fix(context): the audit's control and fit, and rung 1's price - #185
Merged
chuycepeda merged 2 commits intoSep 25, 2026
Merged
Conversation
- context-load-audit.py recognised primary sessions by a regex of one operator's session names. Primaries now come from USER.md's `## Identity` table (its first GFM table; italic example rows skipped) plus --primary. With none declared it aborts and says how to declare one. - Its fit check (outward action without a declared/ read) only looked at the first --cap calls and ignored order. It now reads the whole transcript and asks whether a declared/ read came before the first outward action, within a single call too. --cap and --min-tools still measure the loading window. - context-rungs.py priced rung 1 as the last five entries of every observed file, while the floor emits a rule library's index and the newest entries by date. The floor's per-file selection is now one function, recent_slice(), and rungs imports it. Floor output is byte-identical. Tests: rung 1 equals the floor's emitted words per file; primaries, parser counterexamples and fit ordering cases; old-hook reproductions pinned to the pre-change sha. The parity test accepts the shared recency constant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> AIOS-Session: 4ce35e79-7182-45d3-a479-d25e0004fda0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chuycepeda
added a commit
that referenced
this pull request
Sep 25, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LCjeYxWVWosFKnRiCf8Ae7
Member
|
Shipped in v0.8.5 with your commits and authorship intact. Thank you. It went in as you wrote it. The floor refactor was checked against a live vault: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Three defects in the two tools that measure context loading.
/aios:housekeepingruns both.hooks/context-load-audit.pyhooks/context-load-audit.pydeclared/file. It only scanned the first--cap(120) calls, so a later export was never seen. It also ignored order: a worker that exported first and read the voice file afterwards counted as having read it.hooks/context-rungs.pycontext-floor.pyemits. The floor emits a rule library's index and the newest entries of each observed file by date. Rungs priced the last five entries of every file, rule library included. It defined a rule-library regex it never used.Fix
## IdentityinUSER.md, the table that already decides how a session is greeted, plus--primary NAME. The parser follows GFM (a header row, then a delimiter row). It skips the template's italic example rows and ignores fenced code, and the table ends at the first line that is not a row. With no primary declared, the audit aborts and says how to declare one.declared/read. When one call does both, the positions of the matches that produced the hit decide.--capand--min-toolsstill apply to the loading window; the JSON gainstools_totalanddeclared_before_outward.recent_slice().context-rungs.pyimports it, and its recency constant, from the floor, so price and emission cannot drift. The floor's output is byte-identical before and after, in text and--json, with default, zero and widened--recent.Proof
tests/context-rungs.test.shbuilds a vault with a rule library and a chronology whose tail is its oldest part. It asserts rung 1's per-file price equals the words the floor emits for each file. Against the pre-change hook, pinned by sha, the prices differ by two orders of magnitude.tests/context-load-audit.test.shcovers declared primaries, the no-USER.mdabort,--primary, and 20 parser cases. It also covers fit past the cap, a read after the ship, a ship then read inside one call, and a look-alike filename earlier in the same call.--min-toolsstill filters on the loading window. The pre-change hook, pinned by sha, first has to produce a valid report, and then it flags none of the fit cases.tests/spawned-worker-context-parity.test.shcompared two numeric recency constants. It now also accepts rungs reading the floor's constant, which is the stronger form.tests/run passes. The three suites also pass under bash 3.2.Scope
hooks/context-load-audit.py,hooks/context-rungs.py,hooks/context-floor.py(refactor only), the three tests,hooks/_index.md, the Bucket 30 text inhousekeeping.md, and the CHANGELOG entry. It continues the hooks series announced in #158.🤖 Generated with Claude Code