npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@damaall/ccx

v0.1.0

Published

Agent Teams control plane for Claude Code — observability, cost tracking, and team topology reuse

Readme

ccx

Agent Teams control plane for Claude Code.

ccx 是一個唯讀的 CLI 觀測工具,用於即時監控 Claude Code Agent Teams 的運行狀態、成本追蹤、事後報告,以及團隊拓撲重用。

English README


Why

Claude Code 的 Agent Teams 可以同時啟動數十個 agent 並行工作,但缺乏:

  • 即時的成本可視化(跑完才知道花了多少)
  • agent 狀態一覽(誰在工作、誰卡住了)
  • 事後分析(這次 team 的效能如何)
  • 拓撲重用(上次的 team 結構很好,怎麼快速重建)

ccx 填補了這個缺口。

Install

npm install -g @damaall/ccx

或直接用 npx:

npx @damaall/ccx watch

Quick Start

# 監控當前 active team(自動偵測)
ccx watch

# 設定 $10 預算警告
ccx watch --budget 10

# 預算超標時自動送 C-c 給 agent
ccx watch --budget 10 --kill

# 查看所有 teams 和 sessions
ccx ls

# 產生事後報告
ccx report

# 提取 team 拓撲供下次重用
ccx reuse --prompt

Commands

ccx watch [team]

即時 dashboard,追蹤所有 agent 的狀態、token 用量和成本。

ccx watch: e2e-optimization (2h 15m 30s)    Cost: $45.23
────────────────────────────────────────────────────────────────────────
AGENTS                        STATUS      ACTIVE    TOKENS    COST
├─ team-lead (opus)            working     12s       3.2M      $15.40
├─ syntax-fixer (haiku)        working     3s        1.8M      $0.45
├─ regression-guard (opus)     idle        2m30s     500.0k    $0.91
└─ agent-a0cc0a3 (opus)        idle        5m12s     2.1M      $8.30
                               TOTAL                 7.6M      $25.06

TASKS
#1     [done]       Fix syntax errors                          syntax-fixer
#2     [working]    Run regression tests                       regression-guard
#3     [pending]    Final integration check                    ──

Options:

| Flag | Description | |------|-------------| | --budget <usd> | 成本警告閾值(USD) | | --kill | 超過預算時送 C-c 給 agent tmux pane | | --notify | 預算警告時送 OS 通知 | | --stuck-timeout <s> | 標記 agent 為 stuck 的秒數(預設 180) | | --plain | 純文字模式(無 ink UI) |

Features:

  • ink React UI(即時更新,按 q 退出)
  • 自動辨識 agent 名稱(從 JSONL 中的 teammate_id 確定性映射)
  • 同名 agent 自動合併(多輪 session 造成的重複)
  • 預算分級警告(60% / 80% / 90% / 100%)
  • 偵測 team 刪除(30s polling,2 次確認)
  • SIGINT graceful shutdown(自動存 snapshot)
  • Double-tap SIGINT force exit

ccx report [target]

從 saved session 或 live team 產生事後報告。

ccx report                     # auto-detect(最新 session)
ccx report my-team             # 指定 team name
ccx report my-session-id       # 指定 session ID
ccx report e2e-opt             # 前綴匹配
ccx report my-team --md        # Markdown 格式
ccx report my-team --json      # JSON 格式
ccx report my-team --save      # 同時存成 .md 檔案
ccx report my-team --save rpt  # 自訂檔名(rpt-report.md)

三種輸出格式:

  • Terminal(預設):彩色表格,包含 Summary / Agents / Tasks / Alerts
  • Markdown (--md):可直接貼到 PR 或文件裡
  • JSON (--json):供程式化處理

ccx reuse [target]

從 saved session 提取 team 拓撲,生成可直接貼入 Claude Code 的 prompt。

ccx reuse                      # auto-detect 最新 session
ccx reuse my-team              # 指定 team name
ccx reuse my-team --prompt     # 只輸出 prompt(適合 pipe)
ccx reuse my-team --json       # JSON 格式

範例輸出(--prompt):

Create a team called "e2e-optimization" with the following structure:

Team size: 72 agents (36x haiku, 35x opus, 1x sonnet)

Named roles:
- team-lead: opus (lead)
- regression-guard: opus
- syntax-fixer: opus

Worker agents:
- 36x haiku workers
- 31x opus workers

Task examples from previous run:
- Fix syntax errors in generated Go code
- Run regression tests
- Final integration check

ccx ls

列出 active teams 和 saved sessions。

ccx ls                  # 全部
ccx ls --active         # 只看 active teams
ccx ls --sessions       # 只看 saved sessions

How It Works

ccx 是一個唯讀觀測者。它只讀取 Claude Code 的 filesystem,永遠不寫入(唯一例外:--kill 透過 tmux send-keys C-c 終止 agent)。

Data Sources

ccx 讀取 4 個 Claude Code 內部資料來源:

| Source | Path | Content | |--------|------|---------| | Team config | ~/.claude/teams/{team}/config.json | team name, lead session ID, members | | Tasks | ~/.claude/tasks/{team}/*.json | per-task status, owner, subject | | Inboxes | ~/.claude/teams/{team}/inboxes/*.json | agent 間通訊訊息 | | Token usage | ~/.claude/projects/*/subagents/agent-*.jsonl | per-agent JSONL journals(token counts) |

ccx 自己的資料存放在 ~/.ccx/

| Path | Content | |------|---------| | ~/.ccx/sessions/{name}/snapshot.yaml | session snapshots(YAML) |

Architecture

chokidar FileWatcher
  ├─ TeamReader      ─┐
  ├─ TaskReader       │
  ├─ InboxReader      ├─→ StateAggregator ─→ SnapshotManager (500ms debounce)
  └─ CursorReader ────┘         │
       ↓                        ↓
  IdentityResolver     EventEmitter → Dashboard (ink) / PlainMode

CursorReader: byte-offset 差量讀取 JSONL,per-file state machine(UNRESOLVED → RESOLVED)。只累加 token counts + 維護 20-entry ring buffer,不存全部 records。

IdentityResolver: 從 JSONL raw text 中匹配 teammate_id="<name>",確定性映射 agent ID → 人類可讀名稱。不用時間戳 heuristic。

StateAggregator: EventEmitter 架構,解耦 readers 和 consumers。同名 agent 自動合併(多輪 session 造成的重複 JSONL)。

SnapshotManager: 500ms trailing-edge debounce,atomic write(.tmprename())。

Cost Calculation

讀取 JSONL journals 的 token usage,套用 Claude model 定價:

| Model | Input | Output | Cache Write | Cache Read | |-------|-------|--------|-------------|------------| | Opus | $15/M | $75/M | $18.75/M | $1.50/M | | Sonnet | $3/M | $15/M | $3.75/M | $0.30/M | | Haiku | $0.80/M | $4/M | $1.00/M | $0.08/M |

Security

  • Secret redaction: 15 regex patterns 覆蓋 Anthropic / OpenAI / GitHub / AWS / Stripe / Slack keys、Bearer tokens、passwords、private keys、connection strings
  • Snapshot permissions: 目錄 0o700、檔案 0o600
  • Path traversal protection: 名稱驗證 [a-zA-Z0-9._-],最長 128 字元
  • Report redaction: 所有 report 輸出自動過濾 task subject / description / alert message 中的 secrets

Development

git clone https://github.com/DamaAll/ccx.git
cd ccx
npm install

npm run dev -- watch            # 用 tsx 即時運行
npm run dev -- ls               # 測試其他指令
npm test                        # 跑 90 個單元測試
npm run test:watch              # watch mode
npm run lint                    # TypeScript type check
npm run build                   # 編譯到 dist/

Project Structure

src/
  commands/         CLI 指令(watch, report, reuse)
  core/             核心邏輯
    cursor-reader   byte-offset JSONL 差量讀取
    data-source-adapter  zod schema validation
    identity-resolver    agent ID → name 映射
    paths           路徑常數(~/.claude/, ~/.ccx/)
    pricing         token cost 計算
    redact          secret redaction patterns
    session-discovery    subagents 目錄探索
    snapshot-manager     debounced snapshot 寫入
    snapshot-reader      saved session 讀取
    state-aggregator     狀態聚合 + event emitter
    task-reader     task JSON 讀取
    team-reader     team config 讀取
    types           TypeScript 型別定義
    watcher         chokidar 檔案監控 orchestrator
  guard/            budget guard(soft / hard limit)
  report/           report formatters(terminal / markdown / json)
  ui/               ink React 元件(Dashboard, AgentPanel, TaskPanel, etc.)
tests/              90 個單元測試(vitest)

Requirements

  • Node.js >= 18
  • Claude Code with Agent Teams feature(Opus 4.6)

License

MIT