Cc Agent Brain 标志

Cc Agent Brain

社区
syiibfs-hash

Local-first memory engine for coding agents (Claude Code/Cursor/Codex): SQLite+FTS5 retrieval, versioned bi-temporal memories, full-session capture, zero dependencies, MCP server

发布者syiibfs-hash
代码仓库cc-agent-brain
语言Python
复刻数
0
星标数
94
可用工具
0
传输类型stdio
许可协议MIT
链接
  • 将工具接入 AI 工作流

    Cc Agent Brain 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 94 个 Star 和 0 个 Fork。

CC Agent Brain

English | 中文

A local-first memory engine for coding agents. It captures what you and the agent actually do, distills it into versioned long-term memory, and recalls it automatically — fully offline, with zero third-party dependencies, and exposed to any tool through MCP. Installs as a namespaced add-on and never replaces your existing .claude/ directory.


English

What is CC Agent Brain

CC Agent Brain turns a stateless coding agent into one that remembers you across sessions and across tools — all locally, no cloud, no API key.

text
user prompts / assistant replies / tool actions
        ↓ automatic hooks
append-only event stream (SQLite + FTS5)  +  readable Wiki (Markdown)
        ↓ distill
versioned long-term memory (layered, bi-temporal, auditable)
        ↓ BM25 + RRF retrieval, project DB first / global DB fallback
automatic recall in future sessions
        ↓ MCP server
the same memory in Claude Code, Cursor, Codex, Gemini CLI, Claude Desktop…

Why it exists (2026 memory landscape)

Agent memory is becoming standard infrastructure, but existing choices force a trade-off: cloud memory APIs send your data away; heavy self-hosted stacks need vector/graph databases; plain Markdown memory does not actually search or version itself. CC Agent Brain occupies the middle:

  • Zero-dependency engine — Python stdlib sqlite3 + FTS5 (BM25), including CJK bigram tokenization, so Chinese and English retrieval both work offline.
  • Real capture loop — user prompts and assistant replies / tool calls are indexed (Stop hook reads the transcript; idempotent).
  • Versioned, trustworthy memory — facts are superseded/expired, never silently overwritten; a timeline shows what changed and when.
  • MCP-native, tool-agnostic — one memory store for every MCP client.
  • Human-readable projection — Markdown Wiki and generated indexes keep you in control; the DB is a single portable file.
  • Private by construction — common secret shapes are redacted at capture time; personal data is git-ignored.

Quick install

bash
git clone https://github.com/syiibfs-hash/cc-agent-brain.git
cd cc-agent-brain
python installer/install.py --target /path/to/your/project
# preview first:
python installer/install.py --target /path/to/your/project --dry-run

Or paste the install prompt from prompts/install-from-github.md into Claude Code.

What gets installed

text
my-project/
├── .claude/
│   ├── settings.json                         ← merged, not replaced (+ backup)
│   ├── skills/cc-agent-brain-*/              ← 6 skills
│   ├── agents/cc-agent-brain-*.md            ← 3 agents
│   └── hooks/cc-agent-brain/                 ← 6 hooks + engine + _utils
│       ├── brain_store.py                    ← SQLite/FTS5 engine + MCP server
│       ├── transcript_capture.py             ← indexes assistant/tool actions
│       └── …
├── .cc-agent-brain/brain.db                  ← local engine DB (git-ignored)
├── memory/     compressed long-term memory + generated index
├── wiki/       detailed human-readable context
├── private/    local sensitive notes
└── templates/  writing templates

The engine CLI

bash
BRAIN="python .claude/hooks/cc-agent-brain/brain_store.py"
$BRAIN init
$BRAIN search "deployment decision" --human
$BRAIN memory add --title "..." --body "..." --layer semantic --confidence high
$BRAIN memory add ... --supersedes <old-id>   # replace, keep history
$BRAIN audit / timeline / stats / candidates
$BRAIN sync-md                                # regenerate memory projection
$BRAIN serve-mcp                              # MCP server over stdio

Full reference: docs/memory-engine.md, MCP setup: docs/mcp.md.

Components

6 Hooks

HookEventPurpose
session_start.pySessionStartonboarding check, engine status
prompt_capture.pyUserPromptSubmitprompt → Wiki projection + event stream
wiki_context_hint.pyUserPromptSubmitreal FTS recall for the current prompt
transcript_capture.pyStopindex assistant replies & tool calls
pre_compact_save.pyPreCompactcheckpoint before compaction
memory_audit.pyStopSQL audit: duplicates, broken chains, stale entries

6 Skills — onboarding, wiki update/search, memory distill/audit, material distill. 3 Agents — memory curator, wiki compiler, material distiller.

Memory model

Four layers — working (current task), episodic (timestamped events), semantic (distilled facts/preferences), procedural (reusable workflows). Each memory has status (active/superseded/expired/archived), validity window, confidence, source and supersede chain. See docs/memory-design.md.

Uninstall

bash
python installer/uninstall.py --target /path/to/your/project

Only framework files tracked by the manifest are removed. Your memory/, wiki/, private/ and brain.db are preserved.

Roadmap

VersionThemeStatus
v0.1Local second-brain MVP (capture/wiki/distill hints)released
v0.2Local engine: SQLite+FTS5, full capture, versioned memory, audit, MCPcurrent
v0.3Recall quality: optional local embeddings + RRF, built-in recall eval setplanned
v0.4Portability: Marketplace packaging, one-line install, import/exportplanned
v0.5Optional E2E-encrypted private backup (local-first by default)planned

Privacy

Open-source framework, no personal data inside. Everything runs on your machine; there is no telemetry and no network call. memory/, wiki/, private/ and *.db are git-ignored. See docs/product-analysis.md for the product rationale.

License

MIT


中文

CC Agent Brain 是什么

给编码 Agent 用的本地记忆引擎:自动捕获你和 Agent 的真实工作过程,蒸馏成带版本的长期记忆,并在后续会话自动召回——全程离线、零第三方依赖,并通过 MCP 把同一份记忆提供给任意工具。以命名空间插件方式安装,绝不覆盖你已有的 .claude/。

text
用户提示 / 助手回复 / 工具动作
        ↓ 钩子自动捕获
只增事件流(SQLite + FTS5) + 可读 Wiki(Markdown)
        ↓ 蒸馏
带版本的长期记忆(分层、双时间、可审计)
        ↓ BM25 + RRF 检索,项目库优先 / 全局库兜底
后续会话自动召回
        ↓ MCP 服务
同一套记忆服务 Claude Code、Cursor、Codex、Gemini CLI、Claude Desktop…

为什么做它(2026 记忆赛道现状)

Agent 记忆正在成为基础设施,但现有方案都要你做取舍:云记忆 API 要上传数据;重型自建方案要装向量/图数据库;纯 Markdown 记忆既不能真正检索也没有版本。CC Agent Brain 取中间路线:

  • 零依赖引擎:仅用 Python 标准库 sqlite3 + FTS5(BM25),内置中文 bigram 分词,中英文检索全部离线可用。
  • 完整捕获闭环:不只存用户提问,Stop 钩子读取会话记录,把助手回复与工具调用一并索引(幂等)。
  • 可信的版本化记忆:事实变更走"取代/失效"而非静默覆盖,时间线可查"何时因为什么改了结论"。
  • MCP 原生、不绑工具:一套记忆,所有 MCP 客户端复用。
  • 人类可读投影:Markdown Wiki 与生成式索引让你始终掌控;数据库只是一个可拷贝的文件。
  • 隐私内建:常见密钥形态在捕获时即脱敏,个人数据默认 git 忽略。

快速安装

bash
git clone https://github.com/syiibfs-hash/cc-agent-brain.git
cd cc-agent-brain
python installer/install.py --target /path/to/your/project
# 先预览:
python installer/install.py --target /path/to/your/project --dry-run

也可以把 prompts/install-from-github.md 中的安装提示词粘贴给 Claude Code。

安装内容

text
my-project/
├── .claude/
│   ├── settings.json                         ← 增量合并(自动备份)
│   ├── skills/cc-agent-brain-*/              ← 6 个技能
│   ├── agents/cc-agent-brain-*.md            ← 3 个代理
│   └── hooks/cc-agent-brain/                 ← 6 个钩子 + 引擎 + 工具库
│       ├── brain_store.py                    ← SQLite/FTS5 引擎 + MCP 服务
│       ├── transcript_capture.py             ← 索引助手回复/工具动作
│       └── …
├── .cc-agent-brain/brain.db                  ← 本地引擎库(git 忽略)
├── memory/     压缩长期记忆 + 生成式索引
├── wiki/       详细的人类可读上下文
├── private/    本地敏感笔记
└── templates/  写作模板

引擎命令行

bash
BRAIN="python .claude/hooks/cc-agent-brain/brain_store.py"
$BRAIN init
$BRAIN search "部署方案的决策" --human
$BRAIN memory add --title "..." --body "..." --layer semantic --confidence high
$BRAIN memory add ... --supersedes <旧id>     # 取代并保留历史
$BRAIN audit / timeline / stats / candidates
$BRAIN sync-md                                # 重新生成记忆投影
$BRAIN serve-mcp                              # 以 stdio 启动 MCP 服务

完整说明见 docs/memory-engine.md,MCP 接入见 docs/mcp.md。

组件

6 个 Hooks

Hook触发点功能
session_start.pySessionStart初始化检查、引擎状态
prompt_capture.pyUserPromptSubmit提示写入 Wiki 投影与事件流
wiki_context_hint.pyUserPromptSubmit对当前问题做真实 FTS 召回
transcript_capture.pyStop索引助手回复与工具调用
pre_compact_save.pyPreCompact压缩前检查点
memory_audit.pyStopSQL 审计:重复、断链、过期、积压

6 个 Skills:初始化、Wiki 更新/检索、记忆蒸馏/审计、素材蒸馏。 3 个 Agents:记忆策展人、Wiki 编纂者、素材提炼者。

记忆模型

四层——working(当前任务)、episodic(带时间戳的事件)、semantic(蒸馏事实与偏好)、procedural(可复用流程)。每条记忆带状态(active/superseded/expired/archived)、有效期、置信度、来源与取代链。详见 docs/memory-design.md。

卸载

bash
python installer/uninstall.py --target /path/to/your/project

只删除清单中记录的框架文件;memory/、wiki/、private/ 与 brain.db 全部保留。

路线图

版本主题状态
v0.1本地第二大脑 MVP(捕获/Wiki/蒸馏提示)已发布
v0.2本地引擎:SQLite+FTS5、全量捕获、版本化记忆、审计、MCP当前
v0.3召回质量:可选本地向量 + RRF、内置召回评测集规划中
v0.4可移植:Marketplace 打包、一行安装、导入导出规划中
v0.5可选端到端加密私有备份(默认仍纯本地)规划中

隐私

开源框架,仓库内不含任何个人数据。所有计算在本机完成,无遥测、无网络请求。memory/、wiki/、private/ 与 *.db 均被 git 忽略。产品层面的完整分析见 docs/product-analysis.md。

协议

MIT

将 Cc Agent Brain MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 Cc Agent Brain 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请保持终端窗口及其中的进程运行。
3

将 Cc Agent Brain 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 Cc Agent Brain MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "cc-agent-brain": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 Cc Agent Brain MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 Cc Agent Brain MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 Cc Agent Brain 帮我完成这项任务吗?
Cc Agent Brain
当然。我已阅读。
以下是我使用 Cc Agent Brain 得到的结果。

常见问题

Cc Agent Brain MCP 服务器有什么用途?

Cc Agent Brain 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 Cc Agent Brain MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您可以让 Claude、ChatGPT、Gemini 等不同 AI 模型,或您在 TypingMind 中配置的其他模型使用 Cc Agent Brain,而无需为每个模型单独配置 MCP 服务器。

为什么在 TypingMind 中使用 Cc Agent Brain MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是优秀的大语言模型聊天前端之一。连接 Cc Agent Brain 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 Cc Agent Brain MCP 连接到 TypingMind?

Cc Agent Brain 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

Cc Agent Brain MCP 在 TypingMind 中提供哪些工具?

Cc Agent Brain 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 Cc Agent Brain MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行掌控模型提供商、API 密钥、提示词和 MCP 配置。如果 Cc Agent Brain 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇