dev-loops 0.1.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.
- package/.pi/dev-loop/defaults.yaml +477 -0
- package/AGENTS.md +25 -0
- package/CHANGELOG.md +18 -0
- package/LICENSE +21 -0
- package/README.md +178 -0
- package/agents/dev-loop.agent.md +82 -0
- package/agents/developer.agent.md +37 -0
- package/agents/docs.agent.md +33 -0
- package/agents/fixer.agent.md +53 -0
- package/agents/quality.agent.md +28 -0
- package/agents/refiner.agent.md +87 -0
- package/agents/review.agent.md +64 -0
- package/cli/index.mjs +424 -0
- package/extension/README.md +233 -0
- package/extension/checks.ts +94 -0
- package/extension/index.ts +131 -0
- package/extension/post-merge-update.ts +512 -0
- package/extension/presentation.ts +107 -0
- package/lib/dev-loops-core.mjs +284 -0
- package/package.json +103 -0
- package/scripts/README.md +1007 -0
- package/scripts/_cli-primitives.mjs +10 -0
- package/scripts/_core-helpers.mjs +30 -0
- package/scripts/docs/validate-links.mjs +567 -0
- package/scripts/docs/validate-no-duplicate-rules.mjs +250 -0
- package/scripts/github/_review-thread-mutations.mjs +214 -0
- package/scripts/github/capture-review-threads.mjs +180 -0
- package/scripts/github/create-draft-pr.mjs +108 -0
- package/scripts/github/detect-checkpoint-evidence.mjs +393 -0
- package/scripts/github/detect-linked-issue-pr.mjs +331 -0
- package/scripts/github/manage-sub-issues.mjs +394 -0
- package/scripts/github/probe-copilot-review.mjs +323 -0
- package/scripts/github/ready-for-review.mjs +93 -0
- package/scripts/github/reconcile-draft-gate.mjs +328 -0
- package/scripts/github/reply-resolve-review-thread.mjs +42 -0
- package/scripts/github/reply-resolve-review-threads.mjs +329 -0
- package/scripts/github/request-copilot-review.mjs +551 -0
- package/scripts/github/resolve-tracker-local-spec.mjs +205 -0
- package/scripts/github/stage-reviewer-draft.mjs +191 -0
- package/scripts/github/upsert-checkpoint-verdict.mjs +694 -0
- package/scripts/github/verify-fresh-review-context.mjs +125 -0
- package/scripts/github/write-gate-findings-log.mjs +212 -0
- package/scripts/loop/_checkpoint-io.mjs +55 -0
- package/scripts/loop/_checkpoint-paths.mjs +28 -0
- package/scripts/loop/_handoff-contract.mjs +230 -0
- package/scripts/loop/_inspect-run-viewer-adapter.mjs +345 -0
- package/scripts/loop/_loop-evidence.mjs +32 -0
- package/scripts/loop/_pr-runner-coordination.mjs +611 -0
- package/scripts/loop/_stale-runner-detection.mjs +145 -0
- package/scripts/loop/_steering-state-file.mjs +134 -0
- package/scripts/loop/build-handoff-envelope.mjs +181 -0
- package/scripts/loop/checkpoint-contract.mjs +49 -0
- package/scripts/loop/conductor-monitor.mjs +1850 -0
- package/scripts/loop/conductor.mjs +214 -0
- package/scripts/loop/copilot-pr-handoff.mjs +493 -0
- package/scripts/loop/debt-remediate.mjs +304 -0
- package/scripts/loop/detect-change-scope.mjs +102 -0
- package/scripts/loop/detect-copilot-loop-state.mjs +454 -0
- package/scripts/loop/detect-copilot-session-activity.mjs +186 -0
- package/scripts/loop/detect-initial-copilot-pr-state.mjs +318 -0
- package/scripts/loop/detect-internal-only-pr.mjs +270 -0
- package/scripts/loop/detect-issue-refinement-artifact.mjs +163 -0
- package/scripts/loop/detect-pr-gate-coordination-state.mjs +509 -0
- package/scripts/loop/detect-reviewer-loop-state.mjs +231 -0
- package/scripts/loop/detect-stale-runner.mjs +250 -0
- package/scripts/loop/detect-tracker-first-loop-state.mjs +76 -0
- package/scripts/loop/detect-tracker-pr-state.mjs +102 -0
- package/scripts/loop/info.mjs +267 -0
- package/scripts/loop/inspect-run-viewer/cli.mjs +117 -0
- package/scripts/loop/inspect-run-viewer/constants.mjs +80 -0
- package/scripts/loop/inspect-run-viewer/graph.mjs +757 -0
- package/scripts/loop/inspect-run-viewer/handoff-envelope-renderer.mjs +398 -0
- package/scripts/loop/inspect-run-viewer/inbox.mjs +308 -0
- package/scripts/loop/inspect-run-viewer/managed-instance.mjs +750 -0
- package/scripts/loop/inspect-run-viewer/rendering.mjs +411 -0
- package/scripts/loop/inspect-run-viewer/server.mjs +638 -0
- package/scripts/loop/inspect-run-viewer/shared.mjs +103 -0
- package/scripts/loop/inspect-run-viewer/status.mjs +715 -0
- package/scripts/loop/inspect-run-viewer-ci-changes.mjs +77 -0
- package/scripts/loop/inspect-run-viewer.mjs +82 -0
- package/scripts/loop/inspect-run.mjs +382 -0
- package/scripts/loop/outer-loop.mjs +419 -0
- package/scripts/loop/pr-runner-coordination.mjs +143 -0
- package/scripts/loop/pre-commit-branch-guard.mjs +68 -0
- package/scripts/loop/pre-flight-gate.mjs +236 -0
- package/scripts/loop/pre-pr-ready-gate.mjs +183 -0
- package/scripts/loop/pre-push-main-guard.mjs +103 -0
- package/scripts/loop/pre-write-remote-freshness-guard.mjs +32 -0
- package/scripts/loop/print-gates.mjs +42 -0
- package/scripts/loop/resolve-dev-loop-startup.mjs +533 -0
- package/scripts/loop/run-conductor-cycle.mjs +322 -0
- package/scripts/loop/run-queue.mjs +124 -0
- package/scripts/loop/run-refinement-audit.mjs +513 -0
- package/scripts/loop/run-watch-cycle.mjs +358 -0
- package/scripts/loop/steer-loop.mjs +841 -0
- package/scripts/loop/ui-designer-review-contract.mjs +76 -0
- package/scripts/loop/watch-initial-copilot-pr.mjs +253 -0
- package/scripts/projects/add-queue-item.mjs +528 -0
- package/scripts/projects/ensure-queue-board.mjs +837 -0
- package/scripts/projects/list-queue-items.mjs +489 -0
- package/scripts/projects/move-queue-item.mjs +549 -0
- package/scripts/projects/reorder-queue-item.mjs +518 -0
- package/scripts/refine/_refine-helpers.mjs +258 -0
- package/scripts/refine/prose-linkage-detector.mjs +92 -0
- package/scripts/refine/refinement-completeness-checker.mjs +88 -0
- package/scripts/refine/scope-boundary-cross-checker.mjs +163 -0
- package/scripts/refine/tree-integrity-validator.mjs +211 -0
- package/scripts/refine/verify.mjs +178 -0
- package/scripts/repo-wiki-local.mjs +156 -0
- package/scripts/repo-wiki.mjs +119 -0
- package/skills/copilot-pr-followup/SKILL.md +380 -0
- package/skills/dev-loop/SKILL.md +141 -0
- package/skills/dev-loop/scripts/dev-mode-context.mjs +152 -0
- package/skills/dev-loop/scripts/dev-mode-context.test.mjs +80 -0
- package/skills/dev-loop/scripts/init-phase.mjs +71 -0
- package/skills/dev-loop/scripts/log-bash-exit-1.mjs +25 -0
- package/skills/dev-loop/scripts/phase-files.mjs +29 -0
- package/skills/dev-loop/scripts/post-gate-verdict-fallback.mjs +480 -0
- package/skills/dev-loop/scripts/post-gate-verdict-fallback.test.mjs +732 -0
- package/skills/dev-loop/scripts/render-template.mjs +82 -0
- package/skills/dev-loop/scripts/render-template.test.mjs +63 -0
- package/skills/dev-loop/templates/bootstrap-agents.md +26 -0
- package/skills/dev-loop/templates/bootstrap-implementation-state.md +31 -0
- package/skills/dev-loop/templates/bootstrap-implementation-workflow.md +17 -0
- package/skills/dev-loop/templates/dev-mode-retrospective.md +15 -0
- package/skills/dev-loop/templates/dev-mode-review.md +17 -0
- package/skills/dev-loop/templates/dev-mode-skill-changes.md +11 -0
- package/skills/dev-loop/templates/merged-phase-plan.md +19 -0
- package/skills/dev-loop/templates/phase-doc.md +27 -0
- package/skills/dev-loop/templates/phase-summary.md +13 -0
- package/skills/dev-loop/templates/phase-variant.md +15 -0
- package/skills/dev-loop/templates/retrospective.md +11 -0
- package/skills/dev-loop/templates/review.md +32 -0
- package/skills/dev-loop/templates/ui-vision-review.md +55 -0
- package/skills/docs/acceptance-criteria-verification.md +21 -0
- package/skills/docs/anti-patterns.md +21 -0
- package/skills/docs/artifact-authority-contract.md +119 -0
- package/skills/docs/confirmation-rules.md +28 -0
- package/skills/docs/copilot-ci-status-contract.md +52 -0
- package/skills/docs/copilot-loop-operations.md +233 -0
- package/skills/docs/debt-remediation-contract.md +107 -0
- package/skills/docs/entrypoint-strategies.md +115 -0
- package/skills/docs/epic-tree-refinement-procedure.md +234 -0
- package/skills/docs/issue-intake-procedure.md +235 -0
- package/skills/docs/main-agent-contract.md +72 -0
- package/skills/docs/merge-preconditions.md +29 -0
- package/skills/docs/pr-lifecycle-contract.md +209 -0
- package/skills/docs/public-dev-loop-contract.md +497 -0
- package/skills/docs/retrospective-checkpoint-contract.md +159 -0
- package/skills/docs/stop-conditions.md +29 -0
- package/skills/docs/structural-quality.md +42 -0
- package/skills/docs/tracker-first-loop-state.md +281 -0
- package/skills/docs/validation-policy.md +27 -0
- package/skills/docs/workflow-handoff-contract.md +135 -0
- package/skills/final-approval/SKILL.md +19 -0
- package/skills/local-implementation/SKILL.md +640 -0
|
@@ -0,0 +1,640 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: local-implementation
|
|
3
|
+
description: >-
|
|
4
|
+
Internal routed strategy behind `dev-loop` for local phase-bounded
|
|
5
|
+
implementation. Use it when authoritative startup/resume routing selects the
|
|
6
|
+
`local_implementation` strategy so the child agent can own phase planning,
|
|
7
|
+
artifact discipline, test-first implementation, and local validation in fresh
|
|
8
|
+
context.
|
|
9
|
+
compatibility: Pi skill for git-based repositories with Node.js/npm and optional subagent support.
|
|
10
|
+
allowed-tools: read bash edit write subagent review_loop
|
|
11
|
+
user-invocable: false
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Local Implementation
|
|
15
|
+
|
|
16
|
+
This skill is the canonical internal `local_implementation` route behind the public `dev-loop` façade.
|
|
17
|
+
|
|
18
|
+
Use it only after the public dispatcher has already resolved `selectedStrategy: local_implementation`. This skill owns the local phase procedure and artifact discipline for that route; it does not redefine the shipped runtime semantics of helper CLIs, shared loop logic, or extension commands.
|
|
19
|
+
|
|
20
|
+
Read the authoritative public routing contract at [Public Dev Loop Contract](../docs/public-dev-loop-contract.md) and keep any repository-specific decisions grounded in [Project Plan](../../PLAN.md), durable phase docs, source, tests, config, and actual validation commands.
|
|
21
|
+
For UI validation under `dev-loop`, see [UI Validation Contract](../../docs/ui-validation-contract.md), [UI Smoke Harness](../../docs/ui-smoke-harness.md), [UI Artifact Contract](../../docs/ui-artifact-contract.md), and [UI Designer Review Loop](../../docs/ui-designer-review-loop.md) (designer + `uiReviewMode: vision`) (these are repo-level docs present in the source checkout; they are not part of the bundled `../docs/` runtime contract surface for installed skill copies).
|
|
22
|
+
|
|
23
|
+
## Minimal required project inputs
|
|
24
|
+
|
|
25
|
+
For a new project, the only required inputs are:
|
|
26
|
+
|
|
27
|
+
1. [Project Plan](../../PLAN.md)
|
|
28
|
+
2. [this skill file](./SKILL.md)
|
|
29
|
+
|
|
30
|
+
Everything else is optional and may be bootstrapped by this skill.
|
|
31
|
+
|
|
32
|
+
## Required startup reads
|
|
33
|
+
|
|
34
|
+
Read the canonical entrypoint briefing first: [Entrypoint Strategies](../docs/entrypoint-strategies.md#local-implementation). Then read only what the current step needs:
|
|
35
|
+
|
|
36
|
+
- [Agent Instructions](../../AGENTS.md) (repo constitution)
|
|
37
|
+
- [Public Dev Loop Contract](../docs/public-dev-loop-contract.md)
|
|
38
|
+
- [Retrospective Checkpoint Contract](../docs/retrospective-checkpoint-contract.md) (when async state applies)
|
|
39
|
+
- [Project Plan](../../PLAN.md) and phase/tracker docs when relevant
|
|
40
|
+
- Relevant issue/PR, validation surface, and task files
|
|
41
|
+
|
|
42
|
+
Treat missing optional files as normal bootstrap conditions, not errors.
|
|
43
|
+
|
|
44
|
+
### Tracker-backed local implementation
|
|
45
|
+
|
|
46
|
+
Local implementation supports two durable spec inputs:
|
|
47
|
+
|
|
48
|
+
- phase-doc-backed local sessions ([Phase Plan](../../docs/phases/phase-x.md) is canonical)
|
|
49
|
+
- tracker-backed local sessions (the tracker issue is canonical)
|
|
50
|
+
|
|
51
|
+
Tracker-backed local implementation stays inside the existing `local_implementation` path. For sub-issue tree decomposition, see [Sub-Issue Tree Contract](../../docs/sub-issue-tree-contract.md) (this is a source-repo reference; it is not part of the bundled `../docs/` runtime contract surface for installed skill copies). It does not introduce a new routing mode.
|
|
52
|
+
|
|
53
|
+
When the local spec already lives in a tracker issue:
|
|
54
|
+
|
|
55
|
+
- resolve the tracker reference deterministically from a GitHub issue URL or explicit `<owner/name>` + issue number
|
|
56
|
+
- use the bounded GitHub helper `scripts/github/resolve-tracker-local-spec.mjs` when you need a machine-readable spec bundle
|
|
57
|
+
- treat the tracker issue title/body/url/state as the durable local spec bundle
|
|
58
|
+
- do not create or read [Phase Plan](../../docs/phases/phase-x.md) for that same tracker-backed session
|
|
59
|
+
- sync durable scope / acceptance / status changes back to the tracker issue rather than maintaining a duplicate local phase doc
|
|
60
|
+
- keep `tmp/` as temporary local execution state only; it does not become a second durable spec surface
|
|
61
|
+
- for tracker-backed sessions, the handoff path is always: push the working branch → open a PR → merge via GitHub
|
|
62
|
+
- for tracker-backed sessions, PR creation must always include `--assignee @me` so the new PR is self-assigned, and the PR body must contain `Closes #N` (or `Fixes #N`) for the linked issue so GitHub auto-closes it on merge. When `.devloops` sets `workflow.requireDraftFirst` to true, use `dev-loops pr create-draft --assignee @me ...`. Do not create a fresh PR directly in ready-for-review state unless the user explicitly overrides that policy for the current PR scope. The draft gate inspection is a real workflow boundary.
|
|
63
|
+
- do not suggest a direct local-main merge for tracker-backed sessions; do not merge the working branch into local `main` at phase completion
|
|
64
|
+
|
|
65
|
+
## Primary execution rules
|
|
66
|
+
|
|
67
|
+
### Step 0: Pre-flight gate (mandatory for local_implementation)
|
|
68
|
+
|
|
69
|
+
For the `local_implementation` strategy, before any planning or implementation mutation, run the pre-flight gate:
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
node scripts/loop/pre-flight-gate.mjs --expected-branch <working-branch> --check-subagents
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Before creating or reusing a worktree for local implementation, always run `git fetch origin` first. Always create worktrees from a freshly fetched `origin/main`. The fetched `origin/main` is the authoritative base for all worktree creation.
|
|
76
|
+
|
|
77
|
+
This validates:
|
|
78
|
+
- Worktree isolation (current directory is under `tmp/worktrees/`)
|
|
79
|
+
- Branch identity (current branch matches the working branch)
|
|
80
|
+
- Subagent availability (subagents should be used for fan-out when available)
|
|
81
|
+
|
|
82
|
+
If the gate fails, **stop and fix the violation** before proceeding. Do not bypass the gate in normal workflow execution.
|
|
83
|
+
|
|
84
|
+
Note: `--check-subagents` is advisory — it reports availability but does not block the gate. The worktree and branch checks are the mandatory gates.
|
|
85
|
+
|
|
86
|
+
This gate does **not** apply to other routed strategies (`copilot_pr_followup`, `external_pr_followup`, `reviewer_fixer`, `wait_watch`, `final_approval`, `issue_intake`). Those strategies have their own execution rules and may edit code from any checkout as needed.
|
|
87
|
+
|
|
88
|
+
Development-only bypass (`PI_PREFLIGHT_BYPASS=1`) exists for testing the gate itself but must not be used in production workflow runs. The bypass variable is a testing convenience, not an operational escape hatch.
|
|
89
|
+
|
|
90
|
+
### Step 1
|
|
91
|
+
|
|
92
|
+
- Implement **one phase at a time**.
|
|
93
|
+
- Do not refine later phases in detail before the current phase is complete.
|
|
94
|
+
- Use the `refiner` agent for phase-refinement work when subagents are available; escalate RFC-worthy technical decisions to the parent session / human operator.
|
|
95
|
+
- Work **test-first** for all non-trivial logic.
|
|
96
|
+
- Maintain **90% coverage** thresholds.
|
|
97
|
+
- Log detailed iteration artifacts under `tmp/` using the required structure below.
|
|
98
|
+
- For phase-doc-backed local sessions, keep durable phase intent and acceptance criteria in [Phase Plan](../../docs/phases/phase-x.md); for tracker-backed local sessions, keep that durable intent in the tracker issue and do not duplicate it into [Phase Plan](../../docs/phases/phase-x.md). Keep detailed execution artifacts in `tmp/`.
|
|
99
|
+
- Treat `tmp/` as temporary local execution state. Do not rely on it as durable repo history and do not force-add it to git unless the user explicitly wants checked-in examples or fixtures.
|
|
100
|
+
- When a phase changes durable product truth in ways `PLAN.md` should express (for example command surface, accepted product decisions, resolved open questions, or scope changes), update [Project Plan](../../PLAN.md) before closing the phase.
|
|
101
|
+
- Do implementation work on a dedicated local branch, not directly on `main`.
|
|
102
|
+
- If the repo has no commits yet, still create the working branch first so the first commits land off `main`; only move `main` forward after review and validation.
|
|
103
|
+
- Use small atomic local commits as progress checkpoints whenever a coherent slice is green and reviewable.
|
|
104
|
+
- Before a branch is considered review-complete, approval-ready, merge-ready, or ready for final handoff, run the default pre-approval gate as a full review / fix loop with the review angles resolved from config (`resolveGateAngles(config, "preApproval")`), then apply accepted fixes and rerun validation. Shipped defaults include the `deep` angle.
|
|
105
|
+
- A phase is only fully complete when its scoped work, required support files, artifacts, validation, review/fix pass, commit(s), and finalization (merge into local `main` for phase-doc-backed sessions; PR merge for tracker-backed sessions) are done, or when the only remaining step is an explicitly noted authorization-gated finalization action.
|
|
106
|
+
- When subagents are used, log what each subagent was asked to do and what it concluded.
|
|
107
|
+
- If [Project Plan](../../PLAN.md) is too rough or ambiguous to safely start the current phase, do not guess: run a clarification/interview step with the user first.
|
|
108
|
+
|
|
109
|
+
## Structural quality
|
|
110
|
+
|
|
111
|
+
Apply [Structural Quality](../docs/structural-quality.md) from the `deep` review angle.
|
|
112
|
+
|
|
113
|
+
## Light mode (small changes) — config-only
|
|
114
|
+
|
|
115
|
+
Light mode is currently **config-only**: the schema, resolver, and scope detector are implemented, but no functional wiring exists yet in the local-implementation flow. When scope is small enough, the intent is to skip fan-out/fan-in and use a single review pass instead. Light mode will still require validation and pre-approval gate once wired.
|
|
116
|
+
|
|
117
|
+
**Eligibility:** ≤3 files AND ≤200 lines changed (configurable via `.devloops` field `localImplementation.lightMode`).
|
|
118
|
+
|
|
119
|
+
Use `scripts/loop/detect-change-scope.mjs` to determine eligibility:
|
|
120
|
+
```sh
|
|
121
|
+
node scripts/loop/detect-change-scope.mjs
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Planned light mode path (not yet wired):**
|
|
125
|
+
1. Validation (`npm run verify`)
|
|
126
|
+
2. Single review pass (not multi-angle fan-out)
|
|
127
|
+
3. Pre-approval gate
|
|
128
|
+
4. Finalization
|
|
129
|
+
|
|
130
|
+
**Override threshold:**
|
|
131
|
+
```yaml
|
|
132
|
+
localImplementation:
|
|
133
|
+
lightMode:
|
|
134
|
+
enabled: true
|
|
135
|
+
maxFiles: 5
|
|
136
|
+
maxLines: 300
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Disabled by default (opt-in). Scope above threshold falls back to full fan-out/fan-in path.
|
|
140
|
+
|
|
141
|
+
## Deterministic logging structure
|
|
142
|
+
|
|
143
|
+
Treat the workflow as three layers:
|
|
144
|
+
- [Project Plan](../../PLAN.md) = strategic product and architecture truth
|
|
145
|
+
- [Phase Plan](../../docs/phases/phase-x.md) or the canonical tracker issue = durable per-phase plan and acceptance criteria for the active local session
|
|
146
|
+
- `tmp/` = temporary local execution audit trail and machine-friendly continuation state
|
|
147
|
+
|
|
148
|
+
Maintain the core paths below while the phase is active locally, and create optional artifacts only when they are actually used:
|
|
149
|
+
|
|
150
|
+
Core paths:
|
|
151
|
+
- for phase-doc-backed local sessions: [Phase Plan](../../docs/phases/phase-x.md)
|
|
152
|
+
- `tmp/phases/index.json`
|
|
153
|
+
- `tmp/phases/phase-x/manifest.json`
|
|
154
|
+
- `Variant A` (`tmp/phases/phase-x/variant-a.md`)
|
|
155
|
+
- `Variant B` (`tmp/phases/phase-x/variant-b.md`)
|
|
156
|
+
- `Merged Plan` (`tmp/phases/phase-x/merged-plan.md`)
|
|
157
|
+
- `Phase Review` (`tmp/phases/phase-x/review.md`)
|
|
158
|
+
- `Phase Summary` (`tmp/phases/phase-x/summary.md`)
|
|
159
|
+
- `Retrospective` (`tmp/phases/phase-x/retrospective.md`)
|
|
160
|
+
|
|
161
|
+
Optional when used:
|
|
162
|
+
- `Variant C` (`tmp/phases/phase-x/variant-c.md`)
|
|
163
|
+
- `tmp/phases/phase-x/subagents/`
|
|
164
|
+
- `tmp/phases/phase-x/subagents/raw/`
|
|
165
|
+
- `tmp/phases/phase-x/bash-exit-1.jsonl`
|
|
166
|
+
- `Clarification Log` (`tmp/phases/phase-x/clarification.md`)
|
|
167
|
+
- in dev mode: `tmp/phases/phase-x/dev-mode-context.json`
|
|
168
|
+
- in dev mode: `Dev Mode Review` (`tmp/phases/phase-x/dev-mode-review.md`) as optional analytical notes when they help shape the retrospective
|
|
169
|
+
- in dev mode: `Dev Mode Retrospective` (`tmp/phases/phase-x/dev-mode-retrospective.md`)
|
|
170
|
+
- in dev mode: `Dev Mode Skill Changes` (`tmp/phases/phase-x/dev-mode-skill-changes.md`)
|
|
171
|
+
|
|
172
|
+
Use the templates in `../dev-loop/templates/` (the sibling `skills/dev-loop/templates/` directory in this repo).
|
|
173
|
+
|
|
174
|
+
Use deterministic helper scripts from `../dev-loop/scripts/` (the sibling `skills/dev-loop/scripts/` directory in this repo; in installed-skill layouts these live at `../dev-loop/scripts/` relative to this skill file, not inside this skill's own directory) for repeatable support tasks such as phase initialization, phase-file updates, template materialization, bash-exit logging, and dev-mode context collection.
|
|
175
|
+
|
|
176
|
+
## Bootstrap missing support files
|
|
177
|
+
|
|
178
|
+
If these files are missing, create them from the `../dev-loop/templates/` directory before continuing:
|
|
179
|
+
|
|
180
|
+
- missing [Agent Instructions](../../AGENTS.md) -> create from [Bootstrap Agents Template](../dev-loop/templates/bootstrap-agents.md)
|
|
181
|
+
- missing [Implementation State](../../docs/IMPLEMENTATION_STATE.md) -> create from [Bootstrap Implementation State Template](../dev-loop/templates/bootstrap-implementation-state.md)
|
|
182
|
+
- missing [Implementation Workflow](../../docs/IMPLEMENTATION_WORKFLOW.md) -> create from [Bootstrap Implementation Workflow Template](../dev-loop/templates/bootstrap-implementation-workflow.md)
|
|
183
|
+
- missing [Phase Plan](../../docs/phases/phase-x.md) for the active phase -> create from [Phase Doc Template](../dev-loop/templates/phase-doc.md)
|
|
184
|
+
- missing `tmp/phases/index.json` -> create or reinitialize it
|
|
185
|
+
|
|
186
|
+
The bootstrap files are support infrastructure. [Project Plan](../../PLAN.md) remains the product source of truth. For phase-doc-backed local sessions, [Phase Plan](../../docs/phases/phase-x.md) is the durable source of truth for the current phase's plan and acceptance boundary. For tracker-backed local sessions, the tracker issue is that durable source of truth, and no duplicate local phase doc should be bootstrapped.
|
|
187
|
+
|
|
188
|
+
For bootstrap/setup phases, do not mark the phase `completed` or `awaiting-finalization` until the expected durable support files for the chosen workflow contract actually exist in the repository. Temporary `tmp/` execution artifacts do not need to be committed.
|
|
189
|
+
## Plan sufficiency check
|
|
190
|
+
|
|
191
|
+
Before phase planning, check whether [Project Plan](../../PLAN.md) contains enough information to proceed safely.
|
|
192
|
+
|
|
193
|
+
At minimum, the current phase needs enough information to infer:
|
|
194
|
+
- the goal of the phase
|
|
195
|
+
- the main constraints
|
|
196
|
+
- the intended scope or boundaries
|
|
197
|
+
- at least rough acceptance criteria or success shape
|
|
198
|
+
|
|
199
|
+
If that information is missing or too ambiguous, pause implementation and run a clarification/interview step.
|
|
200
|
+
|
|
201
|
+
## Clarification / interview step
|
|
202
|
+
|
|
203
|
+
When the plan is insufficient, use one of these modes:
|
|
204
|
+
|
|
205
|
+
### Mode A — interactive clarification
|
|
206
|
+
- ask only the missing high-value questions needed to safely refine the current phase
|
|
207
|
+
- prefer a short interview or wizard-style sequence over one giant question dump
|
|
208
|
+
- record the answers in `Clarification Log` (`tmp/phases/phase-x/clarification.md`)
|
|
209
|
+
- update [Phase Plan](../../docs/phases/phase-x.md) with clarified durable phase intent, scope, or acceptance criteria
|
|
210
|
+
- update [Project Plan](../../PLAN.md) only if the clarified information is durable product/project truth beyond the current phase
|
|
211
|
+
- update [Implementation State](../../docs/IMPLEMENTATION_STATE.md) if the clarification changes the next phase boundary
|
|
212
|
+
|
|
213
|
+
### Mode B — auto clarification
|
|
214
|
+
Use this when the user explicitly asks for an auto option, says to just proceed, or is clearly optimizing for speed over discussion.
|
|
215
|
+
|
|
216
|
+
In auto mode:
|
|
217
|
+
- infer the smallest safe defaults for the current phase only
|
|
218
|
+
- prefer conservative assumptions over ambitious ones
|
|
219
|
+
- never auto-resolve product, security, or architecture decisions that could materially change scope
|
|
220
|
+
- write all assumptions to `Clarification Log` (`tmp/phases/phase-x/clarification.md`)
|
|
221
|
+
- mark them clearly as `auto-assumptions`
|
|
222
|
+
- surface the assumptions in the phase plan audit so they can be challenged later
|
|
223
|
+
- if an assumption is too risky to make safely, stop and ask the user anyway
|
|
224
|
+
|
|
225
|
+
Do not begin fan-out planning until the current phase is sufficiently specified, either by user clarification or safe auto-assumptions.
|
|
226
|
+
|
|
227
|
+
## Determine where to resume
|
|
228
|
+
|
|
229
|
+
Read [Implementation State](../../docs/IMPLEMENTATION_STATE.md) and identify the next unfinished phase.
|
|
230
|
+
Read [Phase Plan](../../docs/phases/phase-x.md) for that phase if it exists.
|
|
231
|
+
|
|
232
|
+
If `tmp/phases/index.json` exists locally, use it as a fast index for prior artifacts.
|
|
233
|
+
If the durable phase doc, the state file, and the tmp index disagree, trust docs first and note the mismatch in the phase plan audit log.
|
|
234
|
+
|
|
235
|
+
If the state file is ambiguous, resolve ambiguity conservatively:
|
|
236
|
+
- prefer the earliest clearly unfinished phase
|
|
237
|
+
- do not skip ahead
|
|
238
|
+
- note the ambiguity in the phase plan audit log under `tmp/`
|
|
239
|
+
- if this is a first-run bootstrap, start from the earliest phase implied by [Project Plan](../../PLAN.md)
|
|
240
|
+
|
|
241
|
+
## Phase planning loop
|
|
242
|
+
|
|
243
|
+
For the **current phase only**, run this loop before implementation.
|
|
244
|
+
|
|
245
|
+
### 1. Create or update the durable phase doc and tmp scaffold
|
|
246
|
+
|
|
247
|
+
Use paths like:
|
|
248
|
+
- `docs/phases/phase-0.md`
|
|
249
|
+
- `tmp/phases/phase-0/`
|
|
250
|
+
- `docs/phases/phase-1.md`
|
|
251
|
+
- `tmp/phases/phase-1/`
|
|
252
|
+
|
|
253
|
+
Create or update:
|
|
254
|
+
- [Phase Plan](../../docs/phases/phase-x.md)
|
|
255
|
+
- `tmp/phases/phase-x/manifest.json`
|
|
256
|
+
- `tmp/phases/index.json`
|
|
257
|
+
|
|
258
|
+
Prefer the deterministic helper:
|
|
259
|
+
- `../dev-loop/scripts/init-phase.mjs`
|
|
260
|
+
|
|
261
|
+
Use `../dev-loop/scripts/phase-files.mjs` only when you need a narrower manifest/index update without regenerating the standard phase-planning scaffold.
|
|
262
|
+
|
|
263
|
+
### 2. Read the previous phase's learning before planning the next one
|
|
264
|
+
|
|
265
|
+
If a previous phase exists, read:
|
|
266
|
+
- its `summary.md`
|
|
267
|
+
- its `retrospective.md`
|
|
268
|
+
- any relevant subagent summaries
|
|
269
|
+
|
|
270
|
+
Use those lessons to improve the current phase plan.
|
|
271
|
+
|
|
272
|
+
### 2b. Optional bounded refinement audit
|
|
273
|
+
|
|
274
|
+
Before variant fan-out, optionally run one bounded audit when the active phase would benefit from slop-risk discovery, structural drift discovery, or adjacent cleanup discovery.
|
|
275
|
+
|
|
276
|
+
When used:
|
|
277
|
+
- run one bounded audit before variant fan-out
|
|
278
|
+
- write the audit artifact to `tmp/phases/phase-x/audit/refinement-audit-summary.json`
|
|
279
|
+
- use `node scripts/loop/run-refinement-audit.mjs --paths ... --output tmp/phases/phase-x/audit/refinement-audit-summary.json`
|
|
280
|
+
- pass a concise audit summary into every refiner briefing
|
|
281
|
+
- keep the audit opt-in; do not turn it into a mandatory precondition
|
|
282
|
+
- preserve prioritized findings, the highest-value follow-up candidates, and an explicit statement of what this phase will not rewrite or broaden in the merged plan and review artifacts
|
|
283
|
+
|
|
284
|
+
### 3. Fan out short plan variants
|
|
285
|
+
|
|
286
|
+
Write 2-3 short variants:
|
|
287
|
+
- `Variant A` (`tmp/phases/phase-x/variant-a.md`) = smallest safe implementation
|
|
288
|
+
- `Variant B` (`tmp/phases/phase-x/variant-b.md`) = best practical UX/developer-experience option within phase scope
|
|
289
|
+
- `Variant C` (`tmp/phases/phase-x/variant-c.md`) = safest boundary/risk-reduction option when useful
|
|
290
|
+
|
|
291
|
+
When subagents are available, the default refinement path should use the `refiner` role and **parallel fresh-context subagents** so the variants are independently generated rather than serially contaminated by one another. Pass each refiner a concise written briefing summary instead of relying on forked parent-session context.
|
|
292
|
+
|
|
293
|
+
For future refinement hardening, treat the `variant-a` / `variant-b` pattern as the stable inner fan-out shape for a given persona or review angle. Do not switch personas halfway through one `a/b` pair. Instead, when more hardening is needed, run multiple fresh-context fan-out passes with different personas or angles, each with its own consistent `a/b` pair, and then merge across those persona-specific passes.
|
|
294
|
+
|
|
295
|
+
Each refiner variant should make room for:
|
|
296
|
+
- explicit non-goals
|
|
297
|
+
- complete acceptance criteria
|
|
298
|
+
- a complete definition of done
|
|
299
|
+
- risks and unresolved questions
|
|
300
|
+
- when a bounded audit artifact exists: prioritized findings, highest-value follow-up candidates, and what the phase will not rewrite or broaden
|
|
301
|
+
- RFC escalation notes when technical decisions should go to the parent session / human operator
|
|
302
|
+
- for watcher/predicate-heavy phases: explicit negative-case tests and timeout semantics, including any zero-timeout or single-check contract
|
|
303
|
+
|
|
304
|
+
Use the template in [Phase Variant Template](../dev-loop/templates/phase-variant.md).
|
|
305
|
+
|
|
306
|
+
Each variant should cover only:
|
|
307
|
+
- scope for this phase
|
|
308
|
+
- files/modules touched
|
|
309
|
+
- tests to add first
|
|
310
|
+
- implementation order
|
|
311
|
+
- acceptance criteria
|
|
312
|
+
- risks/non-goals
|
|
313
|
+
|
|
314
|
+
When a phase includes a bounded audit, inventory, or scan:
|
|
315
|
+
- treat the scan as a first-class deliverable rather than an implicit side note
|
|
316
|
+
- require prioritized findings, not an unbounded dump
|
|
317
|
+
- state explicitly what the scan does **not** authorize or rewrite in the current phase
|
|
318
|
+
|
|
319
|
+
If subagents generate the variants:
|
|
320
|
+
- run them in parallel with clean context when practical
|
|
321
|
+
- give each variant generator a concise briefing summary that includes phase objective, in-scope work, constraints, known risks, and required outputs
|
|
322
|
+
- keep each `variant-a` / `variant-b` pair anchored to one persona or refinement angle so the alternatives are directly comparable
|
|
323
|
+
- when you want broader hardening, add another fan-out pass with a different persona or angle and its own `variant-a` / `variant-b` pair instead of blending multiple personas into one pair
|
|
324
|
+
- do not fork the parent session just to share planning context; summarize it instead
|
|
325
|
+
- save raw subagent outputs under `tmp/phases/phase-x/subagents/raw/` only when keeping the raw capture is actually useful
|
|
326
|
+
- then write the human-oriented `Variant A` (`tmp/phases/phase-x/variant-a.md`) / `Variant B` (`tmp/phases/phase-x/variant-b.md`) / `Variant C` (`tmp/phases/phase-x/variant-c.md`) files from those raw outputs when applicable
|
|
327
|
+
|
|
328
|
+
Update `manifest.json` with the planned artifact list and current status.
|
|
329
|
+
|
|
330
|
+
### 4. Fan in to a merged phase plan
|
|
331
|
+
|
|
332
|
+
Write:
|
|
333
|
+
- `Merged Plan` (`tmp/phases/phase-x/merged-plan.md`)
|
|
334
|
+
- update [Phase Plan](../../docs/phases/phase-x.md) with the selected durable phase plan
|
|
335
|
+
|
|
336
|
+
Use the templates in [Merged Phase Plan Template](../dev-loop/templates/merged-phase-plan.md) and [Phase Doc Template](../dev-loop/templates/phase-doc.md).
|
|
337
|
+
|
|
338
|
+
The merged plan must include:
|
|
339
|
+
- exact scope for this phase
|
|
340
|
+
- explicit non-goals
|
|
341
|
+
- tests to write first
|
|
342
|
+
- implementation order
|
|
343
|
+
- validation steps
|
|
344
|
+
- acceptance criteria
|
|
345
|
+
- definition of done
|
|
346
|
+
- when a bounded audit artifact exists: prioritized findings, highest-value follow-up candidates, and an explicit statement of what this phase will not rewrite or broaden
|
|
347
|
+
- RFC escalation notes for any RFC-worthy technical decisions that must go to the parent session / human operator instead of being silently resolved during refinement
|
|
348
|
+
- for any new CLI surface: explicit success-output and malformed-argument/error-contract expectations
|
|
349
|
+
- for any watcher/predicate-driven behavior: explicit timeout semantics plus negative-case detection rules for non-target identities or events
|
|
350
|
+
- for package-first phases in a source-loaded workspace: explicit expectations about whether callers consume shared logic through workspace/source adapters or published package import paths during local development
|
|
351
|
+
|
|
352
|
+
The durable phase doc should capture the subset that a fresh human or agent should read first: objective, why now, scope, non-goals, acceptance criteria, definition of done, validation approach, durable decisions, and open questions.
|
|
353
|
+
|
|
354
|
+
### 5. Review the merged phase plan adversarially
|
|
355
|
+
|
|
356
|
+
Write:
|
|
357
|
+
- `Phase Review` (`tmp/phases/phase-x/review.md`)
|
|
358
|
+
|
|
359
|
+
Use the template in [Review Template](../dev-loop/templates/review.md).
|
|
360
|
+
Ensure the durable phase doc still matches the reviewed plan; update [Phase Plan](../../docs/phases/phase-x.md) if the review changes accepted scope or criteria.
|
|
361
|
+
|
|
362
|
+
The review must check for:
|
|
363
|
+
- overreach beyond phase scope
|
|
364
|
+
- KISS/SRP/YAGNI violations
|
|
365
|
+
- missing tests
|
|
366
|
+
- weak validation
|
|
367
|
+
- unclear module boundaries
|
|
368
|
+
- hidden coupling to Pi runtime internals
|
|
369
|
+
- ambiguous acceptance criteria
|
|
370
|
+
- unclear or incomplete definition-of-done output
|
|
371
|
+
- missing review-surface completeness
|
|
372
|
+
- weak RFC-escalation sanity when the plan surfaces an unresolved technical decision
|
|
373
|
+
- for bounded audits/scans: missing prioritization or quiet expansion into a broad rewrite
|
|
374
|
+
- for new CLI surfaces: weak malformed-argument or error-contract coverage
|
|
375
|
+
- for watcher/predicate-heavy behavior: weak timeout semantics or missing negative-case tests for non-target activity
|
|
376
|
+
- for package-first phases: ambiguous source-loaded workspace integration boundaries that leave local scripts/tests guessing how shared helpers are consumed
|
|
377
|
+
|
|
378
|
+
If the review finds real issues, revise the merged plan and briefly update the review.
|
|
379
|
+
|
|
380
|
+
### 6. Only then start implementation
|
|
381
|
+
|
|
382
|
+
Do not begin coding before the merged phase plan has passed review.
|
|
383
|
+
Update `manifest.json` to show that phase implementation has started.
|
|
384
|
+
|
|
385
|
+
## Task breakdown & delegation
|
|
386
|
+
|
|
387
|
+
After the merged phase plan passes review and before implementation starts, break the phase
|
|
388
|
+
into parallel executable tasks and dispatch them to the right specialist subagents.
|
|
389
|
+
|
|
390
|
+
### Task decomposition
|
|
391
|
+
|
|
392
|
+
1. Read the merged phase plan and identify independent work slices.
|
|
393
|
+
2. Break each slice into a discrete task with explicit acceptance criteria, required files,
|
|
394
|
+
and expected verification.
|
|
395
|
+
3. Prefer parallel dispatch of non-overlapping tasks.
|
|
396
|
+
4. Treat task ordering as: parallel-independent work first, then dependent work that requires
|
|
397
|
+
a prior task's output.
|
|
398
|
+
|
|
399
|
+
### Delegation contract
|
|
400
|
+
|
|
401
|
+
Dispatch implementation tasks to dedicated specialist agents:
|
|
402
|
+
|
|
403
|
+
| Task type | Delegate to |
|
|
404
|
+
|---|---|
|
|
405
|
+
| Code changes, refactors, tests, bug fixes, feature work | `developer` |
|
|
406
|
+
| Build systems, CI, test runners, type-checking, linting | `quality` |
|
|
407
|
+
| README, plan docs, agent docs, migration notes | `docs` |
|
|
408
|
+
| Review-comment follow-up, PR fix commits | `fixer` |
|
|
409
|
+
|
|
410
|
+
For each delegated task:
|
|
411
|
+
- give the subagent one focused task with exact success criteria
|
|
412
|
+
- include only the minimum relevant files, plans, and repo context
|
|
413
|
+
- tell the subagent whether it should implement, verify, or review
|
|
414
|
+
- require the subagent to report blockers, verification results, and changed files
|
|
415
|
+
- avoid circular delegation and overlapping scopes
|
|
416
|
+
|
|
417
|
+
### Status monitoring
|
|
418
|
+
|
|
419
|
+
Track each dispatched task:
|
|
420
|
+
- at minimum record agent name, task summary, status (`queued`, `running`, `done`, `failed`),
|
|
421
|
+
and output artifacts
|
|
422
|
+
- when tasks are dispatched asynchronously, check status periodically
|
|
423
|
+
- if a subagent exits while the task is still non-terminal, resume or re-dispatch
|
|
424
|
+
|
|
425
|
+
### Consolidation
|
|
426
|
+
|
|
427
|
+
After all dispatched tasks complete:
|
|
428
|
+
1. Collect results and verification output from each task.
|
|
429
|
+
2. Review that each task's acceptance criteria are genuinely satisfied.
|
|
430
|
+
3. Resolve any coordination gaps or overlapping changes.
|
|
431
|
+
4. Proceed to the implementation loop for the phase once all tasks are green.
|
|
432
|
+
|
|
433
|
+
## Subagent summary logging
|
|
434
|
+
|
|
435
|
+
If subagents are used for planning, review, research, or implementation support:
|
|
436
|
+
|
|
437
|
+
Create one summary file per subagent run under:
|
|
438
|
+
- `tmp/phases/phase-x/subagents/`
|
|
439
|
+
|
|
440
|
+
Recommended naming:
|
|
441
|
+
- `001-planner.md`
|
|
442
|
+
- `002-reviewer-correctness.md`
|
|
443
|
+
- `003-reviewer-maintainability.md`
|
|
444
|
+
- `004-worker-followup.md`
|
|
445
|
+
|
|
446
|
+
Each summary must include a machine-readable header block using bullet-key format so
|
|
447
|
+
`conductor-monitor.mjs` can detect and parse local phase subagent state:
|
|
448
|
+
|
|
449
|
+
```
|
|
450
|
+
- agent name: <developer|quality|docs|review|refiner|fixer>
|
|
451
|
+
- status: <queued|running|completed|failed|paused>
|
|
452
|
+
- run id: <subagent-run-id>
|
|
453
|
+
- task: <one-line task summary>
|
|
454
|
+
- cwd: <working directory>
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
Only `agent name` and `status` are required for conductor-monitor detection; the
|
|
458
|
+
other fields improve resume-plan quality. The header block must start at the
|
|
459
|
+
beginning of a line (no leading whitespace before the bullet).
|
|
460
|
+
|
|
461
|
+
Below the header, include human-readable context:
|
|
462
|
+
- whether it was sync or async
|
|
463
|
+
- why it was used
|
|
464
|
+
- main findings or output
|
|
465
|
+
- files or artifacts it influenced
|
|
466
|
+
- whether its advice was accepted, partially accepted, or rejected
|
|
467
|
+
- raw output path if output was saved separately
|
|
468
|
+
|
|
469
|
+
If the subagent ran asynchronously, update its summary when results arrive so fresh sessions can understand what happened without replaying the whole conversation.
|
|
470
|
+
|
|
471
|
+
## Workflow-run subagent hand-off contract
|
|
472
|
+
|
|
473
|
+
When handing off a full workflow run to a subagent (draft PR → gates → Copilot → merge),
|
|
474
|
+
use the canonical hand-off contract. Do not rely on abbreviated task summaries or operator
|
|
475
|
+
memory.
|
|
476
|
+
|
|
477
|
+
The canonical contract is [Workflow Handoff Contract](../docs/workflow-handoff-contract.md) (source-tree path: `skills/docs/workflow-handoff-contract.md`). It includes:
|
|
478
|
+
- direct contract-doc references the subagent must read before executing
|
|
479
|
+
- a mandatory 8-step checklist (draft PR → draft_gate → ready → Copilot → resolve → pre_approval_gate → merge)
|
|
480
|
+
- non-negotiable invariants (Copilot review loop between gates, `unresolvedThreadCount === 0`, visible gate comments)
|
|
481
|
+
|
|
482
|
+
For all GitHub-first routed follow-up (`copilot_pr_followup`, `issue_intake`), the
|
|
483
|
+
`local-implementation` skill uses this template when delegating the full run to a subagent.
|
|
484
|
+
Reference it by path, not by memory.
|
|
485
|
+
|
|
486
|
+
## Implementation loop for the phase
|
|
487
|
+
|
|
488
|
+
After the phase plan passes review:
|
|
489
|
+
|
|
490
|
+
1. Write or update tests first.
|
|
491
|
+
2. Implement only enough code for the current phase.
|
|
492
|
+
3. Run local validation:
|
|
493
|
+
- `npm run verify`
|
|
494
|
+
- when a narrower local check is more honest for the touched slice, say so explicitly and run the narrowest justified subset instead of pretending the full verify path was unnecessary
|
|
495
|
+
- for user-facing HTML/UI/component slices when the user opts in, add a bounded deterministic browser smoke harness (prefer fixture-backed Playwright WebKit plus screenshot capture); use `npm run test:playwright:viewer` when that viewer/browser surface is part of the slice, and wire it into CI once it becomes required validation for that slice
|
|
496
|
+
- **Commit immediately after validation passes.** Once `npm run verify` (or the narrowest justified validation subset) is green, stage and commit the current slice of work with an atomic commit message. For tracker-backed sessions, also push the commit. In non-interactive subagent sessions, commit authorization is implicit — the subagent was dispatched to implement and must commit before exiting. In interactive sessions, wait for coordination agent authorization. Do not defer commits — uncommitted changes when the session terminates are a workflow defect.
|
|
497
|
+
4. Review the implementation against the merged phase plan.
|
|
498
|
+
5. Run the default pre-approval gate as a full review / fix loop on the branch before calling it review-complete, approval-ready, merge-ready, or ready for final handoff:
|
|
499
|
+
- resolve review angles from config: `resolveGateAngles(config, "preApproval")` from `@dev-loops/core/config` (shipped defaults enable all 11 pre-approval gate angle families; consumer repos may opt out individual angles via `excludeAngles`); run via the chain prescription below
|
|
500
|
+
- run the resolved angle-focused passes in parallel with fresh context when practical
|
|
501
|
+
- if parallel execution is impractical (for example due to tooling or resource constraints), run all angles sequentially and explicitly record why parallel execution was impractical in `Phase Review` (`tmp/phases/phase-x/review.md`) (or the equivalent merged review artifact)
|
|
502
|
+
- for each angle, resolve its persona and prompt via `resolveReviewerRole(config, angle)` — start each reviewer in fresh context with a concise briefing including the angle-specific prompt, the branch/phase, intended behavior, acceptance criteria, relevant files or artifacts, and current validation status
|
|
503
|
+
- run the mandatory chain defined in [Gate Review Sub-Loop Contract](../../docs/gate-review-sub-loop-contract.md). Retry rule: in subsequent cycles, only re-run reviewers that produced findings in the previous pass. Do not fork the parent session for parallel reviewers; write a compact handoff artifact under `tmp/` and point the reviewer at it.
|
|
504
|
+
- when reviewer subagents stumble on raw source-tree reads (for example unresolved build artifacts or import assumptions), generate a deterministic diff/review artifact under `tmp/` and have reviewers inspect that artifact instead of the raw file set
|
|
505
|
+
- synthesize actionable findings
|
|
506
|
+
- apply accepted fixes on the same branch
|
|
507
|
+
- rerun validation after fixes
|
|
508
|
+
- log review artifacts and subagent summaries under `tmp/`
|
|
509
|
+
6. Update [Phase Plan](../../docs/phases/phase-x.md) so it reflects the phase as actually implemented, including any accepted scope or validation changes.
|
|
510
|
+
7. Update [Project Plan](../../PLAN.md) when the phase changed durable product truth, resolved an open question, or made the shipped command/behavior surface more concrete.
|
|
511
|
+
8. Write `Phase Summary` (`tmp/phases/phase-x/summary.md`) using [Phase Summary Template](../dev-loop/templates/phase-summary.md).
|
|
512
|
+
9. Write `Retrospective` (`tmp/phases/phase-x/retrospective.md`) using [Retrospective Template](../dev-loop/templates/retrospective.md).
|
|
513
|
+
10. Update `tmp/phases/phase-x/manifest.json` and `tmp/phases/index.json`.
|
|
514
|
+
11. Update [Implementation State](../../docs/IMPLEMENTATION_STATE.md).
|
|
515
|
+
12. **Exit validation gate — no uncommitted changes.** Before the subagent session terminates, run `git status --porcelain` and verify the output is empty. If uncommitted changes exist, first determine whether they are intended implementation changes or unintended/post-validation deltas. Revert any unintended or speculative changes. For intended changes, rerun the narrowest justified validation (`npm run verify` or equivalent) before staging and committing with an appropriate message; for tracker-backed sessions, also push the branch. A subagent session that exits with uncommitted changes in the worktree is a workflow defect and must not be treated as a clean completion. After committing, verify `git status --porcelain` is empty before declaring phase completion.
|
|
516
|
+
13. For tracker-backed sessions, create a draft PR from the working branch using `dev-loops pr create-draft --assignee @me --repo <owner/name> --base main --head <branch> --title "..." --body-file <body-file>`. When the `dev-loops` CLI helper is unavailable, use the equivalent `create-draft-pr.mjs` script directly: `node <resolved-skill-scripts>/github/create-draft-pr.mjs --repo <owner/name> --assignee @me --base main --head <branch> --title "..." --body-file <body-file>`. The PR body must contain `Closes #N` (or `Fixes #N`) for the linked issue. Do not create a fresh PR directly in ready-for-review state unless the user explicitly overrides that policy.
|
|
517
|
+
14. If authorized, merge the fully reviewed, locally validated phase branch back into local `main` (phase-doc-backed sessions) or proceed through the PR gate pipeline (tracker-backed sessions).
|
|
518
|
+
15. If authorization for PR creation or merge is still pending (commit authorization is already enforced by the exit validation gate in step 12), mark the phase as `awaiting-finalization` rather than `completed`, and record exactly which finalization step is pending.
|
|
519
|
+
|
|
520
|
+
## Retrospective requirements
|
|
521
|
+
|
|
522
|
+
The retrospective must capture:
|
|
523
|
+
- what worked well in the local dev loop
|
|
524
|
+
- what caused friction or waste
|
|
525
|
+
- whether the fan-out/fan-in/review loop improved the phase
|
|
526
|
+
- what should change in the skill or workflow next time
|
|
527
|
+
- what a fresh session should know before the next phase
|
|
528
|
+
|
|
529
|
+
This is the infrastructure for self-improvement. Do not skip it.
|
|
530
|
+
|
|
531
|
+
## Dev mode
|
|
532
|
+
|
|
533
|
+
Dev mode is for improving the local implementation loop itself while using it.
|
|
534
|
+
|
|
535
|
+
A repository may also declare a formal-dev-mode default through `.devloops` field `workflow.devModeDefault`. Treat that config as the policy source of truth when present, but explicit user opt-in or opt-out for the current run still wins. Runtime consumption of that config may be staged separately from this documentation update.
|
|
536
|
+
|
|
537
|
+
Trigger it when the user explicitly asks for dev mode, self-improvement mode, or says they want the skill to refine itself as it goes.
|
|
538
|
+
|
|
539
|
+
In dev mode, after the normal phase summary and retrospective are written, run one extra bounded self-improvement pass before moving on:
|
|
540
|
+
|
|
541
|
+
1. collect a deterministic context bundle for the phase using:
|
|
542
|
+
- `../dev-loop/scripts/dev-mode-context.mjs`
|
|
543
|
+
- output to `tmp/phases/phase-x/dev-mode-context.json`
|
|
544
|
+
2. review the phase artifacts and logs with emphasis on the workflow itself:
|
|
545
|
+
- planning quality
|
|
546
|
+
- review quality
|
|
547
|
+
- validation friction
|
|
548
|
+
- bash exit-code-1 patterns
|
|
549
|
+
- places where skill or agent prompts should be tightened
|
|
550
|
+
- places where deterministic tooling should replace ad hoc work
|
|
551
|
+
3. write `Dev Mode Retrospective` (`tmp/phases/phase-x/dev-mode-retrospective.md`)
|
|
552
|
+
- this is the required dev-mode retrospective artifact
|
|
553
|
+
- it should name the highest-value prompt/workflow follow-ups revealed by the phase
|
|
554
|
+
4. optionally write `Dev Mode Review` (`tmp/phases/phase-x/dev-mode-review.md`) when separate analytical notes help support the retrospective
|
|
555
|
+
5. apply at least one bounded follow-up update to a relevant skill and/or agent prompt
|
|
556
|
+
- deterministic tooling, docs, templates, or tests may accompany that change
|
|
557
|
+
- but they do not replace the required prompt update
|
|
558
|
+
- keep the change phase-bounded and tied directly to the retrospective findings
|
|
559
|
+
6. write `Dev Mode Skill Changes` (`tmp/phases/phase-x/dev-mode-skill-changes.md`)
|
|
560
|
+
- record which skill and/or agent prompts changed
|
|
561
|
+
- record any supporting tooling/docs/template changes that accompanied them
|
|
562
|
+
- if no prompt update can be justified safely, stop and report that dev-mode exit criteria were not met
|
|
563
|
+
7. if skill scripts or deterministic tooling changed, rerun the skill-local tests
|
|
564
|
+
8. stop after this bounded self-improvement pass; do not recurse into endless self-editing loops
|
|
565
|
+
|
|
566
|
+
Dev mode is still phase-bounded. It improves the loop around the completed phase; it does not authorize work on the next product phase.
|
|
567
|
+
|
|
568
|
+
## tmp/ logging requirements
|
|
569
|
+
|
|
570
|
+
At minimum, each phase should leave behind:
|
|
571
|
+
- a durable phase doc at [Phase Plan](../../docs/phases/phase-x.md)
|
|
572
|
+
- local `tmp/` execution artifacts needed to resume and audit the phase, including:
|
|
573
|
+
- `manifest.json`
|
|
574
|
+
- `Variant A` (`tmp/phases/phase-x/variant-a.md`)
|
|
575
|
+
- `Variant B` (`tmp/phases/phase-x/variant-b.md`)
|
|
576
|
+
- `merged-plan.md`
|
|
577
|
+
- `review.md`
|
|
578
|
+
- `summary.md`
|
|
579
|
+
- `retrospective.md`
|
|
580
|
+
- optional `Variant C` (`tmp/phases/phase-x/variant-c.md`) when a third variant was actually useful
|
|
581
|
+
- `bash-exit-1.jsonl` when any bash call during the phase exited with code `1`
|
|
582
|
+
- `clarification.md` when a plan-sufficiency interview or auto-clarification step was needed
|
|
583
|
+
- subagent summaries when subagents were used
|
|
584
|
+
- raw subagent outputs only when they were saved separately on purpose
|
|
585
|
+
- in dev mode: `dev-mode-context.json`, `dev-mode-retrospective.md`, and `dev-mode-skill-changes.md`
|
|
586
|
+
- optional in dev mode: `dev-mode-review.md` when separate analytical notes were useful
|
|
587
|
+
|
|
588
|
+
These `tmp/` artifacts are normally temporary and do not need to be checked into git.
|
|
589
|
+
|
|
590
|
+
Also log validation output summaries and notable decisions if they help evaluate the local dev loop later.
|
|
591
|
+
|
|
592
|
+
Additionally, append every bash call that exits with code `1` to:
|
|
593
|
+
- `tmp/phases/phase-x/bash-exit-1.jsonl`
|
|
594
|
+
|
|
595
|
+
Use the deterministic helper:
|
|
596
|
+
- `../dev-loop/scripts/log-bash-exit-1.mjs`
|
|
597
|
+
|
|
598
|
+
Each line should be one JSON object with at least:
|
|
599
|
+
- `timestamp`
|
|
600
|
+
- `phase`
|
|
601
|
+
- `cwd`
|
|
602
|
+
- `command`
|
|
603
|
+
- `exitCode`
|
|
604
|
+
- `purpose`
|
|
605
|
+
- `summary`
|
|
606
|
+
|
|
607
|
+
If useful, also include truncated `stdout` and `stderr` fields or a path to a larger saved artifact. This log is for improving the local dev loop itself, so do not skip it just because the command was exploratory.
|
|
608
|
+
|
|
609
|
+
## Stop conditions
|
|
610
|
+
|
|
611
|
+
See [Stop Conditions](../docs/stop-conditions.md). Local-specific stops: phase completed & finalized, next-phase refinement needed, user/main-agent approval required, validation failure needing direction change.
|
|
612
|
+
|
|
613
|
+
## Branch / review / merge policy
|
|
614
|
+
|
|
615
|
+
- Do not implement directly on `main`.
|
|
616
|
+
- Start or switch to a dedicated local working branch before the first mutating step.
|
|
617
|
+
- If the repository is unborn (no commits yet), still create the working branch first and make the initial atomic commits there.
|
|
618
|
+
- Use atomic local commits to log progress, but only for coherent reviewable slices.
|
|
619
|
+
- Before merging, run a full parallel review / fix loop and resolve accepted findings on the same branch.
|
|
620
|
+
- Rerun validation after review-driven fixes.
|
|
621
|
+
- A phase is not operationally closed until its branch state is captured in commit history and the reviewed branch has been finalized according to session type (merged into local `main` for phase-doc-backed sessions; merged via GitHub PR for tracker-backed sessions), unless authorization for that finalization is still pending.
|
|
622
|
+
- For tracker-backed sessions, the handoff path is always: push the working branch → open a PR → merge via GitHub; never merge the working branch into local `main`.
|
|
623
|
+
- PR creation must always include `--assignee @me` so the new PR is self-assigned, and the PR body must contain `Closes #N` (or `Fixes #N`) for the linked issue so GitHub auto-closes it on merge. When `.devloops` sets `workflow.requireDraftFirst` to true, use `dev-loops pr create-draft --assignee @me ...`. Do not create a fresh PR directly in ready-for-review state unless the user explicitly overrides that policy for the current PR scope. The draft gate inspection is a real workflow boundary, so a new PR must exist in draft before `gh pr ready` is eligible.
|
|
624
|
+
- When authorization is pending, record the phase as `awaiting-finalization` and describe the exact missing step.
|
|
625
|
+
- For phase-doc-backed sessions, merge the fully reviewed, locally validated branch back into local `main` when authorized.
|
|
626
|
+
|
|
627
|
+
## Commit policy
|
|
628
|
+
|
|
629
|
+
- Do not commit speculative work.
|
|
630
|
+
- Do not commit before the relevant validation for that slice passes.
|
|
631
|
+
- Immediately before every `git add && git commit` sequence, assert branch identity with `git branch --show-current` and stop if it does not match the intended local working branch.
|
|
632
|
+
- Keep commits small and phase-bounded.
|
|
633
|
+
- Do not leave completed phase work stranded off `main`; once the reviewed branch is ready and authorized, finalize it according to session type (merge into local `main` for phase-doc-backed sessions; complete via PR merge for tracker-backed sessions).
|
|
634
|
+
- Commit only when the coordination/main agent has decided the slice or phase is ready. **Exception:** in non-interactive subagent sessions, commit authorization is implicit — the subagent was dispatched to implement and must commit before exiting (see the commit sub-bullet under implementation loop step 3 and the exit validation gate in step 12).
|
|
635
|
+
- If commit/merge authorization has not yet been given, do not call the phase `completed`; call it `awaiting-finalization` instead.
|
|
636
|
+
- **Subagent exit contract:** before a subagent session terminates, the exit validation gate (implementation loop step 12) must pass — `git status --porcelain` must be empty. A subagent that exits with uncommitted changes in the worktree has not completed its task, regardless of what was implemented.
|
|
637
|
+
|
|
638
|
+
## Anti-patterns
|
|
639
|
+
|
|
640
|
+
See [Anti-patterns](../docs/anti-patterns.md). Local-specific: don't assume optional plan docs exist, don't guess through missing plan details, don't skip fan-out/fan-in, don't skip `tmp/` artifacts, don't use subagents without readable summaries.
|