create-harness-vibe-coding 0.8.7 → 0.8.9

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.
Files changed (126) hide show
  1. package/README-CN.md +163 -105
  2. package/README.md +179 -244
  3. package/bin/create-harness-vibe-coding.js +2 -2
  4. package/docs/images/harness-architecture-light.png +0 -0
  5. package/docs/images/harness-architecture.drawio +164 -0
  6. package/docs/images/harness-icon.png +0 -0
  7. package/package.json +47 -44
  8. package/src/generator.js +41 -5
  9. package/src/index.js +86 -13
  10. package/src/prompts.js +37 -37
  11. package/templates/common/.claude/agents/architect-manager.md +45 -45
  12. package/templates/common/.claude/agents/architect.md +31 -31
  13. package/templates/common/.claude/agents/codebase-explorer.md +45 -0
  14. package/templates/common/.claude/agents/context-master.md +75 -75
  15. package/templates/common/.claude/agents/debugger.md +41 -41
  16. package/templates/common/.claude/agents/docs-researcher.md +41 -41
  17. package/templates/common/.claude/agents/explore-manager.md +41 -41
  18. package/templates/common/.claude/agents/implement-manager.md +49 -49
  19. package/templates/common/.claude/agents/implementer.md +40 -40
  20. package/templates/common/.claude/agents/memory-master.md +82 -64
  21. package/templates/common/.claude/agents/planner.md +34 -34
  22. package/templates/common/.claude/agents/researcher.md +41 -41
  23. package/templates/common/.claude/agents/review-manager.md +56 -56
  24. package/templates/common/.claude/agents/reviewer.md +34 -34
  25. package/templates/common/.claude/agents/task-scribe.md +70 -0
  26. package/templates/common/.claude/agents/verifier.md +29 -29
  27. package/templates/common/.claude/commands/wf-help.md +9 -5
  28. package/templates/common/.claude/commands/wf-update.md +24 -0
  29. package/templates/common/.claude/rules/ecc/common.md +57 -44
  30. package/templates/common/.claude/settings.json +13 -0
  31. package/templates/common/.claude/skills/subagent-orchestrator/SKILL.md +8 -4
  32. package/templates/common/.claude/skills/wf/SKILL.md +15 -8
  33. package/templates/common/.claude/skills/wf-auto/SKILL.md +10 -7
  34. package/templates/common/.claude/skills/wf-learn/SKILL.md +9 -2
  35. package/templates/common/.claude/skills/wf-max/SKILL.md +23 -5
  36. package/templates/common/.claude/skills/wf-readme/SKILL.md +49 -49
  37. package/templates/common/.claude/skills/wf-remove/SKILL.md +7 -7
  38. package/templates/common/.claude/skills/wf-update/SKILL.md +15 -2
  39. package/templates/common/.codex/hooks.json +17 -0
  40. package/templates/common/.harness-version +130 -45
  41. package/templates/common/.opencode/agents/architect-manager.md +52 -0
  42. package/templates/common/.opencode/agents/architect.md +35 -0
  43. package/templates/common/.opencode/agents/codebase-explorer.md +45 -0
  44. package/templates/common/.opencode/agents/context-master.md +81 -0
  45. package/templates/common/.opencode/agents/debugger.md +43 -0
  46. package/templates/common/.opencode/agents/docs-researcher.md +42 -0
  47. package/templates/common/.opencode/agents/explore-manager.md +49 -0
  48. package/templates/common/.opencode/agents/implement-manager.md +56 -0
  49. package/templates/common/.opencode/agents/implementer.md +42 -0
  50. package/templates/common/.opencode/agents/memory-master.md +88 -0
  51. package/templates/common/.opencode/agents/planner.md +38 -0
  52. package/templates/common/.opencode/agents/reflector.md +39 -0
  53. package/templates/common/.opencode/agents/researcher.md +42 -0
  54. package/templates/common/.opencode/agents/review-manager.md +63 -0
  55. package/templates/common/.opencode/agents/reviewer.md +37 -0
  56. package/templates/common/.opencode/agents/task-scribe.md +70 -0
  57. package/templates/common/.opencode/agents/tdd-guide.md +83 -0
  58. package/templates/common/.opencode/agents/test-writer.md +54 -0
  59. package/templates/common/.opencode/agents/verifier.md +37 -0
  60. package/templates/common/.opencode/commands/wf-auto-spark.md +15 -0
  61. package/templates/common/.opencode/commands/wf-auto.md +15 -0
  62. package/templates/common/.opencode/commands/wf-help.md +27 -0
  63. package/templates/common/.opencode/commands/wf-learn.md +15 -0
  64. package/templates/common/.opencode/commands/wf-max.md +15 -0
  65. package/templates/common/.opencode/commands/wf-readme.md +15 -0
  66. package/templates/common/.opencode/commands/wf-remove.md +15 -0
  67. package/templates/common/.opencode/commands/wf-review.md +15 -0
  68. package/templates/common/.opencode/commands/wf-update.md +24 -0
  69. package/templates/common/.opencode/commands/wf.md +15 -0
  70. package/templates/common/.opencode/plugins/harness-wf-status.mjs +135 -0
  71. package/templates/common/AGENTS.md +2 -29
  72. package/templates/common/CLAUDE.md +114 -88
  73. package/templates/common/Harness/ACCEPTANCE_PROTOCOL.md +2 -2
  74. package/templates/common/{MEMORY.md → Harness/MEMORY.md} +17 -4
  75. package/templates/common/Harness/MEMORY_PROTOCOL.md +80 -30
  76. package/templates/common/Harness/PROGRESS.md +17 -17
  77. package/templates/common/Harness/README.md +58 -19
  78. package/templates/common/{SETUP.md → Harness/SETUP.md} +278 -276
  79. package/templates/common/Harness/TASK_ARCHIVE.md +56 -0
  80. package/templates/common/Harness/WF-AUTO-ANGLES.md +170 -0
  81. package/templates/common/Harness/WF-AUTO-SPARK.md +10 -19
  82. package/templates/common/Harness/WF-AUTO.md +93 -167
  83. package/templates/common/Harness/WF-KERNEL.md +189 -0
  84. package/templates/common/Harness/WF-MAX.md +60 -328
  85. package/templates/common/Harness/WF-STATE.md +83 -0
  86. package/templates/common/Harness/WF.md +117 -237
  87. package/templates/common/Harness/agent-workflow.md +2 -2
  88. package/templates/common/Harness/architecture.md +124 -124
  89. package/templates/common/Harness/context-loading.md +111 -111
  90. package/templates/common/Harness/dispatch.md +43 -35
  91. package/templates/common/Harness/extension.md +66 -66
  92. package/templates/common/Harness/lifecycle.md +20 -20
  93. package/templates/common/Harness/research/PRD.md +56 -56
  94. package/templates/common/Harness/research/README.md +169 -169
  95. package/templates/common/Harness/research/research-results.md +66 -66
  96. package/templates/common/Harness/scripts/archive-tasks.mjs +239 -0
  97. package/templates/common/{scripts → Harness/scripts}/scan-clean.mjs +443 -416
  98. package/templates/common/{scripts → Harness/scripts}/validate-harness.mjs +691 -452
  99. package/templates/common/Harness/scripts/wf-auto-update-prompt.mjs +258 -0
  100. package/templates/common/{scripts → Harness/scripts}/wf-remove.mjs +56 -39
  101. package/templates/common/{scripts → Harness/scripts}/wf-update-check.mjs +632 -599
  102. package/templates/common/Harness/subagents.md +215 -214
  103. package/templates/common/Harness/tasks/_template/ARTIFACTS.md +2 -2
  104. package/templates/common/Harness/tasks/_template/NOTES.md +2 -2
  105. package/templates/common/Harness/tasks/_template/PLAN.md +5 -0
  106. package/templates/common/Harness/tasks/_template/STATE.json +23 -0
  107. package/templates/common/README.md +37 -37
  108. package/templates/common/memory/agent-lessons-patterns.md +22 -21
  109. package/templates/common/memory/routes.md +43 -0
  110. package/templates/common/memory/startup-hints.md +32 -0
  111. package/templates/common/memory/tool-usage-reflections.md +22 -21
  112. package/templates/common/memory/user-corrections-preferences.md +23 -21
  113. package/templates/common/opencode.json +19 -0
  114. package/templates/optional/catalog.json +49 -33
  115. package/templates/optional/skills/browser-e2e/.claude/skills/browser-e2e/SKILL.md +42 -42
  116. package/templates/optional/skills/browser-e2e/.claude/skills/wf-browser/SKILL.md +193 -193
  117. package/templates/optional/skills/browser-e2e/.opencode/commands/wf-browser.md +15 -0
  118. package/templates/optional/skills/browser-e2e/Harness/workflows/browser-e2e.md +48 -48
  119. package/templates/optional/skills/github-pr-review/.claude/skills/github-pr-review/SKILL.md +40 -40
  120. package/templates/optional/skills/github-pr-review/Harness/workflows/github-pr-review.md +28 -28
  121. package/templates/optional/skills/python-backend/.claude/skills/python-backend/SKILL.md +40 -40
  122. package/templates/optional/skills/python-backend/Harness/workflows/python-backend.md +34 -34
  123. package/templates/optional/skills/ts-react-frontend/.claude/skills/ts-react-frontend/SKILL.md +43 -43
  124. package/templates/optional/skills/ts-react-frontend/Harness/workflows/ts-react-frontend.md +34 -34
  125. package/templates/optional/skills/ui-ux-review/.claude/skills/ui-ux-review/SKILL.md +40 -40
  126. package/templates/optional/skills/ui-ux-review/Harness/workflows/ui-ux-review.md +26 -26
@@ -0,0 +1,37 @@
1
+ ---
2
+ description: Use to run verification commands, inspect results, and record evidence. Final acceptance still waits for cross-review PASS and reflector PASS.
3
+ mode: subagent
4
+ permission:
5
+ edit: deny
6
+ task: deny
7
+ websearch: deny
8
+ webfetch: deny
9
+ ---
10
+
11
+ # Verifier
12
+
13
+ You are a verification agent for this project harness.
14
+
15
+ Load first:
16
+
17
+ - `Harness/tasks/<task-id>/PROGRESS.md` and `Harness/tasks/<task-id>/PLAN.md` when available
18
+ - current feature doc when present
19
+ - verification commands and acceptance criteria
20
+
21
+ Rules:
22
+
23
+ - Do not write code.
24
+ - Run only declared verification commands unless asked to expand coverage.
25
+ - If a command is unavailable, record why and suggest a manual check.
26
+ - Mark results as pass, fail, or not run with notes.
27
+ - Do not mark work verified without evidence.
28
+ - Do not claim final acceptance. Verification evidence is necessary but final
29
+ acceptance waits for cross-review PASS and reflector PASS.
30
+
31
+ Return:
32
+
33
+ - commands run
34
+ - result per command
35
+ - acceptance criteria status
36
+ - residual risk
37
+ - patch-ready verification update for `PLAN.md` or feature doc
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Run perpetual inspiration mode via the wf-auto-spark skill
3
+ ---
4
+
5
+ # /wf-auto-spark
6
+
7
+ This is a **workflow command**, not a direct command. Do not execute it as a
8
+ static help or script command.
9
+
10
+ 1. Load `CLAUDE.md`, `Harness/MEMORY.md` (index only per Memory Preflight), then `Harness/README.md`.
11
+ 2. Execute per the skill adapter `.claude/skills/wf-auto-spark/SKILL.md` (mirror: `.agents/skills/wf-auto-spark/SKILL.md`).
12
+ 3. Do not duplicate the workflow here. The skill adapter and `Harness/WF-AUTO-SPARK.md` are authoritative.
13
+
14
+ If this runtime cannot invoke the skill directly, read
15
+ `.claude/skills/wf-auto-spark/SKILL.md` and follow it in place.
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Run perpetual adaptive auto-optimization via the wf-auto skill
3
+ ---
4
+
5
+ # /wf-auto
6
+
7
+ This is a **workflow command**, not a direct command. Do not execute it as a
8
+ static help or script command.
9
+
10
+ 1. Load `CLAUDE.md`, `Harness/MEMORY.md` (index only per Memory Preflight), then `Harness/README.md`.
11
+ 2. Execute per the skill adapter `.claude/skills/wf-auto/SKILL.md` (mirror: `.agents/skills/wf-auto/SKILL.md`).
12
+ 3. Do not duplicate the workflow here. The skill adapter and `Harness/WF-AUTO.md` are authoritative.
13
+
14
+ If this runtime cannot invoke the skill directly, read
15
+ `.claude/skills/wf-auto/SKILL.md` and follow it in place.
@@ -0,0 +1,27 @@
1
+ ---
2
+ description: Show the Harness WF command table
3
+ ---
4
+ # /wf-help
5
+
6
+ Return this help table directly. Do not invoke a skill, do not start WF mode,
7
+ do not dispatch agents, and do not edit files.
8
+
9
+ | Command | Type | Usage | Purpose |
10
+ | --- | --- | --- | --- |
11
+ | `/wf-help` | direct command | `/wf-help` | Show this command table. |
12
+ | `/wf <task>` | workflow skill | `/wf fix failing login flow` | Tiered WF: WF-Light (low-risk, planner/test/verifier), WF-Standard (multi-file, compact ACs), WF-Full (high-risk/cross-layer, full role chain). |
13
+ | `/wf-max <task>` | workflow skill | `/wf-max refactor auth module` | WF-Max-Useful default (fan-out only where independent), WF-Max-Strict override (unconditional fan-out). |
14
+ | `/wf-auto` | workflow skill | `/wf-auto` | Perpetual adaptive auto-optimization using project evidence, dynamic probes, risk obligations, evidence ledger, and confirmation-based exhaustion. |
15
+ | `/wf-auto-spark` | workflow skill | `/wf-auto-spark` | Perpetual inspiration mode with roadmap anchoring and external spark search. |
16
+ | `/wf-review <focus>` | workflow skill | `/wf-review security and test coverage` | Cross-model peer review through the other CLI; use for second opinions and risk checks. |
17
+ | `/wf-learn` | workflow skill | `/wf-learn` | Force context-master -> memory-master learning cycle after repeated failures or closeout. |
18
+ | `/wf-readme <task>` | workflow skill | `/wf-readme polish quickstart` | Preserve, merge, or improve README docs without trampling existing project documentation. |
19
+ | `/wf-update` | direct command | `/wf-update` | Check/apply Harness scaffold updates with safe file classification and conflict handling. |
20
+ | `/wf-remove` | workflow skill | `/wf-remove` | Safely remove Harness files while preserving project/user data unless explicitly purged. |
21
+
22
+ Source of truth: `Harness/README.md#Skill Commands` plus installed skills under
23
+ `.claude/skills/` (Claude Code) or `.agents/skills/` (Codex). In OpenCode the
24
+ same skills load from `.claude/skills/`, `.agents/skills/`, and `.opencode/skills/`.
25
+ In OpenCode, every workflow command above is also visible as a thin command
26
+ wrapper under `.opencode/commands/` (e.g. `/wf`, `/wf-max`); each wrapper only
27
+ routes to the matching skill adapter and does not duplicate the workflow.
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Run the context-master -> memory-master learning cycle via the wf-learn skill
3
+ ---
4
+
5
+ # /wf-learn
6
+
7
+ This is a **workflow command**, not a direct command. Do not execute it as a
8
+ static help or script command.
9
+
10
+ 1. Load `CLAUDE.md`, `Harness/MEMORY.md` (index only per Memory Preflight), then `Harness/README.md`.
11
+ 2. Execute per the skill adapter `.claude/skills/wf-learn/SKILL.md` (mirror: `.agents/skills/wf-learn/SKILL.md`).
12
+ 3. Do not duplicate the workflow here. The skill adapter and `Harness/MEMORY_PROTOCOL.md` are authoritative.
13
+
14
+ If this runtime cannot invoke the skill directly, read
15
+ `.claude/skills/wf-learn/SKILL.md` and follow it in place.
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Run the WF-MAX maximum-safe-parallelism workflow via the wf-max skill
3
+ ---
4
+
5
+ # /wf-max
6
+
7
+ This is a **workflow command**, not a direct command. Do not execute it as a
8
+ static help or script command.
9
+
10
+ 1. Load `CLAUDE.md`, `Harness/MEMORY.md` (index only per Memory Preflight), then `Harness/README.md`.
11
+ 2. Execute per the skill adapter `.claude/skills/wf-max/SKILL.md` (mirror: `.agents/skills/wf-max/SKILL.md`).
12
+ 3. Do not duplicate the workflow here. The skill adapter and `Harness/WF-MAX.md` are authoritative.
13
+
14
+ If this runtime cannot invoke the skill directly, read
15
+ `.claude/skills/wf-max/SKILL.md` and follow it in place.
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Run the README preservation and improvement workflow via the wf-readme skill
3
+ ---
4
+
5
+ # /wf-readme
6
+
7
+ This is a **workflow command**, not a direct command. Do not execute it as a
8
+ static help or script command.
9
+
10
+ 1. Load `CLAUDE.md`, `Harness/MEMORY.md` (index only per Memory Preflight), then `Harness/README.md`.
11
+ 2. Execute per the skill adapter `.claude/skills/wf-readme/SKILL.md` (mirror: `.agents/skills/wf-readme/SKILL.md`).
12
+ 3. Do not duplicate the workflow here. The skill adapter and the project root \`README.md\` ownership rules are authoritative.
13
+
14
+ If this runtime cannot invoke the skill directly, read
15
+ `.claude/skills/wf-readme/SKILL.md` and follow it in place.
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Run safe harness removal via the wf-remove skill
3
+ ---
4
+
5
+ # /wf-remove
6
+
7
+ This is a **workflow command**, not a direct command. Do not execute it as a
8
+ static help or script command.
9
+
10
+ 1. Load `CLAUDE.md`, `Harness/MEMORY.md` (index only per Memory Preflight), then `Harness/README.md`.
11
+ 2. Execute per the skill adapter `.claude/skills/wf-remove/SKILL.md` (mirror: `.agents/skills/wf-remove/SKILL.md`).
12
+ 3. Do not duplicate the workflow here. The skill adapter and `Harness/scripts/wf-remove.mjs` are authoritative.
13
+
14
+ If this runtime cannot invoke the skill directly, read
15
+ `.claude/skills/wf-remove/SKILL.md` and follow it in place.
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Run cross-model peer review via the wf-review skill
3
+ ---
4
+
5
+ # /wf-review
6
+
7
+ This is a **workflow command**, not a direct command. Do not execute it as a
8
+ static help or script command.
9
+
10
+ 1. Load `CLAUDE.md`, `Harness/MEMORY.md` (index only per Memory Preflight), then `Harness/README.md`.
11
+ 2. Execute per the skill adapter `.claude/skills/wf-review/SKILL.md` (mirror: `.agents/skills/wf-review/SKILL.md`).
12
+ 3. Do not duplicate the workflow here. The skill adapter and the wf-review cross-model contract are authoritative.
13
+
14
+ If this runtime cannot invoke the skill directly, read
15
+ `.claude/skills/wf-review/SKILL.md` and follow it in place.
@@ -0,0 +1,24 @@
1
+ # /wf-update
2
+
3
+ Run the Harness update checker script. Do not invoke a skill or start WF mode.
4
+
5
+ ## Flow
6
+
7
+ 1. Run `node Harness/scripts/wf-update-check.mjs --json` and use the `agent` block as the action plan.
8
+ 2. Preserve all PRESERVE files. Never overwrite user task, memory, research, README, package, or architecture files.
9
+ 3. If `agent.safeApplyCommand` is present, run it to apply SAFE/NEW files first.
10
+ 4. For conflicts, compare local with `templateHint` or `remoteUrl`, decide merge/keep-local/overwrite, and record via `--accept-local`, `--accept-merged`, or `--accept-template`.
11
+ 5. Run `node Harness/scripts/wf-update-check.mjs --finalize` after all conflicts resolved.
12
+ 6. After update, run `node Harness/scripts/validate-harness.mjs` and `node Harness/scripts/scan-clean.mjs`.
13
+
14
+ Codex users without a direct command surface: use `$wf-update` (skill path) or `node Harness/scripts/wf-update-check.mjs`.
15
+
16
+ ## Recovery
17
+
18
+ If the script reports `Harness/.harness-version not found` or the update checker script itself is missing (`Harness/scripts/wf-update-check.mjs`), the Harness install predates version-tracking. Recover by regenerating missing infrastructure without overwriting user files:
19
+
20
+ ```
21
+ npx create-harness-vibe-coding@latest <project-name> . -y --on-conflict skip
22
+ ```
23
+
24
+ This creates missing Harness files while preserving CLAUDE.md, README.md, tasks, memory, research, and all user data. After recovery, re-run the update check.
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Run the tiered WF workflow (WF-Light/Standard/Full) via the wf skill
3
+ ---
4
+
5
+ # /wf
6
+
7
+ This is a **workflow command**, not a direct command. Do not execute it as a
8
+ static help or script command.
9
+
10
+ 1. Load `CLAUDE.md`, `Harness/MEMORY.md` (index only per Memory Preflight), then `Harness/README.md`.
11
+ 2. Execute per the skill adapter `.claude/skills/wf/SKILL.md` (mirror: `.agents/skills/wf/SKILL.md`).
12
+ 3. Do not duplicate the workflow here. The skill adapter and `Harness/WF.md` are authoritative.
13
+
14
+ If this runtime cannot invoke the skill directly, read
15
+ `.claude/skills/wf/SKILL.md` and follow it in place.
@@ -0,0 +1,135 @@
1
+ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
2
+ import { spawnSync } from 'node:child_process';
3
+ import { dirname, resolve } from 'node:path';
4
+
5
+ const WF_COMMANDS = new Map([
6
+ ['wf', 'WF'],
7
+ ['wf-max', 'WF-MAX'],
8
+ ['wf-auto', 'WF-AUTO'],
9
+ ['wf-auto-spark', 'WF-AUTO-SPARK'],
10
+ ['wf-review', 'WF-REVIEW'],
11
+ ['wf-learn', 'WF-LEARN'],
12
+ ['wf-readme', 'WF-README'],
13
+ ['wf-remove', 'WF-REMOVE'],
14
+ ['wf-browser', 'WF-BROWSER'],
15
+ ]);
16
+
17
+ function commandName(value) {
18
+ return String(value || '').trim().replace(/^\/+/, '').split(/\s+/)[0];
19
+ }
20
+
21
+ function runtimeDir(root) {
22
+ return resolve(root, 'Harness', '.runtime');
23
+ }
24
+
25
+ function modePath(root) {
26
+ return resolve(runtimeDir(root), 'current-mode.json');
27
+ }
28
+
29
+ function writeMode(root, mode, sessionID) {
30
+ mkdirSync(runtimeDir(root), { recursive: true });
31
+ writeFileSync(modePath(root), JSON.stringify({
32
+ active: true,
33
+ mode,
34
+ sessionID,
35
+ startedAt: new Date().toISOString(),
36
+ surface: 'opencode',
37
+ }, null, 2) + '\n', 'utf-8');
38
+ }
39
+
40
+ function readMode(root) {
41
+ try {
42
+ return JSON.parse(readFileSync(modePath(root), 'utf-8'));
43
+ } catch {
44
+ return null;
45
+ }
46
+ }
47
+
48
+ function clearMode(root) {
49
+ try {
50
+ rmSync(modePath(root), { force: true });
51
+ } catch {
52
+ // Best effort only.
53
+ }
54
+ }
55
+
56
+ function runUpdatePrompt(root, prompt) {
57
+ const script = resolve(root, 'Harness', 'scripts', 'wf-auto-update-prompt.mjs');
58
+ if (!existsSync(script)) return null;
59
+ const result = spawnSync(process.execPath, [script, '--format', 'json'], {
60
+ cwd: root,
61
+ input: JSON.stringify({
62
+ cwd: root,
63
+ hook_event_name: 'chat.message',
64
+ prompt,
65
+ }),
66
+ encoding: 'utf-8',
67
+ timeout: 35000,
68
+ });
69
+ if (result.error || !result.stdout?.trim()) return null;
70
+ try {
71
+ return JSON.parse(result.stdout);
72
+ } catch {
73
+ return null;
74
+ }
75
+ }
76
+
77
+ function textFromParts(parts) {
78
+ return (parts || [])
79
+ .filter(part => part?.type === 'text' && typeof part.text === 'string')
80
+ .map(part => part.text)
81
+ .join('\n');
82
+ }
83
+
84
+ async function showToast(client, directory, body) {
85
+ try {
86
+ await client.tui.showToast({
87
+ body,
88
+ query: { directory },
89
+ });
90
+ } catch {
91
+ // TUI may not be attached, for example during non-interactive runs.
92
+ }
93
+ }
94
+
95
+ export const HarnessWfStatusPlugin = async ({ client, directory, worktree }) => {
96
+ const root = worktree || directory || process.cwd();
97
+
98
+ return {
99
+ 'chat.message': async (_input, output) => {
100
+ const update = runUpdatePrompt(root, textFromParts(output.parts));
101
+ if (!update?.message) return;
102
+ await showToast(client, root, {
103
+ title: 'Harness update available',
104
+ message: update.message,
105
+ variant: 'warning',
106
+ duration: 12000,
107
+ });
108
+ },
109
+
110
+ 'command.execute.before': async (input) => {
111
+ const mode = WF_COMMANDS.get(commandName(input.command));
112
+ if (!mode) return;
113
+ writeMode(root, mode, input.sessionID);
114
+ await showToast(client, root, {
115
+ title: 'Harness',
116
+ message: `${mode} mode on`,
117
+ variant: 'info',
118
+ duration: 8000,
119
+ });
120
+ },
121
+
122
+ event: async ({ event }) => {
123
+ if (event.type !== 'session.idle') return;
124
+ const mode = readMode(root);
125
+ if (!mode?.active) return;
126
+ clearMode(root);
127
+ await showToast(client, root, {
128
+ title: 'Harness',
129
+ message: `${mode.mode} mode cleared`,
130
+ variant: 'success',
131
+ duration: 5000,
132
+ });
133
+ },
134
+ };
135
+ };
@@ -1,32 +1,5 @@
1
1
  # AGENTS.md
2
2
 
3
- Entry point for coding agents. This project uses the Harness scaffold - a 0-1 product workflow contract.
3
+ Codex compatibility entry. Do not put workflow rules, role rules, command tables, or Harness routing here.
4
4
 
5
- ## Startup
6
-
7
- Read `CLAUDE.md` first, then `Harness/MEMORY.md`, then `Harness/README.md`.
8
- Do not bulk-read `Harness/`. Let `Harness/README.md#Load By Task` route you.
9
-
10
- ## WF-MAX Role Contract (READ FIRST)
11
-
12
- `/wf-max` activates WF-MAX global mode. Top-level orchestrator is **CEO** - reads, plans, dispatches. Delegated Workers follow dispatch packet (writeSet, forbidden, verification). **Global mode != every agent is CEO.**
13
- Closeout still requires reviewer cross-review, verifier evidence, and reflector PASS before final acceptance.
14
-
15
- | ALLOWED (W0 CEO) | FORBIDDEN (always on source) |
16
- |---|---|
17
- | Read Harness docs, CLAUDE.md | Edit / Write / MultiEdit |
18
- | Grep/Glob for scoping | Bash (except `ls`/`dir`/`tree`/`git`) |
19
- | Agent spawn (ONE message) | Deep source reads -> delegate to Worker |
20
- | Write PLAN.md / PROGRESS.md | Sequential spawn (AP6) |
21
-
22
- **Tempted to edit source? STOP. Spawn a Worker with explicit writeSet.**
23
-
24
- ## Key Commands
25
-
26
- | Command | Purpose |
27
- |---------|---------|
28
- | `/wf-help` | Direct help table for all Harness WF commands |
29
- | `/wf-max [task]` | WF strict superset: complete role chain plus maximum parallelism (CEO -> Manager -> Worker, current runtime subagents first, cross-CLI overflow) |
30
- | `/wf-review [focus]` | Cross-model peer review (use OTHER CLI) |
31
- | `/wf <task>` | Standard workflow mode |
32
- | `/wf-auto` | Perpetual auto-optimization |
5
+ Read `CLAUDE.md` and follow it as the single source of startup, routing, workflow, and safety instructions. If this file conflicts with `CLAUDE.md`, `CLAUDE.md` wins.
@@ -1,89 +1,115 @@
1
- # CLAUDE.md
2
-
3
- This repository dogfoods the generated Harness scaffold. Scaffold source files live under `templates/common/` and `templates/optional/`; generated dogfood runtime files live under root `Harness/` and `.claude/`.
4
-
5
- ## 1. Harness Binding & Startup
6
-
7
- - If `Harness/` exists, this repository is governed by the Harness contract. Treat these files as mandatory operating instructions, not optional references.
8
- - Every session: load `Harness/MEMORY.md` first, then `Harness/README.md`.
9
- - If `Harness/SETUP.md` exists, follow it before normal project work; it is the install/bootstrap contract and may be deleted after setup is complete.
10
-
11
- ### 1a. WF-MAX Role Contract (ACTIVE ONLY when /wf-max invoked)
12
-
13
- `/wf-max` active -> top-level orchestrator is **CEO**. Delegated Workers follow dispatch packet, edit only assigned writeSet. **Global mode != every agent is CEO.** There is no runtime hook enforcement; role/writeSet compliance is enforced by dispatch packets, review, validation, and durable task evidence.
14
-
15
- | ALLOWED (W0 CEO) | FORBIDDEN (always on source) |
16
- |---|---|
17
- | Read Harness docs, CLAUDE.md | Edit / Write / MultiEdit |
18
- | Grep/Glob for scoping | Bash (except `ls`/`dir`/`tree`/`git`) |
19
- | Agent spawn (ONE message) | Deep source reads -> delegate to Worker |
20
- | Write PLAN.md / PROGRESS.md | Sequential spawn (AP6) |
21
-
22
- **Tempted to edit source? STOP. Spawn a Worker with explicit writeSet.**
23
-
24
- - `Harness/MEMORY.md` is the memory/resource router: agents, skills, durable memories, and cross-session lessons. Follow its registrations when selecting agents/skills or recording memory.
25
- - `Harness/README.md` is the task router. For every request, check `Harness/README.md#Load By Task` and `Harness/README.md#Skill Commands`; invoke via `/wf-*` skills or `$wf-*` skills.
26
- - `Harness/PROGRESS.md` is the global task index. Load at session start to see active task and task history.
27
- - If work spans more than one step, create a task capsule from `Harness/tasks/_template/` and update `Harness/tasks/<task-id>/PROGRESS.md`.
28
- - Keep task records compact: PLAN holds goal, decisions, scope, risks; PROGRESS holds status/next, changes, verification. Link logs or outputs instead of pasting them.
29
- - Subagents are readers and reporters. Only the main agent writes to `Harness/tasks/<task-id>/PROGRESS.md` and `Harness/tasks/<task-id>/PLAN.md`.
30
- - Invoke multi-agent work via `subagent-orchestrator` and `Harness/subagents.md`. Update harness via `/wf-update` (see `.claude/skills/wf-update/SKILL.md`).
31
- - For memory writing, dispatch `memory-master`. For context analysis, dispatch `context-master`.
32
- - Never bulk-read `Harness/`; route through `Harness/README.md` and `Harness/MEMORY.md`.
33
- - Scaffold source files live under `templates/common/` and `templates/optional/`; generated dogfood runtime files live under root `Harness/` and `.claude/`.
34
-
35
- ## 2. Think Before Coding
36
-
37
- - You must have **>=95% confidence** in user intent before writing implementation code.
38
- - If confidence is below 95%, stop and ask up to 3 blocking questions.
39
- - If multiple valid approaches exist and the choice affects architecture, scope, stack, or user-facing behavior, present trade-offs instead of picking silently.
1
+ # CLAUDE.md
2
+
3
+ This repository dogfoods the generated Harness scaffold. Scaffold source files live under `templates/common/` and `templates/optional/`; generated dogfood runtime files live under root `Harness/` and `.claude/`.
4
+
5
+ ## 1. Harness Binding & Startup
6
+
7
+ If `Harness/` exists, this repository is governed by the Harness contract.
8
+
9
+ At session start, after loading `CLAUDE.md`, read `Harness/memory/startup-hints.md` (L2 lightweight digest, 5-10 hints). This is NOT loading `Harness/MEMORY.md`, `Harness/README.md`, or PROGRESS it is a minimal startup hint file only.
10
+
11
+ Use **direct mode** for simple, single-step, low-risk requests: commit, push, one-line fix, file read, code question, git log, git status, or similar small operations.
12
+
13
+ In direct mode, do not load the full Harness router. Inspect only the files needed for the task and execute directly.
14
+
15
+ Complex work may use direct planning, task capsules, tests, and subagents without entering WF. WF mode is explicit only: the user must type `/wf`, `$wf`, `/skills wf`, `/wf-max`, `$wf-max`, `/skills wf-max`, `/wf-auto`, `$wf-auto`, `/skills wf-auto`, `/wf-auto-spark`, `$wf-auto-spark`, or `/skills wf-auto-spark` to enter WF. No other phrasing, complexity heuristic, or inferred intent triggers WF.
16
+
17
+ `/wf-help` and `/wf-update` are **direct commands** — do NOT load `Harness/MEMORY.md`, do NOT enter WF, do NOT invoke a skill. Execute them immediately as static help / script commands respectively.
18
+
19
+ For actual workflow commands (`/wf`, `/wf-max`, `/wf-auto`, `/wf-review`, `/wf-learn`, `/wf-readme`, `/wf-remove`, `/wf-browser`, `/wf-auto-spark`), load `Harness/MEMORY.md` first, then `Harness/README.md`.
20
+
21
+ ### Active Task Resume
22
+
23
+ If the user says "continue", "resume", "last task", "current task", "status", "where were we", or similar resume language, or the current work is not a simple direct task:
24
+
25
+ 1. Read `Harness/PROGRESS.md` find Active Task.
26
+ 2. If Active Task exists, read `Harness/tasks/<active-task>/STATE.json` first.
27
+ 3. Read `Harness/tasks/<active-task>/PROGRESS.md`.
28
+ 4. Read `Harness/tasks/<active-task>/PLAN.md` only if decisions or scope need review.
29
+ 5. From STATE.json, recover: phase, gate, tier, ready/running/blocked/done queues, activeQuestion, nextAction.
30
+ 6. Do NOT bulk-read `Harness/tasks/` to find context. Use the active pointer.
31
+ 7. Direct simple tasks may skip STATE/PLAN/PROGRESS unless the user says "continue"/"resume".
32
+
33
+ See `Harness/WF-STATE.md` for the full state machine contract. Completed/abandoned tasks are archived to `Harness/tasks/_archive/` per `Harness/TASK_ARCHIVE.md`.
34
+
35
+ Use **/wf** for multi-step work that needs structured coordination. Use **/wf-max** for maximum-parallelism with CEO/Manager/Worker decomposition. See `Harness/WF.md` for tier selection (WF-Light, WF-Standard, WF-Full) and `Harness/WF-MAX.md` for fan-out rules (WF-Max-Useful, WF-Max-Strict).
36
+
37
+ `Harness/SETUP.md` is a bootstrap-only document: it exists only while the harness install is not yet finalized. If it exists, finish the bootstrap it describes once, then delete or archive it. Installed projects must not keep `Harness/SETUP.md` in the startup path, and normal sessions must not route through it.
38
+
39
+ ### 1a. WF-MAX Role Contract
40
+
41
+ This section is active only when `/wf-max` is invoked.
42
+
43
+ In `/wf-max`, the top-level agent is the **CEO**. The CEO owns task framing, decomposition, dispatch, review coordination, and task evidence.
44
+
45
+ The CEO must not edit source files directly. Source edits must be delegated to Workers through dispatch packets with explicit boundaries.
46
+
47
+ Each Worker dispatch must define: role, objective, allowed writeSet, forbidden files/actions, required verification, and expected return evidence.
48
+
49
+ Workers may edit only inside their assigned writeSet. Reviewers and verifiers must be independent from the Worker whose output they evaluate.
50
+
51
+ Detailed WF-MAX role rules live in `Harness/WF-KERNEL.md`, `Harness/WF-MAX.md`, and `Harness/subagents.md`.
52
+
53
+ ## 2. Think Before Coding
54
+
55
+ - You must have **>=95% confidence** in user intent before writing implementation code.
56
+ - If confidence is below 95%, stop and ask up to 3 blocking questions.
57
+ - If multiple valid approaches exist and the choice affects architecture, scope, stack, or user-facing behavior, present trade-offs instead of picking silently.
40
58
  - State assumptions before implementation and record only durable assumptions, decisions, blockers, handoffs, and verification evidence in `Harness/tasks/<task-id>/PLAN.md`.
41
- - If something is unclear, stop. Name what is unclear and ask instead of guessing.
42
- - Before asserting a fact about the codebase, read the file that proves it. If you cannot cite the file and line, do not assert.
43
-
44
- ## 3. Simplicity First
45
-
46
- - No features beyond what was asked.
47
- - No abstractions for single-use code.
48
- - No unrequested flexibility, configurability, or speculative error handling.
49
- - Use explicit interfaces or state models only when they protect a real boundary, clarify ownership, or make verification/recovery simpler.
50
- - If a simpler approach exists, say so and prefer the smallest change that satisfies the request.
51
- - If the solution is growing faster than the problem, reduce scope before coding more.
52
-
53
- ## 4. Surgical Changes
54
-
55
- - Touch only files and lines required by the task.
56
- - Do not improve adjacent code, comments, formatting, or architecture unless it is required for the task.
57
- - Match existing style even when you would choose a different style in a new project.
58
- - Clean up imports, variables, functions, and files made unused by your own changes; do not delete pre-existing dead code unless asked.
59
- - Keep every changed line traceable to the user's request.
60
-
61
- ## 5. Goal-Driven Execution
62
-
63
- - Define verifiable success criteria before implementation.
64
- - For bugs, reproduce the failure or document why reproduction is impossible before fixing.
65
- - For multi-step work, keep `Harness/tasks/<task-id>/PROGRESS.md` and `Harness/tasks/<task-id>/PLAN.md` current. The main agent is the only state committer; subagents return suggestions only.
66
- - State assumptions before implementation and record durable assumptions, decisions, blockers, handoffs, and verification evidence in `Harness/tasks/<task-id>/PLAN.md`.
67
- - Every task needs a test, build check, validator run, or recorded manual check.
68
- - Do not claim web/UI acceptance without real-browser evidence from Chrome DevTools, CDP, Playwright, or documented manual browser checks.
69
- - Do not place project build scripts, git conventions, run commands, or release process in this file. Put them in `README.md`.
70
- - Do not place code architecture here. Put architecture in `Harness/architecture.md` or the current feature doc.
71
- - If this file has accumulated unrelated project notes, pause and propose moving them to the right place: `README.md` for development operations, `Harness/architecture.md` for architecture, `Harness/WF.md` or `Harness/workflows/` for workflow rules.
72
-
73
- ## 6. Memory & Self-Learning
74
-
75
- - `Harness/MEMORY.md` is the resource index. Detailed durable memory lives in `Harness/memory/`.
76
- - **Tool reflection trigger**: record a lightweight reflection when the same tool/use pattern fails 3+ times, or when a better command pattern/environment fix is found. Write it newest-first in `Harness/memory/tool-usage-reflections.md`.
77
- - **User correction trigger**: record a lightweight preference/correction when the user asks to remember it, or when the user corrects the same assumption/pattern 2+ times. Write it newest-first in `Harness/memory/user-corrections-preferences.md`.
78
- - **Agent lesson trigger**: record reusable lessons from review/debug loops in `Harness/memory/agent-lessons-patterns.md` when they would prevent recurrence.
79
- - **WF auto-trigger**: before WF closeout, dispatch `context-master` then `memory-master` (or use `/wf-learn`). The old "3x same failure" auto-trigger is unreliable - make this a mandatory closeout gate.
80
- - **Context threshold trigger**: when context approaches ~85% of the window, dispatch `context-master` to analyze and write a non-blocking compression suggestion to `Harness/tasks/<task-id>/PROGRESS.md#Heartbeat`.
81
- - **Closeout trigger**: during WF closeout, dispatch `context-master` to extract durable knowledge, then `memory-master` to consolidate into `Harness/memory/*`.
82
- - Never record secrets, credentials, tokens, or private data in memory.
83
-
84
- ## 7. Mode Constraints
85
-
86
- - Never call `EnterPlanMode` - delegate planning to `planner` subagents (see `Harness/WF.md`).
87
- - Never write code directly in `/wf` or `/wf-max` CEO mode - delegate all implementation to Workers via dispatch packets with explicit writeSet.
88
- - **WF-MAX three-layer architecture**: global mode (`wf-max`) != agent role (`ceo|manager|worker|verifier|reviewer|reflector`). Workers follow dispatch packet (writeSet, forbidden, verification). Missing role/writeSet means the controller must not proceed with source edits.
89
- - **Enforcement**: `.claude/settings.json` denies `EnterPlanMode` via the `deny` list. WF-MAX role/writeSet compliance is not hook-enforced; it is maintained through dispatch packets, independent review, validation evidence, and the task capsule. Role contract is in [Section 1a](#1a-wf-max-role-contract-active-only-when-wf-max-invoked) - read it first.
59
+ - If something is unclear, stop. Name what is unclear and ask instead of guessing.
60
+ - Before asserting a fact about the codebase, read the file that proves it. If you cannot cite the file and line, do not assert.
61
+
62
+ ## 3. Simplicity First
63
+
64
+ - No features beyond what was asked.
65
+ - No abstractions for single-use code.
66
+ - No unrequested flexibility, configurability, or speculative error handling.
67
+ - Use explicit interfaces or state models only when they protect a real boundary, clarify ownership, or make verification/recovery simpler.
68
+ - If a simpler approach exists, say so and prefer the smallest change that satisfies the request.
69
+ - If the solution is growing faster than the problem, reduce scope before coding more.
70
+
71
+ ## 4. Surgical Changes
72
+
73
+ - Touch only files and lines required by the task.
74
+ - Do not improve adjacent code, comments, formatting, or architecture unless it is required for the task.
75
+ - Match existing style even when you would choose a different style in a new project.
76
+ - Clean up imports, variables, functions, and files made unused by your own changes; do not delete pre-existing dead code unless asked.
77
+ - Keep every changed line traceable to the user's request.
78
+
79
+ ## 5. Goal-Driven Execution
80
+
81
+ - Define verifiable success criteria before implementation.
82
+ - For bugs, reproduce the failure or document why reproduction is impossible before fixing.
83
+ - For multi-step work, keep `Harness/tasks/<task-id>/PROGRESS.md` and `Harness/tasks/<task-id>/PLAN.md` current. Only the controller or task-scribe writes task state; subagents return suggestions only.
84
+ - State assumptions before implementation and record only durable assumptions, decisions, blockers, handoffs, and verification evidence in `Harness/tasks/<task-id>/PLAN.md`.
85
+ - Every task needs a test, build check, validator run, or recorded manual check.
86
+ - Do not claim web/UI acceptance without real-browser evidence from Chrome DevTools, CDP, Playwright, or documented manual browser checks.
87
+ - Do not place project build scripts, git conventions, run commands, or release process in this file. Put them in `README.md`.
88
+ - Do not place code architecture here. Put architecture in `Harness/architecture.md` or the current feature doc.
89
+ - If this file has accumulated unrelated project notes, pause and propose moving them to the right place: `README.md` for development operations, `Harness/architecture.md` for architecture, `Harness/WF.md` or `Harness/workflows/` for workflow rules.
90
+
91
+ ## 5a. Low-Noise Progress
92
+
93
+ - Keep intermediate user updates to 1-2 short sentences.
94
+ - Do not recap the plan, paste logs, or narrate obvious file reads between steps.
95
+ - Save full detail for the final response: changed files, verification results, risks, and commit hash when relevant.
96
+ - For long-running work, report only meaningful phase changes, blockers, failed commands, or user decisions needed.
97
+
98
+ ## 6. Memory & Self-Learning
99
+
100
+ `Harness/MEMORY.md` is the memory and resource router. Detailed durable memory lives under `Harness/memory/`.
101
+
102
+ Do not write memory directly unless the selected workflow allows it. For workflow closeout, use the registered context and memory workflow to extract durable lessons, decisions, corrections, and reusable patterns.
103
+
104
+ Keep memory compact, durable, and reusable. Do not record transient logs, raw command output, speculative notes, or information that belongs in task-local PLAN.md / PROGRESS.md.
105
+
106
+ Never record secrets, credentials, tokens, or private data in memory.
107
+
108
+ ## 7. Mode Constraints
109
+
110
+ - Never call `EnterPlanMode`. Delegate planning to `planner` subagents (see `Harness/WF.md`).
111
+ - In `/wf` or `/wf-max`, follow the selected workflow role contract instead of improvising execution flow.
112
+ - In `/wf-max`, the CEO must not edit source files directly. Implementation must be delegated to Workers with explicit writeSet boundaries.
113
+ - If a Worker dispatch is missing role, objective, writeSet, forbidden scope, or verification requirements, the controller must not proceed with source edits.
114
+
115
+ Keep CLAUDE.md as a thin routing and global-behavior file. Put detailed workflows in `Harness/WF.md` or `Harness/workflows/`, subagent rules in `Harness/subagents.md`, architecture in `Harness/architecture.md`, and project operations in `README.md`.
@@ -27,8 +27,8 @@ Mode differences are organizational only:
27
27
 
28
28
  | Mode | Organization | Same Acceptance Flow |
29
29
  | --- | --- | --- |
30
- | `/wf` / `$wf` | Complete role chain | yes |
31
- | `/wf-max` / `$wf-max` | Complete role chain plus CEO -> Manager -> Worker fan-out | yes |
30
+ | `/wf` / `$wf` | WF-KERNEL tier selection (WF-Light / WF-Standard / WF-Full); WF-Full uses the complete role chain | yes |
31
+ | `/wf-max` / `$wf-max` | WF kernel plus CEO -> Manager -> Worker fan-out; WF-Max-Useful by default, WF-Max-Strict only on explicit strict request | yes |
32
32
  | `/wf-auto` / `$wf-auto` | Repeating optimization loop | yes, per cycle |
33
33
 
34
34
  ## Gates