@zerwiz/ymir 0.1.16 → 0.1.18

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 (171) hide show
  1. package/.agents/config/app-repos.yaml +38 -0
  2. package/.claude/settings.json +31 -0
  3. package/.codex/hooks.json +43 -0
  4. package/.cursor/hooks.json +33 -0
  5. package/.pi/extensions/README.md +39 -0
  6. package/.pi/extensions/gna-pi-watch.ts +15 -0
  7. package/.pi/extensions/lib/ro-assistant-layout.ts +96 -0
  8. package/.pi/extensions/lib/ro-operational-user-layout.ts +145 -0
  9. package/.pi/extensions/lib/ro-visibility.ts +99 -0
  10. package/.pi/extensions/lib/ro-working-ship.ts +243 -0
  11. package/.pi/extensions/lib/rodd-operational-input.ts +62 -0
  12. package/.pi/extensions/lib/skuld-branch-dispatch.ts +252 -0
  13. package/.pi/extensions/lib/skuld-branch-model-picker.ts +77 -0
  14. package/.pi/extensions/lib/vordr-sessionstart-supervisor.mjs +48 -0
  15. package/.pi/extensions/ro.ts +11 -0
  16. package/.pi/extensions/skuld-branch-supervision.ts +11 -0
  17. package/.pi/extensions/syn-turnend-guard.ts +11 -0
  18. package/.pi/mcp.json +16 -0
  19. package/.pi/mcp.json.example +11 -0
  20. package/.pi/npm/.gitignore +2 -0
  21. package/.pi/settings.json +8 -0
  22. package/.pi/shared/extensions/gna-pi-watch.ts +750 -0
  23. package/.pi/shared/extensions/herdr-agent-state.ts +257 -0
  24. package/.pi/shared/extensions/open-editor.ts +509 -0
  25. package/.pi/shared/extensions/ro.ts +504 -0
  26. package/.pi/shared/extensions/skuld-branch-supervision.ts +1535 -0
  27. package/.pi/shared/extensions/syn-turnend-guard.ts +683 -0
  28. package/.pi/shared/extensions/todo.ts +133 -0
  29. package/.pi/shared/extensions/ymir-subagents.ts +287 -0
  30. package/.pi/shared/extensions/ymir-well.ts +130 -0
  31. package/CHANGELOG.md +23 -0
  32. package/assets/Ymir.md +4654 -0
  33. package/assets/healer.html +717 -0
  34. package/assets/icon-family/family-sheet.png +0 -0
  35. package/assets/icon-family/hlidskjalf.svg +1 -0
  36. package/assets/icon-family/sessrumnir.svg +1 -0
  37. package/assets/icon-family/smidja.svg +1 -0
  38. package/assets/icon-family/ymir.svg +1 -0
  39. package/assets/mimirswell.html +880 -0
  40. package/assets/mock/README.md +16 -0
  41. package/assets/mock/feeds.ts +175 -0
  42. package/assets/mock/mock.ts +408 -0
  43. package/assets/reference/docs/agent-control.md +122 -0
  44. package/assets/reference/docs/apodex/Appdex_as_Orchestrator_Planner_Reviewer_Assessment.md +176 -0
  45. package/assets/reference/docs/apodex/Final Report(1).md +198 -0
  46. package/assets/reference/docs/apodex/Final Report(2).md +54 -0
  47. package/assets/reference/docs/apodex/Final Report(3).md +40 -0
  48. package/assets/reference/docs/apodex/Final Report(4).md +234 -0
  49. package/assets/reference/docs/apodex/Final Report(5).md +13 -0
  50. package/assets/reference/docs/apodex/Final Report.md +82 -0
  51. package/assets/reference/docs/architecture.md +392 -0
  52. package/assets/reference/docs/arm-pretool-check.md +247 -0
  53. package/assets/reference/docs/calm-mode-feasibility.md +541 -0
  54. package/assets/reference/docs/calm.md +59 -0
  55. package/assets/reference/docs/captain-hold-lifecycle.md +96 -0
  56. package/assets/reference/docs/cd-guard.md +165 -0
  57. package/assets/reference/docs/cmux-backend.md +133 -0
  58. package/assets/reference/docs/codex-app-backend.md +57 -0
  59. package/assets/reference/docs/configuration.md +924 -0
  60. package/assets/reference/docs/documentation-audiences.json +468 -0
  61. package/assets/reference/docs/documentation-audiences.md +28 -0
  62. package/assets/reference/docs/examples/crew-dispatch.json +26 -0
  63. package/assets/reference/docs/examples/process-event-extension/file-signal.mjs +96 -0
  64. package/assets/reference/docs/examples/process-event-extension/firstmate-extension.json +15 -0
  65. package/assets/reference/docs/examples/watched-tools.json +24 -0
  66. package/assets/reference/docs/examples/wedge-alarm +22 -0
  67. package/assets/reference/docs/extension-bindings.md +237 -0
  68. package/assets/reference/docs/fm-test-isolation-proof.json +37 -0
  69. package/assets/reference/docs/fm-test-isolation-proof.md +149 -0
  70. package/assets/reference/docs/fm-test-portable-shards.md +118 -0
  71. package/assets/reference/docs/gitlab-merge-watch.md +275 -0
  72. package/assets/reference/docs/herdr-backend.md +346 -0
  73. package/assets/reference/docs/orca-backend.md +84 -0
  74. package/assets/reference/docs/pi-supervision-branch-poster.svg +125 -0
  75. package/assets/reference/docs/pi-supervision-branch.md +96 -0
  76. package/assets/reference/docs/plans/agentic-engineering-workflow.md +395 -0
  77. package/assets/reference/docs/plans/agentic-factory-implementation-plan.md +615 -0
  78. package/assets/reference/docs/plans/command-factory-enhancement-plan.md +420 -0
  79. package/assets/reference/docs/plans/phase-1-layer3-program-design.md +134 -0
  80. package/assets/reference/docs/plans/phase-2-vertical-slices.md +100 -0
  81. package/assets/reference/docs/plans/phase-3-measurable-goals.md +106 -0
  82. package/assets/reference/docs/plans/phase-4-context-budget.md +106 -0
  83. package/assets/reference/docs/plans/phase-5-pre-mortem-confidence.md +100 -0
  84. package/assets/reference/docs/plans/phase-6-incident-to-agent.md +109 -0
  85. package/assets/reference/docs/remote-secondmates.md +268 -0
  86. package/assets/reference/docs/scripts.md +146 -0
  87. package/assets/reference/docs/sessionstart-nudge.md +115 -0
  88. package/assets/reference/docs/subagent-guard.md +383 -0
  89. package/assets/reference/docs/supervision-protocols/claude.md +27 -0
  90. package/assets/reference/docs/supervision-protocols/codex.md +16 -0
  91. package/assets/reference/docs/supervision-protocols/cursor.md +31 -0
  92. package/assets/reference/docs/supervision-protocols/grok.md +39 -0
  93. package/assets/reference/docs/supervision-protocols/opencode.md +17 -0
  94. package/assets/reference/docs/supervision-protocols/pi.md +33 -0
  95. package/assets/reference/docs/supervision-protocols/unknown.md +13 -0
  96. package/assets/reference/docs/tmux-backend.md +115 -0
  97. package/assets/reference/docs/trace-context.md +117 -0
  98. package/assets/reference/docs/turnend-guard.md +170 -0
  99. package/assets/reference/docs/verification/dispatch-auth.md +204 -0
  100. package/assets/reference/docs/verification/muse.md +221 -0
  101. package/assets/reference/docs/verification/process-event-sources.md +208 -0
  102. package/assets/reference/docs/verification/public-followup.md +119 -0
  103. package/assets/reference/docs/verification/runtime-backends.md +1022 -0
  104. package/assets/reference/docs/verification/stow-memory.md +53 -0
  105. package/assets/reference/docs/verification/supervision.md +534 -0
  106. package/assets/reference/docs/verification/trace-context.md +31 -0
  107. package/assets/reference/docs/voice-relay.md +295 -0
  108. package/assets/reference/docs/watcher-continuity.md +119 -0
  109. package/assets/reference/docs/wedge-alarm.md +39 -0
  110. package/assets/reference/docs/zellij-backend.md +114 -0
  111. package/assets/reference/index.html +1172 -0
  112. package/assets/reference/skills/afk/SKILL.md +241 -0
  113. package/assets/reference/skills/ahoy/SKILL.md +56 -0
  114. package/assets/reference/skills/ask-user-authority/SKILL.md +56 -0
  115. package/assets/reference/skills/bearings/SKILL.md +161 -0
  116. package/assets/reference/skills/bearings/assets/board-template.html +731 -0
  117. package/assets/reference/skills/bootstrap-diagnostics/SKILL.md +68 -0
  118. package/assets/reference/skills/captain-hold-lifecycle/SKILL.md +54 -0
  119. package/assets/reference/skills/decision-hold-lifecycle/SKILL.md +15 -0
  120. package/assets/reference/skills/diagnostic-reasoning/SKILL.md +53 -0
  121. package/assets/reference/skills/firstmate-codexapp/SKILL.md +110 -0
  122. package/assets/reference/skills/firstmate-codexapp/agents/openai.yaml +4 -0
  123. package/assets/reference/skills/firstmate-coding-guidelines/SKILL.md +127 -0
  124. package/assets/reference/skills/firstmate-orca/SKILL.md +92 -0
  125. package/assets/reference/skills/fmx-respond/SKILL.md +283 -0
  126. package/assets/reference/skills/harness-adapters/SKILL.md +95 -0
  127. package/assets/reference/skills/harness-adapters/references/common/control-and-recovery.md +37 -0
  128. package/assets/reference/skills/harness-adapters/references/common/dispatch.md +32 -0
  129. package/assets/reference/skills/harness-adapters/references/common/model-and-effort.md +42 -0
  130. package/assets/reference/skills/harness-adapters/references/common/primary-hooks.md +40 -0
  131. package/assets/reference/skills/harness-adapters/references/harness/claude.md +55 -0
  132. package/assets/reference/skills/harness-adapters/references/harness/codex.md +43 -0
  133. package/assets/reference/skills/harness-adapters/references/harness/cursor.md +75 -0
  134. package/assets/reference/skills/harness-adapters/references/harness/grok.md +69 -0
  135. package/assets/reference/skills/harness-adapters/references/harness/kimi.md +51 -0
  136. package/assets/reference/skills/harness-adapters/references/harness/muse.md +70 -0
  137. package/assets/reference/skills/harness-adapters/references/harness/opencode.md +42 -0
  138. package/assets/reference/skills/harness-adapters/references/harness/pi.md +56 -0
  139. package/assets/reference/skills/process-event-sources/SKILL.md +137 -0
  140. package/assets/reference/skills/project-management/SKILL.md +92 -0
  141. package/assets/reference/skills/quota-array-dispatch/SKILL.md +131 -0
  142. package/assets/reference/skills/secondmate-provisioning/SKILL.md +254 -0
  143. package/assets/reference/skills/stow/SKILL.md +309 -0
  144. package/assets/reference/skills/stuck-crewmate-recovery/SKILL.md +54 -0
  145. package/assets/reference/skills/updatefirstmate/SKILL.md +64 -0
  146. package/assets/skills/README.md +5 -0
  147. package/assets/yggdrasil.html +649 -0
  148. package/assets/ymir-banner-01.png +0 -0
  149. package/assets/ymir-banner-02.png +0 -0
  150. package/assets/ymir-banner-03.png +0 -0
  151. package/assets/ymir-banner-04.png +0 -0
  152. package/assets/ymir-banner-05.png +0 -0
  153. package/assets/ymir-banner-06.png +0 -0
  154. package/assets/ymir-emblem-darksteel.svg +63 -0
  155. package/assets/ymir-emblem-forged.svg +55 -0
  156. package/assets/ymir-emblem-slate.svg +55 -0
  157. package/assets/ymir-mark-algiz-anvil.svg +9 -0
  158. package/assets/ymir-stave.svg +53 -0
  159. package/assets/ymir.html +563 -0
  160. package/bin/ymir-install.sh +6 -1
  161. package/data/learnings.md +33 -0
  162. package/data/local-models.md +34 -0
  163. package/data/operator.md +15 -0
  164. package/data/projects.md +28 -0
  165. package/data/realm.md +1 -0
  166. package/deploy/Containerfile +27 -0
  167. package/deploy/README.md +104 -0
  168. package/deploy/compose/compose.yaml +45 -0
  169. package/deploy/env.example +30 -0
  170. package/deploy/quadlet/ymir.container +57 -0
  171. package/package.json +10 -8
@@ -0,0 +1,615 @@
1
+ # Agentic Engineering Workflow — Factory Implementation Plan
2
+
3
+ **Objective**: Encode Dex Horthy's four-layer program design system and context engineering principles into the Firstmate software factory as enforceable, automated workflows.
4
+
5
+ **Source**: `docs/agentic-engineering-workflow.md` (comprehensive research from YouTube `xgkjtF89-44`)
6
+
7
+ ---
8
+
9
+ ## Phase 0: Foundation — Core Skills (Week 1)
10
+
11
+ ### 0.1 `program-design` Skill (NEW) — ✅ IMPLEMENTED IN EXISTING SKILLS (Phase 1)
12
+ **Purpose**: Enforce Layer 3 capture in every plan/brief before spawn
13
+
14
+ **Location**: Integrated into `create-plan`, `validate-plan`, `ticket-executor` skills + global plan template
15
+
16
+ **Deliverables**:
17
+ - `SKILL.md` — trigger: before `create-plan`, before `ticket-executor` phase 0, before any ship brief (implemented in existing skills)
18
+ - `templates/program-design.md` (implemented in create-plan template + global plan template):
19
+ ```markdown
20
+ ## Program Design (Layer 3)
21
+
22
+ ### File Map
23
+ | Component | Path | Responsibility |
24
+ |-----------|------|----------------|
25
+ | | | |
26
+
27
+ ### Type Signatures
28
+ ```typescript
29
+ // Exact interfaces before implementation
30
+ interface X { }
31
+ type Y = ;
32
+ ```
33
+
34
+ ### Call Stack Visualization
35
+ ```mermaid
36
+ graph TD
37
+ A[Entry] --> B[Handler]
38
+ B --> C[Service]
39
+ C --> D[Repository]
40
+ ```
41
+
42
+ ### Test Shapes (Signatures Only)
43
+ ```typescript
44
+ describe('Feature', () => {
45
+ it('should do X', () => { /* shape */ })
46
+ it('should handle Y', () => { /* shape */ })
47
+ })
48
+ ```
49
+ ```
50
+ - `bin/program-design-check.sh` — validates program design section exists in plan/brief before spawn (implemented in validate-plan section 1e + ticket-executor Phase 0 gate)
51
+
52
+ **Integration Points (DONE)**:
53
+ - `create-plan`: Added Layer 3 (Program Design — MANDATORY) section to template (File Map, Type Signatures, Call Stack, Test Shapes)
54
+ - `validate-plan`: Added section 1e "Layer 3 Program Design (MANDATORY)" — REJECTED if missing/incomplete
55
+ - `ticket-executor`: Phase 0 Validation Gate requires Layer 3 present; refuses to start if missing
56
+ - Global plan template: Program Design (Layer 3 — MANDATORY) section
57
+
58
+ **Integration Points (DEFERRED)**:
59
+ - `fm-brief.sh`: scaffold includes program-design section (mandatory)
60
+ - `fm-spawn.sh`: pre-spawn validation gate
61
+
62
+ ---
63
+
64
+ ### 0.2 `vertical-slice-executor` Skill (NEW) — ✅ IMPLEMENTED IN EXISTING SKILLS (Phase 2)
65
+ **Purpose**: Structure ticket-executor around thin e2e slices; prevent horizontal building
66
+
67
+ **Location**: Integrated into `ticket-executor`, `validate-implementation`, `validate-plan` skills
68
+
69
+ **Deliverables**:
70
+ - `SKILL.md` — trigger: `ticket-executor` start, `fm-brief.sh` scaffold (implemented in existing skills)
71
+ - `templates/vertical-slice-definition.md` (implemented in global plan template Phase 0 section):
72
+ ```markdown
73
+ ## Vertical Slice Definition (Layer 4)
74
+
75
+ ### Slice 1 (Tracer Bullet) — MUST BE FIRST
76
+ - Mock API endpoint: `POST /api/v1/feature`
77
+ - Stub frontend: minimal UI component
78
+ - Wire together: testable e2e path
79
+ - Success criteria: `curl` returns 200 + expected JSON
80
+
81
+ ### Subsequent Slices (in priority order)
82
+ - Slice 2: Add migrations + business logic
83
+ - Slice 3: Error handling + validation
84
+ - Slice 4: Polish + edge cases
85
+ ```
86
+ - `bin/vertical-slice-enforce.sh` — validates slice 1 is defined and testable before horizontal work (implemented in ticket-executor Phase 0 gate + validate-implementation)
87
+
88
+ **Integration Points (DONE)**:
89
+ - `ticket-executor`: Phase 0 = vertical slice definition + validation
90
+ - `validate-implementation`: Tests against slice 1 first (vertical slice validation)
91
+ - `validate-plan`: Checks vertical slice definition exists
92
+ - Global plan template: Phase 0 Vertical Slice Definition section
93
+
94
+ **Integration Points (DEFERRED)**:
95
+ - `fm-brief.sh`: scaffold includes vertical-slice section (mandatory)
96
+ - `program-design` skill: not yet created (Layer 3 separate)
97
+
98
+ ---
99
+
100
+ ### 0.3 `context-budget` Skill (NEW) — ✅ COMPLETED (2026-09-10)
101
+ **Purpose**: Monitor token usage, warn at 50% ("dumb zone"), enforce early structural decisions
102
+
103
+ **Location**: `~/.config/opencode/skills/context-budget/` + copied to `command/.agents/skills/context-budget/`
104
+
105
+ **Deliverables**:
106
+ - `SKILL.md` — trigger: session start, before long-running agent tasks, periodic during execution
107
+ - `bin/context-budget.sh` — tracks tokens via harness APIs:
108
+ - `< 30%`: Green — structural decisions optimal
109
+ - `30-50%`: Yellow — make structural decisions NOW
110
+ - `50-85%`: Red — "dumb zone" — warn, suggest compaction/handoff
111
+ - `> 85%`: Critical — force compaction or handoff
112
+ - `config/context-budget.yaml` — thresholds, harness-specific token APIs
113
+
114
+ **Integration Points (DONE)**:
115
+ - `create-plan`: Added context budget check before design work + `## Context Budget at Creation` template section
116
+ - `ticket-executor`: Added `Context Budget Enforcement` section + Phase 0 validation gate
117
+ - `validate-implementation`: Added budget compliance check (Step 0.5) + report line
118
+
119
+ **Integration Points (DEFERRED)**:
120
+ - `fm-session-start.sh`: initialize budget tracking
121
+ - `fm-spawn.sh`: pass budget context to worker
122
+ - `harness-adapters`: harness-specific token reporting
123
+ - `fm-brief.sh`: include budget guidance in brief
124
+
125
+ ---
126
+
127
+ ### 0.4 `pre-mortem-confidence` Skill (NEW) — ✅ COMPLETED (2026-09-10)
128
+ **Purpose**: "Which choices are you not confident about?" — Victor Tali technique
129
+
130
+ **Location**: `~/.config/opencode/skills/pre-mortem-confidence/` + copied to `command/.agents/skills/pre-mortem-confidence/`
131
+
132
+ **Deliverables**:
133
+ - `SKILL.md` — trigger: program design review, before spawn, after vertical slice definition
134
+ - `bin/pre-mortem-check.sh` — prompts agent for confidence assessment:
135
+ ```markdown
136
+ ## Pre-Mortem Confidence Check
137
+
138
+ While designing this, which choices are you NOT confident about?
139
+ (List each with reasoning — these become review focus areas)
140
+
141
+ | Choice | Confidence (1-10) | Reasoning | Mitigation |
142
+ |--------|-------------------|-----------|------------|
143
+ | | | | |
144
+ ```
145
+ - Output feeds into `multi-model-review` focus areas
146
+
147
+ **Integration Points (DONE)**:
148
+ - `create-plan`: Added Step 3 pre-mortem + `## Pre-Mortem Confidence Check` template section (after Layer 3)
149
+ - `validate-plan`: Added section 1d "Pre-Mortem Confidence Validation" + output format
150
+
151
+ **Integration Points (DEFERRED)**:
152
+ - `program-design` skill: runs after program design complete (not yet created)
153
+ - `fm-brief.sh`: includes pre-mortem section
154
+ - `multi-model-review`: uses low-confidence items as review focus (not yet created)
155
+
156
+ ---
157
+
158
+ ## Phase 1: Planning & Execution Pipeline Updates (Week 2)
159
+
160
+ ### 1.1 Update `create-plan` Skill
161
+ **File**: `/home/zerwiz/firstmate/.agents/skills/create-plan/` (or wherever it lives)
162
+
163
+ **Changes**:
164
+ - Add **Layer 1 (Product)** section template: problem, metrics, announcement post, HTML mockups
165
+ - Add **Layer 2 (Architecture)** section template: services, flow, endpoints, tables
166
+ - Add **Layer 3 (Program Design)** section — delegate to `program-design` skill
167
+ - Add **Layer 4 (Vertical Slices)** section — delegate to `vertical-slice-executor` skill
168
+ - Add **Measurable Goals** section (quantitative, business-tied)
169
+ - Add **Pre-Mortem Confidence** section — delegate to `pre-mortem-confidence` skill
170
+ - Output validation: all 4 layers + measurable goal + pre-mortem required before plan approved
171
+
172
+ **Acceptance Criteria**:
173
+ - Plan cannot be marked "ready" without all 4 layers complete
174
+ - Measurable goal must be quantitative (not "improve UX" but "reduce checkout drop-off from 23% to 15%")
175
+ - Program design must have file map, type signatures, call stack, test shapes
176
+
177
+ ---
178
+
179
+ ### 1.2 Update `ticket-executor` Skill
180
+ **File**: `/home/zerwiz/firstmate/.agents/skills/ticket-executor/`
181
+
182
+ **Changes**:
183
+ - **Phase 0 (NEW)**: Program Design + Vertical Slice Definition
184
+ - Run `program-design` skill validation
185
+ - Run `vertical-slice-executor` skill validation
186
+ - Run `pre-mortem-confidence` skill
187
+ - Gate: cannot proceed to Phase 1 without all three passing
188
+ - **Phase 1**: Vertical Slice 1 (tracer bullet) only — mock API → stub FE → wire → test
189
+ - **Phase 2+**: Horizontal expansion per slice definition
190
+ - Each phase: measurable goal validation via `measurable-goals` skill
191
+ - Context budget check at each phase transition
192
+
193
+ **Acceptance Criteria**:
194
+ - No horizontal work (DB layer, service layer, etc.) before Slice 1 passes e2e test
195
+ - Measurable goal tracked per phase
196
+ - Context budget warnings respected
197
+
198
+ ---
199
+
200
+ ### 1.3 Update `validate-implementation` Skill
201
+ **File**: `/home/zerwiz/firstmate/.agents/skills/validate-implementation/`
202
+
203
+ **Changes**:
204
+ - **Live dev environment testing**: integrate with orbs/portals/preview deployments
205
+ - **Vertical slice validation**: test Slice 1 first (e2e), then subsequent slices
206
+ - **Measurable goal validation**: run metric checks (conversion, performance, etc.)
207
+ - **Multi-model review gate** (for high-stakes): parallel Codex + Opus review
208
+ - **Logic retention check**: periodic "quiz" on system logic during long tasks
209
+
210
+ **Acceptance Criteria**:
211
+ - Validation fails if Slice 1 not testable end-to-end
212
+ - Measurable goals must pass or require explicit captain override
213
+ - High-stakes changes require multi-model review
214
+
215
+ ---
216
+
217
+ ## Phase 2: Incident & Automation Pipeline (Week 3)
218
+
219
+ ### 2.1 `incident-to-agent` Skill (NEW) — ✅ CORE IMPLEMENTED (2026-09-10), INFRASTRUCTURE DEFERRED
220
+ **Purpose**: Route alerts → agent pipeline → PR (not 3am page)
221
+
222
+ **Location**: `~/.config/opencode/skills/incident-to-agent/` + copied to `command/.agents/skills/incident-to-agent/`
223
+
224
+ **Deliverables**:
225
+ - `SKILL.md` — trigger: `process-event-sources` check wake for incident sources
226
+ - `bin/incident-classifier.sh` — GLM 5.2 style classification (tested: JSON title extraction fixed):
227
+ ```markdown
228
+ ## Incident Classification
229
+ - Type: provider_outage | missing_migration | config_drift | code_regression | unknown
230
+ - Actionable: true/false
231
+ - Fix: specific fix description (if actionable)
232
+ - Priority: P1/P2/P3
233
+ ```
234
+ - `bin/incident-to-brief.sh` — generates agent brief from classification (tested: fix brief + runbook brief both work):
235
+ - If actionable: full four-layer brief targeting the fix
236
+ - If not actionable: documentation/update runbook brief
237
+
238
+ **Integration Points (DONE)**:
239
+ - Core skill + classifier + brief scripts created and tested locally
240
+ - Copied to `command` project for MCP registration
241
+
242
+ **Integration Points (DEFERRED — requires captain credentials/deployment)**:
243
+ - `process-event-sources` skill: add incident source types (PagerDuty, GH Actions, Vercel)
244
+ - Cron infrastructure: Vercel/GH Actions for polling + render.com for inference
245
+ - `fm-spawn.sh`: accepts incident-triggered briefs
246
+ - `fm-pr-check.sh`: tracks incident-linked PRs
247
+
248
+ ---
249
+
250
+ ### 2.2 `measurable-goals` Skill (NEW) — ✅ COMPLETED (2026-09-10) via Phase 3
251
+ **Purpose**: Require quantitative success metrics in tickets/plans, validate against them
252
+
253
+ **Location**: Integrated into existing skills (no separate skill — implemented in ticket-manager, ticket-template, create-plan, validate-plan, validate-implementation, bin/measurable-goal-validate.sh)
254
+
255
+ **Deliverables**:
256
+ - `SKILL.md` — trigger: ticket creation, plan creation, validation (implemented in existing skills)
257
+ - `templates/measurable-goal.md` (implemented in global ticket-template.md + plan-template.md):
258
+ ```markdown
259
+ ## Measurable Goal (Back-Pressure Metric)
260
+
261
+ **Metric**: [e.g., checkout conversion rate]
262
+ **Current Baseline**: [e.g., 12.3%]
263
+ **Target**: [e.g., 15.0%]
264
+ **Measurement Method**: [e.g., Mixpanel event 'checkout_complete' / 'checkout_start']
265
+ **Timeframe**: [e.g., 14 days post-deploy]
266
+ **Rollback Threshold**: [e.g., < 11% for 48h]
267
+ ```
268
+ - `bin/measurable-goal-validate.sh` — checks goal is quantitative, not descriptive (at `/home/zerwiz/CodeP/wayofmono/bin/measurable-goal-validate.sh`)
269
+
270
+ **Integration Points (DONE)**:
271
+ - `ticket-manager`: Added `measurable_goal` to frontmatter schema + Production-Ready Standard
272
+ - Global ticket template: `measurable_goal` frontmatter + `## Measurable Goal (Back-Pressure Metric)` section
273
+ - `create-plan`: Step 1 requires ticket `measurable_goal` (STOP if missing/descriptive); template has `## Measurable Goal (from Ticket)`
274
+ - `validate-plan`: Section 1c "Measurable Goal Validation" (runs `bin/measurable-goal-validate.sh`)
275
+ - `validate-implementation`: Step 0.4 "Verify Measurable Goal Achievement" + report section
276
+
277
+ **Integration Points (DEFERRED)**:
278
+ - `ticket-create` skill: require measurable goal field (implemented in ticket-manager)
279
+ - `fm-teardown.sh`: goal validation before teardown
280
+
281
+ ---
282
+
283
+ ### 2.3 `logic-retention-guard` Skill (NEW)
284
+ **Purpose**: Periodic codebase logic quizzes / agent-educates-human during long tasks
285
+
286
+ **Location**: `/home/zerwiz/firstmate/.agents/skills/logic-retention-guard/`
287
+
288
+ **Deliverables**:
289
+ - `SKILL.md` — trigger: long-running tasks (>30 min), after major structural changes
290
+ - `bin/logic-quiz.sh` — generates MCQs + Mermaid diagrams on:
291
+ - Current system state (what fires on endpoint X?)
292
+ - New implementation changes (what does the new call stack look like?)
293
+ - Critical invariants (what must never break?)
294
+ - `bin/agent-educates-human.sh` — agent explains logic in plain English when human signals confusion
295
+ - Configurable interval: every N minutes or after M structural decisions
296
+
297
+ **Integration Points**:
298
+ - `fm-spawn.sh`: starts logic-retention timer for long tasks
299
+ - `harness-adapters`: integrates with agent's conversation flow
300
+ - `fm-send.sh`: delivers quiz/education to human
301
+
302
+ ---
303
+
304
+ ### 2.4 `multi-model-review` Skill (NEW)
305
+ **Purpose**: Parallel Codex + Opus review for high-stakes changes
306
+
307
+ **Location**: `/home/zerwiz/firstmate/.agents/skills/multi-model-review/`
308
+
309
+ **Deliverables**:
310
+ - `SKILL.md` — trigger: PR validation for high-stakes changes (configurable: security, payments, core infra)
311
+ - `bin/multi-model-review.sh` — spawns parallel reviewers:
312
+ - Reviewer 1: Codex (implementation correctness)
313
+ - Reviewer 2: Opus (architectural soundness, maintainability)
314
+ - Both get: PR diff + program design doc + measurable goals + pre-mortem confidence items
315
+ - `bin/review-synthesis.sh` — merges reviews, flags conflicts, produces unified verdict
316
+ - High-stakes detection: file patterns, ticket labels, captain designation
317
+
318
+ **Integration Points**:
319
+ - `validate-implementation`: invokes for high-stakes PRs
320
+ - `fm-pr-check.sh`: arms multi-model review poll
321
+ - `fm-merge-outcome-lib.sh`: requires unified verdict for merge
322
+
323
+ ---
324
+
325
+ ## Phase 3: Factory-Wide Integration & Polish (Week 4)
326
+
327
+ ### 3.1 Update `fm-brief.sh` — Master Scaffold
328
+ **File**: `/home/zerwiz/firstmate/bin/fm-brief.sh`
329
+
330
+ **Changes**:
331
+ - Scaffold includes ALL four layers as mandatory sections:
332
+ 1. Product (Layer 1)
333
+ 2. Architecture (Layer 2)
334
+ 3. Program Design (Layer 3) — validated by `program-design` skill
335
+ 4. Vertical Slices (Layer 4) — validated by `vertical-slice-executor` skill
336
+ - Measurable Goals section (validated by `measurable-goals` skill)
337
+ - Pre-Mortem Confidence section (validated by `pre-mortem-confidence` skill)
338
+ - Context Budget guidance (from `context-budget` skill)
339
+ - Worktree isolation assertion (existing)
340
+ - Delivery mode + yolo posture (existing)
341
+
342
+ **Validation**: `fm-spawn.sh` runs all skill validations before dispatch
343
+
344
+ ---
345
+
346
+ ### 3.2 Update `fm-session-start.sh` — Context Budget Init
347
+ **File**: `/home/zerwiz/firstmate/bin/fm-session-start.sh`
348
+
349
+ **Changes**:
350
+ - Initialize context budget tracking per task
351
+ - Display budget status in fleet-state digest
352
+ - Warn if any active task > 50% context
353
+
354
+ ---
355
+
356
+ ### 3.3 Update `fm-teardown.sh` — Goal Validation
357
+ **File**: `/home/zerwiz/firstmate/bin/fm-teardown.sh`
358
+
359
+ **Changes**:
360
+ - Require measurable goal validation before teardown (for ship tasks)
361
+ - Record goal outcome in backlog (met/not-met/pending)
362
+ - If not-met: auto-create follow-up ticket with `measurable-goals` skill
363
+
364
+ ---
365
+
366
+ ### 3.4 Update `data/backlog.md` Schema
367
+ **File**: `/home/zerwiz/firstmate/.tasks.toml` + backlog items
368
+
369
+ **Changes**:
370
+ - Add fields to task metadata:
371
+ ```toml
372
+ measurable_goal = "metric:target:method:timeframe:rollback"
373
+ program_design_complete = true/false
374
+ vertical_slice_defined = true/false
375
+ pre_mortem_done = true/false
376
+ context_budget_warned = true/false
377
+ multi_model_review_required = true/false
378
+ logic_retention_active = true/false
379
+ ```
380
+
381
+ ---
382
+
383
+ ## Phase 4: Secondmate & Fleet Propagation (Week 5)
384
+
385
+ ### 4.1 Secondmate Skill Propagation
386
+ - All new skills propagated to secondmate homes via `secondmate-provisioning`
387
+ - `config/crew-dispatch.json` updated with dispatch profiles for new skills
388
+ - Secondmate charter briefs include four-layer requirements
389
+
390
+ ### 4.2 Cross-Home Consistency
391
+ - `fm-fleet-sync.sh` validates all homes have required skills
392
+ - `fm-secondmate-reconcile.sh` checks secondmate compliance
393
+
394
+ ---
395
+
396
+ ## Skill Dependency Graph
397
+
398
+ ```
399
+ program-design (NEW)
400
+
401
+ ├── create-plan (UPDATE)
402
+ ├── ticket-executor (UPDATE) ──▶ vertical-slice-executor (NEW)
403
+ ├── fm-brief.sh (UPDATE)
404
+ └── fm-spawn.sh (UPDATE: pre-spawn gate)
405
+
406
+ context-budget (NEW)
407
+
408
+ ├── fm-session-start.sh (UPDATE)
409
+ ├── fm-spawn.sh (UPDATE)
410
+ ├── harness-adapters (UPDATE: token reporting)
411
+ └── fm-brief.sh (UPDATE)
412
+
413
+ pre-mortem-confidence (NEW)
414
+
415
+ ├── program-design (after design complete)
416
+ ├── fm-brief.sh (UPDATE)
417
+ └── multi-model-review (focus areas)
418
+
419
+ vertical-slice-executor (NEW)
420
+
421
+ ├── ticket-executor (UPDATE: Phase 0)
422
+ ├── fm-brief.sh (UPDATE)
423
+ └── validate-implementation (UPDATE: slice 1 first)
424
+
425
+ measurable-goals (NEW)
426
+
427
+ ├── ticket-create (UPDATE)
428
+ ├── create-plan (UPDATE)
429
+ ├── validate-implementation (UPDATE)
430
+ └── fm-teardown.sh (UPDATE)
431
+
432
+ incident-to-agent (NEW)
433
+
434
+ ├── process-event-sources (UPDATE: incident sources)
435
+ ├── fm-spawn.sh (UPDATE: incident briefs)
436
+ └── fm-pr-check.sh (UPDATE: incident-linked PRs)
437
+
438
+ logic-retention-guard (NEW)
439
+
440
+ ├── fm-spawn.sh (UPDATE: timer)
441
+ ├── harness-adapters (UPDATE: conversation integration)
442
+ └── fm-send.sh (UPDATE: quiz delivery)
443
+
444
+ multi-model-review (NEW)
445
+
446
+ ├── validate-implementation (UPDATE: high-stakes gate)
447
+ ├── fm-pr-check.sh (UPDATE: review poll)
448
+ └── fm-merge-outcome-lib.sh (UPDATE: verdict requirement)
449
+ ```
450
+
451
+ ---
452
+
453
+ ## Acceptance Criteria (Definition of Done)
454
+
455
+ ### Factory-Level
456
+ - [x] Every ship task has all 4 layers documented before spawn (Layer 3 implemented, Layer 4 in template, Layer 1/2 in existing template)
457
+ - [x] Zero horizontal-first builds (Slice 1 e2e testable first — ticket-executor Phase 0 gate)
458
+ - [x] 100% of ship tasks have measurable goals (implemented in ticket-manager + create-plan + validate-plan)
459
+ - [ ] Context budget warnings visible in fleet digest (deferred — fm-session-start.sh integration)
460
+ - [x] Pre-mortem confidence check on every program design (create-plan + validate-plan)
461
+ - [ ] High-stakes changes go through multi-model review (deferred)
462
+ - [ ] Incident-to-PR pipeline operational (core skill done, infra deferred)
463
+ - [ ] Logic retention active on tasks >30 min (deferred)
464
+
465
+ ### Skill-Level
466
+ - [x] 4 core foundation skills implemented (context-budget, pre-mortem-confidence, incident-to-agent, measurable-goals via existing skills)
467
+ - [x] 3 core pipeline skills updated (`create-plan`, `ticket-executor`, `validate-implementation`)
468
+ - [x] `validate-plan` updated with all new validations
469
+ - [x] Global plan template rewritten with all 4 layers + measurable goal + pre-mortem
470
+ - [x] All new skills copied to `command` project for MCP registration
471
+ - [ ] No regression in existing workflows (pending integration test)
472
+ - [ ] Skills work in both primary and secondmate homes (pending secondmate sync)
473
+
474
+ ### Quality Gates
475
+ - [ ] `fm-lint.sh` passes on all new/modified code
476
+ - [ ] Integration test: full ticket lifecycle (create → plan → execute → validate → teardown)
477
+ - [ ] Stress test: 5 concurrent tasks with context budget tracking
478
+ - [ ] Failure injection: simulate "never read code" scenario — factory catches it
479
+
480
+ ---
481
+
482
+ ## Risk Mitigation
483
+
484
+ | Risk | Likelihood | Impact | Mitigation |
485
+ |------|------------|--------|------------|
486
+ | Overhead slows pre-PMF work | High | Medium | Configurable threshold: skip four-layer for tickets labeled `vibe-mode` |
487
+ | Skill conflicts with existing | Medium | High | Feature flags per skill; gradual rollout |
488
+ | Token API differences across harnesses | High | Medium | `context-budget` skill abstracts harness differences |
489
+ | Measurable goals hard for some work | Medium | Low | Allow "learning goal" variant with qualitative criteria + captain sign-off |
490
+ | Multi-model review cost | Low | Medium | Only for high-stakes (configurable patterns); Opus + Codex ~$0.50/review |
491
+
492
+ ---
493
+
494
+ ## Rollout Sequence
495
+
496
+ 1. **Week 1** ✅ DONE (2026-09-10): Created 4 foundation skills + updated 3 core pipeline skills
497
+ - context-budget skill + bin/context-budget.sh + config/context-budget.yaml
498
+ - pre-mortem-confidence skill + bin/pre-mortem-check.sh
499
+ - incident-to-agent skill + bin/incident-classifier.sh + bin/incident-to-brief.sh
500
+ - measurable-goals (integrated into ticket-manager, create-plan, validate-plan, validate-implementation + bin/measurable-goal-validate.sh)
501
+ - Updated: create-plan, ticket-executor, validate-implementation, validate-plan
502
+ - Rewrote: global plan-template.md
503
+
504
+ 2. **Week 2** (In Progress): Integration into master scaffolds
505
+ - [ ] `fm-brief.sh`: add Layer 3, vertical slices, measurable goals, pre-mortem, context budget sections
506
+ - [ ] `fm-session-start.sh`: context budget init
507
+ - [ ] `fm-spawn.sh`: pass budget to worker, pre-spawn validation gate
508
+ - [ ] `fm-teardown.sh`: measurable goal validation
509
+ - [ ] `data/backlog.md` schema: add new fields
510
+
511
+ 3. **Week 3**: Build remaining automation skills
512
+ - [ ] `logic-retention-guard` skill
513
+ - [ ] `multi-model-review` skill
514
+
515
+ 4. **Week 4**: Incident pipeline infrastructure
516
+ - [ ] Extend `process-event-sources` with incident sources
517
+ - [ ] Cron infrastructure (Vercel/GH Actions + render.com)
518
+ - [ ] Integrate `fm-spawn` + `fm-pr-check` with incident briefs
519
+
520
+ 5. **Week 5**: Propagate to secondmates, fleet validation, documentation
521
+
522
+ ---
523
+
524
+ ## Captain Decision Points
525
+
526
+ 1. **Vibe-mode threshold**: At what team size/project stage does four-layer become mandatory? (Default: 5 engineers, paying users, 6-month horizon)
527
+ 2. **High-stakes definition**: What file patterns/ticket labels trigger multi-model review?
528
+ 3. **Context budget thresholds**: Use 30/50/80% defaults or tune per harness?
529
+ 4. **Incident classification**: Use GLM 5.2 or local model? What incident sources exist?
530
+ 5. **Measurable goal enforcement**: Hard gate (block teardown) or soft gate (warn + follow-up)?
531
+
532
+ ---
533
+
534
+ ## Reference Documents
535
+
536
+ - **Full Research**: `docs/agentic-engineering-workflow.md`
537
+ - **Firstmate Architecture**: `docs/architecture.md`
538
+ - **Supervision Protocols**: `docs/supervision-protocols/`
539
+ - **Skill Development Guide**: `docs/verification/` (various)
540
+ - **Configuration Schema**: `docs/configuration.md`
541
+
542
+ ---
543
+
544
+ ## Next Steps
545
+
546
+ 1. Captain reviews and approves plan
547
+ 2. Assign implementation tickets via `ticket-create` (with measurable goals!)
548
+ 3. Begin Phase 0 foundation skills
549
+ 4. Weekly sync on rollout progress
550
+
551
+ **Estimated Total Effort**: 5 weeks, ~200-300 lines of new skill code per skill, ~500 lines of integration updates
552
+
553
+ ---
554
+
555
+ ## Appendix: Dex Horthy GitHub Profile (Source Context)
556
+
557
+ **Profile**: https://github.com/dexhorthy
558
+ **Date Fetched**: August 2026
559
+ **Relevance**: Primary source for the agentic engineering workflow framework documented above
560
+
561
+ ---
562
+
563
+ ### Profile Summary
564
+
565
+ **Dex Horthy** (@dexhorthy) — Ex-NASA dev, co-founder of HumanLayer, author of "12-Factor Agents" and "Agent Control Plane"
566
+
567
+ - **Followers**: 1.9k | **Following**: 47 | **Repos**: 163 | **Stars**: 152
568
+ - **Bio**: "Looking for a cool place to deploy my hugo site"
569
+ - **Links**: https://humanlayer.dev | X: @dexhorthy | LinkedIn: in/dexterihorthy
570
+
571
+ ---
572
+
573
+ ### Pinned Repositories (Top 3)
574
+
575
+ 1. **humanlayer/humanlayer** (11.5k ⭐, 947 forks) — TypeScript
576
+ > "The best way to get AI coding agents to solve hard problems in complex codebases."
577
+
578
+ 2. **humanlayer/agentcontrolplane** (474 ⭐, 61 forks) — Go
579
+ > "ACP is the Agent Control Plane - a distributed agent scheduler optimized for simplicity, clarity, and control. It is designed for outer-loop agents that run without supervision, and make asynchronous decisions."
580
+
581
+ 3. **humanlayer/12-factor-agents** (25.8k ⭐, 2k forks) — TypeScript
582
+ > "What are the principles we can use to build LLM-powered software that is actually good enough to put in the hands of production customers?"
583
+
584
+ ---
585
+
586
+ ### Achievements
587
+
588
+ - ⭐ Starstruck (x4)
589
+ - 🤝 Pair Extraordinaire (x3)
590
+ - 🦈 Pull Shark (x4)
591
+ - ⚡ Quickdraw
592
+ - 🎯 YOLO
593
+ - 🧊 Arctic Code Vault Contributor
594
+
595
+ ---
596
+
597
+ ### Professional Context
598
+
599
+ **HumanLayer** (https://humanlayer.dev) — Dex's software factory platform implementing the principles in this document. The four-layer program design system, context engineering principles, vertical slice execution, and measurable goals framework were developed through running HumanLayer's "light software factory" (reviewing plans/tickets without reading code) and learning from its failure modes.
600
+
601
+ **Key Insight from Failure**: The July 2025 experiment where models kept diagnosing wrong causes for a shipping bug while nobody had read the code for 3 months directly produced the thesis: *"The odds of this happening to you are higher than the odds that models get good enough before it does."*
602
+
603
+ ---
604
+
605
+ ### Framework Genealogy
606
+
607
+ This document's framework synthesizes:
608
+ - **David Ondrej Podcast** (YouTube `xgkjtF89-44`) — Primary interview
609
+ - **OpenClawDatabase Deep-Dive** — Technical breakdown
610
+ - **FrontierModels Summary** — Key takeaways
611
+ - **Zovi AI** — Visual summary
612
+ - **Wesley Stander LinkedIn Analysis** — Professional context
613
+ - **Dylan Mulroy (Cloudflare)** — Program design advocacy
614
+ - **Victor Tali** — Pre-mortem confidence technique
615
+ - **HumanLayer Platform** — Production implementation