compound-workflow 1.4.0 → 1.4.2

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
@@ -19,6 +19,7 @@ Runtime assets live in `src/.agents/` and `src/AGENTS.md`. Supports **Cursor**,
19
19
  ```bash
20
20
  npm install compound-workflow
21
21
  npx compound-workflow install
22
+ npx compound-workflow install all
22
23
  ```
23
24
 
24
25
  **2. Choose how you use it:**
@@ -29,7 +30,7 @@ npx compound-workflow install
29
30
 
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.
31
32
 
32
- **CLI options:** `--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).
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).
33
34
 
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.
35
36
 
@@ -57,6 +58,10 @@ flowchart LR
57
58
 
58
59
  ---
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
+
60
65
  ## Step-by-step: intent and commands
61
66
 
62
67
  | Step | Intent | Command | Output / note |
@@ -64,8 +69,8 @@ flowchart LR
64
69
  | Clarify what to build | Dialogue only; no code | `/workflow:brainstorm [topic]` | `docs/brainstorms/` |
65
70
  | Define how (fidelity + confidence) | Plan only; no code; include agentic access + validation contract | `/workflow:plan [description or brainstorm path]` | `docs/plans/` |
66
71
  | Ready the queue | Priority/dependencies + executable agentic contract checks for pending todos | `/workflow:triage` | — |
67
- | Execute | File-based todos; risk-tier testing; evidence-backed completion; no auto-ship | `/workflow:work <plan-path>` | `todos/` |
68
- | Validate quality | Evidence-based review + agentic executability checks; no fixes by default | `/workflow:review [PR, branch, or current]` | pass / pass-with-notes / fail |
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 |
69
74
  | Capture learnings | One solution doc for future use | `/workflow:compound [context]` | `docs/solutions/` |
70
75
  | Log and improve | Session log + optional aggregate review | `/metrics` + `/assess weekly 7` (or monthly) | `docs/metrics/daily/`, weekly/monthly |
71
76
 
@@ -87,9 +92,11 @@ flowchart LR
87
92
 
88
93
  `/workflow:work` must not run until `/workflow:triage` has approved executable ready todos.
89
94
 
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
+
90
97
  #### 5. Validate quality (review)
91
98
 
92
- **Intent:** Evidence-based review + agentic validation coverage checks; no fixes by default. **Command:** `/workflow:review [PR|branch|current]`. **Output:** pass / pass-with-notes / fail.
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.
93
100
 
94
101
  #### 6. Capture learnings (compound)
95
102
 
@@ -151,8 +158,14 @@ Full “when to use what” and reference standards: [src/AGENTS.md](src/AGENTS.
151
158
 
152
159
  - **Todo completion requires evidence:** acceptance/success criteria plus quality gates must be recorded before `complete`.
153
160
 
161
+ - **Independent review policy:** code/config changes require `/workflow:review` before workflow completion; docs-only changes are exempt.
162
+
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.
164
+
154
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.
155
166
 
167
+ - **Artifact policy:** do not create ad-hoc artifacts outside canonical outputs (`docs/plans`, `todos`, `docs/solutions`, `docs/metrics`) unless explicitly requested.
168
+
156
169
  - Add a separate shipping command if you want automated commit/PR and quality gates.
157
170
 
158
171
  ---
@@ -176,4 +189,5 @@ If your project does not already have `.cursor/`, run `npx compound-workflow ins
176
189
  **Source of truth**
177
190
 
178
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)
179
193
  - Principles and skill index: [src/AGENTS.md](src/AGENTS.md)
package/package.json CHANGED
@@ -1 +1,31 @@
1
- {"name":"compound-workflow","version":"1.4.0","description":"Clarify → plan → execute → verify → capture. One Install action for Cursor, Claude, and OpenCode.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/cjerochim/compound-workflow.git"},"bin":{"compound-workflow":"scripts/install-cli.mjs"},"files":["src","scripts",".cursor-plugin",".claude-plugin","skills"],"scripts":{"check:pack-readme":"node scripts/check-pack-readme.mjs"},"engines":{"node":">=18"},"devDependencies":{"@semantic-release/git":"^10.0.1","@semantic-release/npm":"^13.1.4","semantic-release":"^25.0.3"}}
1
+ {
2
+ "name": "compound-workflow",
3
+ "version": "1.4.2",
4
+ "description": "Clarify → plan → execute → verify → capture. One Install action for Cursor, Claude, and OpenCode.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/cjerochim/compound-workflow.git"
9
+ },
10
+ "bin": {
11
+ "compound-workflow": "scripts/install-cli.mjs"
12
+ },
13
+ "files": [
14
+ "src",
15
+ "scripts",
16
+ ".cursor-plugin",
17
+ ".claude-plugin",
18
+ "skills"
19
+ ],
20
+ "scripts": {
21
+ "check:pack-readme": "node scripts/check-pack-readme.mjs"
22
+ },
23
+ "engines": {
24
+ "node": ">=18"
25
+ },
26
+ "devDependencies": {
27
+ "@semantic-release/git": "^10.0.1",
28
+ "@semantic-release/npm": "^13.1.4",
29
+ "semantic-release": "^25.0.3"
30
+ }
31
+ }
@@ -0,0 +1,181 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+
6
+ const root = process.cwd();
7
+
8
+ const requiredChecks = [
9
+ {
10
+ file: "docs/principles/workflow-baseline-principles.md",
11
+ pattern: "tie-breaker",
12
+ description: "baseline principles tie-breaker rule",
13
+ },
14
+ {
15
+ file: "src/AGENTS.md",
16
+ pattern: "## Contract Precedence",
17
+ description: "AGENTS contract precedence section",
18
+ },
19
+ {
20
+ file: "src/AGENTS.md",
21
+ pattern: "No ad-hoc artifacts outside canonical outputs",
22
+ description: "canonical artifact policy in AGENTS",
23
+ },
24
+ {
25
+ file: "src/AGENTS.md",
26
+ pattern: "Standards baseline is mandatory for code/config changes.",
27
+ description: "standards hard-gate policy in AGENTS",
28
+ },
29
+ {
30
+ file: "README.md",
31
+ pattern: "If docs conflict:",
32
+ description: "README conflict resolution note",
33
+ },
34
+ {
35
+ file: "README.md",
36
+ pattern: "code/config changes require `/workflow:review`",
37
+ description: "README review gate policy",
38
+ },
39
+ {
40
+ file: "README.md",
41
+ pattern: "Standards baseline policy:",
42
+ description: "README standards baseline guardrail",
43
+ },
44
+ {
45
+ file: "src/.agents/commands/workflow/plan.md",
46
+ pattern: "Contract precedence:",
47
+ description: "plan command precedence note",
48
+ },
49
+ {
50
+ file: "src/.agents/commands/workflow/triage.md",
51
+ pattern: "Contract precedence:",
52
+ description: "triage command precedence note",
53
+ },
54
+ {
55
+ file: "src/.agents/commands/workflow/work.md",
56
+ pattern: "Contract precedence:",
57
+ description: "work command precedence note",
58
+ },
59
+ {
60
+ file: "src/.agents/commands/workflow/work.md",
61
+ pattern: "HARD GATE - WORKTREE FIRST",
62
+ description: "worktree hard-gate wording in work command",
63
+ },
64
+ {
65
+ file: "src/.agents/commands/workflow/work.md",
66
+ pattern:
67
+ "No file writes, implementation commands, test/lint/typecheck commands, or dependency-install commands may run before this gate passes.",
68
+ description: "pre-gate write/command prohibition in work command",
69
+ },
70
+ {
71
+ file: "src/.agents/commands/workflow/work.md",
72
+ pattern: "workflow_complete: false (pending /workflow:review current)",
73
+ description: "implementation-complete pending-review status in work command",
74
+ },
75
+ {
76
+ file: "src/.agents/commands/workflow/work.md",
77
+ pattern: "Standards Compliance Gate (REQUIRED for code/config changes)",
78
+ description: "required standards gate in work command",
79
+ },
80
+ {
81
+ file: "src/.agents/commands/workflow/work.md",
82
+ pattern: "This gate cannot run until the isolation/worktree gate is passed and recorded (`gate_status: passed`).",
83
+ description: "standards gate ordering with worktree gate",
84
+ },
85
+ {
86
+ file: "src/.agents/commands/workflow/review.md",
87
+ pattern: "Contract precedence:",
88
+ description: "review command precedence note",
89
+ },
90
+ {
91
+ file: "src/.agents/commands/workflow/review.md",
92
+ pattern: "Independent Reviewer Pass (REQUIRED)",
93
+ description: "required independent reviewer pass in review command",
94
+ },
95
+ {
96
+ file: "src/.agents/commands/workflow/review.md",
97
+ pattern: "review_independence_mode: independent|degraded",
98
+ description: "explicit review independence mode in review command",
99
+ },
100
+ {
101
+ file: "src/.agents/commands/workflow/review.md",
102
+ pattern: "what was skipped and why",
103
+ description: "review skipped-pass disclosure requirement",
104
+ },
105
+ {
106
+ file: "src/.agents/commands/workflow/review.md",
107
+ pattern: "standards_compliance: pass|pass-with-notes|fail",
108
+ description: "review standards compliance output field",
109
+ },
110
+ {
111
+ file: "src/.agents/commands/workflow/review.md",
112
+ pattern: "standards `MUST` violations => blocking finding and review recommendation `fail`",
113
+ description: "review must-violation fail criteria",
114
+ },
115
+ {
116
+ file: "src/.agents/skills/standards/SKILL.md",
117
+ pattern: "## Mandatory Baseline (Declarative, Immutable, Maintainable)",
118
+ description: "standards mandatory baseline section",
119
+ },
120
+ {
121
+ file: "src/.agents/skills/standards/SKILL.md",
122
+ pattern: "### MUST NOT",
123
+ description: "standards must-not checklist",
124
+ },
125
+ ];
126
+
127
+ const forbiddenChecks = [
128
+ {
129
+ file: "src/.agents/commands/workflow/work.md",
130
+ pattern: "## When to Use Reviewer Agents",
131
+ description: "legacy optional reviewer section in work command",
132
+ },
133
+ {
134
+ file: "src/.agents/commands/workflow/work.md",
135
+ pattern: "**Don't use by default.**",
136
+ description: "legacy skip-by-default reviewer wording in work command",
137
+ },
138
+ {
139
+ file: "src/.agents/commands/workflow/work.md",
140
+ pattern: "skip specialist reviewers by default",
141
+ description: "legacy skip-by-default specialist reviewer wording",
142
+ },
143
+ {
144
+ file: "src/.agents/commands/workflow/work.md",
145
+ pattern: "Follow project coding standards (see AGENTS.md)",
146
+ description: "legacy advisory-only coding standards wording in work command",
147
+ },
148
+ ];
149
+
150
+ const failures = [];
151
+
152
+ const readFile = (relativePath) => {
153
+ const absolutePath = path.join(root, relativePath);
154
+ if (!fs.existsSync(absolutePath)) {
155
+ failures.push(`Missing file: ${relativePath}`);
156
+ return "";
157
+ }
158
+ return fs.readFileSync(absolutePath, "utf8");
159
+ };
160
+
161
+ for (const check of requiredChecks) {
162
+ const contents = readFile(check.file);
163
+ if (!contents.includes(check.pattern)) {
164
+ failures.push(`Missing required contract text (${check.description}) in ${check.file}`);
165
+ }
166
+ }
167
+
168
+ for (const check of forbiddenChecks) {
169
+ const contents = readFile(check.file);
170
+ if (contents.includes(check.pattern)) {
171
+ failures.push(`Found forbidden contract text (${check.description}) in ${check.file}`);
172
+ }
173
+ }
174
+
175
+ if (failures.length > 0) {
176
+ console.error("Workflow contract drift check failed:");
177
+ for (const failure of failures) console.error(`- ${failure}`);
178
+ process.exit(1);
179
+ }
180
+
181
+ console.log("Workflow contract check passed.");
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * compound-workflow install
4
4
  * One action: opencode.json (load from package) + AGENTS.md merge + dirs + Repo Config Block.
5
- * Run from project: npx compound-workflow install [--root <dir>] [--dry-run] [--no-config]
5
+ * Run from project: npx compound-workflow install [all|--all] [--root <dir>] [--dry-run] [--no-config]
6
6
  */
7
7
  import fs from "node:fs";
8
8
  import path from "node:path";
@@ -14,11 +14,12 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
14
14
  function usage(exitCode = 0) {
15
15
  const msg = `
16
16
  Usage:
17
- npx compound-workflow install [--root <projectDir>] [--dry-run] [--no-config] [--cursor]
17
+ npx compound-workflow install [all|--all] [--root <projectDir>] [--dry-run] [--no-config] [--cursor]
18
18
 
19
19
  One action: writes opencode.json (loads from package), merges AGENTS.md, creates dirs,
20
20
  and prompts for Repo Config Block (unless --no-config).
21
21
 
22
+ all, --all Full install shortcut (enables Cursor integration; creates .cursor if needed)
22
23
  --root <dir> Project directory (default: cwd)
23
24
  --dry-run Print planned changes only
24
25
  --no-config Skip Repo Config Block prompt (only write opencode.json + AGENTS.md + dirs)
@@ -35,6 +36,7 @@ function parseArgs(argv) {
35
36
  if (a === "--dry-run") out.dryRun = true;
36
37
  else if (a === "--no-config") out.noConfig = true;
37
38
  else if (a === "--cursor") out.cursor = true;
39
+ else if (a === "--all" || a === "all") out.cursor = true;
38
40
  else if (a === "--root") {
39
41
  const v = argv[i + 1];
40
42
  if (!v) usage(1);
@@ -309,7 +311,7 @@ function ensureCursorSkills(targetRoot, dryRun, cursorReady) {
309
311
  const blocked = [];
310
312
  for (const name of skillNames) {
311
313
  const linkPath = path.join(skillsDir, name);
312
- const targetRel = path.join("..", "..", "..", "node_modules", "compound-workflow", "src", ".agents", "skills", name);
314
+ const targetRel = path.join("..", "..", "node_modules", "compound-workflow", "src", ".agents", "skills", name);
313
315
  const targetAbs = path.resolve(path.dirname(linkPath), targetRel);
314
316
  let needCreate = true;
315
317
  try {
@@ -345,12 +347,53 @@ function verifyCursorIntegration(targetRoot) {
345
347
  for (const check of checks) {
346
348
  const linkPath = path.join(cursorDir, check.rel);
347
349
  const expectedAbs = path.join(targetRoot, "node_modules", "compound-workflow", "src", ".agents", check.rel);
348
- if (!symlinkPointsTo(linkPath, expectedAbs)) issues.push(`${check.name} is missing or not linked to package`);
350
+ if (!fs.existsSync(linkPath)) issues.push(`${check.name} is missing`);
351
+ else {
352
+ const stat = fs.lstatSync(linkPath);
353
+ if (stat.isSymbolicLink() && !symlinkPointsTo(linkPath, expectedAbs)) {
354
+ issues.push(`${check.name} symlink points to unexpected target`);
355
+ }
356
+ }
357
+ }
358
+
359
+ const packageSkillsDir = path.join(packageRoot, "src", ".agents", "skills");
360
+ if (fs.existsSync(packageSkillsDir)) {
361
+ const missingSkills = [];
362
+ for (const name of fs.readdirSync(packageSkillsDir)) {
363
+ const skillPath = path.join(packageSkillsDir, name);
364
+ if (!fs.statSync(skillPath).isDirectory()) continue;
365
+ if (!fs.existsSync(path.join(skillPath, "SKILL.md"))) continue;
366
+ const cursorSkill = path.join(cursorDir, "skills", name, "SKILL.md");
367
+ if (!fs.existsSync(cursorSkill)) missingSkills.push(name);
368
+ }
369
+ if (missingSkills.length) {
370
+ issues.push(
371
+ `.cursor/skills is missing ${missingSkills.length} package skill(s), e.g. ${missingSkills[0]}`
372
+ );
373
+ }
349
374
  }
350
375
 
351
- const workCommand = path.join(cursorDir, "commands", "workflow", "work.md");
352
- if (!fs.existsSync(workCommand)) {
353
- issues.push(".cursor/commands/workflow/work.md is not reachable after integration");
376
+ const packageRoots = [
377
+ { label: "commands", pkgDir: path.join(packageRoot, "src", ".agents", "commands"), cursorSubdir: "commands" },
378
+ { label: "agents", pkgDir: path.join(packageRoot, "src", ".agents", "agents"), cursorSubdir: "agents" },
379
+ { label: "references", pkgDir: path.join(packageRoot, "src", ".agents", "references"), cursorSubdir: "references" },
380
+ ];
381
+ for (const item of packageRoots) {
382
+ if (!fs.existsSync(item.pkgDir)) continue;
383
+ const pkgFiles = walkFiles(item.pkgDir, () => true);
384
+ let missingCount = 0;
385
+ let firstMissing = null;
386
+ for (const abs of pkgFiles) {
387
+ const rel = path.relative(item.pkgDir, abs);
388
+ const targetFile = path.join(cursorDir, item.cursorSubdir, rel);
389
+ if (!fs.existsSync(targetFile)) {
390
+ missingCount++;
391
+ if (!firstMissing) firstMissing = rel;
392
+ }
393
+ }
394
+ if (missingCount) {
395
+ issues.push(`.cursor/${item.label} is missing ${missingCount} package file(s), e.g. ${firstMissing}`);
396
+ }
354
397
  }
355
398
  return issues;
356
399
  }
@@ -359,7 +402,7 @@ function ensureCursorIntegration(targetRoot, dryRun, forceCursor) {
359
402
  const cursorDir = path.join(targetRoot, ".cursor");
360
403
  let cursorReady = fs.existsSync(cursorDir);
361
404
  if (!fs.existsSync(cursorDir)) {
362
- if (!forceCursor) return { issues: [] };
405
+ if (!forceCursor) return { issues: [], status: "skipped-no-cursor" };
363
406
  if (dryRun) console.log("[dry-run] Would create .cursor directory (Cursor)");
364
407
  else {
365
408
  fs.mkdirSync(cursorDir, { recursive: true });
@@ -388,7 +431,7 @@ function ensureCursorIntegration(targetRoot, dryRun, forceCursor) {
388
431
  if (!dryRun) {
389
432
  for (const issue of verifyCursorIntegration(targetRoot)) issues.push(issue);
390
433
  }
391
- return { issues };
434
+ return { issues, status: "configured" };
392
435
  }
393
436
 
394
437
  function writeOpenCodeJson(targetRoot, dryRun) {
@@ -540,6 +583,11 @@ function main() {
540
583
  ensureSkillsSymlink(targetRoot, args.dryRun);
541
584
  reportOpenCodeIntegration(targetRoot, args.dryRun);
542
585
  const cursorReport = ensureCursorIntegration(targetRoot, args.dryRun, args.cursor);
586
+ if (cursorReport.status === "skipped-no-cursor") {
587
+ console.log("Cursor integration: skipped (.cursor missing). Run install with `all` or `--cursor` to create it.");
588
+ } else {
589
+ console.log("Cursor integration: verified skills, agents, commands, and references.");
590
+ }
543
591
  writeAgentsMd(targetRoot, args.dryRun);
544
592
  ensureDirs(targetRoot, args.dryRun);
545
593
 
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: install
3
3
  invocation: install
4
- description: Install compound-workflow in this project (one action)—opencode.json, AGENTS.md, dirs, and Repo Config Block.
5
- argument-hint: "[--dry-run] [--root <path>] [--no-config]"
4
+ description: Install compound-workflow in this project (one action)—opencode.json, AGENTS.md, dirs, Repo Config Block, and optional Cursor wiring.
5
+ argument-hint: "[all|--all] [--dry-run] [--root <path>] [--no-config] [--cursor]"
6
6
  ---
7
7
 
8
8
  # /install
@@ -24,6 +24,7 @@ Run in the **workspace root** (or the directory the user specifies):
24
24
 
25
25
  ```bash
26
26
  npx compound-workflow@latest install
27
+ npx compound-workflow@latest install all
27
28
  ```
28
29
 
29
30
  Or with a specific root and flags:
@@ -32,11 +33,14 @@ Or with a specific root and flags:
32
33
  npx compound-workflow install --root /path/to/project
33
34
  npx compound-workflow install --dry-run
34
35
  npx compound-workflow install --no-config
36
+ npx compound-workflow install --cursor
35
37
  ```
36
38
 
39
+ - **all / --all**: Full install shortcut; same as `--cursor` (creates `.cursor` if missing, then wires skills/agents/commands/references).
37
40
  - **--dry-run**: Print planned changes only; no writes.
38
41
  - **--root &lt;path&gt;**: Target project directory (default: current directory).
39
42
  - **--no-config**: Skip Repo Config Block reminder; only write opencode.json, AGENTS.md merge, and dirs.
43
+ - **--cursor**: Force Cursor integration (create `.cursor` if missing, then wire skills/agents/commands/references).
40
44
 
41
45
  Do not copy files from a compound-workflow clone; the Install CLI uses the package from `node_modules/compound-workflow`.
42
46
 
@@ -13,6 +13,8 @@ argument-hint: "[feature description, bug report, improvement idea, or brainstor
13
13
 
14
14
  Transform feature descriptions, bug reports, or improvement ideas into well-structured markdown plan files that follow project conventions and best practices. This command provides flexible detail levels to match your needs.
15
15
 
16
+ Contract precedence: if this command conflicts with other workflow docs, follow `docs/principles/workflow-baseline-principles.md`, then `src/AGENTS.md`, then this command.
17
+
16
18
  This workflow MUST choose a planning fidelity and confidence level before final plan construction:
17
19
 
18
20
  - Fidelity: `Low | Medium | High`
@@ -9,6 +9,8 @@ argument-hint: "[PR number, GitHub URL, branch name, or 'current']"
9
9
 
10
10
  Run a structured, evidence-based **code** review. This command produces findings and recommendations; it does not implement fixes by default.
11
11
 
12
+ Contract precedence: if this command conflicts with other workflow docs, follow `docs/principles/workflow-baseline-principles.md`, then `src/AGENTS.md`, then this command.
13
+
12
14
  **If the user provides a document path** (e.g. a plan or spec): redirect to the `technical-review` skill for technical correctness (no edits), and/or the `document-review` skill to refine the document. This command does not review documents.
13
15
 
14
16
  Guardrails (unless explicitly requested):
@@ -101,6 +103,11 @@ Protected artifacts:
101
103
 
102
104
  - `Task learnings-researcher(<target context>)` (related prior solutions)
103
105
  - `Task lint(<changed files context>)` only if `lint_command` is configured in the Repo Config Block
106
+ - Run the standards compliance pass using `skill: standards` as mandatory baseline for code/config changes:
107
+ - evaluate declarative flow
108
+ - evaluate immutable transforms
109
+ - evaluate maintainability boundaries
110
+ - evaluate hidden mutable state
104
111
  - Verify agentic executability from plan/todo artifacts when available:
105
112
  - access prerequisites are explicit
106
113
  - validation commands are explicit and reproducible
@@ -115,6 +122,19 @@ Protected artifacts:
115
122
  - If changes touch existing behavior and risk is medium/high: `Task git-history-analyzer(<target context>)`
116
123
  - If changes depend on framework/library behavior and version constraints: `Task framework-docs-researcher(<topic>)`
117
124
 
125
+ ### Phase 3.5: Independent Reviewer Pass (REQUIRED)
126
+
127
+ Before final verdict, run an explicit independent pass and record:
128
+
129
+ - `review_independence_mode: independent|degraded`
130
+ - `independence_evidence`: what independent pass ran
131
+ - `skipped_passes`: what was skipped and why
132
+
133
+ Mode rules:
134
+
135
+ - `independent` (default): run a distinct fresh-context reviewer pass (separate reviewer/agent perspective from the main synthesis).
136
+ - `degraded`: only when independent reviewer tooling/path is unavailable. Must include explicit disclosure that confidence is reduced and why fallback was used.
137
+
118
138
  Then perform the main review synthesis across:
119
139
 
120
140
  - change summary (surface area, high-risk files)
@@ -124,17 +144,30 @@ Then perform the main review synthesis across:
124
144
  - risk and failure modes
125
145
  - operational considerations (monitoring, rollback)
126
146
  - readability/maintainability
147
+ - standards compliance using `skill: standards` (MUST/MUST NOT baseline)
127
148
 
128
149
  ### Phase 4: Synthesis + Verdict
129
150
 
130
151
  Provide:
131
152
 
132
153
  - Review recommendation: `pass | pass-with-notes | fail`
154
+ - `review_independence_mode: independent|degraded`
155
+ - `verdict_confidence: normal|degraded` (use `degraded` only when `review_independence_mode=degraded`)
156
+ - `standards_compliance: pass|pass-with-notes|fail`
157
+ - `fail`: one or more standards MUST violations (blocking)
158
+ - `pass-with-notes`: no MUST violations, but SHOULD-level maintainability concerns
159
+ - `pass`: no material standards violations
133
160
  - Top risks (1–5 bullets)
134
161
  - Findings list:
135
162
  - severity (`critical | high | medium | low`)
136
163
  - evidence (file references or commands/output)
137
164
  - recommended action (concise)
165
+ - standards classification:
166
+ - standards `MUST` violations => blocking finding and review recommendation `fail`
167
+ - standards `SHOULD` violations => non-blocking finding and review recommendation `pass-with-notes`
168
+ - Independence evidence summary:
169
+ - what independent pass ran
170
+ - what was skipped and why
138
171
  - What ran vs skipped (selected agents/passes)
139
172
  - Validation coverage summary:
140
173
  - tests: pass|fail|not-run
@@ -12,6 +12,8 @@ Turn todo items into a prioritized executable queue.
12
12
  This command does not implement fixes. It approves and organizes work so `/workflow:work` can execute without ambiguity.
13
13
  Output of this command is the only executable queue for `/workflow:work`.
14
14
 
15
+ Contract precedence: if this command conflicts with other workflow docs, follow `docs/principles/workflow-baseline-principles.md`, then `src/AGENTS.md`, then this command.
16
+
15
17
  ## Inputs
16
18
 
17
19
  - Default: triage all active todos under `todos/` (`pending` + `ready`)
@@ -13,6 +13,8 @@ Execute a work plan efficiently while maintaining quality and finishing features
13
13
 
14
14
  This command takes a plan file and executes it systematically. The focus is on completing the work while understanding requirements quickly, following existing patterns, and maintaining quality throughout.
15
15
 
16
+ Contract precedence: if this command conflicts with other workflow docs, follow `docs/principles/workflow-baseline-principles.md`, then `src/AGENTS.md`, then this command.
17
+
16
18
  Non-goals (unless explicitly requested):
17
19
 
18
20
  - Creating commits
@@ -89,22 +91,7 @@ The input must be a plan file path.
89
91
  - Prefer `test_command` and optional `test_fast_command` from `AGENTS.md`.
90
92
  - If missing, ask once for the repo's test command and suggest adding it to `AGENTS.md`.
91
93
 
92
- 1.6. **Agentic Access + Validation Preflight (HARD GATE)**
93
-
94
- Contract checksum (MUST all be true before implementation):
95
-
96
- - triage completed for this plan
97
- - isolation gate recorded (`worktree_decision`, context, `gate_status: passed`)
98
- - blocking spikes execute before dependent build todos
99
-
100
- Before any implementation commands:
101
-
102
- - Verify each `ready` todo has an executable Agentic Execution Contract:
103
- - access preconditions are explicit
104
- - validation path is explicit (commands/routes/checks)
105
- - evidence expectations are explicit
106
- - quality gate commands are explicit or marked for ask-once fallback
107
- - If a todo lacks this contract, move it to `pending` for triage before coding.
94
+ 1.6. **Run-Scoped Quality Gate Fallback Setup (PREP STEP)**
108
95
 
109
96
  Ask-once fallback policy for missing lint/typecheck config:
110
97
 
@@ -113,6 +100,8 @@ The input must be a plan file path.
113
100
  - Continue only when provided commands run successfully.
114
101
  - If commands are not provided or fail, do not mark related todos complete.
115
102
 
103
+ Note: full execution preflight (triage + contract checks + isolation checks) runs after todo creation/triage in Step 3.5.
104
+
116
105
  1.75. **Resolve Plan Scope Contract (REQUIRED)**
117
106
 
118
107
  Before any environment setup or implementation, resolve the plan's scope contract:
@@ -132,11 +121,15 @@ The input must be a plan file path.
132
121
  - `migration`: identify migration verification + rollback checks before executing todos.
133
122
  - `full_remediation`: complete all known gaps in the scoped area before completion.
134
123
 
135
- 2. **Setup Environment (HARD GATE)**
124
+ 2. **Setup Environment (HARD GATE - WORKTREE FIRST)**
136
125
 
137
126
  Determine how to isolate the work for this plan.
138
127
 
139
- No implementation commands or code edits may run before this gate passes.
128
+ This gate MUST run immediately after Step 1.75.
129
+
130
+ No file writes, implementation commands, test/lint/typecheck commands, or dependency-install commands may run before this gate passes.
131
+
132
+ Allowed before gate: read-only inspection only (e.g., `ls`, `rg`, `cat`, `git status`, `git branch`).
140
133
 
141
134
  Default: use a worktree. Opt-out requires explicit user confirmation.
142
135
 
@@ -154,6 +147,8 @@ The input must be a plan file path.
154
147
 
155
148
  If Yes: ask for the new branch name (e.g., `feat/<slug>`, `fix/<slug>`).
156
149
 
150
+ If the user does not explicitly choose "No", proceed with "Yes" by default.
151
+
157
152
  3) If worktree is chosen, run:
158
153
 
159
154
  ```bash
@@ -231,6 +226,23 @@ The input must be a plan file path.
231
226
  - Do not proceed to Phase 2 until triage completes and execution order is explicit.
232
227
  - If triage leaves no unblocked `ready` todos, stop and report pending/deferred/blocked items.
233
228
 
229
+ 3.5. **Execution Preflight (HARD GATE before Phase 2)**
230
+
231
+ Contract checksum (MUST all be true before implementation):
232
+
233
+ - triage completed for this plan
234
+ - isolation gate recorded (`worktree_decision`, execution context, `gate_status: passed`)
235
+ - blocking spikes execute before dependent build todos
236
+
237
+ Before any implementation commands:
238
+
239
+ - Verify each `ready` todo has an executable Agentic Execution Contract:
240
+ - access preconditions are explicit
241
+ - validation path is explicit (commands/routes/checks)
242
+ - evidence expectations are explicit
243
+ - 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
+
234
246
  ### Phase 2: Execute
235
247
 
236
248
  1. **Task Execution Loop**
@@ -382,7 +394,7 @@ The input must be a plan file path.
382
394
  - The plan should reference similar code - read those files first
383
395
  - Match naming conventions exactly
384
396
  - Reuse existing components where possible
385
- - Follow project coding standards (see AGENTS.md)
397
+ - Load and follow `skill: standards` as the mandatory baseline for declarative, immutable, maintainable implementation quality
386
398
  - When in doubt, grep for similar implementations
387
399
 
388
400
  3. **Test Continuously**
@@ -431,19 +443,40 @@ The input must be a plan file path.
431
443
  - If `test_command` is not configured, ask once for the project's test command and suggest adding it to `AGENTS.md`.
432
444
  - If `lint_command` or `typecheck_command` is not configured, ask once for run-provided commands and use them for this run.
433
445
 
434
- 2. **Consider Reviewer Agents** (Optional)
446
+ 2. **Prepare Review Handoff (REQUIRED for code/config changes)**
447
+
448
+ If this run changed code or configuration, prepare an explicit `/workflow:review current` handoff summary:
449
+
450
+ - files changed
451
+ - validations run and outcomes
452
+ - known risks or unresolved notes
453
+
454
+ Docs-only runs may skip this handoff using the docs-only review exemption.
455
+
456
+ 3. **Standards Compliance Gate (REQUIRED for code/config changes)**
435
457
 
436
- Use for complex, risky, or large changes.
458
+ For code/config changes, standards compliance is a hard gate before todo completion:
437
459
 
438
- If this repo defines preferred review agents in `AGENTS.md`, follow that.
460
+ - Use `skill: standards` as the source of truth.
461
+ - This gate cannot run until the isolation/worktree gate is passed and recorded (`gate_status: passed`).
462
+ - Record standards evidence in todo Work Log using the standards evidence format:
463
+ - declarative flow
464
+ - immutable transforms
465
+ - maintainability boundaries
466
+ - hidden mutable state check
467
+ - If any mandatory standards line fails:
468
+ - do not rename todo to `*-complete-*.md`
469
+ - move todo back to `pending`
470
+ - add `tags: [blocker]`
471
+ - record blocking rationale + remediation steps in Work Log
439
472
 
440
- If not configured, skip specialist reviewers by default.
473
+ Docs-only runs: mark this gate `not_applicable` and continue.
441
474
 
442
- 3. **Final Validation**
475
+ 4. **Final Validation**
443
476
  - All todo files created for this plan are marked complete
444
477
  - All tests pass
445
478
  - Linting/typechecking/formatting checks pass (configured or run-provided via ask-once fallback)
446
- - Code follows existing patterns
479
+ - Code follows existing patterns and passes the standards compliance gate
447
480
  - UI validation completed (if applicable)
448
481
  - No console errors or warnings
449
482
  - Scope contract satisfied:
@@ -451,21 +484,26 @@ The input must be a plan file path.
451
484
  - `migration`: migration verification and rollback checks are documented as passing
452
485
  - `full_remediation`: scoped remediation goals are complete per `completion_expectation`
453
486
 
454
- 4. **Update Plan Status**
487
+ 5. **Update Plan Status**
455
488
 
456
489
  If the input document has YAML frontmatter with a `status` field, update it to `completed`:
457
490
  ```
458
491
  status: active → status: completed
459
492
  ```
460
493
 
461
- 5. **Notify User**
494
+ 6. **Notify User**
462
495
  - Summarize what was completed
463
496
  - Note any follow-up work needed
464
497
  - Suggest next steps if applicable
465
498
 
466
- Risk-based recommendation:
499
+ Completion policy:
467
500
 
468
- - If the plan fidelity is `high` or confidence is `low`, recommend running `/workflow:review current` before considering the work complete.
501
+ - If this run changed code or configuration, report status as:
502
+ - `implementation_complete: true`
503
+ - `workflow_complete: false (pending /workflow:review current)`
504
+ - If this run is docs-only (no code/config changes), report status as:
505
+ - `implementation_complete: true`
506
+ - `workflow_complete: true (docs-only review exemption)`
469
507
 
470
508
  Stop here by default.
471
509
 
@@ -475,11 +513,11 @@ If the user wants to ship (commits/PR/screenshots), handle that as a separate ex
475
513
 
476
514
  ## Key Principles
477
515
 
478
- ### Start Fast, Execute Faster
516
+ ### Execute with Deterministic Gates
479
517
 
480
- - Get clarification once at the start, then execute
481
- - Don't wait for perfect understanding - ask questions and move
482
- - The goal is to **finish the feature**, not create perfect process
518
+ - Resolve unclear requirements early, then execute decisively
519
+ - Keep hard gates explicit and non-skippable
520
+ - Optimize for correct, verifiable completion
483
521
 
484
522
  ### The Plan is Your Guide
485
523
 
@@ -498,7 +536,7 @@ If the user wants to ship (commits/PR/screenshots), handle that as a separate ex
498
536
  - Follow existing patterns
499
537
  - Write tests for new code
500
538
  - Run linting/typechecking/formatting as configured in `AGENTS.md` (or run-provided via ask-once fallback)
501
- - Use reviewer agents for complex/risky changes only
539
+ - For code/config changes, require `/workflow:review current` before declaring workflow completion
502
540
 
503
541
  ### Ship Complete Features
504
542
 
@@ -521,25 +559,23 @@ Before marking work complete, verify:
521
559
  - [ ] For `partial_fix`, unresolved work is captured as `pending/deferred` todos
522
560
  - [ ] If shipping is requested, capture any required artifacts (screenshots, release notes) per repo conventions
523
561
 
524
- ## When to Use Reviewer Agents
562
+ ## Review Completion Gate
525
563
 
526
- **Don't use by default.** Use reviewer agents only when:
564
+ For code/config changes, completion of `/workflow:work` is implementation-complete only. Workflow completion requires `/workflow:review current`.
527
565
 
528
- - Large refactor affecting many files (10+)
529
- - Security-sensitive changes (authentication, permissions, data access)
530
- - Performance-critical code paths
531
- - Complex algorithms or business logic
532
- - User explicitly requests thorough review
566
+ Docs-only exception:
533
567
 
534
- For most features: tests + linting + following patterns is sufficient.
568
+ - If no code/config files changed, `/workflow:work` may close as workflow-complete without `/workflow:review`.
569
+ - When taking this exemption, explicitly state "docs-only review exemption" in the final summary.
535
570
 
536
571
  ## Common Pitfalls to Avoid
537
572
 
538
573
  - **Analysis paralysis** - Don't overthink, read the plan and execute
539
574
  - **Skipping clarifying questions** - Ask now, not after building wrong thing
540
575
  - **Skipping the worktree hard gate** - No implementation before Step 2 gate passes
576
+ - **Starting writes before isolation gate** - no file writes or run commands before Step 2
541
577
  - **Ignoring plan references** - The plan has links for a reason
542
578
  - **Testing at the end** - Test continuously or suffer later
543
579
  - **Forgetting todo updates** - Update todo files and plan checkboxes or lose track of progress
544
580
  - **80% done syndrome** - Finish the feature, don't move on early
545
- - **Over-reviewing simple changes** - Save reviewer agents for complex work
581
+ - **Skipping required review on code/config changes** - workflow completion requires `/workflow:review current`
@@ -5,6 +5,43 @@ description: General coding practices, implementation styles, and patterns for t
5
5
 
6
6
  # Altai Code Standards
7
7
 
8
+ ## Mandatory Baseline (Declarative, Immutable, Maintainable)
9
+
10
+ These rules are mandatory for code/config implementation work. They are pass/fail gates, not advisory guidance.
11
+
12
+ ### MUST
13
+
14
+ - **MUST keep orchestration declarative** in containers/controllers: describe state transitions and event flow explicitly instead of imperative step-by-step control logic.
15
+ - **MUST use immutable transforms** for domain and controller data operations (`input -> output`), returning new values instead of mutating existing objects/arrays.
16
+ - **MUST keep domain logic in pure entity functions** (no side effects, no hidden mutable module state, no IO in entity transforms/predicates).
17
+ - **MUST keep maintainability boundaries clear**:
18
+ - containers wire/select/send and avoid business rules
19
+ - controllers manage state transitions and delegate reusable logic to entities
20
+ - presentation components remain UI-focused
21
+ - **MUST keep branching complexity controlled** with early exits and extracted helpers when conditional logic grows.
22
+
23
+ ### MUST NOT
24
+
25
+ - **MUST NOT implement mutation-heavy imperative handlers** that modify shared state in-place across multiple steps.
26
+ - **MUST NOT use hidden mutable accumulators** (`let` variables mutated through control flow) when a pure transform is feasible.
27
+ - **MUST NOT mix business decision logic into containers/presentation** when it belongs in domain entities/controllers.
28
+ - **MUST NOT allow branching sprawl** in controllers/containers (deep nesting, chained `else-if`, or nested ternaries for workflow logic).
29
+ - **MUST NOT complete code/config work without standards evidence** recorded in work/review outputs.
30
+
31
+ ### Required Evidence Format (Work and Review)
32
+
33
+ Use this format when reporting standards compliance in execution or review evidence:
34
+
35
+ ```markdown
36
+ standards_compliance:
37
+ - declarative_flow: pass|fail (evidence: file:line)
38
+ - immutable_transforms: pass|fail (evidence: file:line)
39
+ - maintainability_boundaries: pass|fail (evidence: file:line)
40
+ - hidden_mutable_state: pass|fail (evidence: file:line)
41
+ ```
42
+
43
+ If any mandatory line is `fail`, code/config work is not complete.
44
+
8
45
  ## Core Principles
9
46
 
10
47
  1. **Simplicity over cleverness** - Prefer straightforward solutions
package/src/AGENTS.md CHANGED
@@ -44,6 +44,15 @@ This workspace currently implements `brainstorm`, `plan`, `triage`, `work`, `rev
44
44
 
45
45
  Use the canonical command names (`/workflow:plan`, `/workflow:work`, `/workflow:review`, etc.). This template does not ship aliases.
46
46
 
47
+ ## Contract Precedence
48
+
49
+ If workflow documents conflict, resolve them in this order:
50
+
51
+ 1. `docs/principles/workflow-baseline-principles.md`
52
+ 2. This file (`src/AGENTS.md`) non-negotiables and repo config
53
+ 3. Workflow command specs (`src/.agents/commands/workflow/*.md`)
54
+ 4. Skill docs (`src/.agents/skills/*/SKILL.md`)
55
+
47
56
  ## Non-negotiables (Structure Integrity)
48
57
 
49
58
  - **Commands are the public API.** Keep `/workflow:*` command docs stable; add capability via skills/agents, not new command variants.
@@ -56,11 +65,13 @@ Use the canonical command names (`/workflow:plan`, `/workflow:work`, `/workflow:
56
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.
57
66
  - **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.
58
67
  - **Agentic access/testability is mandatory in planning.** Every plan must include an executable access + validation contract so work/review can run deterministically.
68
+ - **Independent review is required for code/config changes.** `/workflow:review` must emit `review_independence_mode: independent|degraded`, plus independence evidence and skipped-pass disclosure.
69
+ - **Standards baseline is mandatory for code/config changes.** `/workflow:work` and `/workflow:review` must apply `skill: standards` as a hard gate for declarative flow, immutable transforms, and maintainability boundaries.
59
70
  - **Todo completion requires evidence.** A todo may move to `complete` only after success criteria evidence and quality gate evidence are recorded in Work Log.
60
71
  - **Blockers change todo state immediately.** Blocked work must move from `ready` back to `pending` with `tags: [blocker]` and an options+recommendation decision record.
61
72
  - **Quality gates are enforced with ask-once fallback.** If `lint_command` or `typecheck_command` is missing, ask once per run and continue only when commands are provided and pass.
62
73
  - **Skills are invoked only by trigger.** `document-review` only when user selects "Review and refine" (or explicit request); guardrail skills (PII/financial/audit/data) only when the feature touches that domain.
63
- - **No new files/directories by default** beyond `docs/plans/...` for planning output.
74
+ - **No ad-hoc artifacts outside canonical outputs** (`docs/plans`, `todos`, `docs/solutions`, `docs/metrics`) unless explicitly requested.
64
75
  - **Plan file is the artifact.** Post-generation options are actions on the artifact; they do not change the workflow shape.
65
76
  - **Tighten over expand.** Resolve ambiguity, standardize naming, enforce sections—avoid adding new process steps unless they reduce rework.
66
77