@roarpeng/graphflow 1.4.4 → 1.7.4

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.
Files changed (227) hide show
  1. package/AGENTS.md +1 -1
  2. package/CHANGELOG.md +72 -0
  3. package/CLAUDE.md +1 -1
  4. package/README.md +76 -50
  5. package/dist/agents/atp-schema.d.ts +59 -0
  6. package/dist/agents/atp-schema.d.ts.map +1 -0
  7. package/dist/agents/atp-schema.js +3 -0
  8. package/dist/agents/atp-schema.js.map +1 -0
  9. package/dist/agents/decision-engine.d.ts +55 -0
  10. package/dist/agents/decision-engine.d.ts.map +1 -0
  11. package/dist/agents/decision-engine.js +338 -0
  12. package/dist/agents/decision-engine.js.map +1 -0
  13. package/dist/agents/insight.d.ts +69 -2
  14. package/dist/agents/insight.d.ts.map +1 -1
  15. package/dist/agents/insight.js +420 -27
  16. package/dist/agents/insight.js.map +1 -1
  17. package/dist/agents/task-profile.d.ts +19 -0
  18. package/dist/agents/task-profile.d.ts.map +1 -0
  19. package/dist/agents/task-profile.js +64 -0
  20. package/dist/agents/task-profile.js.map +1 -0
  21. package/dist/agents/validator.js +1 -1
  22. package/dist/agents/validator.js.map +1 -1
  23. package/dist/config/defaults.d.ts.map +1 -1
  24. package/dist/config/defaults.js +4 -3
  25. package/dist/config/defaults.js.map +1 -1
  26. package/dist/config/discover-workspace.d.ts.map +1 -1
  27. package/dist/config/discover-workspace.js +13 -2
  28. package/dist/config/discover-workspace.js.map +1 -1
  29. package/dist/config/embedding-factory.d.ts.map +1 -1
  30. package/dist/config/embedding-factory.js +87 -8
  31. package/dist/config/embedding-factory.js.map +1 -1
  32. package/dist/config/loader.d.ts.map +1 -1
  33. package/dist/config/loader.js +10 -4
  34. package/dist/config/loader.js.map +1 -1
  35. package/dist/config/provider-env.d.ts +32 -0
  36. package/dist/config/provider-env.d.ts.map +1 -0
  37. package/dist/config/provider-env.js +51 -0
  38. package/dist/config/provider-env.js.map +1 -0
  39. package/dist/config/resolve.d.ts.map +1 -1
  40. package/dist/config/resolve.js +7 -2
  41. package/dist/config/resolve.js.map +1 -1
  42. package/dist/config/schema.d.ts +17 -3
  43. package/dist/config/schema.d.ts.map +1 -1
  44. package/dist/config/workspace-root.d.ts +0 -12
  45. package/dist/config/workspace-root.d.ts.map +1 -1
  46. package/dist/config/workspace-root.js +21 -5
  47. package/dist/config/workspace-root.js.map +1 -1
  48. package/dist/core/agent-delegation.d.ts +8 -1
  49. package/dist/core/agent-delegation.d.ts.map +1 -1
  50. package/dist/core/agent-delegation.js +233 -38
  51. package/dist/core/agent-delegation.js.map +1 -1
  52. package/dist/core/cancellation.d.ts +57 -0
  53. package/dist/core/cancellation.d.ts.map +1 -0
  54. package/dist/core/cancellation.js +195 -0
  55. package/dist/core/cancellation.js.map +1 -0
  56. package/dist/core/dag-engine.d.ts +6 -1
  57. package/dist/core/dag-engine.d.ts.map +1 -1
  58. package/dist/core/dag-engine.js +67 -9
  59. package/dist/core/dag-engine.js.map +1 -1
  60. package/dist/core/orchestrator-context.d.ts.map +1 -1
  61. package/dist/core/orchestrator-context.js +28 -3
  62. package/dist/core/orchestrator-context.js.map +1 -1
  63. package/dist/core/orchestrator-route.d.ts +1 -1
  64. package/dist/core/orchestrator-route.d.ts.map +1 -1
  65. package/dist/core/orchestrator-route.js.map +1 -1
  66. package/dist/core/orchestrator.js +6 -1
  67. package/dist/core/orchestrator.js.map +1 -1
  68. package/dist/core/runtime-controller.d.ts +19 -0
  69. package/dist/core/runtime-controller.d.ts.map +1 -0
  70. package/dist/core/runtime-controller.js +89 -0
  71. package/dist/core/runtime-controller.js.map +1 -0
  72. package/dist/core/types.d.ts +17 -0
  73. package/dist/core/types.d.ts.map +1 -1
  74. package/dist/graph/context-slicer-types.d.ts +2 -4
  75. package/dist/graph/context-slicer-types.d.ts.map +1 -1
  76. package/dist/graph/context-slicer-types.js.map +1 -1
  77. package/dist/graph/context-slicer.d.ts +1 -0
  78. package/dist/graph/context-slicer.d.ts.map +1 -1
  79. package/dist/graph/context-slicer.js +54 -18
  80. package/dist/graph/context-slicer.js.map +1 -1
  81. package/dist/graph/file-indexer-walker.d.ts +3 -0
  82. package/dist/graph/file-indexer-walker.d.ts.map +1 -1
  83. package/dist/graph/file-indexer-walker.js.map +1 -1
  84. package/dist/graph/file-indexer.d.ts +1 -0
  85. package/dist/graph/file-indexer.d.ts.map +1 -1
  86. package/dist/graph/file-indexer.js +14 -18
  87. package/dist/graph/file-indexer.js.map +1 -1
  88. package/dist/graph/file-watcher.d.ts.map +1 -1
  89. package/dist/graph/file-watcher.js +9 -2
  90. package/dist/graph/file-watcher.js.map +1 -1
  91. package/dist/graph/graph-utils.d.ts +6 -1
  92. package/dist/graph/graph-utils.d.ts.map +1 -1
  93. package/dist/graph/graph-utils.js +116 -2
  94. package/dist/graph/graph-utils.js.map +1 -1
  95. package/dist/graph/graphify-file-client.d.ts.map +1 -1
  96. package/dist/graph/graphify-file-client.js +2 -1
  97. package/dist/graph/graphify-file-client.js.map +1 -1
  98. package/dist/graph/hit-diversify.d.ts +31 -0
  99. package/dist/graph/hit-diversify.d.ts.map +1 -0
  100. package/dist/graph/hit-diversify.js +270 -0
  101. package/dist/graph/hit-diversify.js.map +1 -0
  102. package/dist/graph/language-indexers/go.d.ts.map +1 -1
  103. package/dist/graph/language-indexers/go.js +2 -3
  104. package/dist/graph/language-indexers/go.js.map +1 -1
  105. package/dist/graph/language-indexers/incremental-parse.d.ts +9 -0
  106. package/dist/graph/language-indexers/incremental-parse.d.ts.map +1 -0
  107. package/dist/graph/language-indexers/incremental-parse.js +114 -0
  108. package/dist/graph/language-indexers/incremental-parse.js.map +1 -0
  109. package/dist/graph/language-indexers/python.d.ts.map +1 -1
  110. package/dist/graph/language-indexers/python.js +2 -3
  111. package/dist/graph/language-indexers/python.js.map +1 -1
  112. package/dist/graph/language-indexers/rust.d.ts.map +1 -1
  113. package/dist/graph/language-indexers/rust.js +2 -3
  114. package/dist/graph/language-indexers/rust.js.map +1 -1
  115. package/dist/graph/language-indexers/tree-sitter-loader.d.ts +19 -3
  116. package/dist/graph/language-indexers/tree-sitter-loader.d.ts.map +1 -1
  117. package/dist/graph/language-indexers/tree-sitter-loader.js +24 -4
  118. package/dist/graph/language-indexers/tree-sitter-loader.js.map +1 -1
  119. package/dist/graph/query-expand.d.ts.map +1 -1
  120. package/dist/graph/query-expand.js +2 -0
  121. package/dist/graph/query-expand.js.map +1 -1
  122. package/dist/index.d.ts +1 -1
  123. package/dist/index.d.ts.map +1 -1
  124. package/dist/index.js +2 -1
  125. package/dist/index.js.map +1 -1
  126. package/dist/integrations/agent-mcp-installer.d.ts +39 -0
  127. package/dist/integrations/agent-mcp-installer.d.ts.map +1 -1
  128. package/dist/integrations/agent-mcp-installer.js +220 -14
  129. package/dist/integrations/agent-mcp-installer.js.map +1 -1
  130. package/dist/learning/embedding-quality.d.ts +46 -0
  131. package/dist/learning/embedding-quality.d.ts.map +1 -0
  132. package/dist/learning/embedding-quality.js +131 -0
  133. package/dist/learning/embedding-quality.js.map +1 -0
  134. package/dist/learning/embeddings.d.ts +46 -3
  135. package/dist/learning/embeddings.d.ts.map +1 -1
  136. package/dist/learning/embeddings.js +186 -26
  137. package/dist/learning/embeddings.js.map +1 -1
  138. package/dist/learning/hnsw-index.d.ts +9 -35
  139. package/dist/learning/hnsw-index.d.ts.map +1 -1
  140. package/dist/learning/hnsw-index.js +8 -154
  141. package/dist/learning/hnsw-index.js.map +1 -1
  142. package/dist/learning/skill-flywheel.d.ts +1 -1
  143. package/dist/learning/skill-flywheel.d.ts.map +1 -1
  144. package/dist/learning/skill-flywheel.js +10 -3
  145. package/dist/learning/skill-flywheel.js.map +1 -1
  146. package/dist/routing/deepseek-tools.d.ts +7 -0
  147. package/dist/routing/deepseek-tools.d.ts.map +1 -0
  148. package/dist/routing/deepseek-tools.js +154 -0
  149. package/dist/routing/deepseek-tools.js.map +1 -0
  150. package/dist/routing/model-router.d.ts +1 -1
  151. package/dist/routing/model-router.d.ts.map +1 -1
  152. package/dist/routing/model-router.js +5 -1
  153. package/dist/routing/model-router.js.map +1 -1
  154. package/dist/routing/provider-adapters/anthropic.d.ts.map +1 -1
  155. package/dist/routing/provider-adapters/anthropic.js +7 -4
  156. package/dist/routing/provider-adapters/anthropic.js.map +1 -1
  157. package/dist/routing/provider-adapters/bailian.d.ts.map +1 -1
  158. package/dist/routing/provider-adapters/bailian.js +7 -4
  159. package/dist/routing/provider-adapters/bailian.js.map +1 -1
  160. package/dist/routing/provider-adapters/deepseek.d.ts +5 -0
  161. package/dist/routing/provider-adapters/deepseek.d.ts.map +1 -0
  162. package/dist/routing/provider-adapters/deepseek.js +109 -0
  163. package/dist/routing/provider-adapters/deepseek.js.map +1 -0
  164. package/dist/routing/provider-adapters/doubao.d.ts.map +1 -1
  165. package/dist/routing/provider-adapters/doubao.js +7 -4
  166. package/dist/routing/provider-adapters/doubao.js.map +1 -1
  167. package/dist/routing/provider-adapters/openai.d.ts +2 -4
  168. package/dist/routing/provider-adapters/openai.d.ts.map +1 -1
  169. package/dist/routing/provider-adapters/openai.js +23 -32
  170. package/dist/routing/provider-adapters/openai.js.map +1 -1
  171. package/dist/routing/provider-adapters/types.d.ts +61 -0
  172. package/dist/routing/provider-adapters/types.d.ts.map +1 -0
  173. package/dist/routing/provider-adapters/types.js +56 -0
  174. package/dist/routing/provider-adapters/types.js.map +1 -0
  175. package/dist/routing/provider-executor.d.ts +6 -1
  176. package/dist/routing/provider-executor.d.ts.map +1 -1
  177. package/dist/routing/provider-executor.js +70 -39
  178. package/dist/routing/provider-executor.js.map +1 -1
  179. package/dist/routing/provider-health.d.ts.map +1 -1
  180. package/dist/routing/provider-health.js +7 -1
  181. package/dist/routing/provider-health.js.map +1 -1
  182. package/dist/routing/role-capabilities.d.ts +11 -0
  183. package/dist/routing/role-capabilities.d.ts.map +1 -0
  184. package/dist/routing/role-capabilities.js +94 -0
  185. package/dist/routing/role-capabilities.js.map +1 -0
  186. package/dist/surfaces/antigravity-rules/graphflow.md +8 -8
  187. package/dist/surfaces/cli/runtime/env.d.ts.map +1 -1
  188. package/dist/surfaces/cli/runtime/env.js +3 -0
  189. package/dist/surfaces/cli/runtime/env.js.map +1 -1
  190. package/dist/surfaces/cli/runtime/facade.d.ts +2 -1
  191. package/dist/surfaces/cli/runtime/facade.d.ts.map +1 -1
  192. package/dist/surfaces/cli/runtime/facade.js +1 -0
  193. package/dist/surfaces/cli/runtime/facade.js.map +1 -1
  194. package/dist/surfaces/cli/runtime/graph.d.ts.map +1 -1
  195. package/dist/surfaces/cli/runtime/graph.js +7 -1
  196. package/dist/surfaces/cli/runtime/graph.js.map +1 -1
  197. package/dist/surfaces/cli/runtime/routing.d.ts +3 -0
  198. package/dist/surfaces/cli/runtime/routing.d.ts.map +1 -1
  199. package/dist/surfaces/cli/runtime/routing.js +31 -4
  200. package/dist/surfaces/cli/runtime/routing.js.map +1 -1
  201. package/dist/surfaces/cli/runtime/settings.d.ts.map +1 -1
  202. package/dist/surfaces/cli/runtime/settings.js +0 -5
  203. package/dist/surfaces/cli/runtime/settings.js.map +1 -1
  204. package/dist/surfaces/cli/runtime/types.d.ts +23 -9
  205. package/dist/surfaces/cli/runtime/types.d.ts.map +1 -1
  206. package/dist/surfaces/cli/runtime.d.ts +1 -1
  207. package/dist/surfaces/cli/runtime.d.ts.map +1 -1
  208. package/dist/surfaces/cli/runtime.js +2 -1
  209. package/dist/surfaces/cli/runtime.js.map +1 -1
  210. package/dist/surfaces/copilot-instructions/graphflow.md +6 -6
  211. package/dist/surfaces/cursor-rules/graphflow.mdc +20 -27
  212. package/dist/surfaces/mcp/server.js +17 -6
  213. package/dist/surfaces/mcp/server.js.map +1 -1
  214. package/dist/surfaces/mcp/tool-definitions.d.ts.map +1 -1
  215. package/dist/surfaces/mcp/tool-definitions.js +31 -124
  216. package/dist/surfaces/mcp/tool-definitions.js.map +1 -1
  217. package/dist/surfaces/mcp/tool-handlers.d.ts.map +1 -1
  218. package/dist/surfaces/mcp/tool-handlers.js +80 -42
  219. package/dist/surfaces/mcp/tool-handlers.js.map +1 -1
  220. package/dist/surfaces/trae-rules/graphflow.md +9 -9
  221. package/dist/surfaces/trae-skill/graphflow/SKILL.md +68 -75
  222. package/package.json +2 -2
  223. package/src/surfaces/antigravity-rules/graphflow.md +8 -8
  224. package/src/surfaces/copilot-instructions/graphflow.md +6 -6
  225. package/src/surfaces/cursor-rules/graphflow.mdc +20 -27
  226. package/src/surfaces/trae-rules/graphflow.md +9 -9
  227. package/src/surfaces/trae-skill/graphflow/SKILL.md +68 -75
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: GraphFlow token-first — always call graphflow_preview_context before code exploration, debugging, or edits.
2
+ description: GraphFlow token-first — always call graphflow_context before code exploration, debugging, or edits.
3
3
  alwaysApply: true
4
4
  globs:
5
5
  - "**/*"
@@ -13,11 +13,11 @@ GraphFlow is a graph-based context and planning MCP service. **You MUST use it b
13
13
 
14
14
  Before code exploration, implementation, debugging, review, planning, or architecture questions:
15
15
 
16
- 1. Call MCP tool **`graphflow_preview_context`** with the user's task/query and **`rootDir`** set to the current project absolute path.
16
+ 1. Call MCP tool **`graphflow_context`** with the user's task/query and **`rootDir`** set to the current project absolute path.
17
17
  2. Use returned `summary`, `anchors`, `refillPreview`, and `tokenBudget` as the primary context.
18
18
  3. Read full files only when anchors point there, compressed context is insufficient, or exact edits require the file body.
19
19
  4. For multi-step or ambiguous work, call **`graphflow_plan`** before implementation.
20
- 5. After major file changes, call **`graphflow_index`** or **`graphflow_index_file`**.
20
+ 5. After major file changes, call **`graphflow_index`** (or pass `filePath` for single-file index).
21
21
 
22
22
  **Do NOT** recursively grep the whole repository or read large files before GraphFlow preview.
23
23
 
@@ -26,11 +26,12 @@ Before code exploration, implementation, debugging, review, planning, or archite
26
26
  Code symbols are mostly English. For Chinese user questions:
27
27
 
28
28
  1. **Proactive:** Translate intent to English **file/class/component names** and pass **`englishQuery`** (e.g. `PoseDetectionPage`, `BattlePage`, `shieldEffect`). Avoid generic `exercise` when the user means UI/camera.
29
- 2. **Reactive:** If preview returns `agentWorkItems` with `query-translate-en`, answer the JSON prompt, then retry with `englishQuery`.
30
- 3. Keep `query` as the original Chinese text.
29
+ 2. **Module families (store/slices):** Prefer file stems (`useGameStore companionSlice dailySlice`), not bare domain words like `monster` (often hits `data/monsters` instead of `monsterSlice`).
30
+ 3. **Reactive:** If preview returns `agentWorkItems` with `query-translate-en`, answer the JSON prompt, then retry with `englishQuery`.
31
+ 4. Keep `query` as the original Chinese text.
31
32
 
32
33
  ```typescript
33
- graphflow_preview_context({
34
+ graphflow_context({
34
35
  query: "摄像头锻炼人物角色选择",
35
36
  englishQuery: "PoseDetectionPage avatarMode poseService",
36
37
  rootDir: "/absolute/path/to/project"
@@ -41,12 +42,11 @@ graphflow_preview_context({
41
42
 
42
43
  | Tool | When |
43
44
  |------|------|
44
- | `graphflow_preview_context` | **Always first** for code questions |
45
- | `graphflow_expand_anchor` | Need full content of one anchor |
45
+ | `graphflow_context` | **Always first** for code questions (use `query`); need full content of one anchor (use `anchorId`) |
46
46
  | `graphflow_plan` | Multi-step tasks |
47
47
  | `graphflow_index` | After significant edits |
48
48
 
49
- For the full 18-tool reference and workflows, use Skill **`#graphflow`** or `@skills/graphflow/SKILL.md`.
49
+ For the full 10-tool reference and workflows, use Skill **`#graphflow`** or `@skills/graphflow/SKILL.md`.
50
50
 
51
51
  ## Bridge mode
52
52
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: "graphflow"
3
- description: "Graph-based code context compression, task planning, and knowledge graph orchestration (18 MCP tools). Invoke before ANY code question, bug fix, debugging, file reading, Chinese/CJK query, refactor, or multi-step edit — ALWAYS call graphflow_preview_context MCP first when GraphFlow is connected."
3
+ description: "Graph-based code context compression, task planning, and knowledge graph orchestration (10 MCP tools). Invoke before ANY code question, bug fix, debugging, file reading, Chinese/CJK query, refactor, or multi-step edit — ALWAYS call graphflow_context MCP first when GraphFlow is connected."
4
4
  ---
5
5
 
6
6
  # GraphFlow Skill
@@ -20,11 +20,9 @@ GraphFlow is a graph-based context and planning service backed by a persistent M
20
20
 
21
21
  ┌─────────────────────────────────────────────────┐
22
22
  │ GraphFlow MCP Server (persistent backend) │
23
- 18 tools: preview, expand, plan, plan_insight, │
24
- run, report_outcome, submit_insight, merge_insight,│
25
- index, index_file, rebuild, inspect, skill_insights,│
26
- │ skill_guide, diagnose, export_artifact, import_artifact,│
27
- │ stats │
23
+ 10 tools: context, plan, index, insight, run,
24
+ report_outcome, skill_insights, diagnose,
25
+ artifact, skill_guide │
28
26
  └──────────────────┬──────────────────────────────┘
29
27
 
30
28
 
@@ -51,7 +49,7 @@ GraphFlow is a graph-based context and planning service backed by a persistent M
51
49
  - Scan the whole repository recursively before trying GraphFlow
52
50
  - Read large files before checking GraphFlow anchors
53
51
  - Skip GraphFlow for complex tasks
54
- - Use grep for codebase exploration before `graphflow_preview_context`
52
+ - Use grep for codebase exploration before `graphflow_context`
55
53
 
56
54
  ### Trae / Trae CN setup (Rules + Skill + MCP)
57
55
 
@@ -59,11 +57,11 @@ Trae loads **Rules every turn** and **Skills on demand**. GraphFlow `install` wr
59
57
 
60
58
  | Path | Role |
61
59
  |------|------|
62
- | `.trae/rules/graphflow.md` | `alwaysApply: true` — **must** call `graphflow_preview_context` first |
60
+ | `.trae/rules/graphflow.md` | `alwaysApply: true` — **must** call `graphflow_context` first |
63
61
  | `.trae/skills/graphflow/SKILL.md` | Full workflows; trigger with `#graphflow` |
64
62
  | `User/mcp.json` | GraphFlow MCP server |
65
63
 
66
- If Rules are missing, type `#graphflow` at the start of a chat. Pass `rootDir` = current project absolute path on every preview call.
64
+ If Rules are missing, type `#graphflow` at the start of a chat. Pass `rootDir` = current project absolute path on every context call.
67
65
 
68
66
  ### Antigravity IDE setup (Rules + Skill + MCP)
69
67
 
@@ -95,45 +93,37 @@ Run `npx @roarpeng/graphflow install` from the project root. Do **not** hardcode
95
93
 
96
94
  ---
97
95
 
98
- ## Tool Inventory (18 MCP Tools)
96
+ ## Tool Inventory (10 MCP Tools)
99
97
 
100
98
  ### Core Context Tools (Highest Frequency)
101
99
 
102
100
  | Tool | Purpose | Call Frequency |
103
101
  |------|---------|---------------|
104
- | `graphflow_preview_context` | Compress task context with token budget | **Highest** - default first step |
105
- | `graphflow_expand_anchor` | Expand a single anchor to full content | **High** - dive deeper into specific items |
102
+ | `graphflow_context` | Preview compressed context (query) or expand anchor (anchorId) | **Highest** - default first step |
106
103
 
107
104
  ### Planning Tools (High Frequency)
108
105
 
109
106
  | Tool | Purpose | Call Frequency |
110
107
  |------|---------|---------------|
111
- | `graphflow_plan` | Multi-step task decomposition & DAG | High - before complex work |
112
- | `graphflow_plan_insight` | Six Thinking Hats + 5-Why deep analysis | Medium - ambiguous/high-stakes tasks |
108
+ | `graphflow_plan` | Multi-step task decomposition & DAG (mode='simple' or 'insight') | High - before complex work |
113
109
  | `graphflow_run` | Plan + context package (bridge mode) | Medium - full task packaging |
114
110
  | `graphflow_report_outcome` | Report bridge-mode execution outcome back | Medium - close the learning loop |
115
- | `graphflow_submit_insight` | Submit agent answers to Six Hats / plan prompts | Medium - no external LLM API |
116
- | `graphflow_merge_insight` | Merge submitted insights into unified plan | Medium - after submit_insight |
111
+ | `graphflow_insight` | Submit or merge agent insights | Medium - no external LLM API |
117
112
 
118
113
  ### Graph Management Tools (Medium Frequency)
119
114
 
120
115
  | Tool | Purpose | Call Frequency |
121
116
  |------|---------|---------------|
122
- | `graphflow_index` | Incremental workspace re-index | Medium - after file changes |
123
- | `graphflow_index_file` | Single file incremental index | Medium-High - after saving a file |
124
- | `graphflow_rebuild` | Clear cache + full re-index | Low - when graph is stale/corrupted |
125
- | `graphflow_inspect_graph` | Graph stats & sample nodes/edges | Low - check graph health |
117
+ | `graphflow_index` | Incremental workspace re-index, single-file, or full rebuild | Medium - after file changes |
126
118
 
127
119
  ### Collaboration & Insights Tools (Low Frequency)
128
120
 
129
121
  | Tool | Purpose | Call Frequency |
130
122
  |------|---------|---------------|
131
- | `graphflow_export_artifact` | Export graph to portable artifact | Low - team sharing |
132
- | `graphflow_import_artifact` | Import graph artifact | Low - skip full index on new machine |
123
+ | `graphflow_artifact` | Export or import graph artifact | Low - team sharing |
133
124
  | `graphflow_skill_insights` | Learned skill patterns | Low - leverage prior learning |
134
125
  | `graphflow_skill_guide` | Skill usage guide for connected agents | Low - onboarding |
135
- | `graphflow_stats` | Cumulative token savings stats | Low - ROI tracking |
136
- | `graphflow_diagnose` | Provider health & model routing | Rare - config issues |
126
+ | `graphflow_diagnose` | Provider health, graph stats, and token savings | Low - ROI tracking / config issues |
137
127
 
138
128
  ---
139
129
 
@@ -144,32 +134,32 @@ Run `npx @roarpeng/graphflow install` from the project root. Do **not** hardcode
144
134
  **Use when:** Answering code questions, exploring codebase, understanding modules
145
135
 
146
136
  ```
147
- Step 1: graphflow_preview_context(query: "<your question>")
137
+ Step 1: graphflow_context(query: "<your question>")
148
138
  Step 2: Read summary + anchors as primary context
149
- Step 3: Expand specific anchors with graphflow_expand_anchor when needed
139
+ Step 3: Expand specific anchors with graphflow_context(anchorId: "...") when needed
150
140
  Step 4: Read full files only when exact edits required
151
141
  ```
152
142
 
153
- **Input - preview_context:**
143
+ **Input - context (preview):**
154
144
  ```typescript
155
145
  {
156
- query: string; // Required - user question (Chinese OK)
146
+ query: string; // Required for preview - user question (Chinese OK)
157
147
  englishQuery?: string; // Agent-translated English code search terms (recommended for CJK)
158
148
  configPath?: string;
159
149
  rootDir?: string;
160
150
  }
161
151
  ```
162
152
 
163
- **Input - expand_anchor:**
153
+ **Input - context (expand):**
164
154
  ```typescript
165
155
  {
166
- anchorId: string; // Required - anchor id from preview_context
156
+ anchorId: string; // Required for expand - anchor id from preview
167
157
  configPath?: string;
168
158
  rootDir?: string;
169
159
  }
170
160
  ```
171
161
 
172
- **Output structure (preview_context):**
162
+ **Output structure (preview):**
173
163
  ```typescript
174
164
  {
175
165
  summary: string[];
@@ -197,12 +187,14 @@ GraphFlow tokenizes CJK and expands workspace path hints. When that is not enoug
197
187
  **Preferred (proactive):**
198
188
  ```
199
189
  Step 1: Translate user intent to English file/symbol terms with YOUR model
200
- Step 2: graphflow_preview_context({ query: "<Chinese>", englishQuery: "PoseDetectionPage avatarMode BattlePage shieldEffect", rootDir })
190
+ Step 2: graphflow_context({ query: "<Chinese>", englishQuery: "PoseDetectionPage avatarMode BattlePage shieldEffect", rootDir })
201
191
  Step 3: Use summary + anchors
202
192
  ```
203
193
 
204
194
  Use **exact file/class/component names** (PascalCase stems). Avoid generic words like `exercise` when the user means camera/pose UI — that word often hits data/types layers instead of pages.
205
195
 
196
+ For **module families** (Zustand store + `slices/`): put file stems in `englishQuery` (`useGameStore companionSlice dailySlice inventorySlice`), not bare domain words like `monster` (often ranks `data/monsters` over `monsterSlice`).
197
+
206
198
  **Fallback:** If `anchorCount < 3` and `agentWorkItems` includes `query-translate-en`, answer JSON prompt and retry with `englishQuery`.
207
199
 
208
200
  ---
@@ -212,7 +204,7 @@ Use **exact file/class/component names** (PascalCase stems). Avoid generic words
212
204
  **Use when:** Multi-step changes, refactors, features with unclear scope
213
205
 
214
206
  ```
215
- Step 1: graphflow_preview_context(query: "<task>")
207
+ Step 1: graphflow_context(query: "<task>")
216
208
  Step 2: graphflow_plan(task: "<task description>")
217
209
  Step 3: Review plan steps and dependencies
218
210
  Step 4: Execute step by step, using GraphFlow context for each step
@@ -223,6 +215,8 @@ Step 5: graphflow_index() after major changes
223
215
  ```typescript
224
216
  {
225
217
  task: string; // Required - task description to plan
218
+ mode?: "simple" | "insight"; // 'simple' (default) for quick planning, 'insight' for Six Hats + 5-Why
219
+ configPath?: string;
226
220
  }
227
221
  ```
228
222
 
@@ -250,8 +244,8 @@ Step 5: graphflow_index() after major changes
250
244
  **Use when:** High-stakes changes, root-cause analysis, ambiguous requirements
251
245
 
252
246
  ```
253
- Step 1: graphflow_preview_context(query: "<task>")
254
- Step 2: graphflow_plan_insight(task: "<task description>")
247
+ Step 1: graphflow_context(query: "<task>")
248
+ Step 2: graphflow_plan(task: "<task description>", mode: "insight")
255
249
  Step 3: Review Six Hats analysis and 5-Why chains
256
250
  Step 4: Use insights to inform implementation plan
257
251
  Step 5: Execute with regular context previews
@@ -304,7 +298,7 @@ graphflow_index(rootDir?: string, configPath?: string)
304
298
 
305
299
  #### Single File Index (fastest)
306
300
  ```
307
- graphflow_index_file(filePath: string, configPath?: string)
301
+ graphflow_index(filePath: string, configPath?: string)
308
302
  ```
309
303
  - Index just one file
310
304
  - Perfect for onSave hooks
@@ -312,7 +306,7 @@ graphflow_index_file(filePath: string, configPath?: string)
312
306
 
313
307
  #### Full Rebuild (slow but clean)
314
308
  ```
315
- graphflow_rebuild(rootDir?: string, configPath?: string)
309
+ graphflow_index(mode: "full", rootDir?: string, configPath?: string)
316
310
  ```
317
311
  - Clears ALL cached data
318
312
  - Full re-index from scratch
@@ -320,11 +314,12 @@ graphflow_rebuild(rootDir?: string, configPath?: string)
320
314
 
321
315
  #### Inspect Graph State
322
316
  ```
323
- graphflow_inspect_graph(nodeLimit?, edgeLimit?, rootDir?)
317
+ graphflow_diagnose(nodeLimit?, edgeLimit?, rootDir?)
324
318
  ```
325
319
  - Check graph size, file count, symbol count
326
320
  - Verify indexing worked correctly
327
321
  - Sample nodes to verify quality
322
+ - Also shows provider health and token savings
328
323
 
329
324
  ---
330
325
 
@@ -334,7 +329,7 @@ graphflow_inspect_graph(nodeLimit?, edgeLimit?, rootDir?)
334
329
 
335
330
  #### Export Artifact
336
331
  ```
337
- graphflow_export_artifact(outputPath?, compression?)
332
+ graphflow_artifact(mode: "export", outputPath?, compression?)
338
333
  ```
339
334
  - Export graph to portable gzip artifact
340
335
  - Share with team to skip full indexing
@@ -342,7 +337,7 @@ graphflow_export_artifact(outputPath?, compression?)
342
337
 
343
338
  #### Import Artifact
344
339
  ```
345
- graphflow_import_artifact(inputPath?)
340
+ graphflow_artifact(mode: "import", inputPath?)
346
341
  ```
347
342
  - Import teammate's graph artifact
348
343
  - Skip initial full workspace index
@@ -362,9 +357,9 @@ graphflow_skill_insights(limit?, rootDir?)
362
357
 
363
358
  #### Token Savings Stats
364
359
  ```
365
- graphflow_stats(configPath?, rootDir?)
360
+ graphflow_diagnose(configPath?, rootDir?)
366
361
  ```
367
- - Cumulative token savings across all runs
362
+ - Check the `stats` field for cumulative token savings across all runs
368
363
  - ROI tracking
369
364
  - See how much GraphFlow has saved
370
365
 
@@ -375,6 +370,7 @@ graphflow_diagnose(configPath?)
375
370
  - Check provider health
376
371
  - Verify model routing
377
372
  - Debug configuration issues
373
+ - Also returns graph stats and token savings
378
374
 
379
375
  ---
380
376
 
@@ -384,37 +380,37 @@ graphflow_diagnose(configPath?)
384
380
  Start
385
381
 
386
382
  ├─ Is this a codebase question/exploration?
387
- │ └─ YES → graphflow_preview_context ← START HERE
383
+ │ └─ YES → graphflow_context ← START HERE
388
384
  │ │
389
385
  │ └─ Need more detail on specific item?
390
- │ └─ YES → graphflow_expand_anchor
386
+ │ └─ YES → graphflow_context(anchorId)
391
387
 
392
388
  ├─ Is this a multi-step coding task?
393
- │ ├─ Simple (2-3 files) → preview_context + implement
394
- │ ├─ Complex → preview_context → graphflow_plan → implement
395
- │ └─ Ambiguous/high-stakes → preview_contextgraphflow_plan_insight → implement
389
+ │ ├─ Simple (2-3 files) → context + implement
390
+ │ ├─ Complex → context → graphflow_plan → implement
391
+ │ └─ Ambiguous/high-stakes → contextgraphflow_plan(mode="insight") → implement
396
392
 
397
393
  ├─ Do you need a complete packaged task?
398
394
  │ └─ YES → graphflow_run (bridge mode) → execute → report_outcome
399
395
 
400
396
  ├─ Did you just make file changes?
401
- │ ├─ Single file → graphflow_index_file
397
+ │ ├─ Single file → graphflow_index(filePath)
402
398
  │ └─ Multiple files → graphflow_index (incremental)
403
399
 
404
400
  ├─ Is the graph giving bad results?
405
- │ ├─ First → graphflow_inspect_graph (check state)
401
+ │ ├─ First → graphflow_diagnose (check state)
406
402
  │ ├─ Then → graphflow_index (try incremental)
407
- │ └─ Last resort → graphflow_rebuild (full rebuild)
403
+ │ └─ Last resort → graphflow_index(mode="full") (full rebuild)
408
404
 
409
405
  ├─ Sharing with teammates?
410
- │ ├─ Export → graphflow_export_artifact
411
- │ └─ Import → graphflow_import_artifact
406
+ │ ├─ Export → graphflow_artifact(mode="export")
407
+ │ └─ Import → graphflow_artifact(mode="import")
412
408
 
413
409
  ├─ Do you want to leverage prior learning?
414
410
  │ └─ YES → graphflow_skill_insights
415
411
 
416
412
  ├─ Tracking ROI?
417
- │ └─ graphflow_stats
413
+ │ └─ graphflow_diagnose (check stats field)
418
414
 
419
415
  └─ Is routing/models misbehaving?
420
416
  └─ YES → graphflow_diagnose
@@ -455,21 +451,21 @@ Always pay attention to `tokenBudget`:
455
451
  ## Best Practices
456
452
 
457
453
  ### 1. Context First, Always
458
- - Start EVERY coding task with `graphflow_preview_context`
454
+ - Start EVERY coding task with `graphflow_context`
459
455
  - Only read full files when compressed context is insufficient
460
456
  - Never grep the whole repo before trying GraphFlow
461
457
 
462
458
  ### 2. Plan Before Complex Work
463
459
  - Use `graphflow_plan` for anything beyond 2-3 files
464
- - Use `graphflow_plan_insight` for ambiguous tasks
460
+ - Use `graphflow_plan(mode="insight")` for ambiguous tasks
465
461
  - Follow the DAG order (respect dependencies)
466
462
  - Use context from GraphFlow at each step
467
463
 
468
464
  ### 3. Keep Graph Fresh
469
- - Call `graphflow_index_file` after saving individual files
465
+ - Call `graphflow_index(filePath)` after saving individual files
470
466
  - Call `graphflow_index` after significant changes
471
467
  - Prefer incremental index over full rebuild
472
- - Check `graphflow_inspect_graph` if results seem off
468
+ - Check `graphflow_diagnose` if results seem off
473
469
 
474
470
  ### 4. Close the Learning Loop
475
471
  - After bridge-mode runs, call `graphflow_report_outcome`
@@ -492,18 +488,18 @@ Always pay attention to `tokenBudget`:
492
488
 
493
489
  ### "0 anchors found" or empty results
494
490
  1. **Chinese/CJK:** translate to English keywords; pass `englishQuery` or answer `agentWorkItems` id `query-translate-en`
495
- 2. Check if graph exists: `graphflow_inspect_graph`
491
+ 2. Check if graph exists: `graphflow_diagnose`
496
492
  3. If empty: run `graphflow_index`
497
493
  4. If still empty: verify `rootDir` points to correct project
498
494
 
499
495
  ### Results seem stale
500
496
  1. Run `graphflow_index` (incremental, fast)
501
- 2. If still stale: `graphflow_rebuild` (full, slow)
497
+ 2. If still stale: `graphflow_index(mode="full")` (full, slow)
502
498
 
503
499
  ### Context quality is poor
504
500
  1. Try more specific query terms
505
- 2. Check if symbols are indexed (inspect graph)
506
- 3. Run `graphflow_rebuild` if the graph may be stale
501
+ 2. Check if symbols are indexed (diagnose)
502
+ 3. Run `graphflow_index(mode="full")` if the graph may be stale
507
503
 
508
504
  ### Tool errors / configuration issues
509
505
  1. Run `graphflow_diagnose` to check provider health
@@ -511,9 +507,9 @@ Always pay attention to `tokenBudget`:
511
507
  3. Check workspace root is correct
512
508
 
513
509
  ### Want to share graph with teammates
514
- 1. Export: `graphflow_export_artifact`
510
+ 1. Export: `graphflow_artifact(mode="export")`
515
511
  2. Send the artifact file
516
- 3. Teammate imports: `graphflow_import_artifact`
512
+ 3. Teammate imports: `graphflow_artifact(mode="import")`
517
513
 
518
514
  ---
519
515
 
@@ -521,16 +517,16 @@ Always pay attention to `tokenBudget`:
521
517
 
522
518
  ```typescript
523
519
  // 90% of the time - start here
524
- await graphflow_preview_context({ query: "what you're looking for" });
520
+ await graphflow_context({ query: "what you're looking for" });
525
521
 
526
522
  // Need more detail on a specific anchor?
527
- await graphflow_expand_anchor({ anchorId: "symbol:src/foo.ts:abc123" });
523
+ await graphflow_context({ anchorId: "symbol:src/foo.ts:abc123" });
528
524
 
529
525
  // Before complex tasks
530
526
  await graphflow_plan({ task: "describe the task" });
531
527
 
532
528
  // Deep analysis with Six Thinking Hats + 5-Why
533
- await graphflow_plan_insight({ task: "complex ambiguous task" });
529
+ await graphflow_plan({ task: "complex ambiguous task", mode: "insight" });
534
530
 
535
531
  // Full packaged task (bridge mode)
536
532
  const result = await graphflow_run({ task: "full task description" });
@@ -542,27 +538,24 @@ await graphflow_report_outcome({
542
538
  });
543
539
 
544
540
  // After making changes - single file
545
- await graphflow_index_file({ filePath: "src/foo.ts" });
541
+ await graphflow_index({ filePath: "src/foo.ts" });
546
542
 
547
543
  // After making changes - workspace
548
544
  await graphflow_index({ rootDir: "/path/to/project" });
549
545
 
550
- // Check graph health
551
- await graphflow_inspect_graph({ nodeLimit: 20 });
546
+ // Check graph health + stats + savings
547
+ await graphflow_diagnose({ nodeLimit: 20 });
552
548
 
553
549
  // When graph is broken
554
- await graphflow_rebuild({ rootDir: "/path/to/project" });
550
+ await graphflow_index({ mode: "full", rootDir: "/path/to/project" });
555
551
 
556
552
  // Team collaboration
557
- await graphflow_export_artifact({ outputPath: "graph-artifact.gz" });
558
- await graphflow_import_artifact({ inputPath: "graph-artifact.gz" });
553
+ await graphflow_artifact({ mode: "export", outputPath: "graph-artifact.gz" });
554
+ await graphflow_artifact({ mode: "import", inputPath: "graph-artifact.gz" });
559
555
 
560
556
  // Leverage prior learning
561
557
  await graphflow_skill_insights({ limit: 5 });
562
558
 
563
- // Token savings stats
564
- await graphflow_stats();
565
-
566
559
  // Diagnose issues
567
560
  await graphflow_diagnose();
568
561
  ```