图
](https://www.npmjs.com/package/@graph-tl/graph)  ](https://www.npmjs.com/package/@graph-tl/graph)
你的经纪人在两次会议之间忘记了一切。 你的架构决策、命名约定、业务规则、项目愿景都消失了。每次新聊天都从零开始。您重新解释相同的上下文,重新做出相同的决定,并观察代理偏离您已经建立的模式。
Graph解决了这个问题。它是一个MCP服务器,为您的代理提供了一个持久的项目大脑:愿景和目标、架构决策、惯例、结构化路线图以及会话之间的自动切换。
安装
npx -y @graph-tl/graph init重新启动克劳德代码。就这样
看到它工作
告诉你的经纪人:
“使用图表为我的应用程序构建项目愿景、架构和路线图。”
代理人将:
- 就目标、业务规则、原则和约束对你进行面试
- 将所有内容记录为持久知识——架构决策、命名约定、规范
- 构建一个路线图,其中包含跨里程碑的优先级、依赖性感知任务
- 开始执行——认领任务、记录证据、解锁下一块
下一个会话,代理调用 graph_onboard 并且立即具有完整的上下文——您的愿景、架构、命名约定以及昨天所做的工作。一个电话,零重新解释。
前后
无图形 --每次会话都以冷开始:
You: "Continue working on the project"
Agent: "I don't see any prior context. What's the architecture?
What conventions are you using? What's been built?"
You: *spends 5 minutes re-explaining everything*使用Graph --代理人打电话来 graph_onboard 并且立即知道:
Agent: "I see the project. Vision: multi-tenant SaaS platform.
12 of 30 tasks done. Auth and data layer shipped last week.
Conventions: kebab-case files, Zod validation at boundaries.
3 tasks are actionable — I'll pick up the billing integration,
it's highest priority and its dependencies are resolved."一个电话。完整的上下文。无需重新解释。
你得到了什么
- 坚持不懈的项目大脑 --愿景、目标、架构、业务规则、惯例——所有这些在会议之间都存在
- 结构化路线图 --具有优先级、里程碑和自动解锁的依赖关系感知任务树
- 坚持的知识 --决策、规格、术语记录一次,自动呈现给每个未来的代理
- 证据线索 --每个任务都会记录提交、决策和文件更改,因此不会丢失任何内容
- 上下文感知响应 --压缩、结构化的输出,旨在在不淹没上下文窗口的情况下提供信息
- 本地和私人 --您的计算机上只有一个SQLite文件,没有云,没有遥测
运作原理
graph_onboard → "What's the state of this project?"
graph_next → "What should I work on?" (claims it)
... agent does the work ...
graph_update → "Done. Here's what I did." (resolves with evidence)
→ engine returns newly unblocked tasks
graph_next → "What's next?"规划
代理人打电话来 graph_plan 构建依赖树。这不是一个简单的待办事项列表,而是一个具有阻塞关系的结构化分解:
SaaS Platform
├── Foundation
│ ├── Document architecture decisions
│ ├── Define naming conventions & code principles
│ └── Write API spec
├── Core
│ ├── Auth & tenancy (depends on: architecture, API spec)
│ ├── Data layer (depends on: architecture)
│ └── Billing integration (depends on: Auth & tenancy)
├── Features
│ ├── User management (depends on: Auth & tenancy)
│ └── Dashboard (depends on: Data layer, User management)
└── Release
├── E2E tests (depends on: all Features)
└── Deploy pipeline (depends on: E2E tests)引擎知道:架构文档、命名约定和API规范现在是可操作的。其他一切都被封锁了。当任务解决时,依赖项会自动取消阻止。
知识
当代理工作时,它会将决策和约定记录为持久的知识——不是埋在聊天历史中,而是存储在未来的会话中并自动出现:
knowledge: "architecture" → "Event-driven, PostgreSQL, Redis for cache"
knowledge: "convention" → "kebab-case files, Zod at boundaries, no default exports"
knowledge: "decision" → "Stripe for billing — evaluated Paddle, chose Stripe for metered billing support"
knowledge: "api-contract" → "REST, versioned /v1/, snake_case JSON fields"惯例和架构条目会自动包含在相关工具响应中。代理会遵循您的模式,而不会在每次会话中都被告知。
交接
会话1在完成5个任务后结束。会话2开始:
→ graph_onboard("my-project")
← goal: "SaaS Platform"
summary: 5 of 14 resolved, 3 actionable
recently_resolved: Architecture, Conventions, API spec, Auth, Data layer
knowledge: 6 entries (architecture, conventions, 2 decisions, API contract, env setup)
actionable: Billing integration (priority 9), User management (priority 8), Dashboard (priority 7)
continuity_confidence: 92/100新代理知道愿景、架构、约定、构建的内容以及下一步要做什么。连续性置信度得分告诉它对现有状态的信任程度。
工具
Graph公开了22个MCP工具。以下是代理商最常用的:
| 工具 | 它做什么 |
|---|---|
graph_onboard | 一次通话中的完整项目背景——总结、树、证据、知识、可操作的任务 |
graph_plan | 批量创建具有依赖关系的任务树。原子 |
graph_next | 获得最高优先级的可操作任务。可选索赔 |
graph_update | 用证据解决任务。返回新解除阻止的任务 |
graph_resolve | 一次调用resolve——自动收集git提交和修改的文件 |
graph_status | 带有进度和完整性检查的格式化项目仪表板 |
graph_roadmap | 按地平线分组的发布管道视图(现在/下一个/以后/暂停) |
All tools
核心工作流程: graph_open, graph_plan, graph_next, graph_update, graph_resolve
导航: graph_onboard, graph_context, graph_tree, graph_query, graph_history
结构: graph_connect (具有周期检测的依赖性边), graph_restructure (移动、合并、删除、删除任务), graph_roadmap
质量: graph_status, graph_retro (带漂移检测的结构化回顾), graph_agent_config
知识: graph_knowledge_write, graph_knowledge_write_batch, graph_knowledge_read, graph_knowledge_search, graph_knowledge_delete, graph_knowledge_audit
配置
npx -y @graph-tl/graph init # Auto-configures everything或手动添加到 .mcp.json:
{
"mcpServers": {
"graph": {
"command": "npx",
"args": ["-y", "@graph-tl/graph@latest"],
"env": {
"GRAPH_AGENT": "claude-code"
}
}
}
}Environment variables
| 变量 | 默认值 | 描述 |
|---|---|---|
GRAPH_AGENT | default-agent | 审计跟踪的代理身份 |
GRAPH_DB | ~/.graph/db//graph.db | 数据库路径(每个项目,存储库外) |
GRAPH_CLAIM_TTL | 60 | 软索赔到期时间(分钟) |
CLI commands
graph init # Set up graph in the current project
graph update # Clear npx cache and re-run init to get the latest version
graph ship # Build, test, bump, commit, push, and create GitHub release
graph doctor # Run integrity checks on all projects
graph backup # List, create, or restore database backups
graph ui # Start the web UI
graph --version # Print version
graph --help # Print usage summary更新中
Graph在启动时检查npm的更新版本。要更新,请执行以下操作:
npx @graph-tl/graph update数据和安全
您的数据保留在您的机器上。
- 单个SQLite文件 在
~/.graph/db/--在你的仓库之外,没有任何东西给gitignore - 本地优先 --stdio MCP服务器,无遥测,无云同步
- 未存储任何秘密 --仅限于任务摘要、证据注释和文件路径引用
- 您拥有自己的数据 --备份、删除、在机器之间移动
许可证
麻省理工学院——免费开源。
