Repository navigation
Add compact mode: optional rules block for complete answers in fewer tokens - #71
Merged
Merged
Conversation
…er tokens `tokenstretch compact on|off` adds or removes a short marked block in the project instruction file through each tool's adapter (CLAUDE.md, AGENTS.md, an existing GEMINI.md or .github/copilot-instructions.md). Off by default. `start --compact` turns it on with setup; `start` mentions it otherwise. In a file that has the credit-rules block, the compact rules go inside that block without the read-narrowly rule it already has. Every change is backed up with a manifest, so `undo` reverses it. The block is under 200 approx. tokens, checked by a test. No saving is claimed: it has not been measured. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… for byte The planner read the instruction file in text mode, which turns CRLF into LF. On a CRLF file (the default on Windows) compact on then off left LF endings behind. Read the bytes, edit with LF, and write the file back in its own style. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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
tokenstretch compact on|offadds or removes a short marked rules block in the project instruction file. Plaincompactsays where it is. Off by default.CLAUDE.mdandAGENTS.md(created if missing), an existingGEMINI.md, an existing.github/copilot-instructions.md. A tool that already loads a file with the block gets no second copy.start --compactturns it on with setup in one run;startmentions the command otherwise.undoreverses them.Rules in the block
Targeted edits instead of whole-file reprints; pointers to code instead of quotes; no restating or recaps; fewer words but never fewer facts; a one-line finish; a fixed handoff format; search before reading.
Size
About 175 approx. tokens alone, about 140 inside the rules block (characters / 4). A test fails at 200.
Not claimed
No saving is claimed in the README or docs. A paired same-model bench is still to be run.
Tests
tests/test_compact.py: on / off / undo round trip for each of the four adapters, with and without the rules block; no second block on a second run; token budget; files never created; one block for tools that share files; the command;start --compact. Whole suite: 544 passed, 1 skipped.🤖 Generated with Claude Code