Skip to main content

MCP server that captures and retrieves architectural decisions and context for Claude Code sessions

Project description

Contexer

PyPI version License: MIT Python 3.12+ Discord

contexer.ai · Discord · Docs


Every Claude Code session starts fresh. No memory of what was decided last week. No knowledge of the constraints your team spent months establishing. No recollection of the architecture choices that took three PRs to get right.

The result: developers re-explain the same rules every session. Claude re-introduces patterns already rejected. Work gets redone. Sessions run long. Budgets overrun.

Contexer fixes this by capturing decisions as they happen and replaying them before Claude types a single character in your next session.


What changes

Before Contexer: You establish "mock at the service boundary, not the DB layer" in session one. Session two, Claude is back to mocking the DB. You correct it. Session three, same thing. Every session pays the re-explanation tax, and every mistake Claude makes because it forgot costs correction turns that run sessions long.

After Contexer: That rule is stored once as a constraint. Every future session starts with it already injected. Claude never forgets it. You never say it again.

The impact compounds across a team. Shared constraints mean every engineer's agent follows the same rules, enforces the same quality standards, and stays within the same architectural boundaries — without anyone managing it manually.


vs. CLAUDE.md, AGENTS.md, .cursorrules

CLAUDE.md, AGENTS.md, and .cursorrules are worth having. They work well for stable project context — setup notes, architecture overviews, things you know before you start working.

The gap they don't cover is decisions made during development.

You can't write a CLAUDE.md entry for a constraint you haven't established yet. The rules that matter most — the ones that emerge from real work, real mistakes, real conversations — get established mid-session and disappear when it ends. CLAUDE.md captures what you remember to write down. Contexer captures what actually happened.

CLAUDE.md / AGENTS.md / .cursorrules Contexer
Source Written manually, when you think of it Captured automatically as decisions are made
Freshness As current as the last time someone edited the file Updated continuously; novelty filter prevents drift
Token cost Entire file on every prompt Only constraints/conventions at session start; architecture fetched when relevant
New repo Blank — you start from scratch Bootstrap scans git history and code to infer initial decisions
Scope One file, one repo Per-repo decisions + global rules that follow you across every repo

Today Contexer is a personal decision store — private by default, per-user, per-machine. Team sharing is next.

Use both. CLAUDE.md is the right place for onboarding context and stable project notes. Contexer is where the decisions made during development live — automatically, without discipline to maintain a file.


Quick start

Install takes under two minutes.

# Step 1 — install
uv tool install contexer

# Step 2 — wire into Claude Code
contexer install

Step 3 — restart Claude Code and open any git repo. Contexer runs silently from here.

See docs/install.md for verification, update, and uninstall steps.


How it works

You work normally. Contexer captures decisions in the background.

  • Session start — constraints and conventions inject automatically before you type anything
  • As you work — Claude captures significant decisions; no manual intervention needed
  • "Why" questions — if you ask about rationale or past decisions, Contexer fetches them automatically
  • Context window limit — decisions are saved before compaction and restored after, so nothing is lost

If Claude misses something, say "store that decision" and it is captured immediately.

First time in a repo — Claude includes a brief offer at the top of its first response. The offer adapts to how well you know the repo, judged from its git history:

  • The repo has commits from you → pick quick (one question) or full (guided setup).
  • No commits from your git email (e.g. a freshly cloned project) → Contexer suggests scan: it reads the code and docs instead of asking questions you can't answer.
  • Can't tell → it simply asks how well you know the repo.

Resumed sessions (--resume / --continue) don't repeat any of this — the context is already in the conversation. If you installed Contexer mid-project, resuming an old session makes Claude mine that conversation for decisions already made and store them, no questions asked.


Decision types

Not all context is equal. Contexer distinguishes between what must always apply and what is only relevant sometimes — and only loads what the current task actually needs.

Type What it captures Loaded at session start
constraint Rules that must always apply — "never merge untested code" Yes — always
convention Team or project standards — "use uv not pip", "conventional commits" Yes — always
architecture Structural decisions — "chose REST over GraphQL" No — fetched when relevant
pattern Recurring implementation approaches No — fetched when relevant

Constraints and conventions load every session because they apply to every task. Architecture and pattern decisions cost zero tokens at session start — they are retrieved only when the work requires them.


Why this saves money

Contexer has a fixed, predictable cost: ~26 tokens per rule at every session start, paid only for constraints and conventions. Architecture and pattern decisions cost nothing at session start.

The saving comes from what that replaces.

Without Contexer With Contexer
200–500 tokens re-explaining rules per session through back-and-forth ~26 tokens per rule at session start, flat and predictable
Claude re-introduces rejected patterns, correction turns follow Pattern stored once, correction never needed
Developer reworks output that didn't follow established decisions Decisions enforced from session start
Long sessions from accumulated re-explanation and mistakes Sessions stay focused, context stays clean
10 constraints/conventions stored  →  ~260 tokens at every session start
20 constraints/conventions stored  →  ~520 tokens at every session start

The trade: unpredictable, recurring re-explanation cost replaced by a small, flat, predictable session-start cost. A single avoided correction turn saves more than a full week of that overhead.

The ROI is in eliminated rework across sessions, not token compression within one.


Managing decisions

Everything uses natural language.

Store a decision

"store that as a constraint"
"save this as a convention: always use uv not pip"
"remember this architecture decision"

Global decisions apply across all repos — use them for commit style, branch naming, or anything that travels with you:

"store that globally as a convention"
"save this as a global constraint: always use conventional commits"

Only constraint and convention types can be stored globally. Architecture and pattern decisions are always repo-specific.

Query decisions

"show me all constraints"
"what decisions did we make about postgres?"
"show everything stored for this repo"

Update or remove

"update the uv decision — we switched back to pip"
"delete the postgres decision"
"remove all outdated constraints"

The store is plain JSON at ~/.contexer/ — edit it directly if you prefer.


Why it stays lightweight

Contexer is a single Python MCP server with a plain JSON store. No background worker. No vector database. No port listening. No infrastructure to maintain.

This is intentional. Every piece of complexity added to a memory system is a piece of complexity that can fail, drift, or accumulate noise. Contexer stores only what matters — decisions — and keeps everything inspectable, auditable, and greppable.


Token cost reference

Context processing runs before Claude generates a response, not during it. It adds nothing to response time.

Session start — pre-loaded rules (constraints + conventions):

Pre-loaded rules Tokens at session start
5 ~125
10 ~250
25 ~625

~26 tokens per rule, fixed regardless of total store size. Architecture and pattern decisions cost 0 tokens at session start — fetched on demand only.

Token cost is paid once at session start. Every subsequent prompt within that session adds nothing — the rules are already in context.

Retrieval latency:

Operation Time
Hit (decision found) 0.3–0.5ms
Miss (no match) ~0ms
Session start load ~1ms

On prompts unrelated to stored decisions, Contexer skips entirely — no read, no tokens.


CLI reference

Command Description
contexer install Connect Contexer to Claude Code
contexer status Show connection status, store size, current repo; warns about corrupt config files, cleans stale temp files, and notifies when a newer version is on PyPI
contexer reinstall Re-sync after a Claude Code update
contexer uninstall Disconnect; context store is kept
contexer uninstall --purge Remove everything including ~/.contexer/
contexer version Print installed version
contexer help Show all commands and flags

Troubleshooting

Claude isn't storing decisions automatically. Say "store that decision" and it is captured immediately.

A decision was stored but isn't appearing. Constraints and conventions load at session start. If added mid-session, they appear from the next session onward.

A decision is outdated or wrong. Say "delete the X decision" or edit the store file directly at ~/.contexer/.

A new decision wasn't saved — looks like a duplicate. Content too similar to an existing decision is silently skipped. Rephrase to include what specifically changed.

No context appeared at session start on a new repo. Claude will offer bootstrap setup. Complete it once and all future sessions will have context.


Contributing

Bug reports, fixes, and documentation improvements are welcome. See CONTRIBUTING.md for setup, code style, and the PR process.

Questions or ideas? Join the community on Discord.


License

MIT — see LICENSE for full terms.

The Contexer name and logo are trademarks of Contexer.ai. The MIT license does not grant rights to use the Contexer name, logo, or brand in any way that implies official affiliation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

contexer-0.6.3.tar.gz (144.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

contexer-0.6.3-py3-none-any.whl (36.1 kB view details)

Uploaded Python 3

File details

Details for the file contexer-0.6.3.tar.gz.

File metadata

  • Download URL: contexer-0.6.3.tar.gz
  • Upload date:
  • Size: 144.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for contexer-0.6.3.tar.gz
Algorithm Hash digest
SHA256 90f9c4f63772b778284c81d38ba39ab56dab4aa162dc31ff6ebfcd4b76cf01f5
MD5 fd2884ad523a2855d3fb361cd3c0b152
BLAKE2b-256 3714702d4be5125a67a3db7b427bb1a9e3f8ef82c0a879dbda028d8651335825

See more details on using hashes here.

Provenance

The following attestation bundles were made for contexer-0.6.3.tar.gz:

Publisher: release-please.yml on bhargavamin/contexer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file contexer-0.6.3-py3-none-any.whl.

File metadata

  • Download URL: contexer-0.6.3-py3-none-any.whl
  • Upload date:
  • Size: 36.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for contexer-0.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 caa2e5a002d3b202e4b43dddd11118616b6e1d62b3c7a49b7fbaca75858f5128
MD5 4243014351b2f73b3cd3ebf3c9e4e40b
BLAKE2b-256 c6bfa0cf728eeabf075883626e8611d23eb9bb29aa44901b2839cdf1852405ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for contexer-0.6.3-py3-none-any.whl:

Publisher: release-please.yml on bhargavamin/contexer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page