ctx
Filesystem-native context layer for AI agents.
ctx generates CONTEXT.md manifests for every directory in a project so AI agents can navigate with structured summaries instead of reading every file. One command refreshes the entire tree. Manifests are deterministic, verifiable, and cheap to maintain.
Quick Start
pip install ctx-tool
export ANTHROPIC_API_KEY="sk-..."
ctx refresh .
That's it. Every directory now has a CONTEXT.md with a purpose summary, file descriptions, and subdirectory overviews.
What It Costs
ctx uses lightweight LLM calls (Haiku-class models by default). Real-world benchmarks on personal document trees:
| Tree | Dirs | Files | Cost | Time |
|---|---|---|---|---|
| 31 dirs | 31 | 566 | $0.11 | 7 min |
| 171 dirs | 171 | ~1,200 | ~$1.26 | ~15 min |
Runs are incremental — unchanged directories are skipped, so subsequent refreshes cost near zero.
For Agents
Tell your agent: install ctx-tool, run ctx refresh ., then read AGENTS.md for the full command contract, JSON output schemas, error codes, and integration patterns.
For MCP clients, copy the config from mcp.json into your client's MCP config (.mcp.json for Claude Code, .cursor/mcp.json for Cursor) or run ctx serve --mcp.
Commands
| Command | Purpose |
|---|---|
ctx refresh <path> |
Generate or update manifests |
ctx check <path> |
Validate manifest health, coverage, freshness |
ctx export <path> |
Concatenate manifests for agent ingestion |
ctx reset <path> |
Remove all generated manifests |
ctx serve --mcp |
Expose manifests via MCP (stdio JSON-RPC) |
Key flags: --until-complete (auto-retry large trees), --output json (machine-readable), --force (regenerate all), --watch (live refresh).
Configuration
Works out of the box with ANTHROPIC_API_KEY or OPENAI_API_KEY. For local models:
ctx refresh . --setup # auto-detects Ollama or LM Studio
Fine-tune with .ctxconfig:
provider: anthropic
model: claude-haiku-4-5-20251001
max_usd_per_run: 1.00
Full config reference in AGENTS.md.
Docs
| Doc | Audience |
|---|---|
| AGENTS.md | Agents — command contract, schemas, integration patterns |
| architecture.md | Developers — engine design and data flow |
| CONTRIBUTING.md | Contributors — dev setup and workflow |
| state.md | Maintainers — roadmap and phase history |
License
MIT
Metadata
Release files for ctx-tool 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ctx_tool-1.0.0.tar.gz | 115.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ctx_tool-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 187.7 kB
Release files / ctx_tool-1.0.0.tar.gz
| Download URL | ctx_tool-1.0.0.tar.gz |
|---|---|
| Size | 115.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eaeffaea2f42cac593a89f4a9ccf0a5ee8cea7a44fa0ed8356f805e4b7ca6f89
|
|
BLAKE2b-256 checksum How to use checksums |
5fec5e8a3266557331aec1e490fd35a9950bbf6494063241518843dee22ae6f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 20, 2026.
Transparency logRelease files / ctx_tool-1.0.0-py3-none-any.whl
| Download URL | ctx_tool-1.0.0-py3-none-any.whl |
|---|---|
| Size | 72.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5b291ca01acfe4bd2285f98b35b1209f6454ebb2a7c0f86a62427ac7901df1c2
|
|
BLAKE2b-256 checksum How to use checksums |
daea969ece96502d127eb313ca8e10a5dee808ee1c6862af49801b5dd75efec5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 20, 2026.
Transparency log