agentleFS
tokensafe-devtokensafe-dev/tokensafe/AGENTS.md

tokensafe

AGENTS.md47 starsChanged 2 days agoApache-2.0View on GitHub

Welcome to the TokenSafe project repository. Before submitting changes, keep new dependencies minimal: the AST, proxy, MCP, and telemetry engines run strictly on the Python standard library, with cryptography>=42.0 (see requirements.txt / pyproject.toml) as the single required runtime dependency for Ed25519 offline license verification and fail-closed RS256 Clerk session verification. tree-sitter grammars and Pillow are optional accelerators and must keep their stdlib fallbacks (src/treesitter_backend.py, src/image_downscale.py) working when absent. Installed interpreters come from bin/tokensafe.js: system CPython, then ~/.tokensafe/venv, then the pinned…

  • 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 35,337 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 repository5 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is 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.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All internal documents, plans, strategy files, roadmaps, and business design docs MUST live exclusively in the private repository …

    line 13
  2. Distinctive:

    If you find any internal planning or strategy document here, delete it immediately and move it to the private repository.

    line 14
  3. Distinctive:

    Run unit tests with:

    line 31

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 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

TokenSafe Project Instructions

Welcome to the TokenSafe project repository.

Project Overview

This repository implements the TokenSafe local engine for AI coding agents. It intercepts user prompts via lifecycle hooks, compiles natural language into compact intent expressions, slices bulky tool calls (such as full-file reads), guards secrets and unsafe commands, and provides real-time SQLite metrics tracking.

STRICT REPOSITORY PRIVACY BOUNDARY (CONFIDENTIALITY DIRECTIVE)

  • This repository (tokensafe) is STRICTLY PUBLIC OPEN-SOURCE.
  • NEVER save, commit, or create internal architectural plans, marketing strategies, repositioning docs, roadmaps, design documents (docs/plans/), or internal notes in this repository!
  • All internal documents, plans, strategy files, roadmaps, and business design docs MUST live exclusively in the private repository (tokensafe-api, specifically tokensafe-api/docs/plans/ or tokensafe-site/docs/).
  • If you find any internal planning or strategy document here, delete it immediately and move it to the private repository.

Architecture Guidelines

  • src/tokenizer.py: Zero-dependency, calibrated BPE token counter.
  • src/compactor.py: Semantic intent extractor and S-expression serializer.
  • src/slicer.py: Tool arguments optimizer (AST & line windowing).
  • src/type_slicer.py: 3rd-party TypeScript definition slicer (@types, .d.ts) with L1/L2/L3 caching.
  • src/schema_slicer.py: OpenAPI & multi-file Prisma schema contract optimizer with composite fingerprints.
  • src/web_reader.py: Sanitized documentation fetcher with 3-tier L1/L2/L3 caching.
  • src/format_parsers/lockfiles.py: Lockfile point queries (query_dependency) and index summarizer.
  • src/mistakes.py: Anti-stuck dead-end ledger with 2-tier hybrid escalation and team broadcast.
  • src/metrics.py: SQLite metrics persistence engine (data/metrics.db).
  • src/dashboard.py: Visual terminal & Markdown analytics visualizer.
  • hooks/: Lifecycle hook implementations (PreInvocation, PreToolUse, PostToolUse).
  • bin/tokensafe: Standalone executable CLI for developers.

Testing & Quality

Run unit tests with:

python3 -m unittest discover tests

Before submitting changes, keep new dependencies minimal: the AST, proxy, MCP, and telemetry engines run strictly on the Python standard library, with cryptography>=42.0 (see requirements.txt / pyproject.toml) as the single required runtime dependency for Ed25519 offline license verification and fail-closed RS256 Clerk session verification. tree-sitter grammars and Pillow are optional accelerators and must keep their stdlib fallbacks (src/treesitter_backend.py, src/image_downscale.py) working when absent. Installed interpreters come from bin/tokensafe.js: system CPython, then ~/.tokensafe/venv, then the pinned managed runtime in bin/python-runtime.json (SHA-256 verified, downloaded only when no CPython 3.10+ exists).

<!-- tokensafe -->

TOKENSAFE GRAPH-FIRST OPTIMIZATION PROTOCOL

The full protocol is installed globally in the agent-level instructions (~/.zcode/AGENTS.md, ~/.claude/CLAUDE.md, ~/.codex/AGENTS.md, ~/.kimi-code/AGENTS.md) and applies to this project. Core tools: tokensafe:repo_map(view='graph'|'api'|'tree') for architecture & directory trees, tokensafe:scoped_search (single or queries batch, never raw grep/find), tokensafe:smart_read_file (symbol, targets bundle, or .d.ts package_name), tokensafe:apply_edits for multi-file edits, tokensafe:oumv (MANDATORY first on OUMV-supported React/Vue/Go/FastAPI stacks — live or static offline; check status in mixed monorepos), tokensafe:session_context(action='budget'|'compact'|'prune'|'mistakes') for context & anti-stuck hygiene, and tokensafe:run_helper(action='sanitize'|'guard'|'diff'|'deps'|'web'|'expand'|'image'|'compress'); never hardcode secret fallbacks; append the ⚡ TokenSafe Turn Savings footer on tool-using turns.

<!-- /tokensafe -->

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.