Skip to content

Token-efficiency coverage check: adoption profile plus value-free --client-wiring for every host - #264

Merged
seathatflowsinourveins merged 3 commits into
mainfrom
claude/token-coverage-profile-20260925
Sep 25, 2026
Merged

seathatflowsinourveins merged 3 commits into
mainfrom
claude/token-coverage-profile-20260925

Conversation

@seathatflowsinourveins

Copy link
Copy Markdown
Collaborator

Scope

  • What this PR changes: any host (this WSL2 workstation or the Macs) can now run one value-free command that reports whether the selected token-efficiency practice is applied. It checks two things: the selected tools are present, and they are wired into native Claude Code and Codex, so workflow workers inherit them.
    • A new token-efficiency profile in adoption/manifest.json.
    • An opt-in --client-wiring flag in scripts/adoption_status.py. It emits fixed keys holding only booleans and counts.
  • Base commit: 6752ede5 (current origin/main). Rebased with the hot-file protocol in docs/lanes.md.
  • Lane: lane:foundation
  • Owned paths touched: adoption/manifest.json, adoption/README.md, scripts/adoption_status.py, tests/test_adoption_status.py, docs/token-efficiency-stack.md and .json. Regenerated: new-host-grand-list.{json,md} and manifests/evidence.json.

What "applied" means here. It follows the landscape's current choice for context and usage (catalogs/landscape/foundation.json layers[9].current_choice) plus the layer winners:

  • Required tools: RTK, Context Mode, Repomix, Headroom, TOON, ccusage, QMD, MarkItDown, Serena, SocratiCode, ai-memory, MCPorter, jCodeMunch.
  • Optional reference rows: codebase-memory-mcp, Context Hub, ast-grep, agentsview, otel-tui and OmniRoute.
  • The JSON computes client_wiring.complete from these keys:
    • the Claude RTK hook
    • the ai-memory hook count
    • the Context Mode plugin
    • subagent depth 1
    • the workflow concurrency cap
    • CLAUDE_CODE_EFFORT_LEVEL unset
    • agent teams off
    • project settings
    • Codex RTK instructions
    • the Codex Context Mode plugin
    • the Codex [features] hooks flag (the replacement for the removed plugin_hooks, verified in the codex-rs source)
    • the Codex MCP servers at user or project scope

How this host measures:

Evidence-class table

Claim Evidence class Command
On this workstation, the profile finds 13/13 selected commands and client wiring is complete for the main checkout local_integration (read-only run on this host; no receipt) uv run --no-project --python 3.13 python scripts/adoption_status.py --profile token-efficiency --client-wiring --repo-root <checkout> --json
--client-wiring emits only booleans and counts, never file content. Wired, unwired and malformed fake-HOME fixtures behave as documented. synthetic tests/test_adoption_status.py: 39 tests, 20 before this PR and 19 added; 13/13 hand mutations of the new logic are caught
The Codex hooks feature is stable and on by default; plugin_hooks is removed source_review gh api repos/openai/codex/contents/codex-rs/features/src/lib.rs (+ legacy.rs)

Local commands run

$ uv run … -m unittest tests.test_adoption_status tests.test_adoption_docs_consistency tests.test_new_host_grand_list tests.test_evidence_manifest tests.test_validate
Ran 168 tests … OK (skipped=1)
$ uv run … scripts/validate.py              # passed: 69 components, 5509 hashed files, 147 receipts
$ uv run … scripts/new_host_grand_list.py --check; component_matrix.py --check; build_ecosystem.py --check   # passed / checked / passed
$ uv run … -m unittest      # full suite at the pre-rebase head f2d207e5: 5326 OK, 667 skipped

uv run … stands for uv run --no-project --python 3.13 --with-requirements .github/requirements-ci.txt python.

Review

  • An independent Opus reviewer returned needs_changes with 2 medium and 7 low findings. The repair commit (5e331b24) fixes:
    • the Codex hooks flag;
    • complete, which the JSON now computes;
    • the wording about reading credentials: the check parses the whole client files in-process, emits no value from them and opens no credential store;
    • the baseline test count;
    • the pinned-release note.
  • Residual, not fixed here: the check proves that tools are present, not that they are at their pinned versions. Version evidence still comes from host receipts and each recipe's version command. A follow-up can reuse Bootstraps: declared, bounded version probes instead of --version on every bin entry #251's declared version_probe.
  • Cross-family Codex review was skipped: Codex is at its usage limit until 2026-09-30.
  • A known upstream-semantics gap is recorded in the limitations: tools/token-report/token_manifest.py:385 still derives the hook engine from hooks AND plugin_hooks.

Decision record

None. This PR encodes the existing layers[9].current_choice; no new selection is made.

Host evidence

Not applicable: no evidence/hosts/ change. The Macs can run the same command and record the result by PR.

Checklist

  • No workflow changes.
  • No secrets printed, logged or committed. The check opens no credential store and emits no value from client files.
  • No new paid hosting, subscription or billing surface.
  • Peer-owned files and worktrees preserved.

🤖 Generated with Claude Code

@seathatflowsinourveins seathatflowsinourveins added the lane:foundation Foundation lane: Claude/Codex setup, hosts, memory, RAG, research, workers label Sep 25, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Scout and others added 3 commits September 25, 2026 14:53
…t-wiring

One value-free command shows on any host whether the selected token practice
is installed and wired into both native clients:

  python3 scripts/adoption_status.py --profile token-efficiency --client-wiring --json

- adoption/manifest.json: a token-efficiency profile, labelled drafted and not
  accepted (the manifest has no per-profile status field; the label follows
  macos-arm64-foundation). It encodes the landscape selection: the
  token-efficiency layer's current choice (RTK, Context Mode, Repomix,
  Headroom, TOON, ccusage), the Serena, QMD, MarkItDown, SocratiCode,
  ai-memory and MCPorter winners, and both native clients. The reference-only
  rows (jCodeMunch, ast-grep, codebase-memory-mcp, Context Hub, AgentsView,
  Claude HUD, otel-tui, OmniRoute) stay optional. Bootstrap pins cover 8 of
  14 components on Linux and 6 of 14 on macOS (README table, test-enforced).
- scripts/adoption_status.py: --client-wiring parses the user Claude settings
  and plugin registry, the Codex config.toml, hooks.json and AGENTS.md, and
  the checkout's .claude/settings.json and .codex/config.toml in-process. It
  returns fixed keys with booleans, two hook-event counts or null only, and a
  guard refuses any other shape. It adds no subprocess, never reads
  ~/.claude.json, and checks the effort and agent-teams variables by name.
  Codex MCP servers are reported at user and project scope, because the
  recipes register them per project. The limitations are restated when the
  flag is set; the exit code is unchanged.
- tests/test_adoption_status.py: fake-HOME fixtures (wired, unwired,
  malformed, wrong types, oversized, dangling links, matcher and opt-in edge
  cases), the CLI opt-in, real-manifest profile resolution and a guard
  against drift from the landscape winners. 17 hand mutations are caught.
- docs/token-efficiency-stack.md: a Coverage check section. The .json install
  lines now name repomix 1.18.1 and ccusage 20.0.24, the manifests/stack.json
  pins qualified in recipes/native-upgrades-20260921.md.
- Regenerated docs/new-host-grand-list.md and its JSON with --write and
  re-registered the changed hashed files with register_file.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… scope

Repair round for the independent review of the token-efficiency coverage check.

- scripts/adoption_status.py: codex.hooks_feature_enabled resolves Codex's
  lifecycle-hook feature the way upstream 0.155.1 does (codex-rs/features at
  rust-v0.155.1: "hooks" is Stage::Stable with default_enabled true, the legacy
  alias "codex_hooks" is applied first in sorted key order, so "hooks" wins, and
  plugin_hooks is Stage::Removed). An explicit false, a non-boolean or a
  non-table [features] zeroes the Codex ai-memory hook count, as disableAllHooks
  does for Claude. An unreadable config.toml leaves both null. client_wiring
  gains a computed "complete" that applies the documented rule: every file
  parsed, every boolean true with each Codex server in the user or the project
  config.toml, and both hook counts above zero. Text mode prints it and the
  exit code is unchanged. The docstring and limitations now say the client
  files are parsed whole and in-process, no value is emitted and no credential
  store is opened, and that Codex profiles, project features and command-line
  overrides are not evaluated.
- tests/test_adoption_status.py covers the hooks feature cases (absent, true,
  false, legacy alias, precedence in both file orders, non-boolean, non-table,
  and an unreadable config.toml beside a valid hooks.json) and the complete
  rule. 39 tests: 20 at the base, 17 added by the first commit and 2 here.
  13 of 13 hand mutations of the new logic are caught.
- docs/token-efficiency-stack.md: the uv form is the primary command. Any
  interpreter other than 3.13, or a platform the manifest does not list, keeps
  the top-level status missing with exit 2. "Applied" now requires
  client_wiring.complete plus a separate pinned-version condition (the
  bootstrap's installed-versions.txt, or each recipe's version command), and the
  section says plainly that this command does not establish the pins. The
  optional rows are described as the landscape encodes them. Adds a
  changed-after-v2026.09.24.1 note.
- adoption/README.md: changed-after-v2026.09.24.1 notes in step 3, beside the
  command and in the profile row.
- manifests/evidence.json: re-registered the four changed hashed files with
  register_file.

Not adopted: a version probe inside adoption_status.py (review option 1). The
pin files declare probes for only 8 of the profile's 14 components on Linux and
6 on macOS. The bootstrap already runs them into installed-versions.txt. The
script's documented and tested contract is that it never runs the commands it
checks.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@seathatflowsinourveins
seathatflowsinourveins force-pushed the claude/token-coverage-profile-20260925 branch from 6e2ec43 to ceaede1 Compare September 25, 2026 18:54
seathatflowsinourveins added a commit that referenced this pull request Sep 25, 2026
- Opt-out: set switchModelsOnFlag true and the variable "0". Removing the
  keys does not undo an earlier merge. The client parses the variable
  with M.bool.
- switchModelsOnFlag cannot stop a subagent's fallback. Its reads in
  wpo(), apo() and Spo() are listed.
- The silent-retry lane is armed by the server (model configuration
  convolute_arcades or header x-cc-tender-quilt), not by a client
  experiment.
- The built-in agents that omit CLAUDE.md include Plan.
- Workers returning null: check the transcript for a refusal before
  retrying.
- Correct the population and cutoff for the source-scout figure.
- Mark the client-wiring report as a proposal in PR #264. Rebased
  onto dcd6f0c.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@seathatflowsinourveins

seathatflowsinourveins commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator Author

Counter semantics for the token-practice docs and reporter. This is evidence from #270 (merged), independently reviewed (agree ×4). I haven't edited this PR's files. Please fold in whatever fits at integration.

Receipts, generation 2, on wsl-authoring-20260923, 2026-09-25:

What each counter actually counts:

  • RTK total_saved is ceil(bytes/4) of raw output minus that of filtered output, uncapped (estimate_tokens and track at v0.49.0).
    • It is dominated by outliers. On this host the ten largest commands are 74.4% of 741M, and one grep is 28.7%.
    • Claude Code 2.1.282 shows up to 30,000 characters inline, otherwise a saved file with a preview of at most 2,000 characters. Modelled on that, the net difference is about 1.18% of the headline.
    • Suggestion: label rtk gain as an uncapped upper-bound estimate, not context tokens avoided.
  • Context Mode tokens_saved_lifetime is retained session events × 256 (TOKENS_PER_EVENT, in both the plugin bundle and build/server.js). It is a fixed per-event constant, not bytes kept out. The status line's "MB kept out" uses a different base.
  • jCodeMunch total_tokens_saved is a whole-file bytes/4 counterfactual. On this host all 59,640 come from get_symbol_source since 2026-09-20, which includes acceptance reads.
  • Headroom savings --json returns zeros both when the ledger is empty and when ~/.headroom/savings_events.jsonl does not exist. Check the file's existence before reporting "0 saved". The lifetime field is clamped to 30 days in code (MAX_RETENTION_DAYS = 30).

@seathatflowsinourveins
seathatflowsinourveins merged commit 0fb150f into main Sep 25, 2026
23 checks passed
@seathatflowsinourveins
seathatflowsinourveins deleted the claude/token-coverage-profile-20260925 branch September 25, 2026 19:12
seathatflowsinourveins added a commit that referenced this pull request Sep 25, 2026
- Opt-out: set switchModelsOnFlag true and the variable "0". Removing the
  keys does not undo an earlier merge. The client parses the variable
  with M.bool.
- switchModelsOnFlag cannot stop a subagent's fallback. Its reads in
  wpo(), apo() and Spo() are listed.
- The silent-retry lane is armed by the server (model configuration
  convolute_arcades or header x-cc-tender-quilt), not by a client
  experiment.
- The built-in agents that omit CLAUDE.md include Plan.
- Workers returning null: check the transcript for a refusal before
  retrying.
- Correct the population and cutoff for the source-scout figure.
- Mark the client-wiring report as a proposal in PR #264. Rebased
  onto dcd6f0c.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
seathatflowsinourveins added a commit that referenced this pull request Sep 25, 2026
- The client-wiring check is merged (#264) and does not check the
  variable yet.
- Drop the count of switchModelsOnFlag reads and list them.
- The built-in Explore and Plan bodies cannot be edited; the rule
  reaches them only through a same-name custom agent.
- /config omits the toggle row while the variable is set (verified in
  the client's row builder).
- Rebased onto 5abd17e.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
seathatflowsinourveins added a commit that referenced this pull request Sep 25, 2026
- Opt-out: set switchModelsOnFlag true and the variable "0". Removing the
  keys does not undo an earlier merge. The client parses the variable
  with M.bool.
- switchModelsOnFlag cannot stop a subagent's fallback. Its reads in
  wpo(), apo() and Spo() are listed.
- The silent-retry lane is armed by the server (model configuration
  convolute_arcades or header x-cc-tender-quilt), not by a client
  experiment.
- The built-in agents that omit CLAUDE.md include Plan.
- Workers returning null: check the transcript for a refusal before
  retrying.
- Correct the population and cutoff for the source-scout figure.
- Mark the client-wiring report as a proposal in PR #264. Rebased
  onto dcd6f0c.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
seathatflowsinourveins added a commit that referenced this pull request Sep 25, 2026
- The client-wiring check is merged (#264) and does not check the
  variable yet.
- Drop the count of switchModelsOnFlag reads and list them.
- The built-in Explore and Plan bodies cannot be edited; the rule
  reaches them only through a same-name custom agent.
- /config omits the toggle row while the variable is set (verified in
  the client's row builder).
- Rebased onto 5abd17e.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
seathatflowsinourveins added a commit that referenced this pull request Sep 25, 2026
…uredOutput fields at the top level (#272)

* Portable Claude profile: no silent model fallback, top-level StructuredOutput fields

The settings template now sets CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK=1 and
switchModelsOnFlag false. When a request is flagged, it ends in a refusal
instead of silently re-running on Opus 4.8, in the main thread and in
every subagent. switchModelsOnFlag alone governs only the main thread in
Claude Code 2.1.282. The example user CLAUDE.md asks workers to put
StructuredOutput fields at the top level of the call arguments: in an
interleaved A/B, schema errors fell from 5/30 to 0/30 (p = 0.026). The
dated record in docs/decisions/2026-09-25-model-fallback-guard.md names
the evidence, the alternatives and the overturn conditions. The fallback
variable is undocumented, so that part stays keep-but-compare.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* Resolve the independent review of the fallback-guard record

- Scope: the ultracode recipe's settings file stays unguarded, and the
  omitClaudeMd agents (source-scout, blind-*) and built-in Explore do not
  read the user file.
- Biology flags fall back to Opus 5 as well as cyber flags to Opus 4.8.
- The client gating is stated precisely: WM() gates target selection in
  aHn(), and a silent-retry experiment lane retries only on the refusing
  model.
- availableModels is recorded as documented and subagent-wide. It is
  rejected because excluding versions needs pins that also exclude the
  next Opus release.
- Record template precedence, the hidden /config toggle and the opt-out.
- Add a manual watch command. The catalog has no automated one yet.
- Cite the host-local evidence archive and the result's version scope.
- The example CLAUDE.md says what to do when a worker returns null
  after a safety flag.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* Resolve the second independent review of the fallback-guard record

- Opt-out: set switchModelsOnFlag true and the variable "0". Removing the
  keys does not undo an earlier merge. The client parses the variable
  with M.bool.
- switchModelsOnFlag cannot stop a subagent's fallback. Its reads in
  wpo(), apo() and Spo() are listed.
- The silent-retry lane is armed by the server (model configuration
  convolute_arcades or header x-cc-tender-quilt), not by a client
  experiment.
- The built-in agents that omit CLAUDE.md include Plan.
- Workers returning null: check the transcript for a refusal before
  retrying.
- Correct the population and cutoff for the source-scout figure.
- Mark the client-wiring report as a proposal in PR #264. Rebased
  onto dcd6f0c.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* Resolve the third independent review of the fallback-guard record

- The client-wiring check is merged (#264) and does not check the
  variable yet.
- Drop the count of switchModelsOnFlag reads and list them.
- The built-in Explore and Plan bodies cannot be edited; the rule
  reaches them only through a same-name custom agent.
- /config omits the toggle row while the variable is set (verified in
  the client's row builder).
- Rebased onto 5abd17e.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* Name the dispatching brief as the per-run carrier of the StructuredOutput rule

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* Name the SubagentStart hook as a further persistent carrier of the StructuredOutput rule

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* Record the rebase base 3e4054d

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* Re-register the settings template and CLAUDE.md example hashes

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

---------

Co-authored-by: seathatflowsinourveins <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lane:foundation Foundation lane: Claude/Codex setup, hosts, memory, RAG, research, workers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant