maestro-flow 0.4.17 → 0.4.19

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 (165) hide show
  1. package/.agents/skills/maestro/SKILL.md +1 -1
  2. package/.agents/skills/maestro-analyze/SKILL.md +5 -0
  3. package/.agents/skills/maestro-blueprint/SKILL.md +5 -0
  4. package/.agents/skills/maestro-brainstorm/SKILL.md +5 -0
  5. package/.agents/skills/maestro-next/SKILL.md +254 -0
  6. package/.agents/skills/team-swarm/SKILL.md +180 -0
  7. package/.agents/skills/team-swarm/roles/analyst/role.md +187 -0
  8. package/.agents/skills/team-swarm/roles/ant/role.md +169 -0
  9. package/.agents/skills/team-swarm/roles/coordinator/commands/converge.md +146 -0
  10. package/.agents/skills/team-swarm/roles/coordinator/commands/init-swarm.md +136 -0
  11. package/.agents/skills/team-swarm/roles/coordinator/commands/iterate.md +232 -0
  12. package/.agents/skills/team-swarm/roles/coordinator/role.md +211 -0
  13. package/.agents/skills/team-swarm/roles/scorer/role.md +157 -0
  14. package/.agents/skills/team-swarm/scripts/aco.py +473 -0
  15. package/.agents/skills/team-swarm/scripts/pheromone.py +144 -0
  16. package/.agents/skills/team-swarm/scripts/scoring.py +92 -0
  17. package/.agents/skills/team-swarm/scripts/test_aco.py +475 -0
  18. package/.agents/skills/team-swarm/specs/ant-output-schema.md +119 -0
  19. package/.agents/skills/team-swarm/specs/convergence-criteria.md +106 -0
  20. package/.agents/skills/team-swarm/specs/pheromone-schema.md +123 -0
  21. package/.agents/skills/team-swarm/specs/swarm-config-template.json +71 -0
  22. package/.agents/skills/team-swarm/specs/swarm-protocol.md +117 -0
  23. package/.agy/skills/maestro/SKILL.md +1 -1
  24. package/.agy/skills/maestro-analyze/SKILL.md +5 -0
  25. package/.agy/skills/maestro-blueprint/SKILL.md +5 -0
  26. package/.agy/skills/maestro-brainstorm/SKILL.md +5 -0
  27. package/.agy/skills/maestro-next/SKILL.md +250 -0
  28. package/.agy/skills/team-swarm/SKILL.md +176 -0
  29. package/.agy/skills/team-swarm/roles/analyst/role.md +183 -0
  30. package/.agy/skills/team-swarm/roles/ant/role.md +165 -0
  31. package/.agy/skills/team-swarm/roles/coordinator/commands/converge.md +134 -0
  32. package/.agy/skills/team-swarm/roles/coordinator/commands/init-swarm.md +136 -0
  33. package/.agy/skills/team-swarm/roles/coordinator/commands/iterate.md +202 -0
  34. package/.agy/skills/team-swarm/roles/coordinator/role.md +209 -0
  35. package/.agy/skills/team-swarm/roles/scorer/role.md +153 -0
  36. package/.agy/skills/team-swarm/scripts/aco.py +473 -0
  37. package/.agy/skills/team-swarm/scripts/pheromone.py +144 -0
  38. package/.agy/skills/team-swarm/scripts/scoring.py +92 -0
  39. package/.agy/skills/team-swarm/scripts/test_aco.py +475 -0
  40. package/.agy/skills/team-swarm/specs/ant-output-schema.md +119 -0
  41. package/.agy/skills/team-swarm/specs/convergence-criteria.md +106 -0
  42. package/.agy/skills/team-swarm/specs/pheromone-schema.md +123 -0
  43. package/.agy/skills/team-swarm/specs/swarm-config-template.json +71 -0
  44. package/.agy/skills/team-swarm/specs/swarm-protocol.md +117 -0
  45. package/.claude/commands/maestro-analyze.md +5 -0
  46. package/.claude/commands/maestro-blueprint.md +5 -0
  47. package/.claude/commands/maestro-brainstorm.md +5 -0
  48. package/.claude/commands/maestro-next.md +252 -0
  49. package/.claude/commands/maestro.md +1 -1
  50. package/.claude/skills/team-swarm/SKILL.md +178 -0
  51. package/.claude/skills/team-swarm/roles/analyst/role.md +185 -0
  52. package/.claude/skills/team-swarm/roles/ant/role.md +167 -0
  53. package/.claude/skills/team-swarm/roles/coordinator/commands/converge.md +146 -0
  54. package/.claude/skills/team-swarm/roles/coordinator/commands/init-swarm.md +136 -0
  55. package/.claude/skills/team-swarm/roles/coordinator/commands/iterate.md +232 -0
  56. package/.claude/skills/team-swarm/roles/coordinator/role.md +209 -0
  57. package/.claude/skills/team-swarm/roles/scorer/role.md +155 -0
  58. package/.claude/skills/team-swarm/scripts/aco.py +473 -0
  59. package/.claude/skills/team-swarm/scripts/pheromone.py +144 -0
  60. package/.claude/skills/team-swarm/scripts/scoring.py +92 -0
  61. package/.claude/skills/team-swarm/scripts/test_aco.py +475 -0
  62. package/.claude/skills/team-swarm/specs/ant-output-schema.md +119 -0
  63. package/.claude/skills/team-swarm/specs/convergence-criteria.md +106 -0
  64. package/.claude/skills/team-swarm/specs/pheromone-schema.md +123 -0
  65. package/.claude/skills/team-swarm/specs/swarm-config-template.json +71 -0
  66. package/.claude/skills/team-swarm/specs/swarm-protocol.md +117 -0
  67. package/.codex/skills/learn-decompose/SKILL.md +34 -3
  68. package/.codex/skills/learn-retro/SKILL.md +31 -1
  69. package/.codex/skills/learn-second-opinion/SKILL.md +34 -4
  70. package/.codex/skills/maestro-analyze/SKILL.md +44 -5
  71. package/.codex/skills/maestro-blueprint/SKILL.md +5 -0
  72. package/.codex/skills/maestro-brainstorm/SKILL.md +46 -0
  73. package/.codex/skills/maestro-execute/SKILL.md +61 -5
  74. package/.codex/skills/maestro-milestone-audit/SKILL.md +64 -13
  75. package/.codex/skills/maestro-milestone-complete/SKILL.md +12 -0
  76. package/.codex/skills/maestro-next/SKILL.md +297 -0
  77. package/.codex/skills/maestro-plan/SKILL.md +36 -1
  78. package/.codex/skills/maestro-player/SKILL.md +25 -6
  79. package/.codex/skills/maestro-ralph/SKILL.md +17 -10
  80. package/.codex/skills/maestro-ralph-execute/SKILL.md +2 -1
  81. package/.codex/skills/maestro-roadmap/SKILL.md +35 -4
  82. package/.codex/skills/maestro-ui-codify/SKILL.md +38 -10
  83. package/.codex/skills/maestro-verify/SKILL.md +40 -5
  84. package/.codex/skills/manage-codebase-rebuild/SKILL.md +52 -5
  85. package/.codex/skills/manage-issue-discover/SKILL.md +106 -15
  86. package/.codex/skills/quality-auto-test/SKILL.md +70 -16
  87. package/.codex/skills/quality-debug/SKILL.md +139 -28
  88. package/.codex/skills/quality-refactor/SKILL.md +61 -11
  89. package/.codex/skills/quality-review/SKILL.md +45 -9
  90. package/.codex/skills/quality-test/SKILL.md +58 -3
  91. package/.codex/skills/security-audit/SKILL.md +38 -0
  92. package/.codex/skills/spec-map/SKILL.md +65 -8
  93. package/.codex/skills/team-coordinate/SKILL.md +28 -11
  94. package/.codex/skills/team-coordinate/specs/role-catalog.md +20 -0
  95. package/.codex/skills/team-lifecycle-v4/SKILL.md +23 -7
  96. package/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md +20 -0
  97. package/.codex/skills/team-quality-assurance/SKILL.md +40 -2
  98. package/.codex/skills/team-review/SKILL.md +42 -2
  99. package/.codex/skills/team-tech-debt/SKILL.md +45 -2
  100. package/.codex/skills/team-testing/SKILL.md +42 -2
  101. package/dashboard/dist-server/dashboard/src/server/wiki/search.d.ts +6 -4
  102. package/dashboard/dist-server/dashboard/src/server/wiki/search.js +50 -8
  103. package/dashboard/dist-server/dashboard/src/server/wiki/search.js.map +1 -1
  104. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.d.ts +32 -0
  105. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js +294 -0
  106. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js.map +1 -1
  107. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +1 -0
  108. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +35 -1
  109. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  110. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js +235 -0
  111. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js.map +1 -1
  112. package/dist/src/commands/install.js +5 -1
  113. package/dist/src/commands/install.js.map +1 -1
  114. package/dist/src/i18n/locales/en.d.ts.map +1 -1
  115. package/dist/src/i18n/locales/en.js +9 -0
  116. package/dist/src/i18n/locales/en.js.map +1 -1
  117. package/dist/src/i18n/locales/zh.d.ts.map +1 -1
  118. package/dist/src/i18n/locales/zh.js +9 -0
  119. package/dist/src/i18n/locales/zh.js.map +1 -1
  120. package/dist/src/i18n/types.d.ts +3 -0
  121. package/dist/src/i18n/types.d.ts.map +1 -1
  122. package/dist/src/ralph/cmd-check.js +1 -1
  123. package/dist/src/ralph/cmd-check.js.map +1 -1
  124. package/dist/src/ralph/cmd-complete.js +1 -1
  125. package/dist/src/ralph/cmd-complete.js.map +1 -1
  126. package/dist/src/ralph/cmd-next.d.ts.map +1 -1
  127. package/dist/src/ralph/cmd-next.js +12 -4
  128. package/dist/src/ralph/cmd-next.js.map +1 -1
  129. package/dist/src/ralph/cmd-session.js +2 -2
  130. package/dist/src/ralph/cmd-session.js.map +1 -1
  131. package/dist/src/ralph/status-store.d.ts +8 -1
  132. package/dist/src/ralph/status-store.d.ts.map +1 -1
  133. package/dist/src/ralph/status-store.js +12 -2
  134. package/dist/src/ralph/status-store.js.map +1 -1
  135. package/dist/src/tools/store-knowhow.d.ts.map +1 -1
  136. package/dist/src/tools/store-knowhow.js +51 -64
  137. package/dist/src/tools/store-knowhow.js.map +1 -1
  138. package/dist/src/tui/install-ui/HooksConfig.d.ts +5 -1
  139. package/dist/src/tui/install-ui/HooksConfig.d.ts.map +1 -1
  140. package/dist/src/tui/install-ui/HooksConfig.js +5 -3
  141. package/dist/src/tui/install-ui/HooksConfig.js.map +1 -1
  142. package/dist/src/tui/install-ui/InstallConfirm.d.ts +2 -0
  143. package/dist/src/tui/install-ui/InstallConfirm.d.ts.map +1 -1
  144. package/dist/src/tui/install-ui/InstallConfirm.js +1 -1
  145. package/dist/src/tui/install-ui/InstallConfirm.js.map +1 -1
  146. package/dist/src/tui/install-ui/InstallExecution.d.ts +1 -0
  147. package/dist/src/tui/install-ui/InstallExecution.d.ts.map +1 -1
  148. package/dist/src/tui/install-ui/InstallExecution.js +26 -3
  149. package/dist/src/tui/install-ui/InstallExecution.js.map +1 -1
  150. package/dist/src/tui/install-ui/InstallFlow.d.ts +1 -1
  151. package/dist/src/tui/install-ui/InstallFlow.d.ts.map +1 -1
  152. package/dist/src/tui/install-ui/InstallFlow.js +76 -16
  153. package/dist/src/tui/install-ui/InstallFlow.js.map +1 -1
  154. package/dist/src/tui/install-ui/InstallHub.d.ts +2 -0
  155. package/dist/src/tui/install-ui/InstallHub.d.ts.map +1 -1
  156. package/dist/src/tui/install-ui/InstallHub.js +8 -0
  157. package/dist/src/tui/install-ui/InstallHub.js.map +1 -1
  158. package/dist/src/tui/install-ui/InstallResult.d.ts.map +1 -1
  159. package/dist/src/tui/install-ui/InstallResult.js +1 -1
  160. package/dist/src/tui/install-ui/InstallResult.js.map +1 -1
  161. package/dist/src/utils/update-notices.js +23 -0
  162. package/dist/src/utils/update-notices.js.map +1 -1
  163. package/package.json +1 -1
  164. package/workflows/finish-work.md +119 -0
  165. package/workflows/milestone-complete.md +23 -1
@@ -61,10 +61,10 @@ $spec-map --continue "20260318-map-auth"
61
61
 
62
62
  ```csv
63
63
  id,title,description,focus_area,output_file,deps,context_from,wave,status,findings,error
64
- "1","Tech Stack Analysis","Analyze languages, frameworks, dependencies, build system, package managers, runtime configuration. Scan package.json, build configs, CI/CD files.","full","tech-stack.md","","","1","","",""
65
- "2","Architecture Analysis","Analyze project structure, module boundaries, layer architecture, data flow patterns, entry points, API surface. Map directory tree and import graph.","full","architecture.md","","","1","","",""
66
- "3","Features Analysis","Inventory user-facing capabilities, API endpoints, CLI commands, UI components, background jobs, integrations. Map to source locations.","full","features.md","","","1","","",""
67
- "4","Cross-cutting Concerns","Analyze error handling patterns, logging strategy, authentication/authorization, configuration management, testing approach, observability.","full","concerns.md","","","1","","",""
64
+ "1","Tech Stack Analysis","Analyze languages, frameworks, dependencies, build system, package managers, runtime configuration. Scan package.json, build configs, CI/CD files.","full","tech-stack.md","","","1","pending","",""
65
+ "2","Architecture Analysis","Analyze project structure, module boundaries, layer architecture, data flow patterns, entry points, API surface. Map directory tree and import graph.","full","architecture.md","","","1","pending","",""
66
+ "3","Features Analysis","Inventory user-facing capabilities, API endpoints, CLI commands, UI components, background jobs, integrations. Map to source locations.","full","features.md","","","1","pending","",""
67
+ "4","Cross-cutting Concerns","Analyze error handling patterns, logging strategy, authentication/authorization, configuration management, testing approach, observability.","full","concerns.md","","","1","pending","",""
68
68
  ```
69
69
 
70
70
  **Columns**:
@@ -79,9 +79,11 @@ id,title,description,focus_area,output_file,deps,context_from,wave,status,findin
79
79
  | `deps` | Input | Empty (all independent) |
80
80
  | `context_from` | Input | Empty (no cross-task context) |
81
81
  | `wave` | Computed | Always 1 (single wave) |
82
- | `status` | Output | pending/completed/failed/skipped |
83
- | `findings` | Output | Analysis summary (max 500 chars) |
84
- | `error` | Output | Error if failed |
82
+ | `status` | Lifecycle | `pending` (initial) → `completed`/`failed`/`skipped` (set by merge step from worker's `result_status`) |
83
+ | `findings` | Lifecycle | Analysis summary (max 500 chars; merged from worker output) |
84
+ | `error` | Lifecycle | Error if failed (merged) |
85
+
86
+ **Column separation rule**: Wave CSV (input to `spawn_agents_on_csv`) contains Input columns only. Workers return Output columns exclusively via `output_schema` using `result_status` (NOT `status`). Merge maps `result_status` → master `status`.
85
87
 
86
88
  </csv_schema>
87
89
 
@@ -106,7 +108,62 @@ Generate 4 mapper rows. If focus area specified, scope descriptions to that area
106
108
 
107
109
  ### Phase 2: Wave Execution
108
110
 
109
- Single wave -- all 4 mappers via `spawn_agents_on_csv` (max_concurrency: 4, 3600s timeout). Each agent returns: id, status (completed/failed), findings, error.
111
+ Single wave -- all 4 mappers via `spawn_agents_on_csv`:
112
+
113
+ ```javascript
114
+ spawn_agents_on_csv({
115
+ csv_path: `${sessionFolder}/wave-1.csv`, // only rows where status == "pending"
116
+ id_column: "id",
117
+ instruction: MAPPER_INSTRUCTION, // see "Mapper Worker Contract" below
118
+ max_concurrency: 4,
119
+ max_runtime_seconds: 3600,
120
+ output_csv_path: `${sessionFolder}/wave-1-results.csv`,
121
+ output_schema: {
122
+ type: "object",
123
+ properties: {
124
+ id: { type: "string" },
125
+ result_status: { type: "string", enum: ["completed", "failed"] },
126
+ findings: { type: "string", maxLength: 500 },
127
+ error: { type: "string" }
128
+ },
129
+ required: ["id", "result_status", "findings"]
130
+ }
131
+ })
132
+ ```
133
+
134
+ Merge: write `master.status = result_status`, copy `findings` and `error`. Delete `wave-1.csv` and `wave-1-results.csv`.
135
+
136
+ #### Mapper Worker Contract (MAPPER_INSTRUCTION)
137
+
138
+ ```
139
+ You are a codebase mapper for ONE dimension. Your assigned focus_area, description, and output_file come from your CSV row.
140
+
141
+ REQUIRED STEPS:
142
+ 1. Read shared discoveries: {sessionFolder}/discoveries.ndjson (may be empty)
143
+ 2. Scan codebase using Read/Grep/Glob within your focus_area
144
+ 3. Synthesize findings into the analysis sections required by your description
145
+ 4. Append reusable discoveries (tech_stack / code_pattern / integration_point / convention) to discoveries.ndjson
146
+ 5. Call report_agent_job_result EXACTLY ONCE
147
+
148
+ TERMINATION CONTRACT (mandatory — NO worker may end without calling report_agent_job_result):
149
+ - Success path → result_status = completed
150
+ - Timeout path → if approaching max_runtime_seconds, STOP and report failed with error="timeout (partial findings)"
151
+ - Failure path → on unrecoverable error, report failed with error message
152
+ - NEVER continue indefinitely. NEVER exit silently. NEVER omit the call.
153
+
154
+ OUTPUT (return via report_agent_job_result; must match output_schema):
155
+ {
156
+ "id": "<your row id>",
157
+ "result_status": "completed" | "failed",
158
+ "findings": "<analysis summary, max 500 chars — orchestrator uses this to write {output_file}>",
159
+ "error": "<message if failed, else empty>"
160
+ }
161
+
162
+ CONSTRAINTS:
163
+ - Read-only. Do NOT write to .workflow/codebase/ — orchestrator writes output files from your findings in Phase 3.
164
+ - Do NOT write to tasks.csv, wave-*.csv, or results.csv.
165
+ - Do NOT call spawn_agents_on_csv (no recursion).
166
+ ```
110
167
 
111
168
  ### Phase 3: Write Output Files
112
169
 
@@ -303,18 +303,22 @@ Extract qualifying rows from master CSV. Add `prev_context` column.
303
303
 
304
304
  ```javascript
305
305
  spawn_agents_on_csv({
306
- csv_path: `${sessionFolder}/wave-${N}.csv`,
306
+ csv_path: `${sessionFolder}/wave-${N}.csv`, // only rows where wave==N AND status=="pending"
307
307
  id_column: "id",
308
- instruction: /* see Instruction Builder section below */,
308
+ instruction: TEAM_COORDINATE_INSTRUCTION, // see "Instruction Builder" section below
309
309
  max_concurrency: maxConcurrency,
310
310
  max_runtime_seconds: 3600,
311
311
  output_csv_path: `${sessionFolder}/wave-${N}-results.csv`,
312
312
  output_schema: {
313
- id, // mandatory: links to master CSV
314
- result_status, // mandatory: completed | failed | blocked
315
- findings, // key findings (max 500 chars)
316
- files_modified, // semicolon-separated paths
317
- error // error message if not completed
313
+ type: "object",
314
+ properties: {
315
+ id: { type: "string" },
316
+ result_status: { type: "string", enum: ["completed", "failed", "blocked"] },
317
+ findings: { type: "string", maxLength: 500 },
318
+ files_modified: { type: "string", description: "Semicolon-separated paths" },
319
+ error: { type: "string" }
320
+ },
321
+ required: ["id", "result_status", "findings"]
318
322
  }
319
323
  })
320
324
  ```
@@ -409,12 +413,25 @@ Append findings as NDJSON lines:
409
413
  {"ts":"<ISO>","worker":"<TASK-ID>","type":"<TYPE>","data":{...}}
410
414
  Types: code_pattern, integration_point, convention, blocker, key_finding, decision
411
415
 
416
+ ## Termination Contract (MANDATORY)
417
+ You MUST call report_agent_job_result EXACTLY ONCE before exiting. NO exceptions.
418
+ - Success path → result_status=completed after verification passes
419
+ - Failure path → unrecoverable error (build fails, scope unclear, contract violation) → result_status=failed with error message
420
+ - Blocked path → cannot proceed without upstream fix → result_status=blocked with error explaining what is needed
421
+ - Timeout path → approaching max_runtime_seconds → revert partial unsafe work, report blocked with error="timeout"
422
+ - NEVER continue indefinitely. NEVER exit silently. NEVER omit the call.
423
+
412
424
  ## Output
413
- Return via output_schema:
414
- - result_status: completed | failed | blocked
425
+ Return via output_schema (matches schema declared in spawn call):
426
+ - id: your CSV row id (mandatory)
427
+ - result_status: completed | failed | blocked (mandatory)
415
428
  - findings: key findings summary (max 500 chars, be specific and actionable)
416
- - files_modified: semicolon-separated paths of created/modified files
417
- - error: error message if result_status is not completed
429
+ - files_modified: semicolon-separated paths of created/modified files (empty if none)
430
+ - error: error message if result_status is not completed (empty otherwise)
431
+
432
+ ## Hard Constraints
433
+ - Do NOT write to tasks.csv, wave-*.csv, results.csv (orchestrator owns those).
434
+ - Do NOT call spawn_agents_on_csv (no recursion).
418
435
  ```
419
436
 
420
437
  </actions>
@@ -80,6 +80,26 @@ All agents — regardless of dynamically assigned role — MUST follow these tra
80
80
  - 2 retries exhausted → report `failed` with evidence
81
81
  - NEVER skip verification and report completed
82
82
 
83
+ ### Termination Contract (MANDATORY)
84
+
85
+ Every spawned worker MUST call `report_agent_job_result` EXACTLY ONCE before exiting. NO exceptions:
86
+
87
+ | Path | Action |
88
+ |------|--------|
89
+ | Success | `result_status=completed` after verification passes |
90
+ | Failure | `result_status=failed` with error message (build error, file write failure, unrecoverable tool error) |
91
+ | Blocked | `result_status=blocked` when upstream missing OR retries exhausted |
92
+ | Timeout | Approaching `max_runtime_seconds` → revert partial unsafe work → `result_status=blocked` with error="timeout" |
93
+
94
+ - NEVER continue indefinitely.
95
+ - NEVER exit silently.
96
+ - NEVER omit `report_agent_job_result`.
97
+
98
+ ### Hard Constraints
99
+
100
+ - Do NOT write to `tasks.csv`, `wave-*.csv`, `results.csv` — orchestrator owns those.
101
+ - Do NOT call `spawn_agents_on_csv` (no recursion).
102
+
83
103
  ## 6. Quality Scoring
84
104
 
85
105
  | Result | Score | Action |
@@ -302,19 +302,23 @@ Extract wave N rows + add `prev_context` column.
302
302
 
303
303
  ```javascript
304
304
  spawn_agents_on_csv({
305
- csv_path: `${sessionFolder}/wave-${N}.csv`,
305
+ csv_path: `${sessionFolder}/wave-${N}.csv`, // only rows where wave==N AND status=="pending"
306
306
  id_column: "id",
307
307
  instruction: buildLifecycleInstruction(sessionFolder, skillRoot),
308
308
  max_concurrency: maxConcurrency,
309
309
  max_runtime_seconds: 3600,
310
310
  output_csv_path: `${sessionFolder}/wave-${N}-results.csv`,
311
311
  output_schema: {
312
- id,
313
- result_status, // completed | failed | blocked
314
- findings, // key findings (max 500 chars)
315
- files_modified, // semicolon-separated paths
316
- quality_score, // 0-100
317
- error // error message
312
+ type: "object",
313
+ properties: {
314
+ id: { type: "string" },
315
+ result_status: { type: "string", enum: ["completed", "failed", "blocked"] },
316
+ findings: { type: "string", maxLength: 500 },
317
+ files_modified: { type: "string", description: "Semicolon-separated paths" },
318
+ quality_score: { type: "string", description: "0-100" },
319
+ error: { type: "string" }
320
+ },
321
+ required: ["id", "result_status", "findings"]
318
322
  }
319
323
  })
320
324
  ```
@@ -363,6 +367,18 @@ For roles with commands/ subdirectory, load the relevant command file based on y
363
367
  3. Retry on verification failure (max 2 retries)
364
368
  4. Report blocked if still failing after retries
365
369
 
370
+ ## Termination Contract (MANDATORY)
371
+ You MUST call report_agent_job_result EXACTLY ONCE before exiting. NO exceptions.
372
+ - Success → result_status=completed after all verifications pass
373
+ - Failure → result_status=failed with error message (build error, file write fail)
374
+ - Blocked → result_status=blocked when upstream missing OR after retries exhausted
375
+ - Timeout → near max_runtime_seconds → revert partial unsafe work → result_status=blocked, error="timeout"
376
+ - NEVER continue indefinitely. NEVER exit silently. NEVER omit the call.
377
+
378
+ ## Hard Constraints
379
+ - Do NOT write to tasks.csv, wave-*.csv, results.csv (orchestrator owns those).
380
+ - Do NOT call spawn_agents_on_csv (no recursion).
381
+
366
382
  ## Discovery Protocol
367
383
  Write task output to {sessionFolder}/discoveries/{task_id}.json:
368
384
  {
@@ -811,6 +811,24 @@ All roles read/write `{session}/discoveries.ndjson`:
811
811
 
812
812
  ---
813
813
 
814
+ ## Termination Contract (MANDATORY for ALL roles)
815
+
816
+ Every spawned worker — regardless of role — MUST call `report_agent_job_result` EXACTLY ONCE before exiting. NO exceptions:
817
+
818
+ | Path | Action |
819
+ |------|--------|
820
+ | Success | `status=completed` after verification passes |
821
+ | Failure | `status=failed` with error message (unrecoverable error) |
822
+ | Blocked | `status=failed` (no separate "blocked" enum here — use error message to explain blockage) |
823
+ | Timeout | Approaching `max_runtime_seconds` → revert partial unsafe work → `status=failed` with error="timeout" |
824
+
825
+ Rules:
826
+ - NEVER continue indefinitely.
827
+ - NEVER exit silently.
828
+ - NEVER omit `report_agent_job_result`.
829
+ - Do NOT write to tasks.csv, wave-*.csv, results.csv — orchestrator owns those.
830
+ - Do NOT call `spawn_agents_on_csv` (no recursion).
831
+
814
832
  ## Output Format
815
833
 
816
834
  All roles use `report_agent_job_result` with this schema:
@@ -825,3 +843,5 @@ All roles use `report_agent_job_result` with this schema:
825
843
  "error": ""
826
844
  }
827
845
  ```
846
+
847
+ Note: spawn output_schema in SKILL.md uses `result_status` (not `status`). The orchestrator's merge step maps `result_status` → master `status`. Workers report via `report_agent_job_result` which the harness converts to the CSV result row — the field key here (`status`) is the worker-facing field name documented for this skill family.
@@ -178,10 +178,48 @@ Session: {sessionFolder}
178
178
  Discovery board: {sessionFolder}/discoveries.ndjson
179
179
  Previous context: 'prev_context' column
180
180
 
181
- ## Output
182
- result_status, findings, files_modified, coverage_score (QARUN only), error
181
+ ## Termination Contract (MANDATORY)
182
+ You MUST call report_agent_job_result EXACTLY ONCE before exiting. NO exceptions.
183
+ - Success → result_status=completed
184
+ - Failure → result_status=failed with error message
185
+ - Blocked → result_status=blocked when upstream missing
186
+ - Timeout → near max_runtime_seconds → result_status=blocked, error="timeout"
187
+ - NEVER continue indefinitely. NEVER exit silently. NEVER omit the call.
188
+
189
+ ## Output (must match output_schema)
190
+ {
191
+ "id": "<your CSV row id>",
192
+ "result_status": "completed" | "failed" | "blocked",
193
+ "findings": "<key findings, max 500 chars>",
194
+ "files_modified": "<semicolon-separated paths or empty>",
195
+ "coverage_score": "<0-100 or empty>" (QARUN only),
196
+ "error": "<message if not completed>"
197
+ }
198
+
199
+ ## Hard Constraints
200
+ - Do NOT write to tasks.csv, wave-*.csv, results.csv (orchestrator owns those).
201
+ - Do NOT call spawn_agents_on_csv (no recursion).
183
202
  ```
184
203
 
204
+ ### Spawn output_schema
205
+
206
+ ```json
207
+ {
208
+ "type": "object",
209
+ "properties": {
210
+ "id": { "type": "string" },
211
+ "result_status": { "type": "string", "enum": ["completed", "failed", "blocked"] },
212
+ "findings": { "type": "string", "maxLength": 500 },
213
+ "files_modified": { "type": "string" },
214
+ "coverage_score": { "type": "string" },
215
+ "error": { "type": "string" }
216
+ },
217
+ "required": ["id", "result_status", "findings"]
218
+ }
219
+ ```
220
+
221
+ Merge maps `result_status` → master `status`.
222
+
185
223
  </actions>
186
224
  </state_machine>
187
225
 
@@ -172,10 +172,50 @@ Discovery board: {sessionFolder}/discoveries.ndjson
172
172
  Previous context: 'prev_context' column
173
173
  Dimensions: {skillRoot}/specs/dimensions.md
174
174
 
175
- ## Output
176
- result_status, findings, files_modified, finding_count, verdict (REV only), error
175
+ ## Termination Contract (MANDATORY)
176
+ You MUST call report_agent_job_result EXACTLY ONCE before exiting. NO exceptions.
177
+ - Success → result_status=completed after scan/review/fix completes
178
+ - Failure → result_status=failed with error message
179
+ - Blocked → result_status=blocked when upstream missing
180
+ - Timeout → near max_runtime_seconds → result_status=blocked, error="timeout"
181
+ - NEVER continue indefinitely. NEVER exit silently. NEVER omit the call.
182
+
183
+ ## Output (must match output_schema)
184
+ {
185
+ "id": "<your CSV row id>",
186
+ "result_status": "completed" | "failed" | "blocked",
187
+ "findings": "<key findings, max 500 chars>",
188
+ "files_modified": "<semicolon-separated paths or empty>",
189
+ "finding_count": "<integer or empty>",
190
+ "verdict": "PASS" | "WARN" | "BLOCK" | "" (REV only),
191
+ "error": "<message if not completed>"
192
+ }
193
+
194
+ ## Hard Constraints
195
+ - Do NOT write to tasks.csv, wave-*.csv, results.csv (orchestrator owns those).
196
+ - Do NOT call spawn_agents_on_csv (no recursion).
177
197
  ```
178
198
 
199
+ ### Spawn output_schema
200
+
201
+ ```json
202
+ {
203
+ "type": "object",
204
+ "properties": {
205
+ "id": { "type": "string" },
206
+ "result_status": { "type": "string", "enum": ["completed", "failed", "blocked"] },
207
+ "findings": { "type": "string", "maxLength": 500 },
208
+ "files_modified": { "type": "string" },
209
+ "finding_count": { "type": "string" },
210
+ "verdict": { "type": "string", "enum": ["PASS", "WARN", "BLOCK", ""] },
211
+ "error": { "type": "string" }
212
+ },
213
+ "required": ["id", "result_status", "findings"]
214
+ }
215
+ ```
216
+
217
+ Merge maps `result_status` → master `status`.
218
+
179
219
  </actions>
180
220
  </state_machine>
181
221
 
@@ -187,10 +187,53 @@ Session: {sessionFolder}
187
187
  Discovery board: {sessionFolder}/discoveries.ndjson
188
188
  Previous context: 'prev_context' column
189
189
 
190
- ## Output
191
- result_status, findings, files_modified, debt_count, regression_detected (TDVAL), error
190
+ ## Termination Contract (MANDATORY)
191
+ You MUST call report_agent_job_result EXACTLY ONCE before exiting. NO exceptions.
192
+ - Success → result_status=completed after verification
193
+ - Failure → result_status=failed with error message
194
+ - Blocked → cannot proceed without upstream fix → result_status=blocked
195
+ - Timeout → near max_runtime_seconds → revert partial unsafe work → result_status=blocked, error="timeout"
196
+ - NEVER continue indefinitely. NEVER exit silently. NEVER omit the call.
197
+
198
+ ## Output (must match output_schema)
199
+ Return JSON:
200
+ {
201
+ "id": "<your CSV row id>",
202
+ "result_status": "completed" | "failed" | "blocked",
203
+ "findings": "<key findings, max 500 chars>",
204
+ "files_modified": "<semicolon-separated paths or empty>",
205
+ "debt_count": <integer or empty>,
206
+ "regression_detected": "true" | "false" | "" (TDVAL only),
207
+ "error": "<message if not completed>"
208
+ }
209
+
210
+ ## Hard Constraints
211
+ - Do NOT write to tasks.csv, wave-*.csv, results.csv (orchestrator owns those).
212
+ - Do NOT call spawn_agents_on_csv (no recursion).
192
213
  ```
193
214
 
215
+ ### Spawn output_schema
216
+
217
+ When the coordinator dispatches a wave via `spawn_agents_on_csv`, it MUST use the strict JSON Schema:
218
+
219
+ ```json
220
+ {
221
+ "type": "object",
222
+ "properties": {
223
+ "id": { "type": "string" },
224
+ "result_status": { "type": "string", "enum": ["completed", "failed", "blocked"] },
225
+ "findings": { "type": "string", "maxLength": 500 },
226
+ "files_modified": { "type": "string" },
227
+ "debt_count": { "type": "string" },
228
+ "regression_detected": { "type": "string", "enum": ["true", "false", ""] },
229
+ "error": { "type": "string" }
230
+ },
231
+ "required": ["id", "result_status", "findings"]
232
+ }
233
+ ```
234
+
235
+ Merge maps `result_status` → master `status`.
236
+
194
237
  </actions>
195
238
  </state_machine>
196
239
 
@@ -183,10 +183,50 @@ Session: {sessionFolder}
183
183
  Discovery board: {sessionFolder}/discoveries.ndjson
184
184
  Previous context: 'prev_context' column
185
185
 
186
- ## Output
187
- result_status, findings, files_modified, pass_rate (TESTRUN), coverage_score (TESTRUN), error
186
+ ## Termination Contract (MANDATORY)
187
+ You MUST call report_agent_job_result EXACTLY ONCE before exiting. NO exceptions.
188
+ - Success → result_status=completed after tests run / coverage measured
189
+ - Failure → result_status=failed with error message
190
+ - Blocked → cannot proceed without upstream fix → result_status=blocked
191
+ - Timeout → near max_runtime_seconds → result_status=blocked, error="timeout"
192
+ - NEVER continue indefinitely. NEVER exit silently. NEVER omit the call.
193
+
194
+ ## Output (must match output_schema)
195
+ {
196
+ "id": "<your CSV row id>",
197
+ "result_status": "completed" | "failed" | "blocked",
198
+ "findings": "<key findings, max 500 chars>",
199
+ "files_modified": "<semicolon-separated paths or empty>",
200
+ "pass_rate": "<0-100 or empty>" (TESTRUN only),
201
+ "coverage_score": "<0-100 or empty>" (TESTRUN only),
202
+ "error": "<message if not completed>"
203
+ }
204
+
205
+ ## Hard Constraints
206
+ - Do NOT write to tasks.csv, wave-*.csv, results.csv (orchestrator owns those).
207
+ - Do NOT call spawn_agents_on_csv (no recursion).
188
208
  ```
189
209
 
210
+ ### Spawn output_schema
211
+
212
+ ```json
213
+ {
214
+ "type": "object",
215
+ "properties": {
216
+ "id": { "type": "string" },
217
+ "result_status": { "type": "string", "enum": ["completed", "failed", "blocked"] },
218
+ "findings": { "type": "string", "maxLength": 500 },
219
+ "files_modified": { "type": "string" },
220
+ "pass_rate": { "type": "string" },
221
+ "coverage_score": { "type": "string" },
222
+ "error": { "type": "string" }
223
+ },
224
+ "required": ["id", "result_status", "findings"]
225
+ }
226
+ ```
227
+
228
+ Merge maps `result_status` → master `status`.
229
+
190
230
  </actions>
191
231
  </state_machine>
192
232
 
@@ -14,11 +14,13 @@ export interface SearchResult {
14
14
  score: number;
15
15
  }
16
16
  /**
17
- * Tokenize into lowercase terms. Strips non-word chars, drops tokens shorter
18
- * than 2 characters, and filters a tiny English stop-word set.
17
+ * Tokenize into lowercase terms. Strategy:
18
+ * 1. Lowercase, split on non-word chars (\p{L}\p{N})
19
+ * 2. For each chunk: if contains CJK → emit 2/3-char n-grams; otherwise
20
+ * keep the chunk if it passes length + stop-word filters.
19
21
  *
20
- * CJK characters are not split by this regex; callers searching Chinese
21
- * corpora should feed substrings directly ranking is approximate then.
22
+ * Query and document use the same function so n-grams from both sides
23
+ * intersect in the inverted index BM25 ranking works for CJK corpora.
22
24
  */
23
25
  export declare function tokenize(text: string): string[];
24
26
  export declare function buildInvertedIndex(entries: WikiEntry[]): InvertedIndex;
@@ -9,12 +9,36 @@ const STOP_WORDS = new Set([
9
9
  'is', 'it', 'with', 'as', 'at', 'by', 'be', 'are', 'was', 'were',
10
10
  'this', 'that', 'from', 'but', 'not',
11
11
  ]);
12
+ // CJK character range: CJK Unified Ideographs + CJK Extension A.
13
+ // Used to detect runs that need n-gram splitting (BM25 can't match
14
+ // otherwise — a single 4-char Chinese term would never overlap a 2-char
15
+ // query substring). Hiragana/katakana/hangul are out of scope for now.
16
+ const CJK_RUN = /[一-鿿㐀-䶿]+/g;
17
+ const HAS_CJK = /[一-鿿㐀-䶿]/;
12
18
  /**
13
- * Tokenize into lowercase terms. Strips non-word chars, drops tokens shorter
14
- * than 2 characters, and filters a tiny English stop-word set.
19
+ * Extract 2- and 3-char n-grams from a CJK run. 2/3 covers the majority of
20
+ * Chinese terms while keeping the inverted index size bounded; 4+ grams
21
+ * explode postings without proportional recall gain.
22
+ */
23
+ function cjkNgrams(run) {
24
+ const out = [];
25
+ for (let n = 2; n <= 3; n++) {
26
+ if (run.length < n)
27
+ break;
28
+ for (let i = 0; i <= run.length - n; i++) {
29
+ out.push(run.substring(i, i + n));
30
+ }
31
+ }
32
+ return out;
33
+ }
34
+ /**
35
+ * Tokenize into lowercase terms. Strategy:
36
+ * 1. Lowercase, split on non-word chars (\p{L}\p{N})
37
+ * 2. For each chunk: if contains CJK → emit 2/3-char n-grams; otherwise
38
+ * keep the chunk if it passes length + stop-word filters.
15
39
  *
16
- * CJK characters are not split by this regex; callers searching Chinese
17
- * corpora should feed substrings directly ranking is approximate then.
40
+ * Query and document use the same function so n-grams from both sides
41
+ * intersect in the inverted index BM25 ranking works for CJK corpora.
18
42
  */
19
43
  export function tokenize(text) {
20
44
  if (!text)
@@ -22,11 +46,29 @@ export function tokenize(text) {
22
46
  const out = [];
23
47
  const parts = text.toLowerCase().split(/[^\p{L}\p{N}]+/u);
24
48
  for (const p of parts) {
25
- if (p.length < 2)
26
- continue;
27
- if (STOP_WORDS.has(p))
49
+ if (!p)
28
50
  continue;
29
- out.push(p);
51
+ if (HAS_CJK.test(p)) {
52
+ // A chunk may mix CJK and Latin (e.g. "用户auth"); slice each CJK run
53
+ // for n-gram emission and keep any Latin remainder as its own token.
54
+ const cjkRuns = p.match(CJK_RUN) ?? [];
55
+ for (const run of cjkRuns) {
56
+ for (const g of cjkNgrams(run))
57
+ out.push(g);
58
+ }
59
+ const latinRemainder = p.replace(CJK_RUN, ' ').split(/\s+/).filter(Boolean);
60
+ for (const lr of latinRemainder) {
61
+ if (lr.length >= 2 && !STOP_WORDS.has(lr))
62
+ out.push(lr);
63
+ }
64
+ }
65
+ else {
66
+ if (p.length < 2)
67
+ continue;
68
+ if (STOP_WORDS.has(p))
69
+ continue;
70
+ out.push(p);
71
+ }
30
72
  }
31
73
  return out;
32
74
  }
@@ -1 +1 @@
1
- {"version":3,"file":"search.js","sourceRoot":"","sources":["../../../../../src/server/wiki/search.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,GAAmB,EAAE,CAAC;IAClC,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM;QAAE,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACnE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3E,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAChC,CAAC"}
@@ -1,3 +1,35 @@
1
1
  import type { WikiEntry } from './wiki-types.js';
2
2
  export declare function adaptIssueRow(row: unknown, sourcePath: string, line: number): WikiEntry | null;
3
3
  export declare function loadVirtualEntries(absPath: string, adapter: (row: unknown, sourcePath: string, line: number) => WikiEntry | null, relPath: string): Promise<WikiEntry[]>;
4
+ export declare function loadVirtualJsonEntries(absPath: string, adapter: (parsed: unknown, sourcePath: string) => WikiEntry[], relPath: string): Promise<WikiEntry[]>;
5
+ export declare function adaptCodebaseDocIndex(parsed: unknown, sourcePath: string): WikiEntry[];
6
+ interface ContextPackageInsight {
7
+ role?: string;
8
+ area?: string;
9
+ summary?: string;
10
+ }
11
+ interface ContextPackageConstraint {
12
+ area?: string;
13
+ }
14
+ interface ContextPackagePeek {
15
+ insights?: ContextPackageInsight[];
16
+ constraints?: ContextPackageConstraint[];
17
+ open_questions?: unknown[];
18
+ requirements?: unknown[];
19
+ domain?: {
20
+ problem_statement?: string;
21
+ };
22
+ }
23
+ /**
24
+ * Adapter for session archive.json files. Returns the lazy reader pattern:
25
+ * pass `peekContextPackage` to enrich summary/tags from context-package.json
26
+ * sibling. If unavailable, archive metadata alone is used.
27
+ */
28
+ export declare function adaptSessionArchive(parsed: unknown, sourcePath: string, peek?: ContextPackagePeek | null): WikiEntry[];
29
+ /**
30
+ * Reads archive.json + optional sibling context-package.json (for summary
31
+ * enrichment) and returns adapted WikiEntries. Tolerates missing/malformed
32
+ * context-package — only archive.json is required.
33
+ */
34
+ export declare function loadSessionArchiveEntries(archiveAbsPath: string, archiveRelPath: string): Promise<WikiEntry[]>;
35
+ export {};