1.6 KiB
1.6 KiB
Cognitive Memory
Markdown-based AI memory system — MCP server, CLI, decay scoring, episodic logging. stdlib-only (no pip dependencies).
Commands
- Run CLI:
cd /mnt/NV2/Development/cognitive-memory && uv run python client.py <command> - Wrapper:
claude-memory <command>(installed at~/.local/bin/claude-memory) - MCP server:
python3 mcp_server.py(stdio JSON-RPC, registered in~/.claude.json)
Architecture
common.py— constants, YAML parsing, decay math, helpers (everything imports from here)client.py—CognitiveMemoryClientcore API + CLI entrypoint (if __name__)cli.py— argparse CLI, called fromclient.py's__main__blockedges.py,embeddings.py,analysis.py— mixins composed intoCognitiveMemoryClientmcp_server.py— standalone MCP server wrappingCognitiveMemoryClient- Data lives at
~/.local/share/cognitive-memory/(never in this repo)
Style
- Flat module imports:
from common import ...,from client import ...(no package prefix) - Mixin pattern:
EdgesMixin,EmbeddingsMixin,AnalysisMixincomposed via multiple inheritance - YAML frontmatter in memory files parsed manually (no PyYAML dependency)
- All paths via
pathlib.Path
IMPORTANT
- Zero external dependencies — stdlib only. Ollama/OpenAI are optional HTTP calls.
mcp_server.pydoessys.path.insert(0, ...)to find sibling modules — don't restructure without updating thisfeature.jsonhas stalefilesentries from pre-extraction — update when modifying file list- Skill layer at
~/.claude/skills/cognitive-memory/(SKILL.md + SCHEMA.md) is separate — don't duplicate app code there