token-saver / scripts
AGENTS.md164 starsChanged 6 months agoApache-2.0View on GitHub
- Apply the root Google Python style policy to entry points and maintenance scripts. Use absolute module imports after any required path bootstrap; justify that import placement locally. Document exit statuses and execution side effects, and record broad isolation failures without command/output data. - Keep hook stdout valid for the host protocol. Send diagnostics to stderr or configured logging; malformed input and unavailable optional components must fail open without preventing the host from running the original command. - Never recursively…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 33,398 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- antigravity/AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- examples/AGENTS.mdAGENTS.md
- .github/AGENTS.mdAGENTS.md
- installers/AGENTS.mdAGENTS.md
- skills/AGENTS.mdAGENTS.md
- src/AGENTS.mdAGENTS.md
- tests/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- docs/llms.txtllms.txt
- llms.txtllms.txt
- token-saver-configSkill
The file
We split this AGENTS.md into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 7
Keep hook stdout valid for the host protocol.
- Very specific: line 10
Never recursively wrap Token-Saver's CLI or wrapper.
- Very specific: line 14
Use shared quote-aware shell helpers.
- Very specific: line 19
Use the same POSIX shell for parsing and execution.
- Distinctive: line 21
Keep timeout/signal cleanup and partial output behavior.
≈ “Common” is an estimate: at least 1 in 5 of the 43,423 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Hooks, shell execution, and maintenance scripts
- Apply the root Google Python style policy to entry points and maintenance scripts. Use absolute module imports after any required path bootstrap; justify that import placement locally. Document exit statuses and execution side effects, and record broad isolation failures without command/output data.
- Keep hook stdout valid for the host protocol. Send diagnostics to stderr or configured logging; malformed input and unavailable optional components must fail open without preventing the host from running the original command.
- Never recursively wrap Token-Saver's CLI or wrapper. Preserve exclusions for sudo, interactive/streaming/background commands, redirection, unsafe shell constructs, and unsupported pipelines. Safe trailing pipes and command chains have explicit existing rules; do not broaden them with naive string splitting.
- Use shared quote-aware shell helpers. Keep
explain_decision()consistent with the actual wrapping decision so diagnostics report production behavior. - Preserve command execution exactly once, original exit status, cwd/environment
behavior, quoting, and
&&short-circuit semantics. Markers inserted into chained output must never leak. Validate rewritten shell syntax before use. - Use the same POSIX shell for parsing and execution. On Windows honor the
existing Git Bash selection; do not send Bash commands to
cmd.exe. - Keep timeout/signal cleanup and partial output behavior. Never retry a command just because compression or tracking failed: commands may have side effects.
wrap.py --dry-runexecutes the command and reports what compression would change. CLIbenchmark --dry-runonly inspects routing; normalbenchmarkexecutes unless--stdinsupplies captured output. Preserve and document this distinction, and test execution modes with harmless commands.- Benchmark/demo scripts must use reproducible fixtures. Report estimated tokens consistently with the runtime estimator and preserve version checks.
For hook/wrapper changes run tests/test_hooks.py, tests/test_shell_syntax.py,
tests/test_cli.py, and the affected engine/core tests. For release maintenance
run python3 scripts/check_versions.py.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

