Skip to content

feat(cognition): the render receipt names the tool surface's reason and the affordable prompt (card 3026b83e, step 1) - #5122

Merged
joelteply merged 4 commits into
canaryfrom
3026b83e/tool-framing-cost-bounded-by-the-prefill
Oct 19, 2026
Merged

joelteply merged 4 commits into
canaryfrom
3026b83e/tool-framing-cost-bounded-by-the-prefill

Conversation

@joelteply

@joelteply joelteply commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Card 3026b83e (owner Cormac), step 1: observation only. Nothing sent changes. Authorized by root via Codex b545afac. Overlap with Codex's shared-context-budget lane checked and cleared (6a1885f2). Codex independently reviewed a28d803's observation fields (59d82394).

Why

IntelMac, core 6b75b55, 2026-10-16T21:21:14Z: a pass rendered tools 10,542 + framing 2,853 + conversation 5,365 tokens (request 16,206).

  • Its prefill took 609,933 ms, and the lane was held 618,353 ms.
  • The affordable prompt at that moment was 2,836 tokens interactive and 8,509 unattended (prefill_bound, 47.3 t/s fresh).
  • 42 of 45 renders that day sent a 38-tool surface, and delib.context.render could not say which SurfaceReason chose it.

What

Measured

  • source-hygiene ratchets at a28d803 (IntelMac, cargo test -j 2 -p source-hygiene): 32 passed, 0 failed.
  • Not compiled locally: IntelMac doesn't compile the core. CI on this PR is the first compile.

Measured after deploy

Owner Cormac, on IntelMac, within 48 h of the deploy tracker adopting it: the surface_reason distribution and every over_affordable. This answers which arm sends 38 tools on the CPU tier, and it gates step 2.

Publication

Opened with airc work state 3026b83e review --workspace ~/.airc/worktrees/3026b83e-obs (airc #1580, card 52bf7370). The card's canonical claim worktree had landed in the deploy repo's .git at a stale HEAD; both checkouts were left untouched.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

joelteply added a commit that referenced this pull request Oct 17, 2026
…ontextComposition stays coherent

CI on #5122 (job 117275378277, 01:48:45Z) was the first compile of
a28d803 and refused it: ContextComposition derives Default, and tests
build it with ::default(), but the new surface_reason field had no
Default. A default composition has tool_tokens 0, which is what NoTools
means. So NoTools is the default, not a value that would contradict the
composition's cost.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply added a commit that referenced this pull request Oct 18, 2026
…ontextComposition stays coherent

CI on #5122 (job 117275378277, 01:48:45Z) was the first compile of
a28d803 and refused it: ContextComposition derives Default, and tests
build it with ::default(), but the new surface_reason field had no
Default. A default composition has tool_tokens 0, which is what NoTools
means. So NoTools is the default, not a value that would contradict the
composition's cost.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply
joelteply force-pushed the 3026b83e/tool-framing-cost-bounded-by-the-prefill branch from 371d559 to 510cb88 Compare October 18, 2026 22:59
@github-actions github-actions Bot added size: M and removed size: S labels Oct 18, 2026
@joelteply

Copy link
Copy Markdown
Contributor Author

PASSED at 510cb88, with CI as the compile check. Reviewed by Fable (M5), 2026-10-18; I read it and compiled nothing.

Verified:

  • SurfaceReason moved whole into cognition/tool_surface.rs and is re-exported to its callers, adding Default = NoTools with its reason stated.
  • over_affordable_receipt is observation only, and its affordable number comes from the one ContextBudget::from_window. It doesn't re-derive the TTFT bound.
  • The 8 deleted doc lines are truly orphaned. On canary, llm_deliberation_faculty.rs:4090 stacks "How many tool categories…" and "Chars-per-token assumed by the window guard…" doc headers with no item under either; GUARD_CHARS_PER_TOKEN lives in deliberation_budget.
  • The faculty file goes −16.

🤖 Generated with Claude Code

joelteply and others added 4 commits October 18, 2026 19:46
…nd the affordable prompt (card 3026b83e, step 1)

Observation only; nothing sent changes.

IntelMac, core 6b75b55, 2026-10-16T21:21:14Z: a pass rendered tools
10,542 + framing 2,853 + conversation 5,365 tokens. Its prefill held the
only lane 609,933 ms, against an affordable prompt of 2,836 tokens
interactive and 8,509 unattended (prefill_bound, 47.3 t/s fresh). 42 of
45 renders that day sent a 38-tool surface, yet delib.context.render
could not say which SurfaceReason chose it.

- ContextBudget::affordable_tokens(): the whole prompt the window
  affords, from the same total every share is a fraction of. No new
  constant.
- ContextComposition carries the SelectedSurface's reason; both
  delib.context.render sites record surface_reason and
  affordable_tokens.
- delib.tool_surface.over_affordable fires when tools + framing alone
  exceed that prompt.
- Also moves the `1/denom` doc comment back onto `fraction`; #5112's
  is_known insert had split it from its fn.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…ontextComposition stays coherent

CI on #5122 (job 117275378277, 01:48:45Z) was the first compile of
a28d803 and refused it: ContextComposition derives Default, and tests
build it with ::default(), but the new surface_reason field had no
Default. A default composition has tool_tokens 0, which is what NoTools
means. So NoTools is the default, not a value that would contradict the
composition's cost.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…n/tool_surface.rs (card 3026b83e)

SurfaceReason (why a turn's tool surface is what it is) and the new
over-affordable receipt leave the 12,000-line deliberation faculty for
their own module. The faculty re-exports SurfaceReason and makes one call.
Also removes 8 orphan doc lines glued onto SurfaceReason's doc: the text
of long-deleted constants, one a duplicate of GUARD_CHARS_PER_TOKEN's doc
in deliberation_budget.rs.

Net: the faculty file shrinks by 16 lines instead of growing by 33
(source-hygiene file_size, plan goal 4). Behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply
joelteply force-pushed the 3026b83e/tool-framing-cost-bounded-by-the-prefill branch from 510cb88 to 3ae882b Compare October 19, 2026 00:46
@joelteply

Copy link
Copy Markdown
Contributor Author

PASSED at 3ae882b (the rebase). Re-verified by Fable.

  • Baseline: an independent git count of lines past 1,000 across continuum-core/src at this head gives exactly 159,447, the constant's value.
  • Diff: the PR is the same four files I reviewed at 510cb88, with the same line counts, plus the one baseline line.

Auto-merge is set, pinned to this head.

🤖 Generated with Claude Code

@joelteply
joelteply enabled auto-merge (squash) October 19, 2026 00:47
@joelteply
joelteply merged commit 769df97 into canary Oct 19, 2026
9 checks passed
@joelteply
joelteply deleted the 3026b83e/tool-framing-cost-bounded-by-the-prefill branch October 19, 2026 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant