@roarpeng/graphflow 1.4.3 → 1.7.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/AGENTS.md +11 -37
- package/CHANGELOG.md +40 -0
- package/CLAUDE.md +1 -1
- package/README.md +116 -44
- package/dist/agents/atp-schema.d.ts +59 -0
- package/dist/agents/atp-schema.d.ts.map +1 -0
- package/dist/agents/atp-schema.js +3 -0
- package/dist/agents/atp-schema.js.map +1 -0
- package/dist/agents/decision-engine.d.ts +55 -0
- package/dist/agents/decision-engine.d.ts.map +1 -0
- package/dist/agents/decision-engine.js +338 -0
- package/dist/agents/decision-engine.js.map +1 -0
- package/dist/agents/insight.d.ts +57 -1
- package/dist/agents/insight.d.ts.map +1 -1
- package/dist/agents/insight.js +365 -2
- package/dist/agents/insight.js.map +1 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +1 -2
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/discover-workspace.d.ts.map +1 -1
- package/dist/config/discover-workspace.js +4 -0
- package/dist/config/discover-workspace.js.map +1 -1
- package/dist/config/embedding-factory.js +6 -6
- package/dist/config/embedding-factory.js.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +1 -2
- package/dist/config/loader.js.map +1 -1
- package/dist/config/schema.d.ts +1 -2
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/core/agent-delegation.d.ts +3 -1
- package/dist/core/agent-delegation.d.ts.map +1 -1
- package/dist/core/agent-delegation.js +121 -0
- package/dist/core/agent-delegation.js.map +1 -1
- package/dist/core/orchestrator-context.d.ts.map +1 -1
- package/dist/core/orchestrator-context.js +25 -3
- package/dist/core/orchestrator-context.js.map +1 -1
- package/dist/core/types.d.ts +12 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/graph/context-slicer-types.d.ts +0 -4
- 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 +5 -15
- package/dist/graph/context-slicer.js.map +1 -1
- package/dist/graph/file-indexer-walker.d.ts +3 -0
- package/dist/graph/file-indexer-walker.d.ts.map +1 -1
- package/dist/graph/file-indexer-walker.js.map +1 -1
- package/dist/graph/file-indexer.d.ts +1 -0
- package/dist/graph/file-indexer.d.ts.map +1 -1
- package/dist/graph/file-indexer.js +14 -18
- package/dist/graph/file-indexer.js.map +1 -1
- package/dist/integrations/agent-mcp-installer.d.ts.map +1 -1
- package/dist/integrations/agent-mcp-installer.js +26 -10
- package/dist/integrations/agent-mcp-installer.js.map +1 -1
- package/dist/integrations/skill-installer.d.ts +24 -2
- package/dist/integrations/skill-installer.d.ts.map +1 -1
- package/dist/integrations/skill-installer.js +262 -18
- package/dist/integrations/skill-installer.js.map +1 -1
- package/dist/learning/embeddings.d.ts +2 -3
- package/dist/learning/embeddings.d.ts.map +1 -1
- package/dist/learning/embeddings.js +18 -33
- package/dist/learning/embeddings.js.map +1 -1
- package/dist/learning/hnsw-index.d.ts +9 -35
- package/dist/learning/hnsw-index.d.ts.map +1 -1
- package/dist/learning/hnsw-index.js +8 -154
- package/dist/learning/hnsw-index.js.map +1 -1
- package/dist/surfaces/antigravity-rules/graphflow.md +45 -0
- package/dist/surfaces/cli/init.d.ts.map +1 -1
- package/dist/surfaces/cli/init.js +24 -1
- package/dist/surfaces/cli/init.js.map +1 -1
- package/dist/surfaces/cli/runtime/graph.d.ts.map +1 -1
- package/dist/surfaces/cli/runtime/graph.js +0 -1
- package/dist/surfaces/cli/runtime/graph.js.map +1 -1
- package/dist/surfaces/cli/runtime/settings.d.ts.map +1 -1
- package/dist/surfaces/cli/runtime/settings.js +0 -5
- package/dist/surfaces/cli/runtime/settings.js.map +1 -1
- package/dist/surfaces/cli/runtime/types.d.ts +0 -8
- package/dist/surfaces/cli/runtime/types.d.ts.map +1 -1
- package/dist/surfaces/copilot-instructions/graphflow.md +74 -0
- package/dist/surfaces/cursor-rules/graphflow.mdc +17 -25
- package/dist/surfaces/mcp/tool-definitions.d.ts.map +1 -1
- package/dist/surfaces/mcp/tool-definitions.js +31 -124
- 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 +78 -42
- package/dist/surfaces/mcp/tool-handlers.js.map +1 -1
- package/dist/surfaces/trae-rules/graphflow.md +52 -0
- package/dist/surfaces/trae-skill/graphflow/SKILL.md +104 -73
- package/package.json +5 -2
- package/src/surfaces/antigravity-rules/graphflow.md +45 -0
- package/src/surfaces/copilot-instructions/graphflow.md +74 -0
- package/src/surfaces/cursor-rules/graphflow.mdc +17 -25
- package/src/surfaces/trae-rules/graphflow.md +52 -0
- package/src/surfaces/trae-skill/graphflow/SKILL.md +104 -73
|
@@ -11,7 +11,7 @@ GraphFlow is a graph-based context and planning service backed by a persistent M
|
|
|
11
11
|
|
|
12
12
|
Before broad code exploration, implementation, debugging, review, planning, or architecture questions:
|
|
13
13
|
|
|
14
|
-
1. Call `
|
|
14
|
+
1. Call `graphflow_context` with the user's task/query.
|
|
15
15
|
2. Use the returned `summary`, `anchors`, `refillPreview`, and `tokenBudget` as the first context source.
|
|
16
16
|
3. Read full files only when:
|
|
17
17
|
- GraphFlow anchors point to that file/symbol,
|
|
@@ -31,57 +31,49 @@ Do not scan the whole repository, recursively inspect many files, or read large
|
|
|
31
31
|
|
|
32
32
|
Code symbols are mostly English. For Chinese user questions:
|
|
33
33
|
|
|
34
|
-
1. **Proactive:** Before or with `
|
|
34
|
+
1. **Proactive:** Before or with `graphflow_context`, translate intent to English **file/class/component names** (e.g. `PoseDetectionPage`, `BattlePage`, `shieldEffect`) and pass `englishQuery`. Avoid generic terms like `exercise` when the user means UI/camera — they often match data/types layers.
|
|
35
35
|
2. **Reactive:** If preview returns `agentWorkItems` with `query-translate-en` (low `anchorCount`), answer the JSON prompt with your model, then retry preview with `englishQuery`.
|
|
36
36
|
3. Keep `query` as the original Chinese text; use `englishQuery` for search terms only.
|
|
37
37
|
|
|
38
38
|
```typescript
|
|
39
|
-
|
|
39
|
+
graphflow_context({
|
|
40
40
|
query: "游戏战斗系统怎么实现的",
|
|
41
41
|
englishQuery: "battle combat fight damage scene system",
|
|
42
42
|
rootDir: "/absolute/path/to/project"
|
|
43
43
|
})
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
## Tool Inventory (
|
|
46
|
+
## Tool Inventory (10 MCP Tools)
|
|
47
47
|
|
|
48
48
|
### Core Context Tools (Highest Frequency)
|
|
49
49
|
|
|
50
50
|
| Tool | Purpose | Call Frequency |
|
|
51
51
|
|------|---------|---------------|
|
|
52
|
-
| `
|
|
53
|
-
| `graphflow_expand_anchor` | Expand a single anchor to full content | **High** - dive deeper into specific items |
|
|
52
|
+
| `graphflow_context` | Preview compressed context (query) or expand anchor (anchorId) | **Highest** - default first step |
|
|
54
53
|
|
|
55
54
|
### Planning Tools (High Frequency)
|
|
56
55
|
|
|
57
56
|
| Tool | Purpose | Call Frequency |
|
|
58
57
|
|------|---------|---------------|
|
|
59
|
-
| `graphflow_plan` | Multi-step task decomposition & DAG | High - before complex work |
|
|
60
|
-
| `graphflow_plan_insight` | Six Thinking Hats + 5-Why deep analysis | Medium - ambiguous/high-stakes tasks |
|
|
58
|
+
| `graphflow_plan` | Multi-step task decomposition & DAG (mode='simple' or 'insight') | High - before complex work |
|
|
61
59
|
| `graphflow_run` | Plan + context package (bridge mode) | Medium - full task packaging |
|
|
62
60
|
| `graphflow_report_outcome` | Report bridge-mode execution outcome back | Medium - close the learning loop |
|
|
63
|
-
| `
|
|
64
|
-
| `graphflow_merge_insight` | Merge submitted insights into unified plan | Medium - after submit_insight |
|
|
61
|
+
| `graphflow_insight` | Submit or merge agent insights | Medium - no external LLM API |
|
|
65
62
|
|
|
66
63
|
### Graph Management Tools (Medium Frequency)
|
|
67
64
|
|
|
68
65
|
| Tool | Purpose | Call Frequency |
|
|
69
66
|
|------|---------|---------------|
|
|
70
|
-
| `graphflow_index` | Incremental workspace re-index | Medium - after file changes |
|
|
71
|
-
| `graphflow_index_file` | Single file incremental index | Medium-High - after saving a file |
|
|
72
|
-
| `graphflow_rebuild` | Clear cache + full re-index | Low - when graph is stale/corrupted |
|
|
73
|
-
| `graphflow_inspect_graph` | Graph stats & sample nodes/edges | Low - check graph health |
|
|
67
|
+
| `graphflow_index` | Incremental workspace re-index, single-file, or full rebuild | Medium - after file changes |
|
|
74
68
|
|
|
75
69
|
### Collaboration & Insights Tools (Low Frequency)
|
|
76
70
|
|
|
77
71
|
| Tool | Purpose | Call Frequency |
|
|
78
72
|
|------|---------|---------------|
|
|
79
|
-
| `
|
|
80
|
-
| `graphflow_import_artifact` | Import graph artifact | Low - skip full index on new machine |
|
|
73
|
+
| `graphflow_artifact` | Export or import graph artifact | Low - team sharing |
|
|
81
74
|
| `graphflow_skill_insights` | Learned skill patterns | Low - leverage prior learning |
|
|
82
75
|
| `graphflow_skill_guide` | Skill usage guide for connected agents | Low - onboarding |
|
|
83
|
-
| `
|
|
84
|
-
| `graphflow_diagnose` | Provider health & model routing | Rare - config issues |
|
|
76
|
+
| `graphflow_diagnose` | Provider health, graph stats, and token savings | Rare - config issues |
|
|
85
77
|
|
|
86
78
|
## Standard Workflows
|
|
87
79
|
|
|
@@ -90,9 +82,9 @@ graphflow_preview_context({
|
|
|
90
82
|
**Use when:** Answering code questions, exploring codebase, understanding modules
|
|
91
83
|
|
|
92
84
|
```
|
|
93
|
-
Step 1:
|
|
85
|
+
Step 1: graphflow_context(query: "<your question>")
|
|
94
86
|
Step 2: Read summary + anchors as primary context
|
|
95
|
-
Step 3: Expand specific anchors with
|
|
87
|
+
Step 3: Expand specific anchors with graphflow_context(anchorId: "...") when needed
|
|
96
88
|
Step 4: Read full files only when exact edits required
|
|
97
89
|
```
|
|
98
90
|
|
|
@@ -101,7 +93,7 @@ Step 4: Read full files only when exact edits required
|
|
|
101
93
|
**Use when:** Multi-step changes, refactors, features with unclear scope
|
|
102
94
|
|
|
103
95
|
```
|
|
104
|
-
Step 1:
|
|
96
|
+
Step 1: graphflow_context(query: "<task>")
|
|
105
97
|
Step 2: graphflow_plan(task: "<task description>")
|
|
106
98
|
Step 3: Review plan steps and dependencies
|
|
107
99
|
Step 4: Execute step by step, using GraphFlow context for each step
|
|
@@ -113,8 +105,8 @@ Step 5: graphflow_index() after major changes
|
|
|
113
105
|
**Use when:** High-stakes changes, root-cause analysis, ambiguous requirements
|
|
114
106
|
|
|
115
107
|
```
|
|
116
|
-
Step 1:
|
|
117
|
-
Step 2:
|
|
108
|
+
Step 1: graphflow_context(query: "<task>")
|
|
109
|
+
Step 2: graphflow_plan(task: "<task>", mode: "insight")
|
|
118
110
|
Step 3: Review analysis and apply findings
|
|
119
111
|
```
|
|
120
112
|
|
|
@@ -124,7 +116,7 @@ After `graphflow_run`, the external agent **must** call `graphflow_report_outcom
|
|
|
124
116
|
|
|
125
117
|
- Pass `episodeId` from the run result, a `success` boolean, and optional `lessons`.
|
|
126
118
|
- Do this after executing the work described in the returned `executionDescriptor`, whether the task succeeded or failed.
|
|
127
|
-
- When the run returns `agentWorkItems`, answer each prompt with your model and call `
|
|
119
|
+
- When the run returns `agentWorkItems`, answer each prompt with your model and call `graphflow_insight(mode: "submit")` once per item (before or with `graphflow_report_outcome`).
|
|
128
120
|
|
|
129
121
|
CLI fallback:
|
|
130
122
|
|
|
@@ -144,4 +136,4 @@ graphflow --json route diagnose
|
|
|
144
136
|
|
|
145
137
|
Treat GraphFlow outputs as structured machine-readable data, not prose.
|
|
146
138
|
|
|
147
|
-
When the user asks about saving token usage, optimizing context, repo understanding, or learning from Graphify, prioritize GraphFlow context compression over ordinary file search.
|
|
139
|
+
When the user asks about saving token usage, optimizing context, repo understanding, or learning from Graphify, prioritize GraphFlow context compression over ordinary file search.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: GraphFlow token-first — always call graphflow_context before code exploration, debugging, or edits.
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
globs:
|
|
5
|
+
- "**/*"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# GraphFlow Token-First Rule (Trae)
|
|
9
|
+
|
|
10
|
+
GraphFlow is a graph-based context and planning MCP service. **You MUST use it before broad file search or reading many files.**
|
|
11
|
+
|
|
12
|
+
## Mandatory workflow
|
|
13
|
+
|
|
14
|
+
Before code exploration, implementation, debugging, review, planning, or architecture questions:
|
|
15
|
+
|
|
16
|
+
1. Call MCP tool **`graphflow_context`** with the user's task/query and **`rootDir`** set to the current project absolute path.
|
|
17
|
+
2. Use returned `summary`, `anchors`, `refillPreview`, and `tokenBudget` as the primary context.
|
|
18
|
+
3. Read full files only when anchors point there, compressed context is insufficient, or exact edits require the file body.
|
|
19
|
+
4. For multi-step or ambiguous work, call **`graphflow_plan`** before implementation.
|
|
20
|
+
5. After major file changes, call **`graphflow_index`** (or pass `filePath` for single-file index).
|
|
21
|
+
|
|
22
|
+
**Do NOT** recursively grep the whole repository or read large files before GraphFlow preview.
|
|
23
|
+
|
|
24
|
+
## Chinese / CJK queries
|
|
25
|
+
|
|
26
|
+
Code symbols are mostly English. For Chinese user questions:
|
|
27
|
+
|
|
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.
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
graphflow_context({
|
|
34
|
+
query: "摄像头锻炼人物角色选择",
|
|
35
|
+
englishQuery: "PoseDetectionPage avatarMode poseService",
|
|
36
|
+
rootDir: "/absolute/path/to/project"
|
|
37
|
+
})
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## High-frequency MCP tools
|
|
41
|
+
|
|
42
|
+
| Tool | When |
|
|
43
|
+
|------|------|
|
|
44
|
+
| `graphflow_context` | **Always first** for code questions (use `query`); need full content of one anchor (use `anchorId`) |
|
|
45
|
+
| `graphflow_plan` | Multi-step tasks |
|
|
46
|
+
| `graphflow_index` | After significant edits |
|
|
47
|
+
|
|
48
|
+
For the full 10-tool reference and workflows, use Skill **`#graphflow`** or `@skills/graphflow/SKILL.md`.
|
|
49
|
+
|
|
50
|
+
## Bridge mode
|
|
51
|
+
|
|
52
|
+
After `graphflow_run`, **must** call `graphflow_report_outcome` with `episodeId`, `success`, and optional `lessons`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "graphflow"
|
|
3
|
-
description: "Graph-based code context compression, task planning, and knowledge graph orchestration
|
|
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
|
-
│
|
|
24
|
-
│
|
|
25
|
-
│
|
|
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,49 +49,81 @@ 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 `
|
|
52
|
+
- Use grep for codebase exploration before `graphflow_context`
|
|
53
|
+
|
|
54
|
+
### Trae / Trae CN setup (Rules + Skill + MCP)
|
|
55
|
+
|
|
56
|
+
Trae loads **Rules every turn** and **Skills on demand**. GraphFlow `install` writes:
|
|
57
|
+
|
|
58
|
+
| Path | Role |
|
|
59
|
+
|------|------|
|
|
60
|
+
| `.trae/rules/graphflow.md` | `alwaysApply: true` — **must** call `graphflow_context` first |
|
|
61
|
+
| `.trae/skills/graphflow/SKILL.md` | Full workflows; trigger with `#graphflow` |
|
|
62
|
+
| `User/mcp.json` | GraphFlow MCP server |
|
|
63
|
+
|
|
64
|
+
If Rules are missing, type `#graphflow` at the start of a chat. Pass `rootDir` = current project absolute path on every context call.
|
|
65
|
+
|
|
66
|
+
### Antigravity IDE setup (Rules + Skill + MCP)
|
|
67
|
+
|
|
68
|
+
| Path | Role |
|
|
69
|
+
|------|------|
|
|
70
|
+
| `~/.gemini/antigravity/mcp_config.json` | Global MCP (`mcpServers.graphflow`) |
|
|
71
|
+
| `~/.gemini/antigravity/skills/graphflow/SKILL.md` | Global Skill |
|
|
72
|
+
| `.agent/rules/graphflow.md` | Project rules (always loaded in workspace) |
|
|
73
|
+
| `.agent/skills/graphflow/SKILL.md` | Project Skill |
|
|
74
|
+
| `GEMINI.md` (project root) | Managed token-first block |
|
|
75
|
+
|
|
76
|
+
Run `npx @roarpeng/graphflow install` from the project root. Do **not** hardcode `GRAPHFLOW_WORKSPACE_ROOT` in MCP env.
|
|
77
|
+
|
|
78
|
+
### Gemini CLI setup
|
|
79
|
+
|
|
80
|
+
| Path | Role |
|
|
81
|
+
|------|------|
|
|
82
|
+
| `~/.gemini/settings.json` | MCP (`mcpServers.graphflow`) |
|
|
83
|
+
| `~/.gemini/GEMINI.md` | Global managed instruction block |
|
|
84
|
+
| `GEMINI.md` (project root) | Project managed block (with `install --scope all`) |
|
|
85
|
+
|
|
86
|
+
### GitHub Copilot (VS Code) setup
|
|
87
|
+
|
|
88
|
+
| Path | Role |
|
|
89
|
+
|------|------|
|
|
90
|
+
| `~/.config/Code/User/mcp.json` | User MCP (`servers.graphflow`) |
|
|
91
|
+
| `.vscode/mcp.json` | Project MCP (optional, team-shared) |
|
|
92
|
+
| `.github/copilot-instructions.md` | Repo-level Copilot instructions |
|
|
55
93
|
|
|
56
94
|
---
|
|
57
95
|
|
|
58
|
-
## Tool Inventory (
|
|
96
|
+
## Tool Inventory (10 MCP Tools)
|
|
59
97
|
|
|
60
98
|
### Core Context Tools (Highest Frequency)
|
|
61
99
|
|
|
62
100
|
| Tool | Purpose | Call Frequency |
|
|
63
101
|
|------|---------|---------------|
|
|
64
|
-
| `
|
|
65
|
-
| `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 |
|
|
66
103
|
|
|
67
104
|
### Planning Tools (High Frequency)
|
|
68
105
|
|
|
69
106
|
| Tool | Purpose | Call Frequency |
|
|
70
107
|
|------|---------|---------------|
|
|
71
|
-
| `graphflow_plan` | Multi-step task decomposition & DAG | High - before complex work |
|
|
72
|
-
| `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 |
|
|
73
109
|
| `graphflow_run` | Plan + context package (bridge mode) | Medium - full task packaging |
|
|
74
110
|
| `graphflow_report_outcome` | Report bridge-mode execution outcome back | Medium - close the learning loop |
|
|
75
|
-
| `
|
|
76
|
-
| `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 |
|
|
77
112
|
|
|
78
113
|
### Graph Management Tools (Medium Frequency)
|
|
79
114
|
|
|
80
115
|
| Tool | Purpose | Call Frequency |
|
|
81
116
|
|------|---------|---------------|
|
|
82
|
-
| `graphflow_index` | Incremental workspace re-index | Medium - after file changes |
|
|
83
|
-
| `graphflow_index_file` | Single file incremental index | Medium-High - after saving a file |
|
|
84
|
-
| `graphflow_rebuild` | Clear cache + full re-index | Low - when graph is stale/corrupted |
|
|
85
|
-
| `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 |
|
|
86
118
|
|
|
87
119
|
### Collaboration & Insights Tools (Low Frequency)
|
|
88
120
|
|
|
89
121
|
| Tool | Purpose | Call Frequency |
|
|
90
122
|
|------|---------|---------------|
|
|
91
|
-
| `
|
|
92
|
-
| `graphflow_import_artifact` | Import graph artifact | Low - skip full index on new machine |
|
|
123
|
+
| `graphflow_artifact` | Export or import graph artifact | Low - team sharing |
|
|
93
124
|
| `graphflow_skill_insights` | Learned skill patterns | Low - leverage prior learning |
|
|
94
125
|
| `graphflow_skill_guide` | Skill usage guide for connected agents | Low - onboarding |
|
|
95
|
-
| `
|
|
96
|
-
| `graphflow_diagnose` | Provider health & model routing | Rare - config issues |
|
|
126
|
+
| `graphflow_diagnose` | Provider health, graph stats, and token savings | Low - ROI tracking / config issues |
|
|
97
127
|
|
|
98
128
|
---
|
|
99
129
|
|
|
@@ -104,32 +134,32 @@ GraphFlow is a graph-based context and planning service backed by a persistent M
|
|
|
104
134
|
**Use when:** Answering code questions, exploring codebase, understanding modules
|
|
105
135
|
|
|
106
136
|
```
|
|
107
|
-
Step 1:
|
|
137
|
+
Step 1: graphflow_context(query: "<your question>")
|
|
108
138
|
Step 2: Read summary + anchors as primary context
|
|
109
|
-
Step 3: Expand specific anchors with
|
|
139
|
+
Step 3: Expand specific anchors with graphflow_context(anchorId: "...") when needed
|
|
110
140
|
Step 4: Read full files only when exact edits required
|
|
111
141
|
```
|
|
112
142
|
|
|
113
|
-
**Input -
|
|
143
|
+
**Input - context (preview):**
|
|
114
144
|
```typescript
|
|
115
145
|
{
|
|
116
|
-
query: string; // Required - user question (Chinese OK)
|
|
146
|
+
query: string; // Required for preview - user question (Chinese OK)
|
|
117
147
|
englishQuery?: string; // Agent-translated English code search terms (recommended for CJK)
|
|
118
148
|
configPath?: string;
|
|
119
149
|
rootDir?: string;
|
|
120
150
|
}
|
|
121
151
|
```
|
|
122
152
|
|
|
123
|
-
**Input -
|
|
153
|
+
**Input - context (expand):**
|
|
124
154
|
```typescript
|
|
125
155
|
{
|
|
126
|
-
anchorId: string; // Required - anchor id from
|
|
156
|
+
anchorId: string; // Required for expand - anchor id from preview
|
|
127
157
|
configPath?: string;
|
|
128
158
|
rootDir?: string;
|
|
129
159
|
}
|
|
130
160
|
```
|
|
131
161
|
|
|
132
|
-
**Output structure (
|
|
162
|
+
**Output structure (preview):**
|
|
133
163
|
```typescript
|
|
134
164
|
{
|
|
135
165
|
summary: string[];
|
|
@@ -157,7 +187,7 @@ GraphFlow tokenizes CJK and expands workspace path hints. When that is not enoug
|
|
|
157
187
|
**Preferred (proactive):**
|
|
158
188
|
```
|
|
159
189
|
Step 1: Translate user intent to English file/symbol terms with YOUR model
|
|
160
|
-
Step 2:
|
|
190
|
+
Step 2: graphflow_context({ query: "<Chinese>", englishQuery: "PoseDetectionPage avatarMode BattlePage shieldEffect", rootDir })
|
|
161
191
|
Step 3: Use summary + anchors
|
|
162
192
|
```
|
|
163
193
|
|
|
@@ -172,7 +202,7 @@ Use **exact file/class/component names** (PascalCase stems). Avoid generic words
|
|
|
172
202
|
**Use when:** Multi-step changes, refactors, features with unclear scope
|
|
173
203
|
|
|
174
204
|
```
|
|
175
|
-
Step 1:
|
|
205
|
+
Step 1: graphflow_context(query: "<task>")
|
|
176
206
|
Step 2: graphflow_plan(task: "<task description>")
|
|
177
207
|
Step 3: Review plan steps and dependencies
|
|
178
208
|
Step 4: Execute step by step, using GraphFlow context for each step
|
|
@@ -183,6 +213,8 @@ Step 5: graphflow_index() after major changes
|
|
|
183
213
|
```typescript
|
|
184
214
|
{
|
|
185
215
|
task: string; // Required - task description to plan
|
|
216
|
+
mode?: "simple" | "insight"; // 'simple' (default) for quick planning, 'insight' for Six Hats + 5-Why
|
|
217
|
+
configPath?: string;
|
|
186
218
|
}
|
|
187
219
|
```
|
|
188
220
|
|
|
@@ -210,8 +242,8 @@ Step 5: graphflow_index() after major changes
|
|
|
210
242
|
**Use when:** High-stakes changes, root-cause analysis, ambiguous requirements
|
|
211
243
|
|
|
212
244
|
```
|
|
213
|
-
Step 1:
|
|
214
|
-
Step 2:
|
|
245
|
+
Step 1: graphflow_context(query: "<task>")
|
|
246
|
+
Step 2: graphflow_plan(task: "<task description>", mode: "insight")
|
|
215
247
|
Step 3: Review Six Hats analysis and 5-Why chains
|
|
216
248
|
Step 4: Use insights to inform implementation plan
|
|
217
249
|
Step 5: Execute with regular context previews
|
|
@@ -264,7 +296,7 @@ graphflow_index(rootDir?: string, configPath?: string)
|
|
|
264
296
|
|
|
265
297
|
#### Single File Index (fastest)
|
|
266
298
|
```
|
|
267
|
-
|
|
299
|
+
graphflow_index(filePath: string, configPath?: string)
|
|
268
300
|
```
|
|
269
301
|
- Index just one file
|
|
270
302
|
- Perfect for onSave hooks
|
|
@@ -272,7 +304,7 @@ graphflow_index_file(filePath: string, configPath?: string)
|
|
|
272
304
|
|
|
273
305
|
#### Full Rebuild (slow but clean)
|
|
274
306
|
```
|
|
275
|
-
|
|
307
|
+
graphflow_index(mode: "full", rootDir?: string, configPath?: string)
|
|
276
308
|
```
|
|
277
309
|
- Clears ALL cached data
|
|
278
310
|
- Full re-index from scratch
|
|
@@ -280,11 +312,12 @@ graphflow_rebuild(rootDir?: string, configPath?: string)
|
|
|
280
312
|
|
|
281
313
|
#### Inspect Graph State
|
|
282
314
|
```
|
|
283
|
-
|
|
315
|
+
graphflow_diagnose(nodeLimit?, edgeLimit?, rootDir?)
|
|
284
316
|
```
|
|
285
317
|
- Check graph size, file count, symbol count
|
|
286
318
|
- Verify indexing worked correctly
|
|
287
319
|
- Sample nodes to verify quality
|
|
320
|
+
- Also shows provider health and token savings
|
|
288
321
|
|
|
289
322
|
---
|
|
290
323
|
|
|
@@ -294,7 +327,7 @@ graphflow_inspect_graph(nodeLimit?, edgeLimit?, rootDir?)
|
|
|
294
327
|
|
|
295
328
|
#### Export Artifact
|
|
296
329
|
```
|
|
297
|
-
|
|
330
|
+
graphflow_artifact(mode: "export", outputPath?, compression?)
|
|
298
331
|
```
|
|
299
332
|
- Export graph to portable gzip artifact
|
|
300
333
|
- Share with team to skip full indexing
|
|
@@ -302,7 +335,7 @@ graphflow_export_artifact(outputPath?, compression?)
|
|
|
302
335
|
|
|
303
336
|
#### Import Artifact
|
|
304
337
|
```
|
|
305
|
-
|
|
338
|
+
graphflow_artifact(mode: "import", inputPath?)
|
|
306
339
|
```
|
|
307
340
|
- Import teammate's graph artifact
|
|
308
341
|
- Skip initial full workspace index
|
|
@@ -322,9 +355,9 @@ graphflow_skill_insights(limit?, rootDir?)
|
|
|
322
355
|
|
|
323
356
|
#### Token Savings Stats
|
|
324
357
|
```
|
|
325
|
-
|
|
358
|
+
graphflow_diagnose(configPath?, rootDir?)
|
|
326
359
|
```
|
|
327
|
-
-
|
|
360
|
+
- Check the `stats` field for cumulative token savings across all runs
|
|
328
361
|
- ROI tracking
|
|
329
362
|
- See how much GraphFlow has saved
|
|
330
363
|
|
|
@@ -335,6 +368,7 @@ graphflow_diagnose(configPath?)
|
|
|
335
368
|
- Check provider health
|
|
336
369
|
- Verify model routing
|
|
337
370
|
- Debug configuration issues
|
|
371
|
+
- Also returns graph stats and token savings
|
|
338
372
|
|
|
339
373
|
---
|
|
340
374
|
|
|
@@ -344,37 +378,37 @@ graphflow_diagnose(configPath?)
|
|
|
344
378
|
Start
|
|
345
379
|
│
|
|
346
380
|
├─ Is this a codebase question/exploration?
|
|
347
|
-
│ └─ YES →
|
|
381
|
+
│ └─ YES → graphflow_context ← START HERE
|
|
348
382
|
│ │
|
|
349
383
|
│ └─ Need more detail on specific item?
|
|
350
|
-
│ └─ YES →
|
|
384
|
+
│ └─ YES → graphflow_context(anchorId)
|
|
351
385
|
│
|
|
352
386
|
├─ Is this a multi-step coding task?
|
|
353
|
-
│ ├─ Simple (2-3 files) →
|
|
354
|
-
│ ├─ Complex →
|
|
355
|
-
│ └─ Ambiguous/high-stakes →
|
|
387
|
+
│ ├─ Simple (2-3 files) → context + implement
|
|
388
|
+
│ ├─ Complex → context → graphflow_plan → implement
|
|
389
|
+
│ └─ Ambiguous/high-stakes → context → graphflow_plan(mode="insight") → implement
|
|
356
390
|
│
|
|
357
391
|
├─ Do you need a complete packaged task?
|
|
358
392
|
│ └─ YES → graphflow_run (bridge mode) → execute → report_outcome
|
|
359
393
|
│
|
|
360
394
|
├─ Did you just make file changes?
|
|
361
|
-
│ ├─ Single file →
|
|
395
|
+
│ ├─ Single file → graphflow_index(filePath)
|
|
362
396
|
│ └─ Multiple files → graphflow_index (incremental)
|
|
363
397
|
│
|
|
364
398
|
├─ Is the graph giving bad results?
|
|
365
|
-
│ ├─ First →
|
|
399
|
+
│ ├─ First → graphflow_diagnose (check state)
|
|
366
400
|
│ ├─ Then → graphflow_index (try incremental)
|
|
367
|
-
│ └─ Last resort →
|
|
401
|
+
│ └─ Last resort → graphflow_index(mode="full") (full rebuild)
|
|
368
402
|
│
|
|
369
403
|
├─ Sharing with teammates?
|
|
370
|
-
│ ├─ Export →
|
|
371
|
-
│ └─ Import →
|
|
404
|
+
│ ├─ Export → graphflow_artifact(mode="export")
|
|
405
|
+
│ └─ Import → graphflow_artifact(mode="import")
|
|
372
406
|
│
|
|
373
407
|
├─ Do you want to leverage prior learning?
|
|
374
408
|
│ └─ YES → graphflow_skill_insights
|
|
375
409
|
│
|
|
376
410
|
├─ Tracking ROI?
|
|
377
|
-
│ └─
|
|
411
|
+
│ └─ graphflow_diagnose (check stats field)
|
|
378
412
|
│
|
|
379
413
|
└─ Is routing/models misbehaving?
|
|
380
414
|
└─ YES → graphflow_diagnose
|
|
@@ -415,21 +449,21 @@ Always pay attention to `tokenBudget`:
|
|
|
415
449
|
## Best Practices
|
|
416
450
|
|
|
417
451
|
### 1. Context First, Always
|
|
418
|
-
- Start EVERY coding task with `
|
|
452
|
+
- Start EVERY coding task with `graphflow_context`
|
|
419
453
|
- Only read full files when compressed context is insufficient
|
|
420
454
|
- Never grep the whole repo before trying GraphFlow
|
|
421
455
|
|
|
422
456
|
### 2. Plan Before Complex Work
|
|
423
457
|
- Use `graphflow_plan` for anything beyond 2-3 files
|
|
424
|
-
- Use `
|
|
458
|
+
- Use `graphflow_plan(mode="insight")` for ambiguous tasks
|
|
425
459
|
- Follow the DAG order (respect dependencies)
|
|
426
460
|
- Use context from GraphFlow at each step
|
|
427
461
|
|
|
428
462
|
### 3. Keep Graph Fresh
|
|
429
|
-
- Call `
|
|
463
|
+
- Call `graphflow_index(filePath)` after saving individual files
|
|
430
464
|
- Call `graphflow_index` after significant changes
|
|
431
465
|
- Prefer incremental index over full rebuild
|
|
432
|
-
- Check `
|
|
466
|
+
- Check `graphflow_diagnose` if results seem off
|
|
433
467
|
|
|
434
468
|
### 4. Close the Learning Loop
|
|
435
469
|
- After bridge-mode runs, call `graphflow_report_outcome`
|
|
@@ -452,18 +486,18 @@ Always pay attention to `tokenBudget`:
|
|
|
452
486
|
|
|
453
487
|
### "0 anchors found" or empty results
|
|
454
488
|
1. **Chinese/CJK:** translate to English keywords; pass `englishQuery` or answer `agentWorkItems` id `query-translate-en`
|
|
455
|
-
2. Check if graph exists: `
|
|
489
|
+
2. Check if graph exists: `graphflow_diagnose`
|
|
456
490
|
3. If empty: run `graphflow_index`
|
|
457
491
|
4. If still empty: verify `rootDir` points to correct project
|
|
458
492
|
|
|
459
493
|
### Results seem stale
|
|
460
494
|
1. Run `graphflow_index` (incremental, fast)
|
|
461
|
-
2. If still stale: `
|
|
495
|
+
2. If still stale: `graphflow_index(mode="full")` (full, slow)
|
|
462
496
|
|
|
463
497
|
### Context quality is poor
|
|
464
498
|
1. Try more specific query terms
|
|
465
|
-
2. Check if symbols are indexed (
|
|
466
|
-
3. Run `
|
|
499
|
+
2. Check if symbols are indexed (diagnose)
|
|
500
|
+
3. Run `graphflow_index(mode="full")` if the graph may be stale
|
|
467
501
|
|
|
468
502
|
### Tool errors / configuration issues
|
|
469
503
|
1. Run `graphflow_diagnose` to check provider health
|
|
@@ -471,9 +505,9 @@ Always pay attention to `tokenBudget`:
|
|
|
471
505
|
3. Check workspace root is correct
|
|
472
506
|
|
|
473
507
|
### Want to share graph with teammates
|
|
474
|
-
1. Export: `
|
|
508
|
+
1. Export: `graphflow_artifact(mode="export")`
|
|
475
509
|
2. Send the artifact file
|
|
476
|
-
3. Teammate imports: `
|
|
510
|
+
3. Teammate imports: `graphflow_artifact(mode="import")`
|
|
477
511
|
|
|
478
512
|
---
|
|
479
513
|
|
|
@@ -481,16 +515,16 @@ Always pay attention to `tokenBudget`:
|
|
|
481
515
|
|
|
482
516
|
```typescript
|
|
483
517
|
// 90% of the time - start here
|
|
484
|
-
await
|
|
518
|
+
await graphflow_context({ query: "what you're looking for" });
|
|
485
519
|
|
|
486
520
|
// Need more detail on a specific anchor?
|
|
487
|
-
await
|
|
521
|
+
await graphflow_context({ anchorId: "symbol:src/foo.ts:abc123" });
|
|
488
522
|
|
|
489
523
|
// Before complex tasks
|
|
490
524
|
await graphflow_plan({ task: "describe the task" });
|
|
491
525
|
|
|
492
526
|
// Deep analysis with Six Thinking Hats + 5-Why
|
|
493
|
-
await
|
|
527
|
+
await graphflow_plan({ task: "complex ambiguous task", mode: "insight" });
|
|
494
528
|
|
|
495
529
|
// Full packaged task (bridge mode)
|
|
496
530
|
const result = await graphflow_run({ task: "full task description" });
|
|
@@ -502,27 +536,24 @@ await graphflow_report_outcome({
|
|
|
502
536
|
});
|
|
503
537
|
|
|
504
538
|
// After making changes - single file
|
|
505
|
-
await
|
|
539
|
+
await graphflow_index({ filePath: "src/foo.ts" });
|
|
506
540
|
|
|
507
541
|
// After making changes - workspace
|
|
508
542
|
await graphflow_index({ rootDir: "/path/to/project" });
|
|
509
543
|
|
|
510
|
-
// Check graph health
|
|
511
|
-
await
|
|
544
|
+
// Check graph health + stats + savings
|
|
545
|
+
await graphflow_diagnose({ nodeLimit: 20 });
|
|
512
546
|
|
|
513
547
|
// When graph is broken
|
|
514
|
-
await
|
|
548
|
+
await graphflow_index({ mode: "full", rootDir: "/path/to/project" });
|
|
515
549
|
|
|
516
550
|
// Team collaboration
|
|
517
|
-
await
|
|
518
|
-
await
|
|
551
|
+
await graphflow_artifact({ mode: "export", outputPath: "graph-artifact.gz" });
|
|
552
|
+
await graphflow_artifact({ mode: "import", inputPath: "graph-artifact.gz" });
|
|
519
553
|
|
|
520
554
|
// Leverage prior learning
|
|
521
555
|
await graphflow_skill_insights({ limit: 5 });
|
|
522
556
|
|
|
523
|
-
// Token savings stats
|
|
524
|
-
await graphflow_stats();
|
|
525
|
-
|
|
526
557
|
// Diagnose issues
|
|
527
558
|
await graphflow_diagnose();
|
|
528
559
|
```
|