@bunshin-cc/bunshin

中文文档
0.11.3发布于 2026/11/03MITES Module近 30 天下载 2390

Shared memory for company AI agents. Connect Codex, Claude Code, or Pi to Bunshin.

原始使用文档
文档目录4 节
  1. Connect a project
  2. Check it works
  3. Staying current
  4. Scope and removal

Bunshin

Bunshin lets your company’s AI agents (and robots) learn from each other. Your repo’s own SPEC.md, TESTING.md and SKILL.md sections, other teams’ rules and what earlier sessions learned reach the agent when they matter; what a session learns is tried locally, then reviewed and shared.

Connect a project

You need Node.js 20 or later, a signed-in Codex, Claude Code, or Pi installation, and an account in your company’s Bunshin workspace.

npm install -g @bunshin-cc/bunshin
cd /path/to/your/project
bunshin setup --harness codex

In Bunshin, open Agent keys and create a key for this computer. Paste it into the hidden setup prompt. Setup reads your role, team, and permissions from the workspace, saves the key in a private file outside the project, and configures the project hooks (five for Codex, six plus an MCP server for Claude Code). It does not need a separate model API key.

Run codex interactively in the same project. Review and accept its project trust prompt, then run /hooks and review and trust the five Bunshin hooks. Project trust and hook trust are separate steps. If /hooks does not list Bunshin, check that you opened the connected project and trusted its configuration. This guide tests interactive sessions; codex exec is not a substitute for this setup check.

For a linked Git worktree, setup puts Codex hooks in the primary checkout, where Codex reads them. The printed path identifies that shared hook file. Each connected worktree keeps its own .bunshin store and private connection. Worktrees created from a bare repository are not supported yet; use a full checkout.

For Claude Code, use bunshin setup --harness claude-code, then start a new session in the project and approve the bunshin MCP server it adds to .mcp.json (it gives the model the bunshin_recall and bunshin_load tools). /learn in the Claude Code plugin, or bunshin learn "<what to remember>", captures knowledge on demand.

To connect a whole folder of projects (each its own repository), run setup there with --hooks user: the hooks go in your user settings and every session under that folder uses its workspace, while sessions elsewhere are untouched. bunshin sources shows and changes which of its folders take part (exclude <folder>, only <folders…>, include <folder>, all).

For Pi, use Node.js 22.19 or later and run bunshin setup --harness pi. It installs a project extension in .pi/extensions/bunshin.js. Start Pi in the project (or run /reload in an existing session), review its project resources, and check /bunshin status. The extension ships in this npm package; you do not need a second package or a repository checkout.

Check it works

bunshin status
bunshin sync --json
bunshin index
bunshin recall "changing a state transition other teams depend on" --hypothetical "the owning team must approve first"

bunshin index shows how the repo’s docs split into sections and which paths push each one. Learned knowledge arrives after real sessions: when a session was worth it, a reflection runs at its end (for Claude Code, as a fork of the session, so it reuses the prompt cache). Suggestions that were not applied automatically wait in bunshin review.

Staying current

The hooks run whichever bunshin is installed; nothing updates it for you. At most once a day, session start checks npm for a newer version and, when there is one, tells you once that day (npm i -g @bunshin-cc/bunshin@latest). Set BUNSHIN_NO_UPDATE_CHECK=1 to turn the check off.

Sessions uploaded by a CLI before 0.6.2 carry a clipped trace (at most 60,000 characters). After updating, bunshin sync --retrace re-sends those from the last 30 days (--days N) with their whole trace, as long as the session's transcript file is still on the machine.

bunshin demo runs an offline example using temporary synthetic data. It does not verify your workspace connection or automatic learning.

Scope and removal

Setup applies to the current project. The local .bunshin/ directory contains lessons and session state and is added to .gitignore. The key is stored under ~/.config/bunshin/credentials/ with owner-only permissions. Your existing hooks remain in place.

bunshin init --harness codex --remove-hooks
npm uninstall -g @bunshin-cc/bunshin

Use --harness claude-code to remove Claude Code hooks or --harness pi to remove the Pi extension. Revoke this computer’s key in Bunshin when disconnecting it. Removing hooks keeps local lessons.

Codex hooks are shared across a repository's linked worktrees. Removing them from one removes the repository's Bunshin hooks for all its worktrees. Other tools' hooks are preserved.

Full setup guide: bunshin.cc/docs.

版本与发布记录

@bunshin-cc/bunshin 共发布 41 个版本,首次发布于 2026/09/20;过去 12 个月发布了 41 个版本。

版本发布日期距今
0.11.3latest2026/11/035 天前
0.11.22026/11/036 天前
0.10.52026/10/2514 天前
0.10.42026/10/1227 天前
0.10.32026/10/1227 天前
0.10.22026/10/1227 天前

关于 @bunshin-cc/bunshin 的常见问题

@bunshin-cc/bunshin 是什么?

Shared memory for company AI agents. Connect Codex, Claude Code, or Pi to Bunshin.

如何安装 @bunshin-cc/bunshin?

在项目目录运行 npm install @bunshin-cc/bunshin,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 bunshin、git-remote-bunshin,可以用 npx bunshin 直接运行。

@bunshin-cc/bunshin 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/bunshin-cc__bunshin 是否存在。

@bunshin-cc/bunshin 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@bunshin-cc/bunshin 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@bunshin-cc/bunshin 可以商用吗?

@bunshin-cc/bunshin 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@bunshin-cc/bunshin 的下载量有多少?

根据 npm 官方下载统计,@bunshin-cc/bunshin 在 2026/10/09 – 2026/11/07 这 30 天内被下载 2,390 次,日均约 80 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bunshin-cc/bunshin 还在维护吗?

最新版本 0.11.3 发布于 2026/11/03(5 天前);至今共发布 41 个版本,其中过去 12 个月发布了 41 个;首次发布于 2026/09/20。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。