Sourcebook

io.github.maroondlabs由 GitHub 账号 maroondlabs 发布v0.9.5更新于 Oct 24, 2026

Live codebase intelligence for AI agents: conventions, blast radius, import graphs, git insights.

已验证STDIO仅桌面知识与记忆开发者工具

概览

AI 生成的概览

本地 MCP 服务器,为 AI 助手提供实时代码库情报:仓库结构、导入图、影响范围、约定与 git 共同变更数据。

可以做什么
  • 查询指定项目目录的仓库结构、约定与 Repo Truth Map
  • 查看导入图、枢纽文件以及一次改动的影响范围
  • 查询 git 共同变更伙伴,即历史上总是一起改动的文件
  • 检查 diff 完整性:缺失的测试文件、同级模块与相关配置
  • 配置 Anthropic API 密钥后可对 diff 进行 AI 语义分析
适用场景
适合助手在 git 仓库中修改代码时使用,让它知道一次改动可能还涉及哪些文件,或在提交前检查 diff 是否漏掉测试与依赖方。对 TypeScript/JavaScript、Python 和 Go 项目支持最完整。
运行要求
以 stdio 本地运行,通过 npx sourcebook serve 启动并指定项目目录。需要 Node.js 和带提交历史的本地 git 仓库。AI 语义分析需要环境变量 ANTHROPIC_API_KEY;规则层无需任何配置。
安装前请注意
AI 层会把 diff 及依赖上下文发送给 Claude Sonnet,代码会离开本机,并按次产生费用(README 称每次约 0.012 美元)。init 命令会在仓库中安装 Claude Code 钩子并生成 CLAUDE.md/AGENTS.md 文件。测试文件与同级文件的检出率被标为部分支持,结果应人工复核而非直接采信。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[sourcebook]

sourcebook

Catches the files your AI agent forgot to change.

A safety layer for code changes. sourcebook analyzes git diffs for completeness — flags files that should've been modified but weren't. Rules-based structural detection plus AI-powered semantic analysis. Zero false positives on clean diffs.

bash
npx sourcebook init          # sets up Claude Code hooks + generates CLAUDE.mdnpx sourcebook check         # check your current diff for missing filesnpx sourcebook scan-history  # see what you've been missing

What It Catches

Your AI agent changed the handler. Did it update the test? The sibling module? The config that references the old value?

sourcebook checks your diff against the repo's actual structure:

  • Missing test files — source file changed, test file didn't
  • Sibling modules — files that import or are imported by what you changed
  • Co-change companions — files that historically change together in git commits
  • Hub file blast radius — you touched something with 50+ dependents

With --ai: cross-module semantic relationships, field renames that need migrations, stale validation logic.

Key Stats

MetricResult
Completeness gate100% accurate (30/30 diffs)
False positive rate0% on clean diffs
Test file detection73%
Sibling detection71%
AI analysis cost~$0.012/run

Four Surfaces

1. CLI

Run it on any diff. No setup required.

bash
npx sourcebook check              # check staged/unstaged changesnpx sourcebook check --ai         # add AI semantic analysis (requires ANTHROPIC_API_KEY)npx sourcebook check --quiet      # exit code only (for CI/scripts)npx sourcebook check --branch main  # compare vs a branch

2. Claude Code Hooks

One command wires up pre-commit hooks. Agent edits a file, sourcebook checks the diff, agent sees what's missing — all before the commit lands.

bash
npx sourcebook init   # generates CLAUDE.md + installs hooks

3. MCP Server

Published on the official MCP registry. Agents can query repo structure, blast radius, conventions, and co-change data on demand.

bash
npx sourcebook serve

Add to your MCP client:

json
{  "mcpServers": {    "sourcebook": {      "command": "npx",      "args": ["-y", "sourcebook", "serve", "--dir", "/path/to/your/project"]    }  }}

4. GitHub App (coming soon)

Automated completeness checks on every pull request. Join the waitlist.

Commands

CommandDescription
sourcebook checkAnalyze current diff for completeness
sourcebook check --aiAdd AI-powered semantic analysis (requires ANTHROPIC_API_KEY)
sourcebook check --quietExit code only — 1 if findings, 0 if clean
sourcebook check --jsonStructured JSON output
sourcebook check --branch mainCompare HEAD against a branch
sourcebook check --threshold 0.9Custom co-change coupling threshold (0-1)
sourcebook initSet up Claude Code hooks + generate CLAUDE.md/AGENTS.md
sourcebook scan-historyRetrospective scan of recent commits
sourcebook hooksInstall or check Claude Code hooks
sourcebook truthGenerate a Repo Truth Map (2.5D visualization)
sourcebook serveStart MCP server
sourcebook updateRe-analyze while preserving manual edits
sourcebook diffShow what would change (exit code 1 if changes found)
sourcebook watchAuto-regenerate context files on source changes
sourcebook ask <query>Query codebase knowledge in natural language

How It Works

Layer A — Rules-based (no LLM, <1 second)

  1. Co-change analysis — mines git history for files that change together. If you touched auth.ts and it changes with session.ts in 88% of commits, sourcebook flags session.ts.
  2. Test file detection — maps source files to test files via naming conventions and co-change history.
  3. Import graph — builds a dependency graph and checks whether files that import (or are imported by) your changed files also need updates.
  4. Hub detection — flags when you've modified a file with high fan-in (many dependents). These changes have blast radius.

Layer B — AI-powered (~$0.012/run)

Sends the diff plus dependency context to Claude Sonnet. Catches semantic relationships Layer A can't see — field renames that need migrations, validation logic that assumes old schemas, cross-module dependencies with no import link.

Every AI suggestion requires a dependency citation. Hallucinated file paths are filtered out. The completeness gate ensures zero false positives: if the diff is actually complete, Layer B stays silent.

Configuration

bash
# Required for --ai flag onlyexport ANTHROPIC_API_KEY=sk-ant-...

No other configuration needed. sourcebook reads your repo's git history and file structure directly.

Language Support

LanguageImport GraphGit AnalysisConvention Detection
TypeScript / JavaScriptFullFullFull
PythonFullFullFull
GoFullFullFull
RustFullFullPartial

Research

Built on real benchmarks, not vibes:

License

BSL-1.1 — source-available, free to use, cannot be offered as a hosted service. Converts to MIT on 2030-03-25. See LICENSE for details.


sourcebook.run · GitHub · npm · @maroond_

来源:README.md,提交 d289440

工具

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

版本历史

1
  1. v0.9.5最新Sep 16, 2026

评分

已满足适用检查项的 40%

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

  • 近 30 天内可连通25 分

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

  • 已声明认证方式10 分

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

  • 已列出工具15 分

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

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

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