Repository navigation
context-mode alignment: credential twins, order-keeping settings merge and practice docs (fix plan steps 7-8) - #374
Conversation
Unit
|
f6f0160 to
8d3e3b5
Compare
|
Trading-lane ack (lane:shared), 2026-09-27, at 8d3e3b5.
Merge on green CI, after #376. It will need one more manifest replay then. 🤖 Generated with Claude Code |
…e and practice docs (fix plan steps 7-8) Replayed onto main 881164e (after #364 and #375) with a 3-way squash. Main had changed three of this PR's files: - The settings template and the macOS page merged cleanly; the template keeps #364's OTEL_METRICS_INCLUDE_SESSION_ID and this PR's 11 Read(**/...) twins. - adoption/bootstrap.md conflicted on one note: it keeps this PR's extended settings-template sentence, followed by #364's writer-identity paragraph. manifests/evidence.json was re-registered, and the matrix and grand list were regenerated. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
8d3e3b5 to
a4a0942
Compare
|
Trading-lane ack confirmed. This PR doesn't touch the trading lane, and it strengthens the paper-broker credential boundary. Scope: a read-only look at head
|
Scope
Read(**/…)twins of the credential deny rules, which Context Mode 1.0.169's server-side path check needs; the settings applier now keeps rule order when it merges; and the handbook, recipe, bootstrap, token-practice and example-workflow docs describe the aligned practice and the upstream-intended behaviour at the reviewed revision, with pinned-source citations.8de669dae57425bd5d1597ac25f6f661e592e4a6(rebased onto it; written against015c4702and rebased twice, at59dfe49fand4a32e646)lane:shared(manifests/evidence.jsonandadoption/*change). Lane consolidation: on 2026-09-26 the user shut down the other lane sessions and assigned this work to the workstation coordinator ("no other peers live, i shut them with the token save repos install into our native workflow and github workflow , harness update and sota foundation of our session as main task"); this quote stands in for the trading lane's ack..claude/settings.json,adoption/templates/claude.settings.template.json,tools/adoption/apply_claude_settings.py,adoption/bootstrap.md,adoption/README.md,adoption/platforms/macos-arm64.md,docs/secret-storage.md,docs/token-session-handbook.md,docs/token-practice.md,docs/token-efficiency-stack.md,docs/token-efficiency-stack.json,recipes/README.md,examples/claude-native/workflows/README.md,tools/token-report/token_manifest.py, tests,manifests/evidence.json(re-registration). This touchesadoption/templatesand new-host pages: hold the merge during a release window.Step 7, credential twins. Context Mode 1.0.169 compiles a Read glob literally, without expanding
~/or//, and tests it against a path's raw, resolved and canonical absolute forms (src/security.ts:101-135, 616-655), while Claude Code bounds**/to the current directory. Each form is inert in the other engine, so each of the nine~////store rules and the two.envrules gets a**/twin right after it; the.envtwins sit beforeRead(!.env.example)andRead(!.env.*.example), because a!carve-out reaches only the rules listed before it.apply_claude_settings.pyused to append a missing template entry at the end, which would put the twins after a host's carve-outs and deny.env.exampleagain; it now inserts it after its nearest template neighbour already present (else before the next one, else at the end).docs/secret-storage.mdcarries the twins in its hand-merge block, the reason, and thectx_execute/ctx_batch_executecode-read residual (MCP servers run outside the built-in sandbox).Step 8, practice docs. Patch A2 regenerated at this base, then reworded source-anchored: the handbook subsection "Context Mode executor and session store" (linked from the tool table) gives coordinators, children and Codex workers the working rules: writes persist; which directory code runs in; files outside the server root (no
Read(...)allow rules;ctx_indexthenctx_search, native Read, or onectx_execute); the batchNODE_OPTIONSprefix; MCP calls on Claude Code (the baremcp__matcher is compared as an exact string; no local capture hook); Codex workers (user-scopestart.mjsserver,-Cper worker, deny parity throughCLAUDE_PROJECT_DIR, nevercontext-mode upgrade); session memory, retention, compaction and settings; and the label forctx_statsfigures. Every quotedctx_statsfigure carries that label (row 24b).docs/token-practice.mdseparates the persistedtokens_saved/tokens_saved_lifetimefrom the renderedbytes_avoided, and the token report's boundary text says the same. The bootstrap step 4a and handbook registry checks accept a default-branch context-mode install only whengh api repos/mksglu/context-mode/compare/<reviewed>...<installed>reportsaheadwithstats.jsonas the only changed file. The recipe's project-scoped Codex form addsdefault_tools_approval_mode = "approve"andCLAUDE_PROJECT_DIR, as upstreamstart.mjssets, and names the user-scope form as the default (D3 remainder). The example workflows README replaces "Context Mode has no child hook" with a dated note (D1). D4 goes in the handbook only;docs/ultracode-token-routing-20260921.mdis a dated receipt guide and is unchanged.D2, u3 bridge. Nothing to withdraw: no remote branch or PR carries it, the local branch
claude/context-mode-ultracode-children-20260926points atca8e37f1, an ancestor of main with no commits of its own, and the bridge exists only as uncommitted files in a scratch worktree (removing that worktree is its owner's call). The onlycontext-mode-bridgepaths on main are the unrelated wave-2 MCPorter receipt.Nothing was filed, commented on or opened upstream. Upstream issue numbers in the docs are read-only references. No host configuration was edited; the host steps (plugin reinstall, Codex binding, user-settings twins, pinned-checkout restore) are applied later by the coordinator.
SOTA sources
mksglu/context-modev1.0.169 at the reviewed revision6f0cc6841c687e754059f36714a11233fda1a02b(read withgit show 6f0cc684:<path>):src/security.ts:101-135, 406-487, 616-655, 743-783(literal Read globs, raw/resolved/canonical candidates, allow rules through the deny matcher, no!handling);src/server.ts:1032-1052, 1111-1150, 1164-1209, 1731, 1744-1750, 2118, 2327, 3779-3789, 4465;src/executor.ts:290-331, 406(Rust compiles and runs in the temporary directory);start.mjs:38-51;src/cli.ts:258-261;.codex-plugin/mcp.json:3-10;hooks/hooks.json:6, 73, 82, 91, 100;src/adapters/claude-code/hooks.ts:41-54;src/adapters/codex/index.ts:80-99, 879-887;hooks/pretooluse.mjs:163-172;hooks/core/routing.mjs:28-29, 121-144, 666-668, 839-871, 892-942, 993-995;hooks/posttooluse.mjs:94-141, 224;hooks/routing-block.mjs:46-52;hooks/sessionstart.mjs:49, 166, 285-306;hooks/codex/sessionstart.mjs:66-104;hooks/session-helpers.mjs:78-92, 364-368, 391-427;hooks/session-directive.mjs:59;hooks/userpromptsubmit.mjs:64;src/session/db.ts:639, 970-983, 1096-1097;src/session/extract.ts:24;src/session/snapshot.ts:30, 470;src/session/analytics.ts:1025-1034, 2173-2180, 2950-2956;src/session/retrieval-marker.ts:4-8;README.md:1294, 1305, 1392, 1559-1575;skills/context-mode/SKILL.md:238, 254, 257.openai/codexrust-v0.157.1:codex-rs/hooks/src/events/common.rs:137-152, 169-173(exact matchers compared per alternative);codex-rs/core/src/mcp_tool_call.rs:1610-1614(approval refusal under policynever).**/bound to the current directory,!carve-outs reach only earlier rules of the same source, symlink rules for allow and deny), hooks (matcher patterns and MCP tools; hooks in subagents;transcript_pathvsagent_transcript_path), sandboxing and sandbox environments (the built-in sandbox covers Bash, PowerShell and Monitor; MCP servers run on the host).cm-deep/PLAN.mdsteps 7-8 and section 4,cm-audit/FINAL.mdsections 2-3.Evidence-class table
hooks/security.bundle.mjs, byte-identical to the pin) denies every store-shaped fake path,.envand.env.local, and passesin.txt; with origin/main's list it passes all of themlocal_integration(unchanged upstream code on fake paths), no committed receipt yetnode check.mjsover both lists (scratchcm-align-live/twin-check/check.out)--settingsoverlay reads.env.exampleand denies.env.localnative_proven)claude -pSonnet 5 headless, 2 Read calls (scratchcm-align-live/live-order/live-order.out)local_integrationapply_claude_settings.py --dry-runon a scratch host file with both appliers (scratchapplier_cli_check.out);tests/test_apply_claude_settings.pyBash(echo DENYPROBE*)deny and is not refused for approval; withoutapproveevery call is refused ("requires approval, but approval policy is never"); withoutCLAUDE_PROJECT_DIRthe deny probe runsnative_proven)codex exec --ephemeral -s workspace-write -C <other dir>(codex-cli 0.157.1) with-coverrides, bare CLI from a copy of the pinned npm install, adversaryCODEX_HOME(scratchcm-align-live/runs/SUMMARY.txt); host config, hooks, cache and npm files unchangedokfor the reviewed revision and for astats.json-onlyaheadhead, andMISMATCHfor any other compare result, a failed compare, a tag-installed plugin, or no installlocal_integrationRevisionCheckByContentTestsruns the documented Python with aghstand-in and a scratch registrysource_reviewProvider usage of the live checks, per counter and not summed across counters: Codex RF input 70,347, cached 64,128, output 500, reasoning 90; RFNA 70,168 / 64,000 / 390 / 35; RFNC 35,062 / 29,312 / 430 / 132. Claude
-prun: input 6, cache creation 30,388, cache read 59,987, output 318.Local commands run
All with the CI dependency venv (
ci-venv/bin/python3, Python 3.13.15), in the branch worktree:Fail-first: before the implementation, the new checks failed on the tree without it (12 failures across the step-7 tests, 13 in the docs module, the recipe and boundary tests, and the stats-only case of the revision check); two regression guards (template rule order, user-scope
approve) already held. After the final rebase onto8de669da(upstream changedtests/test_adoption_docs_consistency.py,tests/test_install_claude_profile.pyandmanifests/evidence.json),manifests/evidence.jsonwas re-registered on the new base and the checks above re-ran; the full suite ran on the previous base and runs again in CI.Decision record
This PR carries no repository decision record. The plan's step 10 adds the addendum to
docs/decisions/2026-09-25-codex-mcp-scope.mdand the receiptevidence/artifacts/context-mode-audit-20260926/, which will also carry the live outputs above. Until then the decisions live in the scratch plan:cm-deep/PLAN.md(2026-09-26) decides H2's replacement by the twins, H1's withdrawal, the npmstart.mjsCodex form and the D1-D4 targets, with its evidence index and residuals. Overturn conditions stay as recorded there, for example: a re-pin to a release whosesrc/security.tsexpands~/and//lets the store twins go (the.envtwins stay); a cache-installed context-mode PostToolUse hook that fires for an MCP tool on Claude Code 2.1.283 would change the MCP-capture note.Cross-family review (GPT-6)
One read-only
codex exec -m gpt-6-astra -c model_reasoning_effort=max --sandbox read-onlyreview of the frozen pre-fix diff (197,350 tokens; scope file and report kept in scratch ascodex-rev/scope-cm-align.txtandcodex-rev/review-cm-align.md). Verdict: DEFECTS FOUND, 2 medium and 2 low. All four held against the pinned source and were fixed in one repair round; there was no second review.ctx_executelanguage runs in the project root orcwd; Rust compiles and runs in the temporary directory (src/executor.ts:290-292, 406)docs/secret-storage.mdsaid no deny rule inspects ctx code; the server checks shell code and recognised embedded shell commands againstBash(...)denies (src/server.ts:1137-1150, 1744-1750, 3779-3782)hooks/core/routing.mjs:848-866)CONTEXT_MODE_SESSION_SUFFIXrenames the database, the events file and the cleanup flag, not only the database (hooks/session-helpers.mjs:78-92, 391-427)Residuals from the review: none open.
Residuals
native_provenstatus.**/.env.*twin also denies.env.example(no!carve-outs in 1.0.169); native Read still serves it. Documented indocs/secret-storage.md.ctx_execute/ctx_batch_executecode reads stay an accepted residual until OS-level containment of the whole session is measured (plan step 11).spawn_agentsessions under the npmstart.mjsform are not exercised; the npm bundle bytes differ from the pin's and are unreviewed (plan residuals R1, R2).Host evidence
Not applicable: no file under
evidence/hosts/changes.Checklist
wt-u3worktree is untouched).🤖 Generated with Claude Code