The session context report shows what the hooks injected into one session, per mechanism and per agent (root and every subagent), in chars and tokens.
Open it from the config server's Sessions → context list: the peek sessions of every registered repo, or the picked one, by week and local day. Only each week's newest day is open, a day's label toggles it, and each day shows three rows until "show all".
A row's title opens the report at /sessions-report/<id>; the row also links its peek view when a peek dashboard is configured, and its mined record when one exists. Download .md gives the report as markdown. Injecting hooks: Context system.
Every injection, as the transcript recorded it reaching the model.
| Source | Counted |
|---|---|
| Hook text | Inline global and skill context, plan-mode context, sessiontitle and tool-policy lines, ACDSL read-hook rules, harness AGENTS.md loads. |
| Reads | Successful Read results of injected context-required files and language guides. |
| Projection blocks | ACDSL projection blocks in transcripts recorded while the hook still wrote them. |
| Other | Context-pack reads and Agent prompts. |
| Codex sessions | Their AGENTS.md instructions turn, environment context and plugin list. |
| Not counted | Allow-only hook output (a JSON decision without additionalContext): it never reaches the model. |
A projection block counts only where acdsl project -file writes it: the file's first line, after a #! line or closed front matter, in that file's Read result. Claude sessions since the read-context change carry none; their rules show under Hook injections as acdsl-context. A marker anywhere else is a quote, not an injection: a file or transcript mentioning one, Grep, Bash or MCP output, or a Read starting below the file's head.
Each section but Plan-time rules is one table, one row per subject: a file, a skill, a projected file, a prompt, a hook and its subject. A row sums over the selected agents and shows the agents (the name for one, N agents for several), the injection or read count, and one size figure. Rows sort by tokens, then chars, heaviest first; a table wider than its section scrolls sideways inside it.
| Section | Injector in its header | Notes |
|---|---|---|
| SessionStart | global-context | |
| Skill context | skill-context | The header carries the skill version, /<skill> v<version>: the version the session invoked. |
| ACDSL projections | acdsl | |
| Plan-time rules | acdsl project -plan | A grid of id families, not a table. |
| Context files read | Read and read-gate | |
| Subagent prompts | Agent | No count column. |
| Hook injections | Its three largest hooks by tokens |
| Feature | Behaviour |
|---|---|
| Tokens / chars switch | Beside Expand all: off for tokens (default), on for chars. Picks the figure of the Ingested context block (agent table, section headers, rows); the peek tiles and the Invoked skills table keep theirs. The browser remembers the choice. |
| Row detail | A click opens it underneath: the per-agent split, id families and paths; SessionStart, prompt and hook rows add the injected text (first 4 000 characters). |
| Repeated reads | One row per file, with its read count and the union of the lines returned (lines 1–450, 901–1327). |
| Hook subject | The AGENTS.md path for harness; the governed file for acdsl-context (the text after ACDSL rules governing); the first line, cut at 40 characters, for the rest: sessiontitle, tool-policy, worktree, heartbeat, else the hook event. planmode-context and codex rows show the item label. |
A guide counts as read in full when an agent's Reads cover line 1 to the guide's end as the session saw it: the highest line any agent's Read of that path returned. The read gate makes every agent read a governed guide to its end, so no file on disk is consulted and closed sessions are judged like live ones.
A row reads read in full, lines a–b of N for a single partial reader, or k of n agents in full.
The agent query parameter selects whose context the page shows; the chips and agent-table rows link to its values.
| Value | Shows |
|---|---|
| (absent) | Every agent. |
| root | The root agent. |
| type:<agent type> | Every agent of that type. |
| id:<agent id> | One agent. |
The server computes every section, count, size badge, the total row, pending notice, touched files and markdown download for the selection only. The agent table still lists every agent, dimming those outside it. Filter-bar links keep the selection, and the selection keeps the filter. Peek's tiles (runtime, cost, tokens, cache) stay session-wide.
Invoked skills belong to the root and show only when it is selected: one row per peek skill_invoked event, with start and end from peek's per-skill runs. An open run shows no end; a session peek no longer serves shows none.
Above Invoked skills, one row per switchable feature, from the gate's record ~/.claude/tool-policy/state/<id>.json; switched with #disable and #enable (Permissions § Approvals).
| Column | Shows |
|---|---|
| Feature | The catalog in help order, then every language-guide member the record names. Clicking the name opens its history: each disable and enable, in the server's time zone. |
| Hook | The hook behind it. |
| Tags | The injection tags it feeds. |
| State | on, off or was off. |
| Changes | Number of changes. |
A feature that is off, or was ever disabled, puts ⚠ beside every tag it feeds, in section headers and hook rows, with a hint naming the feature and its disable times; re-enabling keeps the mark. skill:* and hb feed no section.
The gate appends these events from 2026-10-13 on; older records carry only the off set.
Codex text is counted offline with OpenAI's o200k_base tokenizer: exact for the gpt-5 and o-series families, ≈ for others. Claude text goes to Anthropic's count-tokens endpoint, which needs an API key, so counting is off by default.
Enable it (macOS only):
In the Anthropic Console, create a dedicated workspace with the lowest monthly spend limit and an API key scoped to it. count_tokens is free; the limit caps a leaked key.
macOS: the login keychain; the value is prompted, never typed on the command line.
security add-generic-password -s com.smine.configserver -a anthropic-api-key -w
Windows: a generic Credential Manager entry.
cmdkey /generic:com.smine.configserver/anthropic-api-key /user:anthropic-api-key /pass:<key>
A dev server reads the same setting from its dev home's install record.
smine-rules settings set routines.count_tokens keychain
| Safeguard | Value |
|---|---|
| Endpoint | One, pinned. |
| Rate | 30 calls per minute. |
| Per report | At most 200 uncached items. |
| Item size | Items over 200 000 characters are skipped. |
| Breaker | Three consecutive auth, rate or server errors pause counting until restart. |
| Cache | Content-addressed, at ~/.claude/context-report/token-cache.json. |
| Key | Never in a log, error or page. |
| Unavailable | A missing keychain item or Credential Manager entry, a locked keychain or another platform: one notice on the report, token column empty. |
The page never waits for the API: it renders with the cached counts and shows the rest as pending. One background run per session counts them: identical texts once, 30 API calls per minute, 200 injections per run, two minutes at most.
The page polls /sessions-report/{id}/counting and reloads once when the run has finished; anything still pending is counted on the next manual reload. Texts over the size limit show as skipped.
make skill-render counts each skill's deployed body (SKILL.md without frontmatter) into the tokens field of the newest changelog row in <leaf>.cue when the keychain item is readable; otherwise it prints one warning line and leaves the row untouched. The invoked-skills table looks the count up by version: the one the skill-context header recorded, else the one deployed now, marked ≈.
Prints a session's record as JSON (smine-batch's sessions[].context), tokens uncounted.
make context-record ARGS="~/.claude/projects/<munged-cwd>/<session>.jsonl [ctx-dir]"