Project Memory

Not a markdown file. Not a vector database. A persistent knowledge base with typed facts, semantic search, episodic narratives, a knowledge graph with directional edges, working memory pinning, and automatic compaction — all surviving across sessions.

Architecture

Agent Tools

ToolPurpose
memory_recall(query)Semantic search — returns ranked facts by relevance × confidence
memory_query()Load all active facts (expensive — prefer memory_recall)
memory_store(section, content)Persist a new fact
memory_supersede(fact_id, content)Atomically replace a fact with an updated version
memory_archive(fact_ids)Archive stale facts (removed from active context)
memory_episodes(query)Search session narratives for episodic context
memory_focus(fact_ids)Pin facts to working memory (survives compaction)
memory_release()Clear working memory buffer
memory_connect(source, target, relation)Create a typed edge in the knowledge graph
memory_compact()Trigger context compaction to free context window
memory_search_archive(query)Search archived (superseded/stale) facts — not injected into context but still queryable
memory_ingest_lifecycle()Batch-import recent design-tree decisions and resolved questions into the memory store

Lifecycle

  1. Store — agent discovers something important, stores a fact
  2. Recall — on future turns, agent searches for relevant facts by query
  3. Supersede — when understanding changes, old fact is replaced atomically
  4. Connect — relationships between facts are recorded as graph edges
  5. Archive — stale facts are moved to archive (still searchable, not injected)
  6. Compact — when context fills, older conversation is summarized; pinned facts survive

Auto-Ingestion

Two automatic memory flows run without explicit tool calls:

Operator Commands

/memory       # Show memory stats: facts, episodes, working memory
/compact      # Trigger context compaction manually
/note [text]  # Quick-capture a note (persists across sessions)
/notes        # Show pending notes

Storage

Facts are stored as one JSON object per line in the project's memory directory. This file is git-tracked with merge=union in .gitattributes, allowing multiple branches to add facts without merge conflicts. SQLite databases are gitignored and rebuilt from the JSONL source of truth.