Repository navigation
chore: remove v0.4.x release artifacts and compress CLAUDE.md - #683
Merged
Merged
Conversation
- Delete v0.4.0 and v0.4.1 per-release test checklists (now at 0.6.6, practice abandoned after v0.4.1) - Remove tests/results/ directory containing 4 timestamped run logs - Drop .gitignore comment explaining committed test logs (no longer applicable) - Strip dead citation to tokenjam-product-strategy.md from optimize README Co-Authored-By: Claude <[email protected]>
…p claims CLAUDE.md is always-on context: auto-loaded into every session and trusted without re-verification, so a measurement or a state assertion placed there is a future lie with a delay fuse. This pass applies that standard to the file. - Purge measurements while keeping the mechanism they motivated: the CWD-delta and isolated-HOME dollar figures in the ambient-environment rule, the SGR code count in the terminal-output rule, and the pinned assertion string in the test-enforcing-the-defect rule (the test file is its own source of truth). - Drop forward-looking state assertions, which are banned regardless of accuracy: the policy/pricing "not built yet" and "next sprint" notes and the "currently empty" claim about the internal specs directory. The instructions they were attached to are kept. - Collapse the core/optimize/ Key Modules bullet from a 52-line incident log to 16 lines. The dollar-field contract keeps its canonical field, its two companion fields, the retired names and the one-rollup rule; the surrounding rules keep every do/don't and every enumerated check, with the incident narrative behind each cut to a clause. The evidence, the per-analyzer verdicts and the mixed-basis history now live in the product-state analyzer matrix, which is where a measurement belongs. - Compress the reachability, persona-gating, disjoint-spans and same-events rules on the same principle: principle and instructions in full, story in a clause. No Critical Rule was renumbered, reordered or removed — the numbers are cited from source comments and test files across the repo, and the 1-41 sequence is byte-identical before and after. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…op incident narrative Co-Authored-By: Claude <[email protected]>
Restore the prohibition that `which personas have a key` is a question for PERSONA_DISABLED_ANALYZERS' own documentation in runner.py, not for CLAUDE.md. This clause was trimmed in an earlier compression pass and must not drift away again—it keeps CLAUDE.md as a rule file, not a second source of truth for a map that evolves with each analyzer's gate. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Contributor
|
| Filename | Overview |
|---|---|
| CLAUDE.md | Condenses the root guidance and replaces relocated details with a scoped-rule index. |
| .gitignore | Continues ignoring transient .claude content while explicitly tracking .claude/rules. |
| .claude/rules/core-architecture.md | Adds path-scoped core architecture, storage, accounting, and dependency-boundary guidance. |
| .claude/rules/cli-output.md | Adds path-scoped CLI architecture and terminal-output guidance. |
| .claude/rules/optimize-analyzers.md | Adds path-scoped analyzer contracts and implementation guidance. |
| .claude/rules/optimize-cost-figures.md | Adds path-scoped rules for optimization cost proposals and monetary-field handling. |
| tokenjam/core/optimize/README.md | Removes a citation to a nonexistent strategy document. |
Reviews (5): Last reviewed commit: "docs(claude): point the rules index at t..." | Re-trigger Greptile
…t.py entry The meta-repo's root CLAUDE.md carried a cross-repo section about cache token types in aggregates, which is entirely Python-side detail (DuckDB SQL, the optimize runner, calculate_cost) and belongs beside the cache-read vs cache-write contract already documented on the core/cost.py bullet. Merged rather than appended, so the two halves of the rule sit with the fields they govern: both cache classes on both sides of every token SUM, and both on both sides of any actual-vs-alternative price comparison, with one pricer (calculate_cost) instead of a per-analyzer alt-price helper. Incident history dropped; the grep hint and the mechanism are kept. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The root CLAUDE.md had grown to 508 lines / ~158K chars of always-on context, re-sent in full on every turn of every session in this repo. Most of it governs one directory or one file class and is dead weight for a session that never touches that area. Split by load semantics rather than by topic: - Per-directory `CLAUDE.md` files (core, core/optimize, core/summarize, core/rulewrite, sdk, otel, api, cli, ui, mcp) carry the architecture detail. A nested CLAUDE.md loads only when Claude reads files in that directory. - `.claude/rules/*.md` carry the path-scoped Critical Rules, each with `paths:` frontmatter so the rule loads only when a matching file is touched. Every rule keeps its ORIGINAL NUMBER in its heading, because source comments and tests cite rules by number. - Root keeps only what governs every file: project overview, build/test commands, the package dependency boundary, PR/commit conventions, the eight genuinely global Critical Rules (1, 7, 9, 14, 20, 23, 24, 25), and an index naming which rule numbers live in which file behind which glob. Imports (`@path`) were deliberately not used: they load eagerly at launch and would have saved nothing. Three stale claims corrected against the source while moving them: - The `/optimize` route no longer skips anything on `?fast=true`. No analyzer runs on any request path; reports are precomputed by a background daemon (boot / interval / rescan) via `core/optimize/report_store.py` + `scan_cycle.py`. `fast` and `skipped_analyzers` survive for wire back-compat. - The Lens hero-stat rationale no longer claims a 30-day `/optimize` pass takes minutes (it depended on the above). The hero still has its own fetch, for the reason that survives: it must not wait on the triage band's slowest member. - The zero-install first-run screen renders three beats — what tj read, one avoidable-dollars sentence, and the onboard pointer. It carries no quota composition and no statusline preview; those survive only in `--json`. Also dropped a citation to two `.specs/` files that do not exist (the claim they supported, the negative-A/B removal of output_cap, is kept). Three rules deleted as dead letters, their numbers permanently retired so nothing renumbers: 6 (never hardcode a unicode bullet — unenforced and already violated widely), 13 (never write `pip install ocw` — zero remaining occurrences, correct install command is in the overview), 17 (verbatim duplicate of the `otel/otlp_parsing.py` architecture note, folded into it). `.gitignore` had `.claude/` excluded wholesale, which would have made the relocated rules invisible to every fresh clone. Narrowed to `.claude/*` with `!.claude/rules/` so local settings stay private while the rules ship. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
A prior pass split the root CLAUDE.md into two deferred-loading mechanisms at once: per-directory CLAUDE.md files that load when Claude reads that directory, and .claude/rules/*.md carrying paths: globs. That is one mechanism too many. Globs are strictly more expressive than a directory boundary, .claude/rules/ keeps all agent context in one auditable place, and scattering Claude-specific files through the source tree is noise for everyone reading the package. Each area now has one topic file carrying both its architecture notes and the Critical Rules governing it, so a session touching core/optimize/ gets the package walkthrough and the analyzer rules from the same trigger. Content moved verbatim; every glob covers at least what the directory boundary covered. api/ + mcp/ -> rules/api.md · cli/ -> rules/cli-output.md · ui/ -> rules/web-ui.md · sdk/ -> rules/sdk.md · otel/ -> rules/otel.md · core/summarize/ + core/rulewrite/ -> rules/optimize-analyzers.md · core/ -> new rules/core-architecture.md + rules/core-config-pricing.md · core/optimize/ -> new rules/optimize-architecture.md. The Critical Rule numbers are unchanged (1-41 less the retired 6, 13, 17), and the root index table now covers the architecture topics too so any relocated content is findable from root. Only cross-references that would have dangled were rewritten. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ze lane core-architecture.md globbed a bare tokenjam/core/**, a superset of every optimize glob, so editing any analyzer pulled the whole core domain layer in alongside it. Scope it to the modules it actually documents plus export/ and ingest_adapters/, and drop the redundant bare core/** from core-config-pricing.md, which only needs config.py, pricing.py and the packaged pricing table. Co-Authored-By: Claude <[email protected]>
optimize-architecture.md and optimize-analyzers.md carried byte-identical paths: lists, so neither could ever load without the other and the split bought nothing. Analyzer authoring plus the summarize and rulewrite lifecycles now scope to analyzers/, the registry/runner/cost_proposals modules and those two packages; the package walkthrough and the fix contracts keep optimize/**, fixes/** and cmd_optimize.py. Editing core/summarize/ or core/rulewrite/ no longer drags in the architecture file, and editing the write budget or cost-apply machinery no longer drags in the authoring rules. Co-Authored-By: Claude <[email protected]>
…ative padding In core-architecture.md the db.py, cost.py, recommendations.py and framing.py entries interleaved what the module does with the bug that motivated its guard, in single paragraphs a reader had to consume whole. Each is now a description followed by a separate rule/incident block, so the architecture is skimmable without paying for the incident. Also removes content the repo's own standard bans from these files: a literal budget-ceiling value and a dated product-reframing cite. No directive, symbol, module path, constant, test name, CLI flag, config key or rule number was dropped. Co-Authored-By: Claude <[email protected]>
The index described core-architecture.md and core-config-pricing.md as loading on all of tokenjam/core/**, and optimize-analyzers.md as sharing optimize-architecture.md's globs. All three are now narrower. Rule numbers are untouched. Co-Authored-By: Claude <[email protected]>
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.
Removes stale release artifacts and compresses
CLAUDE.md, which had grown to ~181 KB of always-on context.Stale removal
tests/agent-{pre,post}-release-v0.4.x.md(3 files) — per-release checklists pinned to v0.4.0/v0.4.1. The repo is at 0.6.6, and no v0.5.x or v0.6.x checklist was ever authored, so the practice was tried twice in June and abandoned. These are disposable by design; the runners that consume them readagent-pre-release-v<VERSION>.mdas a pattern, not a literal path, so both runners still work.tests/results/(4 timestamped run logs) — records of those same two runs, plus the.gitignorecomment explaining why they were committed.tokenjam/core/optimize/README.mdtotokenjam-product-strategy.mdv3, a document that exists nowhere in the repo (confirmed viagit log --all).Kept: both runners and both
manual-*playbooks, which are version-independent.CLAUDE.md compression
180.9 KB → 156.6 KB (−13%), 544 → 508 lines.
core/optimize/architecture notes into the workspace's product-state record, collapsing it here to the field contract plus a pointer.past_overspend_usdremains documented as the one canonical dollar field.Context consolidation
The cache-token aggregation rule (always include both
cache_tokensandcache_write_tokens; route alternative-side pricing throughcalculate_costrather than a second, lossier pricer) previously lived in the workspace-level context file, where it was the only entry describing this repo's Python internals. It now sits with thecore/cost.pyentry it governs, merged into that entry rather than added as a separate section.Restructure: on-demand context instead of always-on
CLAUDE.mdloads into every session in this repo. At 508 lines it was 2.5× the documented guidance of "target under 200 lines", and roughly 39.5K tokens of context before a single file was read.Root is now 187 lines / 22 KB, down from 508 / 158 KB — with no rule lost. The detail moved to where it loads on demand:
.claude/rules/*.mdwithpaths:frontmatter — one topic file per area, carrying both that area's architecture notes and the rules governing it. Each loads only when Claude touches files matching its globs.One mechanism, not two. An earlier revision of this branch also placed nested
CLAUDE.mdfiles in ten source directories; both approaches defer loading the same way, but globs are strictly more expressive than directory boundaries (several rules govern a package and a file outside it, which a directory cannot express), and keeping all agent context in one directory makes it auditable for staleness in a single pass instead of twenty-five. The nested files are gone.Rule numbers are cited from source comments and test files, so nothing was renumbered — deletions leave permanent gaps and every relocated rule keeps its number in its heading.
Three rules were deleted as dead weight: one forbidding hardcoded bullet characters (the CLI does this 42 times in one file, no test enforces it, zero citations), one warning against an install command for a package name that no longer appears anywhere, and one that was a verbatim duplicate of an architecture note. A fourth rule was stated twice in full; one copy is now a pointer.
.gitignorepreviously excluded.claude/entirely, which would have left the rule files untracked and invisible to contributors. It now excludes.claude/*while re-including.claude/rules/.Making the deferral actually defer
Splitting the file only pays off if the globs are disjoint enough that touching one file doesn't drag in every neighbour. They were not.
core-architecture.mdglobbed a baretokenjam/core/**— a superset of every optimize glob —core-config-pricing.mdrepeated that same bare glob alongside the two modules it needs, andoptimize-architecture.mdandoptimize-analyzers.mdcarried byte-identicalpaths:lists, so neither could ever load without the other. Editing anything undertokenjam/core/optimize/fired five rule files at once.core-architecture.mdnow globs the top-levelcore/*.pymodules it documents, pluscore/export/**andcore/ingest_adapters/**. It no longer matchescore/optimize/,core/summarize/,core/rulewrite/orcore/fixes/, which their own files own.core-config-pricing.mddrops the barecore/**and keepscore/config.py,core/pricing.py,tokenjam/pricing/models.toml.core/optimize/analyzers/**, theregistry/runner/cost_proposalsmodules and those two packages; the package walkthrough and the fix/write-budget/delivery contracts keepcore/optimize/**,core/fixes/**andcli/cmd_optimize.py. Editingcore/summarize/no longer drags in the architecture file, and editing the write budget no longer drags in the authoring rules. The existing cross-references between the two files carry a reader across the boundary.Worst-case co-fire, root included:
core/optimize/analyzers/*.pycore/optimize/write_budget.pycore/summarize/*.pycore/db.pyContent compression was secondary and modest:
core-architecture.md−3.5%,cli-output.md−5.0%. Both fell short of the 20–25% / 10–15% I was aiming for, and the reason is worth stating rather than hiding — these files are symbol-dense reference material where nearly every clause names a module, constant, test or flag, so past a point the only way to keep cutting bytes is to cut facts. What did land structurally: thedb.py,cost.py,recommendations.pyandframing.pyentries interleaved what the module does with the bug that motivated its guard in single unbroken paragraphs, and each is now a description followed by a separate rule block, so the architecture is skimmable without paying for the incident. Two items the repo's own standard bans were removed while in there — a literal budget-ceiling value and a dated product-reframing cite.Verified by extracting the set of backticked identifiers from both files before and after and diffing: no module path, function, constant, test name, CLI flag, config key, lettered sub-case or rule number was dropped.
Corrections to stale architecture claims
An audit checked ~140 factual claims in the architecture section against the code. Three were wrong, all describing user-facing behavior:
/optimizeno longer runs analyzers on the request path. The file described?fast=trueas skipping the Trim analyzer and returningskipped_analyzers. In factfastis accepted and ignored,skipped_analyzersis always empty, and reports are precomputed by a background daemon (boot / interval / rescan). A contributor reading the old text would have built against a request-path analyzer sweep that does not exist.--jsonpayload.A citation to two
.specs/files that do not exist was removed; the claim it supported is still accurate.Verification
import tokenjamclean; 5,070 tests still collect.---and carries a non-emptypaths:key (all 18 checked mechanically). A file with frontmatter but nopaths:silently becomes always-on while still looking deferred, which would quietly undo the whole PR.