CommandCodeAI / CommandCodeAI/command-code
Expose usage + model controls for -p (non-interactive) automation
@vipulgupta2048 đang làm issue này rồi.
Từ ngày 21/5/2026.
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 4k
- Fork
- 350
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Context
We're hitting Command Code from an automated multi-agent orchestrator that fans out coding tasks across several CLI agents (codex CLI, Claude Code, Command Code). The orchestrator picks an adapter per task and records token usage + cost + model for budgeting, audit, and savings telemetry (subscription vs. metered API).
Command Code is in the consideration as the open-weights path. We invoke it via commandcode -p <prompt> --skip-onboarding --yolo -t inside a per-task working directory, which works great — the agent runs, edits files, returns clean stdout. But three control surfaces that exist on codex exec and claude -p are missing on commandcode -p, which forces us to flag those dimensions as "unknown" on every run.
Filing one bundled ask because the three are tightly related (programmatic control of a non-interactive run).
Asks
1. Emit usage in -p output (highest impact for us)
claude -p --output-format json returns:
{
"type": "result",
"total_cost_usd": 0.1969,
"usage": {
"input_tokens": 4,
"output_tokens": 8,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0
},
"num_turns": 1
}
codex exec persists similar info to ~/.codex/sessions/<date>/rollout-*.jsonl (event_msg records with type: 'token_count').
What we'd love from commandcode — either of these works:
- (preferred)
commandcode -p --output-format json <prompt>that returns a final JSON line with at minimum{ tokens: { input, output, cached? }, model, provider, plan_type? }. - (alt) Persist usage in the session JSONL at
~/.commandcode/projects/<slug>/<sessionId>.jsonlso we can post-hoc read it the same way we read codex rollouts. Today the JSONL recordsrole / content / timestamp / parentId / gitBranch / metadata.{source,version,messageId}— nousage/tokens/costfield anywhere across the captured sessions we've inspected.
A surprise we hit: -p --skip-onboarding --yolo -t mode doesn't seem to create a project dir entry at all for our system-tmp-rooted working directories (every other commandcode mode does). If usage lands in the project JSONL we'd also want -p mode to create it.
2. --model <id> flag on commandcode / commandcode -p
codex exec --model gpt-5-codex and claude -p --model sonnet accept a per-invocation model pin. Today the only way to switch Command Code's active model is the interactive /model slash command (or Alt+P quick switch), which is unreachable from -p.
Ask: accept --model <id> on the top-level CLI (and on -p), overriding ~/.commandcode/config.json's model field for the duration of the invocation. A COMMANDCODE_MODEL env var would also work and is arguably easier to wrap.
Use case: an orchestrator that picks the model per task can't currently pin commandcode the way it pins the other CLIs — it has to silently fall back to whatever the operator last selected via /model, which makes the open-weights lane the only one without per-task model control.
3. commandcode status --json (small but useful)
The interactive /context slash command shows context window usage. Surfacing status --json with { user, model, provider, plan_type, context_window, auth: 'oauth'|'api-key' } would let automation:
- detect the active model + plan without parsing TTY output
- record auth mode in session events so it can compute "saved vs. theoretical" cost (we do this for claude via JSON output:
actual=0 / theoretical=0.1969when running on subscription)
What we're shipping in the meantime
To be transparent about the workaround: our adapter currently emits a loud budget.unsupported-dimension skip log on every commandcode run for tokens, usd, tool-calls, and (when set) a per-task model override. We treat the open-weights run as untracked — better than silently fabricating an estimate. Tiktoken-based estimation is a fallback we'd rather avoid since GLM tokenization isn't byte-identical to GPT/Claude tokenizers.
CLI versions tested
commandcode 0.25.13claude --versionandcodex --versionfor shape comparison- macOS Tahoe 26.4.1 (darwin/arm64), Node 25.9.0
Happy to chat / file three separate issues
If you'd prefer three separate issues (-p --output-format json, --model flag, status --json) just say the word. Bundling here for context because they all serve the same automation use case.
Thanks for shipping Command Code — the /init AGENTS.md auto-load and the open-weights option are exactly what we needed for an automated open-weights lane.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Đánh giá
Issue này chưa được đánh giá.