process: Raise the session-start token ceiling to fit one index line per knowledge note
Back to our planType
process
Summary
What loads at the start of every session has a token ceiling, checked by Agent context. Session start is already right at that ceiling, so not one knowledge note can add its index line. This issue raises the ceiling just enough for one short index line per planned note plus a little room to grow: to about 6500 tokens.
Summary of the owner's decision
Amine, 2026-11-07, voice session (relayed by the Claude Code session that filed this): the extra session-start room for the notes' index lines is acceptable. He asked for this change, so it follows the normal path and does not need the needs owner label. It is still a policy change: the review calls it out as one.
Problem
BUDGET_TOKENSinscripts/agent-context.mjsis the only place the ceiling lives.npm run agent-context(the required checkAgent context) fails when session start goes over it.- Run the check on
main: session start is within a few dozen tokens of the ceiling. Each note issue under #719 (#781 to #792) adds one line todocs/knowledge/index.md, which loads every session, so the first one would fail the check. The decision on #719, opens in a new tab says this room is made in its own issue first; this is that issue.
Why a modest raise is safe (evidence):
- Anthropic's Claude Code memory docs (How Claude remembers your project, opens in a new tab) say to target under 200 lines per
CLAUDE.mdfile, that longer files consume more context and reduce adherence, and that anything not needed every session belongs in path-scoped rules or skills. Each always-loaded file here stays well under 200 lines, and everything else already loads by path (.claude/rules/generated/). - The ceiling is our own number, set to keep session start small. It is not a vendor limit. One short line per note is the cheapest form of the "small index that is always loaded" that decision 0019 chose.
Proposed fix
- Set
BUDGET_TOKENSto about 6500: room for one short index line per planned note (roughly 300 tokens) and a little headroom. - Rewrite the comment above the constant as a principle: what the ceiling is for, how it is sized (current need plus modest headroom), and that the owner may raise or lower it. No dated measurement in the comment; the check prints the live figure.
git grep -n -E "BUDGET_TOKENS|token budget"and change any doc that names the number in the same PR. Today only the constant holds it;docs/guidelines/README.md,AGENTS.md,CLAUDE.mdand decision 0019 name the budget without a number, so they stay as they are unless one of them now states it.- Keep the test that the check fails over its ceiling (
scripts/agent-context.test.mjs), and confirm it still passes with the new value.
Native first: not applicable: this is our own check and one constant.
Acceptance criteria
- Not done:
BUDGET_TOKENSis raised to about 6500, and its comment states the principle with no dated figures. - Not done: Every doc that names the number changes in the same PR (or the PR says none does, with the
git grepit ran). - Not done: The check still fails when session start goes over the new ceiling: the existing test passes, and
npm run agent-contextpasses on the branch. - Not done: The note issues' criteria that mentioned the old budget now say the index line stays within the budget check (#781 to #792; updated when this issue was filed, check they still read that way).
- Not done: The PR's description records the owner's decision above and is reviewed as a policy change.
- Not done:
Agent context,PR Policyand the other required checks pass.
Files likely touched
scripts/agent-context.mjs(the constant and its comment)scripts/agent-context.test.mjs(only if a test pins the value)- Any doc
git grepfinds naming the number
Must not touch
- The always-loaded files (
CLAUDE.md,AGENTS.md,docs/guidelines/guard-rails.md,docs/knowledge/index.md): this issue makes room, it doesn't spend it. - The notes and their generated rules (#781 to #792).
Open questions
None.
Area
ci, tooling
Priority
high
Generated by Claude Code, opens in a new tab