compound-workflow 1.4.2 → 1.4.4

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/README.md CHANGED
@@ -1,193 +1,84 @@
1
- # Compound Workflow (.agents)
1
+ # Compound Workflow
2
2
 
3
- A portable, command-first workflow: **clarify plan execute verify → capture**. Commands are the public API; skills and agents are composable internals.
3
+ Compound Workflow is a portable, command-first system for shipping software with less ambiguity and stronger verification.
4
+ It follows a simple cycle: **clarify -> plan -> execute -> verify -> capture**.
5
+ Use it when you want repeatable delivery without ad-hoc process drift.
4
6
 
5
- It reduces delivery failures from **unclear intent**, **weak verification**, and **lost context**. Use it when you want structured cycles without ad-hoc tooling.
7
+ Inspired by [Compound Engineering](https://every.to/guides/compound-engineering) (Every).
6
8
 
7
- *This template and README are continually refined during development.*
9
+ Best fit when you need:
8
10
 
9
- Inspired by [Compound Engineering](https://every.to/guides/compound-engineering) (Every) the AI-native philosophy that each unit of work should compound into the next.
11
+ - Clear intent and acceptance criteria before coding
12
+ - Structured execution with explicit review gates
13
+ - A repeatable process that captures reusable learnings
10
14
 
11
- Runtime assets live in `src/.agents/` and `src/AGENTS.md`. Supports **Cursor**, **Claude**, and **OpenCode** via one Install action per project.
15
+ ## Workflow
12
16
 
13
- ---
14
-
15
- ## Get started
16
-
17
- **1. Add the package and run Install** (in the project where you want the workflow):
18
-
19
- ```bash
20
- npm install compound-workflow
21
- npx compound-workflow install
22
- npx compound-workflow install all
23
- ```
24
-
25
- **2. Choose how you use it:**
26
-
27
- - **Cursor:** If your project already has a `.cursor` directory, Install will create the correct structure: one symlink per skill under `.cursor/skills/`, plus `.cursor/agents`, `.cursor/commands`, and `.cursor/references` (each symlinked to the package). No plugin needed. Use the plugin from this repo if you need a different loading method.
28
- - **OpenCode:** Install writes `opencode.json` and a symlink at `.agents/compound-workflow-skills`; OpenCode loads from the package. Run `/install` or `npx compound-workflow install` in the project.
29
- - **Claude:** Add the compound-workflow plugin from this repo. In any repo, run `/install` or the CLI above.
30
-
31
- **What Install does:** Merges `AGENTS.md` (preserves your Repo Config Block), creates standard dirs (`docs/`, `todos/`), writes `opencode.json` (for OpenCode), and—if the project has a `.cursor` directory—creates `.cursor/skills/<skill>`, `.cursor/agents`, `.cursor/commands`, and `.cursor/references` (symlinks into the package). All paths reference `node_modules/compound-workflow`; no file copying.
32
-
33
- **CLI options:** `all` / `--all` (full install shortcut; same as `--cursor`), `--dry-run` (preview), `--root /path/to/project`, `--no-config` (skip Repo Config Block reminder), `--cursor` (create `.cursor` and wire Cursor symlinks even if `.cursor` does not already exist).
34
-
35
- **Legacy (clone inside repo):** If you cloned this repo inside a host repo and need to copy files without npm, use `./scripts/sync-into-repo.sh` (copy only; does not update opencode.json). Prefer the npm + Install flow above.
36
-
37
- To update to a new release, see [Updating compound-workflow](#updating-compound-workflow).
38
-
39
- ---
40
-
41
- ## Updating compound-workflow
42
-
43
- - **Cursor (plugin):** If you load the plugin from this repo, pull latest and reload the plugin in Cursor.
44
- - **Cursor (npm + .cursor):** Run `npm update compound-workflow`, then run **Install** again (`npx compound-workflow install`) to refresh the `.cursor/skills`, `.cursor/agents`, `.cursor/commands`, and `.cursor/references` symlinks and AGENTS.md.
45
- - **OpenCode / npm:** Run `npm update compound-workflow` (or bump the version in `package.json` and `npm install`), then run **Install** again. This refreshes `opencode.json`, merges the latest `AGENTS.md` template, and ensures dirs exist; Repo Config Block is preserved.
46
- - **Claude (plugin):** Update via the editor’s plugin; if from repo, pull latest and reload.
47
-
48
- ---
49
-
50
- ## Workflow at a glance
51
-
52
- Clarify what to build -> plan how (fidelity + confidence) -> triage todos -> execute -> review -> capture learnings -> log and assess.
17
+ The workflow turns a request into validated output and reusable team knowledge.
53
18
 
54
19
  ```mermaid
55
20
  flowchart LR
56
- A["brainstorm"] --> B["plan"] --> C["triage"] --> D["work"] --> E["review"] --> F["capture"] --> G["metrics"]
21
+ A["brainstorm"] --> B["plan"] --> C["work (includes triage)"] --> D["review"] --> E["capture"] --> F["metrics"]
57
22
  ```
58
23
 
59
- ---
60
-
61
- If docs conflict: follow [docs/principles/workflow-baseline-principles.md](docs/principles/workflow-baseline-principles.md), then [src/AGENTS.md](src/AGENTS.md), then command docs under [src/.agents/commands/](src/.agents/commands/).
62
-
63
- ---
64
-
65
- ## Step-by-step: intent and commands
66
-
67
- | Step | Intent | Command | Output / note |
68
- |------|--------|---------|---------------|
69
- | Clarify what to build | Dialogue only; no code | `/workflow:brainstorm [topic]` | `docs/brainstorms/` |
70
- | Define how (fidelity + confidence) | Plan only; no code; include agentic access + validation contract | `/workflow:plan [description or brainstorm path]` | `docs/plans/` |
71
- | Ready the queue | Priority/dependencies + executable agentic contract checks for pending todos | `/workflow:triage` | — |
72
- | Execute | File-based todos; risk-tier testing; evidence-backed implementation; no auto-ship | `/workflow:work <plan-path>` | `todos/` |
73
- | Validate quality | Independent, evidence-based review for code/config changes (docs-only exempt); no fixes by default | `/workflow:review [PR, branch, or current]` | pass / pass-with-notes / fail |
74
- | Capture learnings | One solution doc for future use | `/workflow:compound [context]` | `docs/solutions/` |
75
- | Log and improve | Session log + optional aggregate review | `/metrics` + `/assess weekly 7` (or monthly) | `docs/metrics/daily/`, weekly/monthly |
76
-
77
- #### 1. Clarify (brainstorm)
78
-
79
- **Intent:** Dialogue only; no code. **Command:** `/workflow:brainstorm [topic]`. **Output:** `docs/brainstorms/`.
80
-
81
- #### 2. Define how (plan)
82
-
83
- **Intent:** Plan only; no code; fidelity + confidence; include an agentic access + validation contract. **Command:** `/workflow:plan [description or brainstorm path]`. **Output:** `docs/plans/`.
84
-
85
- #### 3. Ready the queue (triage)
86
-
87
- **Intent:** Priority/dependencies for pending todos and readiness checks for agentic executability. **Command:** `/workflow:triage`. **Output:** —.
88
-
89
- #### 4. Execute (work)
90
-
91
- **Intent:** File-based todos; risk-tier testing; success-criteria evidence + quality gates before completion; no auto-ship. **Command:** `/workflow:work <plan-path>`. **Output:** `todos/`.
92
-
93
- `/workflow:work` must not run until `/workflow:triage` has approved executable ready todos.
24
+ ## Get Started
94
25
 
95
- For code/config changes, `/workflow:work` ends at implementation-complete and requires `/workflow:review` before workflow completion. Docs-only work can close without `/workflow:review`.
96
-
97
- #### 5. Validate quality (review)
98
-
99
- **Intent:** Independent, evidence-based review with explicit independence mode (`independent|degraded`) and evidence disclosure; no fixes by default. **Command:** `/workflow:review [PR|branch|current]`. **Output:** pass / pass-with-notes / fail.
100
-
101
- #### 6. Capture learnings (compound)
102
-
103
- **Intent:** One solution doc for future use. **Command:** `/workflow:compound [context]`. **Output:** `docs/solutions/`.
104
-
105
- #### 7. Log and improve
106
-
107
- **Intent:** Session log + optional aggregate review. **Command:** `/metrics` + `/assess weekly 7` (or monthly). **Output:** `docs/metrics/daily/`, weekly/monthly.
108
-
109
- **Optional QA:** **`/test-browser [PR|branch|current]`** — Browser validation on affected pages via **agent-browser CLI only** (not MCP). Install: `npm install -g agent-browser` then `agent-browser install`. See [src/.agents/commands/test-browser.md](src/.agents/commands/test-browser.md).
110
-
111
- ---
112
-
113
- ## Command reference
114
-
115
- **Onboarding:** `/install` — one action: merges AGENTS.md, creates dirs, preserves Repo Config Block; writes opencode.json (OpenCode) and, if present, symlinks into `.cursor/skills/` (Cursor). Run `npx compound-workflow install` in the project (requires `npm install compound-workflow`). Re-run after `npm update compound-workflow` to refresh config; see [Updating compound-workflow](#updating-compound-workflow).
116
-
117
- **Core workflow:** See [Step-by-step](#step-by-step-intent-and-commands) above.
118
-
119
- **QA:** `/test-browser [PR|branch|current]` — browser checks on affected routes (agent-browser CLI only).
120
-
121
- **Improvement:** `/metrics [plan|todo|pr|solution|label]` — log session to `docs/metrics/daily/` and assess. `/assess [daily|weekly|monthly] [count]` — aggregate metrics and optional summary files.
122
-
123
- **Experimental:** `/workflow:review-v2 [PR|branch|current]` — interactive snippet review; output-only (no GitHub publish).
124
-
125
- Full detail: [src/AGENTS.md](src/AGENTS.md), [src/.agents/commands/](src/.agents/commands/).
126
-
127
- ---
128
-
129
- ## Artifacts
130
-
131
- - **Brainstorms:** `docs/brainstorms/YYYY-MM-DD-<topic>-brainstorm.md`
132
- - **Plans:** `docs/plans/YYYY-MM-DD-<type>-<slug>-plan.md`
133
- - **Todos:** `todos/{id}-{status}-{priority}-{slug}.md`
134
- - **Solutions:** `docs/solutions/<category>/YYYY-MM-DD-<module-slug>-<symptom-slug>.md`
135
- - **Metrics:** `docs/metrics/daily/YYYY-MM-DD.md`, `docs/metrics/weekly/YYYY-WW.md`, `docs/metrics/monthly/YYYY-MM.md`
136
-
137
- ---
138
-
139
- ## How it works (internals)
140
-
141
- Commands are the public API. Skills and agents are invoked by commands; you don’t call them directly.
142
-
143
- - **Workflow skills:** `brainstorming`, `file-todos`, `compound-docs`, `document-review`, `technical-review`, `git-worktree`, `agent-browser`, `process-metrics`, `react-ddd-mvc-frontend`, `xstate-actor-orchestration`, `standards`.
144
- - **State orchestration:** Use a state-orchestration skill when complexity exceeds simple local state (e.g. `xstate-actor-orchestration` per Skill Index)—UI container-as-orchestrator flows, backend/internal actor orchestration, receptionist/child-actor patterns, retries/timeouts/cancellation, or boolean-flag sprawl.
145
- - **Skill-local metadata:** Some skills may include tool-specific metadata under `src/.agents/skills/<skill>/agents/` (for example `openai.yaml`) when required by skill validation/runtime.
146
- - **Guardrail standards:** `data-foundations`, `pii-protection-prisma`, `financial-workflow-integrity`, `audit-traceability` — applied when work touches multi-tenant data, PII, money, or audit.
147
- - **Agents:** Used by plan, review, and work for research, lint, and validation (e.g. `repo-research-analyst`, `learnings-researcher`, `git-history-analyzer`, `agent-native-reviewer`, `planning-technical-reviewer`).
148
-
149
- Full “when to use what” and reference standards: [src/AGENTS.md](src/AGENTS.md).
150
-
151
- ---
152
-
153
- ## Guardrails
154
-
155
- - **No auto-ship:** `/workflow:work` and `/workflow:review` do not commit, push, or create PRs by default.
156
-
157
- - **Brainstorm and plan do not write code.** Output is documents only.
26
+ ```bash
27
+ npm install compound-workflow
28
+ ```
158
29
 
159
- - **Todo completion requires evidence:** acceptance/success criteria plus quality gates must be recorded before `complete`.
30
+ `npm install` adds the package and automatically configures your repo (`AGENTS.md`, required directories, and runtime wiring).
31
+ If your package manager skips lifecycle scripts, run `npx compound-workflow install` manually.
160
32
 
161
- - **Independent review policy:** code/config changes require `/workflow:review` before workflow completion; docs-only changes are exempt.
33
+ Install configures:
162
34
 
163
- - **Standards baseline policy:** code/config changes must pass `skill: standards` as a hard gate (declarative flow, immutable transforms, maintainability boundaries) in both `/workflow:work` and `/workflow:review`; docs-only changes are exempt.
35
+ - Workflow template content in `AGENTS.md`
36
+ - Standard workspace directories for plans/todos/docs
37
+ - Runtime configuration used by supported tools
164
38
 
165
- - **Quality gate fallback:** if `lint_command` or `typecheck_command` is missing from repo config, workflow asks once for run-provided commands and continues only if they pass.
39
+ ## Critical Path
166
40
 
167
- - **Artifact policy:** do not create ad-hoc artifacts outside canonical outputs (`docs/plans`, `todos`, `docs/solutions`, `docs/metrics`) unless explicitly requested.
41
+ After install, use this default sequence:
168
42
 
169
- - Add a separate shipping command if you want automated commit/PR and quality gates.
43
+ 1. `/workflow:brainstorm` for requirements clarity
44
+ 2. `/workflow:plan` for implementation design
45
+ 3. `/workflow:work` to execute against the approved plan (includes automatic triage)
46
+ 4. `/workflow:review` to validate quality before completion
47
+ 5. `/workflow:compound` to capture reusable learnings
170
48
 
171
- ---
49
+ Optional:
172
50
 
173
- ## Troubleshooting
51
+ - `/workflow:triage` for manual backlog curation before or during execution
52
+ - `/metrics` and `/assess` for process improvement
174
53
 
175
- **Skills not showing in Cursor?** Cursor discovers skills from (1) the plugin’s `skills/` directory when you load the plugin from this repo, or (2) the project’s `.cursor/skills/` when you use npm: ensure the project has a `.cursor` directory and run `npx compound-workflow install`—Install creates the full structure (`.cursor/skills/<skill>`, `.cursor/agents`, `.cursor/commands`, `.cursor/references`). If skills still don’t appear, check Cursor Settings → Rules and any `permission.skill` settings.
54
+ ## Commands (Quick Map)
176
55
 
177
- If your project does not already have `.cursor/`, run `npx compound-workflow install --cursor` to create it and wire links. Install now fails fast when existing non-symlink files/directories block `.cursor` link creation, to prevent partial installs and command drift.
56
+ Core flow: `/workflow:brainstorm` -> `/workflow:plan` -> `/workflow:work` -> `/workflow:review` -> `/workflow:compound` -> `/metrics` (optional `/assess` for rollups).
178
57
 
179
- **Skills not showing in OpenCode?** OpenCode uses the `.agents/compound-workflow-skills` symlink and `opencode.json` `skills.paths`. Run Install from the project root (`npx compound-workflow install`). The learnings-capture skill is named **compound-docs** (hyphen, plural); **compound_doc** (underscore) is an alias that resolves to the same skill.
58
+ | Command | Purpose | Related skills | Related agents |
59
+ |---|---|---|---|
60
+ | `/install` | Configure workflow files and runtime wiring in the repo | install CLI (no workflow skill routing) | none |
61
+ | `/workflow:brainstorm` | Clarify what to build through structured discussion | `brainstorming` (primary), `document-review` (optional refinement) | `repo-research-analyst` |
62
+ | `/workflow:plan` | Convert intent into an executable plan with fidelity/confidence | state-orchestration skill when needed (for example `xstate-actor-orchestration`) | `repo-research-analyst`, `learnings-researcher`, `best-practices-researcher`, `framework-docs-researcher`, `git-history-analyzer`, `spec-flow-analyzer`, `planning-technical-reviewer` |
63
+ | `/workflow:triage` | Manual queue curation for complex/multi-item backlogs (optional; `/workflow:work` runs triage automatically) | `file-todos` | none |
64
+ | `/workflow:work` | Execute plan/todos with quality gates and validation evidence | `git-worktree`, `file-todos`, `standards`, state-orchestration skill when needed | `repo-research-analyst`, `learnings-researcher`, `best-practices-researcher`, `framework-docs-researcher`, `git-history-analyzer` |
65
+ | `/workflow:review` | Perform independent quality review before completion | `git-worktree` (for non-current targets), `standards` | `learnings-researcher`, `lint`, `bug-reproduction-validator`, `git-history-analyzer`, `framework-docs-researcher`, `agent-native-reviewer` |
66
+ | `/workflow:compound` | Capture reusable implementation learnings in `docs/solutions/` | `compound-docs` (primary), `document-review` (optional) | `learnings-researcher`, `best-practices-researcher`, `framework-docs-researcher` |
67
+ | `/metrics` | Log session outcomes and improvement actions | `process-metrics`, `file-todos` (optional for follow-ups) | none |
68
+ | `/assess` | Aggregate metrics trends and propose process improvements | `file-todos` (for approved follow-up actions) | none |
69
+ | `/test-browser` | Validate affected routes with browser-level checks | `agent-browser`, `git-worktree` (optional branch isolation) | none |
180
70
 
181
- ---
71
+ Canonical command docs: [src/.agents/commands/](src/.agents/commands/)
182
72
 
183
- ## Configuration and optional bits
73
+ ## Learn More
184
74
 
185
- **Repo configuration:** Commands read a **Repo Config Block** (YAML) in `AGENTS.md` for `default_branch`, `dev_server_url`, `test_command`, `lint_command`, `typecheck_command`, etc. Run **`/install`** once; then edit `AGENTS.md` to set the Repo Config Block.
75
+ - Workflow principles: [docs/principles/workflow-baseline-principles.md](docs/principles/workflow-baseline-principles.md)
76
+ - Project command and policy index: [src/AGENTS.md](src/AGENTS.md)
77
+ - Command definitions: [src/.agents/commands/](src/.agents/commands/)
186
78
 
187
- **agent-browser:** `/test-browser` uses the agent-browser CLI only. Install: `npm install -g agent-browser` then `agent-browser install`. See [src/.agents/commands/test-browser.md](src/.agents/commands/test-browser.md).
79
+ If docs conflict: follow `docs/principles/workflow-baseline-principles.md`, then `src/AGENTS.md`, then command docs.
188
80
 
189
- **Source of truth**
81
+ Guardrails:
190
82
 
191
- - Workflows and commands: [src/.agents/](src/.agents/)
192
- - Baseline principles (tie-breaker): [docs/principles/workflow-baseline-principles.md](docs/principles/workflow-baseline-principles.md)
193
- - Principles and skill index: [src/AGENTS.md](src/AGENTS.md)
83
+ - Independent review policy: code/config changes require `/workflow:review` before workflow completion (docs-only changes are exempt).
84
+ - Standards baseline policy: code/config changes must pass the standards baseline gate in `/workflow:work` and `/workflow:review`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compound-workflow",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "Clarify → plan → execute → verify → capture. One Install action for Cursor, Claude, and OpenCode.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -18,6 +18,7 @@
18
18
  "skills"
19
19
  ],
20
20
  "scripts": {
21
+ "postinstall": "node scripts/postinstall.mjs",
21
22
  "check:pack-readme": "node scripts/check-pack-readme.mjs"
22
23
  },
23
24
  "engines": {
@@ -11,6 +11,16 @@ const requiredChecks = [
11
11
  pattern: "tie-breaker",
12
12
  description: "baseline principles tie-breaker rule",
13
13
  },
14
+ {
15
+ file: "docs/principles/workflow-baseline-principles.md",
16
+ pattern: "/workflow:work` - implement in isolation with evidence (includes required triage gate)",
17
+ description: "canonical flow routes triage through work by default",
18
+ },
19
+ {
20
+ file: "docs/principles/workflow-baseline-principles.md",
21
+ pattern: "Optional manual command:",
22
+ description: "principles preserve standalone manual triage command",
23
+ },
14
24
  {
15
25
  file: "src/AGENTS.md",
16
26
  pattern: "## Contract Precedence",
@@ -33,12 +43,18 @@ const requiredChecks = [
33
43
  },
34
44
  {
35
45
  file: "README.md",
36
- pattern: "code/config changes require `/workflow:review`",
46
+ anyOf: [
47
+ "code/config changes require `/workflow:review`",
48
+ "Independent review policy:",
49
+ ],
37
50
  description: "README review gate policy",
38
51
  },
39
52
  {
40
53
  file: "README.md",
41
- pattern: "Standards baseline policy:",
54
+ anyOf: [
55
+ "Standards baseline policy:",
56
+ "standards baseline gate",
57
+ ],
42
58
  description: "README standards baseline guardrail",
43
59
  },
44
60
  {
@@ -51,11 +67,21 @@ const requiredChecks = [
51
67
  pattern: "Contract precedence:",
52
68
  description: "triage command precedence note",
53
69
  },
70
+ {
71
+ file: "src/.agents/commands/workflow/triage.md",
72
+ pattern: "independently runnable",
73
+ description: "triage command explicitly standalone while work auto-runs triage",
74
+ },
54
75
  {
55
76
  file: "src/.agents/commands/workflow/work.md",
56
77
  pattern: "Contract precedence:",
57
78
  description: "work command precedence note",
58
79
  },
80
+ {
81
+ file: "src/.agents/commands/workflow/plan.md",
82
+ pattern: "Start `/workflow:work`",
83
+ description: "plan command default next-step routes to work",
84
+ },
59
85
  {
60
86
  file: "src/.agents/commands/workflow/work.md",
61
87
  pattern: "HARD GATE - WORKTREE FIRST",
@@ -160,7 +186,11 @@ const readFile = (relativePath) => {
160
186
 
161
187
  for (const check of requiredChecks) {
162
188
  const contents = readFile(check.file);
163
- if (!contents.includes(check.pattern)) {
189
+ const hasPattern = check.pattern ? contents.includes(check.pattern) : false;
190
+ const hasAnyOf = Array.isArray(check.anyOf)
191
+ ? check.anyOf.some((pattern) => contents.includes(pattern))
192
+ : false;
193
+ if (!hasPattern && !hasAnyOf) {
164
194
  failures.push(`Missing required contract text (${check.description}) in ${check.file}`);
165
195
  }
166
196
  }
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { spawnSync } from "node:child_process";
6
+
7
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
+ const packageRoot = path.resolve(__dirname, "..");
9
+
10
+ function realpathSafe(p) {
11
+ try {
12
+ return fs.realpathSync(p);
13
+ } catch {
14
+ return path.resolve(p);
15
+ }
16
+ }
17
+
18
+ function isTruthy(v) {
19
+ const s = String(v || "").toLowerCase();
20
+ return s === "1" || s === "true" || s === "yes";
21
+ }
22
+
23
+ function hasFile(dir, name) {
24
+ try {
25
+ return fs.existsSync(path.join(dir, name));
26
+ } catch {
27
+ return false;
28
+ }
29
+ }
30
+
31
+ function shouldSkip(targetRoot) {
32
+ if (!targetRoot) return "INIT_CWD not set";
33
+ if (isTruthy(process.env.npm_config_global)) return "global install";
34
+ if (isTruthy(process.env.COMPOUND_WORKFLOW_SKIP_POSTINSTALL)) return "disabled by env";
35
+ if (!hasFile(targetRoot, "package.json")) return "no package.json in target root";
36
+ if (realpathSafe(targetRoot) === realpathSafe(packageRoot)) return "package development install";
37
+ return null;
38
+ }
39
+
40
+ function run() {
41
+ const targetRoot = process.env.INIT_CWD ? path.resolve(process.env.INIT_CWD) : "";
42
+ const skipReason = shouldSkip(targetRoot);
43
+ if (skipReason) {
44
+ console.log(`[compound-workflow] postinstall skipped (${skipReason})`);
45
+ return;
46
+ }
47
+
48
+ const cliPath = path.join(packageRoot, "scripts", "install-cli.mjs");
49
+ const result = spawnSync(
50
+ process.execPath,
51
+ [cliPath, "install", "--root", targetRoot, "--no-config"],
52
+ { stdio: "inherit", env: process.env }
53
+ );
54
+
55
+ if (result.status !== 0) {
56
+ console.warn(
57
+ "[compound-workflow] automatic setup failed; run `npx compound-workflow install` in your project."
58
+ );
59
+ }
60
+ }
61
+
62
+ run();
@@ -75,6 +75,17 @@ You are an independent technical reviewer for plan documents. Your purpose is to
75
75
  - Impact
76
76
  - Suggested improvement
77
77
 
78
+ ### Findings Queue (for stepwise dialogue)
79
+ 1. [Finding title]
80
+ - Summary: [one-line]
81
+ - Intent: [why it matters]
82
+ - Options:
83
+ - A: [path]
84
+ - B: [path]
85
+ - C: [path, optional]
86
+ - Recommendation: [preferred option]
87
+ - Initial status: pending
88
+
78
89
  ### Direction Drift Check
79
90
  - In-scope: yes|no
80
91
  - Drift signals found: [none | list]
@@ -86,6 +97,8 @@ You are an independent technical reviewer for plan documents. Your purpose is to
86
97
  - Preferred option + why
87
98
  ```
88
99
 
100
+ The `Findings Queue` is mandatory when at least one finding exists. It is consumed by `technical-review` for one-finding-at-a-time review (`next` progression).
101
+
89
102
  ## Guardrails
90
103
 
91
104
  - Do not edit the plan in this agent.
@@ -863,17 +863,16 @@ Examples:
863
863
 
864
864
  After writing the plan file, use **AskQuestion** to present these options:
865
865
 
866
- Do not route directly from plan generation to `/workflow:work`.
867
-
868
866
  **Question:** "Plan ready at `docs/plans/YYYY-MM-DD-<type>-<slug>-plan.md`. What would you like to do next?"
869
867
 
870
868
  **Options:**
871
869
 
872
870
  1. **Open plan in editor** - Open the plan file for review
873
871
  2. **Review and refine** - Improve the document through structured self-review
874
- 3. **Start `/workflow:triage`** - Triage todos derived from this plan before execution
875
- 4. **Create Issue** - Create issue in project tracker (GitHub/Linear)
876
- 5. **Other** - Adjust the plan
872
+ 3. **Start `/workflow:work`** - Execute this plan (includes default triage gate)
873
+ 4. **Start `/workflow:triage`** - Manually curate/prioritize queue before execution
874
+ 5. **Create Issue** - Create issue in project tracker (GitHub/Linear)
875
+ 6. **Other** - Adjust the plan
877
876
 
878
877
  Optional (only if those workflows exist in this repo):
879
878
 
@@ -884,6 +883,7 @@ Based on selection:
884
883
 
885
884
  - **Open plan in editor** → Open the plan file in the editor (navigate to `docs/plans/<plan_filename>.md`)
886
885
  - **Review and refine** → Load `document-review` skill.
886
+ - **Start `/workflow:work`** → Run `/workflow:work <plan_path>`; `/workflow:work` must run triage before implementation.
887
887
  - **Start `/workflow:triage`** → Ensure plan todos exist (create via `file-todos` if needed), then run `/workflow:triage` to approve priority/dependencies and the executable ready queue.
888
888
  - **Technical review** → Load `technical-review` skill; then if user agrees to changes, load `document-review` to update the plan.
889
889
  - **Create Issue** → See "Issue Creation" section below
@@ -891,7 +891,7 @@ Based on selection:
891
891
 
892
892
  **Note:** Only if `/deepen-plan` exists in this repo and the user has enabled it (e.g., ultrathink), you may run `/deepen-plan` after plan creation for extra depth; it is optional, not required.
893
893
 
894
- Loop back to options after changes until user selects `/workflow:triage` or ends the session.
894
+ Loop back to options after changes until user selects `/workflow:work`, `/workflow:triage`, or ends the session.
895
895
 
896
896
  ## Issue Creation
897
897
 
@@ -933,6 +933,6 @@ When user selects "Create Issue", detect their project tracker from repo guidanc
933
933
 
934
934
  5. **After creation:**
935
935
  - Display the issue URL
936
- - Ask if they want to proceed to `/workflow:triage`
936
+ - Ask if they want to proceed to `/workflow:work` (default path) or `/workflow:triage` (manual queue curation)
937
937
 
938
938
  NEVER CODE! Just research and write the plan.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: triage
3
3
  invocation: workflow:triage
4
- description: Triage and prioritize todo files into an executable ready queue (priority, dependencies, recommended action)
4
+ description: Manual triage command to prioritize todo files into an executable ready queue (priority, dependencies, recommended action)
5
5
  argument-hint: "[optional: todo path, issue id, status filter ('pending'|'ready'|'active')]"
6
6
  ---
7
7
 
@@ -9,6 +9,8 @@ argument-hint: "[optional: todo path, issue id, status filter ('pending'|'ready'
9
9
 
10
10
  Turn todo items into a prioritized executable queue.
11
11
 
12
+ This command is independently runnable. `/workflow:work` runs the same triage gate automatically before execution.
13
+ Use `/workflow:triage` when you want explicit manual queue curation before or during execution.
12
14
  This command does not implement fixes. It approves and organizes work so `/workflow:work` can execute without ambiguity.
13
15
  Output of this command is the only executable queue for `/workflow:work`.
14
16
 
@@ -100,7 +100,7 @@ The input must be a plan file path.
100
100
  - Continue only when provided commands run successfully.
101
101
  - If commands are not provided or fail, do not mark related todos complete.
102
102
 
103
- Note: full execution preflight (triage + contract checks + isolation checks) runs after todo creation/triage in Step 3.5.
103
+ Note: full execution preflight (auto-triage + contract checks + isolation checks) runs after todo creation in Step 3.5.
104
104
 
105
105
  1.75. **Resolve Plan Scope Contract (REQUIRED)**
106
106
 
@@ -217,20 +217,21 @@ The input must be a plan file path.
217
217
  - Each todo MUST include a link back to the plan file in `Resources` and reference the specific section(s) it implements.
218
218
  - Default todo `status`:
219
219
  - `ready` when the plan is approved and confidence is not low
220
- - `pending` when plan confidence is low or requires explicit triage
220
+ - `pending` when plan confidence is low or requires additional triage decisions
221
221
  - Default todo `priority`: `p2` unless the plan indicates urgency/risk.
222
222
 
223
- After creating todos:
223
+ After creating todos, run an in-command triage pass (same readiness/dependency rules as `/workflow:triage`) before any implementation work:
224
224
 
225
- - Run `/workflow:triage` before any implementation work to approve/prioritize the queue for this plan.
226
- - Do not proceed to Phase 2 until triage completes and execution order is explicit.
227
- - If triage leaves no unblocked `ready` todos, stop and report pending/deferred/blocked items.
225
+ - approve/prioritize queue items for this plan
226
+ - make execution order explicit
227
+ - if no unblocked `ready` todos remain, stop and report pending/deferred/blocked items
228
+ - use standalone `/workflow:triage` only when the user explicitly requests manual queue curation
228
229
 
229
230
  3.5. **Execution Preflight (HARD GATE before Phase 2)**
230
231
 
231
232
  Contract checksum (MUST all be true before implementation):
232
233
 
233
- - triage completed for this plan
234
+ - auto-triage completed for this plan (or standalone `/workflow:triage` completed)
234
235
  - isolation gate recorded (`worktree_decision`, execution context, `gate_status: passed`)
235
236
  - blocking spikes execute before dependent build todos
236
237
 
@@ -241,7 +242,7 @@ The input must be a plan file path.
241
242
  - validation path is explicit (commands/routes/checks)
242
243
  - evidence expectations are explicit
243
244
  - quality gate commands are explicit or marked for ask-once fallback
244
- - If a todo lacks this contract, move it to `pending` for triage before coding.
245
+ - If a todo lacks this contract, move it to `pending` and require triage resolution before coding.
245
246
 
246
247
  ### Phase 2: Execute
247
248
 
@@ -268,7 +269,7 @@ The input must be a plan file path.
268
269
 
269
270
  - If no unblocked `ready` todos remain:
270
271
  - summarize remaining `pending`, `deferred` (parked for reference), and blocked items
271
- - require re-running `/workflow:triage` for pending/blocked prioritization
272
+ - require re-running triage (auto-triage within `/workflow:work` or standalone `/workflow:triage`) for pending/blocked prioritization
272
273
  - stop (do not invent work)
273
274
 
274
275
  For each task in priority order:
@@ -319,7 +320,7 @@ The input must be a plan file path.
319
320
  - If new, non-critical work is discovered, do NOT silently expand scope.
320
321
  - Ask the user to choose one:
321
322
  1) Do now (scope increase): only if small + tightly coupled
322
- 2) Create a triage item: create a new `pending` todo (default `p3` unless urgent) to be approved or deferred via `/workflow:triage`
323
+ 2) Create a triage item: create a new `pending` todo (default `p3` unless urgent) to be approved or deferred via triage
323
324
  3) Park for reference: create a todo with Problem Statement + Findings + rationale, then mark it **deferred** (`*-deferred-*.md`, `status: deferred`) so it is kept for future reference but not in the executable queue
324
325
  4) Compound candidate only: capture as a `/workflow:compound` documentation candidate (no todo by default)
325
326
  - Always record the decision in the todo Work Log.
@@ -368,7 +369,7 @@ The input must be a plan file path.
368
369
  - Convert the decision into explicit todos (implementation/investigation/deferral).
369
370
  - If the chosen option is to run a timeboxed investigation or prototype, follow the **Spike Protocol** below.
370
371
  - Record the decision + rationale in the todo Work Log.
371
- - Re-approve the todo through `/workflow:triage` before returning it to `ready`.
372
+ - Re-approve the todo through triage before returning it to `ready`.
372
373
 
373
374
  **Spike Protocol (allocate a spike)**
374
375
 
@@ -376,7 +377,7 @@ The input must be a plan file path.
376
377
 
377
378
  Steps:
378
379
 
379
- 1. **Spike todo:** Create a new `todos/*-pending-*.md` todo tagged `tags: [spike]` (or convert the current blocked todo to a spike todo). Fill Problem Statement, Proposed Solutions (options), and Acceptance Criteria (deliverable). Carry forward any plan metadata (initial priority, depends_on, unblocks, parallelizable). If triage has not been run, recommend `/workflow:triage` to approve the spike and set timebox + deliverable; then treat the spike as `ready` once approved.
380
+ 1. **Spike todo:** Create a new `todos/*-pending-*.md` todo tagged `tags: [spike]` (or convert the current blocked todo to a spike todo). Fill Problem Statement, Proposed Solutions (options), and Acceptance Criteria (deliverable). Carry forward any plan metadata (initial priority, depends_on, unblocks, parallelizable). Ensure triage approves the spike and sets timebox + deliverable before treating it as `ready`.
380
381
  2. **Isolated execution:** Recommend a dedicated spike worktree. Use `skill: git-worktree` with branch name `spike/<todo_id>-<slug>` (e.g. `spike/003-auth-approach`). Run worktree bootstrap per the git-worktree skill. Execute the spike in that worktree so build work is not mixed with exploration.
381
382
  3. **Research subagents (per spike):** Run mandatory baseline research in parallel:
382
383
  - Always (when agents exist): Task repo-research-analyst(context), Task learnings-researcher(context)
@@ -5,7 +5,7 @@ description: Use when a feature approach or plan doc has passed document review
5
5
 
6
6
  # Technical Review
7
7
 
8
- Review a feature approach or plan document for technical alignment with architecture, code standards, and quality. Output risk level, three options with justifications, and a recommendation. Do not approve for build until the plan is updated via a second document review.
8
+ Review a feature approach or plan document for technical alignment with architecture, code standards, and quality. Keep a running summary of findings, then review findings one at a time through user-driven dialogue (`next`). For each finding, output intent, options, and a recommendation. Do not approve for build until the plan is updated via a second document review.
9
9
 
10
10
  Primary execution model: run an independent planning-phase pass first using `planning-technical-reviewer` (when available), then synthesize final technical review verdict.
11
11
 
@@ -27,6 +27,15 @@ Primary execution model: run an independent planning-phase pass first using `pla
27
27
  - Treat its blocking findings as pre-build blockers.
28
28
  - If the agent is not available, explicitly state: "planning-technical-reviewer unavailable; running direct technical review (degraded bias resistance)".
29
29
 
30
+ ## Step 1.6: Build Findings Queue (Required)
31
+
32
+ - Consolidate all blocking and non-blocking findings into an ordered queue.
33
+ - Keep a persistent `Findings Summary` visible throughout the review with status per finding:
34
+ - `pending`
35
+ - `aligned`
36
+ - `deferred`
37
+ - Do not process findings in bulk. Process one finding at a time.
38
+
30
39
  ## Step 2: Assess Against Technical Criteria
31
40
 
32
41
  Evaluate the plan against:
@@ -52,7 +61,29 @@ Assign one **overall** risk level for the plan:
52
61
 
53
62
  State the risk level and one-line rationale.
54
63
 
55
- ## Step 4: Three Options with Justifications
64
+ ## Step 4: One-Finding Dialogue Loop (Required)
65
+
66
+ For each queued finding, present:
67
+
68
+ - `Finding:` concise summary
69
+ - `Intent:` why this matters technically
70
+ - `Options:` 2-3 viable paths with tradeoffs
71
+ - `Recommendation:` preferred option with rationale
72
+ - `Outcome:` leave as `pending` until user aligns
73
+
74
+ After each finding, stop and prompt exactly:
75
+
76
+ - `Say "next" to continue to the next finding.`
77
+
78
+ Supported user controls in this loop:
79
+
80
+ - `next` -> advance to the next pending finding
81
+ - `accept` -> mark current finding as `aligned`, record chosen outcome
82
+ - `revise: <note>` -> update current finding framing/options/recommendation before moving on
83
+
84
+ Do not skip ahead automatically while findings remain pending.
85
+
86
+ ## Step 5: Three Options with Justifications (Overall Verdict)
56
87
 
57
88
  For each option, provide 2–3 sentences justification:
58
89
 
@@ -60,25 +91,27 @@ For each option, provide 2–3 sentences justification:
60
91
  - **Option B — Proceed with changes** — When risk is medium. List specific doc or code changes; justify why this is sufficient.
61
92
  - **Option C — Rework or spike** — When risk is high or uncertain. Say what to rework or spike; justify why build should wait.
62
93
 
63
- ## Step 5: Recommendation
94
+ ## Step 6: Recommendation (Overall Verdict)
64
95
 
65
96
  State the **preferred option** and clear rationale (e.g. "Recommend Option B because …"). Tie to the risk level and findings.
66
97
 
67
- ## Step 6: Output and Handoff
98
+ ## Step 7: Output and Handoff
68
99
 
69
- - **If pass (Option A or B with changes agreed):** Say "Approved for build" and optional notes. **Handoff:** Run **document review again** to update the plan with technical review findings (recommendation, agreed changes). Then build.
100
+ - **If pass (Option A or B with changes agreed):** Say "Approved for build" and optional notes. **Handoff:** Run **document review again** to update the plan with all aligned technical review findings (recommendation, agreed changes, per-finding outcomes). Then build.
70
101
  - **If issues (Option C or B with open changes):** List issues to fix in the doc; do not approve for build until addressed. Handoff: update the plan (or re-run document review to incorporate fixes), then optionally re-run technical review.
71
102
 
72
103
  ## Required Output
73
104
 
74
105
  End every technical review with:
75
106
 
107
+ - `Findings summary:` full list with status `pending|aligned|deferred`
108
+ - `Per-finding outcomes:` one line each for every aligned finding
76
109
  - `Risk level:` low | medium | high (plus one-line rationale)
77
110
  - `Fresh-context pass:` ran | unavailable (degraded)
78
111
  - `Options A/B/C:` 2–3 sentences each
79
112
  - `Recommendation:` preferred option and rationale
80
113
  - `Approved for build:` yes | no
81
- - `Handoff:` re-run document review to update plan with findings before build (when approved), or list issues to fix (when not approved)
114
+ - `Handoff:` re-run document review to update the plan with related findings and outcomes before build (when approved), or list issues to fix (when not approved)
82
115
 
83
116
  ## What NOT to Do
84
117
 
@@ -86,6 +119,7 @@ End every technical review with:
86
119
  - Do not add scope or new requirements.
87
120
  - Do not approve for build when risk is high and no rework is agreed.
88
121
  - Do not skip the second document review—the plan must be updated with technical review findings before build.
122
+ - Do not collapse multiple findings into one response when interactive finding review is active.
89
123
 
90
124
  ## Integration
91
125
 
package/src/AGENTS.md CHANGED
@@ -26,10 +26,13 @@ This `.agents` workspace is portable and command-first.
26
26
 
27
27
  1. `/workflow:brainstorm` -> clarify what to build
28
28
  2. `/workflow:plan` -> define how to build it
29
- 3. `/workflow:triage` -> approve and prioritize the todo queue before execution
30
- 4. `/workflow:work` -> implement
31
- 5. `/workflow:review` -> validate quality
32
- 6. `/workflow:compound` -> capture durable learnings
29
+ 3. `/workflow:work` -> implement (includes triage gate for todo readiness/prioritization)
30
+ 4. `/workflow:review` -> validate quality
31
+ 5. `/workflow:compound` -> capture durable learnings
32
+
33
+ Optional manual step:
34
+
35
+ - `/workflow:triage` -> explicitly curate/prioritize backlog items before execution when needed
33
36
 
34
37
  Continuous improvement:
35
38
 
@@ -62,7 +65,7 @@ If workflow documents conflict, resolve them in this order:
62
65
  - **Solution scope contract is mandatory in every plan.** Plans must declare `solution_scope` (`partial_fix|full_remediation|migration`) plus explicit completion expectation and non-goals so `/workflow:work` can enforce intent.
63
66
  - **SpecFlow is a validation gate, not a rewrite engine.** High fidelity required; Medium recommended; Low optional. Output must translate into acceptance criteria/edge cases, not new scope.
64
67
  - **Isolation preflight is a hard gate.** `/workflow:work` must complete and record worktree/isolation preflight before any implementation commands. `/workflow:review` must do the same for non-current PR/branch targets before analysis.
65
- - **Triage before execution is mandatory.** `/workflow:work` must not execute todos until a `/workflow:triage` pass has prioritized the queue and validated dependencies/ready state for the current plan.
68
+ - **Triage before execution is mandatory.** `/workflow:work` must run a triage pass before executing todos to prioritize the queue and validate dependencies/ready state for the current plan. `/workflow:triage` remains available as an explicit manual command.
66
69
  - **Spike governance is explicit and ordered.** Risky plans must evaluate spike need, spike candidates must declare initial priority/dependencies/unblocks/timebox/deliverable, triage confirms those assumptions, and `/workflow:work` executes blocking spikes before dependent build todos.
67
70
  - **Agentic access/testability is mandatory in planning.** Every plan must include an executable access + validation contract so work/review can run deterministically.
68
71
  - **Independent review is required for code/config changes.** `/workflow:review` must emit `review_independence_mode: independent|degraded`, plus independence evidence and skipped-pass disclosure.