nitm-ai-dev-toolkit 5.2.1 → 5.3.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.
- package/CHANGELOG.md +17 -1
- package/README.md +24 -0
- package/bin/cli.js +1 -1
- package/package.json +1 -1
- package/src/monorepo/.agents/skills/dispatching-parallel-agents/SKILL.md +1 -1
- package/src/monorepo/.agents/skills/factory/SKILL.md +74 -34
- package/src/monorepo/.agents/skills/factory/roles/approve.md +6 -3
- package/src/monorepo/.agents/skills/factory/roles/build.md +36 -8
- package/src/monorepo/.agents/skills/factory/roles/review-code.md +5 -2
- package/src/monorepo/.agents/skills/factory/roles/review-security.md +1 -1
- package/src/monorepo/.agents/skills/factory/roles/review-ui.md +1 -1
- package/src/monorepo/.agents/skills/factory/roles/review-ux.md +1 -1
- package/src/monorepo/.agents/skills/factory/roles/spec.md +3 -1
- package/src/monorepo/.claude/prompt-snippets/implement-feature.md +2 -1
- package/src/monorepo/.claude/prompt-snippets/implement-fixes.md +1 -1
- package/src/monorepo/.claude/prompt-snippets/implement.md +70 -11
- package/src/monorepo/.claude/prompt-snippets/plan.md +2 -2
- package/src/monorepo/.claude/prompt-snippets/specify.md +9 -2
- package/src/monorepo/.claude/rules-snippets/fit-review.md +62 -0
- package/src/monorepo/.claude/rules-snippets/subagent-workflow.md +59 -28
- package/src/monorepo/AGENTS.md +8 -5
- package/src/monorepo/factory/README.md +14 -6
- package/src/repo/.agents/skills/dispatching-parallel-agents/SKILL.md +1 -1
- package/src/repo/.agents/skills/factory/SKILL.md +74 -34
- package/src/repo/.agents/skills/factory/roles/approve.md +6 -3
- package/src/repo/.agents/skills/factory/roles/build.md +36 -8
- package/src/repo/.agents/skills/factory/roles/review-code.md +5 -2
- package/src/repo/.agents/skills/factory/roles/review-security.md +1 -1
- package/src/repo/.agents/skills/factory/roles/review-ui.md +1 -1
- package/src/repo/.agents/skills/factory/roles/review-ux.md +1 -1
- package/src/repo/.agents/skills/factory/roles/spec.md +3 -1
- package/src/repo/.claude/prompt-snippets/implement-feature.md +2 -1
- package/src/repo/.claude/prompt-snippets/implement-fixes.md +1 -1
- package/src/repo/.claude/prompt-snippets/implement.md +70 -11
- package/src/repo/.claude/prompt-snippets/plan.md +2 -2
- package/src/repo/.claude/prompt-snippets/specify.md +9 -2
- package/src/repo/.claude/rules-snippets/fit-review.md +62 -0
- package/src/repo/.claude/rules-snippets/subagent-workflow.md +59 -28
- package/src/repo/AGENTS.md +12 -5
- package/src/repo/factory/README.md +14 -6
|
@@ -14,7 +14,7 @@ You look at a job's feature running in the build location and review the user ex
|
|
|
14
14
|
- `spec.md` in the feature folder (paths block), for the acceptance criteria and user flows.
|
|
15
15
|
- `build.md` for what the builder says it changed.
|
|
16
16
|
- The project's `AGENTS.md` for the dev command and how to pass the port.
|
|
17
|
-
- `qa.md` at the paths block's `qa.md (absolute, build location)` line, if it exists: the builder's
|
|
17
|
+
- `qa.md` at the paths block's `qa.md (absolute, build location)` line, if it exists: the builder's functional QA record and manual checks. Use it for context only. The QA gate belongs to the code lens and the approver, so it never changes your verdict.
|
|
18
18
|
- Round `N > 1`: your own previous review, `round-<N-1>/review-ux.md`.
|
|
19
19
|
|
|
20
20
|
## Method
|
|
@@ -6,7 +6,7 @@ You turn a feature request into a testable spec, and then into a plan. You are o
|
|
|
6
6
|
|
|
7
7
|
Read these, in this order:
|
|
8
8
|
|
|
9
|
-
1. The feature request in your prompt.
|
|
9
|
+
1. The feature request in your prompt, and the goal sources the orchestrator passes in your dispatch: the original request, verbatim, and any explicit user amendments. The original request is the primary goal source. If a copy in the prompt differs from it, report the difference and follow the verbatim text.
|
|
10
10
|
2. The project's `AGENTS.md` (conventions and commands).
|
|
11
11
|
3. The existing code the feature touches. Inspect it. Do not write a spec or plan from the request alone.
|
|
12
12
|
4. The `AGENTS.md` of each affected app or package, for its patterns and commands.
|
|
@@ -115,5 +115,7 @@ On a re-plan, keep each existing task line that still applies, with its T-number
|
|
|
115
115
|
- A change note with `spec-<k>.md` or `plan-<k>.md` is the operator's request. Apply it, and keep everything else the operator already accepted.
|
|
116
116
|
- When a change note answers a `[PRODUCT DECISION]` item, rewrite that item to start with `[DECIDED]` and the operator's answer, for example `[DECIDED] Free tier: 3 seats.`. Items the note does not answer stay `[PRODUCT DECISION]`. Never mark an item decided yourself.
|
|
117
117
|
- Name every affected app and package in the plan's Steps and in the spec's Affected Code (`apps/<app>/...` or `packages/<pkg>/...`). If a shared package changes, list its downstream consumers too, so the build and reviews test them.
|
|
118
|
+
- Goal-fit findings passed in your dispatch are reviewer findings. They are not operator requests and not goal authority. Fix only the listed findings, in their sections, and write nothing else. Do not drop or narrow a goal to satisfy a finding. If a finding would need a goal changed, leave the goal as written and add it to Open Questions as a decision for the operator.
|
|
119
|
+
- In plan mode, trace each step to an acceptance criterion, a requirement, or the request. A step no goal needs is out of scope. Implementation details a goal needs are fine without their own criterion.
|
|
118
120
|
- Keep `spec.md` and `plan.md` free of tooling chatter. They are feature docs that merge with the code.
|
|
119
121
|
- Do not modify code, tests, `build.md`, `job.json`, `qa.md`, or any file outside the feature folder. Your writes are `spec.md` (spec mode), or `plan.md` and `tasks.md` (plan mode), in the feature folder only.
|
|
@@ -30,6 +30,7 @@ Implement a feature by completing tasks sequentially with proper tracking.
|
|
|
30
30
|
- Group tasks by domain (backend, frontend, docs, tests)
|
|
31
31
|
- Tasks that touch **different files with no shared state** → run their loops in parallel
|
|
32
32
|
- Tasks with dependencies or shared files → keep sequential
|
|
33
|
+
- Tasks with an unknown or undeclared write set → keep sequential until the scope is established
|
|
33
34
|
- Use `dispatching-parallel-agents` skill when 3+ independent tasks exist
|
|
34
35
|
|
|
35
36
|
3. **Create Feature Branch** (before any build):
|
|
@@ -77,7 +78,7 @@ Implement a feature by completing tasks sequentially with proper tracking.
|
|
|
77
78
|
|
|
78
79
|
6. **Create Pull Request** (only after the feature review is accepted):
|
|
79
80
|
|
|
80
|
-
a. **Final Validation**: the
|
|
81
|
+
a. **Final Validation**: after all tasks are reconciled, run the project's full required regression checks once on the final integrated tree (implement.md step 3): the repo-defined full suite, lint, typecheck, and build, where they exist. Every required check must pass on this tree. Any edit after this run requires revalidation.
|
|
81
82
|
|
|
82
83
|
b. **Commit and push**: if accepted feature-review changes are still uncommitted, commit them once, staging only the feature's paths, and skip the commit when nothing is staged. Do not create repair-only commits.
|
|
83
84
|
|
|
@@ -49,7 +49,7 @@ Implement bug fixes and corrections with proper validation and documentation.
|
|
|
49
49
|
4. **Verify, Review and Decide** (repeat implement.md steps 3, 4 and 5 until an exit):
|
|
50
50
|
- Verify: rerun the reproducing test and confirm it passes now, run every check that covers an AC, and run the full test suite for regressions.
|
|
51
51
|
- Review: the independent read-only reviewer checks the fix, the reproducing test, and the untracked files.
|
|
52
|
-
- Decide: repair goes back to the same builder. Repeat until `ACCEPTED`, `BLOCKED`, or `NOT ACCEPTED: needs decision
|
|
52
|
+
- Decide: repair goes back to the same builder. Repeat until `ACCEPTED`, `BLOCKED`, or `NOT ACCEPTED: needs decision` (which includes a pending human QA check, reason `awaiting human QA`). There is no round limit. A review PASS alone never accepts.
|
|
53
53
|
|
|
54
54
|
5. **Commit and Push** (only after `ACCEPTED`, and only when there are accepted changes): stage only the fix's paths, never `git add -A` or a foreign change. Skip the commit when nothing is staged.
|
|
55
55
|
```bash
|
|
@@ -8,6 +8,7 @@ You are the orchestrator for this implementation. You derive the acceptance crit
|
|
|
8
8
|
> with this loop. Do not route through a planning skill, and do not write a spec or plan first.
|
|
9
9
|
> For 3+ independent `[P]` tasks that touch disjoint files, the loops may run concurrently with the
|
|
10
10
|
> `dispatching-parallel-agents` skill. Each task still runs its own loop.
|
|
11
|
+
> Nontrivial ad-hoc code changes outside these commands follow the same loop. Context-heavy nontrivial work may be built directly, but acceptance still needs an independent reviewer; without one it is BLOCKED. Trivial changes (typos, one-line edits) stay outside this loop.
|
|
11
12
|
|
|
12
13
|
## Roles
|
|
13
14
|
|
|
@@ -31,12 +32,13 @@ build → verify → review → decide ─┬─ accept (review PASS, every re
|
|
|
31
32
|
|
|
32
33
|
### 1. Task, checks and baseline (orchestrator)
|
|
33
34
|
|
|
34
|
-
- The original supplied task (request, task list entry, or fix description) is the requirement. Keep its text and give it to the builder and the reviewer unchanged. Do not require a new spec or plan first, and do not write one.
|
|
35
|
+
- The original supplied task (request, task list entry, or fix description) is the requirement. Keep its text and give it to the builder and the reviewer unchanged. Explicit user amendments and answers given during the loop are part of the requirement too: record each one as a dated entry beside the original text (do not rewrite it), and give the builder and the reviewer the original text plus every amendment. Do not require a new spec or plan first, and do not write one.
|
|
35
36
|
- Turn every requirement in the supplied task into an acceptance criterion, `AC-1`, `AC-2`, ... There is no fixed count: one criterion per requirement, however many there are. Do not add requirements the task does not state.
|
|
36
37
|
- Each AC names its check. Discover the real checks; do not assume them. Read the project's manifests (for example `package.json` scripts, `Makefile`, `pyproject.toml`, `Cargo.toml`, `go.mod`), its CI configuration (for example `.github/workflows`), its README, and `AGENTS.md`. Use the commands the project actually runs.
|
|
37
38
|
- A documentation criterion may be checked by direct inspection: open the file and confirm the content, and quote what you found as evidence.
|
|
38
|
-
-
|
|
39
|
-
-
|
|
39
|
+
- Each AC also gets its functional QA checks: every feasible automated check, plus a human check only where a person must judge it. Write the QA plan before the build: the exact command or fixture, and the expected result. See [Functional QA](#functional-qa).
|
|
40
|
+
- A required check that cannot be discovered, or cannot be run, is a gap. It is not a pass, and it is not a bypass. It blocks acceptance of the affected task and of any aggregate run that needs it. Ask the user for the command as one targeted question and keep that question in the progress report. Independent tasks whose checks do not depend on the gap continue (see the Blocked exit in step 5).
|
|
41
|
+
- Ask only when a requirement is unclear in a way that changes what gets built: two readings lead to different code, or a needed fact is missing. Ask one targeted question with its options. A task-scoped question blocks only that task and its dependents: independent tasks with clear requirements continue, and the question stays in the progress report (see [subagent-workflow.md](../rules-snippets/subagent-workflow.md), Autonomous Execution and Blockers). If the whole request is unclear, stop and ask before any build.
|
|
40
42
|
- Take a baseline snapshot once, before any build. It is a plain copy of the state the task starts from, kept in a temporary directory outside the repository:
|
|
41
43
|
- `git rev-parse HEAD`: the base commit.
|
|
42
44
|
- `git status --porcelain > <tmp>/baseline/status.txt`: which files were already changed, staged or untracked.
|
|
@@ -51,6 +53,7 @@ build → verify → review → decide ─┬─ accept (review PASS, every re
|
|
|
51
53
|
- For a bug, first write a failing test that reproduces it, and watch it fail for the right reason. Then make the minimal change that passes it. For a feature, follow TDD: failing test, minimal code, then refactor. Keep the diff as small as the task allows.
|
|
52
54
|
- Leave all its changes uncommitted and unstaged, including new files, so the review sees them. Do not commit.
|
|
53
55
|
- Report each AC as `pass` with the command and result, or `not verified` with the reason. List every changed and new file.
|
|
56
|
+
- Report each automated QA check with its exact command, expected result, and observed result. Write a failing test for a necessary automated check that does not exist yet, and report it when it cannot be written.
|
|
54
57
|
- Report `BLOCKED` with the decision the human must make if the task cannot be built as written.
|
|
55
58
|
|
|
56
59
|
**Later rounds (repair):** dispatch the same builder again with only the open items: every blocking review item, every AC that is not `pass`, and every check that failed or did not run. It must fix each item, or say in its report why it should stand. It must not expand scope.
|
|
@@ -59,6 +62,10 @@ build → verify → review → decide ─┬─ accept (review PASS, every re
|
|
|
59
62
|
|
|
60
63
|
Every round, run every check that covers an AC, using the commands from step 1. Treat the builder's report as a lead, not as evidence. For each AC, record `pass` with the command and result from this round, or `not verified` or `fail` with the reason. Docs criteria are recorded with the quoted content.
|
|
61
64
|
|
|
65
|
+
Also run the automated QA checks for every AC on the current tree, including each `covered` test the AC cites. Record each result as described in [Functional QA](#functional-qa). Human checks go to the handoff; do not run them yourself.
|
|
66
|
+
|
|
67
|
+
Checks are scoped: each repair and each task runs the checks for its own ACs. After all writers are reconciled, run the project's full required regression checks once: the repo-defined full suite, lint, typecheck, and build, where they exist. Use only commands the project defines; do not invent them. A failed required check is a repair. A required check that does not exist or cannot run is BLOCKED (see step 5).
|
|
68
|
+
|
|
62
69
|
### 4. Review (reviewer, read-only)
|
|
63
70
|
|
|
64
71
|
Every round, after verify, dispatch the reviewer on the current working tree. Give it the original supplied task text, the AC list, this round's check results, the base commit, and the baseline snapshot. Its review scope covers the whole task, and it compares content, not patches:
|
|
@@ -74,34 +81,86 @@ The reviewer's rules:
|
|
|
74
81
|
- The first line of the reply is exactly `VERDICT: PASS` or `VERDICT: CHANGES`.
|
|
75
82
|
- `VERDICT: CHANGES` needs at least one blocking item, each with `file:line`, the problem, and the specific fix. Blocking means a correctness issue, a failing check, a requirement with no test or evidence, or a clear convention break. Taste goes in non-blocking notes.
|
|
76
83
|
- Check each requirement of the original task, not only the diff. A requirement with no coverage is a blocking item.
|
|
84
|
+
- QA evidence and labels: check the functional QA rows against [Functional QA](#functional-qa). An automated check with no `pass` from this round's tree, a necessary automated check that is missing, a `covered` check with no cited test, or an `na` with no reason is a blocking item. A human check a person must judge is not a reviewer blocking item.
|
|
85
|
+
- Scope drift, both ways: trace the diff against the original supplied task. A change that no requirement needs is a blocking item unless the reviewer confirms it is a necessary implementation detail for a stated goal and says why. Goals are the original supplied task plus the user amendments recorded in step 1: do not require or assume a spec or plan (supplied-task exception). Simplicity and SRP notes stay non-blocking unless they add scope the task does not ask for.
|
|
77
86
|
|
|
78
87
|
### 5. Decide (orchestrator)
|
|
79
88
|
|
|
80
89
|
Pick one outcome per round:
|
|
81
90
|
|
|
82
|
-
- **Repair (back to step 2):** the review is `VERDICT: CHANGES`, **or** any AC is `not verified` or `fail`, **or** a required check failed or did not run. Send the open items to the builder, then run steps 3, 4 and 5 again on the current tree.
|
|
83
|
-
- **Accept (exit):** all of these hold on this round's verify and review: the review is `VERDICT: PASS`; every requirement has an AC marked `pass` with evidence from this round; every required check ran and passed; an independent reviewer produced the verdict;
|
|
84
|
-
- **Blocked (exit):** the builder reports `BLOCKED`,
|
|
85
|
-
- **Needs user decision (exit):** the task is unclear in a way only the user can settle. Stop, report `NOT ACCEPTED: needs decision` with the question. This is not acceptance.
|
|
91
|
+
- **Repair (back to step 2):** the review is `VERDICT: CHANGES`, **or** any AC is `not verified` or `fail`, **or** a required check failed or did not run, **or** an automated QA check failed, or a necessary automated test is missing and can be written. Send the open items to the builder, then run steps 3, 4 and 5 again on the current tree.
|
|
92
|
+
- **Accept (exit):** all of these hold on this round's verify and review: the review is `VERDICT: PASS`; every requirement has an AC marked `pass` with evidence from this round; every required check ran and passed; every automated QA check passed on this round's tree; an independent reviewer produced the verdict; the builder did not report `BLOCKED`; and every human check has a `PASS` result and an explicit `accept` from the user for the tree it tested. Then report `ACCEPTED` with the AC evidence. A review PASS alone never accepts, and a pending human check is never treated as accepted.
|
|
93
|
+
- **Blocked (exit for the affected work):** the builder reports `BLOCKED`, a required check cannot be discovered, a necessary QA test cannot be written, or no independent reviewer is available. Report `BLOCKED` with the blocker and what would unblock it. Never mark blocked work accepted. Work that depends on it stops; independent authorized work with its own checks and reviewer continues. Without an independent reviewer nothing is accepted, but discovery and builds that do not need acceptance may continue and be reported as awaiting review. Stop the run only when no authorized work remains or a mandatory approval, security, or permission gate applies.
|
|
94
|
+
- **Needs user decision (exit for the affected work):** the task is unclear in a way only the user can settle, a check needs a credential, data, or environment only the user can provide, or a human check waits for the user's answer. Stop work on that task and its dependents, report `NOT ACCEPTED: needs decision` with the question, and continue independent authorized work. For a pending human check, the reason is `awaiting human QA`, and the report carries the exact handoff from [Functional QA](#functional-qa). This is not acceptance.
|
|
95
|
+
|
|
96
|
+
No other exit exists. An unmet requirement or a failing check loops back to repair. A `not verified` result loops back to repair only when the missing piece is code or test work the builder can do. A `not verified` result that waits on evidence only the user or the environment can supply, or on a pending human answer, is the needs-decision exit. There is no round limit to escape the loop.
|
|
86
97
|
|
|
87
|
-
|
|
98
|
+
**Evidence freshness.** Acceptance uses evidence from the tree it accepts. Any edit after a verify or review, whether by the builder, a repair, or the orchestrator, invalidates the evidence it affects: rerun the checks covering those ACs and re-review the changed diff. Reuse evidence that the edit cannot affect. If unsure whether an edit affects a check, treat it as affected. Do not rerun everything for an unrelated edit.
|
|
88
99
|
|
|
89
100
|
### Commit (only when the calling flow asks)
|
|
90
101
|
|
|
91
|
-
The loop never commits by itself. Accepting reports the result; it does not create a commit. The calling command decides whether accepted work is committed, and only when its own flow says so and the user has not asked otherwise. When it does commit:
|
|
102
|
+
The loop never commits by itself. Accepting reports the result; it does not create a commit. The calling command decides whether accepted work is committed, and only when its own flow says so and the user has not asked otherwise. Pending human QA does not change that policy. It blocks acceptance, completion, and merge of the affected work. It neither grants nor removes a commit or push that the calling flow or an explicit checkpoint authorizes. When it does commit:
|
|
92
103
|
|
|
93
104
|
- Stage only the paths this task changed, taken from the builder's list and checked against the baseline. Never `git add -A`, and never stage a preexisting or foreign change.
|
|
94
105
|
- Skip the commit when nothing is staged. Do not create empty commits, and do not create a separate commit for each repair round.
|
|
95
106
|
|
|
96
107
|
### Limits
|
|
97
108
|
|
|
98
|
-
- **No independent reviewer means
|
|
109
|
+
- **No independent reviewer means nothing is accepted.** The orchestrator may run its own verify and report the evidence, but it cannot accept the work on its own review. Report `BLOCKED` for acceptance. Do not treat all work as blocked when independent discovery or build can proceed (see the Blocked exit in step 5).
|
|
110
|
+
- Mandatory approval, security, and permission gates are never bypassed. They apply to the affected work, or to the whole run when the gate is global.
|
|
99
111
|
- A self-review is never presented as an independent review.
|
|
112
|
+
- These gates are prompt instructions, not host enforcement. Resuming after a pause depends on the host; this prompt does not guarantee automatic resume.
|
|
113
|
+
|
|
114
|
+
## Functional QA
|
|
115
|
+
|
|
116
|
+
Acceptance needs evidence that the changed behavior works. A process that starts, a page that loads, or a passing build is not evidence.
|
|
117
|
+
|
|
118
|
+
**Checks per AC.** Every AC gets every feasible automated check. A human check never replaces one.
|
|
119
|
+
|
|
120
|
+
- `local`: the changed behavior is observable (UI, API, CLI, or library). Run it locally with the project's documented commands and fixtures. Cover the happy path, the error path that matters, and a regression check for what the change could break, in proportion to the risk.
|
|
121
|
+
- `covered`: existing automated E2E or functional tests already exercise this behavior at the needed depth. Cite the test file and name, and run it. Do not add a duplicate manual check.
|
|
122
|
+
- `na`: no observable behavior, such as a docs-only change. State the reason.
|
|
123
|
+
|
|
124
|
+
**Human validation.** Add a `human` check to an AC when a person must judge it: a new user-facing flow, or a judgement call that no safe automated check settles. It supplements the automated checks for that AC. Human validation is not required for every change, and an AC without it is not thereby unverified.
|
|
125
|
+
|
|
126
|
+
Optional extra checks are explicit limitations with a reason. They never block acceptance.
|
|
127
|
+
|
|
128
|
+
**Plan before build.** For each AC, record its automated checks and any human check: the exact command or fixture, and the expected result. Write the plan before the build and give it to the builder.
|
|
129
|
+
|
|
130
|
+
**Record every run.** Each check records its exact command, the expected result, the observed result, and one outcome: `pass`, `fail`, `not run: <reason>`, or `NA: <reason>`. Run the automated checks on the current tree. Report a `covered` test with its result.
|
|
131
|
+
|
|
132
|
+
**Missing tests, credentials, and environments.** A missing necessary automated test blocks acceptance of the affected AC. The builder writes it in the next repair. If it cannot be written, the task is `BLOCKED`. A missing credential, seed data, or safe environment is never a pass: ask one targeted question, record the check as `not run` with its reason, and defer it. Such a check is pending, not failed, so it does not send the task to repair. Independent ACs continue.
|
|
133
|
+
|
|
134
|
+
**Safety.** Use local isolated fixtures and legitimate local test accounts from the project's documented setup. Without the user's authorization, do not touch production systems, external services, or real user data, and do not run destructive commands or cause external side effects. Start only the local processes a check needs. Stop the ones the agent started when the check is done, and leave existing servers running. Never weaken authentication, disable a check, or add a bypass to make a result pass.
|
|
135
|
+
|
|
136
|
+
**Identity and freshness.** Evidence is tied to the tree it ran on: its commit and, for uncommitted work, a QA-time snapshot. The baseline (step 1) stays exactly as it was taken before the build, for the review's comparison of preexisting state. It is not the QA identity. At QA and handoff time, capture the current task-scoped diff and the contents of every new file, save them in the progress record, and reference that snapshot from the QA record. Resume compares the current scope with the QA-time snapshot before reusing any evidence. An edit to a file that a check runs or covers invalidates that check, including an uncommitted edit. Rerun the invalidated checks, and reuse evidence that the edit cannot affect. An affected human check gets a new handoff.
|
|
137
|
+
|
|
138
|
+
**Human handoff.** Ask through the harness's native question tool when one exists, and only when no independent authorized work remains or a gate needs the answer. Otherwise ask in chat at that point. If the user is away or has said they will check in later, persist the handoff in the progress record, or in the feature's existing `qa.md` when there is one, and continue independent authorized work. The absence of an answer is never signoff. Pending work is not accepted, completed, or merged. Commits and pushes follow the calling command's existing policy and any explicit checkpoint the user authorized; pending QA neither grants nor removes them.
|
|
139
|
+
|
|
140
|
+
The handoff lists, in order:
|
|
141
|
+
|
|
142
|
+
1. The tested tree: branch and commit (`git rev-parse --short HEAD`), the QA-time snapshot reference when there are uncommitted changes (see Identity and freshness), and the AC or flow under test.
|
|
143
|
+
2. Setup: the documented setup and start commands, the URL or port, and the test accounts, named but not written out. Credentials stay in the project's local secret store, never in the handoff.
|
|
144
|
+
3. Seeded prerequisites.
|
|
145
|
+
4. Numbered actions, each with its expected observable outcome.
|
|
146
|
+
5. What the agent already tested, with the results, and what needs the user.
|
|
147
|
+
6. Safe cleanup.
|
|
148
|
+
7. The response template, one block per case:
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
QA-<n>: PASS | FAIL | not run
|
|
152
|
+
Actual or error evidence: <what you saw>
|
|
153
|
+
Acceptance: accept | reject | defer
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Acceptance of a human check.** It needs both a `PASS` result and an explicit `accept` for the tree the handoff named. `not run` with `accept` stays pending, because the person did not see a result. `FAIL` or `reject` sends the AC to repair, then to a new automated run and a new handoff. `defer` stays pending. The orchestrator never signs off for the user and never treats its own evidence as the user's answer.
|
|
157
|
+
|
|
158
|
+
Resume restores the exact pending handoff from the progress record, not a summary of it.
|
|
100
159
|
|
|
101
160
|
## Your Task
|
|
102
161
|
|
|
103
162
|
1. **Analyze**: identify the files to create or modify, the dependencies between tasks, and the `[P]` tasks.
|
|
104
|
-
Dispatch `[P]` tasks in parallel only when they touch different files with no shared state. Otherwise keep them sequential.
|
|
163
|
+
Dispatch `[P]` tasks in parallel only when they touch different files with no shared state. Otherwise keep them sequential. A task whose write set is unknown or undeclared runs serially until the builder's changed-file list establishes its scope.
|
|
105
164
|
2. **Run the delivery loop** for each task, in dependency order, until it exits as accepted, blocked, or needs a user decision.
|
|
106
165
|
3. **Track progress**: tick a task only after the orchestrator accepts it. Report blockers and summarize the accepted changes.
|
|
107
166
|
|
|
@@ -44,8 +44,8 @@ You are helping to create an implementation plan for a feature or requirement.
|
|
|
44
44
|
- List any open questions or decisions needed
|
|
45
45
|
|
|
46
46
|
5. **Review and Accept Planning Artifacts**:
|
|
47
|
-
- The orchestrator dispatches an independent, read-only reviewer with the original request, requirements/context, plan and any additional artifact paths. Review the actual artifacts for completeness, dependencies/order, actionability, and coverage of the request
|
|
48
|
-
- Repair blocking findings within the agreed scope, repeat affected artifact checks, and re-review the changed artifacts independently. Repeat until PASS or blocked
|
|
47
|
+
- The orchestrator dispatches an independent, read-only reviewer with the original request, requirements/context, plan and any additional artifact paths. Use the goal-fit brief (read and follow [fit-review](../rules-snippets/fit-review.md)): Oracle when available read-only, otherwise a separate reviewer; the author's self-review does not count. Review the actual artifacts for completeness, dependencies/order, actionability, and coverage of the request, and trace goals and plan items both ways. Return `VERDICT: PASS` or `VERDICT: CHANGES` with blocking findings and section references. A finding that needs a user decision is blocking, marked `requires user decision; do not auto-repair`; stop and ask the user.
|
|
48
|
+
- Repair blocking findings within the agreed scope, repeat affected artifact checks, and re-review the changed artifacts independently. Repeat until PASS or blocked, or until the user decides. Stop as BLOCKED with the reason when a repair changes nothing or the same finding returns unchanged. A goal change from the review is a user decision, not a repair. Open decisions block PASS until the user resolves them.
|
|
49
49
|
- Only the orchestrator accepts, after an independent PASS and evidence for every requirement and applicable artifact check. If an independent reviewer is unavailable, report BLOCKED; self-review cannot substitute for independent acceptance.
|
|
50
50
|
- This is a lightweight artifact review, not a code build loop: do not implement the plan, run runtime build/TDD/git procedures, or add commit, push, or apply steps. Keep any required human approval separate from artifact acceptance.
|
|
51
51
|
|
|
@@ -18,8 +18,15 @@ You are helping to create a feature specification based on the user's descriptio
|
|
|
18
18
|
- Use the template structure below
|
|
19
19
|
- Be specific and actionable
|
|
20
20
|
|
|
21
|
-
4. **
|
|
22
|
-
-
|
|
21
|
+
4. **Review and Accept the Specification**:
|
|
22
|
+
- Dispatch an independent, read-only reviewer with the original request (verbatim, with any later user amendments), the feature description, and `spec.md`. Use the goal-fit brief (read and follow [fit-review](../rules-snippets/fit-review.md)): Oracle when available read-only, otherwise a separate reviewer; the author's self-review does not count.
|
|
23
|
+
- The reviewer traces requirements and acceptance criteria both ways against the original request, checks that each criterion is testable, and returns `VERDICT: PASS` or `VERDICT: CHANGES` with blocking findings and section references. A finding that needs a user decision is blocking, marked `requires user decision; do not auto-repair`; stop and ask the user.
|
|
24
|
+
- Repair blocking findings within the agreed scope, repeat the affected checks, and re-review the changed spec independently. Repeat until PASS or blocked, or until the user decides. Stop as BLOCKED with the reason when a repair changes nothing or the same finding returns unchanged. A goal change from the review is a user decision, not a repair. Open decisions block PASS until the user resolves them.
|
|
25
|
+
- Only the orchestrator accepts, after an independent PASS. If an independent reviewer is unavailable, report BLOCKED; self-review cannot substitute for independent acceptance.
|
|
26
|
+
- Acceptance is separate from human approval: the human still confirms the spec.
|
|
27
|
+
|
|
28
|
+
5. **Output** (only after artifact acceptance):
|
|
29
|
+
- Confirm specification created and accepted
|
|
23
30
|
- Summarize key requirements
|
|
24
31
|
- Suggest next step: `/plan` to create implementation plan
|
|
25
32
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Goal-Fit Review Brief
|
|
2
|
+
|
|
3
|
+
Read and follow this brief when a gate or command asks for a goal-fit review of a spec, a plan, or a build's scope. It adds to the reviewer rules of the calling flow.
|
|
4
|
+
|
|
5
|
+
## Reviewer
|
|
6
|
+
|
|
7
|
+
- Read-only. Do not edit files, stage, or commit. Do not write any file the caller did not ask for.
|
|
8
|
+
- Independent of the author. Use Oracle when it is available read-only; otherwise a separate reviewer in fresh context. The author's self-review, the author's summary, and a single session playing every role do not count.
|
|
9
|
+
- If no independent reviewer can run, the caller reports `BLOCKED`. Do not review in its place.
|
|
10
|
+
- Review the current artifacts from scratch on every run, including resumed runs. Do not rely on an earlier reply, an earlier summary, or the author's account of what changed.
|
|
11
|
+
|
|
12
|
+
## Goal sources
|
|
13
|
+
|
|
14
|
+
Use only these as goal authority:
|
|
15
|
+
|
|
16
|
+
1. The original user request, verbatim, and every explicit user amendment (intake answers, operator change requests, rework decisions). The caller passes them to you as text in the dispatch.
|
|
17
|
+
2. Accepted constraints from earlier artifacts, when the caller passes them: for a plan review, the accepted spec's requirements, acceptance criteria, and `[DECIDED]` items; for a build review, the accepted spec and plan. Trace against these. They are not goal authority on their own.
|
|
18
|
+
|
|
19
|
+
Not goal sources: a slug, a ticket key, a ticket title, the existing spec alone, the planner's or author's summary, and any reviewer finding from an earlier round.
|
|
20
|
+
|
|
21
|
+
If the original request is not in the dispatch, do not infer goals from the spec or the plan. Reply `VERDICT: CHANGES` with a blocking finding: `Missing authoritative baseline: requires user decision; do not auto-repair.`
|
|
22
|
+
|
|
23
|
+
Quote the original request in your report. When a lower source (a spec, a plan, or a summary) conflicts with the original request, report the conflict with both quotes. Do not silently trust the lower source.
|
|
24
|
+
|
|
25
|
+
## Trace both ways
|
|
26
|
+
|
|
27
|
+
- **Forward:** every goal is covered by a requirement, acceptance criterion, or step. Name the section that covers it, or report the gap.
|
|
28
|
+
- **Backward:** every requirement, step, or file change traces to a goal. A change that no goal needs is scope drift.
|
|
29
|
+
- Implementation details that a goal needs are allowed without their own acceptance criterion (for example, a migration that a storage goal requires). Do not demand that every mundane detail be an acceptance criterion. Name the goal that justifies such a detail.
|
|
30
|
+
|
|
31
|
+
## Lenses (separate from correctness)
|
|
32
|
+
|
|
33
|
+
- **Ponytail:** is this the simplest work that meets the goals? Flag speculative abstraction, dead flexibility, reinvented standard-library behavior, and steps no goal asks for. Block only when the finding adds scope or complexity the goals do not justify; otherwise note it.
|
|
34
|
+
- **SOLID and SRP, proportional:** flag a responsibility split only when it harms a goal, for example one unit doing unrelated work the request keeps apart. Do not require abstractions or interfaces, and do not forbid a justified interface. Judge by the goals, not by the pattern.
|
|
35
|
+
|
|
36
|
+
## Decisions and repairs
|
|
37
|
+
|
|
38
|
+
- A change to a goal (dropping, narrowing, or adding one) is a user decision. So is any other question only the user can settle. A decision stays blocking until the user resolves it with an explicit amendment. Report it as a blocking finding under `VERDICT: CHANGES`, marked `requires user decision; do not auto-repair`, and also list it under **Decisions for the user**. Do not repair it, and do not assume an answer.
|
|
39
|
+
- Other blocking findings are scoped repairs: name the section and the specific change. The caller passes your findings to the author as dispatch context and reviews the changed artifacts again. You do not write repair notes or repair files.
|
|
40
|
+
- `VERDICT: PASS` means no blocking findings. Absence of blocking findings is not a pass. A finding that needs a user decision is blocking, so it is never a pass.
|
|
41
|
+
|
|
42
|
+
## Output
|
|
43
|
+
|
|
44
|
+
The first line is exactly `VERDICT: PASS` or `VERDICT: CHANGES`. `CHANGES` needs at least one blocking finding. Then use these sections:
|
|
45
|
+
|
|
46
|
+
```markdown
|
|
47
|
+
## Goal sources
|
|
48
|
+
- Original request (quoted, short), amendments, accepted constraints. Conflicts: <quotes, or none>
|
|
49
|
+
|
|
50
|
+
## Trace
|
|
51
|
+
- Forward: <goal → covering section, or gap>
|
|
52
|
+
- Backward: <untraced item → scope drift, or none>
|
|
53
|
+
|
|
54
|
+
## Blocking findings
|
|
55
|
+
- [section] Problem. Repair: <specific change>
|
|
56
|
+
|
|
57
|
+
## Decisions for the user
|
|
58
|
+
- <goal change or open decision, or none>
|
|
59
|
+
|
|
60
|
+
## Notes (non-blocking)
|
|
61
|
+
- [section] Ponytail or SRP observation. Optional.
|
|
62
|
+
```
|
|
@@ -71,42 +71,73 @@ When dispatching implementation tasks, match the specialist to the domain:
|
|
|
71
71
|
|
|
72
72
|
## Orchestration Patterns
|
|
73
73
|
|
|
74
|
-
###
|
|
74
|
+
### Delegation Default
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
- **Delegate by default.** Hand substantial, safely separable discovery, implementation, test, and review work to subagents. Use a single agent only for trivial work, as listed under "When to Use a Single Agent Directly".
|
|
77
|
+
- **The coordinator keeps outcome responsibility.** It defines each task's scope, reconciles every result, makes sure verification runs, and reports the final outcome. A subagent reporting success is not the outcome.
|
|
78
|
+
- **Work directly only** for trivial changes (one small edit, a quick answer) or when the context is too heavy to hand off cheaply, such as work that depends on large context the coordinator already holds. Say why when you skip delegation.
|
|
79
|
+
- **No delegation capability.** If the host offers no subagent dispatch, say so explicitly in the report. Do permitted direct work where it is safe. Never self-review in place of an independent gate: record the gate as pending and end as BLOCKED or WAITING.
|
|
77
80
|
|
|
78
|
-
### Parallel
|
|
81
|
+
### Dependency Graph and Parallel Batches (REQUIRED before dispatching)
|
|
79
82
|
|
|
80
|
-
|
|
83
|
+
Before dispatching any task list, the orchestrator builds the dependency graph. No `[P]` marker is required. If a task list has `[P]` markers, treat them as hints and verify them.
|
|
81
84
|
|
|
82
|
-
|
|
85
|
+
1. **Read and write sets.** For each task, list the files, directories, or packages it reads and writes.
|
|
86
|
+
2. **Exclusive writable scopes.** Each writer gets a scope no other concurrent task writes. Two tasks that share any writable path are dependent. A task whose write set is unknown or undeclared runs serially until its scope is established from the changed-file list.
|
|
87
|
+
3. **Data dependencies.** A task that reads what another task writes waits for that task.
|
|
88
|
+
4. **Ready batch.** Tasks whose dependencies are satisfied and whose writable scopes are disjoint form one batch. Dispatch the whole batch together. Dependent and shared-write tasks run in later batches, one at a time.
|
|
89
|
+
5. **Route by domain.** Backend tasks → Backend Architect; frontend → Frontend Developer; API contracts → API Specialist; docs → Documenter; cross-cutting → Implementer.
|
|
90
|
+
6. **Track handles.** Record each dispatched task's handle, agent, writable scope, and status until its result is reconciled.
|
|
91
|
+
7. **Reconcile before dependents.** Inspect each result (changed files, summary, verification) before dispatching any task that depends on it. If a result changed a path the graph did not expect, stop the affected tasks and re-plan the batch.
|
|
92
|
+
8. **Continue the chain.** When a batch's results are reconciled, compute the next ready batch and dispatch it. Do not wait for the user unless a mandatory gate applies or no authorized, unblocked work remains (see Autonomous Execution and Blockers).
|
|
83
93
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
1. **Scan for `[P]` markers** in the task list — these are pre-identified parallel candidates
|
|
87
|
-
- If no `[P]` markers exist, do **not** assume sequential-only work. Treat all tasks as candidates and infer parallel-safe groups via the independence test.
|
|
88
|
-
2. **Build a dependency graph**: For each task, list which files it reads and writes
|
|
89
|
-
3. **Apply the independence test**:
|
|
90
|
-
- Tasks that write to **different files** with **no shared state** → parallel-safe
|
|
91
|
-
- Tasks that share any writable file → sequential (dependency edge)
|
|
92
|
-
- Tasks where one reads what another writes → sequential (data dependency)
|
|
93
|
-
4. **Group by domain** for specialist routing:
|
|
94
|
-
- Backend tasks → Backend Architect
|
|
95
|
-
- Frontend tasks → Frontend Developer
|
|
96
|
-
- API contract tasks → API Specialist
|
|
97
|
-
- Documentation tasks → Documenter
|
|
98
|
-
- Cross-cutting → Implementer
|
|
99
|
-
5. **Dispatch decision**:
|
|
100
|
-
- **3+ independent tasks** → Use `dispatching-parallel-agents` skill, one agent per task
|
|
101
|
-
- **2 independent tasks** → Parallel dispatch (simpler coordination)
|
|
102
|
-
- **All tasks dependent** → Sequential with `subagent-driven-development` skill
|
|
103
|
-
- **Mixed** → Dispatch independent group in parallel, then continue sequential chain
|
|
94
|
+
**Dispatch shape:** 3+ independent tasks → `dispatching-parallel-agents`, one agent per task. 2 independent tasks → parallel dispatch. All tasks dependent → sequential with `subagent-driven-development`. Mixed → run each ready batch in parallel, then continue the sequential chain.
|
|
104
95
|
|
|
105
96
|
```
|
|
106
|
-
Example: 5 tasks → T1 (setup) → T2
|
|
107
|
-
|
|
97
|
+
Example: 5 tasks → T1 (setup) → T2 (backend API) + T3 (frontend UI) + T4 (docs) → T5 (integration tests)
|
|
98
|
+
Batches: [T1] → [T2, T3, T4] → [T5]
|
|
99
|
+
T2, T3, and T4 run together only because their writable scopes are disjoint.
|
|
108
100
|
```
|
|
109
101
|
|
|
102
|
+
## Turn Completion and Waiting
|
|
103
|
+
|
|
104
|
+
During active multi-step execution, never end a turn silently, and never treat dispatch or partial progress as completion. End each such turn in exactly one of these states. Informational answers need no status line:
|
|
105
|
+
|
|
106
|
+
- **DONE:** the requested work is complete and verified under Quality Gates. State the outcome and the validation that ran.
|
|
107
|
+
- **WAITING:** name each pending task (handle and agent) and its resume trigger, such as a subagent notification or a user reply at a named gate. List what completed and what remains.
|
|
108
|
+
- **BLOCKED / NEEDS-DECISION:** state the blocker or decision, what completed, what remains, and the exact next user action.
|
|
109
|
+
|
|
110
|
+
Resume mechanics depend on the host:
|
|
111
|
+
|
|
112
|
+
- When the host notifies on subagent completion, reconcile the notified result and continue with the next eligible batch. Check each handle once per notification.
|
|
113
|
+
- When the host cannot resume in the background, do not claim that it will. Either run the batch in the foreground and collect the results within the turn, or end as WAITING and say that the user must send a message to resume, naming the exact step.
|
|
114
|
+
- Do not busy-poll. Never loop on status checks.
|
|
115
|
+
|
|
116
|
+
## Autonomous Execution and Blockers
|
|
117
|
+
|
|
118
|
+
During multi-step execution, work autonomously within the approved goal, scope, and permissions. Autonomy grants no extra authority.
|
|
119
|
+
|
|
120
|
+
- **A blocker pauses only the affected task and its dependents.** Independent ready work within authority continues in the next batch.
|
|
121
|
+
- **Record each unresolved blocker immediately** in the existing progress record or the conversation: the affected task, what is needed and why, safe options or a targeted input, and the next action. Keep it visible in progress updates and the final report. Never drop it silently.
|
|
122
|
+
- **Defer non-global blockers** as follow-up questions while work can safely advance.
|
|
123
|
+
- **Stop for user input** only when no authorized, unblocked work remains, or when a mandatory approval, security, or permission gate prevents the remaining work. Agents still running are WAITING, not blocked.
|
|
124
|
+
- **Ask clearly.** Present the consolidated outstanding questions through the harness's native question or clarification tool when one is available. Do not assume a tool name or support. Without one, give numbered options or a fill-in block in chat.
|
|
125
|
+
- **Answers can arrive early.** Do not require a blocking tool prompt while independent work continues. Report deferred questions in progress updates.
|
|
126
|
+
- **Never** silently choose a consequential scope or requirement change, bypass a required human approval, or mark a partially blocked task DONE.
|
|
127
|
+
|
|
128
|
+
## Long-Session Checkpoint
|
|
129
|
+
|
|
130
|
+
For sessions that span several batches or a context reset:
|
|
131
|
+
|
|
132
|
+
- Use existing progress records only: a progress section the plan or task list already has, Factory job notes, or task records, when they exist. Keep the approved goal, current step, active task handles, blocker, and next action in those notes or in the conversation.
|
|
133
|
+
- Never add fields to structured files such as Factory `job.json`, never rewrite accepted requirements or spec/plan text, and never replace an authoritative source with a summary.
|
|
134
|
+
- If no such records exist, a short checkpoint in the conversation is enough. Do not create new files for trivial work.
|
|
135
|
+
- On resume, reread the accepted source (spec, plan, or task text) instead of relying on the checkpoint summary, and check the working tree before dispatching anything.
|
|
136
|
+
|
|
137
|
+
## Factory Approvals
|
|
138
|
+
|
|
139
|
+
Spec and plan confirmations remain mandatory human steps; final approval, escalation, and merge behavior follow the job's `APPROVAL_MODE` and `MERGE_MODE`. Delegation, batching, autonomy, and subagent sign-offs never satisfy spec or plan human confirmation, or human final approval when `APPROVAL_MODE=human`. Mode-defined approver behavior is preserved. Stop at the gate and report it as WAITING or BLOCKED.
|
|
140
|
+
|
|
110
141
|
## Quality Gates
|
|
111
142
|
|
|
112
143
|
- Every implementation must pass **Reviewer** before proceeding
|
|
@@ -122,7 +153,7 @@ When a subagent stops on a model capacity, quota, session limit, or reset-wait f
|
|
|
122
153
|
- **Model order, one attempt each.** Try the next model in the configured fallback order for that agent. When the order is exhausted, try the harness's known available default, unless it was already tried. Then stop; do not cycle back.
|
|
123
154
|
- **Never** retry the same unavailable model, and never wait blindly for a quota reset.
|
|
124
155
|
- **Only supported switching.** Change the model through per-call selection the runtime supports, using only fallback models and defaults that are already configured or exposed. Do not invent model IDs, and do not edit persistent or global config, accounts, or billing.
|
|
125
|
-
- **Blocker when nothing is left.** If no configured fallback or default is available, or per-call selection is unsupported,
|
|
156
|
+
- **Blocker when nothing is left.** If no configured fallback or default is available, or per-call selection is unsupported, the affected task is reported BLOCKED with the question of which model to use. Its dependents stop; independent authorized work continues (see Autonomous Execution and Blockers).
|
|
126
157
|
- **Inspect before resuming.** Check what the failed attempt left in the working tree, then resume from that partial work. Never run two writers on the same files at once.
|
|
127
158
|
- **Keep review independent.** The reviewer stays a separate agent from the builder, even when the builder moves to a fallback model.
|
|
128
159
|
- **Disclose.** The final report names the original model, each fallback attempted, and the model that finished the work.
|
package/src/monorepo/AGENTS.md
CHANGED
|
@@ -77,7 +77,7 @@ For CLI command reference, see the matching skill: `.agents/skills/{acli,gh-cli,
|
|
|
77
77
|
|
|
78
78
|
#### 1. Proactive Clarification
|
|
79
79
|
|
|
80
|
-
- **Identify Ambiguity**:
|
|
80
|
+
- **Identify Ambiguity**: Ask a targeted question if a task lacks clear acceptance criteria, inputs, or expected outputs. It blocks only that task and its dependents; independent work with clear requirements continues (see the "Autonomy with blockers" bullet under Operating Rules).
|
|
81
81
|
- **Resolve Conflicts**: Flag conflicting instructions between the user prompt, existing code, and documentation before writing code.
|
|
82
82
|
- **Expose Assumptions**: State your assumptions clearly and ask for validation before proceeding with high-impact changes.
|
|
83
83
|
|
|
@@ -268,7 +268,10 @@ Use custom agents when you want explicit coordinator and worker roles. Use workf
|
|
|
268
268
|
- Do not make an implementation subagent read the plan file on its own; pass the relevant task directly.
|
|
269
269
|
- In `subagent-driven-development`, keep the review order strict: spec compliance first, then code quality.
|
|
270
270
|
- If a reviewer finds issues, fix them and re-run the same review before moving on.
|
|
271
|
-
-
|
|
271
|
+
- Parallel implementation subagents need exclusive writable scopes. If scopes could overlap (shared packages, shared docs, or the same app surface), or one task reads another's output, run them sequentially. See `.claude/rules-snippets/subagent-workflow.md` for the dependency graph and batch rules.
|
|
272
|
+
- Delegate substantial, separable work by default; the coordinator stays responsible for the outcome and reconciles each result before dispatching dependents.
|
|
273
|
+
- **Never end silently** — During active multi-step execution, end each turn as DONE, WAITING (pending task handle and resume trigger), or BLOCKED / NEEDS-DECISION (what completed, what remains, exact next user action). Dispatch or partial progress is not completion. Spec and plan confirmations remain mandatory human steps; final approval, escalation, and merge behavior follow the job's `APPROVAL_MODE` and `MERGE_MODE`. Delegation or autonomy alone never satisfies a gate.
|
|
274
|
+
- **Autonomy with blockers** — Work autonomously within the approved goal, scope, and permissions. A blocker pauses only its task and dependents: record it, defer non-global questions, and continue independent authorized work. Stop for the user only when no authorized work remains or a mandatory gate applies, and ask through the harness's native question tool when one exists.
|
|
272
275
|
- For cross-app work, research boundaries first, sequence shared package changes before app-specific changes, and review downstream impact explicitly.
|
|
273
276
|
|
|
274
277
|
#### Recommended Flow
|
|
@@ -343,8 +346,8 @@ Workers are dispatched by coordinators and are not directly user-invocable.
|
|
|
343
346
|
- Admin dashboards, RBAC, reporting, monitoring → Admin Portal
|
|
344
347
|
- General implementation → Implementer
|
|
345
348
|
|
|
346
|
-
**Sequential**:
|
|
347
|
-
**Parallel**:
|
|
349
|
+
**Sequential**: Dependent tasks, and tasks that share a writable file or package, run one at a time in dependency order.
|
|
350
|
+
**Parallel**: Ready tasks with exclusive writable scopes (e.g., changes in different apps) run together as one batch. Reconcile each batch's results before dispatching the next.
|
|
348
351
|
|
|
349
352
|
**Monorepo-specific**: When implementing features that span multiple apps, coordinate carefully:
|
|
350
353
|
|
|
@@ -366,7 +369,7 @@ Subagents are typically **agent-initiated** — the coordinator decides when to
|
|
|
366
369
|
|
|
367
370
|
### Factory (opt-in)
|
|
368
371
|
|
|
369
|
-
An optional file-driven pipeline for feature-sized work, alongside Feature Builder and TDD. Start it with `/factory <request>` in Claude Code, Copilot, Cursor, or OpenCode. The orchestrator reads the project and asks only the glaring questions before it creates anything, then asks you to continue or change the answers. Resume a feature with `/factory start <KEY | slug | job-id>`. Codex runs the orchestrator skill directly. Each job belongs to a feature folder in `docs/features/`, stops at a spec gate and a plan gate for your confirmation before any ticket or build, builds in its own git worktree unless you ask for `--in-place`, and moves its tickets when the project tracks them. The orchestrator is [.agents/skills/factory/SKILL.md](.agents/skills/factory/SKILL.md). It runs on the native `planner` (spec and plan), `implementer` (build, repair, and rework), and `reviewer` (the code, security, ux, and ui lenses, and approval) agents. Each role's Factory rules are in its brief in `.agents/skills/factory/roles/`. Setup, placeholders, and approval modes are in [factory/README.md](factory/README.md). Jobs name the affected apps and packages in their spec, and checks run for those with the filtered commands in [Commands](#commands).
|
|
372
|
+
An optional file-driven pipeline for feature-sized work, alongside Feature Builder and TDD. Start it with `/factory <request>` in Claude Code, Copilot, Cursor, or OpenCode. The orchestrator reads the project and asks only the glaring questions before it creates anything, then asks you to continue or change the answers. Resume a feature with `/factory start <KEY | slug | job-id>`. Codex runs the orchestrator skill directly. Each job belongs to a feature folder in `docs/features/`, stops at a spec gate and a plan gate for your confirmation before any ticket or build, builds in its own git worktree unless you ask for `--in-place`, and moves its tickets when the project tracks them. The orchestrator is [.agents/skills/factory/SKILL.md](.agents/skills/factory/SKILL.md). It runs on the native `planner` (spec and plan), `implementer` (build, repair, and rework), and `reviewer` (the code, security, ux, and ui lenses, and approval) agents. Each role's Factory rules are in its brief in `.agents/skills/factory/roles/`. Spec and plan goal-fit must be confirmed by an independent Oracle or read-only reviewer, not the spec or plan author. Single-session role switching, including the Codex fallback, does not satisfy that and blocks these gates. Spec and plan confirmations stay mandatory human steps in every approval mode. Setup, placeholders, and approval modes are in [factory/README.md](factory/README.md). Jobs name the affected apps and packages in their spec, and checks run for those with the filtered commands in [Commands](#commands).
|
|
370
373
|
|
|
371
374
|
## Documentation Requirements
|
|
372
375
|
|
|
@@ -55,7 +55,7 @@ The orchestrator and agents are the same in every harness. Each harness has its
|
|
|
55
55
|
| GitHub Copilot | `/factory` prompt (`.github/prompts/factory.prompt.md`) | `.github/agents/` |
|
|
56
56
|
| Cursor | `/factory` (`.cursor/commands/factory.md`) | `.cursor/agents/` |
|
|
57
57
|
| OpenCode | `/factory` (`.opencode/commands/factory.md`) | `.opencode/agents/` |
|
|
58
|
-
| Codex | The factory skill (`.agents/skills/factory/SKILL.md`) |
|
|
58
|
+
| Codex | The factory skill (`.agents/skills/factory/SKILL.md`) | No native agent definitions. Role briefs run directly; spec and plan acceptance requires an independent review session. Single-session role switching cannot satisfy that gate (see Harness notes in SKILL.md). |
|
|
59
59
|
|
|
60
60
|
In OpenCode with the Slim plugin, `oracle` and `designer` are optional alternatives to `reviewer`, if you configure them as edit-denied. The default is the native agents.
|
|
61
61
|
|
|
@@ -83,6 +83,8 @@ Sizing is decided in `plan.md`:
|
|
|
83
83
|
|
|
84
84
|
Every job stops twice, in every approval mode, before anything is ticketed or built:
|
|
85
85
|
|
|
86
|
+
Before either confirmation, an independent read-only Oracle, or reviewer when Oracle is unavailable, checks goal fit. Revisions and resumed gates are reviewed again. Missing independent review blocks acceptance, including single-session Codex use; it does not block discussing unresolved decisions. If the original requirements cannot be recovered, the operator must confirm the recovered baseline rather than treating an agent-written summary as the original request.
|
|
87
|
+
|
|
86
88
|
1. **Spec gate** (`awaiting-spec`). You read the spec summary, the acceptance criteria count, each open `[PRODUCT DECISION]` item, and open questions. Answer every open decision before you confirm: answers go in your change request, are saved as `spec-<k>.md`, and the spec writer records each one as `[DECIDED]`.
|
|
87
89
|
2. **Plan gate** (`awaiting-plan`). You read the plan, the tasks, the size, the tracking proposal, and the build mode. Confirm, request changes (saved as `plan-<k>.md`), or change size, tracking, or build mode. Requests that touch the spec go back through the spec gate.
|
|
88
90
|
|
|
@@ -90,8 +92,8 @@ Session ended at a gate? `/factory start <job-id | slug | KEY>` shows that gate
|
|
|
90
92
|
|
|
91
93
|
## Approval modes
|
|
92
94
|
|
|
93
|
-
- **`human`** (default). An approved job stops at `awaiting-human`. Read the branch and `qa.md`, then run `/factory approve <job-id>`.
|
|
94
|
-
- **`auto`**. An approved job merges automatically. The approver still escalates anything touching auth, payments, data security, deployment, migrations, email, production data, new dependencies, or unresolved product decisions. Its tickets stay In Review until you run `/factory approve <job-id>`, which then moves them to Done.
|
|
95
|
+
- **`human`** (default). An approved job stops at `awaiting-human`. Read the branch and the QA handoff in `qa.md`, answer any pending human check, then run `/factory approve <job-id>`.
|
|
96
|
+
- **`auto`**. An approved job merges automatically. The approver still escalates anything touching auth, payments, data security, deployment, migrations, email, production data, new dependencies, or unresolved product decisions. A job with a human QA check still stops at `awaiting-human`, because that check is required validation. Its tickets stay In Review until you run `/factory approve <job-id>`, which then moves them to Done.
|
|
95
97
|
|
|
96
98
|
Any value other than exactly `auto` is treated as `human`.
|
|
97
99
|
|
|
@@ -126,9 +128,15 @@ Set `MERGE_MODE`. The approval gates are the same in both modes.
|
|
|
126
128
|
|
|
127
129
|
`push-mr` suits forge-reviewed setups, where required reviews or CI gates sit on the forge after your approval. It never force-pushes and never merges locally. Under `auto`, approve opens the request without a pause, but the forge merge and the second `/factory approve` stay yours.
|
|
128
130
|
|
|
129
|
-
##
|
|
131
|
+
## Functional QA (`qa.md`)
|
|
132
|
+
|
|
133
|
+
The builder writes the QA plan into `qa.md` in the feature folder, on the job's branch, before it writes code. After the final code commit it records each check: the command, the expected result, the observed result, and `pass`, `fail`, `not run` (with the reason), or `NA`. Acceptance criteria that need a person are marked `human`, and their handoff lists the numbered steps, the expected results, and the response template.
|
|
134
|
+
|
|
135
|
+
- **Automated checks** run for every criterion on the job's tree. A failed check goes back to the builder. A check that could not run because a credential, data, or environment is missing stops the job for you, as a `Not verified` item.
|
|
136
|
+
- **Human checks** are added only where a person must judge: a new flow, or a judgement no safe automated check settles. They supplement the automated checks. The job waits at `awaiting-human`, even in `auto`. Answer the handoff with `PASS` and `accept`. `/factory approve` saves your answer in `build.md` and merges only when every human check reads `PASS` with `accept`. A failure or rejection means `/factory rework <job-id> <note>`.
|
|
137
|
+
- **Optional checks** are listed as limitations. They never block.
|
|
130
138
|
|
|
131
|
-
The
|
|
139
|
+
The approver reads the functional QA record and escalates on a failed, missing, or stale check. The manual checklist never affects a verdict, and a missing `qa.md` is only noted when the job has no `local` or `human` criteria. When a job waits for you, the orchestrator prints the record and the reviewers' `Not verified` items under the line `Suggested checks before /factory approve — not a gate`.
|
|
132
140
|
|
|
133
141
|
## Tickets
|
|
134
142
|
|
|
@@ -151,7 +159,7 @@ The parent and every sub-task move together. The orchestrator uses the project's
|
|
|
151
159
|
4. **Plan.** `planner` in plan mode writes `plan.md` (with the size) and `tasks.md` for large work.
|
|
152
160
|
5. **Plan gate.** You confirm the plan, or request changes. Nothing is ticketed or built before you confirm.
|
|
153
161
|
6. **Tickets and build location.** If tracked, the parent and sub-tasks are created and their keys are written into `tasks.md`. The folder is renamed to carry the key. Then a builder gets its own git worktree on branch `factory/<id>` (bootstrapped first, see Build location), or the in-place branch. The job's feature docs are committed on that branch.
|
|
154
|
-
7. **Build.** The builder follows TDD, ticks `tasks.md` as it completes tasks, writes `build.md`, and writes `qa.md
|
|
162
|
+
7. **Build.** The builder follows TDD, ticks `tasks.md` as it completes tasks, writes `build.md`, and writes `qa.md` (its functional QA plan before the code, and its results after).
|
|
155
163
|
8. **Review.** Every configured lens reviews the branch, and each reviewer's report is saved as `round-N/review-<lens>.md` with `VERDICT: PASS` or `VERDICT: CHANGES`.
|
|
156
164
|
9. **Repair.** Any `CHANGES` sends the builder back to fix it. Two repairs at most, so three review rounds. Then the job escalates to you.
|
|
157
165
|
10. **Approve.** `reviewer` in approval mode (fresh context) returns `APPROVE` or `ESCALATE`, and the orchestrator writes it to `decision.md`.
|
|
@@ -139,7 +139,7 @@ For full-stack or cross-cutting features, dispatch domain specialists in paralle
|
|
|
139
139
|
| Multi-subsystem fix | Backend Architect (service A) + Backend Architect (service B) | Independent service bugs |
|
|
140
140
|
| Cross-app monorepo | Specialist per app | Same feature in `apps/web` + `apps/api` (no shared packages) |
|
|
141
141
|
|
|
142
|
-
**Safe to parallelize:** Agents
|
|
142
|
+
**Safe to parallelize:** Agents have exclusive writable scopes (no shared files/directories) and no shared state. Build the dependency graph first; see `.claude/rules-snippets/subagent-workflow.md`.
|
|
143
143
|
**Still sequential:** Tasks that share files, database migrations, or API contracts that one depends on.
|
|
144
144
|
|
|
145
145
|
## When NOT to Use
|