Rules for anyone (human or agent) changing this repo. Keep it short and
high-signal — durable rules only, current-state. Full design: DESIGN.md.
A Claude Code plugin: a persistent, read-only, large-context codebase-Q&A
companion. One long-running HTTP MCP server (Python/asyncio) exposes a single
tool, ask_live_memory, and accumulates repo knowledge across sessions. State
is keyed per workspace (cwd). See DESIGN.md for the full rationale.
- Python ≥ 3.10, asyncio. Server code lives in
server/live_memory/; it's a standalone package (server/pyproject.toml). Key deps:mcp(FastMCP, streamable-http),anthropic,starlette,uvicorn,watchdog. - Type checking is
mypy --strict(pyproject.toml, excludestests/). No ruff/black/flake8 is configured — don't assume a formatter runs. - All tunable magic numbers live in
server/live_memory/constants.py— no scattered literals. - Add a runtime dep = edit
pyproject.tomldependencies+pip install -e .. New source files are auto-discovered (setuptools) — no manual srcs list.
./run-tests.sh(repo root) is the gate:mypy live_memory/thenpytest -q, bootstrappingserver/.venvwith.[dev]if needed. It's the pre-push hook (git-hooks/pre-push; install once viagit-hooks/install.sh). Leave the tree green before committing.- Faster inner loop from
server/:mypy live_memory/+pytest -m "not integration" -q. Tests are fully mocked (fake LLM, mocked httpx/OAuth) — no network or API key needed.
- The server must already be running before Claude Code connects.
.mcp.jsonistype: http— Claude Code connects, never spawns it; if it's down you get a connection error. Dev:cd server && pip install -e . && python -m live_memory→http://127.0.0.1:7711/mcp(+/health,/stats,/notify,/reload). - Prod = a user systemd service on :7711 via
deploy/install-service.sh(defaults to a user service — required so zero-config subscription OAuth can read~/.claude/.credentials.json). It's a supervised singleton serving every session: restart withsystemctl --user restart live-memory; never kill it ad hoc — that breaks every connected session (and systemd restarts it anyway). - Model/provider: set via env (
LIVE_MEMORY_*) or the/live-memory-configcommand, which writesconfig.jsonin the data dir and hot-reloads viaPOST /reload— no restart. Precedence: env > config.json > defaults.
- Read-only, path-jailed to
cwd, forever. The exploration tools are onlyRead/Grep/Glob+find_paths/get_changed_files/git_search. Never addWrite/Edit/Bash— read-only-ness is the product's core guarantee. cwdmust be absolute; it's the workspace partition key, canonicalized to the enclosing git repo root (a subdir and its repo root share one memory). Relative paths are rejected, not resolved.- Window B is append-only between compactions; compaction is batched, neutral
(query-agnostic) summarization — never front-truncation. Keep
compaction_floorbelowcompaction_threshold(floor == threshold reproduces a ~10× cache-thrash regression). - Two wire protocols only (
anthropicMessages +openai-compatible).TOOL_SCHEMASare defined Anthropic-native (input_schema) and translated to OpenAI shape at request time — keep new tools Anthropic-shaped. - Token budget is a soft
chars/≈4heuristic reconciled against realusage; never a correctness input — do not add acount_tokensround-trip (DESIGN Appendix A). - Passive-ingestion bytes are in-memory only, never persisted — snapshots
keep a distilled ledger + file manifest, not raw file contents (also a privacy
line — see
PRIVACY.md). - Benchmarks: the standalone Python probes (
benchmark/harness/*.py) spin up their own server on a separate port (7712/7714) + scratch data dir; the A/B orchestrator shell scripts deliberately drive the prod :7711 server and callPOST /clear. Don't point a probe at :7711. - Plugin files are cached under
~/.claude/plugins/after install — source edits aren't live. For dev, launchclaude --plugin-dir <path>(picks up edits via/reload-plugins); otherwise/plugin marketplace updatethen/reload-plugins.
- Current-state only: no changelogs, no "previously…". Keep
README.md/DESIGN.mdand each surface's doc in sync with the code in the same change.