
Statecore Mcp
io.github.yul761由 GitHub 账号 yul761 发布v0.1.2更新于 Oct 24, 2026
Auditable memory for coding agents: evidence chains, supersession history, keyless embedded SQLite
概览
为编码代理提供可审计的长期记忆存储,每条事实都保留其证据、版本链以及被丢弃的记录原因。
- 可以做什么
- StateCore 是面向编码代理的自托管记忆运行时,通过 MCP 以 statecore-mcp 包对外提供。它把事件和文档写入按作用域划分的记忆,经确定性摘要流水线合并为受保护的稳定状态,并在调用方声明的字符预算内检索有依据的证据。remember、why、recall、handoff 等工具让助手记录决策、追问某条事实的依据及此前的说法,并把会话上下文交接给同一项目上的其他 MCP 客户端。被取代和退役的事实仍留在记录中,不会被删除。
- 适用场景
- 当助手需要跨会话、跨厂商的持久项目记忆,并且要求存储的事实可审计、可追溯到证据、可解释而非被静默覆盖时,适合使用。它面向长期在同一代码仓库上工作的编码代理,包括 Claude Code、Codex、Cursor 等 MCP 客户端之间的交接。
- 运行要求
- 以 stdio MCP 进程在本地运行,通常通过 npx statecore-mcp 启动,使用本地 SQLite 文件;核心记忆、审计和召回无需注册或模型密钥。可选的对话事件后台蒸馏需要设置 FEATURE_LLM=true,并提供面向 OpenAI 兼容端点的 MODEL_API_KEY、MODEL_BASE_URL 和 MODEL_NAME。STATECORE_SCOPE 可覆盖记忆作用域名称。仅支持桌面端,无网页版。
安装
在 SourceWeft 中
- 打开 控制台中的 Statecore Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
StateCore
[CI] [Integration Smoke] [License: MIT]
Auditable memory for coding agents and AI systems. Every fact StateCore holds carries its evidence, its version chain, and a recorded reason for every discard — so "why do you believe this, and what did you believe before?" always has an answer.
StateCore is a self-hosted, low-drift long-term memory runtime for local or BYO models. It turns memory from accumulated text into governed state: events are ingested, run through a deterministic digest pipeline, and merged into protected stable state. The LLM proposes; the pipeline decides.
Try it in 30 seconds
No server, no signup, no model key — one SQLite file over MCP:
[statecore-mcp demo: remember, facts, why, forget — all keyless]
remember a decision in one session, ask why in the next: you get the fact, the evidence behind it, and its version history — superseded and retired facts stay on the record, marked, never deleted. And sessions hand off across vendors: handoff records where one session stopped, and the next one — Claude Code, Codex, Cursor, any MCP client on the same project — receives it at the top of recall, with every earlier stop-point still on the audit chain. Configs for Cursor, dsh, and every other MCP host: apps/mcp/README.md.
Capture is easy. Trust is hard.
Most agent-memory tools compete on capturing more — hook every event, compress the transcript, inject it back. Capture is the solved half of the problem. The unsolved half is what those tools' own issue trackers are full of: memories that silently stop being written, stale decisions injected as if still current, cross-project leakage, and no way to audit or repair what the store believes. That is not a rhetorical claim — docs/prior-art-failure-modes.md cites the verified issues, by number, across five systems.
StateCore is built for that second half:
- Nothing is silently lost. Every discard is logged against a fixed set of reasons; every replaced fact keeps a
supersededBychain; retired facts are marked, never deleted. - Nothing is silently believed. Writes go through a deterministic pipeline with consistency gates — an LLM proposal alone cannot promote itself into stable state.
- Nothing degrades silently. A failed digest carries
degraded; the budget reports what it refused; retrieval reports which embedding stages failed and derives itsmodefrom what actually ran, not from what was configured. - Everything is checkable.
whyreturns a fact's evidence and full version history; a digest's selection report shows exactly what it kept and dropped.
How this compares to other memory systems, mechanism by mechanism: docs/why-auditable.md.
Features
- Event store — ingest stream events and keyed documents into per-scope memory
- Digest pipeline — background worker consolidates events into stable state through selection, merge, consistency checks, and retry
- Protected state — goals, constraints, decisions, and todos are gated by a consistency gate; the LLM proposes, the pipeline enforces
- Auditable facts — every fact carries its evidence and its supersession chain, and a fact that leaves the active set is retired rather than deleted, so "why do you believe this, and what did you believe before" stays answerable
- Recorded discards — the digest logs what it dropped and why, against a fixed set of reasons; losing information is survivable, losing it silently is not
- Replaceable ontology — facets come from a pack resolved per tenant and scope, so the engine stores, protects and supersedes without knowing what a facet means
- Retrieval — hybrid keyword + optional pgvector semantic search over events and digests, packed into a caller-declared character budget that reports what it refused; pinned events and write-protected facts get a bounded ranking boost (never a filter), and embedding failures are itemised in
retrieval.degradedinstead of silently downgrading quality - Reminders — daily reminder job surfaces follow-up items from active scopes
- Benchmarks — a published LongMemEval comparison against mem0 OSS at an equal context budget, plus a built-in synthetic regression suite that guards fact retention, goal stability, decision continuity, and retrieval MRR across commits
- MCP server —
statecore-mcp, a zero-deploy Model Context Protocol front end for coding agents; keyless by default, one SQLite file, no infrastructure
Quickstart
1. Install dependencies
2. Configure environment
Minimum required variables:
To enable LLM features (digest, answers):
On OpenAI, pick a model that accepts
reasoning_effort. The runtime turn sends it on every request —assistant-runtime.tsdefaults it tolowrather than leaving it unset — soPOST /v1/memory/runtime/turnfails against agpt-4o*model, which rejects the parameter. Digest and answers do not send it unlessMODEL_STRUCTURED_OUTPUT_REASONING_EFFORTis set, so agpt-4o*model appears to work right up until the first runtime turn. Any endpoint that accepts the parameter, or ignores unknown ones, is fine.
3. Start infrastructure
This starts Postgres (with pgvector) and Redis.
4. Prepare the database
5. Start the services
The API is available at http://localhost:3002 (or whatever PORT is set to).
API
Authentication
All requests require an x-user-id header. For local development, set LOCAL_USER_TOKEN=local-dev-user in .env and send:
Public surface (/v1)
The /v1 prefix exposes the stable, public-facing subset of the API. Full OpenAPI schema:
Interactive Scalar UI:
Reference documentation: docs/api.md
Key endpoints
The three audit readers in the middle are the ones that make the engine's memory
checkable rather than merely stored; docs/api.md lists the full frozen surface.
API stability: the
/v1contract is frozen and additive-only — see STABILITY.md. It currently covers 22 operations across 20 paths. The contract carries its own version in the generated OpenAPI document (info.version, currently1.8.0), which is what tells you how current a spec you are holding; it is not the release tag and not any package version.
¹ Internal read-model endpoints — registered only at /memory/..., not under /v1, and not part of the frozen /v1 contract.
Use it from your coding agent (MCP)
statecore-mcp is a separately published npm package that fronts this engine
over the Model Context Protocol — no
running server required. It runs the engine embedded (one process, one SQLite
file), keylessly by default:
[statecore-mcp demo: remember, facts, why, forget — all keyless]
Point any MCP client at it, or run it against a full StateCore deployment via
--url for shared/multi-agent memory. Full docs, host configs, and the
keyless/keyed capability matrix: apps/mcp/README.md.
Team memory: one self-hosted deployment as the shared project brain for every agent your team runs — dsh sessions, Claude Code, CI — with one audit trail across all of them: docs/team-memory.md.
Architecture
StateCore sits between your client and your model endpoint. Events flow in, the digest pipeline consolidates them into protected state, and retrieval pulls grounded evidence back out for answers or runtime turns.
Three-layer memory model:
- Fast Layer — synchronous; assembles prompt context for the current turn from recent events, working memory, and stable state
- Working Memory — lightweight, quickly-updated structured memory; bridges raw recent turns and slow stable-state consolidation
- State Layer — authoritative, replayable, low-drift long-term memory; updated asynchronously through the digest control pipeline
See docs/vision-and-roadmap.md for the layered model design and roadmap.
Testing and Benchmarks
Run package tests:
Run the full latency + memory quality benchmark:
Run the synthetic regression suite (no LLM required):
The synthetic suite is a regression guard, not a capability benchmark: every scenario scores 1.000 on the current engine, deliberately — its job is to fail when a change breaks retention, stability, or retrieval, not to rank systems. The comparison that ranks systems is LongMemEval, below.
Benchmark methodology: docs/benchmarking.md
LongMemEval
Compared against mem0 OSS on
LongMemEval at an equal context
budget — the same number of characters of memory in the answerer's prompt,
rather than the same number of retrieved items. 194 questions, gpt-5 answering,
the official gpt-4o judge (2026-08-08):
At 64k, StateCore also beats the 70.1% ±6.4 ceiling of pasting the entire corpus into the prompt with no memory layer at all. At 4k it loses to mem0 by 10 points — a real difference in kind, explained rather than closed, in the full write-up.
Numbers, caveats and what the benchmark does not measure:
docs/longmemeval.md. Harness, raw retrievals and
per-question judge verdicts:
memory-budget-bench.
Documentation
docs/start-here.md— orientation for new contributorsdocs/repo-map.md— repo structure, where code belongs, and the full doc indexdocs/philosophy.md— what the engine is for, and why auditability is the centredocs/why-auditable.md— audit mechanisms compared with other memory systems, factuallydocs/prior-art-failure-modes.md— the documented failure modes this design answers, with verified issue citationsdocs/glossary.md— facet, pack, supersession, retirement, drop logdocs/api.md— full API reference and the/v1contract rulesdocs/vision-and-roadmap.md— positioning and roadmap, with a status mapdocs/technical-overview.md— architecture internalsdocs/digest-state.md— digest state specificationdocs/protected-state-merge.md— the deterministic merge, field by fielddocs/drift-definition.md— drift definition and metricsdocs/assistant-runtime.md— assistant runtime specificationdocs/benchmarking.md— benchmark methodologydocs/longmemeval.md— LongMemEval results vs mem0 OSSdocs/evaluation-metrics.md— evaluation metrics specification
Contributing
- Fork the repo and create a feature branch.
- Run
pnpm lintandpnpm --filter @statecore/core testbefore opening a PR. - Follow Conventional Commits.
License
MIT — see LICENSE.
来源:README.md,提交 724f309
工具
0版本历史
1- v0.1.2最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分