owflow 0.5.0 → 0.7.0

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 (195) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +448 -261
  3. package/dist/agents/bottleneck-analyzer.md +332 -329
  4. package/dist/agents/code-quality-pragmatist.md +353 -354
  5. package/dist/agents/code-reviewer.md +238 -239
  6. package/dist/agents/codebase-analysis-reporter.md +245 -246
  7. package/dist/agents/docs-operator.md +22 -23
  8. package/dist/agents/e2e-test-verifier.md +447 -448
  9. package/dist/agents/gap-analyzer.md +501 -502
  10. package/dist/agents/implementation-completeness-checker.md +219 -220
  11. package/dist/agents/implementation-planner.md +308 -309
  12. package/dist/agents/information-gatherer.md +690 -691
  13. package/dist/agents/production-readiness-checker.md +278 -279
  14. package/dist/agents/project-analyzer.md +403 -403
  15. package/dist/agents/reality-assessor.md +365 -366
  16. package/dist/agents/research-planner.md +449 -450
  17. package/dist/agents/research-synthesizer.md +402 -403
  18. package/dist/agents/solution-brainstormer.md +256 -257
  19. package/dist/agents/solution-designer.md +371 -372
  20. package/dist/agents/spec-auditor.md +297 -298
  21. package/dist/agents/specification-creator.md +333 -334
  22. package/dist/agents/task-classifier.md +449 -450
  23. package/dist/agents/task-group-implementer.md +283 -284
  24. package/dist/agents/test-suite-runner.md +194 -195
  25. package/dist/agents/user-docs-generator.md +508 -509
  26. package/dist/commands/reviews-code.md +90 -90
  27. package/dist/commands/reviews-pragmatic.md +99 -99
  28. package/dist/commands/reviews-production-readiness.md +113 -113
  29. package/dist/commands/reviews-reality-check.md +110 -110
  30. package/dist/commands/reviews-spec-audit.md +114 -114
  31. package/dist/commands/work.md +280 -280
  32. package/dist/configuration/agents-config.d.ts +2 -0
  33. package/dist/configuration/agents-config.js +8 -44
  34. package/dist/configuration/commands-config.d.ts +23 -0
  35. package/dist/configuration/commands-config.js +17 -17
  36. package/dist/configuration/skills-config.d.ts +2 -0
  37. package/dist/configuration/skills-config.js +3 -3
  38. package/dist/hooks/hooks-diagnostics.d.ts +3 -0
  39. package/dist/hooks/hooks-diagnostics.js +21 -0
  40. package/dist/hooks/hooks-persistence.d.ts +17 -0
  41. package/dist/hooks/hooks-persistence.js +207 -0
  42. package/dist/hooks/hooks-registry.d.ts +6 -0
  43. package/dist/hooks/hooks-registry.js +104 -0
  44. package/dist/hooks/hooks-wrapper.d.ts +25 -0
  45. package/dist/hooks/hooks-wrapper.js +318 -0
  46. package/dist/hooks/internal/before-tool.d.ts +6 -0
  47. package/dist/hooks/internal/before-tool.js +13 -0
  48. package/dist/hooks/internal/session-compaction.d.ts +9 -0
  49. package/dist/hooks/{session-compaction.js → internal/session-compaction.js} +9 -7
  50. package/dist/hooks/runtime/circuit-breaker.d.ts +23 -0
  51. package/dist/hooks/runtime/circuit-breaker.js +39 -0
  52. package/dist/hooks/runtime/failure-policy.d.ts +15 -0
  53. package/dist/hooks/runtime/failure-policy.js +49 -0
  54. package/dist/hooks/runtime/process-executor.d.ts +33 -0
  55. package/dist/hooks/runtime/process-executor.js +147 -0
  56. package/dist/hooks/runtime/status-recorder.d.ts +27 -0
  57. package/dist/hooks/runtime/status-recorder.js +111 -0
  58. package/dist/index.d.ts +7 -0
  59. package/dist/index.js +111 -40
  60. package/dist/skills/agents-md-generator/SKILL.md +223 -223
  61. package/dist/skills/codebase-analyzer/SKILL.md +162 -162
  62. package/dist/skills/codebase-analyzer/references/code-analysis.md +63 -63
  63. package/dist/skills/codebase-analyzer/references/combined.md +31 -31
  64. package/dist/skills/codebase-analyzer/references/context-discovery.md +63 -63
  65. package/dist/skills/codebase-analyzer/references/file-discovery.md +51 -51
  66. package/dist/skills/codebase-analyzer/references/migration-target.md +23 -23
  67. package/dist/skills/codebase-analyzer/references/pattern-mining.md +22 -22
  68. package/dist/skills/dev-analyze/SKILL.md +115 -115
  69. package/dist/skills/dev-bugfix/SKILL.md +452 -452
  70. package/dist/skills/dev-finalize/SKILL.md +118 -118
  71. package/dist/skills/dev-implement/SKILL.md +167 -167
  72. package/dist/skills/dev-plan/SKILL.md +147 -147
  73. package/dist/skills/dev-spec/SKILL.md +182 -182
  74. package/dist/skills/dev-tdd-red/SKILL.md +94 -94
  75. package/dist/skills/dev-verify/SKILL.md +153 -153
  76. package/dist/skills/development/SKILL.md +260 -260
  77. package/dist/skills/diagrams-mermaid/SKILL.md +183 -159
  78. package/dist/skills/diagrams-mermaid/references/reference.md +220 -148
  79. package/dist/skills/docs-manager/SKILL.md +379 -379
  80. package/dist/skills/docs-manager/docs/INDEX.md +199 -199
  81. package/dist/skills/docs-manager/docs/standards/backend/api.md +25 -25
  82. package/dist/skills/docs-manager/docs/standards/backend/migrations.md +22 -22
  83. package/dist/skills/docs-manager/docs/standards/backend/models.md +25 -25
  84. package/dist/skills/docs-manager/docs/standards/backend/queries.md +22 -22
  85. package/dist/skills/docs-manager/docs/standards/frontend/accessibility.md +25 -25
  86. package/dist/skills/docs-manager/docs/standards/frontend/components.md +28 -28
  87. package/dist/skills/docs-manager/docs/standards/frontend/css.md +16 -16
  88. package/dist/skills/docs-manager/docs/standards/frontend/responsive.md +28 -28
  89. package/dist/skills/docs-manager/docs/standards/global/coding-style.md +25 -25
  90. package/dist/skills/docs-manager/docs/standards/global/commenting.md +10 -10
  91. package/dist/skills/docs-manager/docs/standards/global/conventions.md +31 -31
  92. package/dist/skills/docs-manager/docs/standards/global/error-handling.md +22 -22
  93. package/dist/skills/docs-manager/docs/standards/global/minimal-implementation.md +22 -22
  94. package/dist/skills/docs-manager/docs/standards/global/validation.md +28 -28
  95. package/dist/skills/docs-manager/docs/standards/testing/test-writing.md +25 -25
  96. package/dist/skills/docs-manager/references/agents-md-template.md +29 -29
  97. package/dist/skills/docs-manager/references/index-md-template.md +73 -73
  98. package/dist/skills/flow-init/SKILL.md +234 -234
  99. package/dist/skills/flow-init/references/architecture-template.md +45 -45
  100. package/dist/skills/flow-init/references/roadmap-templates.md +93 -93
  101. package/dist/skills/flow-init/references/tech-stack-template.md +70 -70
  102. package/dist/skills/flow-init/references/vision-templates.md +75 -75
  103. package/dist/skills/goal-development/SKILL.md +96 -96
  104. package/dist/skills/goal-migration/SKILL.md +114 -114
  105. package/dist/skills/goal-performance/SKILL.md +126 -0
  106. package/dist/skills/goal-research/SKILL.md +118 -118
  107. package/dist/skills/html-renderer/SKILL.md +173 -173
  108. package/dist/skills/html-renderer/references/index.html +318 -318
  109. package/dist/skills/html-renderer/references/styles.css +388 -388
  110. package/dist/skills/html-renderer/references/tokens.json +104 -104
  111. package/dist/skills/implementation-plan-executor/SKILL.md +378 -378
  112. package/dist/skills/implementation-verifier/SKILL.md +307 -307
  113. package/dist/skills/migration/SKILL.md +268 -268
  114. package/dist/skills/migration-analyze/SKILL.md +126 -126
  115. package/dist/skills/migration-finalize/SKILL.md +161 -161
  116. package/dist/skills/migration-fix/SKILL.md +155 -155
  117. package/dist/skills/migration-implement/SKILL.md +131 -131
  118. package/dist/skills/migration-plan/SKILL.md +131 -131
  119. package/dist/skills/migration-spec/SKILL.md +135 -135
  120. package/dist/skills/migration-spec/references/migration-strategies.md +430 -430
  121. package/dist/skills/migration-target/SKILL.md +134 -134
  122. package/dist/skills/migration-target/references/migration-types.md +489 -489
  123. package/dist/skills/migration-verify/SKILL.md +184 -184
  124. package/dist/skills/orchestrator-framework/SKILL.md +65 -65
  125. package/dist/skills/orchestrator-framework/references/command-namespacing.md +7 -7
  126. package/dist/skills/orchestrator-framework/references/confirm-or-revise-exception.md +20 -20
  127. package/dist/skills/orchestrator-framework/references/delegation-rules.md +54 -54
  128. package/dist/skills/orchestrator-framework/references/dispatcher-handoff.md +27 -27
  129. package/dist/skills/orchestrator-framework/references/fix-loop-contract.md +65 -65
  130. package/dist/skills/orchestrator-framework/references/gate-contract.md +122 -117
  131. package/dist/skills/orchestrator-framework/references/orchestrator-creation-checklist.md +51 -51
  132. package/dist/skills/orchestrator-framework/references/orchestrator-patterns.md +235 -235
  133. package/dist/skills/performance/SKILL.md +267 -437
  134. package/dist/skills/performance-analyze/SKILL.md +129 -0
  135. package/dist/skills/{performance → performance-analyze}/references/performance-optimization-guide.md +271 -365
  136. package/dist/skills/performance-finalize/SKILL.md +117 -0
  137. package/dist/skills/performance-implement/SKILL.md +114 -0
  138. package/dist/skills/performance-plan/SKILL.md +112 -0
  139. package/dist/skills/performance-spec/SKILL.md +145 -0
  140. package/dist/skills/performance-verify/SKILL.md +164 -0
  141. package/dist/skills/research/SKILL.md +249 -249
  142. package/dist/skills/research-brainstorm/SKILL.md +120 -120
  143. package/dist/skills/research-brainstorm/references/brainstorming-techniques.md +84 -84
  144. package/dist/skills/research-converge/SKILL.md +130 -130
  145. package/dist/skills/research-design/SKILL.md +146 -146
  146. package/dist/skills/research-design/references/design-techniques.md +40 -40
  147. package/dist/skills/research-finalize/SKILL.md +125 -125
  148. package/dist/skills/research-fork/SKILL.md +190 -190
  149. package/dist/skills/research-gather/SKILL.md +133 -133
  150. package/dist/skills/research-plan/SKILL.md +141 -141
  151. package/dist/skills/research-plan/references/research-methodologies.md +710 -710
  152. package/dist/skills/research-quick/SKILL.md +139 -139
  153. package/dist/skills/research-synthesize/SKILL.md +127 -127
  154. package/dist/skills/rule-reviewer/SKILL.md +334 -334
  155. package/dist/skills/standards-discover/SKILL.md +260 -260
  156. package/dist/skills/standards-discover/references/aggregation-strategy.md +76 -76
  157. package/dist/skills/standards-discover/references/code-pattern-prompt.md +68 -68
  158. package/dist/skills/standards-discover/references/config-analyzer-prompt.md +67 -67
  159. package/dist/skills/standards-discover/references/docs-extractor-prompt.md +65 -65
  160. package/dist/skills/standards-discover/references/external-analyzer-prompt.md +75 -75
  161. package/dist/skills/standards-update/SKILL.md +207 -207
  162. package/dist/templates/orchestrator-state-base.yml +17 -17
  163. package/dist/templates/orchestrator-state-development.yml +95 -95
  164. package/dist/templates/orchestrator-state-migration.yml +95 -95
  165. package/dist/templates/orchestrator-state-performance.yml +64 -53
  166. package/dist/templates/orchestrator-state-research.yml +67 -67
  167. package/dist/tools/fork_task.d.ts +17 -0
  168. package/dist/tools/fork_task.js +21 -11
  169. package/dist/tools/verify_template.d.ts +11 -0
  170. package/dist/tools/verify_template.js +32 -17
  171. package/dist/tui/hooks-dialogs.d.ts +20 -0
  172. package/dist/tui/hooks-dialogs.js +181 -0
  173. package/dist/tui/hooks-presenter.d.ts +15 -0
  174. package/dist/tui/hooks-presenter.js +70 -0
  175. package/dist/tui/hooks-sidebar.d.ts +10 -0
  176. package/dist/tui/hooks-sidebar.js +104 -0
  177. package/dist/tui/primitives.d.ts +21 -0
  178. package/dist/tui/primitives.js +47 -0
  179. package/dist/tui.d.ts +12 -0
  180. package/dist/tui.js +129 -0
  181. package/dist/types/hook-types.d.ts +125 -0
  182. package/dist/types/hook-types.js +76 -0
  183. package/dist/types/opencode-types.d.ts +13 -0
  184. package/dist/utils/file-util.d.ts +2 -0
  185. package/dist/utils/file-util.js +6 -6
  186. package/dist/utils/fork-task.d.ts +27 -0
  187. package/dist/utils/fork-task.js +18 -23
  188. package/dist/utils/plugin-info.d.ts +3 -0
  189. package/dist/utils/plugin-info.js +8 -10
  190. package/dist/utils/workflow-paths.d.ts +17 -0
  191. package/dist/utils/workflow-paths.js +18 -0
  192. package/dist/utils/yaml-structure.d.ts +7 -0
  193. package/dist/utils/yaml-structure.js +7 -11
  194. package/package.json +68 -48
  195. package/dist/hooks/before-tool.js +0 -19
@@ -1,260 +1,260 @@
1
- ---
2
- name: owflow:standards-discover
3
- description: Discover coding standards from project configuration files, code patterns, documentation, and external sources (PRs, CI/CD)
4
- argument-hint: "[task description]"
5
- user-invocable: true
6
- ---
7
-
8
- # Standards Discovery Skill
9
-
10
- Analyzes multiple project sources in parallel to discover coding standards, conventions, and best practices. Aggregates findings with confidence scoring, presents for user approval, and applies approved standards via `docs-manager` skill.
11
-
12
- ## Core Principles
13
-
14
- 1. **Parallel Execution**: Launch discovery subagents concurrently for speed (~45-60s vs ~2-4min sequential)
15
- 2. **Evidence-Based**: Every finding must cite specific files, line counts, or config rules as evidence
16
- 3. **Confidence Scoring**: Multi-factor confidence based on source count, consistency, and explicitness
17
- 4. **Deduplication**: Same standard found across sources merges into single finding with combined evidence
18
- 5. **Graceful Degradation**: Skip unavailable sources (no gh CLI, no docs) without failing entire workflow
19
-
20
- ---
21
-
22
- ## Input Parameters
23
-
24
- | Parameter | Default | Description |
25
- | ----------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
26
- | `--scope` | `full` | Discovery scope: `full`, `quick`, or any category name (baseline: `global`, `frontend`, `backend`, `testing`; custom categories also supported) |
27
- | `--confidence` | `60` | Minimum confidence threshold (0-100) for displaying findings |
28
- | `--auto-apply` | `false` | Auto-apply standards with confidence >= 90% without asking |
29
- | `--skip-external` | `false` | Skip GitHub PR analysis and CI/CD sources |
30
- | `--pr-count` | `20` | Number of recent merged PRs to analyze |
31
-
32
- **Scope determines which phases run:**
33
-
34
- | Scope | Config (P1) | Code (P2) | Docs (P3) | External (P4) |
35
- | ---------- | ---------------- | -------------- | --------- | ------------- |
36
- | `full` | Yes | Yes | Yes | Yes |
37
- | `global` | Yes | Yes (limited) | Yes | Yes |
38
- | `frontend` | FE configs | FE files | Yes | Yes |
39
- | `backend` | BE configs | BE files | Yes | Yes |
40
- | `testing` | Test configs | Test files | Yes | Yes |
41
- | `quick` | Yes | No | No | No |
42
- | `[custom]` | Relevant configs | Filtered files | Yes | Yes |
43
-
44
- Custom scope values are matched against existing `.owflow/docs/standards/*/` directories and filter analysis to relevant files.
45
-
46
- ---
47
-
48
- ## Phase Configuration
49
-
50
- | Phase | Subject | activeForm |
51
- | ----- | -------------------------------- | ---------------------------------- |
52
- | 1 | Plan discovery scope | Planning discovery scope |
53
- | 2 | Analyze configuration files | Analyzing configuration files |
54
- | 3 | Mine code patterns | Mining code patterns |
55
- | 4 | Extract documentation standards | Extracting documentation standards |
56
- | 5 | Analyze external sources | Analyzing external sources |
57
- | 6 | Aggregate & deduplicate findings | Aggregating findings |
58
- | 7 | Review findings with user | Reviewing findings |
59
- | 8 | Apply approved standards | Applying standards |
60
- | 9 | Generate summary report | Generating summary |
61
-
62
- **Task Tracking**: At start of Phase 1, use `TaskCreate` for all phases above (pending). Set dependencies: Phases 2-5 blocked by Phase 1 (they run in parallel after planning). Phase 6 blocked by Phases 2-5. Phases 7-9 sequential. At each phase start: `TaskUpdate` to `in_progress`. At each phase end: `TaskUpdate` to `completed`. For phases skipped due to scope (e.g., Phases 3-4 when `--scope=quick`), mark `completed` with `metadata: {skipped: true, reason: "scope=quick"}`.
63
-
64
- ---
65
-
66
- ## Execution Workflow
67
-
68
- ### Phase 1: Planning & Initialization
69
-
70
- 1. **Parse options** from command arguments
71
- 2. **Check prerequisites**: Verify `.owflow/docs/` exists. If not, offer to run `/owflow:flow-init` first
72
- 3. **Read existing standards** from `.owflow/docs/INDEX.md` to identify updates vs creates and avoid duplicates
73
- 4. **Display discovery plan** showing scope, sources, and estimated time
74
- 5. **Get user confirmation** via question before proceeding
75
-
76
- ---
77
-
78
- ### Phase 2-5: Parallel Discovery
79
-
80
- > **CRITICAL: Launch all applicable subagents in ONE message for parallel execution.**
81
-
82
- **Step 1: Determine which phases to run** based on scope and flags.
83
-
84
- **Step 1.5: Create temp output directory** — Run `mktemp -d` via Bash to create a unique temp directory for this invocation. Store the path (e.g., `/tmp/abc123`). Each subagent will write its results to a dedicated file in this directory: `{tmpdir}/config.yml`, `{tmpdir}/code.yml`, `{tmpdir}/docs.yml`, `{tmpdir}/external.yml`.
85
-
86
- **Step 2: Read prompt templates**
87
-
88
- > **STOP — Do NOT skip this step. Do NOT write prompts from memory.**
89
-
90
- Use the Read tool to load ONLY the reference files for phases you will execute:
91
-
92
- | Phase | Condition | Read This File |
93
- | ------------------- | ------------------------- | ---------------------------------------- |
94
- | 2: Config Analysis | Always | `references/config-analyzer-prompt.md` |
95
- | 3: Code Patterns | scope != `quick` | `references/code-pattern-prompt.md` |
96
- | 4: Documentation | scope != `quick` | `references/docs-extractor-prompt.md` |
97
- | 5: External Sources | `--skip-external` not set | `references/external-analyzer-prompt.md` |
98
-
99
- **SELF-CHECK**: Did you read the template files with the Read tool? If not, go back and read them now.
100
-
101
- **Step 3: Adapt templates** — Replace `[scope]`, `[confidence]`, and other placeholders with actual values. Replace the `[output_file]` placeholder in each template with the actual temp file path for that phase (e.g., `{tmpdir}/config.yml`).
102
-
103
- **Step 4: Launch subagents in parallel** — Use the Task tool with `subagent_type: general-purpose` for each phase.
104
-
105
- > ❌ **WRONG** — launching one agent per message, waiting for result, then launching the next.
106
- > ✅ **CORRECT** — launching ALL applicable agents (2–4 Task calls) in a SINGLE message.
107
-
108
- **Step 5: Wait** for ALL subagents to complete, then read each temp file using the Read tool to collect findings.
109
-
110
- **Step 6: Display progress** — Show count of findings per phase.
111
-
112
- ---
113
-
114
- ### Phase 6: Aggregation & Deduplication
115
-
116
- **Read** `references/aggregation-strategy.md` for confidence scoring methodology.
117
-
118
- 1. **Combine** all findings from Phases 2-5
119
- 2. **Deduplicate** by grouping on `category + standard_name` — merge evidence and sources
120
- 3. **Calculate final confidence** using multi-factor scoring from the reference
121
- 4. **Detect conflicts** — flag contradictory standards (e.g., ESLint says semicolons, Prettier says no)
122
- 5. **Categorize** into High (>= 80%), Medium (60-79%), Low (< 60%)
123
- 6. **Filter** by `--confidence` threshold
124
-
125
- Display aggregation summary: total raw findings, unique standards, conflicts detected.
126
-
127
- ---
128
-
129
- ### Phase 7: User Review & Approval
130
-
131
- **Step 1: Present full summary table** — Before any approval prompts, output ALL findings in a table grouped by confidence level. Each group has a header with count:
132
-
133
- ```
134
- ### High Confidence (>=80%) — 5 standards
135
-
136
- | # | Standard | Category | Score | Sources | Description |
137
- |---|----------|----------|-------|---------|-------------|
138
- | 1 | no-semicolons | global | 92 | config, code, docs | Omit semicolons in all JS/TS files |
139
- | 2 | ... | ... | ... | ... | ... |
140
-
141
- ### Medium Confidence (60-79%) — 3 standards
142
- ...
143
-
144
- ### Low Confidence (<60%) — 2 standards
145
- ...
146
-
147
- ### Conflicts — 1 detected
148
- | # | Standard | Conflict | Sources A | Sources B |
149
- ```
150
-
151
- The **Sources** column lists all contributing sources for each finding (config, code, docs, PRs, CI, pre-commit). This gives users full visibility before making decisions.
152
-
153
- **Step 2: Approval flow** — After the summary table:
154
-
155
- - **High confidence (>= 80%)**: Use question offering batch approval ("Apply all N high-confidence standards") or individual drill-down review. For drill-down, show full detail per finding: all evidence items with source attribution, examples (preferred/avoid), and confidence score breakdown (which factors contributed how many points).
156
-
157
- - **Medium confidence (60-79%)**: Present each individually with full detail (evidence, examples, confidence breakdown). Use question with Accept/Modify/Skip options per finding.
158
-
159
- - **Low confidence (< threshold)**: Show the summary table rows only. Offer to expand details or skip all.
160
-
161
- - **Conflicts**: Present each conflict showing both sides with their evidence and sources. Use question to resolve (pick side A, pick side B, skip, or custom).
162
-
163
- If `--auto-apply` is set, automatically approve findings with confidence >= 90% and only prompt for the rest.
164
-
165
- ---
166
-
167
- ### Phase 8: Application
168
-
169
- > **DELEGATION REQUIRED**: Do NOT write standard files directly using Write/Edit tools. ALL file operations MUST go through the `docs-operator` subagent (Task tool).
170
- >
171
- > **SELF-CHECK before each file operation**: "Am I about to write a file directly? STOP — invoke docs-operator via Task tool instead."
172
-
173
- For each approved standard:
174
-
175
- 1. **Prepare content** — Standard name, description, examples (preferred/avoid), rationale from evidence, source citations. Format each standard as a `###` heading with 1-10 lines description (excluding code snippets). Group related standards into the same topic file. Add brief code examples only when they clarify the practice.
176
- 2. **Check if file exists** — Determine create vs update action
177
- 3. **Invoke `docs-operator` subagent** via Task tool (subagent_type: `docs-operator`) — Pass prepared content. For creates: new file. For updates: merge new findings with existing. Wait for completion, then continue with the next standard.
178
- 4. **After all standards applied, invoke `docs-operator` subagent** via Task tool to regenerate INDEX.md. Wait for completion, then continue with step 5.
179
- 5. **Invoke `docs-operator` subagent** via Task tool to verify AGENTS.md integration — ensure standards directory is referenced. Wait for completion, then display the application summary.
180
-
181
- Display application summary: created count, updated count, total active.
182
-
183
- ---
184
-
185
- ### Phase 9: Summary Report → Exit Gate
186
-
187
- Present final results and close (Exit Gate contract, [Gate Contract](../orchestrator-framework/references/gate-contract.md)):
188
-
189
- **Results box**:
190
-
191
- ```markdown
192
- ## ✅ STANDARDS DISCOVER COMPLETE
193
-
194
- **Sources analyzed** — [config files, code samples, docs, PRs]
195
- **Applied** — [created] created / [updated] updated ([total] active)
196
- **Skipped** — [count — low confidence / declined]
197
-
198
- **Artifacts**
199
- - `.owflow/docs/INDEX.md`
200
- - `.owflow/docs/standards/<category>/<topic>.md` [per applied standard]
201
- ```
202
-
203
- **Results-acceptance question** — use `question` — "Are these results correct?" with options:
204
-
205
- - **Accept** — discovery and application are complete; print next steps below.
206
- - **Adjust** — re-review skipping findings (e.g., "show low-confidence items", "re-run a source"), apply the additional standards, then re-present the results box.
207
- - **Discuss** — walk through specific applied standards (evidence, confidence breakdown, sources) in more depth; then re-ask.
208
- - **Stop here** — end.
209
-
210
- **Next steps (after Accept)**:
211
-
212
- - Review the applied standards files in `.owflow/docs/standards/`
213
- - Commit the changes
214
- - `/owflow:standards-update "<convention>"` — document any conventions discovery missed
215
- - Re-run periodically: `/owflow:standards-discover --scope=quick`
216
-
217
- ---
218
-
219
- ## Error Handling
220
-
221
- | Situation | Strategy |
222
- | ----------------------- | ----------------------------------------------------- |
223
- | `.owflow/docs/` missing | Offer `/owflow:flow-init`, abort if declined |
224
- | gh CLI unavailable | Skip PR analysis, continue with other sources |
225
- | GitHub API rate limit | Skip PR analysis, note in report |
226
- | Config file parse error | Skip that file, log warning, continue |
227
- | No standards found | Suggest lowering threshold or checking specific scope |
228
- | docs-manager fails | Offer retry/skip/cancel per standard |
229
- | Subagent returns empty | Note in report, proceed with available findings |
230
-
231
- ---
232
-
233
- ## Integration
234
-
235
- | Integrates With | How |
236
- | ------------------------------------ | ---------------------------------------------------------------- |
237
- | `docs-manager` skill | Creates/updates standard files, regenerates INDEX.md |
238
- | `implementation-plan-executor` skill | Discovered standards immediately available via INDEX.md |
239
- | `standards-update` command | Complementary: discover = automated bulk, update = manual single |
240
-
241
- ---
242
-
243
- ## Examples
244
-
245
- ```bash
246
- # Full discovery (default)
247
- /owflow:standards-discover
248
-
249
- # Quick scan (config files only, ~30-60s)
250
- /owflow:standards-discover --scope=quick
251
-
252
- # Frontend standards only
253
- /owflow:standards-discover --scope=frontend
254
-
255
- # High confidence, auto-apply
256
- /owflow:standards-discover --confidence=80 --auto-apply
257
-
258
- # Skip external analysis (offline/no GitHub)
259
- /owflow:standards-discover --skip-external
260
- ```
1
+ ---
2
+ name: owflow:standards-discover
3
+ description: Discover coding standards from project configuration files, code patterns, documentation, and external sources (PRs, CI/CD)
4
+ argument-hint: "[task description]"
5
+ user-invocable: true
6
+ ---
7
+
8
+ # Standards Discovery Skill
9
+
10
+ Analyzes multiple project sources in parallel to discover coding standards, conventions, and best practices. Aggregates findings with confidence scoring, presents for user approval, and applies approved standards via `docs-manager` skill.
11
+
12
+ ## Core Principles
13
+
14
+ 1. **Parallel Execution**: Launch discovery subagents concurrently for speed (~45-60s vs ~2-4min sequential)
15
+ 2. **Evidence-Based**: Every finding must cite specific files, line counts, or config rules as evidence
16
+ 3. **Confidence Scoring**: Multi-factor confidence based on source count, consistency, and explicitness
17
+ 4. **Deduplication**: Same standard found across sources merges into single finding with combined evidence
18
+ 5. **Graceful Degradation**: Skip unavailable sources (no gh CLI, no docs) without failing entire workflow
19
+
20
+ ---
21
+
22
+ ## Input Parameters
23
+
24
+ | Parameter | Default | Description |
25
+ | ----------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
26
+ | `--scope` | `full` | Discovery scope: `full`, `quick`, or any category name (baseline: `global`, `frontend`, `backend`, `testing`; custom categories also supported) |
27
+ | `--confidence` | `60` | Minimum confidence threshold (0-100) for displaying findings |
28
+ | `--auto-apply` | `false` | Auto-apply standards with confidence >= 90% without asking |
29
+ | `--skip-external` | `false` | Skip GitHub PR analysis and CI/CD sources |
30
+ | `--pr-count` | `20` | Number of recent merged PRs to analyze |
31
+
32
+ **Scope determines which phases run:**
33
+
34
+ | Scope | Config (P1) | Code (P2) | Docs (P3) | External (P4) |
35
+ | ---------- | ---------------- | -------------- | --------- | ------------- |
36
+ | `full` | Yes | Yes | Yes | Yes |
37
+ | `global` | Yes | Yes (limited) | Yes | Yes |
38
+ | `frontend` | FE configs | FE files | Yes | Yes |
39
+ | `backend` | BE configs | BE files | Yes | Yes |
40
+ | `testing` | Test configs | Test files | Yes | Yes |
41
+ | `quick` | Yes | No | No | No |
42
+ | `[custom]` | Relevant configs | Filtered files | Yes | Yes |
43
+
44
+ Custom scope values are matched against existing `.owflow/docs/standards/*/` directories and filter analysis to relevant files.
45
+
46
+ ---
47
+
48
+ ## Phase Configuration
49
+
50
+ | Phase | Subject | activeForm |
51
+ | ----- | -------------------------------- | ---------------------------------- |
52
+ | 1 | Plan discovery scope | Planning discovery scope |
53
+ | 2 | Analyze configuration files | Analyzing configuration files |
54
+ | 3 | Mine code patterns | Mining code patterns |
55
+ | 4 | Extract documentation standards | Extracting documentation standards |
56
+ | 5 | Analyze external sources | Analyzing external sources |
57
+ | 6 | Aggregate & deduplicate findings | Aggregating findings |
58
+ | 7 | Review findings with user | Reviewing findings |
59
+ | 8 | Apply approved standards | Applying standards |
60
+ | 9 | Generate summary report | Generating summary |
61
+
62
+ **Task Tracking**: At start of Phase 1, use `TaskCreate` for all phases above (pending). Set dependencies: Phases 2-5 blocked by Phase 1 (they run in parallel after planning). Phase 6 blocked by Phases 2-5. Phases 7-9 sequential. At each phase start: `TaskUpdate` to `in_progress`. At each phase end: `TaskUpdate` to `completed`. For phases skipped due to scope (e.g., Phases 3-4 when `--scope=quick`), mark `completed` with `metadata: {skipped: true, reason: "scope=quick"}`.
63
+
64
+ ---
65
+
66
+ ## Execution Workflow
67
+
68
+ ### Phase 1: Planning & Initialization
69
+
70
+ 1. **Parse options** from command arguments
71
+ 2. **Check prerequisites**: Verify `.owflow/docs/` exists. If not, offer to run `/owflow:flow-init` first
72
+ 3. **Read existing standards** from `.owflow/docs/INDEX.md` to identify updates vs creates and avoid duplicates
73
+ 4. **Display discovery plan** showing scope, sources, and estimated time
74
+ 5. **Get user confirmation** via question before proceeding
75
+
76
+ ---
77
+
78
+ ### Phase 2-5: Parallel Discovery
79
+
80
+ > **CRITICAL: Launch all applicable subagents in ONE message for parallel execution.**
81
+
82
+ **Step 1: Determine which phases to run** based on scope and flags.
83
+
84
+ **Step 1.5: Create temp output directory** — Run `mktemp -d` via Bash to create a unique temp directory for this invocation. Store the path (e.g., `/tmp/abc123`). Each subagent will write its results to a dedicated file in this directory: `{tmpdir}/config.yml`, `{tmpdir}/code.yml`, `{tmpdir}/docs.yml`, `{tmpdir}/external.yml`.
85
+
86
+ **Step 2: Read prompt templates**
87
+
88
+ > **STOP — Do NOT skip this step. Do NOT write prompts from memory.**
89
+
90
+ Use the Read tool to load ONLY the reference files for phases you will execute:
91
+
92
+ | Phase | Condition | Read This File |
93
+ | ------------------- | ------------------------- | ---------------------------------------- |
94
+ | 2: Config Analysis | Always | `references/config-analyzer-prompt.md` |
95
+ | 3: Code Patterns | scope != `quick` | `references/code-pattern-prompt.md` |
96
+ | 4: Documentation | scope != `quick` | `references/docs-extractor-prompt.md` |
97
+ | 5: External Sources | `--skip-external` not set | `references/external-analyzer-prompt.md` |
98
+
99
+ **SELF-CHECK**: Did you read the template files with the Read tool? If not, go back and read them now.
100
+
101
+ **Step 3: Adapt templates** — Replace `[scope]`, `[confidence]`, and other placeholders with actual values. Replace the `[output_file]` placeholder in each template with the actual temp file path for that phase (e.g., `{tmpdir}/config.yml`).
102
+
103
+ **Step 4: Launch subagents in parallel** — Use the Task tool with `subagent_type: general-purpose` for each phase.
104
+
105
+ > ❌ **WRONG** — launching one agent per message, waiting for result, then launching the next.
106
+ > ✅ **CORRECT** — launching ALL applicable agents (2–4 Task calls) in a SINGLE message.
107
+
108
+ **Step 5: Wait** for ALL subagents to complete, then read each temp file using the Read tool to collect findings.
109
+
110
+ **Step 6: Display progress** — Show count of findings per phase.
111
+
112
+ ---
113
+
114
+ ### Phase 6: Aggregation & Deduplication
115
+
116
+ **Read** `references/aggregation-strategy.md` for confidence scoring methodology.
117
+
118
+ 1. **Combine** all findings from Phases 2-5
119
+ 2. **Deduplicate** by grouping on `category + standard_name` — merge evidence and sources
120
+ 3. **Calculate final confidence** using multi-factor scoring from the reference
121
+ 4. **Detect conflicts** — flag contradictory standards (e.g., ESLint says semicolons, Prettier says no)
122
+ 5. **Categorize** into High (>= 80%), Medium (60-79%), Low (< 60%)
123
+ 6. **Filter** by `--confidence` threshold
124
+
125
+ Display aggregation summary: total raw findings, unique standards, conflicts detected.
126
+
127
+ ---
128
+
129
+ ### Phase 7: User Review & Approval
130
+
131
+ **Step 1: Present full summary table** — Before any approval prompts, output ALL findings in a table grouped by confidence level. Each group has a header with count:
132
+
133
+ ```
134
+ ### High Confidence (>=80%) — 5 standards
135
+
136
+ | # | Standard | Category | Score | Sources | Description |
137
+ |---|----------|----------|-------|---------|-------------|
138
+ | 1 | no-semicolons | global | 92 | config, code, docs | Omit semicolons in all JS/TS files |
139
+ | 2 | ... | ... | ... | ... | ... |
140
+
141
+ ### Medium Confidence (60-79%) — 3 standards
142
+ ...
143
+
144
+ ### Low Confidence (<60%) — 2 standards
145
+ ...
146
+
147
+ ### Conflicts — 1 detected
148
+ | # | Standard | Conflict | Sources A | Sources B |
149
+ ```
150
+
151
+ The **Sources** column lists all contributing sources for each finding (config, code, docs, PRs, CI, pre-commit). This gives users full visibility before making decisions.
152
+
153
+ **Step 2: Approval flow** — After the summary table:
154
+
155
+ - **High confidence (>= 80%)**: Use question offering batch approval ("Apply all N high-confidence standards") or individual drill-down review. For drill-down, show full detail per finding: all evidence items with source attribution, examples (preferred/avoid), and confidence score breakdown (which factors contributed how many points).
156
+
157
+ - **Medium confidence (60-79%)**: Present each individually with full detail (evidence, examples, confidence breakdown). Use question with Accept/Modify/Skip options per finding.
158
+
159
+ - **Low confidence (< threshold)**: Show the summary table rows only. Offer to expand details or skip all.
160
+
161
+ - **Conflicts**: Present each conflict showing both sides with their evidence and sources. Use question to resolve (pick side A, pick side B, skip, or custom).
162
+
163
+ If `--auto-apply` is set, automatically approve findings with confidence >= 90% and only prompt for the rest.
164
+
165
+ ---
166
+
167
+ ### Phase 8: Application
168
+
169
+ > **DELEGATION REQUIRED**: Do NOT write standard files directly using Write/Edit tools. ALL file operations MUST go through the `docs-operator` subagent (Task tool).
170
+ >
171
+ > **SELF-CHECK before each file operation**: "Am I about to write a file directly? STOP — invoke docs-operator via Task tool instead."
172
+
173
+ For each approved standard:
174
+
175
+ 1. **Prepare content** — Standard name, description, examples (preferred/avoid), rationale from evidence, source citations. Format each standard as a `###` heading with 1-10 lines description (excluding code snippets). Group related standards into the same topic file. Add brief code examples only when they clarify the practice.
176
+ 2. **Check if file exists** — Determine create vs update action
177
+ 3. **Invoke `docs-operator` subagent** via Task tool (subagent_type: `docs-operator`) — Pass prepared content. For creates: new file. For updates: merge new findings with existing. Wait for completion, then continue with the next standard.
178
+ 4. **After all standards applied, invoke `docs-operator` subagent** via Task tool to regenerate INDEX.md. Wait for completion, then continue with step 5.
179
+ 5. **Invoke `docs-operator` subagent** via Task tool to verify AGENTS.md integration — ensure standards directory is referenced. Wait for completion, then display the application summary.
180
+
181
+ Display application summary: created count, updated count, total active.
182
+
183
+ ---
184
+
185
+ ### Phase 9: Summary Report → Exit Gate
186
+
187
+ Present final results and close (Exit Gate contract, [Gate Contract](../orchestrator-framework/references/gate-contract.md)):
188
+
189
+ **Results box**:
190
+
191
+ ```markdown
192
+ ## ✅ STANDARDS DISCOVER COMPLETE
193
+
194
+ **Sources analyzed** — [config files, code samples, docs, PRs]
195
+ **Applied** — [created] created / [updated] updated ([total] active)
196
+ **Skipped** — [count — low confidence / declined]
197
+
198
+ **Artifacts**
199
+ - `.owflow/docs/INDEX.md`
200
+ - `.owflow/docs/standards/<category>/<topic>.md` [per applied standard]
201
+ ```
202
+
203
+ **Results-acceptance question** — use `question` — "Are these results correct?" with options:
204
+
205
+ - **Accept** — discovery and application are complete; print next steps below.
206
+ - **Adjust** — re-review skipping findings (e.g., "show low-confidence items", "re-run a source"), apply the additional standards, then re-present the results box.
207
+ - **Discuss** — walk through specific applied standards (evidence, confidence breakdown, sources) in more depth; then re-ask.
208
+ - **Stop here** — end.
209
+
210
+ **Next steps (after Accept)**:
211
+
212
+ - Review the applied standards files in `.owflow/docs/standards/`
213
+ - Commit the changes
214
+ - `/owflow:standards-update "<convention>"` — document any conventions discovery missed
215
+ - Re-run periodically: `/owflow:standards-discover --scope=quick`
216
+
217
+ ---
218
+
219
+ ## Error Handling
220
+
221
+ | Situation | Strategy |
222
+ | ----------------------- | ----------------------------------------------------- |
223
+ | `.owflow/docs/` missing | Offer `/owflow:flow-init`, abort if declined |
224
+ | gh CLI unavailable | Skip PR analysis, continue with other sources |
225
+ | GitHub API rate limit | Skip PR analysis, note in report |
226
+ | Config file parse error | Skip that file, log warning, continue |
227
+ | No standards found | Suggest lowering threshold or checking specific scope |
228
+ | docs-manager fails | Offer retry/skip/cancel per standard |
229
+ | Subagent returns empty | Note in report, proceed with available findings |
230
+
231
+ ---
232
+
233
+ ## Integration
234
+
235
+ | Integrates With | How |
236
+ | ------------------------------------ | ---------------------------------------------------------------- |
237
+ | `docs-manager` skill | Creates/updates standard files, regenerates INDEX.md |
238
+ | `implementation-plan-executor` skill | Discovered standards immediately available via INDEX.md |
239
+ | `standards-update` command | Complementary: discover = automated bulk, update = manual single |
240
+
241
+ ---
242
+
243
+ ## Examples
244
+
245
+ ```bash
246
+ # Full discovery (default)
247
+ /owflow:standards-discover
248
+
249
+ # Quick scan (config files only, ~30-60s)
250
+ /owflow:standards-discover --scope=quick
251
+
252
+ # Frontend standards only
253
+ /owflow:standards-discover --scope=frontend
254
+
255
+ # High confidence, auto-apply
256
+ /owflow:standards-discover --confidence=80 --auto-apply
257
+
258
+ # Skip external analysis (offline/no GitHub)
259
+ /owflow:standards-discover --skip-external
260
+ ```