@namch/agent-assistant 1.3.0 → 1.3.2

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 (142) hide show
  1. package/CHANGELOG.md +24 -1
  2. package/README.md +3 -4
  3. package/agents/backend-engineer.md +3 -3
  4. package/agents/brainstormer.md +3 -3
  5. package/agents/business-analyst.md +3 -3
  6. package/agents/database-architect.md +3 -3
  7. package/agents/debugger.md +2 -2
  8. package/agents/designer.md +2 -2
  9. package/agents/devops-engineer.md +2 -2
  10. package/agents/docs-manager.md +23 -15
  11. package/agents/frontend-engineer.md +3 -3
  12. package/agents/game-engineer.md +3 -3
  13. package/agents/mobile-engineer.md +4 -4
  14. package/agents/performance-engineer.md +3 -3
  15. package/agents/planner.md +4 -4
  16. package/agents/project-manager.md +3 -3
  17. package/agents/researcher.md +3 -3
  18. package/agents/reviewer.md +3 -3
  19. package/agents/scouter.md +3 -3
  20. package/agents/security-engineer.md +3 -3
  21. package/agents/tech-lead.md +3 -3
  22. package/agents/tester.md +2 -2
  23. package/code-assistants/codex-assistant/CODEX.md +1 -2
  24. package/commands/ask/hard.md +1 -1
  25. package/commands/brainstorm/hard.md +1 -1
  26. package/commands/code/hard.md +1 -1
  27. package/commands/code.md +2 -7
  28. package/commands/cook/hard.md +1 -1
  29. package/commands/cook.md +1 -6
  30. package/commands/debug/hard.md +1 -1
  31. package/commands/debug.md +1 -6
  32. package/commands/design/hard.md +1 -1
  33. package/commands/design.md +1 -6
  34. package/commands/docs/audit.md +554 -78
  35. package/commands/docs/business.md +392 -76
  36. package/commands/docs/core.md +573 -74
  37. package/commands/docs.md +62 -61
  38. package/commands/fix/hard.md +1 -1
  39. package/commands/fix.md +1 -6
  40. package/commands/plan/hard.md +1 -1
  41. package/commands/plan.md +1 -6
  42. package/commands/report/fast.md +2 -2
  43. package/commands/report/hard.md +1 -1
  44. package/commands/report.md +2 -7
  45. package/commands/review/hard.md +1 -1
  46. package/commands/test/hard.md +1 -1
  47. package/commands/test.md +1 -6
  48. package/documents/HSOL-ASSESSMENT.md +6 -6
  49. package/documents/SMART-SKILL-ORCHESTRATION-BLUEPRINT.md +1 -1
  50. package/documents/business/business-features/00-index.md +101 -0
  51. package/documents/business/business-features/01-feature-inventory.md +341 -0
  52. package/documents/business/business-features/02-prioritization-moscow.md +148 -0
  53. package/documents/business/business-features/03-feature-specifications.md +511 -0
  54. package/documents/business/business-features/04-dependencies-and-release-sequencing.md +313 -0
  55. package/documents/business/business-features/05-success-metrics.md +290 -0
  56. package/documents/business/business-glossary/00-index.md +89 -0
  57. package/documents/business/business-glossary/01-canonical-terms.md +428 -0
  58. package/documents/business/business-glossary/02-synonyms-and-deprecated-terms.md +180 -0
  59. package/documents/business/business-glossary/03-domain-entities-and-events.md +395 -0
  60. package/documents/business/business-glossary/04-api-term-mapping.md +173 -0
  61. package/documents/business/business-prd/00-index.md +107 -0
  62. package/documents/business/business-prd/01-executive-summary.md +131 -0
  63. package/documents/business/business-prd/02-problem-goals-and-scope.md +204 -0
  64. package/documents/business/business-prd/03-stakeholders-and-requirements.md +210 -0
  65. package/documents/business/business-prd/04-acceptance-risks-assumptions.md +246 -0
  66. package/documents/business/business-workflows/00-index.md +107 -0
  67. package/documents/business/business-workflows/01-actor-map.md +303 -0
  68. package/documents/business/business-workflows/02-workflow-catalog.md +252 -0
  69. package/documents/business/business-workflows/03-detailed-workflows.md +641 -0
  70. package/documents/business/business-workflows/04-decision-rules-and-exceptions.md +216 -0
  71. package/documents/business/business-workflows/05-sla-and-handoffs.md +253 -0
  72. package/documents/knowledge-architecture/00-index.md +159 -0
  73. package/documents/knowledge-architecture/01-system-overview.md +240 -0
  74. package/documents/knowledge-architecture/02-components.md +419 -0
  75. package/documents/knowledge-architecture/03-data-flow.md +368 -0
  76. package/documents/knowledge-architecture/04-design-patterns.md +497 -0
  77. package/documents/knowledge-architecture/05-decisions.md +410 -0
  78. package/documents/knowledge-domain/00-index.md +251 -0
  79. package/documents/knowledge-domain/01-entities.md +582 -0
  80. package/documents/knowledge-domain/02-database-schema.md +138 -0
  81. package/documents/knowledge-domain/03-api-contracts.md +477 -0
  82. package/documents/knowledge-domain/04-business-rules.md +554 -0
  83. package/documents/knowledge-overview/00-index.md +107 -0
  84. package/documents/knowledge-overview/01-project-identity.md +162 -0
  85. package/documents/knowledge-overview/02-tech-stack.md +119 -0
  86. package/documents/knowledge-overview/03-features.md +232 -0
  87. package/documents/knowledge-overview/04-getting-started.md +394 -0
  88. package/documents/knowledge-source-base/00-index.md +107 -0
  89. package/documents/knowledge-source-base/01-directory-structure.md +312 -0
  90. package/documents/knowledge-source-base/02-entry-points.md +346 -0
  91. package/documents/knowledge-source-base/03-key-modules.md +581 -0
  92. package/documents/knowledge-source-base/04-configuration.md +467 -0
  93. package/documents/knowledge-standards/00-index.md +129 -0
  94. package/documents/knowledge-standards/01-code-style.md +161 -0
  95. package/documents/knowledge-standards/02-conventions.md +254 -0
  96. package/documents/knowledge-standards/03-git-workflow.md +228 -0
  97. package/documents/knowledge-standards/04-testing-standards.md +175 -0
  98. package/matrix-skills/_index.yaml +1 -1
  99. package/package.json +1 -1
  100. package/rules/AGENTS.md +1 -1
  101. package/rules/REFERENCE.md +18 -14
  102. package/rules/SKILLS.md +1 -1
  103. package/rules/TEAMS.md +1 -2
  104. package/skills/docs-audit/README.md +10 -8
  105. package/skills/docs-audit/SKILL.md +45 -41
  106. package/skills/docs-audit/references/scoring-framework.md +5 -5
  107. package/skills/docs-core/README.md +19 -14
  108. package/skills/docs-core/SKILL.md +189 -117
  109. package/skills/planning/references/codebase-understanding.md +5 -5
  110. package/code-assistants/codex-assistant/skills/agent-assistant-code-focus/SKILL.md +0 -18
  111. package/code-assistants/codex-assistant/skills/agent-assistant-code-focus/agents/openai.yaml +0 -4
  112. package/code-assistants/codex-assistant/skills/agent-assistant-cook-focus/SKILL.md +0 -18
  113. package/code-assistants/codex-assistant/skills/agent-assistant-cook-focus/agents/openai.yaml +0 -4
  114. package/code-assistants/codex-assistant/skills/agent-assistant-debug-focus/SKILL.md +0 -18
  115. package/code-assistants/codex-assistant/skills/agent-assistant-debug-focus/agents/openai.yaml +0 -4
  116. package/code-assistants/codex-assistant/skills/agent-assistant-design-focus/SKILL.md +0 -18
  117. package/code-assistants/codex-assistant/skills/agent-assistant-design-focus/agents/openai.yaml +0 -4
  118. package/code-assistants/codex-assistant/skills/agent-assistant-fix-focus/SKILL.md +0 -18
  119. package/code-assistants/codex-assistant/skills/agent-assistant-fix-focus/agents/openai.yaml +0 -4
  120. package/code-assistants/codex-assistant/skills/agent-assistant-plan-focus/SKILL.md +0 -18
  121. package/code-assistants/codex-assistant/skills/agent-assistant-plan-focus/agents/openai.yaml +0 -4
  122. package/code-assistants/codex-assistant/skills/agent-assistant-report-focus/SKILL.md +0 -18
  123. package/code-assistants/codex-assistant/skills/agent-assistant-report-focus/agents/openai.yaml +0 -4
  124. package/code-assistants/codex-assistant/skills/agent-assistant-test-focus/SKILL.md +0 -18
  125. package/code-assistants/codex-assistant/skills/agent-assistant-test-focus/agents/openai.yaml +0 -4
  126. package/commands/code/focus.md +0 -297
  127. package/commands/cook/focus.md +0 -209
  128. package/commands/debug/focus.md +0 -103
  129. package/commands/design/focus.md +0 -229
  130. package/commands/fix/focus.md +0 -145
  131. package/commands/plan/focus.md +0 -140
  132. package/commands/report/focus.md +0 -107
  133. package/commands/test/focus.md +0 -123
  134. package/documents/business/business-features.md +0 -894
  135. package/documents/business/business-glossary.md +0 -554
  136. package/documents/business/business-prd.md +0 -400
  137. package/documents/business/business-workflows.md +0 -713
  138. package/documents/knowledge-architecture.md +0 -621
  139. package/documents/knowledge-domain.md +0 -602
  140. package/documents/knowledge-overview.md +0 -316
  141. package/documents/knowledge-source-base.md +0 -581
  142. package/documents/knowledge-standards.md +0 -632
@@ -0,0 +1,641 @@
1
+ # Agent Assistant — Detailed Workflows
2
+
3
+ | Field | Value |
4
+ |-------|-------|
5
+ | **Purpose** | Step-by-step flow definitions with Mermaid diagrams, decision points, branching, and error paths |
6
+ | **Parent** | [00-index.md](00-index.md) |
7
+ | **Last Updated** | 2026-03-26 |
8
+ | **Generated By** | docs-business skill |
9
+
10
+ ---
11
+
12
+ ## BW-001 — Framework Installation
13
+
14
+ ### Narrative
15
+
16
+ The Framework User runs the CLI to install framework files into their AI coding assistant's configuration directory. The installer validates prerequisites, resolves target paths, copies files with placeholder replacement, and reports success or failure.
17
+
18
+ ### Steps
19
+
20
+ 1. User executes `agent-assistant install <tool>` or `agent-assistant install --all`
21
+ 2. CLI validates Node.js version (>=18)
22
+ 3. CLI validates `<tool>` against known TOOLS list (claude, copilot, cursor, codex, gemini)
23
+ 4. For each target tool:
24
+ a. Resolve target directory: `~/.{tool}/skills/agent-assistant/`
25
+ b. Create directory structure if not exists
26
+ c. Copy framework files (agents, commands, rules, skills, matrix-skills)
27
+ d. Apply placeholder replacement in copied files
28
+ e. Copy platform-specific instruction file from `code-assistants/{tool}-assistant/`
29
+ 5. Report per-tool success/failure
30
+ 6. Exit with code 0 (all succeeded) or 1 (any failed)
31
+
32
+ ### Decision Points
33
+
34
+ - **D1**: Is Node.js >=18 installed? → No: error message + exit 1
35
+ - **D2**: Is `<tool>` valid? → No: "Unknown tool" + exit 1
36
+ - **D3**: `--all` flag? → Yes: iterate all tools; No: single tool
37
+ - **D4**: Directory creation succeeded? → No: report error + exit 1
38
+
39
+ ### Mermaid Diagram
40
+
41
+ ```mermaid
42
+ flowchart TD
43
+ A[User runs install command] --> B{Node.js >= 18?}
44
+ B -->|No| B1[Error: Node.js required >= 18]
45
+ B1 --> Z1[Exit 1]
46
+ B -->|Yes| C{--all flag?}
47
+ C -->|Yes| D[Iterate all 5 tools]
48
+ C -->|No| E{Valid tool name?}
49
+ E -->|No| E1[Error: Unknown tool]
50
+ E1 --> Z1
51
+ E -->|Yes| F[Single tool selected]
52
+ D --> G[For each tool]
53
+ F --> G
54
+ G --> H[Resolve target: ~/.tool/skills/agent-assistant/]
55
+ H --> I{Create directory?}
56
+ I -->|Fail| I1[Report directory error]
57
+ I1 --> Z1
58
+ I -->|OK| J[Copy framework files]
59
+ J --> K[Apply placeholder replacement]
60
+ K --> L[Copy platform-specific files]
61
+ L --> M{More tools?}
62
+ M -->|Yes| G
63
+ M -->|No| N[Report results]
64
+ N --> Z0[Exit 0]
65
+ ```
66
+
67
+ ---
68
+
69
+ ## BW-002 — Framework Uninstallation
70
+
71
+ ### Narrative
72
+
73
+ The Framework User removes installed framework files while preserving any custom user files that were not part of the original installation bundle.
74
+
75
+ ### Steps
76
+
77
+ 1. User executes `agent-assistant uninstall <tool>` or `agent-assistant uninstall --all`
78
+ 2. CLI validates tool name(s)
79
+ 3. For each target tool:
80
+ a. Check if installation directory exists at `~/.{tool}/skills/agent-assistant/`
81
+ b. If not exists → skip with informational message
82
+ c. Identify bundled files (from manifest)
83
+ d. Remove only bundled files
84
+ e. Preserve custom/user-created files
85
+ f. Remove empty directories
86
+ 4. Report results
87
+
88
+ ### Decision Points
89
+
90
+ - **D1**: Installation exists? → No: skip
91
+ - **D2**: File is bundled? → Yes: remove; No: preserve
92
+
93
+ ```mermaid
94
+ flowchart TD
95
+ A[User runs uninstall command] --> B{--all flag?}
96
+ B -->|Yes| C[Iterate all tools]
97
+ B -->|No| D[Single tool]
98
+ C --> E[For each tool]
99
+ D --> E
100
+ E --> F{Installation exists?}
101
+ F -->|No| G[Skip - not installed]
102
+ G --> H{More tools?}
103
+ F -->|Yes| I[Identify bundled files]
104
+ I --> J[Remove bundled files only]
105
+ J --> K[Preserve custom files]
106
+ K --> L[Clean empty directories]
107
+ L --> H
108
+ H -->|Yes| E
109
+ H -->|No| M[Report results]
110
+ M --> N[Exit 0]
111
+ ```
112
+
113
+ ---
114
+
115
+ ## BW-003 — Command Execution (Standard)
116
+
117
+ ### Narrative
118
+
119
+ This is the core workflow of the framework. When a user types a command (explicit or natural language), the Orchestrator performs pre-flight validation, routes to the correct command and variant, then executes phases sequentially. Each phase is delegated to a specialist agent via BW-004. Every phase must pass exit criteria before the next begins.
120
+
121
+ ### Steps
122
+
123
+ 1. User input received (prompt or natural language)
124
+ 2. **Pre-flight**: Orchestrator validates input is actionable
125
+ 3. **Command Detection**: Match input to command (`/cook`, `/fix`, `/plan`, etc.) or natural language mapping
126
+ 4. **Variant Resolution**: Determine variant (`:easy`, `:hard`, `:team`, etc.) — default if unspecified
127
+ 5. **Workflow File Load**: Read `commands/{cmd}.md` → `commands/{cmd}/{variant}.md`
128
+ 6. **Phase Initialization**: Parse phase sequence from workflow file
129
+ 7. **For each phase (sequential)**:
130
+ a. Load phase definition (agent, exit criteria, inputs)
131
+ b. Assemble context from prior phase deliverables (immutable — Law 8)
132
+ c. Delegate to specialist agent via BW-004
133
+ d. Receive deliverable from agent
134
+ e. Verify exit criteria
135
+ f. If criteria not met → halt or retry (BW-010)
136
+ g. Store deliverable for subsequent phases
137
+ 8. **Delivery**: Present final deliverable to user
138
+
139
+ ### Decision Points
140
+
141
+ - **D1**: Is input a known command? → No: attempt NL mapping → still no: ASK user
142
+ - **D2**: Is requirement ambiguous? → Yes: PAUSE + ASK (Law 2)
143
+ - **D3**: Variant specified? → No: use default variant
144
+ - **D4**: Is this a `:team` variant? → Yes: route to BW-008
145
+ - **D5**: Exit criteria met? → No: invoke BW-010 error recovery
146
+ - **D6**: Plan reference detected? → Yes: route to BW-011
147
+
148
+ ### Mermaid Diagram
149
+
150
+ ```mermaid
151
+ flowchart TD
152
+ A[User Input] --> B[Pre-flight Validation]
153
+ B --> C{Known command?}
154
+ C -->|No| C1{NL mapping?}
155
+ C1 -->|No| C2[PAUSE + ASK user]
156
+ C2 --> A
157
+ C1 -->|Yes| D[Command identified]
158
+ C -->|Yes| D
159
+ D --> E{Ambiguous requirement?}
160
+ E -->|Yes| E1[PAUSE + ASK - Law 2]
161
+ E1 --> A
162
+ E -->|No| F{Variant specified?}
163
+ F -->|No| F1[Use default variant]
164
+ F -->|Yes| F2[Use specified variant]
165
+ F1 --> G{Is :team variant?}
166
+ F2 --> G
167
+ G -->|Yes| G1[Route to BW-008]
168
+ G -->|No| H{Plan reference?}
169
+ H -->|Yes| H1[Route to BW-011]
170
+ H -->|No| I[Load workflow file]
171
+ I --> J[Parse phase sequence]
172
+ J --> K[Phase N]
173
+ K --> L[Load phase definition]
174
+ L --> M[Assemble prior deliverables]
175
+ M --> N[Delegate via BW-004]
176
+ N --> O[Receive deliverable]
177
+ O --> P{Exit criteria met?}
178
+ P -->|No| P1[Invoke BW-010]
179
+ P1 -->|Recovered| K
180
+ P1 -->|Failed| Q1[Halt - escalate to user]
181
+ P -->|Yes| R{More phases?}
182
+ R -->|Yes| K
183
+ R -->|No| S[Deliver to user]
184
+ ```
185
+
186
+ ---
187
+
188
+ ## BW-004 — Agent Delegation (Tiered)
189
+
190
+ ### Narrative
191
+
192
+ When a phase requires specialist work, the Orchestrator delegates through a two-tier system. TIER 1 (isolated sub-agent) is always preferred. TIER 2 (embodiment in shared context) is a fallback only when TIER 1 is unavailable or fails.
193
+
194
+ ### Steps
195
+
196
+ 1. Orchestrator identifies agent for current phase
197
+ 2. Load agent definition from `agents/{agent}.md`
198
+ 3. Check if `runSubagent` capability is available
199
+ 4. **TIER 1 path**: Spawn isolated sub-agent with scoped context → execute → collect deliverable
200
+ 5. **TIER 2 path** (fallback): Embody agent persona in shared context → execute → collect deliverable → log TIER 2 justification
201
+ 6. Verify deliverable meets phase exit criteria
202
+ 7. Return deliverable to Orchestrator
203
+
204
+ ```mermaid
205
+ flowchart TD
206
+ A[Phase needs specialist] --> B[Load agent definition]
207
+ B --> C{runSubagent available?}
208
+ C -->|Yes| D[TIER 1: Spawn sub-agent]
209
+ D --> E[Execute in isolated context]
210
+ E --> F{Success?}
211
+ F -->|Yes| G[Collect deliverable]
212
+ F -->|No| H[Log error]
213
+ H --> I[TIER 2: Embody agent]
214
+ C -->|No| I
215
+ I --> J[Execute in shared context]
216
+ J --> K[Collect deliverable]
217
+ K --> L[Log TIER 2 justification]
218
+ G --> M{Exit criteria met?}
219
+ L --> M
220
+ M -->|Yes| N[Return deliverable]
221
+ M -->|No| O[Report failure to Orchestrator]
222
+ ```
223
+
224
+ ---
225
+
226
+ ## BW-005 — Skill Resolution (HSOL)
227
+
228
+ ### Narrative
229
+
230
+ The HSOL system resolves which skills an agent should use for a given task. It combines static matrix lookups with dynamic discovery and trust-weighted scoring. Three fitness bands determine the resolution path: matrix-only (≥0.8), matrix + async discovery (0.75–0.8), and blocking discovery (<0.75).
231
+
232
+ ### Steps
233
+
234
+ 1. Agent assigned to phase signals skill need
235
+ 2. Parse agent's skill profile from agent definition
236
+ 3. Load relevant domain YAML files from `matrix-skills/`
237
+ 4. Filter skills by relevance to current task context
238
+ 5. Compute fitness score for each candidate using 5-weight algorithm:
239
+ - Domain match weight
240
+ - Keyword overlap weight
241
+ - Complexity alignment weight
242
+ - Trust level weight
243
+ - Recency weight
244
+ 6. Determine best fitness score
245
+ 7. **Route by fitness band**:
246
+ - **≥0.8**: Use matrix skills directly
247
+ - **0.75–0.8**: Use matrix skills + trigger async BW-006
248
+ - **<0.75**: Blocking — execute BW-006 synchronously before proceeding
249
+ 8. Return sorted skill set to agent
250
+
251
+ ### Decision Points
252
+
253
+ - **D1**: Fitness ≥0.8? → matrix-only
254
+ - **D2**: Fitness 0.75–0.8? → matrix + async discovery
255
+ - **D3**: Fitness <0.75? → blocking discovery required
256
+ - **D4**: Network available? → No: matrix-only fallback
257
+ - **D5**: Any skills found? → No: report gap
258
+
259
+ ### Mermaid Diagram
260
+
261
+ ```mermaid
262
+ flowchart TD
263
+ A[Agent needs skills] --> B[Parse agent skill profile]
264
+ B --> C[Load domain YAMLs]
265
+ C --> D[Filter by relevance]
266
+ D --> E[Compute fitness scores - 5 weights]
267
+ E --> F{Best fitness score?}
268
+ F -->|>= 0.8| G[Use matrix skills directly]
269
+ F -->|0.75 - 0.8| H[Use matrix skills]
270
+ H --> H1[Trigger async BW-006]
271
+ F -->|< 0.75| I{Network available?}
272
+ I -->|No| I1[Matrix-only fallback]
273
+ I -->|Yes| J[Blocking BW-006 execution]
274
+ J --> K{Skills discovered?}
275
+ K -->|Yes| L[Merge with matrix results]
276
+ K -->|No| M[Report gap to Orchestrator]
277
+ G --> N[Return sorted skill set]
278
+ H1 --> N
279
+ I1 --> N
280
+ L --> N
281
+ ```
282
+
283
+ ---
284
+
285
+ ## BW-006 — Dynamic Skill Discovery
286
+
287
+ ### Narrative
288
+
289
+ When HSOL fitness is below threshold, the system searches external registries for potentially superior skills, evaluates them, and conditionally installs them with user confirmation for critical low-trust scenarios.
290
+
291
+ ### Steps
292
+
293
+ 1. BW-005 triggers discovery (fitness < 0.8)
294
+ 2. Execute `npx skills find` with task context query
295
+ 3. Evaluate returned candidates against current matrix skills
296
+ 4. Check superiority delta: candidate must exceed current best by >0.15
297
+ 5. If low-trust skill + critical task: request user confirmation
298
+ 6. Execute `npx skills add` to install selected skill
299
+ 7. Register new skill in `_dynamic.yaml` with NEW trust level (0.3)
300
+ 8. Return skill to HSOL for inclusion in resolution set
301
+
302
+ ### Exception Paths
303
+
304
+ - Timeout (5s) → abandon discovery, use matrix-only
305
+ - Install failure → rollback + offer matrix alternatives
306
+ - User declines confirmation → use matrix-only
307
+
308
+ ```mermaid
309
+ flowchart TD
310
+ A[Fitness below threshold] --> B[npx skills find]
311
+ B --> C{Timeout 5s?}
312
+ C -->|Yes| C1[Matrix-only fallback]
313
+ C -->|No| D[Evaluate candidates]
314
+ D --> E{Superiority delta > 0.15?}
315
+ E -->|No| E1[Matrix skills sufficient]
316
+ E -->|Yes| F{Low-trust + critical?}
317
+ F -->|Yes| G[Request user confirmation]
318
+ G --> G1{Confirmed?}
319
+ G1 -->|No| G2[Matrix-only]
320
+ G1 -->|Yes| H[npx skills add]
321
+ F -->|No| H
322
+ H --> I{Install success?}
323
+ I -->|No| I1[Rollback + offer matrix]
324
+ I -->|Yes| J[Register in _dynamic.yaml]
325
+ J --> K[Trust: NEW at 0.3]
326
+ K --> L[Return to HSOL]
327
+ ```
328
+
329
+ ---
330
+
331
+ ## BW-007 — Trust Progression
332
+
333
+ ### Narrative
334
+
335
+ Every dynamically discovered skill goes through a trust lifecycle. Trust progresses through successful executions and decays through inactivity or poor performance.
336
+
337
+ ### State Machine
338
+
339
+ | State | Value | Entry Condition | Exit Condition |
340
+ |-------|-------|-----------------|----------------|
341
+ | NEW | 0.3 | Installed via BW-006 | 3 successive successes |
342
+ | EVALUATING | 0.5 | 3 successive successes | 10 successive successes |
343
+ | VALIDATED | 0.7 | 10 successive successes | count≥10, rate≥85%, inactive≤30d |
344
+ | PROMOTED | 1.0 | All promotion criteria met | — (terminal success state) |
345
+ | BLOCKED | 0.0 | rate<85% OR inactive>30d | Manual review (future) |
346
+
347
+ ### Decay Rules
348
+
349
+ - Inactive >30 days → transition to BLOCKED regardless of current state
350
+ - 90-day inactivity → full trust decay to 0.0
351
+ - Success rate <85% at any evaluation checkpoint → BLOCKED
352
+
353
+ ```mermaid
354
+ stateDiagram-v2
355
+ [*] --> NEW: Installed via BW-006
356
+ NEW --> EVALUATING: 3 successes
357
+ NEW --> BLOCKED: rate < 85%
358
+ EVALUATING --> VALIDATED: 10 successes
359
+ EVALUATING --> BLOCKED: rate < 85%
360
+ EVALUATING --> BLOCKED: inactive > 30d
361
+ VALIDATED --> PROMOTED: count >= 10 AND rate >= 85% AND inactive <= 30d
362
+ VALIDATED --> BLOCKED: rate < 85%
363
+ VALIDATED --> BLOCKED: inactive > 30d
364
+ PROMOTED --> BLOCKED: inactive > 90d
365
+ BLOCKED --> [*]: Manual review required
366
+ ```
367
+
368
+ ---
369
+
370
+ ## BW-008 — Team Collaboration (Golden Triangle)
371
+
372
+ ### Narrative
373
+
374
+ When a user invokes a `:team` variant, three specialist agents collaborate through a structured Mailbox protocol. The Tech Lead decomposes the task, the Executor implements, and the Reviewer critiques. Disagreements are resolved through up to 3 debate rounds, after which the Tech Lead arbitrates.
375
+
376
+ ### Steps
377
+
378
+ 1. Orchestrator receives `:team` variant command
379
+ 2. Orchestrator spawns Tech Lead agent
380
+ 3. **Tech Lead**: Decomposes task into TASK_ASSIGNMENT message
381
+ 4. TASK_ASSIGNMENT posted to Mailbox
382
+ 5. Orchestrator spawns Executor agent (domain-specific)
383
+ 6. **Executor**: Reads assignment from Mailbox → implements → posts SUBMISSION to Mailbox
384
+ 7. Orchestrator spawns Reviewer agent
385
+ 8. **Reviewer**: Reads submission → critiques → posts REVIEW (PASS or FAIL with evidence)
386
+ 9. **If PASS**: Consensus stamp applied → deliverable released to Orchestrator
387
+ 10. **If FAIL**:
388
+ a. Executor reads review → defends or fixes → new SUBMISSION
389
+ b. Reviewer re-reviews → new REVIEW
390
+ c. Repeat up to 3 rounds
391
+ 11. **If 3 rounds exhausted**: Tech Lead arbitrates final decision
392
+ 12. Consensus stamp applied → deliverable released
393
+
394
+ ### Decision Points
395
+
396
+ - **D1**: REVIEW result? → PASS: release; FAIL: debate
397
+ - **D2**: Rounds < 3? → Yes: continue debate; No: Tech Lead arbitrates
398
+ - **D3**: FAIL has evidence? → No: auto-FAIL the review (reviewer must provide proof)
399
+
400
+ ### Mermaid Diagram
401
+
402
+ ```mermaid
403
+ sequenceDiagram
404
+ participant U as User
405
+ participant O as Orchestrator
406
+ participant TL as Tech Lead
407
+ participant EX as Executor
408
+ participant RV as Reviewer
409
+ participant MB as Mailbox
410
+
411
+ U->>O: /cmd:team request
412
+ O->>TL: Decompose task
413
+ TL->>MB: TASK_ASSIGNMENT
414
+ O->>EX: Execute task
415
+ EX->>MB: Read TASK_ASSIGNMENT
416
+ EX->>MB: SUBMISSION
417
+
418
+ loop Max 3 rounds
419
+ O->>RV: Review submission
420
+ RV->>MB: Read SUBMISSION
421
+ RV->>MB: REVIEW (PASS/FAIL)
422
+ alt PASS
423
+ MB->>O: Consensus stamp
424
+ else FAIL with evidence
425
+ EX->>MB: Read REVIEW
426
+ EX->>MB: Revised SUBMISSION
427
+ else FAIL without evidence
428
+ MB->>O: Auto-FAIL review
429
+ end
430
+ end
431
+
432
+ alt Rounds exhausted
433
+ O->>TL: Arbitrate
434
+ TL->>MB: Final decision
435
+ end
436
+
437
+ O->>U: Deliver result
438
+ ```
439
+
440
+ ---
441
+
442
+ ## BW-009 — Documentation Generation
443
+
444
+ ### Narrative
445
+
446
+ Documentation generation follows a strict sequential order: core documentation first, then business documentation, then audit documentation. Each layer must complete before the next begins.
447
+
448
+ ### Steps
449
+
450
+ 1. User invokes `/docs` (or specific variant)
451
+ 2. Orchestrator loads docs command workflow
452
+ 3. **Core layer**: Generate 5 core documentation folders
453
+ 4. Verify core layer completeness
454
+ 5. **Business layer**: Generate 4 business documentation folders
455
+ 6. Verify business layer completeness
456
+ 7. **Audit layer**: Generate 4 audit documentation folders
457
+ 8. Verify audit layer completeness
458
+ 9. Report generation results
459
+
460
+ ```mermaid
461
+ flowchart TD
462
+ A[/docs command] --> B{Variant?}
463
+ B -->|:core| C[Core only]
464
+ B -->|:business| D[Business only]
465
+ B -->|:audit| E[Audit only]
466
+ B -->|default| F[Full sequence]
467
+ F --> C
468
+ C --> G[Generate 5 core folders]
469
+ G --> H{Core complete?}
470
+ H -->|No| H1[FAILED - halt]
471
+ H -->|Yes| D
472
+ D --> I[Generate 4 business folders]
473
+ I --> J{Business complete?}
474
+ J -->|No| J1[FAILED - halt]
475
+ J -->|Yes| E
476
+ E --> K[Generate 4 audit folders]
477
+ K --> L{Audit complete?}
478
+ L -->|No| L1[FAILED - halt]
479
+ L -->|Yes| M[Report: All complete]
480
+ ```
481
+
482
+ ---
483
+
484
+ ## BW-010 — Error Recovery (E1–E4)
485
+
486
+ ### Narrative
487
+
488
+ Error recovery follows a graduated escalation path. Each tier is attempted before moving to the next. The system guarantees that every error terminates in either successful recovery or an explicit user decision — no silent failures.
489
+
490
+ ### Error Tiers
491
+
492
+ | Tier | Strategy | Max Attempts | Description |
493
+ |------|----------|-------------|-------------|
494
+ | E1 | Direct retry | 3 | Retry the exact same operation |
495
+ | E1b | Chunk | 1 | Break operation into smaller units and retry each |
496
+ | E2 | Alternative | 1 | Attempt an entirely different approach |
497
+ | E3 | Safe point | 1 | Save current progress to a recoverable state |
498
+ | E4 | Rollback | 1 | Revert to last known good state + user escalation |
499
+
500
+ ### Steps
501
+
502
+ 1. Error detected during phase execution
503
+ 2. Classify error severity and type
504
+ 3. **E1**: Retry operation (up to 3 attempts)
505
+ 4. If E1 fails → **E1b**: Chunk operation into smaller units → retry each
506
+ 5. If E1b fails → **E2**: Attempt alternative approach
507
+ 6. If E2 fails → **E3**: Save progress to safe point
508
+ 7. If E3 fails or situation unrecoverable → **E4**: Rollback to last good state
509
+ 8. **E4 terminal**: Escalate to user with full context and options
510
+ 9. User decides: retry with new input, accept partial result, or abort
511
+
512
+ ### Decision Points
513
+
514
+ - **D1**: Retry count < 3? → Yes: E1 retry; No: E1b
515
+ - **D2**: Chunkable operation? → Yes: E1b; No: E2
516
+ - **D3**: Alternative exists? → Yes: E2; No: E3
517
+ - **D4**: Safe point available? → Yes: E3 save; No: E4
518
+ - **D5**: Rollback possible? → Yes: E4 rollback; No: user escalation immediate
519
+
520
+ ### Mermaid Diagram
521
+
522
+ ```mermaid
523
+ flowchart TD
524
+ A[Error detected] --> B[Classify error]
525
+ B --> C[E1: Retry]
526
+ C --> D{Attempt <= 3?}
527
+ D -->|Yes| E[Execute retry]
528
+ E --> F{Success?}
529
+ F -->|Yes| Z[Recovered - resume workflow]
530
+ F -->|No| D
531
+ D -->|No| G{Chunkable?}
532
+ G -->|Yes| H[E1b: Break into chunks]
533
+ H --> I[Retry each chunk]
534
+ I --> J{All chunks OK?}
535
+ J -->|Yes| Z
536
+ J -->|No| K[E2: Alternative approach]
537
+ G -->|No| K
538
+ K --> L{Alternative exists?}
539
+ L -->|Yes| M[Execute alternative]
540
+ M --> N{Success?}
541
+ N -->|Yes| Z
542
+ N -->|No| O[E3: Safe point]
543
+ L -->|No| O
544
+ O --> P{Save possible?}
545
+ P -->|Yes| Q[Save progress]
546
+ P -->|No| R[E4: Rollback]
547
+ Q --> R
548
+ R --> S{Rollback OK?}
549
+ S -->|Yes| T[State restored]
550
+ S -->|No| U[Critical failure]
551
+ T --> V[Escalate to user]
552
+ U --> V
553
+ V --> W{User decision}
554
+ W -->|Retry| A
555
+ W -->|Accept partial| X[Deliver partial]
556
+ W -->|Abort| Y[Terminate workflow]
557
+ ```
558
+
559
+ ---
560
+
561
+ ## BW-011 — Plan Short-Circuit
562
+
563
+ ### Narrative
564
+
565
+ When a user references an existing plan file in a `/code:hard` or `/code:team` command, the Orchestrator detects this and skips early research phases, jumping directly to implementation.
566
+
567
+ ### Steps
568
+
569
+ 1. User invokes `/code:hard` or `/code:team` referencing `PLAN-*.md`
570
+ 2. Orchestrator detects plan file reference
571
+ 3. Validate that plan file exists and is parseable
572
+ 4. Extract implementation plan from file
573
+ 5. Skip phases: research, scout, brainstorm
574
+ 6. Jump to: context optimization → implement → test → review
575
+ 7. Execute remaining phases via standard BW-003/BW-004 delegation
576
+
577
+ ```mermaid
578
+ flowchart TD
579
+ A[/code:hard or /code:team with PLAN ref] --> B{PLAN-*.md exists?}
580
+ B -->|No| C[Fall back to standard BW-003]
581
+ B -->|Yes| D{Plan valid?}
582
+ D -->|No| C
583
+ D -->|Yes| E[Extract plan]
584
+ E --> F[Skip: research, scout, brainstorm]
585
+ F --> G[Context optimization]
586
+ G --> H[Implement via BW-004]
587
+ H --> I[Test via BW-004]
588
+ I --> J[Review via BW-004]
589
+ J --> K[Deliver to user]
590
+ ```
591
+
592
+ ---
593
+
594
+ ## BW-012 — Platform Integration
595
+
596
+ ### Narrative
597
+
598
+ When the Framework Maintainer decides to support a new AI coding assistant platform, a series of integration steps ensures the new platform follows existing conventions and is fully operational.
599
+
600
+ ### Steps
601
+
602
+ 1. Maintainer identifies new platform for integration
603
+ 2. Add platform to TOOLS configuration in `cli/install.js`
604
+ 3. Create install/uninstall mapping for new platform's config directory structure
605
+ 4. Add platform to CORE.md resolution table
606
+ 5. Create `code-assistants/{platform}-assistant/` directory with platform instruction file
607
+ 6. Add npm scripts for the new platform (install/uninstall)
608
+ 7. Update README.md with new platform documentation
609
+ 8. Test installation and uninstallation for the new platform
610
+ 9. Release new framework version
611
+
612
+ ```mermaid
613
+ flowchart TD
614
+ A[New platform identified] --> B[Add to TOOLS config]
615
+ B --> C[Create install/uninstall mapping]
616
+ C --> D[Add to CORE.md resolution table]
617
+ D --> E[Create code-assistants dir]
618
+ E --> F[Create platform instruction file]
619
+ F --> G[Add npm scripts]
620
+ G --> H[Update README]
621
+ H --> I[Test install/uninstall]
622
+ I --> J{Tests pass?}
623
+ J -->|No| K[Fix issues]
624
+ K --> I
625
+ J -->|Yes| L[Release new version]
626
+ ```
627
+
628
+ ---
629
+
630
+ ## Evidence Sources
631
+
632
+ - `CLAUDE.md` — Orchestrator identity, command routing, Law 2 (ambiguity), Law 7 (no direct implementation), Law 8 (immutability)
633
+ - `rules/CORE.md` — Full 10 Orchestration Laws, phase sequencing
634
+ - `rules/AGENTS.md` — TIER 1/TIER 2 delegation protocol, sub-agent spawning
635
+ - `rules/SKILLS.md` — HSOL 5-weight fitness algorithm, threshold bands, trust state machine, dynamic discovery protocol
636
+ - `rules/TEAMS.md` — Golden Triangle protocol, Mailbox message types, debate rounds, consensus stamps, auto-FAIL rules
637
+ - `rules/ERRORS.md` — E1–E4 tier definitions, escalation paths, no-silent-halt guarantee
638
+ - `rules/PHASES.md` — Phase sequencing constraints, exit criteria definitions
639
+ - `cli/install.js` — Installation and uninstallation implementation details
640
+ - `commands/*.md` — Command definitions, variant routing rules
641
+ - `commands/code/*.md` — Plan short-circuit detection in hard/team variants