@roarpeng/graphflow 1.7.14 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/README.md +108 -486
- package/dist/config/loader.js +4 -4
- package/dist/config/loader.js.map +1 -1
- package/dist/config/paths.js +1 -1
- package/dist/config/paths.js.map +1 -1
- package/dist/config/schema.d.ts +1 -1
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/core/agent-delegation.d.ts +15 -1
- package/dist/core/agent-delegation.d.ts.map +1 -1
- package/dist/core/agent-delegation.js +99 -4
- package/dist/core/agent-delegation.js.map +1 -1
- package/dist/core/goal-anchor.d.ts +70 -0
- package/dist/core/goal-anchor.d.ts.map +1 -0
- package/dist/core/goal-anchor.js +253 -0
- package/dist/core/goal-anchor.js.map +1 -0
- package/dist/core/merge-agent-insight.d.ts +10 -0
- package/dist/core/merge-agent-insight.d.ts.map +1 -1
- package/dist/core/merge-agent-insight.js +36 -1
- package/dist/core/merge-agent-insight.js.map +1 -1
- package/dist/core/orchestrator-context.d.ts +7 -1
- package/dist/core/orchestrator-context.d.ts.map +1 -1
- package/dist/core/orchestrator-context.js +29 -3
- package/dist/core/orchestrator-context.js.map +1 -1
- package/dist/core/orchestrator.d.ts.map +1 -1
- package/dist/core/orchestrator.js +8 -2
- package/dist/core/orchestrator.js.map +1 -1
- package/dist/core/submit-agent-insight.d.ts +15 -0
- package/dist/core/submit-agent-insight.d.ts.map +1 -1
- package/dist/core/submit-agent-insight.js +43 -1
- package/dist/core/submit-agent-insight.js.map +1 -1
- package/dist/core/types.d.ts +2 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/graph/client-factory.d.ts.map +1 -1
- package/dist/graph/client-factory.js +14 -0
- package/dist/graph/client-factory.js.map +1 -1
- package/dist/graph/context-slicer-types.d.ts +2 -0
- package/dist/graph/context-slicer-types.d.ts.map +1 -1
- package/dist/graph/context-slicer-types.js.map +1 -1
- package/dist/graph/context-slicer.d.ts.map +1 -1
- package/dist/graph/context-slicer.js +7 -6
- package/dist/graph/context-slicer.js.map +1 -1
- package/dist/graph/file-indexer-edges.d.ts.map +1 -1
- package/dist/graph/file-indexer-edges.js +8 -4
- package/dist/graph/file-indexer-edges.js.map +1 -1
- package/dist/graph/graph-compression.d.ts +7 -0
- package/dist/graph/graph-compression.d.ts.map +1 -1
- package/dist/graph/graph-compression.js +64 -1
- package/dist/graph/graph-compression.js.map +1 -1
- package/dist/graph/graph-utils.d.ts.map +1 -1
- package/dist/graph/graph-utils.js +16 -0
- package/dist/graph/graph-utils.js.map +1 -1
- package/dist/graph/sqlite-client.d.ts +9 -0
- package/dist/graph/sqlite-client.d.ts.map +1 -1
- package/dist/graph/sqlite-client.js +66 -10
- package/dist/graph/sqlite-client.js.map +1 -1
- package/dist/learning/episodic-memory.d.ts +11 -1
- package/dist/learning/episodic-memory.d.ts.map +1 -1
- package/dist/learning/episodic-memory.js +16 -1
- package/dist/learning/episodic-memory.js.map +1 -1
- package/dist/learning/hnsw-index.d.ts +30 -1
- package/dist/learning/hnsw-index.d.ts.map +1 -1
- package/dist/learning/hnsw-index.js +134 -0
- package/dist/learning/hnsw-index.js.map +1 -1
- package/dist/routing/provider-executor.d.ts +6 -0
- package/dist/routing/provider-executor.d.ts.map +1 -1
- package/dist/routing/provider-executor.js +10 -1
- package/dist/routing/provider-executor.js.map +1 -1
- package/dist/surfaces/cli/index.js +39 -2
- package/dist/surfaces/cli/index.js.map +1 -1
- package/dist/surfaces/cli/output.d.ts.map +1 -1
- package/dist/surfaces/cli/output.js +3 -1
- package/dist/surfaces/cli/output.js.map +1 -1
- package/dist/surfaces/cli/runtime/env.d.ts.map +1 -1
- package/dist/surfaces/cli/runtime/env.js +4 -0
- package/dist/surfaces/cli/runtime/env.js.map +1 -1
- package/dist/surfaces/cli/runtime/graph.d.ts +67 -0
- package/dist/surfaces/cli/runtime/graph.d.ts.map +1 -1
- package/dist/surfaces/cli/runtime/graph.js +133 -1
- package/dist/surfaces/cli/runtime/graph.js.map +1 -1
- package/dist/surfaces/cli/runtime/helpers.js +1 -1
- package/dist/surfaces/cli/runtime/helpers.js.map +1 -1
- package/dist/surfaces/cli/runtime/routing.d.ts +2 -1
- package/dist/surfaces/cli/runtime/routing.d.ts.map +1 -1
- package/dist/surfaces/cli/runtime/routing.js +3 -2
- package/dist/surfaces/cli/runtime/routing.js.map +1 -1
- package/dist/surfaces/cli/runtime/types.d.ts +2 -0
- package/dist/surfaces/cli/runtime/types.d.ts.map +1 -1
- package/dist/surfaces/cli/runtime.d.ts +1 -1
- package/dist/surfaces/cli/runtime.d.ts.map +1 -1
- package/dist/surfaces/cli/runtime.js +4 -1
- package/dist/surfaces/cli/runtime.js.map +1 -1
- package/dist/surfaces/mcp/tool-definitions.d.ts.map +1 -1
- package/dist/surfaces/mcp/tool-definitions.js +5 -0
- package/dist/surfaces/mcp/tool-definitions.js.map +1 -1
- package/dist/surfaces/mcp/tool-handlers.d.ts.map +1 -1
- package/dist/surfaces/mcp/tool-handlers.js +6 -1
- package/dist/surfaces/mcp/tool-handlers.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
# GraphFlow
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@roarpeng/graphflow)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> **编码 Agent 的上下文与记忆层** — Local-first 代码知识图谱 + 上下文压缩 + 跨会话学习飞轮
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
GraphFlow 为 Cursor / Claude Code 等编码 Agent 提供项目级的"感知与记忆":把仓库索引成知识图谱,将 Agent 需要的上下文压缩 **90%+ token**(基准实测 98.7%),并通过 Episodic / Skill / Decision 三类节点让 Agent **跨会话复用项目经验**。规划与执行通过 Bridge 模式委托给宿主 Agent 完成——GraphFlow 不持有 LLM 也能完整闭环。
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
纯 TypeScript/Node 实现,CLI + MCP + VS Code 扩展三种形态,无 API key 即可离线运行。
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## 30 秒上手
|
|
12
|
+
|
|
13
|
+
无需 API key(离线 AST 建图 + 图压缩):
|
|
12
14
|
|
|
13
15
|
```bash
|
|
14
|
-
# 1.
|
|
16
|
+
# 1. 离线建图(AST 索引,无需 LLM)
|
|
15
17
|
npx @roarpeng/graphflow graph index .
|
|
16
18
|
|
|
17
|
-
# 2.
|
|
19
|
+
# 2. 预览压缩上下文(锚点 + 摘要,节省 90%+ token)
|
|
18
20
|
npx @roarpeng/graphflow context preview "orchestrator" --json
|
|
19
21
|
```
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
接入 MCP(Cursor / Claude Code 等):
|
|
22
24
|
|
|
23
25
|
```json
|
|
24
26
|
{
|
|
@@ -31,529 +33,149 @@ npx @roarpeng/graphflow context preview "orchestrator" --json
|
|
|
31
33
|
}
|
|
32
34
|
```
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
Agent 先调 `graphflow_context` 拿压缩上下文,再用 `graphflow_plan` 规划;无 provider API key 时 GraphFlow 自动把 ATP 思考协议桥接给宿主 Agent 作答(agent-delegated 模式)。
|
|
35
37
|
|
|
36
|
-
##
|
|
38
|
+
## 为什么是 GraphFlow
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
单点工具各有长项,GraphFlow 把"图谱 + 压缩 + 规划协议 + 学习记忆"合到一处:
|
|
39
41
|
|
|
40
|
-
|
|
|
42
|
+
| 能力 | **GraphFlow** | CodeGraph | Serena | Repomix |
|
|
41
43
|
| --- | --- | --- | --- | --- |
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
| Local-first |
|
|
47
|
-
|
|
|
44
|
+
| 代码图谱 | 12 语言 AST 索引 | 更成熟 | LSP 符号级 | 无 |
|
|
45
|
+
| 上下文压缩 | 分层 + 图压缩 + 向量召回 | 部分 | 部分 | 整库打包 |
|
|
46
|
+
| 规划协议 | ATP IR + DAG + Agent 桥接 | 无 | 无 | 无 |
|
|
47
|
+
| **学习记忆** | Episodic / Skill / Decision 飞轮 | 无 | 无 | 无 |
|
|
48
|
+
| Local-first | ✅ | ✅ | ✅ | ✅ |
|
|
49
|
+
| 协议开放 | [ATP/IR 公开规范](docs/atp-ir-spec-v1.md) | — | — | — |
|
|
48
50
|
|
|
49
|
-
>
|
|
51
|
+
> 差异化核心是**学习飞轮**:图谱索引和 token 压缩都可复制,跨会话积累的项目私有经验(技能、教训、决策)不可复制——它随使用时长增值。
|
|
50
52
|
|
|
51
|
-
##
|
|
53
|
+
## 核心能力(v1.7.15+)
|
|
52
54
|
|
|
53
|
-
|
|
|
55
|
+
| 模块 | 能力 |
|
|
54
56
|
| --- | --- |
|
|
55
|
-
|
|
|
56
|
-
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
**P1 ?? hnswlib-node**??????C++ ??????????????????????? <10K ???????????
|
|
78
|
-
|
|
79
|
-
**P2 MCP ????**??8 ?????? 10 ??????context?plan?index?insight?diagnose?artifact ????????LLM ??????????
|
|
80
|
-
|
|
81
|
-
**P2 ATP ?????**??????????????????????short-circuit????First Principles / Decision Matrix / Reflection????4-6 ??LLM ????
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
### v1.5.0 ????026-07??
|
|
86
|
-
|
|
87
|
-
**ATP v1.0 Agent Thinking Protocol**????????????????????????
|
|
88
|
-
|
|
89
|
-
**?? 5 ??????*?? Six Hats + 5-Why ????????
|
|
90
|
-
|
|
91
|
-
1. **Intent Analysis** ??????/???????????????????
|
|
92
|
-
2. **Requirement Analysis** ?????????????????????included/excluded??
|
|
93
|
-
3. **First Principles** ?????????????????
|
|
94
|
-
4. **Decision Matrix** ?????? 5 ?????complexity/cost/risk/maintainability/impact??????
|
|
95
|
-
5. **Plan Reflection** ???????????????????????????
|
|
96
|
-
|
|
97
|
-
**ATP ?? IR**?`atp-schema.ts` ?? `AgentThinkingProtocol` ????????Multi-Agent ????????
|
|
98
|
-
|
|
99
|
-
**TaskNode ??**????`priority`?`complexity`?`verification`?`inputs`?`outputs`?`risks` 6 ???????
|
|
100
|
-
|
|
101
|
-
**Agent ????**?work items ????intent +requirement +first-principles +decision-matrix +reflection??submit/merge ??????
|
|
102
|
-
|
|
103
|
-
**????**?`planInsight(task, options)` ????????????`runFullAtp=true` ???? ATP 8 ????
|
|
104
|
-
|
|
105
|
-
**P0 ????**????VS Code ????????runtime ??????`enrichGraph`/`downloadModel`/`showSetupGuide` ?? + `/enrich` ???????? 87 ??OpenBMB/enrichment ????????`canaryAllowed`/`canaryReason` ??5 ??enrichment ??????
|
|
106
|
-
|
|
107
|
-
### v1.4.0 ????026-07??
|
|
108
|
-
|
|
109
|
-
**???????**????OpenBMB ?????????????????????????????????????????????????????????????????????
|
|
110
|
-
|
|
111
|
-
**??????????**??
|
|
112
|
-
|
|
113
|
-
1. **HNSW ?????????*?P0 ????
|
|
114
|
-
- `file-indexer` ??????File/Symbol/Module ??????????embedding?`@xenova/transformers` + `all-MiniLM-L6-v2`??84 ??
|
|
115
|
-
- `orchestrator-context` ?????`embeddingProvider` + `enableVectorRecall` ??????
|
|
116
|
-
- ???????????????? C++ ????
|
|
117
|
-
|
|
118
|
-
2. **FileWatcher ?? MCP ??**?P0 ????
|
|
119
|
-
- `startFileWatcherIfEnabled` ????????????MCP ????????
|
|
120
|
-
- ??`autoIndexOnSave: true` ??????????????
|
|
121
|
-
|
|
122
|
-
3. **?????????*?P1 ????
|
|
123
|
-
- `skillHints` ??????? `enableGraphContextInPrompt`??????worker prompt
|
|
124
|
-
- Dangling edges ???`applySkillLearning` ??????Decision ???? `improves` ??
|
|
125
|
-
|
|
126
|
-
### ????
|
|
127
|
-
|
|
128
|
-
- **v1.3.x**?????????Java/Ruby ????MCP ????????????
|
|
129
|
-
- **v1.0.x**????????bridge ??????????????????
|
|
130
|
-
- **v0.6.x**?????????autoIndexOnSave?runtime ????VS Code esbuild bundle
|
|
131
|
-
|
|
132
|
-
### ????
|
|
133
|
-
|
|
134
|
-
- ?????**v1.7.14**?root + vscode-extension??npm?`@roarpeng/graphflow@1.7.14`
|
|
135
|
-
- **GitHub Release**?push ??`main` ??CI ??`windows-2022` ??????VSIX ???? [GitHub Releases](https://github.com/Roarpeng/GraphFlow/releases)
|
|
136
|
-
- **Open VSX**:`main` / `v*` Build 成功后自动幂等发布到 [Open VSX](https://open-vsx.org/extension/roarpeng/graphflow-tool)(密钥 `open_vsx_token`,namespace `roarpeng`,与 `package.json` publisher 一致;版本已存在则跳过)
|
|
137
|
-
- **npm ??**?push tag `v*`?? `v1.4.1`????[Publish npm](https://github.com/Roarpeng/GraphFlow/actions/workflows/publish-npm.yml) ????
|
|
138
|
-
- ?????`CHANGELOG.md`
|
|
139
|
-
|
|
140
|
-
## ????
|
|
141
|
-
|
|
142
|
-
1. Node.js >= 20
|
|
143
|
-
2. npm >= 10
|
|
144
|
-
3. Windows / macOS / Linux ??
|
|
145
|
-
4. **npm ?? `@roarpeng/graphflow` ??*?? JS/TS ??????????
|
|
146
|
-
|
|
147
|
-
## 5 ??????
|
|
148
|
-
|
|
149
|
-
```bash
|
|
150
|
-
npm install
|
|
151
|
-
npm run ci
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
预期:`lint` 无错误、`build` 成功、**357+ tests** 通过、扩展 bundle 与 runtime smoke 通过。
|
|
155
|
-
|
|
156
|
-
## Agent ????
|
|
157
|
-
|
|
158
|
-
GraphFlow ????????????
|
|
159
|
-
|
|
160
|
-
1. **CLI ????**???????? `--json`
|
|
161
|
-
2. **MCP stdio server**?Cursor?Claude Code ??????
|
|
162
|
-
|
|
163
|
-
??????MCP??
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
npm run start:mcp
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### MCP ?????10 ??
|
|
170
|
-
|
|
171
|
-
| ?? | ???|
|
|
57
|
+
| **规划协议** | ATP v1.1(Intent / Requirement / Six Hats / 5-Why / First Principles / Decision Matrix / Planning / Reflection);simple / complex / insight 三种模式;无 LLM 时 agent-delegated 桥接;[ATP/IR 公开规范 v1.1](docs/atp-ir-spec-v1.md) |
|
|
58
|
+
| **目标对齐** | **Goal 锚点节点化**(intent 五元组固化为一等公民,每次打包自动注入原始需求);**低置信度澄清门**(confidence < 0.6 不出 plan);**alignment-check 执行期回检**;**deviation 偏离分类**(misread-requirement / scope-creep / tech-drift);**Goal 版本链 + 变更 diff** |
|
|
59
|
+
| **知识图谱** | 12 语言 AST 索引(TS/JS/Python/Rust/Go/C/C++/Java/Ruby/Kotlin/Swift/Dart);File / Module / Symbol 节点 + 依赖/引用/定义/调用/继承边 |
|
|
60
|
+
| **上下文压缩** | L1/L2/L3 分层锚点;图结构压缩(边权重 + PageRank,**LRU 缓存**);**词干匹配召回**(orchestrate ↔ orchestration);向量召回 + RRF;RepoMap 概览;自适应预算 |
|
|
61
|
+
| **检索质量** | **Golden-set 回归门禁**(26 查询,CI 强制 ≥80% 召回,实测 100%) |
|
|
62
|
+
| **向量索引** | 进程内记忆化 + **磁盘持久化**(指纹校验,MCP 重启秒级恢复) |
|
|
63
|
+
| **存储后端** | `file` / `memory` / `sqlite`(FTS5,**searchtext 分词增强**,camelCase 可检索)/ **`auto`(sqlite 优先自动切换)** / `mcp-http` |
|
|
64
|
+
| **学习飞轮** | Episodic Memory、Reflection、Skill 节点(score ±1,bounded [-20,20])、nightly 学习、技能衰减/剪枝、**飞轮贡献报告**(`skill report` / `graphflow_diagnose`,含偏离聚合与 Goal 统计) |
|
|
65
|
+
| **团队共享** | **`skill sync`**:技能包导出/导入到可提交的 `.graphflow/skills/team-skills.json` |
|
|
66
|
+
| **效果基准** | [token 节省 98.7%](benchmarks/RESULTS.md)(独立复核);[Skill A/B 基准](benchmarks/SKILL-AB-RESULTS.md)(注入率/召回率/开销,`npm run benchmark:skills`) |
|
|
67
|
+
| **模型路由** | Smart / Economy 双 tier;多 provider 健康探测与 fallback(DeepSeek、OpenAI、Anthropic、百炼、豆包) |
|
|
68
|
+
| **可观测性** | `graphflow_diagnose`:provider 健康 + 图统计 + token 节省 + **飞轮报告** |
|
|
69
|
+
| **Agent 接入** | CLI `--json`;MCP stdio(10 工具);自动安装 MCP 到 15+ Agent |
|
|
70
|
+
| **工程质量** | TypeScript strict;**92 测试文件 / 455 tests**;`npm run ci` 含扩展打包与 smoke |
|
|
71
|
+
|
|
72
|
+
### 定位说明
|
|
73
|
+
|
|
74
|
+
> GraphFlow **不是编排执行器**——它是编码 Agent 的**上下文与记忆层**。任务执行通过 Bridge 模式交给宿主 coding agent(诚实语义,不伪造 COMPLETED);GraphFlow 负责让它"看得准、记得住"。
|
|
75
|
+
|
|
76
|
+
## MCP 工具(10 个)
|
|
77
|
+
|
|
78
|
+
| 工具 | 功能 |
|
|
172
79
|
| --- | --- |
|
|
173
|
-
| `graphflow_context` |
|
|
174
|
-
| `graphflow_plan` |
|
|
175
|
-
| `graphflow_run` |
|
|
176
|
-
| `graphflow_report_outcome` |
|
|
177
|
-
| `graphflow_insight` |
|
|
178
|
-
| `graphflow_index` |
|
|
179
|
-
| `graphflow_skill_insights` |
|
|
180
|
-
| `graphflow_diagnose` |
|
|
181
|
-
| `graphflow_artifact` |
|
|
182
|
-
| `graphflow_skill_guide` |
|
|
183
|
-
|
|
184
|
-
**MCP ????**???? MCP ????`cwd` ????????????????
|
|
185
|
-
|
|
186
|
-
- ?? `graphflow_index` ????`rootDir`????????
|
|
187
|
-
- ??MCP ??????`GRAPHFLOW_WORKSPACE_ROOT` ????
|
|
188
|
-
- ?? VS Code ?????????????`.cursor/mcp.json`
|
|
189
|
-
|
|
190
|
-
CLI ????
|
|
191
|
-
|
|
192
|
-
```bash
|
|
193
|
-
npm run start -- plan "refactor planner and add tests" --json
|
|
194
|
-
npm run start -- context preview "orchestrator" --json
|
|
195
|
-
npm run start -- graph inspect --json
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
?? agent ?????`AGENTS.md`?`CLAUDE.md`?`.cursor/rules/graphflow.mdc`
|
|
199
|
-
|
|
200
|
-
## ???????CLI??
|
|
201
|
-
|
|
202
|
-
### ????
|
|
203
|
-
|
|
204
|
-
```bash
|
|
205
|
-
npm run start -- graph index .
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
???`indexedFiles=?? indexedSymbols=?`
|
|
209
|
-
|
|
210
|
-
### ????????
|
|
80
|
+
| `graphflow_context` | 压缩上下文包(query → 锚点 + 摘要;anchorId → 展开) |
|
|
81
|
+
| `graphflow_plan` | 任务规划(mode='simple' 或 'insight';无 LLM 时 agent-delegated) |
|
|
82
|
+
| `graphflow_run` | 编排 + Bridge 执行描述符 |
|
|
83
|
+
| `graphflow_report_outcome` | 结果回填(含 deviation 偏离分类),闭环学习飞轮 |
|
|
84
|
+
| `graphflow_insight` | ATP 洞察 submit / merge(Agent 桥接协议) |
|
|
85
|
+
| `graphflow_index` | 增量 / 全量索引 |
|
|
86
|
+
| `graphflow_skill_insights` | 技能洞察 |
|
|
87
|
+
| `graphflow_diagnose` | 诊断(provider + 图 + token 节省 + 飞轮) |
|
|
88
|
+
| `graphflow_artifact` | 图谱 artifact 导入 / 导出 |
|
|
89
|
+
| `graphflow_skill_guide` | GraphFlow Skill 使用指南 |
|
|
211
90
|
|
|
212
|
-
|
|
213
|
-
npm run start -- context preview "orchestrator"
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
???`summary=?? anchors=?? tokens=?`??????????????**90%+ token**??
|
|
217
|
-
|
|
218
|
-
### ???? / ??
|
|
219
|
-
|
|
220
|
-
```bash
|
|
221
|
-
npm run start -- run "update readme and add tests"
|
|
222
|
-
npm run start -- plan "update readme and add tests and refactor architecture module"
|
|
223
|
-
```
|
|
91
|
+
**MCP 工作区解析**:自动从 MCP 客户端 `cwd` 发现工作区;也可用 `GRAPHFLOW_WORKSPACE_ROOT` 显式指定。
|
|
224
92
|
|
|
225
|
-
|
|
93
|
+
## CLI 速查
|
|
226
94
|
|
|
227
95
|
```bash
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
96
|
+
graphflow graph index . # 建图
|
|
97
|
+
graphflow context preview "orchestrator" # 上下文预览
|
|
98
|
+
graphflow plan "refactor planner" --json # 规划
|
|
99
|
+
graphflow run "update readme" # 编排(Bridge)
|
|
100
|
+
graphflow skill insights # 技能洞察
|
|
101
|
+
graphflow skill report # 飞轮贡献报告
|
|
102
|
+
graphflow skill sync export # 导出团队技能包(git 共享)
|
|
103
|
+
graphflow skill sync import # 导入团队技能包
|
|
104
|
+
graphflow route diagnose # 路由诊断
|
|
105
|
+
graphflow learn nightly # 夜间学习
|
|
106
|
+
graphflow doctor # 安装自检
|
|
232
107
|
```
|
|
233
108
|
|
|
234
|
-
##
|
|
235
|
-
|
|
236
|
-
### ??????
|
|
237
|
-
|
|
238
|
-
GraphFlow ??????????????????????????????????????????????
|
|
239
|
-
|
|
240
|
-
| ??| ?? | ?? | ?? |
|
|
241
|
-
| --- | --- | --- | --- |
|
|
242
|
-
| ??????| ????????+ PageRank ??????| ??LLM | **???* |
|
|
243
|
-
| ???? | transformers.js embedding + ?????+ RRF ?? | ???? | **???* |
|
|
244
|
-
| RepoMap ?? | ???????????? | ??LLM | opt-in |
|
|
245
|
-
| ????? | ???????????token ?? | ??LLM | opt-in |
|
|
246
|
-
|
|
247
|
-
**??????**??
|
|
248
|
-
|
|
249
|
-
- ????`file-indexer` ????????384 ????embedding?`@xenova/transformers` + `all-MiniLM-L6-v2`?? 22MB?? JS ????
|
|
250
|
-
- ??????query ????????embedding????????cosine similarity
|
|
251
|
-
- ????????????? <10K ??????????? HNSW ANN??
|
|
252
|
-
- ??????+ ???????? RRF?Reciprocal Rank Fusion, k=60????
|
|
253
|
-
|
|
254
|
-
??????
|
|
255
|
-
|
|
256
|
-
```json
|
|
257
|
-
{
|
|
258
|
-
"graphPolicy": {
|
|
259
|
-
"compression": {
|
|
260
|
-
"enableGraphCompression": true,
|
|
261
|
-
"enableAdaptiveBudget": true
|
|
262
|
-
}
|
|
263
|
-
},
|
|
264
|
-
"embeddingPolicy": {
|
|
265
|
-
"enabled": true,
|
|
266
|
-
"provider": "transformers",
|
|
267
|
-
"modelCacheDir": "/path/to/preseeded/transformers-cache",
|
|
268
|
-
"topK": 8,
|
|
269
|
-
"minSimilarity": 0.05
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
```
|
|
109
|
+
## 配置
|
|
273
110
|
|
|
274
|
-
|
|
111
|
+
三层合并:全局 `~/.graphflow.config.json` → 项目 `graphflow.config.json` → 项目 `.graphflow/config.json`。复制 [graphflow.config.example.json](graphflow.config.example.json) 起步。
|
|
275
112
|
|
|
276
|
-
|
|
113
|
+
关键项:
|
|
277
114
|
|
|
278
|
-
|
|
279
|
-
npm run start -- route diagnose
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
### SQLite / FTS5 ??
|
|
283
|
-
|
|
284
|
-
```json
|
|
285
|
-
{
|
|
286
|
-
"graphPolicy": {
|
|
287
|
-
"transport": "sqlite",
|
|
288
|
-
"graphStorePath": "tmp/graphflow-graph.sqlite",
|
|
289
|
-
"maxContextTokens": 1500
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
WAL + FTS5 ?????? `file` / `memory` ??????
|
|
295
|
-
|
|
296
|
-
### Episodic Memory + Reflection
|
|
297
|
-
|
|
298
|
-
```ts
|
|
299
|
-
const run = await orchestrate(
|
|
300
|
-
{ task: "refactor planner module and add tests" },
|
|
301
|
-
{ graphClient, enableEpisodicMemory: true, enableGraphContextInPrompt: true }
|
|
302
|
-
);
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
?? task ?? Episode????embedding???? task ???????Jaccard + embedding RRF ??????`learn nightly` ?? Lesson ???Lesson ??????????planner prompt??
|
|
306
|
-
|
|
307
|
-
### ???????
|
|
308
|
-
|
|
309
|
-
- `applySkillLearning`????????????????? Skill ?? score?pass +1 / fail -1?bounded [-20,20]??
|
|
310
|
-
- `suggestSkillHints`????Skill ???? score/uses ??????top-N ?????
|
|
311
|
-
- ?????????worker prompt??????????????
|
|
312
|
-
- ???????????????????? composite skill ??
|
|
313
|
-
|
|
314
|
-
### ??? AST ??
|
|
315
|
-
|
|
316
|
-
| ?? | ?? |
|
|
115
|
+
| 配置 | 说明 |
|
|
317
116
|
| --- | --- |
|
|
318
|
-
|
|
|
319
|
-
|
|
|
320
|
-
|
|
|
321
|
-
|
|
|
322
|
-
|
|
|
323
|
-
|
|
|
324
|
-
| Ruby | `.rb` |
|
|
325
|
-
| Kotlin | `.kt` |
|
|
326
|
-
| Swift | `.swift` |
|
|
327
|
-
| Dart | `.dart` |
|
|
328
|
-
|
|
329
|
-
?? `graphPolicy.includeExtensions` ???????tree-sitter WASM ???? `npm run build` ????`wasm/` ?? npm ???????????????
|
|
330
|
-
|
|
331
|
-
### Agent MCP ????
|
|
117
|
+
| `graphPolicy.transport` | `file` / `memory` / `sqlite` / **`auto`(推荐:sqlite 优先,不可用自动降级 file)** / `mcp-http` |
|
|
118
|
+
| `graphPolicy.maxContextTokens` | 上下文预算(默认 1500) |
|
|
119
|
+
| `graphPolicy.autoIndexOnSave` | 保存时自动增量索引(默认 true) |
|
|
120
|
+
| `embeddingPolicy.provider` | `transformers`(本地默认)/ `openai` / `hash` |
|
|
121
|
+
| `embeddingPolicy.vectorStorePath` | 向量索引持久化路径(自动派生 `.hnsw`) |
|
|
122
|
+
| `skillPolicy.enableSkillFlywheel` | 学习飞轮开关 |
|
|
332
123
|
|
|
333
|
-
|
|
124
|
+
## 基准
|
|
334
125
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
# ?????MCP + Skill + Cursor Rules????
|
|
340
|
-
npx @roarpeng/graphflow install
|
|
126
|
+
- **Token 节省**:[benchmarks/RESULTS.md](benchmarks/RESULTS.md) — 8 个代表性查询,230,069 → 2,893 tokens(**98.7%**),独立 gpt-tokenizer 复核,`npm run benchmark` 可复现。
|
|
127
|
+
- **Skill 飞轮 A/B**:[benchmarks/SKILL-AB-RESULTS.md](benchmarks/SKILL-AB-RESULTS.md) — 注入率 100%、episode 召回 100%、平均开销 25.6 tokens/任务,`npm run benchmark:skills` 可复现。
|
|
128
|
+
- **检索召回**:golden set(26 查询)纳入 CI 回归门禁,防止压缩/排序改动悄悄劣化召回。
|
|
341
129
|
|
|
342
|
-
|
|
343
|
-
npx @roarpeng/graphflow init
|
|
344
|
-
```
|
|
130
|
+
## VS Code / Cursor 扩展
|
|
345
131
|
|
|
346
|
-
|
|
132
|
+
从 [GitHub Releases](https://github.com/Roarpeng/GraphFlow/releases) 下载 `graphflow-tool-<version>.vsix` 安装(或 Open VSX:`roarpeng.graphflow-tool`)。
|
|
347
133
|
|
|
348
|
-
|
|
134
|
+
命令:Settings / Show Graph(图谱可视化)/ Preview Context / Plan & Brainstorm / Run Task / Skill Insights / Install MCP;Chat Agent `@graphflow`(`/run` `/plan` `/graph` `/skills` `/diagnose` `/learn` `/history`)。
|
|
349
135
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
| ?? | ?? |
|
|
353
|
-
|------|------|
|
|
354
|
-
| `.trae/rules/graphflow.md` | `alwaysApply: true` ???????? `graphflow_context` |
|
|
355
|
-
| `.trae/skills/graphflow/SKILL.md` | ?? 10 ???????? `#graphflow` ???? |
|
|
356
|
-
| `~/.config/Trae CN/User/skills/graphflow/SKILL.md` | ????Skill??????|
|
|
357
|
-
| `User/mcp.json` | GraphFlow MCP ????|
|
|
136
|
+
## Agent 集成
|
|
358
137
|
|
|
359
138
|
```bash
|
|
360
|
-
|
|
361
|
-
npx @roarpeng/graphflow install
|
|
362
|
-
npx @roarpeng/graphflow
|
|
139
|
+
npx @roarpeng/graphflow doctor # 检测已安装的 Agent
|
|
140
|
+
npx @roarpeng/graphflow install # 自动安装 MCP + Skill + Rules
|
|
141
|
+
npx @roarpeng/graphflow init # 写入最小项目配置
|
|
363
142
|
```
|
|
364
143
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
### Antigravity IDE ????
|
|
368
|
-
|
|
369
|
-
| ?? | ?? |
|
|
370
|
-
|------|------|
|
|
371
|
-
| `~/.gemini/antigravity/mcp_config.json` | ?? MCP?`mcpServers` ?? |
|
|
372
|
-
| `~/.gemini/antigravity/skills/graphflow/SKILL.md` | ?? Skill |
|
|
373
|
-
| `.agent/rules/graphflow.md` | ????Rules |
|
|
374
|
-
| `.agent/skills/graphflow/SKILL.md` | ????Skill |
|
|
375
|
-
| `GEMINI.md` | ???????? |
|
|
376
|
-
|
|
377
|
-
### Gemini CLI ????
|
|
378
|
-
|
|
379
|
-
| ?? | ?? |
|
|
380
|
-
|------|------|
|
|
381
|
-
| `~/.gemini/settings.json` | MCP ????|
|
|
382
|
-
| `~/.gemini/GEMINI.md` | ????????|
|
|
383
|
-
|
|
384
|
-
### VS Code / GitHub Copilot ????
|
|
385
|
-
|
|
386
|
-
| ?? | ?? |
|
|
387
|
-
|------|------|
|
|
388
|
-
| `~/.config/Code/User/mcp.json` | ????MCP?`servers` ?? |
|
|
389
|
-
| `.github/copilot-instructions.md` | ????Copilot ???token-first??|
|
|
390
|
-
| `.vscode/mcp.json` | ????? MCP |
|
|
144
|
+
支持:Cursor、VS Code、Trae(含 CN)、Claude Code、Windsurf、Cline、Roo Code、Kilo Code、Gemini CLI、Codex、Antigravity、Opencode、Qoder、Amazon Q、Zed、Continue 等 15+。
|
|
391
145
|
|
|
392
|
-
|
|
393
|
-
npx @roarpeng/graphflow install # ????MCP + Skills
|
|
394
|
-
npx @roarpeng/graphflow install --scope all # ???? Rules / Copilot ??
|
|
395
|
-
npx @roarpeng/graphflow doctor
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
????Agent?Cursor?VS Code?Trae?Claude Code?Windsurf?Cline?Roo Code?Kilo Code?PearAI?Gemini?Codex?Antigravity?Amazon Q?Zed?Continue??
|
|
146
|
+
## 协议
|
|
399
147
|
|
|
400
|
-
|
|
148
|
+
[ATP/IR — Agent Thinking Protocol 公开规范 v1.0](docs/atp-ir-spec-v1.md):work-item 注册表、submit/merge 契约、兼容性规则。第三方工具可实现兼容的 producer / consumer。
|
|
401
149
|
|
|
402
|
-
|
|
150
|
+
## 开发
|
|
403
151
|
|
|
404
152
|
```bash
|
|
405
|
-
cp graphflow.config.example.json graphflow.config.json
|
|
406
|
-
```
|
|
407
|
-
|
|
408
|
-
### ?? vs ????
|
|
409
|
-
|
|
410
|
-
| ?? | ?? | ???? |
|
|
411
|
-
| --- | --- | --- |
|
|
412
|
-
| ?? | `~/.graphflow.config.json` | Provider?API Key?Smart/Economy ????????|
|
|
413
|
-
| ????| `graphflow.config.json` | ?????????? |
|
|
414
|
-
| ???? | `.graphflow/config.json` | ????????`graphflow init` ????|
|
|
415
|
-
|
|
416
|
-
**????????*??
|
|
417
|
-
|
|
418
|
-
- ????????**??????*?? `graphflow-out/graphflow-graph.json`
|
|
419
|
-
- ????**??**??????`workspaceRoot`????????????????
|
|
420
|
-
- MCP / ???????????????`GRAPHFLOW_WORKSPACE_ROOT=/path/to/project`
|
|
421
|
-
|
|
422
|
-
????
|
|
423
|
-
|
|
424
|
-
| ?? | ?? |
|
|
425
|
-
| --- | --- |
|
|
426
|
-
| `graphPolicy.transport` | `file` / `memory` / `sqlite` / `mcp-http` |
|
|
427
|
-
| `graphPolicy.graphStorePath` | ???????? JSON ??`.sqlite` ?? |
|
|
428
|
-
| `graphPolicy.maxContextTokens` | ?????????? **1500**??|
|
|
429
|
-
| `graphPolicy.autoIndexOnSave` | ?????????? **true**??|
|
|
430
|
-
| `graphPolicy.autoIndexOnPreview` / `autoIndexOnRun` | preview / run ??????|
|
|
431
|
-
| `graphPolicy.enableNearLosslessMode` | ???????? |
|
|
432
|
-
|
|
433
|
-
| `graphPolicy.layerQuota` | L1/L2/L3 ???? |
|
|
434
|
-
| `routingPolicy.enableDynamicRouting` | provider ???? |
|
|
435
|
-
| `skillPolicy.enableSkillFlywheel` | ?????|
|
|
436
|
-
| `embeddingPolicy.provider` | embedding ????`transformers` ?? / `openai`??|
|
|
437
|
-
|
|
438
|
-
## VS Code / Cursor ??
|
|
439
|
-
|
|
440
|
-
???? GraphFlow runtime??*?? VSIX ?????clone ?????? `npm run start`**?VSIX ???? `@xenova/transformers` ????????????????????? `GRAPHFLOW_EMBEDDING_CACHE_DIR`?Installer ??????????????????IDE ??????
|
|
441
|
-
|
|
442
|
-
### ?? VSIX????
|
|
443
|
-
|
|
444
|
-
1. ?? [GitHub Releases](https://github.com/Roarpeng/GraphFlow/releases)??????`graphflow-tool-<version>.vsix`?CI ????push `main` / tag ??????
|
|
445
|
-
2. **VS Code**????????`?` ??**??VSIX ????* ??????????
|
|
446
|
-
3. **Cursor**????????????`?` ??**Install from VSIX** ??????????
|
|
447
|
-
4. ????????????????? GraphFlow MCP ????Agent ??
|
|
448
|
-
5. ?????? **GraphFlow: Show Settings** ??**??????? LLM??* ?????? Context Preview / ????
|
|
449
|
-
|
|
450
|
-
CLI ????????`code` / `cursor` ????
|
|
451
|
-
|
|
452
|
-
```bash
|
|
453
|
-
code --install-extension graphflow-tool-1.7.14.vsix
|
|
454
|
-
cursor --install-extension graphflow-tool-1.7.14.vsix
|
|
455
|
-
```
|
|
456
|
-
|
|
457
|
-
### ????
|
|
458
|
-
|
|
459
|
-
| ?? | ?? |
|
|
460
|
-
| --- | --- |
|
|
461
|
-
| GraphFlow: Show Settings | ???????????|
|
|
462
|
-
| GraphFlow: Show Graph | **????????*???????????? |
|
|
463
|
-
| GraphFlow: Preview Context | ?????? Token Budget |
|
|
464
|
-
| GraphFlow: Plan & Brainstorm | ???? |
|
|
465
|
-
| GraphFlow: Run Task | ???? |
|
|
466
|
-
| GraphFlow: Skill Insights | ???????|
|
|
467
|
-
| GraphFlow: Install MCP | ?? MCP ?? |
|
|
468
|
-
|
|
469
|
-
Chat Agent?`@graphflow`??`/run`?`/plan`?`/graph`?`/skills`?`/diagnose`?`/learn`?`/history`
|
|
470
|
-
|
|
471
|
-
### Settings ????
|
|
472
|
-
|
|
473
|
-
1. ?? Graph Store Path ??**Save Settings**
|
|
474
|
-
2. **??????? LLM??* ????????
|
|
475
|
-
3. ?????? Provider ??**??????????*
|
|
476
|
-
|
|
477
|
-
???????`graph index` CLI?MCP `graphflow_index`?`autoIndexOnPreview` / `autoIndexOnRun` / `autoIndexOnSave`
|
|
478
|
-
|
|
479
|
-
### ?????????
|
|
480
|
-
|
|
481
|
-
```bash
|
|
482
|
-
cd vscode-extension
|
|
483
153
|
npm install
|
|
484
|
-
npm run build
|
|
154
|
+
npm run ci # lint + build + 测试 + 扩展打包 + smoke
|
|
485
155
|
```
|
|
486
156
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
### ???? VSIX
|
|
490
|
-
|
|
491
|
-
```bash
|
|
492
|
-
npm run package:extension
|
|
493
|
-
# ???artifacts/graphflow-tool-<version>.vsix
|
|
494
|
-
```
|
|
495
|
-
|
|
496
|
-
## ??????
|
|
497
|
-
|
|
498
|
-
1. `npm run ci` ??
|
|
499
|
-
2. `graph index` ??`indexedFiles > 0`
|
|
500
|
-
3. `context preview` ??`summary > 0` ??`anchors > 0`
|
|
501
|
-
4. VS Code **Show Graph** ????????????????????
|
|
502
|
-
5. `plan` / `run` ??????
|
|
503
|
-
6. `route diagnose` ???? provider ?????
|
|
504
|
-
|
|
505
|
-
## ????
|
|
506
|
-
|
|
507
|
-
**??????Snapshot ??????????*
|
|
508
|
-
|
|
509
|
-
- ???`~/.graphflow.config.json` ?????? `workspaceRoot`??*??????*??????
|
|
510
|
-
- ?????????????????? `store` ???????? `graphflow-out/`
|
|
511
|
-
|
|
512
|
-
**MCP ????????????**
|
|
513
|
-
|
|
514
|
-
- `graphflow_index` ?? `rootDir: "/????????"`
|
|
515
|
-
- ?? MCP ???? `"env": { "GRAPHFLOW_WORKSPACE_ROOT": "/????????" }`
|
|
516
|
-
- ?????????????WASM ??????`@roarpeng/graphflow` ????????????
|
|
517
|
-
|
|
518
|
-
**`context preview` ?? 0 anchors**
|
|
519
|
-
|
|
520
|
-
- ????`graph index` ??Settings ??
|
|
521
|
-
- ??????????????? `orchestrator`?`planner`??
|
|
522
|
-
|
|
523
|
-
**??????????????*
|
|
524
|
-
|
|
525
|
-
- ????????**?????*
|
|
526
|
-
- ??????????*????**?? 120 ??????????????
|
|
527
|
-
|
|
528
|
-
**API Key ????*
|
|
529
|
-
|
|
530
|
-
- ??`graphflow.config.json` ?? provider `apiKey`????`${ENV_VAR}` ??
|
|
531
|
-
- **DeepSeek????**?`providers.deepseek` + `tiers.*.provider: "deepseek"`?Base URL ?? `https://api.deepseek.com`???? `deepseek-v4-pro` / `deepseek-v4-flash`?? [DeepSeek API ??](https://api-docs.deepseek.com/zh-cn/)??
|
|
532
|
-
|
|
533
|
-
**??LLM ????**
|
|
534
|
-
|
|
535
|
-
- ??????????????context preview????????+ transformers.js ????????MCP `graphflow_diagnose` ???? LLM
|
|
536
|
-
- ?? Six Hats ??????LLM ?????????provider
|
|
157
|
+
要求 Node.js ≥ 20、npm ≥ 10。预期:lint 无错误、构建成功、455 测试通过。
|
|
537
158
|
|
|
538
|
-
##
|
|
159
|
+
## 项目结构
|
|
539
160
|
|
|
540
161
|
```text
|
|
541
162
|
GraphFlow/
|
|
542
163
|
├── src/
|
|
543
|
-
│ ├── core/ # 编排核心:orchestrator, triage, dag-engine,
|
|
544
|
-
│ ├── graph/ # 索引、上下文切片、图压缩、snapshot
|
|
545
|
-
│ ├── routing/ # 模型路由与健康探测(
|
|
546
|
-
│ ├── learning/ # embeddings,
|
|
164
|
+
│ ├── core/ # 编排核心:orchestrator, triage, dag-engine, agent-delegation
|
|
165
|
+
│ ├── graph/ # 索引、上下文切片、图压缩、sqlite/auto 存储、snapshot
|
|
166
|
+
│ ├── routing/ # 模型路由与健康探测(5 provider)
|
|
167
|
+
│ ├── learning/ # embeddings, episodic, skill-flywheel, hnsw, nightly
|
|
168
|
+
│ ├── agents/ # ATP schema, planner, insight, brainstormer
|
|
547
169
|
│ └── surfaces/
|
|
548
|
-
│ ├── cli/ # CLI + runtime
|
|
549
|
-
│ └── mcp/ # MCP server
|
|
550
|
-
├── tests/ #
|
|
170
|
+
│ ├── cli/ # CLI + runtime
|
|
171
|
+
│ └── mcp/ # MCP server(10 工具)
|
|
172
|
+
├── tests/ # 92 文件 / 455 tests(含检索 golden set、goal anchor)
|
|
173
|
+
├── benchmarks/ # token 节省 + skill A/B 基准(可复现)
|
|
174
|
+
├── docs/ # ATP v1.0 设计 + ATP/IR 公开规范
|
|
551
175
|
├── vscode-extension/ # VS Code 面板与命令
|
|
552
|
-
├── docs/
|
|
553
176
|
└── CHANGELOG.md
|
|
554
177
|
```
|
|
555
178
|
|
|
556
|
-
##
|
|
179
|
+
## 历史变更
|
|
557
180
|
|
|
558
|
-
|
|
559
|
-
- License?Apache-2.0
|
|
181
|
+
详细记录见 [CHANGELOG.md](CHANGELOG.md)。License:Apache-2.0。
|