agentleFS
ppgrangerppgranger/token-saver/scripts/AGENTS.md

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…

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
  1. Distinctive:

    Keep hook stdout valid for the host protocol.

    line 7
  2. Very specific:

    Never recursively wrap Token-Saver's CLI or wrapper.

    line 10
  3. Very specific:

    Use shared quote-aware shell helpers.

    line 14
  4. Very specific:

    Use the same POSIX shell for parsing and execution.

    line 19
  5. Distinctive:

    Keep timeout/signal cleanup and partial output behavior.

    line 21

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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-run executes the command and reports what compression would change. CLI benchmark --dry-run only inspects routing; normal benchmark executes unless --stdin supplies 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.