Claude DB: Provide Claude Code with a fully local long-term memory, where decisions, dead ends and code maps are stored in your own SQLiteClaude DB:给 Claude Code 装一个完全本地的长期记忆库,决策、死胡同和代码地图都存进你自己的 SQLite
Start from scratch every time you open Claude Code: revisit the background of the project, repeat the architecture conventions, and step through the pit you stepped in last week. Claude DB (2,300 + stars, Apache-2.0) thoroughly localizes this matter - it automatically captures decisions, dead ends, and rules in each session with a hook, along with a code call map across seven languages, stored in SQLite on your machine (also available for Postgres/MongoDB multi-machine sharing), and injects the most relevant memories back at the beginning of the next conversation. No cloud, no subscription, no data out of your computer.
每次打开 Claude Code 都要从零开始:重新讲项目背景、重复说清架构约定、再踩一遍上周踩过的坑。Claude DB(2,300+ 星,Apache-2.0)把这件事彻底本地化——它用钩子自动捕获每个会话里的决策、死路与规则,连同一份跨七种语言的代码调用地图,一起存进你机器上的 SQLite(也可换 Postgres/MongoDB 多机共享),下一次对话开场就把最相关的记忆注入回来。没有云、没有订阅、数据不出你的电脑。

What problem does it solve?它解决了什么问题
Common problem of all programming agents: as soon as the context window is cleared, the working memory returns to zero. You decided last week to "use Zustand instead of Redux", stepped on the dead end of "this function can not be called concurrently", and reset the next session.
Claude DB's approach is two-pronged: use lifecycle hooks to silently capture decisions, dead ends, and rules at the end of a session; and scan your codebase to build a symbolic map of who defines, who calls, and who imports, supported by TypeScript, JavaScript, Python, Go, Rust, Java, and Kotlin.
The key restraint lies in the "recall on demand": each new question is only injected with one or two matching historical memories, without a match, nothing will be injected, and the context will not be burst.
所有编程代理的通病:上下文窗口一清空,工作记忆就归零。你上周决定「不用 Redux 改用 Zustand」、踩过的「这个函数不能并发调用」的死胡同,下个会话全部清零重来。
Claude DB 的做法是双管齐下:一边用生命周期钩子在会话结束时静默捕获决策、死路与规则;一边扫描你的代码库建立「谁定义、谁调用、谁导入」的符号地图,TypeScript、JavaScript、Python、Go、Rust、Java、Kotlin 都支持。
关键克制在于「按需召回」:每条新提问只注入匹配的一两条历史记忆,没有匹配就什么都不注,不会把上下文塞爆。
Daily Commands at a Glance日常命令一览
/catchup: Come back after a few days and ask “Where did I do it last time?” and it answers you with a memory bank.
/handoff: Leave a handoff note for the next conversation (or co-worker who takes over) without losing key conclusions.
/cdb-scan: Sweep an existing code base into the memory map as a whole, and connect to the old project for the first time.
claude-db status/doctor: Always check if the hook is connected, what is recorded, and where there is a problem with the configuration.
/catchup:隔了几天回来,问一句「我上次做到哪了」,它拿记忆库回答你。
/handoff:给下一个会话(或接手的同事)留一张交接便条,关键结论不丢。
/cdb-scan:把一个已有代码库整体扫进记忆地图,首次接入老项目必跑。
claude-db status / doctor:随时检查钩子是否接好、记录了什么、配置哪里出了问题。

Installation & Initialization安装与初始化
Node 22.16 or higher is required and is used within the git repository.
Three steps: npm install -g claude-db install → cd globally Your project claude-db → install --project Write the hook into the project configuration and restart the Claude Code. After that, the capture and recall will be fully automatic without manual intervention.
If you take over the stock project, first run claude-db flush to empty the demo data, and then run claude-db scan (or/cdb-scan) to build the existing code map.
要求 Node 22.16 或更高版本,且在 git 仓库内使用。
三步走:npm install -g claude-db 全局安装 → cd 你的项目 → claude-db install --project 把钩子写进项目配置,然后重启 Claude Code 即可,之后捕获与召回全自动,无需手动干预。
接手存量项目的,装完先跑 claude-db flush 清空演示数据,再跑 claude-db scan(或 /cdb-scan)把现有代码地图建起来。
Download instructions下载说明
The download button provides the Claude DB official repository source code package (zip, 0.78 MB), which contains the complete plugin source code, hook scripts and documentation. You can install it yourself after offline review, or you can install it directly according to the above npm command.
The data is stored natively in SQLite by default; the team wants to share memory, cut the storage backend to Postgres or MongoDB, and still host it themselves.
下载按钮提供 Claude DB 官方仓库源码包(zip,0.78MB),内含完整插件源码、钩子脚本与文档,可离线审阅后自行安装,也可照上面的 npm 命令直接安装。
数据默认存本机 SQLite;团队想共享记忆,把存储后端切到 Postgres 或 MongoDB 即可,仍是自己托管。
Use reminder使用提醒
This article is compiled from public sources and ships with the matching resource. Product features and pricing are subject to the official page. Resources are for learning and exchange only — please respect the original license.
本文整理自公开资料并附上配套资源;涉及产品的功能与价格以官方页面为准。资源仅供学习交流,请遵循来源许可。
⬇ Download · 点击下载:Claude DB 官方仓库源码包(0.78MB)
取自 GitHub 仓库 Avijit07x/claude-db 主分支,Apache-2.0 许可,含插件、钩子与文档全量源码。
阅读与点赞数据保存在你的浏览器本地,欢迎留下你的想法。
今日正能量学一点,用一点;今天种下的种子,会长成明天的能力。去免费下载专区 →广告
评论 文明发言,让讨论更有价值