@punks/cli 2.0.0-beta.4 → 2.0.1

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 (36) hide show
  1. package/AGENTS.md +4 -0
  2. package/dist/data/catalog/hooks.ts +0 -7
  3. package/dist/data/catalog/packs.ts +34 -4
  4. package/dist/data/catalog/skills.ts +31 -7
  5. package/dist/data/catalog/tools.ts +6 -0
  6. package/dist/data/hooks/format-edited-file.mjs +26 -5
  7. package/dist/data/hooks.test.ts +0 -29
  8. package/dist/data/scripts/sync-subagents.mjs +29 -87
  9. package/dist/data/subagents/manifest.mjs +9 -9
  10. package/dist/data/subagents/manifest.test.ts +40 -0
  11. package/dist/index.js +3275 -1764
  12. package/dist/skills/agnostic/planning/create-spec/references/discovery.md +3 -3
  13. package/dist/skills/agnostic/requirements/requirements-grill/SKILL.md +1 -1
  14. package/dist/skills/agnostic/requirements/requirements-grill/references/wiki-output.md +1 -1
  15. package/dist/skills/phases/bug-discovery-phase/REFERENCE.md +124 -0
  16. package/dist/skills/phases/bug-discovery-phase/SKILL.md +76 -0
  17. package/dist/skills/phases/bug-resolution-phase/REFERENCE.md +154 -0
  18. package/dist/skills/phases/bug-resolution-phase/SKILL.md +62 -0
  19. package/dist/skills/{agnostic/docs → phases}/docs-ingest-phase/SKILL.md +16 -16
  20. package/dist/skills/phases/docs-ingest-phase/references/concept-pages.md +70 -0
  21. package/dist/skills/phases/docs-ingest-phase/references/flow-pages.md +56 -0
  22. package/dist/skills/phases/docs-ingest-phase/references/fumadocs-routing.md +76 -0
  23. package/dist/skills/{agnostic/docs → phases}/docs-ingest-phase/references/wiki-ingest.md +5 -5
  24. package/dist/skills/{agnostic/planning → phases}/resolve-debt-phase/SKILL.md +4 -4
  25. package/package.json +12 -3
  26. package/dist/skills/agnostic/docs/docs-ingest-phase/references/concept-pages.md +0 -48
  27. package/dist/skills/agnostic/docs/docs-ingest-phase/references/flow-pages.md +0 -41
  28. package/dist/skills/agnostic/docs/docs-ingest-phase/references/fumadocs-routing.md +0 -88
  29. /package/dist/skills/{agnostic/debug → phases}/debugging-phase/SKILL.md +0 -0
  30. /package/dist/skills/{agnostic/planning → phases}/delivery-phase/SKILL.md +0 -0
  31. /package/dist/skills/{agnostic/docs → phases}/docs-ingest-phase/agents/openai.yaml +0 -0
  32. /package/dist/skills/{agnostic/docs → phases}/docs-ingest-phase/references/repo-docs.md +0 -0
  33. /package/dist/skills/{agnostic/planning → phases}/goalify/EXAMPLES.md +0 -0
  34. /package/dist/skills/{agnostic/planning → phases}/goalify/SKILL.md +0 -0
  35. /package/dist/skills/{agnostic/requirements → phases}/requirements-phase/SKILL.md +0 -0
  36. /package/dist/skills/{agnostic/research → phases}/review-phase/SKILL.md +0 -0
@@ -12,9 +12,9 @@ Use this reference before asking clarifying questions.
12
12
  - Prefer the domain whose contract most clearly owns the request.
13
13
  - If multiple domains are involved, pick the primary owner and note cross-domain scope in the spec.
14
14
  - If no domain matches, stop and tell the user to run `/create-wiki-domain <name>` first.
15
- 4. Read the relevant domain contract:
16
- - `apps/wiki/domains/<domain>/<domain>-contract.md`
17
- 5. Optionally read related domain concepts or flows when they are obviously relevant.
15
+ 4. Read the relevant routed domain index:
16
+ - `apps/wiki/content/docs/<domain>/index.mdx`
17
+ 5. Optionally read related routed concepts or flows when they are obviously relevant.
18
18
  6. Check for existing overlapping specs in:
19
19
  - `apps/wiki/specs/<domain>/<domain>-specs.md`
20
20
  7. If backlog context exists, inspect the parent epic/capability and every child story beneath it.
@@ -22,7 +22,7 @@ Use wiki synthesis when the user asks to persist closed grill decisions into `ap
22
22
  Both workflows can happen in one long session, but keep the responsibilities distinct:
23
23
 
24
24
  - `docs/<topic>-grill-log.md` and `docs/<topic>-grill-status.md` are the detailed requirements and glossary record
25
- - `apps/wiki/domains/` is synthesized domain knowledge
25
+ - `apps/wiki/content/docs/<domain>/` is synthesized routed domain knowledge
26
26
  - backlog/user-story creation is the next phase after the grill gate, outside this skill's scope
27
27
 
28
28
  ## Core Behavior
@@ -80,7 +80,7 @@ Create or update decision pages only when:
80
80
 
81
81
  Keep `docs/` as the detailed design record.
82
82
 
83
- Use `apps/wiki/domains/` for synthesized domain knowledge.
83
+ Use `apps/wiki/content/docs/<domain>/` for synthesized routed domain knowledge.
84
84
 
85
85
  Do not duplicate the full grill log in wiki pages.
86
86
  Summarize stable meaning, glossary, and axioms; link back to source docs when useful.
@@ -0,0 +1,124 @@
1
+ # Bug Discovery Phase Reference
2
+
3
+ ## Preflight Record
4
+
5
+ Before running ClawPatch, write down the run contract in the conversation, goal
6
+ handoff, or local run notes:
7
+
8
+ ```text
9
+ repo root: <absolute path>
10
+ scope: <whole repo | path | feature/project selector>
11
+ provider: <codex|acpx|grok|opencode|pi|mock|mock-fail>
12
+ model: <model name or unset>
13
+ limit: <number or unset>
14
+ jobs: <number or unset>
15
+ state dir: <repo>/.clawpatch/
16
+ report path: <repo>/.clawpatch/reports/<name>.md or .json
17
+ dirty posture: include dirty changes? <yes|no>
18
+ output format: plain|json
19
+ ```
20
+
21
+ This record is part of the phase contract. Do it before launching any long AFK
22
+ review so the user can understand cost, scope, state, and replay boundaries.
23
+
24
+ ## Provider Warnings
25
+
26
+ Warn, but do not block, when any of these are true:
27
+
28
+ - provider is `pi`
29
+ - provider is `acpx` and the model or ACP config resolves to Claude
30
+ - provider, model, config, or environment mentions `claude`, `anthropic`, or an
31
+ Anthropic model family such as `claude-3`, `claude-3.5`, `claude-3-7`,
32
+ `claude-sonnet`, `claude-opus`, or `claude-haiku`
33
+ - `ANTHROPIC_API_KEY` is set
34
+
35
+ Use wording like:
36
+
37
+ ```text
38
+ Provider warning: this run appears to use Claude/Anthropic or another metered
39
+ route. That is allowed, but confirm the provider/model/cost boundary before
40
+ leaving it AFK. I will make the provider explicit in every generated command.
41
+ ```
42
+
43
+ Do not imply Anthropic routes are banned. The operator chooses the route.
44
+
45
+ ## Command Rules
46
+
47
+ Use explicit provider flags in generated ClawPatch commands. Add `--model` when
48
+ the model is known. Keep `--root`, `--state-dir`, `--limit`, `--jobs`, and
49
+ `--output` visible when they matter.
50
+
51
+ Prefer repo-local state:
52
+
53
+ ```sh
54
+ clawpatch doctor --root "$REPO" --state-dir "$REPO/.clawpatch" --provider "$PROVIDER" --model "$MODEL"
55
+ clawpatch status --root "$REPO" --state-dir "$REPO/.clawpatch" --plain
56
+ clawpatch init --root "$REPO" --state-dir "$REPO/.clawpatch"
57
+ clawpatch map --root "$REPO" --state-dir "$REPO/.clawpatch" --provider "$PROVIDER" --model "$MODEL"
58
+ ```
59
+
60
+ For discovery, use `review` for normal AFK review and `ci` when the user wants
61
+ CI-shaped discovery:
62
+
63
+ ```sh
64
+ clawpatch review --root "$REPO" --state-dir "$REPO/.clawpatch" --provider "$PROVIDER" --model "$MODEL" --limit "$LIMIT" --jobs "$JOBS"
65
+ clawpatch ci --root "$REPO" --state-dir "$REPO/.clawpatch" --provider "$PROVIDER" --model "$MODEL" --limit "$LIMIT" --jobs "$JOBS" --output "$REPORT"
66
+ ```
67
+
68
+ Use `--include-dirty` only when the user wants current uncommitted work included
69
+ in discovery. If omitted, say dirty work was excluded or left to ClawPatch
70
+ defaults.
71
+
72
+ For report and ledger inspection:
73
+
74
+ ```sh
75
+ clawpatch report --root "$REPO" --state-dir "$REPO/.clawpatch" --output "$REPORT" --plain
76
+ clawpatch report --root "$REPO" --state-dir "$REPO/.clawpatch" --output "$REPORT_JSON" --json
77
+ clawpatch next --root "$REPO" --state-dir "$REPO/.clawpatch" --plain
78
+ clawpatch show --root "$REPO" --state-dir "$REPO/.clawpatch" --finding "$FINDING_ID" --plain
79
+ clawpatch status --root "$REPO" --state-dir "$REPO/.clawpatch" --plain
80
+ ```
81
+
82
+ Triage commands are allowed for discovery classification when no source mutation
83
+ is performed:
84
+
85
+ ```sh
86
+ clawpatch triage --root "$REPO" --state-dir "$REPO/.clawpatch" --finding "$FINDING_ID" --status "$STATUS"
87
+ clawpatch revalidate --root "$REPO" --state-dir "$REPO/.clawpatch" --provider "$PROVIDER" --model "$MODEL" --finding "$FINDING_ID" --plain
88
+ ```
89
+
90
+ Discovery classification should reflect what was learned from static review:
91
+ branch relevance, runtime-debugging need, false-positive candidacy, resolution
92
+ candidacy, deferral, or blockers. Use ClawPatch statuses only where they match
93
+ the tool's supported values. Do not claim runtime truth from ClawPatch alone.
94
+
95
+ ## No-Mutation Boundary
96
+
97
+ Never run these by default in `bug-discovery-phase`:
98
+
99
+ ```sh
100
+ clawpatch fix --finding "$FINDING_ID"
101
+ clawpatch open-pr --patch "$PATCH_ATTEMPT_ID"
102
+ ```
103
+
104
+ If the user asks for fixing, stop discovery and enter `$bug-resolution-phase`.
105
+ If a finding needs runtime reproduction, enter `$debugging-phase`. If a selected
106
+ finding becomes tech debt, route repo docs through `$docs-ingest-phase`; broad
107
+ discovery itself does not create tech-debt docs.
108
+
109
+ ## Output Checklist
110
+
111
+ The final report must include:
112
+
113
+ - report path, usually `.clawpatch/reports/<run>.md` or `.json`
114
+ - durable ledger/state path, usually `.clawpatch/`
115
+ - provider, model, scope, `--limit`, `--jobs`, report path, and dirty posture
116
+ - command list and whether each command completed
117
+ - relevant finding IDs, status, severity if available, and why they matter
118
+ - explicit statement: ClawPatch findings are static-review candidates, not
119
+ proven runtime root causes
120
+ - next recommended phase for each important finding:
121
+ `$bug-resolution-phase`, `$debugging-phase`, `$docs-ingest-phase`, or none
122
+
123
+ Keep the summary concise. Preserve report and state paths so later resolution
124
+ goals can resume from the durable ClawPatch ledger.
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: bug-discovery-phase
3
+ description: >-
4
+ Runs AFK ClawPatch bug discovery, reporting, and triage without source
5
+ mutation. Use when the user asks for ClawPatch discovery, broad bug discovery,
6
+ bug lifecycle triage, finding ledgers, AFK bug review, or durable bug reports.
7
+ ---
8
+
9
+ # Bug Discovery Phase
10
+
11
+ `bug-discovery-phase` wraps ClawPatch discovery. It produces review state,
12
+ reports, and triage notes; it does not prove runtime root causes and does not
13
+ patch code by default.
14
+
15
+ See [REFERENCE.md](REFERENCE.md) for command patterns, provider warning wording,
16
+ and the full output checklist.
17
+
18
+ ## Contract
19
+
20
+ - **Role:** public AFK ClawPatch discovery/report/triage phase
21
+ - **Owns:** ClawPatch setup checks, discovery scope, report path, durable state,
22
+ finding IDs, and branch-relevant triage notes
23
+ - **Does not own:** runtime reproduction, root-cause proof, code fixes, PRs, or
24
+ repo tech-debt docs
25
+ - **Allowed commands:** `clawpatch init`, `map`, `review`, `ci`, `report`,
26
+ `show`, `next`, `triage`, `status`, `doctor`, `revalidate`
27
+ - **Blocked by default:** `clawpatch fix --finding`, `clawpatch open-pr`
28
+
29
+ ## Use When
30
+
31
+ - The user asks for broad ClawPatch review, discovery, report, triage, or status.
32
+ - A goal needs AFK static bug-finding before humans choose findings to resolve.
33
+ - Existing `.clawpatch/` state needs inspection, report generation, or triage.
34
+ - The desired output is a durable finding ledger, not a patch.
35
+
36
+ ## Do Not Use When
37
+
38
+ - There is one concrete runtime symptom; use `$debugging-phase`.
39
+ - The user asks to fix a selected ClawPatch finding; use `$bug-resolution-phase`.
40
+ - The user wants repo tech-debt docs; route that through `$docs-ingest-phase`
41
+ after a selected finding is classified.
42
+ - The target repo, provider, or scope cannot be identified.
43
+
44
+ ## Workflow
45
+
46
+ 1. **Bound the run.** Record repo root, scope, provider, model, `--limit`,
47
+ `--jobs`, state dir, report path, dirty-worktree posture, and requested output
48
+ format before running ClawPatch.
49
+ 2. **Warn on cost-sensitive routes.** Warn, but do not ban, Claude, Anthropic,
50
+ `acpx` resolving to Claude, `pi`, Anthropic model names, or
51
+ `ANTHROPIC_API_KEY`.
52
+ 3. **Make provider explicit.** Generated goals and commands must include the
53
+ selected provider. Include the model when known.
54
+ 4. **Inspect readiness.** Prefer `clawpatch doctor`, `status`, and existing
55
+ `.clawpatch/` state before long runs.
56
+ 5. **Discover.** Use read-oriented ClawPatch commands: usually `init`, `map`,
57
+ then `review` or `ci` with explicit provider, model, limit, jobs, state dir,
58
+ scope, and output.
59
+ 6. **Report and triage.** Generate a report under `.clawpatch/reports/` unless
60
+ the user supplied another path. Use `show`, `next`, `triage`, `status`, or
61
+ `revalidate` only for inspection and classification.
62
+ 7. **Stop before mutation.** Do not run `fix --finding` or `open-pr` unless the
63
+ user gives a new explicit resolution request.
64
+
65
+ ## Output Contract
66
+
67
+ Return:
68
+
69
+ - repo root, scope, provider, model, `--limit`, `--jobs`
70
+ - report path and durable ClawPatch ledger/state path
71
+ - commands run and validation status
72
+ - relevant finding IDs, statuses, and branch relevance
73
+ - warning that findings are static-review candidates, not proven runtime root
74
+ causes
75
+ - next action: inspect selected finding, enter `$bug-resolution-phase`, enter
76
+ `$debugging-phase`, or stop
@@ -0,0 +1,154 @@
1
+ # Bug Resolution Phase Reference
2
+
3
+ ## Operating Model
4
+
5
+ `bug-resolution-phase` starts after a human or upstream discovery step selects one ClawPatch finding. ClawPatch is the ledger and context source; it is not treated as proof of runtime behavior and is not the default patching engine.
6
+
7
+ Default to one finding. Accept a batch only when the user bounds it and the findings share at least one concrete constraint:
8
+
9
+ - same confirmed or suspected root cause
10
+ - same owned file set or package boundary
11
+ - same validation path or failing check
12
+ - same contract or test coverage gap
13
+
14
+ Do not turn a broad report into an automatic repair campaign. If the request is ambiguous, ask for the finding ID or batch boundary.
15
+
16
+ ## Useful ClawPatch Commands
17
+
18
+ Use commands like these for context and state:
19
+
20
+ ```sh
21
+ clawpatch show --finding <id>
22
+ clawpatch report
23
+ clawpatch triage --finding <id> --status <status> --note "<reason>"
24
+ clawpatch revalidate --finding <id>
25
+ clawpatch fix --finding <id> --dry-run
26
+ ```
27
+
28
+ `clawpatch fix --finding <id> --dry-run` is allowed for inspection when it clarifies the proposed patch, but do not apply it by default. `clawpatch fix --finding <id>` and `clawpatch open-pr --patch <patchAttemptId>` are explicit mutation paths and require a clear user request.
29
+
30
+ Preserve report linkage in notes and final output: finding ID, report path if known, `.clawpatch/` state path when relevant, and command outputs used for decisions.
31
+
32
+ ## Classification Matrix
33
+
34
+ ### `resolve-now`
35
+
36
+ Use when the finding is selected, bounded, code/docs ownership is clear, and verification is available.
37
+
38
+ Actions:
39
+
40
+ 1. Inspect ClawPatch evidence and relevant source.
41
+ 2. Optionally inspect `clawpatch fix --finding <id> --dry-run` for context only.
42
+ 3. Patch through normal Harness/Codex edits.
43
+ 4. Run focused tests, type checks, smoke checks, or docs validation appropriate to the touched scope.
44
+ 5. Revalidate with `clawpatch revalidate --finding <id>` when possible.
45
+ 6. If revalidation is unavailable or inconclusive, update triage/status with a clear note.
46
+
47
+ ### `needs-runtime-debugging`
48
+
49
+ Use when the finding depends on runtime behavior, reproduction, logs, browser/CLI checks, flakiness, performance, or an observed symptom.
50
+
51
+ Actions:
52
+
53
+ 1. Stop resolution edits unless a cause is already proven.
54
+ 2. Route into `$debugging-phase`.
55
+ 3. Pass input artifacts: finding ID, report path, source evidence, expected behavior, observed or suspected behavior, affected scenario, and any failed revalidation.
56
+ 4. Let `$debugging-phase` own hypotheses, runtime evidence, fix, and verification.
57
+
58
+ ### `tech-debt`
59
+
60
+ Use when the finding is real or plausible but too broad for selected-finding repair, needs product/architecture decisions, lacks acceptance criteria, or would require a larger spec.
61
+
62
+ Actions:
63
+
64
+ 1. Classify the selected finding first. Discovery alone must not create debt docs.
65
+ 2. Update ClawPatch triage/history with the tech-debt reason.
66
+ 3. Run `$docs-ingest-phase` to create or update durable repo debt/docs context.
67
+ 4. Preserve these fields in the durable context:
68
+ - ClawPatch finding ID
69
+ - ClawPatch report path or state path
70
+ - source evidence and affected paths
71
+ - classification reason
72
+ - human-review question
73
+ - why immediate resolution is unsafe or too broad
74
+ 5. Do not write speculative architecture as current truth.
75
+
76
+ The debt context should be small and reviewable. It should point to the
77
+ ClawPatch report and finding instead of copying the full report. It should name
78
+ the human decision needed before architecture, product scope, or acceptance
79
+ criteria can change.
80
+
81
+ Human-review questions should be concrete, for example: "Should this contract be changed, tested, or accepted as a known limitation?"
82
+
83
+ ### `false-positive`
84
+
85
+ Use when source inspection proves the finding is incorrect, stale, unreachable, already covered, or intentionally accepted behavior.
86
+
87
+ Actions:
88
+
89
+ 1. Record the proof with file paths, tests, docs, or command evidence.
90
+ 2. Run `clawpatch triage --finding <id> --status false-positive --note "<clear reason>"` or the closest supported false-positive status.
91
+ 3. Revalidate only if it adds signal; otherwise report the triage command as the state update.
92
+
93
+ ### `blocked`
94
+
95
+ Use when resolution cannot proceed because required access, artifacts, environment, owner decision, or reproduction evidence is missing.
96
+
97
+ Actions:
98
+
99
+ 1. Record the blocker and the specific missing item.
100
+ 2. Leave source unchanged unless partial safe cleanup was already verified.
101
+ 3. Update ClawPatch triage/status when useful with a note that names the blocker.
102
+ 4. Report the next human action.
103
+
104
+ ## Parallel Batch Resolution
105
+
106
+ `parallel: true` means bounded batch findings can be resolved concurrently, not merely inspected concurrently.
107
+
108
+ Preconditions:
109
+
110
+ - The batch list is explicit.
111
+ - Each finding has a classification target or classification owner.
112
+ - File ownership is disjoint, or the batch intentionally shares one root-cause patch with one coordination owner.
113
+ - Validation commands are known and can be merged centrally.
114
+ - Shared files, generated files, lockfiles, migrations, docs, and schemas have a single owner.
115
+ - Every worker can state which files it may edit, which files it must not edit,
116
+ and which validation it must run before handoff.
117
+
118
+ Worker brief must include:
119
+
120
+ - finding IDs
121
+ - classification route
122
+ - owned files and forbidden files
123
+ - allowed validation commands
124
+ - ClawPatch context command outputs or paths
125
+ - merge/revalidation handoff expectations
126
+ - explicit note that final ClawPatch status changes are centralized unless the
127
+ coordinator assigns one worker to a single finding end to end
128
+
129
+ Central coordinator responsibilities:
130
+
131
+ 1. Confirm no worker overwrote unrelated edits.
132
+ 2. Review combined diff for overlap and consistency.
133
+ 3. Run final focused validation.
134
+ 4. Run `clawpatch revalidate --finding <id>` for each resolved finding when possible.
135
+ 5. Update false-positive, tech-debt, or blocked statuses centrally.
136
+ 6. Produce one final report mapping each finding to classification, changes, validation, and ClawPatch state.
137
+
138
+ If two workers discover that their findings require the same file or root-cause
139
+ patch, pause fan-out for that subset and consolidate under one owner. Do not let
140
+ parallel workers race on the same fix.
141
+
142
+ ## Output Contract
143
+
144
+ Return:
145
+
146
+ - mode: `parallel: true|false`
147
+ - finding IDs and report/state paths used
148
+ - classification for each finding
149
+ - route taken: resolved, debugging, debt, false-positive, or blocked
150
+ - changes made through normal edits, if any
151
+ - ClawPatch commands run and resulting state
152
+ - verification commands and results
153
+ - debt/docs artifacts or debugging handoff, if created
154
+ - caveats, residual risk, and next human action
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: bug-resolution-phase
3
+ description: >-
4
+ Resolves selected ClawPatch findings through classification, bounded fixes,
5
+ triage, docs/debt routing, and revalidation. Use when the user selects a
6
+ ClawPatch finding, asks for ClawPatch-backed bug resolution, or gives a
7
+ tightly bounded finding batch for sequential or parallel handling.
8
+ ---
9
+
10
+ # Bug Resolution Phase
11
+
12
+ ## Contract
13
+
14
+ - **Role:** public ClawPatch selected-finding resolution phase
15
+ - **Scope:** one selected finding by default; bounded batch only when explicitly tied by root cause, owned files, validation path, or contract/test gap
16
+ - **Primary input:** ClawPatch finding ID plus report or `.clawpatch/` state path when available
17
+ - **Uses ClawPatch for:** finding context, report linkage, triage/history, optional dry-run inspection, revalidation
18
+ - **Does not use by default:** `clawpatch fix --finding`, `clawpatch open-pr --patch`
19
+ - **Patch path:** normal Harness/Codex edits unless the user explicitly requests ClawPatch patch attempts
20
+ - **Exit conditions:** resolved and revalidated, routed to debugging, recorded as debt, triaged false positive, or blocked with evidence
21
+
22
+ ## Use When
23
+
24
+ - The user selects a ClawPatch finding for resolution.
25
+ - The user asks to resolve a ClawPatch finding or bounded batch.
26
+ - Discovery output needs follow-up classification and repair.
27
+ - `parallel: true` is requested for a bounded finding batch.
28
+
29
+ ## Do Not Use When
30
+
31
+ - No finding is selected; use `$bug-discovery-phase` or ask for the finding ID.
32
+ - The work starts from a runtime symptom rather than a ClawPatch finding; use `$debugging-phase`.
33
+ - The user wants broad debt resolution from an existing debt artifact; use `$resolve-debt-phase`.
34
+ - The request is discovery/report generation only.
35
+
36
+ ## Quick Start
37
+
38
+ 1. Read the selected finding with `clawpatch show --finding <id>` and, when useful, `clawpatch report`.
39
+ 2. Capture finding ID, report path, source evidence, affected files, claimed behavior, and current ClawPatch status.
40
+ 3. Classify each finding as `resolve-now`, `needs-runtime-debugging`, `tech-debt`, `false-positive`, or `blocked`.
41
+ 4. Execute the classification route:
42
+ - `resolve-now`: patch through normal Harness/Codex edits, then test and revalidate.
43
+ - `needs-runtime-debugging`: route into `$debugging-phase` with the finding context as input artifact.
44
+ - `tech-debt`: after classification, run `$docs-ingest-phase` to create or update durable debt/docs context.
45
+ - `false-positive`: run `clawpatch triage --finding <id> --status <status> --note <reason>`.
46
+ - `blocked`: record blocker, missing evidence, and next human action.
47
+ 5. Finish with centralized verification and `clawpatch revalidate --finding <id>` or a triage/status update.
48
+
49
+ ## Parallel Rules
50
+
51
+ `bug-resolution-phase` may run with `parallel: true` or `parallel: false`.
52
+
53
+ - `parallel: false`: resolve one finding, or a tiny batch sequentially.
54
+ - `parallel: true`: only for bounded batches with explicit worker ownership.
55
+ - Before fan-out, prove findings are safely disjoint or intentionally share one root-cause scope.
56
+ - Assign owned finding IDs, files, tests, and allowed commands per worker.
57
+ - Workers may patch only their owned scope through normal Harness/Codex edits.
58
+ - Final verification, status decisions, and ClawPatch revalidation stay centralized.
59
+
60
+ ## Reference
61
+
62
+ See [REFERENCE.md](REFERENCE.md) for classification rules, ClawPatch command guidance, tech-debt artifact requirements, and output format.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: docs-ingest-phase
3
- description: Ingest specs into the wiki source layer, project wiki/project pages into Fumadocs routes, and keep repo docs accurate. Use when a spec is ready for domain capture, when apps/wiki content or Fumadocs navigation changes, or when code changes alter architecture, setup, contracts, or operator workflow.
3
+ description: Ingest specs and docs-affecting changes into canonical routed wiki/project docs and keep repo docs accurate. Use when a spec is ready for domain capture, when apps/wiki content or Fumadocs navigation changes, or when code changes alter architecture, setup, contracts, or operator workflow.
4
4
  ---
5
5
 
6
6
  # Docs Ingest Phase
@@ -10,15 +10,15 @@ description: Ingest specs into the wiki source layer, project wiki/project pages
10
10
  - **Role:** higher-order ingest and repo-docs phase
11
11
  - **Entrypoint type:** public phase entrypoint
12
12
  - **Upstream:** reviewed or implemented spec folder, or concrete docs-affecting code changes
13
- - **Delegates to:** internal flow-writing phase, internal concept-writing phase, Fumadocs projection
14
- - **Downstream:** synced wiki indexes, ingest metadata, wiki log, routed Fumadocs pages/meta, and required `docs/` updates
13
+ - **Delegates to:** internal routed flow-writing phase, internal routed concept-writing phase, route/navigation bookkeeping
14
+ - **Downstream:** canonical routed Fumadocs pages, `meta.json` navigation, ingest metadata, wiki log/index updates, and required `docs/` updates
15
15
  - **Entry conditions:** resolved spec folder for ingest work, or a concrete docs-affecting code change
16
16
  - **Stop conditions:** ingest bookkeeping complete, required docs updates complete, failures reported honestly
17
17
 
18
18
  ## Use When
19
19
 
20
- - A reviewed or implemented spec folder should become durable domain knowledge.
21
- - `apps/wiki` source content, Fumadocs navigation, `meta.json`, or routed pages change.
20
+ - A reviewed or implemented spec folder should become durable routed domain knowledge.
21
+ - `apps/wiki` content, Fumadocs navigation, `meta.json`, or routed pages change.
22
22
  - Code changes alter architecture, setup, contracts, decisions, runbooks, or operator workflow.
23
23
  - `delivery-phase` reaches `$docs-ingest-phase` and docs-affecting changes exist.
24
24
 
@@ -27,7 +27,7 @@ description: Ingest specs into the wiki source layer, project wiki/project pages
27
27
  - The work is still requirements discovery, planning, coding, or review.
28
28
  - The target spec is already marked `ingested: true`; report a no-op.
29
29
  - The requested docs would document speculative future behavior as current truth.
30
- - The task would duplicate large specs/plans/source pages into routed MDX instead of summarizing and linking.
30
+ - The task would duplicate large specs, plans, implementation notes, or runbooks into wiki/project pages instead of summarizing and linking.
31
31
 
32
32
  ## Quick Start
33
33
 
@@ -36,7 +36,7 @@ description: Ingest specs into the wiki source layer, project wiki/project pages
36
36
  - single-repo: `wiki`
37
37
  2. Read `<wiki-root>/AGENTS.md` before touching wiki content.
38
38
  3. If ingesting a spec, read [references/wiki-ingest.md](references/wiki-ingest.md).
39
- 4. If updating routed docs, read [references/fumadocs-routing.md](references/fumadocs-routing.md).
39
+ 4. If updating routed docs or navigation, read [references/fumadocs-routing.md](references/fumadocs-routing.md).
40
40
  5. If updating root `docs/`, read [references/repo-docs.md](references/repo-docs.md).
41
41
  6. Finish by reporting written pages, metadata changes, docs updates, validation run, and any no-op reason.
42
42
 
@@ -46,10 +46,10 @@ Run this order exactly:
46
46
 
47
47
  ```text
48
48
  docs-ingest-phase
49
- -> flow-writing phase
50
- -> concept-writing phase
49
+ -> routed flow-writing phase
50
+ -> routed concept-writing phase
51
51
  -> ingest bookkeeping
52
- -> Fumadocs projection
52
+ -> route/navigation bookkeeping
53
53
  ```
54
54
 
55
55
  Why: concept pages can cross-link flow pages, so flows must exist first.
@@ -58,10 +58,9 @@ Why: concept pages can cross-link flow pages, so flows must exist first.
58
58
 
59
59
  Keep the private Fumadocs app discoverable:
60
60
 
61
- - `/docs/wiki` renders product/domain knowledge: usage, concepts, theory, flows, glossary, and concept/flow ingest output.
62
- - `/docs/project` renders internal project operations: specs, plans, implementation notes, maintenance logs, decisions, repo guidance, runbooks, and useful management context.
61
+ - `/docs/project` is the canonical routed surface for internal project operations: specs, plans, implementation notes, maintenance logs, decisions, repo guidance, runbooks, and useful management context.
63
62
 
64
- Do not create a second wiki or separate content-owner layer. `apps/wiki` owns canonical source content and rendered Fumadocs pages.
63
+ Do not create a second wiki or a separate `domains/` content-owner layer. Routed MDX pages under `content/docs` are the durable human-facing wiki/project pages.
65
64
 
66
65
  ## Output Contract
67
66
 
@@ -70,8 +69,8 @@ Always report:
70
69
  - source spec or docs-affecting change processed
71
70
  - flows written or skipped
72
71
  - concepts written or skipped
73
- - source frontmatter/bookkeeping updates
74
- - Fumadocs routed pages and `meta.json` updates
72
+ - routed pages and `meta.json` updates
73
+ - ingest frontmatter/bookkeeping updates
75
74
  - root `docs/` updates, if any
76
75
  - validation commands run
77
76
  - no-op reasons or blockers
@@ -81,7 +80,8 @@ Always report:
81
80
  - Leave new or moved routed pages out of Fumadocs `meta.json`.
82
81
  - Strip or omit `surface` / `permission` frontmatter from routed pages.
83
82
  - Proceed to concept writing after a flow write fails.
83
+ - Write canonical concept or flow content outside routed `content/docs` pages.
84
84
  - Create `docs/prd`, `docs/dev`, roadmap, sprint, or backlog-mirror folders.
85
85
  - Put agent task instructions inside human-facing docs pages.
86
86
  - Leave docs orphaned from `docs/README.md` after adding or renaming them.
87
- - Duplicate content between `<wiki-root>/domains/` and `docs/reference/domains/`.
87
+ - Duplicate wiki article content across routed pages and another source tree.
@@ -0,0 +1,70 @@
1
+ # Concept Pages
2
+
3
+ Use this reference when `docs-ingest-phase` writes concepts into routed wiki docs.
4
+
5
+ ## Input Expansion
6
+
7
+ For each extracted concept:
8
+
9
+ 1. Read related routed flow pages under `<wiki-root>/content/docs/<domain>/`.
10
+ 2. Scan `<wiki-root>/raw/` recursively and collect files where frontmatter `ingested: false` or `ingested` is absent.
11
+ 3. Use relevant raw content only as supplementary material. Do not mark raw files as ingested here.
12
+
13
+ ## Output Contract
14
+
15
+ Synthesize concept content in this precedence order:
16
+
17
+ 1. `IMPLEMENTATION-NOTES.md` deviations, surprises, and judgment calls
18
+ 2. `SPEC.md` acceptance criteria, data model, and technical notes
19
+ 3. relevant sections from routed flow pages
20
+ 4. relevant raw file content
21
+
22
+ Determine status:
23
+
24
+ - `proposed` when only `SPEC.md` is present
25
+ - `implemented` when `IMPLEMENTATION-NOTES.md` is present
26
+
27
+ Derive the routed output path:
28
+
29
+ 1. Use the domain's existing route section if the concept clearly belongs there.
30
+ 2. Otherwise write to `<wiki-root>/content/docs/<domain>/<concept-name>.mdx`.
31
+ 3. Slugify the concept name to kebab-case.
32
+
33
+ For Harness-style domains, prefer existing topical sections such as `foundations`, `prompt-surfaces`, `skills-and-packs`, `execution-modes`, `validation-and-tools`, and `lifecycle-flows` when they already exist.
34
+
35
+ ## Page Shape
36
+
37
+ Every concept page must include frontmatter:
38
+
39
+ ```yaml
40
+ ---
41
+ title: <Concept Name>
42
+ description: <one sentence>
43
+ surface: wiki
44
+ permission: internal
45
+ domain: <domain>
46
+ type: concept
47
+ status: proposed | implemented
48
+ source:
49
+ - <source path>
50
+ updated: YYYY-MM-DD
51
+ ---
52
+ ```
53
+
54
+ Every concept page should include:
55
+
56
+ - a definition or opening explanation
57
+ - the concept's invariants, attributes, or boundaries
58
+ - links to related flows or mechanics pages
59
+ - source links or a short source section when useful
60
+
61
+ ## Merge Rules
62
+
63
+ When a routed concept page already exists:
64
+
65
+ - preserve established facts
66
+ - merge new implemented reality into the main article
67
+ - flag contradictions inline with a warning callout
68
+ - update `updated` and `source`
69
+
70
+ Update the nearest `meta.json` and section index page so the concept is discoverable.
@@ -0,0 +1,56 @@
1
+ # Flow Pages
2
+
3
+ Use this reference when `docs-ingest-phase` writes flows into routed wiki docs.
4
+
5
+ ## Output Contract
6
+
7
+ For each extracted flow:
8
+
9
+ 1. Derive the routed output path:
10
+ - use the domain's existing flow section when one exists
11
+ - otherwise write to `<wiki-root>/content/docs/<domain>/<flow-name>.mdx`
12
+ - slugify the flow name to kebab-case
13
+ 2. Determine status:
14
+ - `proposed` when only `SPEC.md` is present
15
+ - `implemented` when `IMPLEMENTATION-NOTES.md` is present
16
+ 3. Reconcile implementation notes when present:
17
+ - use `SPEC.md` acceptance criteria as the skeleton
18
+ - override or annotate steps where `IMPLEMENTATION-NOTES.md` records a deviation, surprise, or judgment call
19
+ - mark blocked or unmet steps with a warning callout
20
+ 4. Write or merge the routed flow page:
21
+ - preserve established facts
22
+ - integrate new implemented reality into the main flow
23
+ - flag contradictions inline with a warning callout
24
+ 5. Update the nearest `meta.json` and section index page so the flow is discoverable.
25
+
26
+ For Harness-style domains, flow pages usually belong under `lifecycle-flows`.
27
+
28
+ ## Page Shape
29
+
30
+ Every flow page must include frontmatter:
31
+
32
+ ```yaml
33
+ ---
34
+ title: <Flow Name>
35
+ description: <one sentence>
36
+ surface: wiki
37
+ permission: internal
38
+ domain: <domain>
39
+ type: flow
40
+ status: proposed | implemented
41
+ source:
42
+ - <source path>
43
+ updated: YYYY-MM-DD
44
+ ---
45
+ ```
46
+
47
+ Every flow page should include:
48
+
49
+ - trigger
50
+ - actors
51
+ - ordered steps and decision points
52
+ - terminal outcome
53
+ - validation or closeout signal
54
+ - source links when useful
55
+
56
+ Use a Mermaid diagram only when it clarifies branching or sequencing. Do not force diagrams for simple flows.