@lumenflow/cli 2.2.2 → 2.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 (120) hide show
  1. package/README.md +147 -57
  2. package/dist/__tests__/agent-log-issue.test.js +56 -0
  3. package/dist/__tests__/cli-entry-point.test.js +66 -17
  4. package/dist/__tests__/cli-subprocess.test.js +25 -0
  5. package/dist/__tests__/init.test.js +298 -0
  6. package/dist/__tests__/initiative-plan.test.js +340 -0
  7. package/dist/__tests__/mem-cleanup-execution.test.js +19 -0
  8. package/dist/__tests__/merge-block.test.js +220 -0
  9. package/dist/__tests__/release.test.js +61 -0
  10. package/dist/__tests__/safe-git.test.js +191 -0
  11. package/dist/__tests__/state-doctor.test.js +274 -0
  12. package/dist/__tests__/wu-done.test.js +36 -0
  13. package/dist/__tests__/wu-edit.test.js +119 -0
  14. package/dist/__tests__/wu-prep.test.js +108 -0
  15. package/dist/agent-issues-query.js +4 -3
  16. package/dist/agent-log-issue.js +25 -4
  17. package/dist/backlog-prune.js +5 -4
  18. package/dist/cli-entry-point.js +11 -1
  19. package/dist/doctor.js +368 -0
  20. package/dist/flow-bottlenecks.js +6 -5
  21. package/dist/flow-report.js +4 -3
  22. package/dist/gates.js +356 -101
  23. package/dist/guard-locked.js +4 -3
  24. package/dist/guard-worktree-commit.js +4 -3
  25. package/dist/init.js +517 -86
  26. package/dist/initiative-add-wu.js +4 -3
  27. package/dist/initiative-bulk-assign-wus.js +8 -5
  28. package/dist/initiative-create.js +73 -37
  29. package/dist/initiative-edit.js +37 -21
  30. package/dist/initiative-list.js +4 -3
  31. package/dist/initiative-plan.js +337 -0
  32. package/dist/initiative-status.js +4 -3
  33. package/dist/lane-health.js +377 -0
  34. package/dist/lane-suggest.js +382 -0
  35. package/dist/mem-checkpoint.js +2 -2
  36. package/dist/mem-cleanup.js +2 -2
  37. package/dist/mem-context.js +306 -0
  38. package/dist/mem-create.js +2 -2
  39. package/dist/mem-delete.js +293 -0
  40. package/dist/mem-inbox.js +2 -2
  41. package/dist/mem-index.js +211 -0
  42. package/dist/mem-init.js +1 -1
  43. package/dist/mem-profile.js +207 -0
  44. package/dist/mem-promote.js +254 -0
  45. package/dist/mem-ready.js +2 -2
  46. package/dist/mem-signal.js +2 -2
  47. package/dist/mem-start.js +2 -2
  48. package/dist/mem-summarize.js +2 -2
  49. package/dist/mem-triage.js +2 -2
  50. package/dist/merge-block.js +222 -0
  51. package/dist/metrics-cli.js +7 -4
  52. package/dist/metrics-snapshot.js +4 -3
  53. package/dist/orchestrate-initiative.js +10 -4
  54. package/dist/orchestrate-monitor.js +379 -31
  55. package/dist/release.js +69 -29
  56. package/dist/signal-cleanup.js +296 -0
  57. package/dist/spawn-list.js +6 -5
  58. package/dist/state-bootstrap.js +5 -4
  59. package/dist/state-cleanup.js +360 -0
  60. package/dist/state-doctor-fix.js +196 -0
  61. package/dist/state-doctor.js +501 -0
  62. package/dist/validate-agent-skills.js +4 -3
  63. package/dist/validate-agent-sync.js +4 -3
  64. package/dist/validate-backlog-sync.js +4 -3
  65. package/dist/validate-skills-spec.js +4 -3
  66. package/dist/validate.js +4 -3
  67. package/dist/wu-block.js +3 -3
  68. package/dist/wu-claim.js +208 -98
  69. package/dist/wu-cleanup.js +5 -4
  70. package/dist/wu-create.js +71 -46
  71. package/dist/wu-delete.js +88 -60
  72. package/dist/wu-deps.js +6 -5
  73. package/dist/wu-done-check.js +34 -0
  74. package/dist/wu-done.js +39 -12
  75. package/dist/wu-edit.js +63 -28
  76. package/dist/wu-infer-lane.js +7 -6
  77. package/dist/wu-preflight.js +23 -81
  78. package/dist/wu-prep.js +125 -0
  79. package/dist/wu-prune.js +4 -3
  80. package/dist/wu-recover.js +88 -22
  81. package/dist/wu-repair.js +7 -6
  82. package/dist/wu-spawn.js +226 -270
  83. package/dist/wu-status.js +4 -3
  84. package/dist/wu-unblock.js +5 -5
  85. package/dist/wu-unlock-lane.js +4 -3
  86. package/dist/wu-validate.js +5 -4
  87. package/package.json +16 -7
  88. package/templates/core/.lumenflow/constraints.md.template +192 -0
  89. package/templates/core/.lumenflow/rules/git-safety.md.template +27 -0
  90. package/templates/core/.lumenflow/rules/wu-workflow.md.template +48 -0
  91. package/templates/core/AGENTS.md.template +60 -0
  92. package/templates/core/LUMENFLOW.md.template +255 -0
  93. package/templates/core/UPGRADING.md.template +121 -0
  94. package/templates/core/ai/onboarding/agent-safety-card.md.template +106 -0
  95. package/templates/core/ai/onboarding/first-wu-mistakes.md.template +198 -0
  96. package/templates/core/ai/onboarding/quick-ref-commands.md.template +186 -0
  97. package/templates/core/ai/onboarding/release-process.md.template +362 -0
  98. package/templates/core/ai/onboarding/troubleshooting-wu-done.md.template +159 -0
  99. package/templates/core/ai/onboarding/wu-create-checklist.md.template +117 -0
  100. package/templates/vendors/aider/.aider.conf.yml.template +27 -0
  101. package/templates/vendors/claude/.claude/CLAUDE.md.template +52 -0
  102. package/templates/vendors/claude/.claude/settings.json.template +49 -0
  103. package/templates/vendors/claude/.claude/skills/bug-classification/SKILL.md.template +192 -0
  104. package/templates/vendors/claude/.claude/skills/code-quality/SKILL.md.template +152 -0
  105. package/templates/vendors/claude/.claude/skills/context-management/SKILL.md.template +155 -0
  106. package/templates/vendors/claude/.claude/skills/execution-memory/SKILL.md.template +304 -0
  107. package/templates/vendors/claude/.claude/skills/frontend-design/SKILL.md.template +131 -0
  108. package/templates/vendors/claude/.claude/skills/initiative-management/SKILL.md.template +164 -0
  109. package/templates/vendors/claude/.claude/skills/library-first/SKILL.md.template +98 -0
  110. package/templates/vendors/claude/.claude/skills/lumenflow-gates/SKILL.md.template +87 -0
  111. package/templates/vendors/claude/.claude/skills/multi-agent-coordination/SKILL.md.template +84 -0
  112. package/templates/vendors/claude/.claude/skills/ops-maintenance/SKILL.md.template +254 -0
  113. package/templates/vendors/claude/.claude/skills/orchestration/SKILL.md.template +189 -0
  114. package/templates/vendors/claude/.claude/skills/tdd-workflow/SKILL.md.template +139 -0
  115. package/templates/vendors/claude/.claude/skills/worktree-discipline/SKILL.md.template +138 -0
  116. package/templates/vendors/claude/.claude/skills/wu-lifecycle/SKILL.md.template +106 -0
  117. package/templates/vendors/cline/.clinerules.template +53 -0
  118. package/templates/vendors/cursor/.cursor/rules/lumenflow.md.template +34 -0
  119. package/templates/vendors/cursor/.cursor/rules.md.template +28 -0
  120. package/templates/vendors/windsurf/.windsurf/rules/lumenflow.md.template +34 -0
@@ -0,0 +1,164 @@
1
+ ---
2
+ name: initiative-management
3
+ description: Create, track, and coordinate multi-phase initiatives spanning multiple WUs and lanes. Use when working with INIT-NNN IDs, multi-phase projects, cross-lane coordination, or asking about initiative status.
4
+ version: 1.1.0
5
+ source: packages/@lumenflow/cli/src/initiative-*.ts
6
+ last_updated: {{DATE}}
7
+ allowed-tools: Read, Bash, Grep
8
+ ---
9
+
10
+ # Initiative Management Skill
11
+
12
+ Guides agents through creating, tracking, and coordinating multi-phase initiatives.
13
+
14
+ ## When This Skill Activates
15
+
16
+ - User mentions "initiative", "INIT-", or initiative IDs
17
+ - User asks about multi-phase projects or cross-lane coordination
18
+ - User wants to group related WUs under a common goal
19
+ - User asks about initiative status or progress
20
+
21
+ ## Available Commands
22
+
23
+ ### Create an Initiative
24
+
25
+ ```bash
26
+ pnpm initiative:create --id INIT-001 --title "Initiative Title" --description "Description" --wus WU-001,WU-002,WU-003
27
+ ```
28
+
29
+ Creates a new initiative that groups multiple WUs together.
30
+
31
+ ### List All Initiatives
32
+
33
+ ```bash
34
+ pnpm initiative:list
35
+ ```
36
+
37
+ Shows all active initiatives with their status and linked WUs.
38
+
39
+ ### Check Initiative Status
40
+
41
+ ```bash
42
+ pnpm initiative:status --id INIT-001
43
+ ```
44
+
45
+ Shows detailed status of a specific initiative including:
46
+
47
+ - Linked WUs and their completion status
48
+ - Overall progress percentage
49
+ - Cross-lane dependencies
50
+ - Blockers affecting the initiative
51
+
52
+ ### Link a WU to an Initiative
53
+
54
+ ```bash
55
+ pnpm initiative:add-wu --initiative INIT-001 --wu WU-123
56
+ ```
57
+
58
+ Links an existing WU to an initiative bidirectionally:
59
+
60
+ - Adds `initiative: INIT-001` field to WU YAML
61
+ - Adds WU ID to initiative `wus:` array
62
+ - Idempotent: no error if link already exists
63
+ - Errors if WU is already linked to a different initiative
64
+
65
+ ### Edit an Initiative
66
+
67
+ ```bash
68
+ # Update status
69
+ pnpm initiative:edit --id INIT-001 --status in_progress
70
+
71
+ # Set blocking initiative
72
+ pnpm initiative:edit --id INIT-001 --blocked-by INIT-002 --blocked-reason "Waiting for Phase 1"
73
+
74
+ # Remove blocking
75
+ pnpm initiative:edit --id INIT-001 --unblock
76
+
77
+ # Add lane
78
+ pnpm initiative:edit --id INIT-001 --add-lane "Operations: Tooling"
79
+
80
+ # Append note
81
+ pnpm initiative:edit --id INIT-001 --notes "Phase 2 started"
82
+
83
+ # Combine multiple edits
84
+ pnpm initiative:edit --id INIT-001 --status in_progress --add-lane "Operations: Tooling" --notes "Work started"
85
+ ```
86
+
87
+ Edits initiative YAML fields atomically using micro-worktree isolation:
88
+
89
+ - `--status`: Update status (draft, open, in_progress, done, archived)
90
+ - `--blocked-by` + `--blocked-reason`: Set blocking initiative (reason required)
91
+ - `--unblock`: Remove blocked_by and blocked_reason fields
92
+ - `--add-lane`: Append lane (no duplicates, repeatable)
93
+ - `--notes`: Append note to notes array
94
+
95
+ ## Initiative Structure
96
+
97
+ Initiatives are defined in `docs/04-operations/tasks/initiatives/INIT-001.yaml`:
98
+
99
+ ```yaml
100
+ id: INIT-001
101
+ slug: initiative-slug
102
+ title: 'Initiative Title'
103
+ description: |
104
+ Multi-line description of the initiative goal
105
+ status: draft # draft | open | in_progress | done | archived
106
+ priority: P2 # P0 | P1 | P2 | P3
107
+ owner: team-or-individual # optional
108
+ created: 2025-MM-DD
109
+ target_date: 2025-MM-DD # optional
110
+ phases: [] # optional ordered phases
111
+ success_metrics: [] # optional completion criteria
112
+ labels: [] # optional cross-cutting tags
113
+ wus: # Linked WU IDs (bidirectional with WU.initiative field)
114
+ - WU-001
115
+ - WU-002
116
+ - WU-003
117
+ ```
118
+
119
+ ## Cross-Lane Coordination
120
+
121
+ Initiatives often span multiple lanes. Key coordination patterns:
122
+
123
+ 1. **Phase dependencies**: WU-002 in one lane depends on WU-001 in another
124
+ 2. **Parallel execution**: Multiple lanes work simultaneously on independent WUs
125
+ 3. **Integration points**: Final WU combines work from all lanes
126
+
127
+ ## Spawning Sub-Agents for Initiative WUs (MANDATORY)
128
+
129
+ When orchestrating an initiative with multiple WUs, use `wu:spawn` to generate complete Task invocations:
130
+
131
+ ```bash
132
+ # For each WU being delegated to a sub-agent:
133
+ pnpm wu:spawn --id WU-1501 # Generates Task invocation with full context
134
+ pnpm wu:spawn --id WU-1502
135
+ pnpm wu:spawn --id WU-1503
136
+ ```
137
+
138
+ ### Orchestration Pattern
139
+
140
+ 1. **Generate prompts**: Run `pnpm wu:spawn --id WU-XXX` for each WU
141
+ 2. **Spawn in parallel**: Use Task tool with `run_in_background: true`
142
+ 3. **Monitor progress**: Use `pnpm mem:inbox --since 30m` (NOT TaskOutput - causes context explosion)
143
+ 4. **Synthesise**: Combine results from all sub-agents
144
+
145
+ ### What wu:spawn Provides
146
+
147
+ - Context loading preamble (LUMENFLOW.md, README, lumenflow-complete, WU YAML)
148
+ - Full acceptance criteria from WU spec
149
+ - Constraints block at end (per "Lost in the Middle" research)
150
+
151
+ ### When NOT to Use wu:spawn
152
+
153
+ - Helper agents for the orchestrator's own WU (use inline context)
154
+ - Validation agents checking orchestrator's work
155
+ - Explore agents for codebase research
156
+
157
+ See [agent-invocation-guide.md](../../../docs/04-operations/_frameworks/lumenflow/agent/onboarding/agent-invocation-guide.md) for decision tree.
158
+
159
+ ## Best Practices
160
+
161
+ 1. **Keep initiatives focused**: 3-10 WUs per initiative
162
+ 2. **Clear dependencies**: Document which WUs block others
163
+ 3. **Regular status updates**: Update initiative notes as work progresses
164
+ 4. **Lane alignment**: Ensure each WU is in the appropriate lane
@@ -0,0 +1,98 @@
1
+ ---
2
+ name: library-first
3
+ description: Validate well-known libraries solve your problem before custom code. Use when implementing parsing, dates, validation, or any non-trivial logic.
4
+ version: 1.0.0
5
+ source: docs/04-operations/_frameworks/lumenflow/agent/onboarding/library-first-toolkit.md
6
+ source_sections: Validation Protocol, Decision Tree, Context7 Query Templates
7
+ last_updated: {{DATE}}
8
+ allowed-tools: Read, mcp__context7__*
9
+ ---
10
+
11
+ # Library-First Skill
12
+
13
+ **Source**: `docs/04-operations/_frameworks/lumenflow/agent/onboarding/library-first-toolkit.md` (canonical)
14
+
15
+ Search for libraries BEFORE writing custom code. Custom implementations create debt, violate DRY/SOLID, and introduce bugs that libraries have already solved.
16
+
17
+ ## Quick Reference: Validation Protocol
18
+
19
+ 1. **Search context7**: `"<use case> library <language>"`
20
+ 2. **Check npm trends**: >10k weekly downloads
21
+ 3. **Verify maintenance**: Last commit <12 months, issue response <7 days
22
+ 4. **Document in WU notes**: Libraries considered + justification
23
+
24
+ ## Context7 Query Patterns
25
+
26
+ ```
27
+ # Generic
28
+ "<functionality> library <language>"
29
+ "<language> <functionality> npm package"
30
+
31
+ # Common use cases
32
+ "markdown parser library JavaScript" → remark, marked
33
+ "date manipulation library TypeScript" → date-fns, dayjs
34
+ "YAML validation library Node.js" → zod, ajv, joi
35
+ "schema validation library TypeScript" → zod
36
+ "git operations library Node.js" → simple-git
37
+ ```
38
+
39
+ ## Decision Tree
40
+
41
+ ```
42
+ Found library covering ≥70%?
43
+ ├─ YES, covers 100% → Use directly ✅
44
+ ├─ YES, covers 70-99% → Thin wrapper pattern ✅
45
+ │ └─ Document gaps in WU notes
46
+ └─ NO → Check requirements:
47
+ ├─ Searched ≥3 libraries? NO → STOP, search more ⛔
48
+ ├─ Complex logic (parsing, dates, crypto)? → STOP, find library ⛔
49
+ └─ Simple (<50 LOC, no edge cases)? → Custom OK with justification ✅
50
+ ```
51
+
52
+ ## Anti-Patterns (NEVER DO)
53
+
54
+ | Anti-Pattern | Use Instead |
55
+ | --------------------------------- | --------------------------------------------- |
56
+ | Regex for markdown/HTML/JSON/YAML | Grammar-based parsers (remark, cheerio, yaml) |
57
+ | Custom date/time parsing | date-fns, dayjs, luxon |
58
+ | Reimplementing array/object utils | lodash or native methods |
59
+ | Custom HTTP clients | axios, fetch with thin adapter |
60
+ | Custom cryptography | Node.js crypto, bcrypt |
61
+
62
+ ## Validation Criteria
63
+
64
+ | Criterion | Threshold |
65
+ | ---------------- | -------------------------------- |
66
+ | Weekly downloads | >10k (npm trends) |
67
+ | Last updated | <12 months |
68
+ | Issue response | <7 days |
69
+ | TypeScript types | Available (`@types/*` or native) |
70
+ | Security | Documented policy or audit |
71
+
72
+ ## MCP Tool Reference
73
+
74
+ | Tool | Use Case |
75
+ | ----------------------------------- | -------------------------------- |
76
+ | `mcp__context7__resolve-library-id` | Find library ID from name |
77
+ | `mcp__context7__query-docs` | Get documentation for validation |
78
+
79
+ **Note**: MCP tools provide connectivity; this skill provides procedural knowledge for using them correctly.
80
+
81
+ ## WU Notes Template
82
+
83
+ ```yaml
84
+ library_decisions:
85
+ - use_case: 'YAML validation'
86
+ libraries_considered: ['ajv', 'joi', 'zod']
87
+ selected: 'zod'
88
+ reason: 'TypeScript-native, 100KB smaller, composable'
89
+ ```
90
+
91
+ ## Integration with Other Skills
92
+
93
+ - **tdd-workflow**: Library selection happens BEFORE writing tests
94
+ - **code-quality**: Library-first prevents DRY violations
95
+
96
+ ---
97
+
98
+ **Red Flags**: If you're writing regex for structured formats, date parsing, or reimplementing utilities — STOP and search for a library.
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: lumenflow-gates
3
+ description: Quality gates troubleshooting (format, lint, typecheck, tests). Use when gates fail, debugging format/lint/typecheck errors, or determining if failure is from your changes vs pre-existing.
4
+ version: 2.1.0
5
+ source: docs/04-operations/_frameworks/lumenflow/lumenflow-complete.md
6
+ source_sections: §6.4 (Validation & Gates)
7
+ last_updated: {{DATE}}
8
+ allowed-tools: Read, Bash, Grep
9
+ ---
10
+
11
+ # LumenFlow Gates Skill
12
+
13
+ **Source**: `docs/04-operations/_frameworks/lumenflow/lumenflow-complete.md` §6.4 (canonical)
14
+
15
+ ## When to Use
16
+
17
+ Activate this skill when:
18
+
19
+ - `pnpm gates` fails with format, lint, or typecheck errors
20
+ - Need to determine if failure is from your changes vs pre-existing
21
+ - Debugging test failures or coverage issues
22
+ - Deciding whether to use `--skip-gates` (emergency only)
23
+
24
+ **Use skill first**: Follow the decision tree and fix patterns in this skill.
25
+
26
+ **Spawn lumenflow-enforcer agent when**: Complex gate failures span multiple packages, pre-existing failures require investigation, or DoD validation needs holistic review.
27
+
28
+ ## Gate Sequence
29
+
30
+ ```
31
+ pnpm gates = format:check → lint → typecheck → spec:linter → tests
32
+ ```
33
+
34
+ ## Fix Patterns
35
+
36
+ | Gate | Auto-fix | Manual |
37
+ | --------- | --------------- | ----------------------------------- |
38
+ | Format | `pnpm format` | - |
39
+ | Lint | `pnpm lint:fix` | Fix reported issues |
40
+ | Typecheck | - | Fix type errors (first error first) |
41
+ | Tests | - | Debug, fix mocks, update snapshots |
42
+
43
+ ## Decision Tree
44
+
45
+ **Gate failed. Is it from YOUR changes?**
46
+
47
+ ```bash
48
+ git checkout main && pnpm gates # Check main
49
+ # Pass on main → Your change caused it → Fix it
50
+ # Fail on main → Pre-existing → Consider --skip-gates
51
+ ```
52
+
53
+ **Can you fix it?**
54
+
55
+ - In your `code_paths`, <=10 lines → Fix in place
56
+ - Different paths, >10 lines → Create Bug WU
57
+
58
+ ## Skip Gates (Emergency)
59
+
60
+ Only when pre-existing failures:
61
+
62
+ ```bash
63
+ pnpm wu:done --id WU-XXX --skip-gates --reason "Pre-existing" --fix-wu WU-YYY
64
+ ```
65
+
66
+ ## Common Lint Fixes
67
+
68
+ ```
69
+ no-explicit-any → Add proper types
70
+ no-unused-vars → Remove or prefix with _
71
+ no-restricted-paths → Check hex boundaries (application cannot import infrastructure)
72
+ exhaustive-deps → Add missing dependencies
73
+ ```
74
+
75
+ ## Validation Commands
76
+
77
+ ```bash
78
+ pnpm gates # All gates
79
+ pnpm gates -- --docs-only # Docs WUs
80
+ pnpm validate:context # Context validation
81
+ pnpm spec:linter # Spec validation
82
+ pnpm tasks:validate # WU YAML validation
83
+ ```
84
+
85
+ ---
86
+
87
+ **Full spec**: [lumenflow-complete.md §6.4](../../../docs/04-operations/_frameworks/lumenflow/lumenflow-complete.md)
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: multi-agent-coordination
3
+ description: Coordinate multiple agents on parallel WUs using git branch locking. Use when spawning sub-agents, coordinating parallel WUs, or handling abandoned WU recovery.
4
+ version: 2.1.0
5
+ source: docs/04-operations/_frameworks/lumenflow/agent/onboarding/agent-invocation-guide.md
6
+ last_updated: {{DATE}}
7
+ allowed-tools: Read, Bash, Grep
8
+ ---
9
+
10
+ # Multi-Agent Coordination Skill
11
+
12
+ ## When to Use
13
+
14
+ Activate this skill when:
15
+
16
+ - Spawning sub-agents for WU delegation
17
+ - Coordinating parallel WUs across different lanes
18
+ - Handling abandoned WU recovery
19
+ - Using memory layer for inter-agent signals
20
+
21
+ **Use skill first**: Follow the coordination patterns for spawning and signalling.
22
+
23
+ ## Git Branch Locking
24
+
25
+ - Branch `lane/operations/wu-700` exists = WU claimed
26
+ - Git prevents duplicate branches = automatic locking
27
+ - No heartbeats, no session files
28
+
29
+ ## Spawning Sub-Agents
30
+
31
+ **Use wu:spawn** when delegating entire WU:
32
+
33
+ ```bash
34
+ pnpm wu:spawn --id WU-XXX # Standard
35
+ pnpm wu:spawn --id WU-XXX --thinking # Complex WUs
36
+ ```
37
+
38
+ **DON'T use wu:spawn** for helper agents (code-reviewer, test-engineer) on YOUR WU.
39
+
40
+ ## Parallel Spawning
41
+
42
+ **Different lanes**: Safe to parallelize (`run_in_background: true`)
43
+ **Same lane**: Sequential only (WIP=1 rule)
44
+
45
+ ```typescript
46
+ // Parallel validation (single message)
47
+ Task({ subagent_type: 'code-reviewer', run_in_background: true, prompt: '...' });
48
+ Task({ subagent_type: 'test-engineer', run_in_background: true, prompt: '...' });
49
+ ```
50
+
51
+ ## Handling Abandoned WUs
52
+
53
+ ```bash
54
+ # Monitor for stuck agents
55
+ pnpm orchestrate:monitor
56
+
57
+ # Review checkpoints
58
+ pnpm mem:ready --wu WU-XXX
59
+
60
+ # Take over (requires coordination)
61
+ cd worktrees/<lane>-wu-XXX
62
+ # Review uncommitted changes, commit, continue
63
+ ```
64
+
65
+ ## Memory Layer Coordination
66
+
67
+ ```bash
68
+ pnpm mem:signal "WU-XXX complete" --wu WU-XXX # Broadcast
69
+ pnpm mem:inbox --lane Operations # Check updates
70
+ pnpm mem:checkpoint "Ready for handoff" --wu WU-XXX # Handoff
71
+ ```
72
+
73
+ ## Common Patterns
74
+
75
+ | Scenario | Approach |
76
+ | ------------------ | ------------------------------------------ |
77
+ | Sequential handoff | Block WU, other agent unblocks |
78
+ | Parallel subtasks | Create separate WUs, work in parallel |
79
+ | Multi-lane feature | Create dependency WUs, complete deps first |
80
+ | Research spike | `type: spike`, `lane: Discovery` |
81
+
82
+ ---
83
+
84
+ **Full docs**: [agent-invocation-guide.md](../../../docs/04-operations/_frameworks/lumenflow/agent/onboarding/agent-invocation-guide.md) | [execution-memory skill](../execution-memory/SKILL.md)
@@ -0,0 +1,254 @@
1
+ ---
2
+ name: ops-maintenance
3
+ description: Run maintenance tasks, generate metrics reports, validate configurations, and manage agent sessions. Use for wu:prune, metrics reports, validation failures, agent sessions, backlog health checks, or bottleneck analysis.
4
+ version: 1.1.0
5
+ source: packages/@lumenflow/cli/src/
6
+ last_updated: {{DATE}}
7
+ allowed-tools: Read, Bash, Grep
8
+ ---
9
+
10
+ # Operations & Maintenance Skill
11
+
12
+ Guides agents through maintenance tasks, metrics reporting, validation, and agent session management.
13
+
14
+ ## When This Skill Activates
15
+
16
+ - User mentions maintenance, cleanup, or pruning
17
+ - User asks about metrics, DORA, or flow reports
18
+ - User encounters validation errors (tasks:validate, spec:linter)
19
+ - User asks about agent sessions
20
+ - User wants to check backlog health
21
+
22
+ ## Maintenance Commands
23
+
24
+ ### Worktree Cleanup
25
+
26
+ ```bash
27
+ # Dry-run (shows what would be pruned)
28
+ pnpm wu:prune
29
+
30
+ # Execute cleanup
31
+ pnpm wu:prune --execute
32
+ ```
33
+
34
+ Removes stale/orphaned worktrees from completed or abandoned WUs.
35
+
36
+ ### Backlog Cleanup
37
+
38
+ ```bash
39
+ # Dry-run
40
+ pnpm backlog:prune
41
+
42
+ # Execute
43
+ pnpm backlog:prune --execute
44
+ ```
45
+
46
+ Identifies stale WUs (>60 days inactive) for review or archival.
47
+
48
+ ### Documentation Link Check
49
+
50
+ ```bash
51
+ pnpm docs:linkcheck
52
+ ```
53
+
54
+ Validates all internal links in documentation files.
55
+
56
+ ## Metrics & Reporting
57
+
58
+ ### Lane Metrics
59
+
60
+ ```bash
61
+ pnpm metrics:lanes
62
+ ```
63
+
64
+ Shows per-lane statistics:
65
+
66
+ - WUs completed per lane
67
+ - Average cycle time
68
+ - Current WIP status
69
+
70
+ ### DORA Metrics
71
+
72
+ ```bash
73
+ pnpm metrics:dora
74
+ ```
75
+
76
+ Shows DevOps Research and Assessment metrics:
77
+
78
+ - Deployment frequency (WUs/week)
79
+ - Lead time (ready → done)
80
+ - Change failure rate
81
+ - Mean time to recovery (MTTR)
82
+
83
+ ### Flow Metrics
84
+
85
+ ```bash
86
+ pnpm metrics:flow
87
+ ```
88
+
89
+ Shows flow efficiency:
90
+
91
+ - Cycle time distribution
92
+ - Blocked time percentage
93
+ - Throughput trends
94
+
95
+ ### Flow Report
96
+
97
+ ```bash
98
+ pnpm flow:report
99
+ ```
100
+
101
+ Generates comprehensive flow analysis report.
102
+
103
+ ### Flow Bottlenecks
104
+
105
+ ```bash
106
+ # Show top 10 bottleneck WUs (ranked by downstream impact)
107
+ pnpm flow:bottlenecks
108
+
109
+ # Output in JSON format for scripting
110
+ pnpm flow:bottlenecks --json
111
+
112
+ # Show critical path (longest dependency chain)
113
+ pnpm flow:bottlenecks --critical-path
114
+
115
+ # Scope analysis to specific initiative
116
+ pnpm flow:bottlenecks --initiative INIT-010
117
+
118
+ # Adjust number of results (default: 10)
119
+ pnpm flow:bottlenecks --limit 20
120
+ ```
121
+
122
+ Identifies WUs that block the most downstream work:
123
+
124
+ - **Impact score**: Count of WUs directly and indirectly blocked
125
+ - **Critical path**: Longest chain of dependencies (schedule risk)
126
+ - **Bottleneck ranking**: Prioritise completing these for maximum unblocking
127
+
128
+ Use with `orchestrate:initiative` which highlights bottlenecks in execution plans, or `orchestrate:monitor` to track agent progress.
129
+
130
+ ## Validation Commands
131
+
132
+ ### Task Validation
133
+
134
+ ```bash
135
+ pnpm tasks:validate
136
+ ```
137
+
138
+ Validates all WU YAML files:
139
+
140
+ - Required fields present
141
+ - Status transitions valid
142
+ - Lane assignments correct
143
+
144
+ ### Backlog Sync Validation
145
+
146
+ ```bash
147
+ pnpm tasks:validate:backlog
148
+ ```
149
+
150
+ Ensures backlog.md and status.md are synchronized with WU YAMLs.
151
+
152
+ ### Spec Linter
153
+
154
+ ```bash
155
+ pnpm spec:linter
156
+ ```
157
+
158
+ Validates specification files against schema.
159
+
160
+ ### Board Validation
161
+
162
+ ```bash
163
+ pnpm board:validate
164
+ ```
165
+
166
+ Validates kanban board state consistency.
167
+
168
+ ### Context Validation
169
+
170
+ ```bash
171
+ pnpm validate:context
172
+ ```
173
+
174
+ Checks for redundancy and reference integrity in context files.
175
+
176
+ ## Agent Session Management
177
+
178
+ ### Start Session
179
+
180
+ ```bash
181
+ pnpm agent:session start --wu WU-XXX --tier 2
182
+ ```
183
+
184
+ Starts telemetry session for a WU. Tier options:
185
+
186
+ - `1`: Quick context (~500 tokens)
187
+ - `2`: Standard context (~2,800 tokens)
188
+ - `3`: Full context (~18,000 tokens)
189
+
190
+ ### End Session
191
+
192
+ ```bash
193
+ pnpm agent:session:end
194
+ ```
195
+
196
+ Ends current session and appends metadata to WU YAML.
197
+
198
+ ### Log Issue
199
+
200
+ ```bash
201
+ pnpm agent:log-issue \
202
+ --category confusion \
203
+ --severity minor \
204
+ --title "Issue title" \
205
+ --description "Detailed description"
206
+ ```
207
+
208
+ Categories: `confusion`, `tooling_error`, `doc_gap`, `workflow_violation`, `unexpected_failure`
209
+ Severities: `minor`, `moderate`, `major`
210
+
211
+ ### Query Issues
212
+
213
+ ```bash
214
+ # Summary of recent issues
215
+ pnpm agent:issues summary --since 7d
216
+
217
+ # List all issues
218
+ pnpm agent:issues list
219
+ ```
220
+
221
+ ### Session Status
222
+
223
+ ```bash
224
+ pnpm session:status
225
+ ```
226
+
227
+ Shows current active sessions across agents.
228
+
229
+ ### Session Recommendations
230
+
231
+ ```bash
232
+ pnpm session:recommend
233
+ ```
234
+
235
+ Suggests optimal context tier based on task complexity.
236
+
237
+ ## Common Maintenance Workflows
238
+
239
+ ### Weekly Health Check
240
+
241
+ ```bash
242
+ pnpm wu:prune # Check for stale worktrees
243
+ pnpm backlog:prune # Check for stale WUs
244
+ pnpm metrics:lanes # Review lane performance
245
+ pnpm docs:linkcheck # Verify documentation links
246
+ ```
247
+
248
+ ### Before WU Completion
249
+
250
+ ```bash
251
+ pnpm tasks:validate # Validate WU YAML
252
+ pnpm board:validate # Check board state
253
+ pnpm validate:context # Check context integrity
254
+ ```