Skip to main content

ctx-store

ctx is a markdown context store for coding agents: one folder of *.md rows with YAML frontmatter as the schema, a CLI with validated structured writes (log, fm, new, move), budgeted reads (brief, find --budget, resolve, get --section --tail), a per-actor audit trail and a maintenance pass (init, validate, doctor, maintain, migrate). The same core serves three front-ends: the CLI (Claude Code hooks and skills call it), an Anthropic memory-tool handler (view create str_replace insert delete rename) and an MCP server (stdio for Claude Desktop; HTTP with authentication for claude.ai, as a separate package).

Production-grade by design: Python stdlib only (≥ 3.10), runs from a plain copy with no install, fixed exit-code table, --json envelope ("api": 1), temp + rename writes under a lock, secret guard on every payload, read-only store support, no writable state under the store for reads.

Interface first

The interface is the contract: verbs, fixed errors and the doc model. Storage is a backend behind it. Markdown files are the default backend, so a store stays a folder you can read and edit; the same calls give the same answers on any other backend (ctxstore/backend.py, ctx help backends).

Install

uv tool install ctx-store     # or: pipx install ctx-store
ctx --version

The package puts ctx and ctx-serve on the PATH: Python ≥ 3.10, no dependencies. Installing is optional, since a plain copy of the repo runs as it is (below). Releases: PyPI, CHANGELOG.md.

Try it

git clone https://github.com/MdaaaaO/ctx-store && cd ctx-store
./ctx --version
./ctx doctor --store tests/fixtures/store-v1
./ctx help errors

No install needed: ctx runs from a plain copy of the repo on Python ≥ 3.10. The interface (verbs, exit codes, error strings, --json envelope, environment) is docs/interface.md; ctx help prints from the same file. Tests: make ci.

Hooks

Every call a harness hook needs is one line. A write names its store; a read may find it by walking up.

When Call
Setup on a new machine, or a schema upgrade ctx init --store <path> --settings <file> --types <folder> (add --upgrade for a new version: files edited since are kept)
After a change under the store ctx validate --changed (add --adopt while writes still come from outside ctx)
Heartbeat ctx touch --session <id>
Session start ctx brief --registry
After a compaction ctx brief --session <id>
A step landed ctx log <doc> "<what happened>"
Session end, or on a timer ctx maintain
CI, after a schema change ctx migrate --check

Claude Desktop

{"mcpServers": {"ctx": {"command": "/path/to/ctx-store/ctx", "args": ["mcp"],
  "env": {"CTX_STORE": "/path/to/store", "CTX_ACTOR": "desktop"}}}}

On Windows with the store and ctx inside WSL, Claude Desktop starts it through wsl.exe, and the environment goes into the arguments:

{"mcpServers": {"ctx": {"command": "wsl.exe",
  "args": ["-e", "env", "CTX_STORE=/home/you/store", "CTX_ACTOR=desktop", "CTX_NO_WALK=1",
           "/home/you/ctx-store/ctx", "mcp"]}}}
Install claude_desktop_config.json is in
Windows, installer %APPDATA%\Claude\
Windows, Microsoft Store %LOCALAPPDATA%\Packages\Claude_*\LocalCache\Roaming\Claude\
macOS ~/Library/Application Support/Claude/

Tested with the Microsoft Store install on Windows with WSL2: the tools are listed, and brief, find and log work. The other two rows are where Claude Desktop documents its config; they were not tested here.

Every built verb is a tool (ctx_brief, ctx_find, ctx_log, …). ctx memory takes the input of Anthropic's memory tool on stdin.

claude.ai

ctx-serve puts the same tools behind HTTP with authentication (OAuth for claude.ai, a bearer token for Claude Code), for a store on your machine behind a tunnel: docs/connector.md. It is a separate package; the core has no network.

Speed

Milliseconds per call as a caller sees it: a fresh process each time, interpreter start included (about 40 ms of every number). Generated Markdown stores of 3.1 MB and 39.2 MB, 20 runs per call, Python 3.14 on Linux under WSL2. The two stores were measured in separate runs on a machine that was not idle: compare a row with the first row of its own column. python3 bench/bench.py reproduces it.

Call 225 docs p50 p95 3 000 docs p50 p95
start of the interpreter (--version) 35 38 34 37
brief <doc> 35 40 34 39
get <doc> --section --tail 5 35 37 35 36
view <doc> 34 35 35 39
brief --registry 42 44 127 140
brief --session <id> 42 50 127 134
resolve <key> 41 46 103 107
find <word in one doc> 44 45 155 163
find <common word> 69 77 173 199
find --tag 41 59 123 144
validate 54 60 295 309
validate --changed 49 55 184 194

No search cache. The rule was: a cache enters only above 3 000 docs, with find over 200 ms at p95, or when a lookup needs ranked search a scan cannot give. At 3 000 docs every find stays under 200 ms. find matches terms and ranks its hits as part of the same scan (ctx help find), which finds 17 of the 18 lookups in bench/eval/ where the phrase match before it found 6; the one it misses is a paraphrase, which an index of words would miss too. A task described in a sentence or two finds its doc as well (7 of 7 in the eval). That is where the scan costs most: about 0.1 s for 25 words on 225 docs, about 0.9 s on 3 000. So the store has no index to build, validate or lose. The question returns when a store passes 3 000 docs, or when lookups need synonyms.

validate --changed, the call behind the after-write hook, stays under its 300 ms budget at 3 000 docs.

Status: P4: every verb except row is built; measured; no cache. Design and phasing: #1. Licence: MIT.

Metadata

Release files for ctx-store 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ctx-store 0.8.0
File Size Uploaded Provenance Actions
ctx_store-0.8.0.tar.gz 113.9 kB With provenance Details for ctx_store-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ctx-store 0.8.0
File Interpreter ABI Platform Actions
ctx_store-0.8.0-py3-none-any.whl Python 3 none any Details for ctx_store-0.8.0-py3-none-any.whl

Total release size: 196.2 kB

Release files / ctx_store-0.8.0.tar.gz

Download URL ctx_store-0.8.0.tar.gz
Size 113.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d4a5503f57d1d89f153fb765f3dacf4e759a36afe385cde2463dbc67494ec161
BLAKE2b-256 checksum
How to use checksums
fab583c6e7c0366a077c55905ff0b5687f0d3ae2e2b26362d873090f48520056
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 15, 2026.

Transparency log

Release files / ctx_store-0.8.0-py3-none-any.whl

Download URL ctx_store-0.8.0-py3-none-any.whl
Size 82.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b12616125816ea5c8594d1256dec04e7ccf13bbdcf8e3b6f5f179c37e6c6218
BLAKE2b-256 checksum
How to use checksums
ae7c49cb595ea23ce15c51b5658ddedd6d453f4f76fde7fa2ca45f2c7860fe68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 15, 2026.

Transparency log

Security for ctx-store 0.8.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ctx_store-0.8.0.tar.gz

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 Oct 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page