Builderforce Memory

io.github.SeanHogg由 GitHub 账号 SeanHogg 发布v2026.10.80更新于 Nov 11, 2026

Token-saving persistent memory for AI agents: recall durable facts instead of re-reading files.

发布方自己的服务:Memory.fit

概览

AI 生成的概览

为 AI 智能体提供持久记忆:保存长期事实并按需召回少量排序结果,让助手不必反复读取文件来记住信息。

可以做什么
  • 召回、按精确键获取并按标签检索已存事实,结果经过排序和截断以控制上下文占用
  • 写入新记忆和遗忘已有记忆,也可用只读模式仅开放召回
  • 把已被吸收的事实压缩成一行指针存根,并保留归档与原文恢复途径
  • 可选启用经验功能:保存和列出演示、编译与调度技能、记录运行及其审计轨迹
  • 把服务器安装到 Claude Code、Claude Desktop、Cursor、Windsurf、VS Code、Cline、Gemini CLI 或 Codex CLI,共用同一存储
适用场景
当助手反复读取文件或重复推导相同事实,而你希望偏好、纠正和项目知识在决策时被召回时使用。适合编码智能体,以及多个工具需要共享同一记忆存储的多主机环境。
运行要求
通过 npx 以 stdio 在本地运行,需要 Node.js。可选的 BUILDERFORCE_API_KEY 用于启用成本工具;BUILDERFORCE_MEMORY_FILE 指定 JSON 快照路径(默认位于用户主目录下的共享文件);BUILDERFORCE_MEMORY_READONLY=1 仅开放召回。语义排序需要配置 Evermind 模型和分词器,否则使用词法排序。
安装前请注意
存储是共享的 JSON 快照,其他进程也会编辑它,写入会影响所有指向它的智能体。安装器会修改各主机的配置,并为 Claude Code 添加钩子,可注入记忆并在停止时阻止以强制写入记忆。HTTP 传输在后续修复前被记录为使用非常量时间令牌比较且无租户隔离,公开暴露前需核实。经验工具可删除全部演示和技能,训练会重写模型文件。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Builderforce Memory,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

@seanhogg/builderforce-memory-mcp

Expose @seanhogg/builderforce-memory to any MCP client. One token-saving tool core over a pluggable MemoryBackend, three transports:

TransportFactoryConsumed asUse when
In-process (Claude Agent SDK)createMemoryMcpServer(backend)the returned type:"sdk" objectthe consuming product is TS and runs @anthropic-ai/claude-agent-sdk in-process — lowest latency
stdiorunStdio(backend) / npx @seanhogg/builderforce-memory-mcp{ type:"stdio", command, args }any language / separate process; decouples the SSM+IndexedDB deps from the consumer
HTTP (Streamable)createMemoryHttpHandler(backend, { authToken }){ type:"http", url, headers }multi-tenant / networked (builderforce.ai hosting, remote agents)

Technical report & peer review. This transport is reviewed in the Evermind technical report's adversarial PEER-REVIEW.md. Note before exposing the HTTP handler publicly: the authToken check is a non-constant-time string compare (timing channel) and the handler shares one backend with no per-tenant isolation — a single token reads every tenant's facts. Despite the "multi-tenant" note above, real isolation (token→namespace mapping, constant-time compare, rate limiting) is not yet implemented. Tracked as EVM-3 in the Builderforce.ai Consolidated Gap Register. Resolved in v2026.6.34: the HTTP handler now uses a constant-time token compare and per-tenant namespace isolation (see the resolution addendum in PEER-REVIEW.md).

Why this saves tokens

The point of an external memory store is fetch-on-demand instead of pinning your whole memory file into every prompt. That only pays off if recall is selective, so the caps are enforced server-side in tools.ts:

  • memory_recall returns a ranked top-K (default 5, hard-capped), never the store.
  • Each entry's content is truncated (default 500 chars) before it hits context.
  • There is no "return everything" tool — a dump-all is more expensive than inlining.
  • memory_compact shrinks a fact the local Evermind has already ABSORBED down to a one-line pointer stub, so it stops filling context. It is lossless: a recall probe must pass first, and the original is archived (recall still returns it) — see below. It writes through the live store, which keeps memory and the on-disk snapshot in agreement.
  • Recall ranks by hybrid fusion (BM25 ⊕ optional CPU SSM embedding, RRF, MMR) and then weights by importance (×(0.5+importance)) and a 90-day half-life recency decay — createLocalMemoryStoreBackend({ ranking: false }) turns the signals off.

Tool descriptions are prescriptive ("call this before answering when…") because recent Claude models reach for tools more conservatively; the trigger condition in the description is what drives should-call rate. Pair this with prompt caching (keep the tool set identical across tenants so the cached prefix survives) and context editing (prune stale recalled facts) for the full win.

The seam

Everything is written against MemoryBackend:

ts
interface MemoryBackend {  recall(query: string, topK: number): Promise<RecallHit[]>;  // semantic  get(key: string): Promise<RecallHit | undefined>;           // exact  recallByTag(tag: string, limit: number): Promise<RecallHit[]>;  remember?(input: RememberInput): Promise<void>;             // optional → read-only backends omit  forget?(key: string): Promise<void>;}

Ship the local MemoryStoreBackend (IndexedDB via @seanhogg/builderforce-memory) today; drop in a networked builderforce.ai adapter later with zero changes to tools or transports.

Quick start — in-process with the Claude Agent SDK

ts
import { query } from "@anthropic-ai/claude-agent-sdk";import { createMemoryMcpServer, createLocalMemoryStoreBackend } from "@seanhogg/builderforce-memory-mcp";
const backend = await createLocalMemoryStoreBackend();          // IndexedDB (fake-indexeddb in Node)const memory  = await createMemoryMcpServer(backend);           // type:"sdk" config
for await (const msg of query({  prompt: "What language does this user prefer? Check memory first.",  options: {    mcpServers: { builderforce_memory: memory },    allowedTools: ["mcp__builderforce_memory__*"],             // auto-approve, no prompts  },})) {  if (msg.type === "result" && msg.subtype === "success") console.log(msg.result);}

The snapshot is shared — the server watches it

With persistFile set, the store lives in memory and the JSON snapshot is the source of truth across process lifetimes. Other processes edit that file too (the BuilderForce VS Code extension rewrites absorbed entries to stubs in place), so before every operation the backend stats the file and re-hydrates from disk when it changed underneath — otherwise this server, still holding the pre-edit bodies, would re-snapshot over that work on its next write. Its own writes are stamped (mtime + size + content hash) the moment they land, so the steady-state cost is one stat and there is no write-loop.

SSM-embedding recall — including on a headless host (no GPU)

With no model configured the local backend ranks recall lexically (BM25). Point it at an Evermind checkpoint and the ordering becomes the SSM embedding's cosine ranking fused with the lexical one (Reciprocal Rank Fusion — dense ⊕ sparse, so exact tokens like identifiers and error codes are still caught). Every memory_recall result names the ranker it used, so a degrade to lexical is never silent:

Ranked by: semantic recall (SSM embedding fused with lexical).Ranked by: lexical recall (fallback - no embedding model loaded).

The stdio/HTTP servers do not need a GPU for this. EvermindLM is a pure-CPU model and EvermindLM.embed() mean-pools + L2-normalises the same hidden state the GPU HybridMambaModel.embed() does, to the same contract. Configure it with:

EnvMeaning
BUILDERFORCE_MEMORY_MODELPath to a .evermind package holding an evermind-lm.
BUILDERFORCE_MEMORY_TOKENIZERTokenizer JSON for that checkpoint. Default <model>.tokenizer.json.
BUILDERFORCE_MEMORY_VECTORSVector-cache path. Defaults beside the memory snapshot.

Vectors are cached across process lifetimes (stamped with the model's fingerprint, so an adapted checkpoint invalidates them), because a per-session subprocess that re-embedded the whole store on its first recall would cost more than the lexical ranking it replaces.

In-process hosts pass an embedder directly — reuse an already-loaded GPU Evermind runtime rather than standing up a second model:

ts
const backend = await createLocalMemoryStoreBackend({ runtime: ssmMemoryService.runtime });

Either way, recall quality improves automatically as that model is adapted/distilled.

Experience — what Evermind has done (opt-in)

Facts are one kind of learned item; experience is another. An episode is a recorded demonstration (a program and the UI steps a person took in it), a skill is what Train Once compiles from one (typed values become parameters, secrets never stored, irreversible clicks gated for approval), and a run is one execution with its audit trail. The domain lives in @seanhogg/builderforce-memory-engine; this server keeps it durable and exposes it.

Set BUILDERFORCE_MEMORY_EXPERIENCE=1 to register the tools (Synapse does). Off by default, so ordinary coding-agent installs never carry them in their tool list.

Tools
experience_infoSnapshot file, screenshot folder, model path, counts.
experience_forget_allDelete every episode, screenshot, skill and run (confirm: true). Memories and the model are untouched.
episode_save / _list / _get / _forgetDemonstrations. Screenshots go in episodes/<id>/ and are deleted with the episode.
skill_preview / _compile / _list / _get / _forget / _schedule, skills_dueTrain Once and routines.
run_start / _step / _finish / _list / _getRuns and their audit trail (newest 500 kept).
experience_trainAdapt the private model (BUILDERFORCE_MEMORY_MODEL) on every procedure it has not learned, through the engine's one adaptation recipe. The previous model is kept as <model>.prev. Opt-in curate: true first leaves out procedures whose runs mostly fail and near-copies (of each other, or of the 200 most recently learned), listing each one dropped; it is reconsidered next time.

Stored beside the memory snapshot as experience.json (shared across processes exactly like memory.json) plus episodes/. Never served to a token-selected tenant of the HTTP handler.

One-shot install into any MCP host (not just Claude)

bash
# Auto-detect installed agents and register the memory server into each:npx -y -p @seanhogg/builderforce-memory-mcp builderforce-memory-install
npx -y -p @seanhogg/builderforce-memory-mcp builderforce-memory-install --host=allnpx -y -p @seanhogg/builderforce-memory-mcp builderforce-memory-install --host=cursor,windsurf

Writes the stdio server entry into each host's own config, idempotently and with .bak backups. Supported hosts: Claude Code, Claude Desktop, Cursor, Windsurf, VS Code, Cline, Gemini CLI, Codex CLI. Every agent points at one shared store (resolveMemoryFile(): ~/.builderforce-memory/memory.json, or the legacy ~/.claude/builderforce-memory/memory.json when that is where the live store is; override with --memory-file / BUILDERFORCE_MEMORY_FILE; the hook script resolves the same way), so a fact remembered in one agent is recalled in another. --readonly drops the write tools; --local=<dist/bin/stdio.js> runs a checkout for development.

The same launch spec is exported for programmatic use: buildServerSpec() / installMemoryServer() (see src/install/).

Claude Code: the self-driving "memory combo"

Registering the server gives Claude Code the memory tools. For Claude Code the installer ALSO wires hooks so memory is self-driving instead of advisory (skip with --no-hooks):

HookBehaviour
SessionStartInject a digest of the top durable memories.
PreCompactFlush durable learnings before the window is summarised.
UserPromptSubmitContextual recall — score memories against the prompt and inject the relevant ones, so a stored fact is retrieved at the decision point, not only at session start.
StopAutonomous capture — if the user's last message was a durable instruction/correction and it wasn't consolidated this turn, BLOCK the stop with a directive to memory_remember. Capture flows through the MCP write path (never racing the snapshot); a stop_hook_active guard means at most one nudge per turn.

All four point at one generated, dependency-free hook script (~/.claude/builderforce-memory/bfmem-hook.mjs, four modes) plus a companion skill. Idempotent + .bak-safe. Source of truth: src/install/claude-hooks.ts (installClaudeCombo / bfmemHookSource).

Quick start — stdio (any process / language)

bash
npx -y @seanhogg/builderforce-memory-mcp        # serves the local MemoryStore over stdio
ts
mcpServers: {  builderforce_memory: { type: "stdio", command: "npx", args: ["-y", "@seanhogg/builderforce-memory-mcp"] },}

Env: BUILDERFORCE_MEMORY_DB (db name), BUILDERFORCE_MEMORY_READONLY=1 (drop write tools).

Quick start — HTTP (multi-tenant)

bash
BUILDERFORCE_MEMORY_TOKEN=secret PORT=8787 npx @seanhogg/builderforce-memory-mcp-http
ts
mcpServers: {  builderforce_memory: {    type: "http",    url: "http://localhost:8787",    headers: { Authorization: "Bearer secret" },  },}

Or mount createMemoryHttpHandler(backend, { authToken }) on your own Node/Express server against any backend (including a future remote one).

Custom / remote backend

Implement MemoryBackend and hand it to any transport:

ts
import { createMemoryMcpServer, type MemoryBackend } from "@seanhogg/builderforce-memory-mcp";
const remote: MemoryBackend = {  recall:      (q, k)   => bfClient.search(q, k),  get:         (key)    => bfClient.get(key),  recallByTag: (t, lim) => bfClient.byTag(t, lim),  remember:    (input)  => bfClient.put(input),  forget:      (key)    => bfClient.delete(key),};const server = await createMemoryMcpServer(remote);

Compaction rules (@seanhogg/builderforce-memory-mcp/compaction)

The stub format that memory_compact writes ([absorbed→Evermind vN] <first line>) is published as a dependency-free subpath. An external compactor imports its rules from it, so its stubs are byte-identical to the server's and neither re-stubs the other.

Lossless contract (what every compactor must do, in order):

  1. planLosslessCompaction(candidates, { probe, version }) — the structural rules (planCompaction: skip stubs, never grow an entry) plus a recall probe: probeQuestionFor(key, content) blanks the fact's most identifying token and the local Evermind must supply it (probePasses). No probe, or a wrong answer, leaves the fact uncompacted (no_probe / probe_failed).
  2. Archive every write's archive row (mergeArchive into defaultArchiveFile(memoryFile) → memory.archive.json) — durably, before any stub is written. The archive sits outside the snapshot, is only merged into and never pruned, so it survives snapshot rewrites, forget, and the 10,000-entry cap.
  3. Write the stubs.

Reads resolve a stub to its archived original (RecallHit.content = full text, RecallHit.stub = the stored stub). A stub with no archive is contentLost: tools and the Claude Code hooks label it CONTENT_LOST_LABEL — "(content lost — re-verify before relying on it)" — and the hooks importance-demote it. memory_restore (file on the stdio bin, inline json everywhere) brings the text back from [{key, content}] or the Evermind coordinator's [{id, text}] mem: dump: matched by key (an id loses its mem: prefix), else uniquely by first line against the stub's pointer; the text is archived beside the stub, so the token saving stays.

Every overwrite of a shared store file (SharedJsonFile: the snapshot, the archive, experience.json) first rotates the previous version into <file>.bak.1 … .bak.3.

Dependencies

@modelcontextprotocol/sdk + zod are hard deps. @anthropic-ai/claude-agent-sdk (SDK transport), @seanhogg/builderforce-memory + fake-indexeddb (local backend) are optional peers, imported indirectly — install only what your transport/backend needs.

来源:packages/memory-mcp/README.md,提交 bec4fb1

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

22
  1. v2026.10.80最新Nov 11, 2026
  2. v2026.10.60Nov 8, 2026
  3. v2026.10.56Nov 8, 2026
  4. v2026.10.55Nov 8, 2026
  5. v2026.10.48Nov 7, 2026
  6. v2026.10.45Nov 7, 2026
  7. v2026.10.40Nov 5, 2026
  8. v2026.10.39Nov 4, 2026
  9. v2026.10.38Nov 3, 2026
  10. v2026.10.37Nov 1, 2026
  11. v2026.10.36Oct 31, 2026
  12. v2026.10.35Oct 29, 2026
  13. v2026.10.26Oct 25, 2026
  14. v2026.10.24Oct 25, 2026
  15. v2026.10.23Oct 23, 2026
  16. v2026.10.3Oct 21, 2026
  17. v2026.9.34Oct 17, 2026
  18. v2026.9.33Sep 30, 2026
  19. v2026.9.32Sep 29, 2026
  20. v2026.9.31Sep 29, 2026
  21. v2026.9.30Sep 28, 2026
  22. v2026.9.29Sep 27, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。

其他 Memory 集成