docs: slim CLAUDE.md to a 76-line core + pointer-loaded docs/areas, with CI budget guards - #1548
Merged
Merged
Conversation
…, add CI budget guards CLAUDE.md is cat-injected into every CASCADE worker prompt (inline only under CONTEXT_OFFLOAD_CONFIG.inlineThreshold) and loaded into every Claude Code session. It was 217 lines plus 95 KB of @imports, 89% of the worker inline cliff, and mostly duplicated docs/architecture or spec/incident narrative; the Git hooks section was wrong. - CLAUDE.md: 76 lines / ~1.7k tokens - commands, gotchas (corrected lefthook contract), hard invariants, env pointer, area pointer table, placement rule; zero @imports - docs/areas/{pm-integrations,router-dispatch,agents,backends}.md: imperatives + links - only-home facts placed first in 01-services, 03-trigger-system, 10-resilience, tests/README.md and .env.example before their CLAUDE.md copies were removed - tests/unit/architecture-docs.test.ts: line/token budget derived from the real inlineThreshold, no-@import, no-narrative, area-doc shape + linkage guards; tests/unit/repo-hygiene.test.ts pins the shared root/web Zod major - src/integrations/README.md: spec-changelog tables removed, duplicate contract table merged; JIRA authType now has one home (08-config-credentials points at it) - SECURITY/README/CONTRIBUTING/ARCHITECTURE/.env.example pointers fixed; CHANGELOG entry - documentation-maintenance partial re-routed (run npm run db:seed-prompts after deploy) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
|
Error: Claude Code returned an error result: You've hit your weekly limit · resets 11pm (UTC) Manual intervention may be required. |
1 similar comment
Collaborator
|
Error: Claude Code returned an error result: You've hit your weekly limit · resets 11pm (UTC) Manual intervention may be required. |
Collaborator
|
Error: Claude Code returned an error result: You've hit your weekly limit · resets 11pm (UTC) Manual intervention may be required. |
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.
Summary
CLAUDE.md(withAGENTS.mdsymlinked to it) is loaded into every Claude Code session andcat-injected when a CASCADE context pipeline includescontextFiles— inline only while underCONTEXT_OFFLOAD_CONFIG.inlineThreshold(src/agents/utils/setup.ts:readContextFiles→src/backends/shared/contextFiles.ts). It had grown to 217 lines plus 95 KB of@-imports (≈31k tokens per interactive session, 7.2k tokens whenevercontextFilesran, 89 % of the silent-offload cliff), ~44 % duplicateddocs/architecture/*/ in-tree READMEs, and the## Git hookssection described hooks that don't exist.This PR cuts it to a 76-line / ~1.7k-token core and moves path-scoped rules to engine-neutral pointer docs under
docs/areas/, with CI guards so it can't re-accrete.CLAUDE.md@imports)contextFilesrunssrc/integrations/README.mdWhat changed
CLAUDE.md— 3-service table, commands, gotchas (incl. the correctedlefthook.ymlcontract: pre-commit = Biome +tsc+ auth-header-provenance test; commit-msg = commitlint; pre-push =npm run test:fast), six hard invariants, an environment pointer to.env.example, a "before you touch an area, read" table, and a placement rule. Zero@imports.AGENTS.mdsymlink untouched.docs/areas/{pm-integrations,router-dispatch,agents,backends}.md— 11–34 lines each; imperatives + links, never restatements. CASCADE runs that includecontextFiles, plus interactive Claude Code, reach them through the same pointer table. (.claude/rules/was rejected because all three engines suppress native instruction discovery, so workers would never see it.)refs/pull/N/head→01-services; review-context budget & debugging (REVIEW_DIFF_CONTEXT_TOKEN_LIMIT,PR context preparedfields, informational CI status) →03-trigger-system;claimReviewDispatch,UnrecoverableError, reviewer-persona check,formatCrashReason→03/10-resilience; integration-DB discovery chain (previously only in code) →tests/README.md;PM_COALESCE_WINDOW_MS→.env.example.tests/unit/architecture-docs.test.ts, TDD — red before the rewrite): ≤ 200 lines;estimateTokens < 0.5 × CONTEXT_OFFLOAD_CONFIG.inlineThreshold(derived from the real constant); no@imports outside code spans; no ticket IDs / spec numbers / dates inCLAUDE.mdordocs/areas/; every area doc ≤ 60 lines, opens with**Applies to:**, and is linked from the root.SECURITY.md/CONTRIBUTING.mdadded to the link-validated set.tests/unit/repo-hygiene.test.tspins the shared root/web/Zod major.src/integrations/README.md— spec-changelog preamble, "Provider migration status" and "Post-spec-010/011/012" tables removed (durable facts folded into the current-state sections: 7thStandardStepKind, shared-step optional props,renderStandardStep); the duplicate behavioral-contract table merged into the harness section; JIRAauthTypenow has one home here, with08-config-credentialsandgetting-startedpointing at it.SECURITY.mddead anchor,README.md,CONTRIBUTING.md(commitlint is thecommit-msghook),docs/ARCHITECTURE.md,.env.example.CHANGELOG.mdentry added.documentation-maintenance.eta— no longer tells agents to append env vars to CLAUDE.md; wording kept generic (it serves every target repo). Pinned literals intests/unit/agents/prompts.test.tspreserved.Verification
npm run verify— Biome clean,tscclean, 620 test files / 11,212 tests passed (3 pre-existing skips).readContextFiles('.')→ one entry (CLAUDE.md, 6,835 chars ≈ 1.7k tokens, well under the 8k inline threshold).git ls-files -s AGENTS.md→ still mode120000;AGENTS.md === CLAUDE.mdguard passes.Operator follow-up
src/agents/prompts/index.ts): runnpm run db:seed-promptsafter deploying so the editeddocumentation-maintenancepartial replaces the seeded copy..claude/rules/<area>.mdstubs withpaths:frontmatter saying "readdocs/areas/<area>.md" would give interactive sessions auto-triggering while keeping content engine-neutral. Not included here.Notes for the reviewer
docs/areas/("agent" is the most overloaded noun in this repo). Trivial to rename.🤖 Generated with Claude Code