@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,106 @@
1
+ # Phase 3: Add Measurable Goals to ticket-manager Skill
2
+
3
+ **Project**: command (COM)
4
+ **Priority**: Critical
5
+ **Estimated Effort**: 3 days
6
+ **Measurable Goal**: `ticket_measurable_goal_coverage:100%:mcp_validation:30d:95%`
7
+
8
+ ---
9
+
10
+ ## Problem Statement
11
+
12
+ Dex Horthy: "An agent given a number to move will go much further than one given a description." Current ticket templates have **Acceptance Criteria** (descriptive) but no **Measurable Goal** (quantitative, business-tied). The "back-pressure" metric is what lets an agent run experiments, check data daily, and pick a winner.
13
+
14
+ ## Current State
15
+
16
+ - Ticket template at `/home/zerwiz/.pi/thoughts/global/templates/ticket-template.md` has Acceptance Criteria (checkboxes)
17
+ - Ticket frontmatter in `ticket-manager/SKILL.md` has no `measurable_goal` field
18
+ - Plans have "Success Criteria" but they're descriptive, not quantitative
19
+ - No validation that goals are measurable vs descriptive
20
+
21
+ ## Requirements
22
+
23
+ ### 1. Add `measurable_goal` Frontmatter Field
24
+ ```yaml
25
+ measurable_goal: "metric:target:method:timeframe:rollback"
26
+ # Examples:
27
+ # "checkout_conversion:15%:mixpanel:14d:11%"
28
+ # "api_p99_latency:200ms:datadog:7d:300ms"
29
+ # "deployment_frequency:daily:github:30d:weekly"
30
+ ```
31
+
32
+ Format: `metric_name:target_value:measurement_method:timeframe:rollback_threshold`
33
+
34
+ ### 2. Update Ticket Template
35
+ Add Measurable Goal section after Acceptance Criteria:
36
+ ```markdown
37
+ ## Measurable Goal (Back-Pressure Metric)
38
+
39
+ **Metric**: [e.g., checkout conversion rate]
40
+ **Current Baseline**: [e.g., 12.3%]
41
+ **Target**: [e.g., 15.0%]
42
+ **Measurement Method**: [e.g., Mixpanel event 'checkout_complete' / 'checkout_start']
43
+ **Timeframe**: [e.g., 14 days post-deploy]
44
+ **Rollback Threshold**: [e.g., < 11% for 48h]
45
+ ```
46
+
47
+ ### 3. Update `ticket-manager` Skill
48
+ - Add `measurable_goal` to frontmatter schema
49
+ - Validation: must match `metric:target:method:timeframe:rollback` format
50
+ - `create-plan` requires measurable goal from ticket
51
+ - `validate-implementation` checks goal achievement
52
+
53
+ ### 4. Add Validation Script
54
+ `bin/measurable-goal-validate.sh` — checks goal is quantitative, not descriptive
55
+
56
+ ## Implementation Approach
57
+
58
+ **Use MCP for all ticket/plan operations** — never hand-write markdown or git-push to f-rr-d. The MCP keeps DB row + canonical markdown + collision-safe numbering in sync.
59
+
60
+ 1. **Edit `ticket-manager/SKILL.md`**: Add `measurable_goal` to frontmatter schema
61
+ 2. **Edit global `ticket-template.md`**: Add Measurable Goal section (via MCP `templates_update`)
62
+ 3. **Edit `create-plan/SKILL.md`**: Require measurable goal from linked ticket (read via `tickets_get`)
63
+ 4. **Edit `validate-implementation/SKILL.md`**: Add goal validation step
64
+ 5. **Create `bin/measurable-goal-validate.sh`**: Format + quantitative check
65
+ 6. **Test via MCP**: Create ticket with `tickets_create` including measurable_goal, verify validation
66
+
67
+ ## Phases
68
+
69
+ - [ ] Phase 3.1: Add frontmatter field + template section (1 day)
70
+ - [ ] Phase 3.2: Update create-plan to require goal (0.5 day)
71
+ - [ ] Phase 3.3: Update validate-implementation to check goal (0.5 day)
72
+ - [ ] Phase 3.4: Create validation script (0.5 day)
73
+ - [ ] Phase 3.5: Test with existing tickets (0.5 day)
74
+
75
+ ## Success Criteria
76
+
77
+ ### Automated Verification:
78
+ - [ ] New tickets require `measurable_goal` frontmatter
79
+ - [ ] Format validation rejects descriptive goals ("improve UX")
80
+ - [ ] `create-plan` fails if ticket lacks measurable goal
81
+ - [ ] `validate-implementation` reports goal status
82
+
83
+ ### Manual Verification:
84
+ - [ ] Goals are quantitative (numbers, not adjectives)
85
+ - [ ] Measurement method is specific (tool + query)
86
+ - [ ] Rollback threshold defined
87
+
88
+ ## Acceptance Criteria
89
+
90
+ - [ ] 100% of new tickets in `command` project have measurable_goal within 30 days
91
+ - [ ] Rollback threshold: < 95% coverage triggers review
92
+ - [ ] Descriptive goals ("make it faster") rejected by validation
93
+
94
+ ## Risk Assessment
95
+
96
+ | Risk | Likelihood | Impact | Mitigation |
97
+ |------|------------|--------|------------|
98
+ | Hard to quantify some work | Medium | Medium | Allow "learning goal" variant with captain sign-off |
99
+ | Metric infrastructure missing | Low | High | Document required analytics setup |
100
+ | Gaming the metric | Low | Medium | Rollback threshold + captain review |
101
+
102
+ ## References
103
+
104
+ - Research: `docs/agentic-engineering-workflow.md` (Measurable Goals section)
105
+ - Dex Horthy: "If you can tell it a measurable output, the agent will move mountains for you"
106
+ - Back-pressure concept: LLM-as-judge acceptable, but real business metric drives convergence
@@ -0,0 +1,106 @@
1
+ # Phase 4: Create context-budget Skill
2
+
3
+ **Project**: command (COM)
4
+ **Priority**: Medium
5
+ **Estimated Effort**: 3 days
6
+ **Status**: ✅ COMPLETED (2026-09-10)
7
+ **Measurable Goal**: `context_budget_warning_accuracy:95%:token_tracking:30d:90%`
8
+
9
+ ---
10
+
11
+ ## Problem Statement
12
+
13
+ Dex Horthy: "The 'dumb zone' at ~50% context is real — for models AND humans." Current factory has no token budget awareness. Agents token-max while bottleneck is code review, leading to degraded model quality in the second half of context window.
14
+
15
+ ## Current State
16
+
17
+ - No token tracking in `fm-session-start.sh`, `fm-spawn.sh`, or harness adapters
18
+ - No warning at 50% context ("dumb zone")
19
+ - No enforcement of "structural decisions early when cheap"
20
+ - Harness adapters don't report token usage
21
+
22
+ ## What Was Implemented
23
+
24
+ ### 1. Created `context-budget` Skill
25
+ **Location**: `~/.config/opencode/skills/context-budget/` + copied to `command/.agents/skills/context-budget/`
26
+
27
+ - `SKILL.md` — skill definition with triggers, thresholds, integration points
28
+ - `bin/context-budget.sh` — token tracking script (tested: green<30, yellow=30-50, red=50-85, critical≥85)
29
+ - `config/context-budget.yaml` — thresholds per harness
30
+
31
+ ### 2. Token Thresholds (implemented)
32
+ ```yaml
33
+ thresholds:
34
+ green: 30 # < 30% — structural decisions optimal
35
+ yellow: 50 # 30-50% — "dumb zone" — make structural decisions NOW
36
+ red: 85 # 50-85% — warn, suggest compaction
37
+ critical: 85 # > 85% — force compaction or handoff
38
+ ```
39
+
40
+ ### 3. Integration with Existing Skills
41
+ - `create-plan`: Added context budget check before design work; added `## Context Budget at Creation` to plan template
42
+ - `ticket-executor`: Added `Context Budget Enforcement` section; Phase 0 validation gate includes budget check
43
+ - `validate-implementation`: Added budget compliance check (Step 0.5) and report line
44
+
45
+ ### 4. Deferred (Future Work)
46
+ - `fm-session-start.sh` budget initialization
47
+ - `fm-spawn.sh` passing budget to worker
48
+ - Harness adapter token reporting (Claude, Codex, OpenCode, etc.)
49
+ - `fm-brief.sh` budget section
50
+
51
+ ## Implementation Approach
52
+
53
+ **Created locally in opencode config first** (`~/.config/opencode/`), then copied to `command` project for MCP registration.
54
+
55
+ 1. Created skill directory: `.config/opencode/skills/context-budget/`
56
+ 2. Wrote `SKILL.md`: Define triggers, thresholds, integration points
57
+ 3. Wrote `bin/context-budget.sh`: Core tracking logic (tested working)
58
+ 4. Wrote `config/context-budget.yaml`: Thresholds per harness
59
+ 5. Updated `create-plan` skill: budget check + template section
60
+ 6. Updated `ticket-executor` skill: enforcement section + Phase 0 gate
61
+ 7. Updated `validate-implementation` skill: Step 0.5 + report
62
+ 8. Copied all artifacts to `command/.agents/skills/context-budget/` for MCP registration
63
+
64
+ ## Phases
65
+
66
+ - [x] Phase 4.1: Create skill structure + SKILL.md (0.5 day)
67
+ - [x] Phase 4.2: Write bin/context-budget.sh (1 day)
68
+ - [x] Phase 4.3: Update create-plan + ticket-executor + validate-implementation (0.5 day)
69
+ - [x] Phase 4.4: Copy to command project for MCP (0.5 day)
70
+ - [ ] Phase 4.5: fm-session-start.sh budget init (deferred)
71
+ - [ ] Phase 4.6: fm-spawn.sh pass budget to worker (deferred)
72
+ - [ ] Phase 4.7: Harness adapters token reporting (deferred)
73
+ - [ ] Phase 4.8: fm-brief.sh budget section (deferred)
74
+
75
+ ## Success Criteria
76
+
77
+ ### Automated Verification:
78
+ - [x] `bin/context-budget.sh` correctly categorizes: 10=green, 35=yellow, 55=red, 80=red, 90=critical
79
+ - [x] Skills updated with budget integration
80
+
81
+ ### Manual Verification:
82
+ - [ ] Structural decisions made early (< 50% context)
83
+ - [ ] No token-maxing while bottleneck is code review
84
+
85
+ ## Acceptance Criteria
86
+
87
+ - [x] Context budget skill created and tested
88
+ - [x] Integrated with create-plan, ticket-executor, validate-implementation
89
+ - [x] Copied to command project for MCP registration
90
+ - [ ] Context budget tracking active for all spawned tasks (deferred)
91
+ - [ ] Measurable goal: 95% warning accuracy within 30 days
92
+ - [ ] Rollback threshold: < 90% accuracy triggers review
93
+
94
+ ## Risk Assessment
95
+
96
+ | Risk | Likelihood | Impact | Mitigation |
97
+ |------|------------|--------|------------|
98
+ | Harness token APIs differ | High | Medium | Abstract in context-budget skill |
99
+ | Token counting inaccurate | Medium | High | Calibrate per harness |
100
+ | Overhead too high | Low | Medium | Sample, don't count every token |
101
+
102
+ ## References
103
+
104
+ - Research: `docs/agentic-engineering-workflow.md` (Context Engineering Principles)
105
+ - Dex Horthy: "One 43k-token session with sharp context > re-reading a 3,000-line diff later"
106
+ - Victor Tali trick: Ask model "which choices are you not confident about?" before run
@@ -0,0 +1,100 @@
1
+ # Phase 5: Create pre-mortem-confidence Skill
2
+
3
+ **Project**: command (COM)
4
+ **Priority**: Medium
5
+ **Estimated Effort**: 2 days
6
+ **Status**: ✅ COMPLETED (2026-09-10)
7
+ **Measurable Goal**: `pre_mortem_coverage:100%:design_review:30d:95%`
8
+
9
+ ---
10
+
11
+ ## Problem Statement
12
+
13
+ Victor Tali technique: "After a change, ask the model *'while working on this, which choices did you make that you're not confident of?'*." Dex's system does this **before the run instead of after** — surfacing uncertain choices during program design, not post-hoc. Current factory has no pre-mortem confidence check.
14
+
15
+ ## Current State
16
+
17
+ - No pre-mortem step in `create-plan`, `ticket-executor`, or `fm-brief.sh`
18
+ - No structured way to capture "low confidence choices" for review focus
19
+ - Models make silent structural decisions (Layer 3) without flagging uncertainty
20
+
21
+ ## What Was Implemented
22
+
23
+ ### 1. Created `pre-mortem-confidence` Skill
24
+ **Location**: `~/.config/opencode/skills/pre-mortem-confidence/` + copied to `command/.agents/skills/pre-mortem-confidence/`
25
+
26
+ - `SKILL.md` — skill definition with triggers, output format, integration
27
+ - `bin/pre-mortem-check.sh` — prompts agent for confidence assessment (tested: rejects confidence ≤6 without mitigation)
28
+
29
+ ### 2. Pre-Mortem Output Format (implemented)
30
+ ```markdown
31
+ ## Pre-Mortem Confidence Check
32
+
33
+ While designing this, which choices are you NOT confident about?
34
+ (List each with reasoning — these become review focus areas)
35
+
36
+ | Choice | Confidence (1-10) | Reasoning | Mitigation |
37
+ |--------|-------------------|-----------|------------|
38
+ | ... | ... | ... | ... |
39
+ ```
40
+
41
+ ### 3. Integration with Existing Skills
42
+ - `create-plan`: Added Step 3 mention + `## Pre-Mortem Confidence Check` section in template (after Layer 3)
43
+ - `validate-plan`: Added section 1d "Pre-Mortem Confidence Validation" + output format
44
+
45
+ ### 4. Deferred (Future Work)
46
+ - `fm-brief.sh`: Include pre-mortem section in brief scaffold
47
+ - `multi-model-review` skill (Phase 6): Use low-confidence items as review focus
48
+
49
+ ## Implementation Approach
50
+
51
+ **Created locally in opencode config first** (`~/.config/opencode/`), then copied to `command` project for MCP registration.
52
+
53
+ 1. Created skill directory: `.config/opencode/skills/pre-mortem-confidence/`
54
+ 2. Wrote `SKILL.md`: Define triggers, output format, integration
55
+ 3. Wrote `bin/pre-mortem-check.sh`: Prompts agent, produces table (tested working)
56
+ 4. Updated `create-plan` skill: pre-mortem step after Layer 3 + template section
57
+ 5. Updated `validate-plan` skill: section 1d validation
58
+ 6. Copied all artifacts to `command/.agents/skills/pre-mortem-confidence/` for MCP registration
59
+
60
+ ## Phases
61
+
62
+ - [x] Phase 5.1: Create skill structure + SKILL.md (0.5 day)
63
+ - [x] Phase 5.2: Write bin/pre-mortem-check.sh (0.5 day)
64
+ - [x] Phase 5.3: Update create-plan + validate-plan skills (0.5 day)
65
+ - [x] Phase 5.4: Copy to command project for MCP (0.5 day)
66
+ - [ ] Phase 5.5: fm-brief.sh pre-mortem section (deferred)
67
+ - [ ] Phase 5.6: multi-model-review uses low-confidence items (deferred)
68
+
69
+ ## Success Criteria
70
+
71
+ ### Automated Verification:
72
+ - [x] `bin/pre-mortem-check.sh` rejects confidence ≤6 without mitigation
73
+ - [x] Skills updated with pre-mortem integration
74
+
75
+ ### Manual Verification:
76
+ - [ ] Reviewers focus on low-confidence areas
77
+ - [ ] Fewer post-hoc "I didn't like that decision" moments
78
+
79
+ ## Acceptance Criteria
80
+
81
+ - [x] Pre-mortem confidence skill created and tested
82
+ - [x] Integrated with create-plan + validate-plan
83
+ - [x] Copied to command project for MCP registration
84
+ - [ ] 100% of plans have pre-mortem confidence check within 30 days
85
+ - [ ] Measurable goal: 100% coverage in design reviews
86
+ - [ ] Rollback threshold: < 95% coverage triggers process review
87
+
88
+ ## Risk Assessment
89
+
90
+ | Risk | Likelihood | Impact | Mitigation |
91
+ |------|------------|--------|------------|
92
+ | Agents overconfident | High | Medium | Calibrate with examples |
93
+ | Adds process overhead | Medium | Low | Keep it lightweight (5 min) |
94
+ | Gaming confidence scores | Low | Medium | Review focuses on low scores anyway |
95
+
96
+ ## References
97
+
98
+ - Research: `docs/agentic-engineering-workflow.md` (Pre-Mortem Confidence section)
99
+ - Victor Tali: "Ask the model which choices it was not confident about — before the run, not after"
100
+ - Dex Horthy: "Surfacing uncertain choices during program design, not post-hoc"
@@ -0,0 +1,109 @@
1
+ # Phase 6: Incident-to-Agent Pipeline
2
+
3
+ **Project**: command (COM)
4
+ **Priority**: Medium
5
+ **Estimated Effort**: 1 week
6
+ **Status**: ✅ CORE IMPLEMENTED (2026-09-10) — Infrastructure deferred
7
+ **Measurable Goal**: `incident_to_pr_latency:<30min:pagerduty:30d:<60min`
8
+
9
+ ---
10
+
11
+ ## Problem Statement
12
+
13
+ Dex Horthy: "**I don't wake up to an alert, I wake up to a pull request.**" Current factory has no incident-to-agent pipeline. David Ondrej's working version: GLM 5.2 reviews every uptime incident, classifies it (provider outage vs missing migration + specific fix), runs on cron (Vercel/GH Actions + render.com inference).
14
+
15
+ ## Current State
16
+
17
+ - `process-event-sources` skill exists but no incident source types
18
+ - No incident classifier (GLM 5.2 style)
19
+ - No auto-brief generation from incident classification
20
+ - No cron infrastructure for incident polling
21
+
22
+ ## What Was Implemented
23
+
24
+ ### 1. Created `incident-to-agent` Skill
25
+ **Location**: `~/.config/opencode/skills/incident-to-agent/` + copied to `command/.agents/skills/incident-to-agent/`
26
+
27
+ - `SKILL.md` — skill definition with triggers and outputs
28
+ - `bin/incident-classifier.sh` — GLM 5.2 style classification (tested: JSON title extraction fixed)
29
+ - `bin/incident-to-brief.sh` — generates four-layer brief from classification (tested: fix brief + runbook brief both work)
30
+
31
+ ### 2. Incident Classification (implemented)
32
+ ```markdown
33
+ ## Incident Classification
34
+
35
+ - Type: provider_outage | missing_migration | config_drift | code_regression | unknown
36
+ - Actionable: true/false
37
+ - Fix: specific fix description (if actionable)
38
+ - Priority: P1/P2/P3
39
+ ```
40
+
41
+ ### 3. Auto-Brief Generation (implemented)
42
+ - Actionable incidents → full four-layer brief targeting the fix
43
+ - Non-actionable incidents → documentation/update runbook brief
44
+ - Includes measurable goal (e.g., "restore API availability to 99.9%")
45
+
46
+ ### 4. Deferred (Requires Captain Credentials/Deployment)
47
+ - **`process-event-sources` extension**: Add incident source types (PagerDuty, GH Actions, Vercel, custom health checks)
48
+ - **Cron infrastructure**: Vercel/GitHub Actions for polling + render.com for inference
49
+ - **`fm-spawn.sh` integration**: Accept incident-triggered briefs
50
+ - **`fm-pr-check.sh`/`fm-teardown.sh`**: Track incident-linked PRs/tasks
51
+ - **End-to-end test**: Simulate incident → classification → brief → spawn → PR
52
+
53
+ ## Implementation Approach
54
+
55
+ **Created locally in opencode config first** (`~/.config/opencode/`), then copied to `command` project for MCP registration.
56
+
57
+ 1. Created skill directory: `.config/opencode/skills/incident-to-agent/`
58
+ 2. Wrote `SKILL.md`: Define triggers, outputs, classification schema
59
+ 3. Wrote `bin/incident-classifier.sh`: LLM-based classification (JSON parsing fixed, tested on PagerDuty-style payload)
60
+ 4. Wrote `bin/incident-to-brief.sh`: Four-layer brief generation (fix brief + `--runbook` brief tested)
61
+ 5. Copied all artifacts to `command/.agents/skills/incident-to-agent/` for MCP registration
62
+
63
+ ## Phases
64
+
65
+ - [x] Phase 6.1: Create incident-to-agent skill + classifier + brief scripts (2 days)
66
+ - [ ] Phase 6.2: Extend process-event-sources with incident sources (1 day) — **deferred, needs captain creds**
67
+ - [ ] Phase 6.3: Cron infrastructure (Vercel + render.com) (2 days) — **deferred, needs captain creds**
68
+ - [ ] Phase 6.4: Integrate with fm-spawn + fm-pr-check (1 day) — **deferred**
69
+ - [ ] Phase 6.5: End-to-end test with simulated incident (1 day) — **deferred**
70
+
71
+ ## Success Criteria
72
+
73
+ ### Automated Verification:
74
+ - [x] `bin/incident-classifier.sh` correctly extracts title from PagerDuty-style JSON
75
+ - [x] `bin/incident-to-brief.sh` generates valid fix brief + runbook brief
76
+ - [ ] Incident webhook triggers classification (deferred)
77
+ - [ ] Classification produces actionable/non-actionable verdict (deferred)
78
+ - [ ] Actionable incidents generate four-layer brief (deferred)
79
+ - [ ] Brief spawns agent via fm-spawn (deferred)
80
+ - [ ] PR created and tracked as incident-linked (deferred)
81
+
82
+ ### Manual Verification:
83
+ - [ ] "Wake up to PR, not alert" workflow works (deferred)
84
+ - [ ] Classification accuracy > 90% on test incidents (deferred)
85
+ - [ ] Mean time to PR < 30 minutes (deferred)
86
+
87
+ ## Acceptance Criteria
88
+
89
+ - [x] Core incident-to-agent skill created and tested locally
90
+ - [x] Copied to command project for MCP registration
91
+ - [ ] Incident-to-PR pipeline operational for `command` project (deferred)
92
+ - [ ] Measurable goal: < 30min incident-to-PR latency within 30 days (deferred)
93
+ - [ ] Rollback threshold: < 60min latency triggers review (deferred)
94
+ - [ ] Classification accuracy > 90% (deferred)
95
+
96
+ ## Risk Assessment
97
+
98
+ | Risk | Likelihood | Impact | Mitigation |
99
+ |------|------------|--------|------------|
100
+ | Classifier accuracy low | Medium | High | Human-in-loop for first 2 weeks |
101
+ | Webhook security | High | High | Signature verification, secret rotation |
102
+ | Cron reliability | Medium | High | Multi-region, dead-man switches |
103
+ | False positive PRs | Medium | Medium | Require captain approval for P1 |
104
+
105
+ ## References
106
+
107
+ - Research: `docs/agentic-engineering-workflow.md` (Incident Routing section)
108
+ - David Ondrej: GLM 5.2 reviews every uptime incident, cron on Vercel/GH Actions + render.com
109
+ - Dex Horthy: "Route the incident straight into the agent pipeline"