Brian Munene Mwirigi

CostHQ

AI 智能体v4.0.0
作者:Brian Munene Mwirigi更新于 2026-06-09共 35 个版本 · 最新版本发布于 2026-06-09costhq@clawhub_brian-mwirigi/costhq
上下文管理记忆增强工具调用#Git

据 AlphaMoat 统计,截至 2026-09,CostHQ 累计下载 4,289 次、获 3 个星标,在全部 5,078 个 AI 技能中排名第 2,301 位,在「AI 智能体」分类(969 个)中排名第 444 位。

累计安装
134
累计下载
4,289
星标
3
全站排名
#2,301
全站前 46% · 「AI 智能体」前 46%
平台累计安装累计下载星标评论
ClawHub ↗1344,2893-
SkillHub ↗1344,1263—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

该工具可记录会话与 AI 使用情况并提供仪表板;语义缓存代理会拦截 API 调用,可能缓存提示词或响应。

资料发布于 2026-10-29

可以用来做什么

  • 适合需要查看代理用量、预算、文件活动和会话分析的开发团队。

什么时候用

  • 在接受监控的仓库中使用并审阅收集的数据;未确认缓存保留与访问控制前,不要经由代理发送机密或客户数据。

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

请概述如何用 CostHQ 跟踪开发任务,并指出启用语义缓存代理前需要审查的数据处理事项。

月度数据趋势

累计下载4,289
3,2463,8064,3662026-05 · 累计下载 3,3232026-06 · 累计下载 3,5662026-07 · 累计下载 3,9012026-08 · 累计下载 4,1052026-09 · 累计下载 4,28926-0526-09
星标3
2342026-05 · 星标 32026-06 · 星标 32026-07 · 星标 32026-08 · 星标 32026-09 · 星标 326-0526-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-094,289—3
2026-084,105+5.2%3
2026-073,901+9.4%3
2026-063,566+7.3%3
2026-053,323—3

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

5.5 KB · ClawHub v4.0.0
---
name: costhq
license: MIT-0
description: Track agent session costs, file changes, and git commits with CostHQ. Enforces budget limits, tracks local models, and provides Enterprise SOC2 audit trails via a web dashboard. v3.3.0 - Enterprise SOC2 Audit Logging and Local Models.
metadata: {"openclaw": {"homepage": "https://github.com/brian-mwirigi/costhq", "requires": {"bins": ["cs"]}, "install": [{"id": "npm", "kind": "node", "package": "costhq", "bins": ["cs"], "label": "Install costhq (npm)"}]}}
---

# Session Cost Tracking (CostHQ)

Track agent session costs, file changes, and git commits. Enforces budget limits, tracks local models (Ollama, vLLM), and provides detailed session analytics with a full web dashboard and tamper-evident SOC2 audit logging for Enterprise users.
展开全部(共 134 行)

**Latest: v4.0.0** - Added Semantic Caching Proxy and Granular Session Termination.

📦 [npm](https://www.npmjs.com/package/costhq) • ⭐ [GitHub](https://github.com/brian-mwirigi/costhq) • 📝 [Changelog](https://github.com/brian-mwirigi/costhq/blob/main/CHANGELOG.md)

## Installation

```bash
# 1. Install the CLI globally from npm
npm install -g costhq

# 2. Install the OpenClaw skill
clawhub install costhq
```

After installing, the `cs` command is available globally. The OpenClaw agent will automatically use it to track sessions.

> **Requirements:** Node.js 18+ and C/C++ build tools (needed to compile the embedded SQLite module).
>
> | OS | Install build tools |
> |---|---|
> | **Ubuntu/Debian** | `sudo apt-get install -y build-essential python3` |
> | **macOS** | `xcode-select --install` |
> | **Windows** | `npm install -g windows-build-tools` or install Visual Studio Build Tools |
> | **Alpine** | `apk add build-base python3` |
>
> Data is stored locally at `~/.costhq/sessions.db` (or `~/.CostHQ`).

## When to use

- **Always** start a tracked session at the beginning of a multi-step task
- **Always** log AI usage after each API call you make
- **Always** end the session when the task is complete
- Use `cs dashboard` to review session data, set up local models, or verify the audit trail (Enterprise).

## Commands

### Start tracking
```bash
# Agent mode (always use --json for structured output):
cs start "task description" --json --close-stale

# Resume if a session was left open (e.g. after a crash):
cs start "task description" --json --resume
```

### Log AI usage (after each API call)
```bash
# Standard cloud model (cost auto-calculated):
cs log-ai -p anthropic -m claude-sonnet-4 --prompt-tokens 8000 --completion-tokens 2000 --json

# Local model with compute duration (NEW in v3.3.0):
# Use --duration in seconds (120) or string (2m30s). Cost is based on registered $/hr rate.
cs log-ai -p ollama -m llama3 --tokens 4500 --duration 2m30s --local --json

# With all fields:
cs log-ai -p openai -m gpt-4o --prompt-tokens 5000 --completion-tokens 1500 -c 0.04 --agent "Research Agent" --json
```

**Agent Name:** Use `--agent "Agent Name"` to track which agent performed the work.
**Local Models:** You can track self-hosted models (Ollama, llama.cpp, vLLM) by registering a GPU hourly rate in the dashboard. Use `--duration` and `--local` when logging.

### Check current status
```bash
cs status --json
```

### End session and get summary
```bash
cs end -n "completion notes" --json
```
Ending the session automatically logs an audit event (Enterprise) and scans git for files/commits.

### Web Dashboard
```bash
cs dashboard
```
The dashboard shows:
- **Overview** — KPIs, daily trends, cost velocity, and the Semantic Caching Proxy toggle.
- **Command Center** — Real-time CLI execution and granular termination of individual sessions.
- **Sessions** — searchable/sortable table, per-session details.
- **Local Models** — Register compute rates ($/hr) for Ollama, vLLM, etc.
- **Compliance** — View the tamper-evident cryptographic SOC2 audit chain and configure Team Identities (Enterprise only).
- **Pro Ops** — Manage licensing, PDF exports, and sync features.

### Semantic Caching Proxy
To save money, CostHQ includes a Semantic Caching Proxy that intercepts API calls and returns cached responses for identical requests:
```bash
cs proxy start --port 3739
```
Or toggle it directly from the **Overview** page in the dashboard. Route your tools via `OPENAI_BASE_URL=http://127.0.0.1:3739/openai/v1`.

### View historical stats and details
```bash
cs show --json --files --commits
cs stats --json
cs export --format json --limit 10
```

### Add notes / annotations
```bash
cs note "Tests passing, moving to cleanup" --json
```

## Agent Workflow

Agents should **always** use `--json` on every command for structured, parseable output.

1. At task start: `cs start "Fix authentication bug" --json --close-stale`
2. Add context notes: `cs note "analyzing auth flow" --json`
3. After each AI call: `cs log-ai -p anthropic -m claude-sonnet-4 --prompt-tokens 800 --completion-tokens 200 --agent "Bug Fixer" --json`
4. If using a local model: `cs log-ai -p ollama -m mistral --tokens 1000 --duration 45s --local --json`
5. At task end: `cs end -n "Fixed the auth bug" --json`

## Budget & Pricing
- Standard pricing is configurable via `cs pricing set my-model 5.00 15.00`.
- Local model pricing (compute-based) is configured in the `cs dashboard` under **Local Models**.
- Check `cs status --json` before expensive operations.

## Important
- **Always** use `--json` on every command — agents must use structured output.
- Use `--close-stale` on `cs start` to clear crashed sessions.
- In Enterprise mode, a cryptographic hash chain automatically logs session starts, ends, data resets, and AI usage.

「AI 智能体」分类下的热门技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。