compound-workflow 1.4.3 → 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 +55 -164
- package/package.json +2 -1
- package/scripts/check-workflow-contracts.mjs +33 -3
- package/scripts/postinstall.mjs +62 -0
- package/src/.agents/commands/workflow/plan.md +7 -7
- package/src/.agents/commands/workflow/triage.md +3 -1
- package/src/.agents/commands/workflow/work.md +13 -12
- package/src/AGENTS.md +8 -5
package/README.md
CHANGED
|
@@ -1,193 +1,84 @@
|
|
|
1
|
-
# Compound Workflow
|
|
1
|
+
# Compound Workflow
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
7
|
+
Inspired by [Compound Engineering](https://every.to/guides/compound-engineering) (Every).
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
Best fit when you need:
|
|
8
10
|
|
|
9
|
-
|
|
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
|
-
|
|
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["
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
-
|
|
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
|
-
|
|
33
|
+
Install configures:
|
|
162
34
|
|
|
163
|
-
-
|
|
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
|
-
|
|
39
|
+
## Critical Path
|
|
166
40
|
|
|
167
|
-
|
|
41
|
+
After install, use this default sequence:
|
|
168
42
|
|
|
169
|
-
|
|
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
|
-
|
|
51
|
+
- `/workflow:triage` for manual backlog curation before or during execution
|
|
52
|
+
- `/metrics` and `/assess` for process improvement
|
|
174
53
|
|
|
175
|
-
|
|
54
|
+
## Commands (Quick Map)
|
|
176
55
|
|
|
177
|
-
|
|
56
|
+
Core flow: `/workflow:brainstorm` -> `/workflow:plan` -> `/workflow:work` -> `/workflow:review` -> `/workflow:compound` -> `/metrics` (optional `/assess` for rollups).
|
|
178
57
|
|
|
179
|
-
|
|
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
|
-
##
|
|
73
|
+
## Learn More
|
|
184
74
|
|
|
185
|
-
|
|
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
|
-
|
|
79
|
+
If docs conflict: follow `docs/principles/workflow-baseline-principles.md`, then `src/AGENTS.md`, then command docs.
|
|
188
80
|
|
|
189
|
-
|
|
81
|
+
Guardrails:
|
|
190
82
|
|
|
191
|
-
-
|
|
192
|
-
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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();
|
|
@@ -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:
|
|
875
|
-
4. **
|
|
876
|
-
5. **
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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
|
-
-
|
|
226
|
-
-
|
|
227
|
-
-
|
|
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`
|
|
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
|
|
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
|
|
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).
|
|
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)
|
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:
|
|
30
|
-
4. `/workflow:
|
|
31
|
-
5. `/workflow:
|
|
32
|
-
|
|
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
|
|
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.
|