OpenProgram Docs

Third-Party Harnesses

Claude Code and Codex write every session to files on this computer. OpenProgram reads those files and shows the sessions, tokens and estimated cost, plus the Codex plan quota its app-server last reported.

Reading changes no harness's configuration, sits in no request path and sends nothing anywhere. Running a harness on OpenProgram's models is the Model Gateway.

PartWhere
Readersopenprogram/models/usage/harnesses/claude_code.py, codex.py
Incremental readingopenprogram/state/store/appended_lines.py
Indexopenprogram/models/usage/harnesses/store.py, <state>/harnesses.db
Pricesopenprogram/models/usage/harnesses/pricing.py
Reportopenprogram/models/usage/harnesses/report.py, GET /api/usage/harnesses
Pageapps/web/components/settings/third-party-harnesses/

Decisions and the peers they come from

magpie (yetone/magpie) reads the same files beside its gateway; Paseo (getpaseo/paseo) lists them to import sessions and shows plan quota; T3 Code (pingdotgg/t3code) does both and prices every call.

QuestionmagpiePaseoT3 CodeOpenProgram
Subagent filesRead, counted toward the parentSkippedReadRead, counted toward the parent
Resuming a fileOffset, checked by 16 sampled windowsNo offsetsOffset, checked by the 64 bytes before itT3 Code's check: a rewrite anywhere before the offset is caught
Counting a call onceInside one file, in a window of about a thousand messagesNot countedOne key across all filesOne key across all files, oldest file first
Price sourcemodels.devNoneLiteLLMmodels.dev, the catalogue OpenProgram already uses
Long-context tierIgnored—AppliedApplied
Deleted transcriptsDropped—KeptKept, 92 days
Codex quotaLive endpointLive endpointLive endpointWhat Codex reports: its app-server's account/rateLimits/read at start, then account/rateLimits/updated, or its rollout files' rate_limits, whichever is newer
Claude quotaLive endpointClaude Code's sign-inClaude Code's sign-inNot shown
When it readsPolls every 10–15 sOn requestOn requestAt Worker start, then when the page asks
Which app started a sessionNot shownNot shownNot shownShown

Claude quota is not shown because reading it means using Claude Code's sign-in against Anthropic's usage endpoint; OpenProgram reaches Anthropic only through the official API with an API key.

Which files

HarnessRead
Claude Code$CLAUDE_CONFIG_DIR or ~/.claude: projects/<folder>/<session>.jsonl, and every *.jsonl under <session>/subagents/ except a workflow's journal.jsonl
Codex$CODEX_HOME or ~/.codex: rollout-*.jsonl and rollout-*.jsonl.zst under sessions/ and archived_sessions/; names from session_index.jsonl

The first scan skips files last changed more than 92 days ago. A home reached twice through a link is read once.

Reading only what was appended

Mark
Per file: size, modification time, the offset after its last complete line, and a hash of the 64 bytes before that offset.
Resume
A file that grew and whose 64 bytes still match is read from the offset; one that shrank or changed is read from the start.
Partial line
A last line without its newline waits for the next scan.
Archive
A zstd archive is read whole, and again only when its size or time changes.
Markers
A line is parsed only when it holds a marker ("usage", token_count, a title record), so tool output and images are skipped as bytes.
Timing
The Worker scans at start, in the background, and again when the page asks and the last scan is older than 5 seconds; one scan at a time. The open page asks every 10 seconds.

On this computer the first scan, 8.6 GB of Claude Code files and 4.7 GB of Codex rollouts, took 37 seconds; the next took 0.04 seconds, and a 30-day report 0.2 seconds.

Counting each call once

HarnessOne call is
Claude CodeAn assistant line with message.usage, keyed message.id + requestId. Claude Code repeats the usage on each content block and copies lines into resumed and forked sessions; copies keep the largest value of each token kind and the earliest time. Model <synthetic> is not a call.
CodexA token_usage_record, keyed by its response_id. A file without them counts each token_count's last_token_usage, skipping one whose running total did not move, keyed by its time and size so a fork's copied history counts once.
Tokens
Input without cache, cache read, cache write (5-minute and 1-hour apart for Claude), output. Codex input is input − cached − cache_write; reasoning is inside output.
Model
Claude message.model; Codex turn_context.model.
Speed
Claude usage.speed; Codex service_tier priority or fast.
App
Claude entrypoint (cli, claude-desktop, sdk-ts, …); Codex session_meta.originator. It tells sessions a person ran from sessions another app drove through an SDK.

Sessions

FieldFrom
TitleClaude: the last custom-title. Codex: the newest name in session_index.jsonl. Else the first prompt, cut to 160 characters, skipping meta, sidechain, tool results and Codex's preamble (Paseo's rules).
PlaceWorking folder and git branch
TimeFirst and last call
Continuecd <folder> && claude --resume <id> or codex resume <id>, copied (magpie)

Calls stay after their file is deleted, since Claude Code deletes its own transcripts after 30 days, and are removed after 92 days.

Price

The cost is the calls at API list prices, labelled an API estimate: it is not the subscription bill. Prices are applied when the page asks, grouped in SQL by model, speed and tier, so a catalogue update reprices history without a rescan.

RulePrice
BaseInput, output, cache read, cache write per million tokens
1-hour cache writeTwice the input price, Anthropic models only (magpie once leaked this rule onto OpenAI models)
Long contextA prompt (input + cache read + cache write) over the model's tier prices all its tokens at the tier
FastThe model's fast price
Unknown modelTokens count, cost does not; the total reads $12.40+. Never priced from a similar name.

The page

Settings → Third-Party Harnesses (/settings/harnesses), beside Token Usage and apart from it, so a harness's cost never enters OpenProgram's own totals or budgets. It was chosen over a source switch on Token Usage because it puts the harnesses side by side.

PartShows
A card per harnessSessions, tokens, output and the API estimate for 30 days; for Codex each plan window as a meter with its reset, credits and when the app-server reported it
Daily tokensStacked bars, one colour per harness
SessionsFiltered by harness and search: title; folder, branch, models, app, last activity; tokens and calls; estimate; a copy button for the continue command. 20 shown, then all.
By model, Started fromTables with the harness on each row
ReadingThe usage.third_party_harnesses switch, on by default; magpie asks per harness instead

Implementation status

Claude Code and Codex are read. Gemini CLI (~/.gemini/tmp/*/chats/), OpenCode (its SQLite store, read only) and Pi are next with the same reader shape. Importing a harness session into a conversation and driving the harnesses (Claude Agent SDK, codex app-server, ACP for the rest) are separate steps.

Last updated · 2026-11-30