state-memory-mcp
@putervision/state-memory-mcp
@putervision/state-memory-mcp 是一个零基础设施、确定性的模型上下文协议(MCP)服务器,为 AI 编程助手(如 Cursor、Claude Code、Gemini 或 Copilot)提供结构化、持久化的 SQLite 图,用于跟踪工作流状态——任务、决策、制品、计划、阻塞项及其语义关系。
🌐 官方文档与网站:statememorymcp.com
⚡ 快速开始与安装
前置条件:Node.js >= 18.18.0
# 1. Install globally
npm install -g @putervision/state-memory-mcp
# 2. Navigate to your project directory
cd your-project
# 3. Initialize state-memory-mcp
# Creates .state-memory-mcp/, updates .gitignore, registers project,
# and scaffolds IDE instructions and MCP configs for Cursor, Claude, VS Code, Windsurf, etc.
state-memory-mcp init
# Done! Restart your IDE or Agent Manager to activate.其他备选方案
# Run directly via binary (after global install)
state-memory-mcp run
# Re-initialize across all registered workspace projects
state-memory-mcp init-globalRelated MCP server: AIVectorMemory
🌟 核心亮点
🧠 确定性状态记忆:记忆操作全程无 LLM 参与;快速、确定性的 SQLite 图遍历。
⚡ 13 个生产级整合式 MCP 工具:完整的 CRUD、关系链接、DAG 循环检测、FTS5 搜索、TF-IDF RAG、时间旅行历史回滚、规范驱动开发及自愈式校验。
📉 高效上下文管理:将上下文卸载到本地 SQLite 数据库,帮助减少提示词上下文膨胀和上下文窗口占用。
🚀 降低 67%–74% 延迟:消除多步文件扫描循环;智能体可在毫秒级检索到未阻塞任务和阻塞项。
🤝 多智能体黑板:共享 Context 存储,允许并行子智能体安全地发布决策、任务和阻塞项的更新。
🎨 交互式 3D 可视化器:基于浏览器的深色模式 3D WebGL 力导向图可视化器(
state-memory-mcp view)。🔗 双 MCP 协同:与
@putervision/vision-memory-mcp搭配使用,实现视觉状态缓存、感知哈希和加密多模态证据包。🛡️ 100% 本地与隐私:本地优先架构;所有状态均保留在工作区的
.state-memory-mcp/目录中。
🛠️ MCP 工具套件
@putervision/state-memory-mcp 提供 13 个生产级整合式 MCP 工具,覆盖 5 个核心工作流领域:
图与关系:
manage_nodes(节点 CRUD、FTS5/TF-IDF 向量搜索、原子批量变更、观测笔记)、manage_edges(类型化 DAG 链接、多模态可视化状态链接)。任务执行与工作队列:
manage_tasks(拓扑依赖队列、阻塞项检测、完成任务并关联制品、自动清理)、manage_sessions(智能体属性、轮次跟踪、上下文引导)。规范驱动开发(SDD):
manage_specs(PRD/RFC 解析、需求到任务的分解、实时验收标准验证、符合度评分)。分析、审计与诊断:
get_analytics(速度、进度消耗、Token ROI、认知负担、关键路径)、get_events(SHA-256 防篡改事件账本)、run_diagnostics(DAG 验证、健康检查、AST 引用完整性)。数据、快照与多智能体:
manage_snapshots(检查点、时间旅行撤销)、manage_database(备份、校验和审计、VCS 分支合并)、manage_data(批量导入/导出、ML 轨迹)、query_graph(子图、依赖追踪、原生 SQL)、use_blackboard(多智能体异步主题黑板)。
👉 如需完整的参数规范、返回结构和示例载荷,请参阅 工具参考指南 和 正式 API 参考。
🚀 架构与状态图生命周期
AI Agent Prompt / Task
│
▼
┌─────────────────────────────────┐
│ Agent Session Attribution │ ──▶ manage_sessions(action: "start")
└────────────────┬────────────────┘
│
▼
┌─────────────────────────────────┐
│ Context & Task Prioritization │ ──▶ get_analytics(action: "summary")
│ │ ──▶ manage_tasks(action: "next")
└────────────────┬────────────────┘
│
▼
┌─────────────────────────────────┐
│ Deterministic Graph Mutation │ ──▶ manage_nodes(action: "create"|"update")
│ (Tasks, Decisions, Blockers) │ ──▶ manage_edges(action: "add"|"link_visual")
└────────────────┬────────────────┘
│
▼
┌─────────────────────────────────┐
│ Spec & Integrity Verification │ ──▶ manage_specs(action: "compliance"|"verify")
│ │ ──▶ run_diagnostics(action: "validate")
└────────────────┬────────────────┘
│
▼
┌─────────────────────────────────┐
│ Persistent SQLite Storage │ ──▶ .state-memory-mcp/graph.db (WAL mode)
│ Append-Only Event Ledger │ ──▶ SHA-256 Cryptographic Audit Chain
└─────────────────────────────────┘📚 文档目录
请浏览 docs/ 目录中的专项指南和深入解析:
指南 | 描述 |
🏗️ 架构与代码库浓缩 | 高信号量级的架构概述、模块清单、数据流与设计决策。 |
逐步迁移指南、旧版工具映射表,以及 | |
💡 价值主张与理论 | 认知外部化、FSM 形式化、首跳确定性与基准指标。 |
📋 状态记忆概念 | 节点类型( |
⚙️ 配置与 IDE 设置 | 自动初始化细节、环境变量表及编辑器配置(Cursor、VS Code、Claude、Antigravity、Windsurf)。 |
🛠️ CLI 命令参考 | CLI 标志( |
⏱️ 会话、快照与 SDD | 会话生命周期、事件审计线索、快照、轨迹、子目录支持与规范驱动开发。 |
🧰 工具、资源与提示模板. | 全部 13 个整合式 MCP 工具的完整参考、只读 |
所有 MCP 端点的正式参数、返回结构及代码签名。 | |
查看并导出交互式 WebGL 3D 力导向图可视化器。 | |
🗄️ 数据库 Schema | SQLite 表、列、索引及结构迁移历史。 |
📖 智能体操作手册:5 步标准工作流
当自主 AI 智能体进入带有 state-memory-mcp 的仓库时:
1. Orient & Bootstrap ──▶ manage_sessions(action: "start") + get_analytics(action: "summary")
2. Task Selection ──▶ manage_tasks(action: "next") + manage_tasks(action: "find_blockers")
3. Trace Context ──▶ query_graph(action: "trace") + manage_specs(action: "compliance")
4. Execute & Record ──▶ manage_nodes(action: "create", type: "decision") + manage_edges(action: "link_visual")
5. Validate & Close ──▶ run_diagnostics(action: "validate") + manage_tasks(action: "complete") + manage_sessions(action: "end")🧪 测试
# Run full unit, integration, and performance benchmark test suite across all 110 test files (406 tests)
npm run test⚖️ 许可证与免责声明
由 [PuterVision](https://putervision.com)开发与维护。以 MIT License 发布。
本地存储保证:所有图数据、决策记录和事件日志均 100% 保存在你的工作区中,绝不传输任何遥测信息或项目数据。
商标与非隶属于声明:产品名称(Cursor、Claude Code、Gemini、Windsurf、VS Code、GitHub、SQLite)归各自所有者所有,仅用于兼容性标识。
Available Tools
13 toolsget_analyticsARead-onlyIdempotent
Compute workflow metrics, velocity, burndown, cognitive load, decision lineages, and contradiction audits (actions: summary, velocity, burndown, value_metrics, cognitive_load, critical_path, context_snapshot, active_context, decision_trail, find_related_decisions, contradictions). Use get_analytics instead of query_graph when calculating high-level progress statistics, ROI metrics, or auditing decision conflicts.
Returns summary dashboard, velocity charts, burndown series, cognitive load metrics, critical path DAG, or contradiction reports.
Inputs: action (required), days, node_id, project, +3 more.
get_eventsARead-onlyIdempotent
Inspect the append-only event audit ledger, query structured changesets, and generate session post-mortems (actions: log, changelog, post_mortem). Use get_events instead of manage_snapshots when examining the granular chronological sequence of mutations rather than restoring state checkpoints.
Returns chronological event array, structured changeset diff, or session post-mortem markdown report.
Inputs: action (required), limit, since, until, +5 more.
manage_dataADestructive
Export and import graph structures, issue tracker items, fine-tuning trajectories, and multimodal synergy metrics (actions: export_graph, export_issues, export_trajectories, export_joint_trajectories, export_synergy_metrics, from_tick, import_graph, import_issues, import_spec). Use manage_data instead of query_graph when bulk-transferring graph data or generating AI training datasets.
Returns serialized graph payload, trajectory dataset, synergy metrics, or import statistics.
Inputs: action (required), edges, force, limit, +9 more.
manage_databaseADestructive
Physical SQLite database maintenance, backups, integrity checks, and Git VCS state sync (actions: backup, restore, audit, merge, branch_diff, branch_merge). Use manage_database instead of manage_snapshots when managing physical SQLite files, cross-branch merges, or database corruption audits.
Returns database backup path, foreign key integrity report, branch merge conflict report, or diff.
Inputs: action (required), force, project, backupPath, +5 more.
manage_edgesADestructive
Manage typed graph relationships between nodes (actions: add, remove, batch_add, link_visual). Use manage_edges instead of manage_nodes when creating or modifying relationships between existing entities rather than entity data itself.
Returns created edge record, batch count, or visual link confirmation.
Inputs: action (required), type, edges, project, +8 more.
manage_nodesADestructive
Manage graph nodes in the state graph (actions: create, update, get, remove, list, search, batch_create, batch_update, add_note). Use manage_nodes instead of manage_tasks when operating on general node types (decisions, artifacts, plans, milestones, blockers) rather than runnable task workflow states.
Returns node object, edge connections, batch results, or search matches.
Inputs: action (required), id, ids, tags, +17 more.
manage_sessionsA
Manage agent tracking sessions and multi-turn workflow attribution (actions: start, end, list, bootstrap). Use manage_sessions instead of manage_tasks when establishing agent session boundaries and tracking multi-turn workflows rather than individual work items.
Returns session record, bootstrap context snapshot, or active session listing.
Inputs: action (required), limit, project, agent_id, +4 more.
manage_snapshotsADestructive
State checkpointing, time travel, diffing, and undo operations (actions: save, list, diff, get_state, revert, undo, get_history). Use manage_snapshots instead of manage_database when reverting state graph mutations or comparing checkpoints rather than physical database file maintenance.
Returns snapshot record, state graph diff, historical graph state, or node audit history.
Inputs: action (required), force, limit, node_id, +5 more.
manage_specsA
Spec-Driven Development (SDD) lifecycle and workflow template generation (actions: scaffold, ingest, export, compliance, verify, decompose_feature, template). Use manage_specs instead of manage_nodes when authoring, ingesting, or verifying formal SDD specifications against acceptance criteria.
Returns specification AST, compliance matrix, verification verdict, or decomposed feature plan.
Inputs: action (required), name, title, format, +9 more.
manage_tasksA
Task prioritization, workflow execution, blockers, and stale task management (actions: next, complete, find_blocked, find_stale, find_blockers, find_similar_blockers, auto_prune). Use manage_tasks instead of query_graph when querying runnable tasks by priority order or resolving execution blockers.
Returns prioritized runnable tasks, blocker hierarchy, similar resolved blockers, or completion confirmation.
Inputs: action (required), type, limit, query, +16 more.
query_graphARead-onlyIdempotent
Query graph topology, neighborhoods, dependency paths, safe read-only SQL queries, and compact System One task slices (actions: subgraph, trace, raw, natural_language, compact_slice). Use query_graph instead of get_analytics when exploring graph topology and path traversals rather than aggregated numerical metrics.
Returns subgraph nodes and edges, upstream/downstream trace path, raw SQL rows, or compact task slice.
Inputs: action (required), sql, depth, query, +7 more.
run_diagnosticsADestructive
Run graph sanity checks, health diagnostics, reference validation, audit chain verification, and storage maintenance (actions: validate, doctor, check_refs, audit_chain, compact, archive, prune_events, version, dedupe). Use run_diagnostics instead of get_analytics when performing database repair, AST reference auto-healing, or verifying SHA-256 event hash chains.
Returns validation diagnostics, health report, broken reference repair log, Merkle chain audit, or maintenance stats.
Inputs: action (required), apply, checks, dry_run, +6 more.
use_blackboardADestructive
Multi-agent shared blackboard for asynchronous coordination and mutex leases (actions: get, set, delete, lease, list, post, read). Use use_blackboard instead of manage_nodes when exchanging transient inter-agent messages or mutex resource leases rather than recording persistent graph knowledge.
Returns blackboard message payload, lease acquisition status, active topic list, or deletion confirmation.
Inputs: action (required), id, mode, limit, +9 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
The descriptions are unusually thorough with explicit 'use X instead of Y' guidance, which genuinely helps separate tools like manage_nodes vs manage_edges vs use_blackboard and manage_snapshots vs manage_database vs get_events. However, the underlying domain heavily overlaps: nodes/edges/specs/blackboard all manipulate graph-like entities, and query_graph/get_analytics/run_diagnostics all operate on the same graph for read, aggregate, and maintenance purposes. Boundaries are clarified by prose rather than being intrinsically clean.
Most tools use a manage_* pattern (manage_data, manage_nodes, manage_edges, manage_sessions, manage_tasks, manage_snapshots, manage_specs, manage_database), which is consistent. But the remaining tools break the pattern with distinct verbs (query_graph, get_analytics, get_events, run_diagnostics, use_blackboard), producing mixed conventions. It remains readable, but there is no single predictable verb_noun scheme.
13 tools is within the well-scoped range and appropriate for a state/memory graph server covering graph, tasks, sessions, specs, analytics, events, and diagnostics. The design consolidates many operations as actions within each tool rather than exploding the tool count, keeping the surface manageable. Slightly heavy given the breadth, but reasonable.
Coverage is broad: node/edge CRUD, task workflow, sessions, snapshots/time-travel, specs, database maintenance, graph queries, analytics, event ledger, diagnostics, and multi-agent blackboard. Most lifecycle operations (create, update, get, list, remove, batch) appear across the mutation tools. Minor gaps exist, such as bulk-delete actions being less explicit than bulk-create.
Maintenance
Related MCP Connectors
Shared memory for your AI tools: tasks, notes and context every tool can read and write over MCP.
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Persistent memory for AI assistants. Save once; recall from Claude, ChatGPT, or any MCP client.
Cross-tool persistent memory and context for AI assistants over MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA self-hosted MCP server that provides AI assistants with a shared, persistent SQLite-backed memory for storing and retrieving project context, decisions, and discoveries. It enables cross-session continuity and team-wide knowledge sharing to keep AI coding tools aligned and informed.3MIT
- AlicenseBqualityDmaintenanceMCP server that provides cross-session persistent memory for AI coding assistants using local vector database and semantic search, enabling automatic recall of project context, issues, and tasks.997 PyPI93Apache 2.0
- FlicenseNot gradedqualityDmaintenanceA persistent, conflict-aware memory MCP server for AI coding assistants (Cursor, Claude Code).-
- AlicenseNot gradedqualityDmaintenanceA local MCP memory server that gives AI assistants durable project memory across coding sessions, storing context, changes, and decisions.1MIT