Local Working Memory for AI Coding Agents v0.26.0

Your product Git is not a memory store.
Put agent state in a curated vault.

Fast, token-budgeted working memory (default 8 KB brief, configurable) outside your repository. Prevents commit pollution, stops repeating bug traps across sessions, and keeps your product clones clean.

$ npm install -g github:jpolvora/spec-memo

Why Git Is The Wrong Place For Agent Memory

Product repositories belong to your product: clean source code, tests, and documentation. Agent scratchpads, execution logs, and repetitive traps belong in an external vault.

The In-Repo Memory Trap

  • Polluted Working Trees: Hundreds of temporary plan files (.agents/plans/, MEMORY.md) clutter git status and bloating commits.
  • Token Budget Exhaustion: Agents waste 40KB+ reading entire unstructured memory logs instead of focused code context.
  • Memory Lost Across Clones: Work in a new branch clone and the agent forgets previous architectural decisions and known bug traps.
  • Git Merge Conflicts: Concurrent sessions produce unresolvable merge conflicts on append-only memory markdown files.

The spec-memo Vault Advantage

  • 100% Clean Product Git: Zero files committed in your product repository. Pre-commit write-block hook prevents accidental leaks.
  • Token-Budgeted Brief (default 8 KB): bootstrap delivers ranked anti-regression traps, active decisions, and code drift warnings. Raise the cap in ~/.spec-memo/config.json (bootstrap.maxBytes) or per call via maxBytes.
  • Automatic Project Remote Binding: Multiple repository clones automatically share the exact same working memory via git remote hash.
  • Disposable SQLite FTS5 Index: Instant full-text search with Porter stemming, path globbing, and automatic markdown re-indexing.
  • Batched Vault-Git + Dual-Mode Sync: Optional private git remote backup with vaultGit.atomic (default batched). When hybrid HTTP and vault-git are both enabled, memo sync and session_end flush both channels in parallel—fail-open, never crashing the MCP server.

Enable In Your AI Coding Environment

spec-memo runs as a standard Model Context Protocol (MCP) server. Configure it in seconds for your favorite coding assistant.

Cursor MCP Configuration ~/.cursor/mcp.json
{
  "mcpServers": {
    "spec-memo": {
      "command": "memo",
      "args": ["serve"]
    }
  }
}
Claude Desktop Configuration %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "spec-memo": {
      "command": "npx",
      "args": ["-y", "github:jpolvora/spec-memo", "serve"]
    }
  }
}
Antigravity / Gemini IDE Config ~/.gemini/config/mcp_config.json
{
  "mcpServers": {
    "spec-memo": {
      "command": "memo",
      "args": ["serve"]
    }
  }
}
VS Code / Cline / Roo Code Settings cline_mcp_settings.json
{
  "mcpServers": {
    "spec-memo": {
      "command": "memo",
      "args": ["serve"]
    }
  }
}
Local Terminal & Server Modes Bash / PowerShell
# Run session bootstrap brief in any repository
memo bootstrap

# Start HTTP / SSE server on :3123 + Status Monitor on :3124
memo serve --sse --port 3123 --status-port 3124

# Run repository pollution diagnostic & cleanup
memo doctor --fix

The 6 Pillars of Working Memory

Every memory entry is stored as a clean Markdown file with YAML frontmatter, typed and indexed for precision retrieval.

Trap Anti-Regression

Anti-Regression Bug Traps

Captures tricky pitfalls, concurrency races, and platform quirks. Path-matched globbing and 70% automatic superseding prevents duplicate warnings.

memo upsert --kind trap --title "SQLite WAL Lock" --severity high --path-patterns "src/db/*.ts"
Decision Architecture

Architecture Decisions (ADRs)

Documents system design choices, trade-offs, and invariants. Can be promoted into human product docs on-demand via memo promote.

memo upsert --kind decision --title "Use SQLite FTS5 for Search" --body "ADR: Zero daemon overhead"
Spec Contract

Feature Specifications

Feature definitions with linked paths and verified commit SHAs. Automatic drift detection flags when source code changes away from the spec.

memo upsert --kind spec --slug "auth-jwt" --body "Spec: JWT Auth Flow"
Plan Execution

Execution Plans & State

Task graphs, DAG execution state, and progress trackers. Garbage collection automatically compacts completed plans to save vault space.

memo upsert --kind plan --slug "auth-dag" --body "Tasks: 1. DB 2. Route 3. Test"
Log Audit Trail

Append-Only Audit Logs

Chronological task events and milestone markers. Never pollutes context briefs, but fully searchable and rolled up monthly.

memo append --event "Refactored token verification and passed 196 tests"
Scratch TTL Retention

Ephemeral Scratch & Reviews

Temporary code review notes and prompt scratchpads. Auto-purged via curator GC with 7-day (scratch) and 14-day (reviews) TTL retention.

memo gc --dry-run # Cleans expired scratch & reviews

Explore 11 MCP Tools & CLI Commands

Every tool is available through MCP for AI agents and matching CLI commands for developers.

/
bootstrap MCP • CLI
Session Start

Binds repository working directory to project identity; returns a token-budgeted brief (default 8 KB; config.json bootstrap.maxBytes or --maxBytes) with top-ranked traps, active decisions, live slug, and SHA drift warnings.

memo bootstrap --slug feature-auth --path src/auth.ts
search MCP • CLI
Query

Full-text search across all vault records using Porter stemming, tags filter, path pattern globbing, and recurrence-weighted ranking.

memo search "database lock" --kind trap --path src/db/*.ts
get MCP • CLI
Read

Fetches a single record by exact ID or kind+slug combination with full YAML frontmatter and markdown body.

memo get --id trap-sqlite-wal-lock
upsert MCP • CLI
Write

Writes or updates a memory record. Validates schema, redacts secrets, checks token overlap for deduplication, and updates index views.

memo upsert --kind trap --title "Close statement before connection"
append MCP • CLI
Log

Appends a timestamped audit event or task execution milestone without polluting the primary context brief.

memo append --event "Passed all 196 test suites"
forget MCP • CLI
Archive

Soft-archives a memory record (marks status=archived) or permanently purges it from disk with the purge flag.

memo forget --id scratch-old-notes --purge
gc MCP • CLI
Curator

Applies TTL retention (7-day scratch, 14-day review), compacts completed execution plans, and rolls up monthly logs.

memo gc --dry-run
promote MCP • CLI
Export

Promotes a vault record into the product repository as documentation (e.g. ADR or MADR template). Default-deny without destination.

memo promote decision-01 --to docs/adr/001.md --format adr
check_version MCP • CLI
Version

Compares the active spec-memo package version against the latest npm registry release. Soft-fails cleanly when offline.

memo check-version --json
install_skills MCP • CLI
Install

Installs packaged runtime agent skills (such as ws-memo) directly into a consumer product's .agents/skills/ directory.

memo install-skills --product-root /path/to/project --force
prompt MCP • CLI
History

Ingests prompt turns and session lifecycles into the vault; supports FTS search, activity reports, AI rule derivation, and intent-story export. session_end also flushes hybrid HTTP and batched vault-git when enabled. Aliases: memo prompts, memo session, memo activity.

memo session end s1 --summary "Shipped auth refresh"
memo serve CLI Only
Transport

Runs the MCP server in stdio mode (default) or HTTP/SSE mode on port :3123 with a live status companion UI on port :3124. Graceful shutdown flushes batched vault-git and hybrid sync when enabled.

memo serve --sse --port 3123 --status-port 3124
memo status CLI Only
Inspector

Queries live daemon reachability (SSE, Status, Canvas, Remote), project bindings, record counts breakdown, and vault storage footprint.

memo status --check
memo doctor CLI Only
Diagnostic

Validates vault structure, checks SQLite FTS5 integrity, and scans the product tree for forbidden workflow residue with automated --fix.

memo doctor --fix --rebuild
memo rank CLI Only
Recurrence

Ranks active anti-regression traps by occurrence frequency, filters by architectural layer, and exports to reusable skills.

memo rank --layer web --limit 10
memo canvas CLI Only
Visual Graph

Starts an interactive visual node graph viewer and REST API on port :3125 (configurable in config.json) for browsing memory relationships.

memo canvas --port 3125
memo setup CLI Only
Setup

Configures vault deployment mode (local, hybrid, remote) and automatically writes or prints host MCP configuration snippets.

memo setup --mode hybrid --url http://127.0.0.1:3123 --write-mcp
memo reset CLI Only
Disaster Recovery

Safely wipes memory databases and unlinks compiled markdown while creating an automatic timestamped backup snapshot in backups/.

memo reset --force
memo restore CLI Only
Restore

Restores full vault state from timestamped pre-wipe ZIP backups or raw archives. Use memo backups to list saved snapshots.

memo restore --latest --overwrite
memo hook install CLI Only
Safety

Installs a git pre-commit write-block hook into the consumer repository to prevent accidental commits of in-repo memory files.

memo hook install --productRoot /path/to/repo
memo sync CLI Only
Sync

Flushes hybrid HTTP delta sync and/or vault-git commit + pull/push. Dual-mode (mode: hybrid + vaultGit.enabled) runs both channels in parallel. Batched vault-git (atomic: false, default) does not commit on every upsert—flush here, on session_end, or graceful serve shutdown.

memo sync --dry-run --json
memo export-vault CLI Only
Encryption

Exports or restores encrypted portable vault archives using AES-256-GCM and PBKDF2 key derivation.

memo export-vault --password "secret" -o ~/vault-backup.json

How spec-memo Isolates Memory

A hybrid architecture combining human-readable Markdown files, disposable SQLite FTS5 search, and zero-friction MCP protocol bridges.

┌────────────────────────────────────────────────────────────────────────┐
│                        AI CODING AGENT SESSION                         │
│             (Cursor, Claude Desktop, Antigravity, VS Code)             │
└───────────────────────────────────┬────────────────────────────────────┘
                                    │ Model Context Protocol (MCP)
                                    ▼ Stdio / SSE Transport (:3123)
┌────────────────────────────────────────────────────────────────────────┐
│                          SPEC-MEMO ENGINE                              │
│  ┌─────────────────────────┐  ┌─────────────────────────────────────┐  │
│  │   Secret Redaction      │  │    Trap Deduplication Engine        │  │
│  │   Write-Block Guard     │  │    Recurrence Ranking & TTL GC       │  │
│  └────────────┬────────────┘  └──────────────────┬──────────────────┘  │
│               │                                  │                     │
│               ▼                                  ▼                     │
│  ┌─────────────────────────┐  ┌─────────────────────────────────────┐  │
│  │   Disposable SQLite     │  │      Markdown Source of Truth       │  │
│  │   FTS5 Index (memo.db)  │  │      (~/.spec-memo/projects/<id>/)  │  │
│  └─────────────────────────┘  └─────────────────────────────────────┘  │
└────────────────────────────────────────────────────────────────────────┘
                                    │
                         ZERO IN-REPO ARTIFACTS
                                    ▼
┌────────────────────────────────────────────────────────────────────────┐
│                       PRODUCT GIT REPOSITORY                           │
│              (Pure source code, tests, and documentation)              │
└────────────────────────────────────────────────────────────────────────┘
📄 Markdown Source of Truth

Every memory record is stored as an individual Markdown file with structured YAML frontmatter. Human-auditable, diffable, and resilient.

Disposable SQLite FTS5

Search is powered by SQLite FTS5 with Porter stemming. If deleted or corrupted, the entire index automatically rebuilds from markdown in milliseconds.

🔗 Git Remote Identity

Projects are automatically identified by normalized git remote URL. Multiple local checkouts share identical working memory seamlessly. Optional vaultGit backs up the vault root to a private git remote with batched or atomic commit cadence.

Live Web Companion (:3124)

Real-Time Status Monitor & Live Activity Log

When running memo serve --sse, a read-only web companion starts automatically on http://127.0.0.1:3124/. View vault health cards, active projects, and watch tool executions and HTTP events stream live via SSE.

$ memo serve --sse --port 3123 --status-port 3124
LIVE ACTIVITY EVENT STREAM ● CONNECTED
12:51:02 BOOTSTRAP github.com-jpolvora-spec-memo (2778B)
12:51:15 SEARCH query="sqlite" hits=4
12:51:40 UPSERT kind=trap id=trap-sqlite-wal-lock
12:52:10 GC purged=2 scratch records

Frequently Asked Questions & CLI Configuration

How to configure the memo CLI on PATH across Windows, Linux, and macOS, handle rebuilds, and troubleshoot agent execution.

How do I add memo to PATH on Windows & Linux?

spec-memo declares its binary in package.json ("bin": { "memo": "./dist/cli.js" }) with a Node shebang.

Option 1: Global link (Recommended for Dev)

cd /path/to/spec-memo
npm install && npm run build
npm link

On Windows, this links memo, memo.cmd, and memo.ps1 in %AppData%\Roaming\npm (already on PATH). On Linux/macOS, it links into /usr/local/bin or your nvm global prefix.

Option 2: Global Install from Local Path

npm install -g "/path/to/spec-memo"

Option 3: Manual Shims (Standalone Wrapper)

  • Linux/macOS: In ~/.local/bin/memo:
    exec node "/path/to/spec-memo/dist/cli.js" "$@"
  • Windows: In a PATH folder (e.g. C:\bin\memo.cmd):
    node "C:\path\to\spec-memo\dist\cli.js" %*
🔄

Do I need to re-link after rebuilding code?

No. The npm link and shims point directly to dist/cli.js.

Whenever you make changes and run npm run build (or run in watch mode via npm run watch), TypeScript compiles output directly to dist/cli.js. The global memo command immediately uses the updated code without requiring you to run npm link again.

🔌

What is the difference between IDE MCP and Terminal CLI?

IDE MCP Configuration: AI editors (Cursor, VS Code, Claude Desktop, Antigravity) use MCP stdio (memo serve or node /path/to/dist/cli.js serve) to call the 11 MCP tools natively inside prompt context.

Terminal CLI (on PATH): Adding memo to PATH enables developers and terminal subagents to run quick commands like memo bootstrap, memo doctor --fix, memo rank, and memo search directly from any shell.

🛠️

Troubleshooting memo: command not found

If running memo --help returns command not found:

  1. Open a new shell session: Environment variables and PATH updates only take effect in new terminal windows.
  2. Check npm global bin in PATH:
    • Windows: Check that %AppData%\Roaming\npm (or npm config get prefix) is in your User or System Environment Variables under PATH.
    • Linux/macOS: Add export PATH="$PATH:$(npm config get prefix)/bin:~/.local/bin" to your ~/.bashrc or ~/.zshrc.
  3. Verify direct execution: Test node /path/to/spec-memo/dist/cli.js --help to confirm the build succeeded.
🌐

What are the default ports, and how do I customize them?

spec-memo services use the following default ports:

  • MCP SSE Daemon (memo serve --sse): 3123
  • Status Monitor UI (companion / /status): 3124
  • Canvas Graph Viewer (memo canvas): 3125

You can override ports via CLI flags (e.g. --port 8080 --status-port 8081) or persist them globally in ~/.spec-memo/config.json under the "ports" key:

{
  "ports": {
    "sse": 3123,
    "status": 3124,
    "canvas": 3125
  }
}

Aliases mcp (for sse) and ui (for status) are also automatically recognized.

Contribute to spec-memo

spec-memo is open source under the MIT license. We welcome contributions from developers and AI practitioners building the future of coding agent infrastructure.

🧩 MCP Host Adapters
Add configuration recipes and test harnesses for new agent frameworks and IDE hosts.
🛡️ Anti-Regression Traps
Contribute refined deduplication heuristics, layer aliases, and trap recurrence patterns.
⚡ Curator & Search GC
Optimize SQLite FTS5 queries, log roll-up algorithms, and automated secret redaction filters.