maestro-flow 0.5.34 → 0.5.35

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 (95) hide show
  1. package/.agents/agents/workflow-collab-planner.md +1 -0
  2. package/.agents/agents/workflow-planner.md +2 -0
  3. package/.agents/skills/maestro-help/SKILL.md +1 -1
  4. package/.agents/skills/maestro-help/index/catalog.json +0 -1
  5. package/.agents/skills/maestro-help/phases/01-parse-intent.md +1 -1
  6. package/.agents/skills/maestro-plan/SKILL.md +3 -1
  7. package/.agents/skills/maestro-ralph/SKILL.md +46 -17
  8. package/.agents/skills/maestro-ralph-execute/SKILL.md +51 -10
  9. package/.agents/skills/quality-test/SKILL.md +27 -1
  10. package/.agy/agents/workflow-collab-planner.md +1 -0
  11. package/.agy/agents/workflow-planner.md +2 -0
  12. package/.agy/skills/maestro-help/SKILL.md +1 -1
  13. package/.agy/skills/maestro-help/index/catalog.json +0 -1
  14. package/.agy/skills/maestro-help/phases/01-parse-intent.md +1 -1
  15. package/.agy/skills/maestro-plan/SKILL.md +3 -1
  16. package/.agy/skills/maestro-ralph/SKILL.md +46 -17
  17. package/.agy/skills/maestro-ralph-execute/SKILL.md +51 -10
  18. package/.agy/skills/quality-test/SKILL.md +27 -1
  19. package/.claude/agents/workflow-collab-planner.md +1 -0
  20. package/.claude/agents/workflow-planner.md +2 -0
  21. package/.claude/commands/maestro-plan.md +3 -1
  22. package/.claude/commands/maestro-ralph-execute.md +51 -10
  23. package/.claude/commands/maestro-ralph.md +46 -17
  24. package/.claude/commands/quality-test.md +27 -1
  25. package/.claude/skills/maestro-help/SKILL.md +1 -1
  26. package/.claude/skills/maestro-help/index/catalog.json +0 -1
  27. package/.claude/skills/maestro-help/phases/01-parse-intent.md +1 -1
  28. package/.codex/skills/maestro/SKILL.md +17 -2
  29. package/.codex/skills/maestro-analyze/SKILL.md +20 -3
  30. package/.codex/skills/maestro-brainstorm/SKILL.md +30 -4
  31. package/.codex/skills/maestro-execute/SKILL.md +25 -3
  32. package/.codex/skills/maestro-grill/SKILL.md +9 -0
  33. package/.codex/skills/maestro-plan/SKILL.md +26 -3
  34. package/.codex/skills/maestro-ralph/SKILL.md +6 -0
  35. package/.codex/skills/maestro-ralph-execute/SKILL.md +51 -10
  36. package/.codex/skills/maestro-roadmap/SKILL.md +30 -1
  37. package/.codex/skills/quality-review/SKILL.md +9 -0
  38. package/README.md +28 -5
  39. package/README.zh-CN.md +28 -5
  40. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.d.ts +82 -0
  41. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js +444 -0
  42. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js.map +1 -0
  43. package/dashboard/dist-server/dashboard/src/server/wiki/search.d.ts +46 -0
  44. package/dashboard/dist-server/dashboard/src/server/wiki/search.js +413 -19
  45. package/dashboard/dist-server/dashboard/src/server/wiki/search.js.map +1 -1
  46. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js +16 -0
  47. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js.map +1 -1
  48. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +13 -0
  49. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +102 -7
  50. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  51. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js +42 -0
  52. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js.map +1 -1
  53. package/dashboard/dist-server/src/commands/hooks.d.ts +3 -0
  54. package/dashboard/dist-server/src/commands/hooks.js +11 -8
  55. package/dashboard/dist-server/src/commands/hooks.js.map +1 -1
  56. package/dashboard/dist-server/src/graph/kg/extraction/code/code-extractor.js +1 -1
  57. package/dashboard/dist-server/src/graph/kg/extraction/code/code-extractor.js.map +1 -1
  58. package/dashboard/dist-server/src/graph/kg/extraction/orchestrator.js +2 -6
  59. package/dashboard/dist-server/src/graph/kg/extraction/orchestrator.js.map +1 -1
  60. package/dist/src/cli.js +1 -0
  61. package/dist/src/cli.js.map +1 -1
  62. package/dist/src/commands/hooks.d.ts +3 -0
  63. package/dist/src/commands/hooks.d.ts.map +1 -1
  64. package/dist/src/commands/hooks.js +11 -8
  65. package/dist/src/commands/hooks.js.map +1 -1
  66. package/dist/src/commands/install.d.ts.map +1 -1
  67. package/dist/src/commands/install.js +42 -9
  68. package/dist/src/commands/install.js.map +1 -1
  69. package/dist/src/commands/search.d.ts +5 -0
  70. package/dist/src/commands/search.d.ts.map +1 -1
  71. package/dist/src/commands/search.js +81 -11
  72. package/dist/src/commands/search.js.map +1 -1
  73. package/dist/src/commands/update.d.ts.map +1 -1
  74. package/dist/src/commands/update.js +37 -21
  75. package/dist/src/commands/update.js.map +1 -1
  76. package/dist/src/core/install-executor.d.ts.map +1 -1
  77. package/dist/src/core/install-executor.js +6 -3
  78. package/dist/src/core/install-executor.js.map +1 -1
  79. package/dist/src/graph/kg/extraction/code/code-extractor.js +1 -1
  80. package/dist/src/graph/kg/extraction/code/code-extractor.js.map +1 -1
  81. package/dist/src/graph/kg/extraction/orchestrator.d.ts.map +1 -1
  82. package/dist/src/graph/kg/extraction/orchestrator.js +2 -6
  83. package/dist/src/graph/kg/extraction/orchestrator.js.map +1 -1
  84. package/dist/src/ralph/cmd-next.d.ts.map +1 -1
  85. package/dist/src/ralph/cmd-next.js +2 -3
  86. package/dist/src/ralph/cmd-next.js.map +1 -1
  87. package/package.json +4 -2
  88. package/workflows/claude-instructions.md +17 -2
  89. package/workflows/codex-instructions.md +85 -14
  90. package/workflows/command-authoring.md +1 -1
  91. package/workflows/plan.md +2 -1
  92. package/.agents/skills/maestro-ralph-beta/SKILL.md +0 -882
  93. package/.agy/skills/maestro-ralph-beta/SKILL.md +0 -878
  94. package/.claude/commands/maestro-ralph-beta.md +0 -880
  95. package/.codex/skills/maestro-ralph-beta/SKILL.md +0 -883
@@ -128,19 +128,44 @@ S_FALLBACK:
128
128
  | maestro-brainstorm | topic | `"{intent}"` |
129
129
  | maestro-roadmap | description | `"{intent}"` |
130
130
  | maestro-analyze | phase or topic | `{phase}` or `"{intent}"` |
131
- | maestro-plan | phase or --dir | `{phase}`, or `--dir {scratch_dir}` |
132
- | maestro-execute | phase or --dir | `{phase}`, or `--dir {scratch_dir}` |
131
+ | maestro-plan | phase, --from, or --dir | see --from auto-injection below |
132
+ | maestro-execute | phase or --dir | see --from auto-injection below |
133
133
  | quality-debug | gap context | Read previous step's error/gap |
134
134
  | quality-* | phase | `{phase}` |
135
135
 
136
- **Artifact dir resolution for --dir:**
136
+ **--from auto-injection (phase-level artifact chaining):**
137
+
138
+ Phase-level steps 在 build 阶段无法预知前序 artifact ID。A_RESOLVE_ARGS 运行时从 state.json 查找并注入显式引用,打通 analyze→plan→execute 数据管道:
139
+
137
140
  ```
138
- Read state.json filter artifacts by milestone + phase
139
- plan commands: latest type=="analyze" --dir .workflow/scratch/{path}
140
- execute commands: latest type=="plan" → --dir .workflow/scratch/{path}
141
+ Read state.json.artifacts(含 milestone_history 内归档 artifacts
142
+ filter by milestone={session.milestone} + phase={session.phase} + status=="completed"
143
+
144
+ plan step(含 {phase} 占位符,args 无 --from 且无 --dir):
145
+ 1. 查同 phase+milestone 最新 completed type=="analyze" artifact → id = ANL-xxx
146
+ 2. 命中 → args 追加 --from analyze:{id}
147
+ 3. 写 step.source_artifact_ref = "analyze:{id}"
148
+
149
+ execute step(含 {phase} 占位符,args 无 --dir):
150
+ 1. 查同 phase+milestone 最新 completed type=="plan" artifact → id = PLN-xxx, path = scratch/...
151
+ 2. 命中 → args 追加 --dir .workflow/scratch/{path}
152
+ 3. 写 step.source_artifact_ref = "plan:{id}"
141
153
  ```
142
154
 
143
- Write enriched args back to status.json.
155
+ 兜底:查询无结果 不注入,由命令自身 discovery 逻辑处理。已有 `--from` 或 `--dir` 的 step 不覆盖。
156
+
157
+ **Goal context injection:**
158
+
159
+ 当 step.goal_ref 非空且 session.task_decomposition 存在时:
160
+ ```
161
+ goal = session.task_decomposition.find(g => g.id == step.goal_ref)
162
+ if goal:
163
+ goal_snippet = { id: goal.id, goal: goal.goal, done_when: goal.done_when,
164
+ boundary: goal.boundary, evidence: goal.evidence }
165
+ → 传递给 A_EXEC_STEP 用于 inline execution 前注入(见 step 2 goal context pre-injection)
166
+ ```
167
+
168
+ Write enriched args + source_artifact_ref back to status.json.
144
169
 
145
170
  ### A_EXEC_DECISION
146
171
 
@@ -156,13 +181,24 @@ Write enriched args back to status.json.
156
181
  - 退出码 2 → 交给 S_LOCATE
157
182
  - 退出码 3 → active_step_index 已被占用
158
183
  - 退出码 1 → pause session
159
- 2. **Inline execution** — stdout 执行;deferred_reading 按需 Read
160
- 3. **Complete**:
184
+ 2. **Goal context pre-injection** — A_RESOLVE_ARGS 产出了 `goal_snippet`(step.goal_ref 非空),在 ralph next stdout prompt **顶部前置**以下 block,使执行命令感知当前子目标和执行约束:
185
+ ```
186
+ <goal_context>
187
+ Sub-goal: {goal.id} — {goal.goal}
188
+ Done when: {goal.done_when}
189
+ Boundary: {goal.boundary}
190
+ Evidence target: {goal.evidence}
191
+ Execution criteria: {session.execution_criteria joined by '; '}
192
+ </goal_context>
193
+ ```
194
+ 无 goal_snippet 时跳过此步。goal_context block 不替换 ralph next 的 stdout 内容,仅在其前方拼接。
195
+ 3. **Inline execution** — 按 stdout(含 goal_context 前置)执行;deferred_reading 按需 Read
196
+ 4. **Complete**:
161
197
  - `Bash("maestro ralph complete N --status DONE [--evidence <path>]")`
162
198
  - `Bash("maestro ralph complete N --status DONE_WITH_CONCERNS --concerns \"...\"")`
163
199
  - `Bash("maestro ralph retry N")`
164
200
  - `Bash("maestro ralph complete N --status BLOCKED --reason \"...\"")`
165
- 4. **Propagate context signals** — 关键信号 (`PHASE: N` / `scratch_dir: path` / `BLP-xxx`) 写入 `status.json.context`
201
+ 5. **Propagate context signals** — 关键信号 (`PHASE: N` / `scratch_dir: path` / `BLP-xxx`) 写入 `status.json.context`
166
202
 
167
203
  完成后 S_LOCATE 触发 `$maestro-ralph-execute` 直调自调用。
168
204
 
@@ -240,5 +276,10 @@ Display: `[{index}/{total}] ✗ {step.skill} 失败,会话已暂停。$maestro
240
276
  - [ ] Auto mode: retry 一次后 pause;interactive 提供 retry/skip/abort
241
277
  - [ ] 自调用持续到全部 completion_confirmed 或 paused
242
278
  - [ ] 只处理 session.platform == "codex" 的会话
279
+ - [ ] --from auto-injection:phase-level plan step 运行时从 state.json 查找同 phase+milestone 最新 completed analyze artifact → 注入 `--from analyze:{id}`,写 `source_artifact_ref`
280
+ - [ ] --from auto-injection:phase-level execute step 运行时查找同 phase+milestone 最新 completed plan artifact → 注入 `--dir`,写 `source_artifact_ref`
281
+ - [ ] Goal context injection:step.goal_ref 非空时从 task_decomposition 提取 goal_snippet,A_EXEC_STEP 在 ralph next stdout 顶部前置 `<goal_context>` block
282
+ - [ ] Goal context 包含 sub-goal description、done_when、boundary、evidence、execution_criteria
283
+ - [ ] 已有 `--from` 或 `--dir` 的 step 不被 auto-injection 覆盖
243
284
 
244
285
  </appendix>
@@ -29,6 +29,11 @@ $ARGUMENTS -- requirement/idea text or @file reference, plus optional flags.
29
29
 
30
30
  **Session**: `.workflow/.csv-wave/{YYYYMMDD}-roadmap-{slug}/`
31
31
  **Output**: tasks.csv, results.csv, discoveries.ndjson, context.md, `.workflow/roadmap.md`
32
+
33
+ ### Pre-load (runs unconditionally, including -y auto mode)
34
+ 1. **Architecture specs**: `maestro spec load --category arch` — load architecture constraints for phase decomposition
35
+ 2. **Wiki search**: `maestro search "{requirement keywords}" --json` → prior knowledge for dependency and scope analysis
36
+ 3. All optional — proceed without if unavailable (log warning)
32
37
  </context>
33
38
 
34
39
  <interview_protocol>
@@ -176,7 +181,22 @@ Assembly agent produces roadmap.md with Milestone > Phase hierarchy (goal, depen
176
181
  3. Generate context.md (summary + analysis findings + roadmap stats)
177
182
  4. Write .workflow/roadmap.md with Milestone > Phase hierarchy
178
183
  5. Update state.json milestones + current_milestone
179
- 6. Next-step routing: need analysis -> maestro-analyze; ready to plan -> maestro-plan; UI first -> maestro-impeccable build; need formal specs -> maestro-blueprint
184
+ 6. **Generate context-package.json** (schema `context-package/1.0`):
185
+ ```jsonc
186
+ {
187
+ "$schema": "context-package/1.0",
188
+ "source": { "type": "roadmap", "artifact_id": "RDM-{id}", "session_path": "...", "generated_at": "..." },
189
+ "requirements": [], // from milestone phase goals → { id, title, acceptance }
190
+ "constraints": [], // from scope decisions → locked items
191
+ "domain": {}, // inherit from upstream --from context-package if loaded
192
+ "non_goals": [], // deferred scope items
193
+ "insights": [], // from risk analysis and dependency findings
194
+ "open_questions": [], // unresolved scope areas
195
+ "references": [{ "type": "roadmap", "path": "roadmap.md" }]
196
+ }
197
+ ```
198
+ Register `context_package` path in RDM artifact entry so downstream `--from roadmap:ID` can resolve.
199
+ 7. Next-step routing: need analysis -> maestro-analyze; ready to plan -> maestro-plan; UI first -> maestro-impeccable build; need formal specs -> maestro-blueprint
180
200
 
181
201
  </actions>
182
202
 
@@ -215,5 +235,14 @@ Protocol: read before analysis, append-only, dedup by type+key.
215
235
  - [ ] context.md generated
216
236
  - [ ] Uncertainty assessed, strategy selected, milestones with phases + success criteria
217
237
  - [ ] Artifact registered in state.json with milestone entries
238
+ - [ ] Ralph-invoked: `maestro ralph complete <idx> --status {STATUS}` called with correct verdict
218
239
  </success_criteria>
240
+
241
+ <ralph_completion>
242
+ When invoked as a ralph session step, end by calling the CLI (no standalone report):
243
+ ```
244
+ maestro ralph complete <idx> --status {STATUS} [--evidence {path}]
245
+ ```
246
+ Status verdicts: **DONE** (normal), **DONE_WITH_CONCERNS** (caveats; pass `--concerns`), **NEEDS_RETRY** (transient error), **BLOCKED** (hard blocker; pass `--reason`).
247
+ </ralph_completion>
219
248
  </output>
@@ -413,4 +413,13 @@ echo '{"ts":"<ISO>","worker":"{id}","type":"vulnerability","data":{"location":"s
413
413
  - [ ] Issues auto-created for qualifying severity findings
414
414
  - [ ] Phase index.json updated with review status
415
415
  - [ ] discoveries.ndjson append-only throughout
416
+ - [ ] Ralph-invoked: `maestro ralph complete <idx> --status {STATUS}` called with correct verdict
416
417
  </success_criteria>
418
+
419
+ <ralph_completion>
420
+ When invoked as a ralph session step, end by calling the CLI (no standalone report):
421
+ ```
422
+ maestro ralph complete <idx> --status {STATUS} [--evidence {path}]
423
+ ```
424
+ Status verdicts: **DONE** (normal), **DONE_WITH_CONCERNS** (caveats; pass `--concerns`), **NEEDS_RETRY** (transient error), **BLOCKED** (hard blocker; pass `--reason`).
425
+ </ralph_completion>
package/README.md CHANGED
@@ -36,7 +36,7 @@ Maestro-Flow is built on two interconnected systems that reinforce each other:
36
36
  ┌──────────────┴──────────────┐ ┌──────────────────┴───────────────┐
37
37
  │ Workflow Orchestration │ │ Knowledge System │
38
38
  │ │ │ │
39
- │ Intent Router │ │ Knowledge Graph (SQLite)
39
+ │ Intent Router │ │ MaestroGraph (SQLite)
40
40
  │ └─ 40+ chain types │ │ └─ Code + Knowledge unified │
41
41
  │ Ralph Decision Engine │ │ Spec Injection (Hooks) │
42
42
  │ └─ 11-state FSM │ │ └─ Auto-inject into prompts │
@@ -67,6 +67,8 @@ maestro install
67
67
 
68
68
  **Prerequisites**: Node.js ≥ 18, Claude Code CLI. Optional: Codex CLI, Gemini CLI for multi-agent workflows.
69
69
 
70
+ `maestro install` provides an interactive component selector — choose which assets (commands, hooks, MCP, agents) to install. Use `maestro workspace link` to share knowledge (specs, knowhow, domain) across multiple projects.
71
+
70
72
  ---
71
73
 
72
74
  ## Quick Start
@@ -95,6 +97,18 @@ Ralph automatically determines where you are (brainstorm → plan → execute
95
97
  | `/maestro-quick` | Quick fixes, small features (analyze → plan → execute) |
96
98
  | `/maestro-*` | Step-by-step: brainstorm, blueprint, analyze, plan, execute, verify |
97
99
 
100
+ ### Odyssey — Long-Running Iterative Cycles
101
+
102
+ Odyssey commands run extended, self-correcting loops that combine archaeology, diagnosis, fix, verification, and knowledge persistence until acceptance criteria are met:
103
+
104
+ | Command | Focus |
105
+ |---------|-------|
106
+ | `odyssey-debug` | Debug cycle — archaeology, diagnosis, fix, confirmation, generalization |
107
+ | `odyssey-planex` | Requirement-driven cycle — plan, execute, strict verify, fix loop |
108
+ | `odyssey-improve` | Codebase improvement — multi-dimensional audit, targeted fix, verify |
109
+ | `odyssey-review-test-fix` | Deep review + fix — multi-dimensional review, targeted fix, generalization |
110
+ | `odyssey-ui` | UI optimization — visual survey, audit, divergent exploration, fix |
111
+
98
112
  ---
99
113
 
100
114
  ## Workflow Orchestration
@@ -159,9 +173,9 @@ These patterns compose: a team coordinator can delegate subtasks to different LL
159
173
 
160
174
  ## Knowledge System
161
175
 
162
- ### Knowledge Graph
176
+ ### Knowledge Graph (MaestroGraph)
163
177
 
164
- A SQLite-backed unified graph that stores both **code structure** (functions, classes, call chains via tree-sitter extraction) and **project knowledge** (specs, knowhow, domain terms, issues) in one queryable structure.
178
+ **MaestroGraph** is the unified code index engine that replaces the former CodeGraph dependency. Built on `web-tree-sitter` for AST-level extraction, it stores both **code structure** (functions, classes, call chains) and **project knowledge** (specs, knowhow, domain terms, issues) in a single SQLite-backed graph with dual FTS5 indexes.
165
179
 
166
180
  ```bash
167
181
  maestro kg search <symbol> # Find nodes
@@ -187,6 +201,10 @@ Agent executes task
187
201
 
188
202
  Four learning tools feed this cycle: `learn-retro` (retrospective), `learn-follow` (pattern study), `learn-decompose` (architecture breakdown), `learn-investigate` (deep dive).
189
203
 
204
+ ### Domain Knowledge
205
+
206
+ A semantic glossary layer that defines **what things mean** in your project. Domain terms (`maestro domain`) standardize terminology, map concept relationships, and serve as a MaestroGraph knowledge source — bridging the gap between code-level symbols and business-level concepts.
207
+
190
208
  ### Wiki & Search
191
209
 
192
210
  WikiIndexer walks the `.workflow/` directory, parses frontmatter, builds backlink graphs, and creates a **BM25 inverted index** for full-text search across all project knowledge — specs, knowhow, issues, and KG nodes as virtual entries.
@@ -225,7 +243,7 @@ Built with React 19, Zustand, Tailwind CSS 4, Framer Motion, Hono, WebSocket.
225
243
 
226
244
  | Metric | Count |
227
245
  |--------|-------|
228
- | Source files (TypeScript) | 446 |
246
+ | Source files (TypeScript) | 454 |
229
247
  | Lines of code | ~111,000 |
230
248
  | Slash commands | 64 |
231
249
  | Workflow definitions | 115 |
@@ -233,7 +251,7 @@ Built with React 19, Zustand, Tailwind CSS 4, Framer Motion, Hono, WebSocket.
233
251
  | Agent definitions | 23 |
234
252
  | CLI commands | 32 |
235
253
  | Templates | 92 |
236
- | Guides (bilingual) | 66 |
254
+ | Guides (bilingual) | 67 |
237
255
 
238
256
  ### Tech Stack
239
257
 
@@ -277,6 +295,7 @@ maestro/
277
295
 
278
296
  **Getting Started**
279
297
  - **[Quick Start Guide](guide/quick-start-guide.en.md)** — Install, first workflow, key concepts
298
+ - **[Install Guide](guide/install-guide.md)** — Step-by-step installation, component selection, workspace setup
280
299
  - **[Maestro Ralph Guide](guide/maestro-ralph-guide.en.md)** — Adaptive lifecycle engine, decision nodes, quality modes
281
300
 
282
301
  **Workflow**
@@ -288,6 +307,9 @@ maestro/
288
307
 
289
308
  **Knowledge**
290
309
  - **[Knowledge Management Guide](guide/knowledge-management-guide.en.md)** — KG, specs, knowhow, wiki
310
+ - **[Search System Guide](guide/search-system-guide.md)** — Unified BM25F search, MaestroGraph integration, type filtering
311
+ - **[MaestroGraph Plan](guide/plan-maestrograph.md)** — Unified KG engine design, CodeGraph replacement, tree-sitter integration
312
+ - **[Domain Knowledge Plan](guide/plan-domain-knowledge.md)** — Semantic glossary, term relationships, concept layer
291
313
  - **[Spec System Guide](guide/spec-system-guide.en.md)** — Spec entries, keyword loading, validation hooks
292
314
  - **[Hooks Guide](guide/hooks-guide.en.md)** — 17 hooks, spec injection, context budget
293
315
  - **[Learning Tools Guide](guide/learn-tools-guide.en.md)** — Retro, follow, decompose, investigate
@@ -296,6 +318,7 @@ maestro/
296
318
  - **[Delegate Async Guide](guide/delegate-async-guide.en.md)** — Multi-CLI delegation, message injection, chaining
297
319
  - **[Overlay Guide](guide/overlay-guide.en.md)** — Non-invasive command extensions
298
320
  - **[Worktree Guide](guide/worktree-guide.en.md)** — Milestone-level parallel development
321
+ - **[Workspace Guide](guide/workspace-guide.md)** — Cross-workspace knowledge sharing, link/unlink
299
322
  - **[MCP Tools Reference](guide/mcp-tools-guide.en.md)** — All 9 MCP endpoint tools
300
323
  - **[Collab Guide](guide/team-lite-guide.en.md)** — 2-8 person team collaboration
301
324
 
package/README.zh-CN.md CHANGED
@@ -36,7 +36,7 @@ Maestro-Flow 建立在两个相互增强的系统之上:
36
36
  ┌──────────────┴──────────────┐ ┌──────────────────┴───────────────┐
37
37
  │ 工作流编排 │ │ 知识系统 │
38
38
  │ │ │ │
39
- │ 意图路由 │ │ 知识图谱 (SQLite)
39
+ │ 意图路由 │ │ MaestroGraph (SQLite)
40
40
  │ └─ 40+ 链类型 │ │ └─ 代码 + 知识统一存储 │
41
41
  │ Ralph 决策引擎 │ │ Spec 注入 (Hooks) │
42
42
  │ └─ 11 状态 FSM │ │ └─ 自动注入 agent 提示词 │
@@ -66,6 +66,8 @@ maestro install
66
66
 
67
67
  **前置条件**:Node.js ≥ 18,Claude Code CLI。可选:Codex CLI、Gemini CLI 用于多智能体工作流。
68
68
 
69
+ `maestro install` 提供交互式组件选择器 — 可选择安装哪些资产(命令、Hook、MCP、Agent)。使用 `maestro workspace link` 跨多个项目共享知识(spec、knowhow、domain)。
70
+
69
71
  ---
70
72
 
71
73
  ## 快速开始
@@ -94,6 +96,18 @@ Ralph 自动判断你在哪个阶段(brainstorm → plan → execute → verif
94
96
  | `/maestro-quick` | 快速修复、小功能(analyze → plan → execute) |
95
97
  | `/maestro-*` | 逐步执行:brainstorm、blueprint、analyze、plan、execute、verify |
96
98
 
99
+ ### Odyssey — 长周期迭代循环
100
+
101
+ Odyssey 命令运行扩展的自校正循环,组合考古式分析、诊断、修复、验证和知识持久化,直到满足验收标准:
102
+
103
+ | 命令 | 聚焦场景 |
104
+ |------|---------|
105
+ | `odyssey-debug` | 调试循环 — 考古分析、诊断、修复、确认、泛化 |
106
+ | `odyssey-planex` | 需求驱动循环 — 计划、执行、严格验证、修复迭代 |
107
+ | `odyssey-improve` | 代码库改进 — 多维审计、定向修复、验证 |
108
+ | `odyssey-review-test-fix` | 深度审查 + 修复 — 多维审查、定向修复、泛化 |
109
+ | `odyssey-ui` | UI 优化 — 视觉巡检、审计、发散探索、修复 |
110
+
97
111
  ---
98
112
 
99
113
  ## 工作流编排
@@ -158,9 +172,9 @@ Maestro 通过四种可组合的编排模式协调 **Claude Code、Codex、Gemin
158
172
 
159
173
  ## 知识系统
160
174
 
161
- ### 知识图谱
175
+ ### 知识图谱(MaestroGraph)
162
176
 
163
- SQLite 支撑的统一图数据库,同时存储**代码结构**(函数、类、调用链,通过 tree-sitter 提取)和**项目知识**(spec、knowhow、领域术语、issue),合并在一个可查询的结构中。
177
+ **MaestroGraph** 是统一的代码索引引擎,替代了原有的 CodeGraph 外部依赖。基于 `web-tree-sitter` 实现 AST 级提取,将**代码结构**(函数、类、调用链)和**项目知识**(spec、knowhow、领域术语、issue)存储在同一个 SQLite 图数据库中,配备双 FTS5 索引。
164
178
 
165
179
  ```bash
166
180
  maestro kg search <symbol> # 查找节点
@@ -186,6 +200,10 @@ Agent 执行任务
186
200
 
187
201
  四个学习工具驱动这个循环:`learn-retro`(复盘)、`learn-follow`(模式学习)、`learn-decompose`(架构拆解)、`learn-investigate`(深度探究)。
188
202
 
203
+ ### 领域知识
204
+
205
+ 语义词汇表层,定义项目中**事物的含义**。Domain 术语(`maestro domain`)标准化命名、映射概念关系,并作为 MaestroGraph 的知识源之一 — 桥接代码级符号与业务级概念。
206
+
189
207
  ### Wiki 与搜索
190
208
 
191
209
  WikiIndexer 遍历 `.workflow/` 目录,解析 frontmatter,构建反向链接图,并创建 **BM25 倒排索引**用于全文搜索 — 覆盖所有项目知识:spec、knowhow、issue 以及 KG 节点的虚拟条目。
@@ -224,7 +242,7 @@ maestro command-help # 交互式命令参考(别名: ch)
224
242
 
225
243
  | 指标 | 数量 |
226
244
  |------|------|
227
- | 源文件 (TypeScript) | 446 |
245
+ | 源文件 (TypeScript) | 454 |
228
246
  | 代码行数 | ~111,000 |
229
247
  | 斜杠命令 | 64 |
230
248
  | 工作流定义 | 115 |
@@ -232,7 +250,7 @@ maestro command-help # 交互式命令参考(别名: ch)
232
250
  | Agent 定义 | 23 |
233
251
  | CLI 命令 | 32 |
234
252
  | 模板 | 92 |
235
- | 指南(双语) | 66 |
253
+ | 指南(双语) | 67 |
236
254
 
237
255
  ### 技术栈
238
256
 
@@ -276,6 +294,7 @@ maestro/
276
294
 
277
295
  **快速入门**
278
296
  - **[快速开始指南](guide/quick-start-guide.md)** — 安装、第一个工作流、核心概念
297
+ - **[安装指南](guide/install-guide.md)** — 分步安装、组件选择、工作空间配置
279
298
  - **[Maestro Ralph 指南](guide/maestro-ralph-guide.md)** — 自适应生命周期引擎、decision 节点、质量模式
280
299
 
281
300
  **工作流**
@@ -287,6 +306,9 @@ maestro/
287
306
 
288
307
  **知识系统**
289
308
  - **[知识管理指南](guide/knowledge-management-guide.md)** — KG、spec、knowhow、wiki
309
+ - **[搜索系统指南](guide/search-system-guide.md)** — 统一 BM25F 搜索、MaestroGraph 集成、类型过滤
310
+ - **[MaestroGraph 设计文档](guide/plan-maestrograph.md)** — 统一 KG 引擎设计、CodeGraph 替代、tree-sitter 集成
311
+ - **[领域知识设计文档](guide/plan-domain-knowledge.md)** — 语义词汇表、术语关系、概念层
290
312
  - **[Spec 系统指南](guide/spec-system-guide.md)** — spec 条目、关键词加载、验证 Hook
291
313
  - **[Hook 系统指南](guide/hooks-guide.md)** — 17 个 Hook、Spec 注入、上下文预算
292
314
  - **[学习工具指南](guide/learn-tools-guide.md)** — 复盘、跟读、拆解、探究
@@ -295,6 +317,7 @@ maestro/
295
317
  - **[Delegate 异步执行指南](guide/delegate-async-guide.md)** — 多 CLI 委派、消息注入、链式调用
296
318
  - **[Overlay 系统指南](guide/overlay-guide.md)** — 非侵入式命令扩展
297
319
  - **[Worktree 并行开发指南](guide/worktree-guide.md)** — 里程碑级并行开发
320
+ - **[跨工作空间指南](guide/workspace-guide.md)** — 跨项目知识共享、link/unlink
298
321
  - **[MCP 工具参考](guide/mcp-tools-guide.md)** — 全部 9 个 MCP 端点工具
299
322
  - **[Collab 协作指南](guide/team-lite-guide.md)** — 2-8 人团队协作
300
323
 
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Embedding-based semantic search using @huggingface/transformers (ONNX backend).
3
+ *
4
+ * Features:
5
+ * - Smart device detection: auto-benchmarks CPU vs GPU (DirectML), picks fastest
6
+ * - Batch inference: processes documents in configurable batch sizes (4-5x faster)
7
+ * - Incremental indexing: only re-embeds new or changed documents
8
+ * - Graceful degradation: falls back to pure BM25 when transformers is unavailable
9
+ */
10
+ export interface EmbeddingIndex {
11
+ modelId: string;
12
+ dimension: number;
13
+ docIds: string[];
14
+ vectors: Float32Array[];
15
+ contentHashes?: string[];
16
+ builtAt: number;
17
+ deviceUsed?: string;
18
+ buildTimeMs?: number;
19
+ }
20
+ export interface VectorSearchResult {
21
+ docId: string;
22
+ score: number;
23
+ }
24
+ export type DeviceType = 'cpu' | 'gpu';
25
+ export type DtypeType = 'fp32' | 'fp16' | 'q8' | 'q4';
26
+ export interface DeviceConfig {
27
+ device: DeviceType;
28
+ dtype: DtypeType;
29
+ batchSize: number;
30
+ }
31
+ export interface RankedResult {
32
+ docId: string;
33
+ score: number;
34
+ }
35
+ export interface RRFSignal {
36
+ name: string;
37
+ weight: number;
38
+ results: RankedResult[];
39
+ }
40
+ export declare function mergeRRFSignals(signals: RRFSignal[], limit: number, k?: number): RankedResult[];
41
+ export declare function mergeRRF(bm25Results: RankedResult[], vectorResults: RankedResult[], limit: number, k?: number, bm25Weight?: number, vectorWeight?: number): RankedResult[];
42
+ /**
43
+ * Hybrid fusion: RRF for ordering stability + BM25 magnitude for score discrimination.
44
+ * finalScore = alpha * rrfNorm + (1-alpha) * bm25Norm
45
+ */
46
+ export declare function mergeHybrid(bm25Results: RankedResult[], vectorResults: RankedResult[], limit: number, options?: {
47
+ k?: number;
48
+ alpha?: number;
49
+ bm25Weight?: number;
50
+ vectorWeight?: number;
51
+ }): RankedResult[];
52
+ interface BackendInfo {
53
+ name: string;
54
+ bundled: boolean;
55
+ }
56
+ export declare function detectDevice(): Promise<DeviceConfig>;
57
+ export declare function getDeviceSummary(): string;
58
+ export interface HardwareInfo {
59
+ backends: BackendInfo[];
60
+ gpuAvailable: boolean;
61
+ selectedDevice: DeviceConfig;
62
+ reason: string;
63
+ }
64
+ export declare function getHardwareInfo(): Promise<HardwareInfo>;
65
+ export declare const DEFAULT_MODEL_ID = "Xenova/multilingual-e5-small";
66
+ export declare function isAvailable(): Promise<boolean>;
67
+ export declare function getUnavailableReason(): string | null;
68
+ export declare function embedTexts(texts: string[]): Promise<Float32Array[]>;
69
+ export declare function embedQuery(query: string): Promise<Float32Array>;
70
+ export declare function vectorSearch(queryVector: Float32Array, index: EmbeddingIndex, limit: number): VectorSearchResult[];
71
+ export declare function saveEmbeddingIndex(index: EmbeddingIndex, dir: string): void;
72
+ export declare function loadEmbeddingIndex(dir: string): EmbeddingIndex | null;
73
+ export interface DocForEmbedding {
74
+ id: string;
75
+ title: string;
76
+ summary: string;
77
+ tags: string[];
78
+ body?: string;
79
+ }
80
+ export declare function hashDocContent(d: DocForEmbedding): string;
81
+ export declare function buildEmbeddingIndex(docs: DocForEmbedding[], existingIndex?: EmbeddingIndex | null): Promise<EmbeddingIndex>;
82
+ export {};