Command Code (cmd), Langbase's coding agent CLI (commandcode.ai, npm command-code).
- Source:
src/providers/command-code.ts - Loading: eager (
src/providers/index.ts) - Test:
tests/providers/command-code.test.ts, fixturetests/fixtures/command-code/(redacted real transcripts)
~/.commandcode/projects/<project-slug>/<session-id>.jsonl. CODEBURN_COMMANDCODE_DIR replaces ~/.commandcode; the CLI itself has no override and follows HOME.
Only <id>.jsonl files are sessions. The CLI writes sidecars next to each one (.checkpoints.jsonl, .prompts.jsonl, .meta.json, .share.json), and discovery skips any file whose name has a second dot. ~/.commandcode/history.jsonl is prompt history and is never read, nor is anything else outside projects/.
JSONL, session format v3:
- First line:
{type: "session", version, id, timestamp, cwd, parentSession?}. - Then
{type: "message", id, parentId, timestamp, message: {role, content, meta: {messageId}}, model?, usage?}.contentis a string or an array oftext,thinking,tool_useandtool_resultblocks. - Assistant lines carry
model(e.g.moonshotai/Kimi-K3,deepseek/deepseek-v4-pro) andusage: {inputTokens, outputTokens, cacheReadTokens, cacheWriteTokens, costUsd}.
One call per assistant message line with usage.
usage.inputTokensincludescacheReadTokens. CodeBurn's input is fresh input, so it storesinputTokens - cacheReadTokens(never below 0). TakinginputTokensas is counts every cache read twice. Checked on real data:inputTokens >= cacheReadTokenson every call, andcostUsdfits one set of per-token rates only when input is taken as cache-inclusive.cacheReadTokensandcacheWriteTokensmap to cache read and cache write.outputTokensalready includes reasoning (no separate count), soreasoningTokensis 0.
costUsd is the dollars Command Code charged for the call (its own rates, e.g. DeepSeek at the discounted price). When it is present, including 0 for free models, it is kept as is with costFromBilling. A call without it is priced from tokens through the shared catalog and marked costIsEstimated; a model id the catalog does not know shows up under codeburn models --unpriced.
command-code:<message.meta.messageId>, a full uuid. The top-level id is only 8 hex characters and unique within one file, so sessions can collide on it; it is used only as a fallback and for turnId. Forking a session copies the parent's message lines verbatim into a new session file, so the key is not scoped to a session.
- Project is the last segment of the session header's
cwd, falling back to the slug directory. - Tool names are Command Code's own (
shell_command,read_file,grep,agent, ...) and are mapped to CodeBurn's names.agentcalls with asubagent_typecount as subagents;activate_skillcounts as a skill.
- Discovery: the
projects/<slug>/<id>.jsonlwalk and the sidecar filter. - Accounting: the input/cache split above. Recheck it against
costUsdif the CLI changes its usage block. - Add a case to
tests/providers/command-code.test.ts; do not mock the filesystem.