@roarpeng/graphflow 1.0.8 → 1.1.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.
Files changed (140) hide show
  1. package/AGENTS.md +8 -0
  2. package/CHANGELOG.md +25 -0
  3. package/CLAUDE.md +2 -1
  4. package/README.md +20 -10
  5. package/dist/agents/insight.d.ts +7 -0
  6. package/dist/agents/insight.d.ts.map +1 -1
  7. package/dist/agents/insight.js +44 -0
  8. package/dist/agents/insight.js.map +1 -1
  9. package/dist/config/defaults.d.ts.map +1 -1
  10. package/dist/config/defaults.js +6 -1
  11. package/dist/config/defaults.js.map +1 -1
  12. package/dist/config/include-extensions.d.ts +17 -0
  13. package/dist/config/include-extensions.d.ts.map +1 -0
  14. package/dist/config/include-extensions.js +50 -0
  15. package/dist/config/include-extensions.js.map +1 -0
  16. package/dist/config/llm-availability.d.ts +7 -0
  17. package/dist/config/llm-availability.d.ts.map +1 -0
  18. package/dist/config/llm-availability.js +37 -0
  19. package/dist/config/llm-availability.js.map +1 -0
  20. package/dist/config/loader.d.ts.map +1 -1
  21. package/dist/config/loader.js +2 -8
  22. package/dist/config/loader.js.map +1 -1
  23. package/dist/config/scaffold.d.ts +9 -0
  24. package/dist/config/scaffold.d.ts.map +1 -1
  25. package/dist/config/scaffold.js +28 -0
  26. package/dist/config/scaffold.js.map +1 -1
  27. package/dist/config/schema.d.ts +1 -1
  28. package/dist/config/schema.d.ts.map +1 -1
  29. package/dist/config/workspace-packages.d.ts +8 -0
  30. package/dist/config/workspace-packages.d.ts.map +1 -0
  31. package/dist/config/workspace-packages.js +157 -0
  32. package/dist/config/workspace-packages.js.map +1 -0
  33. package/dist/core/agent-delegation.d.ts +24 -0
  34. package/dist/core/agent-delegation.d.ts.map +1 -0
  35. package/dist/core/agent-delegation.js +98 -0
  36. package/dist/core/agent-delegation.js.map +1 -0
  37. package/dist/core/merge-agent-insight.d.ts +20 -0
  38. package/dist/core/merge-agent-insight.d.ts.map +1 -0
  39. package/dist/core/merge-agent-insight.js +167 -0
  40. package/dist/core/merge-agent-insight.js.map +1 -0
  41. package/dist/core/orchestrator.d.ts +3 -1
  42. package/dist/core/orchestrator.d.ts.map +1 -1
  43. package/dist/core/orchestrator.js +66 -7
  44. package/dist/core/orchestrator.js.map +1 -1
  45. package/dist/core/submit-agent-insight.d.ts +33 -0
  46. package/dist/core/submit-agent-insight.d.ts.map +1 -0
  47. package/dist/core/submit-agent-insight.js +88 -0
  48. package/dist/core/submit-agent-insight.js.map +1 -0
  49. package/dist/core/types.d.ts +10 -0
  50. package/dist/core/types.d.ts.map +1 -1
  51. package/dist/graph/context-slicer.d.ts.map +1 -1
  52. package/dist/graph/context-slicer.js +92 -0
  53. package/dist/graph/context-slicer.js.map +1 -1
  54. package/dist/graph/file-indexer.d.ts +7 -0
  55. package/dist/graph/file-indexer.d.ts.map +1 -1
  56. package/dist/graph/file-indexer.js +23 -3
  57. package/dist/graph/file-indexer.js.map +1 -1
  58. package/dist/graph/graphify-file-client.d.ts.map +1 -1
  59. package/dist/graph/graphify-file-client.js +16 -6
  60. package/dist/graph/graphify-file-client.js.map +1 -1
  61. package/dist/graph/language-indexers/c-cpp.d.ts.map +1 -1
  62. package/dist/graph/language-indexers/c-cpp.js +10 -2
  63. package/dist/graph/language-indexers/c-cpp.js.map +1 -1
  64. package/dist/graph/language-indexers/index.d.ts.map +1 -1
  65. package/dist/graph/language-indexers/index.js +4 -0
  66. package/dist/graph/language-indexers/index.js.map +1 -1
  67. package/dist/graph/language-indexers/kotlin.d.ts +8 -0
  68. package/dist/graph/language-indexers/kotlin.d.ts.map +1 -0
  69. package/dist/graph/language-indexers/kotlin.js +193 -0
  70. package/dist/graph/language-indexers/kotlin.js.map +1 -0
  71. package/dist/graph/language-indexers/swift.d.ts +8 -0
  72. package/dist/graph/language-indexers/swift.d.ts.map +1 -0
  73. package/dist/graph/language-indexers/swift.js +156 -0
  74. package/dist/graph/language-indexers/swift.js.map +1 -0
  75. package/dist/graph/language-indexers/tree-sitter-loader.d.ts +6 -1
  76. package/dist/graph/language-indexers/tree-sitter-loader.d.ts.map +1 -1
  77. package/dist/graph/language-indexers/tree-sitter-loader.js +49 -52
  78. package/dist/graph/language-indexers/tree-sitter-loader.js.map +1 -1
  79. package/dist/graph/snapshot-view.d.ts +10 -3
  80. package/dist/graph/snapshot-view.d.ts.map +1 -1
  81. package/dist/graph/snapshot-view.js +76 -12
  82. package/dist/graph/snapshot-view.js.map +1 -1
  83. package/dist/index.d.ts +4 -1
  84. package/dist/index.d.ts.map +1 -1
  85. package/dist/index.js +11 -1
  86. package/dist/index.js.map +1 -1
  87. package/dist/integrations/agent-mcp-installer.d.ts.map +1 -1
  88. package/dist/integrations/agent-mcp-installer.js +29 -5
  89. package/dist/integrations/agent-mcp-installer.js.map +1 -1
  90. package/dist/learning/skill-flywheel.d.ts.map +1 -1
  91. package/dist/learning/skill-flywheel.js +57 -13
  92. package/dist/learning/skill-flywheel.js.map +1 -1
  93. package/dist/surfaces/cli/index.js +2 -1
  94. package/dist/surfaces/cli/index.js.map +1 -1
  95. package/dist/surfaces/cli/init.d.ts +6 -0
  96. package/dist/surfaces/cli/init.d.ts.map +1 -1
  97. package/dist/surfaces/cli/init.js +158 -8
  98. package/dist/surfaces/cli/init.js.map +1 -1
  99. package/dist/surfaces/cli/runtime/facade.d.ts +3 -1
  100. package/dist/surfaces/cli/runtime/facade.d.ts.map +1 -1
  101. package/dist/surfaces/cli/runtime/facade.js.map +1 -1
  102. package/dist/surfaces/cli/runtime/graph.d.ts.map +1 -1
  103. package/dist/surfaces/cli/runtime/graph.js +9 -1
  104. package/dist/surfaces/cli/runtime/graph.js.map +1 -1
  105. package/dist/surfaces/cli/runtime/routing.d.ts +10 -0
  106. package/dist/surfaces/cli/runtime/routing.d.ts.map +1 -1
  107. package/dist/surfaces/cli/runtime/routing.js +42 -3
  108. package/dist/surfaces/cli/runtime/routing.js.map +1 -1
  109. package/dist/surfaces/cli/runtime.d.ts +1 -1
  110. package/dist/surfaces/cli/runtime.d.ts.map +1 -1
  111. package/dist/surfaces/cli/runtime.js +3 -1
  112. package/dist/surfaces/cli/runtime.js.map +1 -1
  113. package/dist/surfaces/cursor-rules/graphflow.mdc +131 -0
  114. package/dist/surfaces/mcp/server.d.ts +6 -28
  115. package/dist/surfaces/mcp/server.d.ts.map +1 -1
  116. package/dist/surfaces/mcp/server.js +16 -433
  117. package/dist/surfaces/mcp/server.js.map +1 -1
  118. package/dist/surfaces/mcp/tool-definitions.d.ts +12 -0
  119. package/dist/surfaces/mcp/tool-definitions.d.ts.map +1 -0
  120. package/dist/surfaces/mcp/tool-definitions.js +278 -0
  121. package/dist/surfaces/mcp/tool-definitions.js.map +1 -0
  122. package/dist/surfaces/mcp/tool-handlers.d.ts +22 -0
  123. package/dist/surfaces/mcp/tool-handlers.d.ts.map +1 -0
  124. package/dist/surfaces/mcp/tool-handlers.js +174 -0
  125. package/dist/surfaces/mcp/tool-handlers.js.map +1 -0
  126. package/dist/surfaces/mcp/version.d.ts +3 -0
  127. package/dist/surfaces/mcp/version.d.ts.map +1 -0
  128. package/dist/surfaces/mcp/version.js +26 -0
  129. package/dist/surfaces/mcp/version.js.map +1 -0
  130. package/package.json +7 -4
  131. package/src/surfaces/cursor-rules/graphflow.mdc +131 -0
  132. package/wasm/tree-sitter-c.wasm +0 -0
  133. package/wasm/tree-sitter-cpp.wasm +0 -0
  134. package/wasm/tree-sitter-go.wasm +0 -0
  135. package/wasm/tree-sitter-java.wasm +0 -0
  136. package/wasm/tree-sitter-kotlin.wasm +0 -0
  137. package/wasm/tree-sitter-python.wasm +0 -0
  138. package/wasm/tree-sitter-ruby.wasm +0 -0
  139. package/wasm/tree-sitter-rust.wasm +0 -0
  140. package/wasm/tree-sitter-swift.wasm +0 -0
@@ -0,0 +1,131 @@
1
+ ---
2
+ description: Use GraphFlow first for token-efficient repo context, planning, and orchestration.
3
+ globs:
4
+ - "**/*"
5
+ alwaysApply: true
6
+ ---
7
+
8
+ # GraphFlow Token-First Rule
9
+
10
+ GraphFlow is a graph-based context and planning service backed by a persistent MCP server. It turns codebases into queryable knowledge graphs, delivering token-efficient compressed context, task planning, and orchestration.
11
+
12
+ Before broad code exploration, implementation, debugging, review, planning, or architecture questions:
13
+
14
+ 1. Call `graphflow_preview_context` with the user's task/query.
15
+ 2. Use the returned `summary`, `anchors`, `refillPreview`, and `tokenBudget` as the first context source.
16
+ 3. Read full files only when:
17
+ - GraphFlow anchors point to that file/symbol,
18
+ - the compressed context is insufficient,
19
+ - or exact edits require the file body.
20
+ 4. For multi-step or ambiguous work, call `graphflow_plan` before implementation.
21
+ 5. For graph freshness after project changes, call `graphflow_index`.
22
+ 6. Report token budget when available:
23
+ - estimated raw tokens,
24
+ - compressed tokens,
25
+ - estimated savings percent,
26
+ - max context token budget.
27
+
28
+ Do not scan the whole repository, recursively inspect many files, or read large files before trying GraphFlow context.
29
+
30
+ ## Tool Inventory (18 MCP Tools)
31
+
32
+ ### Core Context Tools (Highest Frequency)
33
+
34
+ | Tool | Purpose | Call Frequency |
35
+ |------|---------|---------------|
36
+ | `graphflow_preview_context` | Compress task context with token budget | **Highest** - default first step |
37
+ | `graphflow_expand_anchor` | Expand a single anchor to full content | **High** - dive deeper into specific items |
38
+
39
+ ### Planning Tools (High Frequency)
40
+
41
+ | Tool | Purpose | Call Frequency |
42
+ |------|---------|---------------|
43
+ | `graphflow_plan` | Multi-step task decomposition & DAG | High - before complex work |
44
+ | `graphflow_plan_insight` | Six Thinking Hats + 5-Why deep analysis | Medium - ambiguous/high-stakes tasks |
45
+ | `graphflow_run` | Plan + context package (bridge mode) | Medium - full task packaging |
46
+ | `graphflow_report_outcome` | Report bridge-mode execution outcome back | Medium - close the learning loop |
47
+
48
+ ### Graph Management Tools (Medium Frequency)
49
+
50
+ | Tool | Purpose | Call Frequency |
51
+ |------|---------|---------------|
52
+ | `graphflow_index` | Incremental workspace re-index | Medium - after file changes |
53
+ | `graphflow_index_file` | Single file incremental index | Medium-High - after saving a file |
54
+ | `graphflow_rebuild` | Clear cache + full re-index | Low - when graph is stale/corrupted |
55
+ | `graphflow_inspect_graph` | Graph stats & sample nodes/edges | Low - check graph health |
56
+ | `graphflow_enrich_graph` | Semantic enrichment of symbols | Rare - LLM-powered enrichment |
57
+ | `graphflow_model_download` | Download local compression model | Rare - offline setup |
58
+
59
+ ### Collaboration & Insights Tools (Low Frequency)
60
+
61
+ | Tool | Purpose | Call Frequency |
62
+ |------|---------|---------------|
63
+ | `graphflow_export_artifact` | Export graph to portable artifact | Low - team sharing |
64
+ | `graphflow_import_artifact` | Import graph artifact | Low - skip full index on new machine |
65
+ | `graphflow_skill_insights` | Learned skill patterns | Low - leverage prior learning |
66
+ | `graphflow_stats` | Cumulative token savings stats | Low - ROI tracking |
67
+ | `graphflow_metrics` | Prometheus-compatible metrics | Low - observability |
68
+ | `graphflow_diagnose` | Provider health & model routing | Rare - config issues |
69
+
70
+ ## Standard Workflows
71
+
72
+ ### Workflow 1: Context First (90% of tasks)
73
+
74
+ **Use when:** Answering code questions, exploring codebase, understanding modules
75
+
76
+ ```
77
+ Step 1: graphflow_preview_context(query: "<your question>")
78
+ Step 2: Read summary + anchors as primary context
79
+ Step 3: Expand specific anchors with graphflow_expand_anchor when needed
80
+ Step 4: Read full files only when exact edits required
81
+ ```
82
+
83
+ ### Workflow 2: Plan Before Coding (complex tasks)
84
+
85
+ **Use when:** Multi-step changes, refactors, features with unclear scope
86
+
87
+ ```
88
+ Step 1: graphflow_preview_context(query: "<task>")
89
+ Step 2: graphflow_plan(task: "<task description>")
90
+ Step 3: Review plan steps and dependencies
91
+ Step 4: Execute step by step, using GraphFlow context for each step
92
+ Step 5: graphflow_index() after major changes
93
+ ```
94
+
95
+ ### Workflow 3: Deep Analysis (complex/ambiguous tasks)
96
+
97
+ **Use when:** High-stakes changes, root-cause analysis, ambiguous requirements
98
+
99
+ ```
100
+ Step 1: graphflow_preview_context(query: "<task>")
101
+ Step 2: graphflow_plan_insight(task: "<task>")
102
+ Step 3: Review analysis and apply findings
103
+ ```
104
+
105
+ ## Bridge-mode outcome reporting
106
+
107
+ After `graphflow_run`, the external agent **must** call `graphflow_report_outcome` to close the skill flywheel loop:
108
+
109
+ - Pass `episodeId` from the run result, a `success` boolean, and optional `lessons`.
110
+ - Do this after executing the work described in the returned `executionDescriptor`, whether the task succeeded or failed.
111
+ - When the run returns `agentWorkItems`, answer each prompt with your model and call `graphflow_submit_insight` once per item (before or with `graphflow_report_outcome`).
112
+
113
+ CLI fallback:
114
+
115
+ ```bash
116
+ graphflow --json outcome report <episodeId> <success>
117
+ ```
118
+
119
+ If MCP is unavailable, use the CLI fallback and always request JSON output:
120
+
121
+ ```bash
122
+ graphflow --json context preview "<query>"
123
+ graphflow --json plan "<task>"
124
+ graphflow --json graph inspect
125
+ graphflow --json skill insights
126
+ graphflow --json route diagnose
127
+ ```
128
+
129
+ Treat GraphFlow outputs as structured machine-readable data, not prose.
130
+
131
+ When the user asks about saving token usage, optimizing context, repo understanding, or learning from Graphify, prioritize GraphFlow context compression over ordinary file search.
File without changes
Binary file
File without changes
File without changes
Binary file
File without changes
File without changes
File without changes
Binary file