This file provides guidance to Claude Code when working in this repository.
This repository is still the older markdown-only implementation of sequential-thinking-mcp-v2. The approved direction is now documented in:
docs/plans/2026-03-08-agent-memory-reasoning-architecture-design.mddocs/plans/2026-03-08-agent-memory-architecture.md
When repository behavior and these design docs disagree, treat the design docs as the target architecture and the codebase as transitional.
Historical docs reference:
uv sync
uv run main.pyUse those commands only if the dependency manifest exists in the checkout you are working from. Do not assume pyproject.toml is present.
- Markdown is canonical human truth.
qmdowns retrieval for canonical docs and document collections.Zvecowns retrieval for promoted memory artifacts and non-doc semantic artifacts.- A small structured metadata store owns lifecycle state such as confidence, evidence, promotion status, staleness, scope, and sync state.
- Cloud memory is an optional overlay for continuity, never the source of truth.
- Scratch reasoning is ephemeral and bounded.
- Checkpoint summaries are recovery artifacts.
- Promoted conclusions are the only durable machine memory.
- Raw chain-of-thought should not be stored as long-term memory by default.
- Promotion requires evidence, sufficient confidence, and likely reuse value.
- Retrieval is on demand and scoped to the active task.
- Do not preload the whole codebase into context.
- Pass handoff bundles and summaries between agents, not raw transcripts.
- Token ceilings like
64Kactive context and45Kcompaction triggers are policy defaults, not universal facts.
Treat qmd indexing as a controlled workflow. Do not automatically spam indexing/update commands on every small change, and do not modify qmd's database directly. Queue or batch indexing work instead.
main.py: current MCP server entry point and tool registrationmcp_tools.py: current tool handlerssession_manager.py: current markdown persistence and session orchestrationmodels.py: current dataclasses for sessions, thoughts, memories, branches, and package infoerrors.py: current exception types
memory-bank/sessions/: session markdown filesmemory-bank/memories/: standalone memory markdown filesmemory-bank/patterns/: reserved pattern storagememory-bank/index.md: session registry
When changing this repository:
- preserve the distinction between canonical docs and retrievable machine memory
- add explicit artifact and metadata models before adding more retrieval complexity
- prefer stable MCP workflows like
retrieve_contextorgenerate_handoffover low-level storage tools - keep local-first fallback viable even when cloud providers are configured
- treat documentation updates as part of the architecture, not an afterthought
When implementing the target architecture, expand tests around:
- artifact metadata validation
- promotion gating
- handoff generation
- retrieval composition
- fallback behavior between cloud-assisted and local modes
- MCP tool contracts for context retrieval and memory promotion