@hallucination-studio/harness-engine 1.0.0-beta.12.d308768 → 1.0.0-beta.14.a797755

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.
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "harness-engine",
3
+ "version": "1.0.0",
4
+ "description": "Repository harness skill for Codex with optional frontend design-doc templates.",
5
+ "skills": "./skills/"
6
+ }
package/README.md CHANGED
@@ -14,16 +14,18 @@ ask for missing high-impact facts, create the harness files, and keep future wor
14
14
 
15
15
  - Installs the `harness-engine` Codex skill locally, globally, or into a custom skills directory.
16
16
  - Provides a repository analyzer that detects language, package manager, frontend signals, existing harness files, missing execution-plan state, and missing SOPs.
17
- - Generates a short routing-style `AGENTS.md` plus durable system-of-record docs such as `ARCHITECTURE.md`, `docs/RELIABILITY.md`, `docs/SECURITY.md`, `docs/QUALITY_SCORE.md`, and `docs/FRONTEND.md`.
18
- - Creates execution-plan folders for active and completed plans.
17
+ - Generates a short routing-style `AGENTS.md` plus durable system-of-record docs such as `ARCHITECTURE.md`, `docs/RELIABILITY.md`, `docs/SECURITY.md`, and `docs/QUALITY_SCORE.md`.
18
+ - Generates `docs/FRONTEND.md`, `docs/DESIGN.md`, and `docs/design-docs/` only when a frontend surface is detected.
19
+ - Creates version-controlled execution-plan folders for active and completed plans.
19
20
  - Adds SOPs for architecture setup, knowledge capture, local observability, and UI validation.
20
21
  - Reconciles managed harnesses through the same `init` flow, refreshing managed files and backfilling newly introduced managed files while preserving unmanaged docs.
21
- - Provides `clean` to remove transient harness runtime state, add `.gitignore` entries, and untrack already committed harness runtime files so a follow-up commit deletes them from the remote.
22
+ - Provides `clean` to remove local skill installs and generated evidence, add `.gitignore` entries, and untrack already committed runtime artifacts so a follow-up commit deletes them from the remote.
22
23
  - Enforces a local harness check without assuming the user's project has CI.
23
24
  - Previews and optionally removes stale unreferenced generated evidence under `docs/generated/`.
24
25
  - Supports durable knowledge closure with stable knowledge IDs and evidence text, so permanent docs can use natural wording instead of duplicated checklist strings.
25
- - Enforces a local quality gate for execution plans; failed scores write `## Rework Required` into the plan and block `plan-close`.
26
+ - Enforces structured execution-plan state: `acceptance-set` creates a pre-implementation Acceptance Contract, `quality-score` records post-implementation evidence against that contract, and stale or failed scores block `plan-close`.
26
27
  - Tracks resumable workstreams so interrupted features, refactors, reliability work, and cleanup efforts can be recovered from repo state instead of chat history.
28
+ - For frontend projects, asks for the desired visual style and initializes a repository-owned visual specification based on the local DESIGN.md format pattern: YAML design tokens plus markdown rationale.
27
29
 
28
30
  ## Why It Exists
29
31
 
@@ -65,22 +67,38 @@ Install into a custom skills directory:
65
67
  npx @hallucination-studio/harness-engine install --path /path/to/skills
66
68
  ```
67
69
 
68
- Replace an existing installed skill:
70
+ Replace an existing installed plugin bundle:
69
71
 
70
72
  ```bash
71
73
  npx @hallucination-studio/harness-engine install --local --force
72
74
  ```
73
75
 
74
- Show where the skill would be installed:
76
+ Show where the plugin bundle would be installed:
75
77
 
76
78
  ```bash
77
79
  npx @hallucination-studio/harness-engine where --local
78
80
  ```
79
81
 
82
+ ## Frontend Design Docs
83
+
84
+ Harness Engine has no external design runtime dependency and never calls an external design skill
85
+ during `init`. When a target repository has no frontend, it does not generate `docs/FRONTEND.md`,
86
+ `docs/DESIGN.md`, or `docs/design-docs/`.
87
+
88
+ When a frontend is detected, Harness Engine creates:
89
+
90
+ - `docs/FRONTEND.md`: project positioning, requested style direction, existing frontend code signals, frontend scope, stack notes, validation loop, and the read order for UI work.
91
+ - `docs/DESIGN.md`: a project-owned unified visual specification using YAML design tokens plus markdown rationale, seeded from the human-confirmed style direction and existing frontend code signals. It defines semantic colors, a unified typography scale, spacing/radius tokens, component states, and rules for mapping those tokens into the project's shared style layer.
92
+ - `docs/design-docs/`: durable design decisions and style-system notes.
93
+
94
+ The templates are informed by the local reference checkout at `/Users/murphy/code/github/design.md`
95
+ for document shape only. The target project owns the content and should replace starter tokens and
96
+ prose with its concrete product style before substantial UI work.
97
+
80
98
  ## Update An Installed Skill Package
81
99
 
82
- The `npx` installer only installs or replaces the Codex skill package. To update an already
83
- installed skill, rerun `install` with `--force` in the same install location.
100
+ The `npx` installer installs or replaces the Codex plugin bundle and compatibility skill entries.
101
+ To update an already installed bundle, rerun `install` with `--force` in the same install location.
84
102
 
85
103
  Replace the local skill install:
86
104
 
@@ -113,11 +131,8 @@ The skill should analyze the workspace and run the single workspace entrypoint:
113
131
  - If a managed harness already exists, `manage_harness.py init` reconciles it by refreshing managed files and backfilling newly introduced managed files.
114
132
  - Unmanaged user files are preserved unless `--force` is explicitly used.
115
133
 
116
- The underlying command for both cases is:
117
-
118
- ```bash
119
- python3 .codex/skills/harness-engine/scripts/manage_harness.py init --repo . --answers answers.json
120
- ```
134
+ Codex runs the underlying manager commands. Users should not need to call the Python script
135
+ directly during normal work.
121
136
 
122
137
  ## Use The Skill In A Target Repo
123
138
 
@@ -132,33 +147,57 @@ The intended workflow is:
132
147
  1. Analyze the target repository.
133
148
  2. Ask the human only for unresolved, high-impact facts.
134
149
  3. Initialize or reconcile the harness files.
135
- 4. Create execution plans for multi-step work.
136
- 5. Log durable knowledge into active plans.
137
- 6. Write the durable facts into permanent docs.
138
- 7. Mark knowledge as written using ID plus evidence text.
139
- 8. Score the finished work across product, UX/operator clarity, architecture, reliability, and security.
140
- 9. If the quality gate fails, implement the generated `## Rework Required` items and score again.
141
- 10. For phased or resumable work, update `Phase Continuity` and `docs/exec-plans/workstreams.md`.
142
- 11. Close the execution plan only after the quality gate passes, phase continuity is recorded, and durable docs are updated.
143
- 12. Run the local harness check before handoff.
144
- 13. Periodically run `evidence-prune` to preview stale unreferenced generated evidence, and apply it only after reviewing the candidate list.
145
-
146
- The installed skill exposes the underlying script at:
150
+ 4. Create or reuse execution plans for repository-mutating work, including code, docs, configuration, tests, dependencies, build/release scripts, generated templates, runtime behavior, migrations, cleanup, and review fixes.
151
+ 5. Define the Acceptance Contract before implementation with product, UX, architecture, reliability, and security criteria.
152
+ 6. Log durable knowledge into active plans.
153
+ 7. Write the durable facts into permanent docs.
154
+ 8. Mark knowledge as written using ID plus evidence text.
155
+ 9. Score the finished work against the Acceptance Contract across product, UX/operator clarity, architecture, reliability, and security.
156
+ 10. If the Quality Result fails, implement the generated `## Rework Required` items and score again.
157
+ 11. Before closing, record a `Continuation Decision` for the plan.
158
+ 12. Close the execution plan only after the Quality Result passes against the current contract fingerprint, the continuation decision is recorded, and durable docs are updated.
159
+ 13. Run the local harness check before handoff.
160
+ 14. Periodically run `evidence-prune` to preview stale unreferenced generated evidence, and apply it only after reviewing the candidate list.
161
+
162
+ ## User Continuation UX
163
+
164
+ Users should express the desired continuation state in natural language. Codex then runs the
165
+ required harness commands and repairs any blocked state before handoff.
166
+
167
+ Useful phrases:
168
+
169
+ - "这项完成了,没有后续" / "mark this complete"
170
+ - "这项要继续到下一阶段" / "continue this as a follow-up workstream"
171
+ - "先暂停,等 API 定稿后恢复" / "pause until the API contract is approved"
172
+ - "停止这个方向,记录原因" / "stop this work and record why"
173
+ - "这个放到技术债,不进入当前 workstream" / "defer this to tech debt"
174
+
175
+ When the user says a task should continue or pause, Codex records the workstream, next action,
176
+ resume notes, and goal in `docs/exec-plans/workstreams.md`. When the user says it is complete,
177
+ Codex records a complete decision and closes the plan without creating a workstream entry.
178
+
179
+ ## CLI Reference
180
+
181
+ The installed skill exposes a manager script for Codex and for advanced debugging:
147
182
 
148
183
  ```bash
149
184
  python3 .codex/skills/harness-engine/scripts/manage_harness.py --help
150
185
  ```
151
186
 
152
- Common commands:
187
+ For frontend or visual-design work, the generated harness uses `docs/FRONTEND.md` to route agents through `docs/DESIGN.md`. `docs/FRONTEND.md` defines which files are controlled by `docs/DESIGN.md`: design notes under `docs/design-docs/`, Tailwind theme files, global CSS variables, component theme modules, Storybook/theme previews, and UI implementation files that consume shared tokens or style rules. Agents should read `docs/FRONTEND.md`, then `docs/DESIGN.md`, then the relevant component, theme, or stylesheet.
188
+
189
+ These commands are not the primary user interface. They are shown so maintainers can debug or
190
+ inspect what Codex runs:
153
191
 
154
192
  ```bash
155
193
  python3 .codex/skills/harness-engine/scripts/manage_harness.py analyze --repo . --output analysis.json
156
194
  python3 .codex/skills/harness-engine/scripts/manage_harness.py sample-answers --analysis analysis.json --output answers.json
157
195
  python3 .codex/skills/harness-engine/scripts/manage_harness.py init --repo . --answers answers.json
158
196
  python3 .codex/skills/harness-engine/scripts/manage_harness.py plan-start --repo . --slug feature-name --goal "Implement the feature"
197
+ python3 .codex/skills/harness-engine/scripts/manage_harness.py acceptance-set --repo . --plan docs/exec-plans/active/2026-06-11-feature-name.md --product "The feature satisfies the named user workflow and expected output." --ux "The user or operator can complete the workflow without ambiguous states." --architecture "The change fits the existing module boundaries and keeps plan state recoverable." --reliability "The validation commands and failure evidence are repeatable from a clean checkout." --security "The change introduces no secrets and preserves sensitive-data handling rules."
159
198
  python3 .codex/skills/harness-engine/scripts/manage_harness.py quality-score --repo . --plan docs/exec-plans/active/2026-06-11-feature-name.md --product-correctness 8 --product-note "Product assertions passed" --ux-operator-clarity 8 --ux-note "User workflow evidence passed" --architecture-maintainability 8 --architecture-note "Boundary and maintainability review passed" --reliability-observability 8 --reliability-note "Tests and smoke checks passed" --security-data-handling 8 --security-note "No new sensitive-data paths or secrets"
160
- python3 .codex/skills/harness-engine/scripts/manage_harness.py phase-set --repo . --plan docs/exec-plans/active/2026-06-11-feature-name.md --mode multi-phase --workstream feature-name --current-phase 1 --next-phase 2 --continuation docs/exec-plans/workstreams.md#feature-name --next-action "Create Phase 2 plan"
161
- python3 .codex/skills/harness-engine/scripts/manage_harness.py workstream-upsert --repo . --id feature-name --status active --current-plan docs/exec-plans/active/2026-06-11-feature-name.md --next-action "Create Phase 2 plan"
199
+ python3 .codex/skills/harness-engine/scripts/manage_harness.py continuation-set --repo . --plan docs/exec-plans/active/2026-06-11-feature-name.md --decision complete --closure-reason "Feature is complete with no follow-up."
200
+ python3 .codex/skills/harness-engine/scripts/manage_harness.py continuation-set --repo . --plan docs/exec-plans/active/2026-06-11-feature-name.md --decision continue --workstream feature-name --next-target docs/exec-plans/workstreams.md#feature-name --next-action "Create the next execution plan" --goal "Deliver the feature across follow-up execution plans"
162
201
  python3 .codex/skills/harness-engine/scripts/manage_harness.py check --repo .
163
202
  python3 .codex/skills/harness-engine/scripts/manage_harness.py evidence-prune --repo . --older-than-days 14
164
203
  python3 .codex/skills/harness-engine/scripts/manage_harness.py evidence-prune --repo . --older-than-days 14 --apply
@@ -166,18 +205,24 @@ python3 .codex/skills/harness-engine/scripts/manage_harness.py clean --repo .
166
205
  python3 .codex/skills/harness-engine/scripts/manage_harness.py clean --repo . --apply
167
206
  ```
168
207
 
169
- The quality gate is intentionally local and repository-owned. It does not require the user's
170
- project to have CI. `plan-close` refuses to move a plan to `completed` unless `quality-score`
171
- has passed, and `check` reports active plans whose quality gate is missing or failing.
208
+ The quality workflow is intentionally local and repository-owned. It does not require the user's
209
+ project to have CI. Active plans must have a ready Acceptance Contract sidecar so work is
210
+ recoverable before implementation finishes. Completed plans must have a passing Quality Result
211
+ scored against the current Acceptance Contract fingerprint; `plan-close` rejects stale scores,
212
+ open defects, unresolved placeholders, and unresolved durable knowledge. Blocked `plan-close`
213
+ commands return structured JSON with `status: "blocked"`, a stable `reason`, a user-readable
214
+ `message`, and machine-readable `details`.
172
215
 
173
216
  ## Version Control Policy
174
217
 
175
218
  Commit harness docs that carry durable repository knowledge: `AGENTS.md`, `ARCHITECTURE.md`,
176
219
  `docs/PLANS.md`, `docs/QUALITY_SCORE.md`, `docs/RELIABILITY.md`, `docs/SECURITY.md`,
177
220
  `docs/FRONTEND.md`, `docs/sops/`, `docs/product-specs/`, `docs/design-docs/`,
178
- `docs/references/`, and intentional execution-plan state.
221
+ `docs/references/`, and execution-plan state.
222
+
223
+ Execution plans are project state. Commit active plans, completed plans, JSON sidecars, and `docs/exec-plans/workstreams.md` so another agent can recover the work from the repository.
179
224
 
180
- Do not commit local skill installs or generated evidence by default. `clean --apply` adds these ignores:
225
+ Do not commit local skill installs or generated evidence by default. `clean --apply` adds these directory-level ignores:
181
226
 
182
227
  ```gitignore
183
228
  # harness-engine transient files
@@ -197,12 +242,12 @@ git commit -m "Remove harness runtime artifacts from git"
197
242
  git push
198
243
  ```
199
244
 
200
- `clean --apply` removes local generated evidence and stale task snapshots, then uses
201
- `git rm --cached` to stage removal of tracked harness runtime files from git and the remote.
245
+ `clean --apply` removes local generated evidence, then uses `git rm --cached` to stage removal of tracked local skill installs and generated evidence from git and the remote. It does not remove, ignore, or untrack execution plans, JSON sidecars, or workstreams.
202
246
 
203
- For multi-phase work, `Phase Continuity` and `docs/exec-plans/workstreams.md` form the recovery
204
- ledger. A plan like `Local Workbench Phase 1` can close only after it records whether the workstream
205
- continues, pauses, completes, or stops, and where the next agent should resume.
247
+ Every plan closes with a `Continuation Decision`: `complete`, `continue`, `pause`, `stop`, or
248
+ `defer`. Only resumable `continue` and `pause` decisions enter `docs/exec-plans/workstreams.md`;
249
+ one-off completed plans do not need workstream entries. Invalid `continue` or `pause` inputs fail before
250
+ writing workstream state, and workstream goals are taken from `--goal` or the plan goal.
206
251
 
207
252
  ## Generated Harness Shape
208
253
 
@@ -268,6 +313,15 @@ Check npm package contents:
268
313
  npm run pack:check
269
314
  ```
270
315
 
316
+ Before release, run:
317
+
318
+ ```bash
319
+ npm test
320
+ npm run smoke:install
321
+ npm run pack:check
322
+ git diff --check
323
+ ```
324
+
271
325
  The publish workflows expect an npm token when trusted publishing is not yet configured:
272
326
 
273
327
  ```text
@@ -281,14 +335,14 @@ These scores describe the current implementation, not an external guarantee.
281
335
  | Layer | Score | Notes |
282
336
  | --- | ---: | --- |
283
337
  | Product fit | 9 / 10 | Clear purpose: install a Codex skill that creates and maintains an agent-first repository harness. Real acceptance against a fresh Go backend plus browser frontend project validated generation and later issue workflows. Broader usage across more project types would still improve confidence. |
284
- | Skill workflow design | 9.2 / 10 | Strong progressive workflow: analyze, confirm, init/reconcile, plan, capture knowledge, validate, score with evidence notes, rework, record continuity, close. The workflow now explicitly routes user-reported product, frontend, backend, architecture, data, security, performance, and reliability issues even when the user does not invoke the skill by name. |
285
- | Knowledge, quality, and workstream closure loop | 9.1 / 10 | Stable knowledge IDs plus exact destination evidence reduce noisy doc duplication, `quality-score` rejects missing evidence notes, defects block closure until resolved, and workstreams make phased work recoverable. Future work could move plan state into structured sidecar metadata instead of Markdown parsing. |
338
+ | Skill workflow design | 9.2 / 10 | Strong progressive workflow: analyze, confirm, init/reconcile, plan, capture knowledge, validate, score with evidence notes, rework, record continuity, close. The workflow now explicitly routes repository-mutating feature, bug, refactor, docs, dependency, UI, test, security, performance, and reliability work through the same lifecycle. |
339
+ | Knowledge, quality, and workstream closure loop | 9.3 / 10 | Stable knowledge IDs plus exact destination evidence reduce noisy doc duplication. Execution plans now have JSON sidecars for Acceptance Contracts, Quality Results, defects, and knowledge state; `quality-score` rejects missing evidence notes or missing contracts, defects invalidate stale scores, and workstreams make resumable follow-up work recoverable. |
286
340
  | CLI installer | 8 / 10 | Simple local/global/custom install modes, force replacement, and path discovery. It is intentionally minimal and does not manage Codex runtime configuration. |
287
- | Generated harness docs | 8.4 / 10 | Covers architecture, plans, reliability, security, frontend policy, issue workflows, references, generated artifacts, and SOPs. The docs now front-load exact knowledge evidence, per-dimension quality notes, and plan placeholder cleanup, but templates still require Codex to tighten project-specific language after generation. |
288
- | Evaluation coverage | 9 / 10 | `npm test` runs 13 structured eval cases covering empty-repo init, frontend analysis, init reconciliation, clean command behavior for local runtime state and already tracked artifacts, issue workflow coverage, closed-loop plan behavior, phase continuity, path canonicalization, defect recovery, required quality-score notes, exact knowledge evidence, generated-evidence cleanup, eval report shape, and user-owned doc preservation. A fully automated Codex child-agent E2E would raise this further. |
341
+ | Generated harness docs | 8.4 / 10 | Covers architecture, plans, reliability, security, frontend policy, broad task intake, issue workflows, references, generated artifacts, and SOPs. The docs now front-load exact knowledge evidence, per-dimension quality notes, default plan lifecycle, and plan placeholder cleanup, but templates still require Codex to tighten project-specific language after generation. |
342
+ | Evaluation coverage | 9.2 / 10 | `npm test` runs 23 structured eval cases covering empty-repo init, frontend analysis, init reconciliation, clean command behavior, broad task intake, closed-loop plan behavior, continuation decisions, path canonicalization, defect recovery, required quality-score notes, exact knowledge evidence, structured sidecars, acceptance readiness, stale score rejection, generated-evidence cleanup, eval report shape, user-owned doc preservation, and frontend design control. A fully automated Codex child-agent E2E would raise this further. |
289
343
  | Release automation | 8 / 10 | Supports stable release, beta on every main commit, nightly, manual dry-run, artifacts, provenance, and token fallback. npm first-publish/trusted-publishing setup still requires external configuration. |
290
344
  | User-project safety | 8.8 / 10 | The skill avoids adding CI to target projects by default, preserves unmanaged files unless forced, and requires evidence-backed closure for defects and durable knowledge. More destructive-change simulation in evals would improve this score. |
291
- | Overall | 9 / 10 | The skill is now strong enough for regular use: self evals pass across the structured suite, real acceptance covered initial scaffold plus frontend and backend issue workflows, and the main failure modes found during acceptance are now documented and eval-covered. Remaining leverage is automated child-agent E2E coverage and structured plan metadata. |
345
+ | Overall | 9.1 / 10 | The skill is now strong enough for regular use: self evals pass across the structured suite, real acceptance covered initial scaffold plus frontend and backend issue workflows, and plan lifecycle state is enforced through JSON sidecars. Remaining leverage is automated child-agent E2E coverage. |
292
346
 
293
347
  ## Reference
294
348
 
package/bin/install.js CHANGED
@@ -5,8 +5,8 @@ const os = require("os");
5
5
  const path = require("path");
6
6
 
7
7
  const PACKAGE_ROOT = path.resolve(__dirname, "..");
8
- const SKILL_NAME = "harness-engine";
9
- const SOURCE_SKILL_DIR = path.join(PACKAGE_ROOT, "skills", SKILL_NAME);
8
+ const BUNDLE_NAME = "harness-engine-plugin";
9
+ const BUNDLE_ENTRIES = [".codex-plugin", "skills"];
10
10
 
11
11
  function printHelp() {
12
12
  console.log(`harness-engine
@@ -19,7 +19,7 @@ Options:
19
19
  --local Install into <cwd>/.codex/skills
20
20
  --global Install into \${CODEX_HOME:-~/.codex}/skills
21
21
  --path <dir> Install into a custom skills directory
22
- --force Replace an existing installed skill
22
+ --force Replace an existing installed bundle
23
23
  -h, --help Show this help text
24
24
  `);
25
25
  }
@@ -85,32 +85,71 @@ function copyDir(sourceDir, targetDir) {
85
85
  for (const entry of fs.readdirSync(sourceDir, { withFileTypes: true })) {
86
86
  const sourcePath = path.join(sourceDir, entry.name);
87
87
  const targetPath = path.join(targetDir, entry.name);
88
- if (entry.isDirectory()) {
88
+ const stat = fs.statSync(sourcePath);
89
+ if (stat.isDirectory()) {
89
90
  copyDir(sourcePath, targetPath);
91
+ } else if (entry.isSymbolicLink()) {
92
+ const linkTarget = fs.readlinkSync(sourcePath);
93
+ fs.symlinkSync(linkTarget, targetPath);
90
94
  } else {
91
95
  fs.copyFileSync(sourcePath, targetPath);
92
- const stat = fs.statSync(sourcePath);
93
96
  fs.chmodSync(targetPath, stat.mode);
94
97
  }
95
98
  }
96
99
  }
97
100
 
98
- function installSkill(destinationDir, force) {
99
- const skillTargetDir = path.join(destinationDir, SKILL_NAME);
100
- if (!fs.existsSync(SOURCE_SKILL_DIR)) {
101
- throw new Error(`Bundled skill not found: ${SOURCE_SKILL_DIR}`);
101
+ function copyEntry(sourcePath, targetPath) {
102
+ const stat = fs.lstatSync(sourcePath);
103
+ if (stat.isDirectory()) {
104
+ copyDir(sourcePath, targetPath);
105
+ } else if (stat.isSymbolicLink()) {
106
+ fs.symlinkSync(fs.readlinkSync(sourcePath), targetPath);
107
+ } else {
108
+ fs.mkdirSync(path.dirname(targetPath), { recursive: true });
109
+ fs.copyFileSync(sourcePath, targetPath);
110
+ fs.chmodSync(targetPath, fs.statSync(sourcePath).mode);
102
111
  }
112
+ }
103
113
 
104
- if (fs.existsSync(skillTargetDir)) {
105
- if (!force) {
106
- throw new Error(`Skill already exists at ${skillTargetDir}. Re-run with --force to replace it.`);
114
+ function assertBundleSources() {
115
+ for (const entry of BUNDLE_ENTRIES) {
116
+ const sourcePath = path.join(PACKAGE_ROOT, entry);
117
+ if (!fs.existsSync(sourcePath)) {
118
+ throw new Error(`Bundled plugin entry not found: ${sourcePath}`);
107
119
  }
108
- fs.rmSync(skillTargetDir, { recursive: true, force: true });
120
+ }
121
+ }
122
+
123
+ function removeIfExists(targetPath, force, label) {
124
+ if (!fs.existsSync(targetPath)) {
125
+ return;
126
+ }
127
+
128
+ if (!force) {
129
+ throw new Error(`${label} already exists at ${targetPath}. Re-run with --force to replace it.`);
109
130
  }
110
131
 
132
+ fs.rmSync(targetPath, { recursive: true, force: true });
133
+ }
134
+
135
+ function installBundle(destinationDir, force) {
136
+ assertBundleSources();
111
137
  fs.mkdirSync(destinationDir, { recursive: true });
112
- copyDir(SOURCE_SKILL_DIR, skillTargetDir);
113
- return skillTargetDir;
138
+ const bundleTargetDir = path.join(destinationDir, BUNDLE_NAME);
139
+ removeIfExists(bundleTargetDir, force, "Plugin bundle");
140
+
141
+ fs.mkdirSync(bundleTargetDir, { recursive: true });
142
+ for (const entry of BUNDLE_ENTRIES) {
143
+ copyEntry(path.join(PACKAGE_ROOT, entry), path.join(bundleTargetDir, entry));
144
+ }
145
+
146
+ // Compatibility: older users invoke $harness-engine from a normal skills directory.
147
+ // Keep a top-level skill copy in place while the plugin root carries the bundle.
148
+ const compatTarget = path.join(destinationDir, "harness-engine");
149
+ removeIfExists(compatTarget, force, "Compatibility skill");
150
+ copyDir(path.join(PACKAGE_ROOT, "skills", "harness-engine"), compatTarget);
151
+
152
+ return bundleTargetDir;
114
153
  }
115
154
 
116
155
  function main() {
@@ -131,7 +170,7 @@ function main() {
131
170
  const destinationDir = resolveSkillsDir(args.mode, args.customPath);
132
171
 
133
172
  if (args.command === "where") {
134
- console.log(path.join(destinationDir, SKILL_NAME));
173
+ console.log(path.join(destinationDir, BUNDLE_NAME));
135
174
  return;
136
175
  }
137
176
 
@@ -142,8 +181,8 @@ function main() {
142
181
  }
143
182
 
144
183
  try {
145
- const installedPath = installSkill(destinationDir, args.force);
146
- console.log(`Installed ${SKILL_NAME} to ${installedPath}`);
184
+ const installedPath = installBundle(destinationDir, args.force);
185
+ console.log(`Installed ${BUNDLE_NAME} plugin bundle to ${installedPath}`);
147
186
  console.log("Invoke it in Codex with $harness-engine.");
148
187
  } catch (error) {
149
188
  console.error(`Install failed: ${error.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hallucination-studio/harness-engine",
3
- "version": "1.0.0-beta.12.d308768",
3
+ "version": "1.0.0-beta.14.a797755",
4
4
  "description": "Install the harness-engine Codex skill for initializing and reconciling advanced repository harness docs.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,6 +19,7 @@
19
19
  },
20
20
  "files": [
21
21
  "bin",
22
+ ".codex-plugin/**",
22
23
  "skills/**/SKILL.md",
23
24
  "skills/**/agents/**",
24
25
  "skills/**/assets/**",
@@ -1,35 +1,41 @@
1
1
  ---
2
2
  name: harness-engine
3
- description: Initialize or refresh an advanced harness-engineering repository shape for Codex-driven projects. Use when Codex needs to analyze a repository, ask the human to confirm high-impact product and architecture facts, and then run the harness-engine init workflow to create or reconcile AGENTS.md, architecture docs, policy docs, plan folders, reference folders, and SOP-backed starter files.
3
+ description: Initialize, refresh, and operate an advanced harness-engineering repository lifecycle for Codex-driven projects. Use when Codex needs to create or reconcile harness docs, or when work inside a harness-managed repository will change code, docs, configuration, tests, dependencies, build/release scripts, generated templates, runtime behavior, migrations, cleanup policy, or other durable repository state.
4
4
  ---
5
5
 
6
6
  # Harness Engine
7
7
 
8
- Run the packaged script to inspect the target repository before editing files. Use the generated analysis to decide what to ask the human, what durable knowledge is missing from the repo, and which execution-plan and SOP files must be created or reconciled.
8
+ Use the packaged script yourself to inspect the target repository before editing files. Do not ask the user to run the harness Python commands during normal work. Use the generated analysis to decide what to ask the human, what durable knowledge is missing from the repo, and which execution-plan and SOP files must be created or reconciled.
9
+
10
+ In a harness-managed repository, default every repository-mutating request into the harness lifecycle. Repository-mutating work includes code, docs, configuration, tests, dependencies, build/release scripts, generated templates, runtime behavior, migrations, cleanup, and fixes from review or user feedback. The only no-plan exceptions are pure question answering, read-only investigation, showing command output, and status reporting with no file changes. If an investigation turns into editing files, enter the lifecycle before editing.
11
+
12
+ The user-facing interface is intent, not CLI. If the user says a task is complete, should continue, should pause, should stop, or should become follow-up debt, translate that into the appropriate manager command yourself and report the outcome. Only show raw commands when the user explicitly asks for implementation details or debugging help.
9
13
 
10
14
  ## Workflow
11
15
 
12
16
  1. Run `python3 scripts/manage_harness.py analyze --repo <target-repo> --output <analysis.json>`.
13
17
  2. Read `analysis.json`.
14
18
  3. Ask the human only the unresolved, high-impact questions from `human_confirmations`.
15
- 4. Run `python3 scripts/manage_harness.py sample-answers --analysis <analysis.json> --output <answers.json>`.
16
- 5. Fill the placeholders in `answers.json` from the repository and the human's confirmed answers.
17
- 6. Run `python3 scripts/manage_harness.py init --repo <target-repo> --answers <answers.json>`. This is the single workspace entrypoint: it creates a new harness when none exists, and reconciles a managed or partial harness when managed harness files are already present. Reconcile refreshes managed files, backfills newly introduced managed files, and preserves unmanaged user files. Pass `--force` only with explicit user approval.
18
- 7. If the task is multi-step, run `python3 scripts/manage_harness.py plan-start --repo <target-repo> --slug <task-name> --goal "<goal>"`.
19
- 8. If you learn durable facts during the work, run `python3 scripts/manage_harness.py knowledge-log --repo <target-repo> --plan <plan-file> --fact "<fact>" --destination <durable-doc>` and keep the returned `id`. Use `--fact-file <file>` when the fact contains shell-sensitive characters.
20
- 9. Before closing the task, write those facts into their durable docs.
21
- 10. Run `python3 scripts/manage_harness.py knowledge-mark-written --repo <target-repo> --plan <plan-file> --id <knowledge-id> --evidence "<verbatim text already in durable doc>"`; prefer `--evidence-file <file>` when evidence contains backticks, globs, quotes, pipes, or other shell-sensitive characters. Evidence must be copied from the destination doc, not summarized. Use `--append` only when the exact fact should be appended mechanically.
22
- 11. If validation, evals, browser checks, or code review reveal a bug, immediately run `python3 scripts/manage_harness.py defect-log --repo <target-repo> --plan <plan-file> --severity <P0|P1|P2|P3> --summary "<bug>" --evidence "<failing check>"`. This forces the quality gate to fail.
23
- 12. Fix logged defects, then run `python3 scripts/manage_harness.py defect-resolve --repo <target-repo> --plan <plan-file> --id <bug-id> --fix-evidence "<passing check or code evidence>"`.
24
- 13. Score the finished work with `python3 scripts/manage_harness.py quality-score --repo <target-repo> --plan <plan-file> --product-correctness <0-10> --product-note "<evidence>" --ux-operator-clarity <0-10> --ux-note "<evidence>" --architecture-maintainability <0-10> --architecture-note "<evidence>" --reliability-observability <0-10> --reliability-note "<evidence>" --security-data-handling <0-10> --security-note "<evidence>"`. Every dimension needs an evidence note.
25
- 14. If `quality-score` fails, treat `## Rework Required` in the plan as the next implementation input, fix the work, then run `quality-score` again.
26
- 15. For phased or resumable work, run `python3 scripts/manage_harness.py phase-set --repo <target-repo> --plan <plan-file> --mode <multi-phase|paused|completed|stopped> --workstream <id> --current-phase <n> --continuation <target> --next-action "<next action>"`, then update `workstreams.md` with `workstream-upsert`.
27
- 16. Before closing, replace generic plan placeholders with task-specific scope, constraints, steps, validation, and completion notes; leave no open durable-knowledge placeholder except the default unused line.
28
- 17. Close the plan with `python3 scripts/manage_harness.py plan-close --repo <target-repo> --plan <plan-file> --summary "<summary>"`.
29
- 18. Before handoff, run `python3 .codex/skills/harness-engine/scripts/manage_harness.py check --repo <target-repo>` from an installed target repository.
30
- 19. To review stale generated evidence, run `python3 scripts/manage_harness.py evidence-prune --repo <target-repo>` first; it is dry-run by default. Add `--apply` only after checking the candidate list.
31
- 20. To clean transient harness runtime files or remove already committed runtime files from the remote, run `python3 scripts/manage_harness.py clean --repo <target-repo>` first; it is dry-run by default. Add `--apply` to clean local runtime state, update `.gitignore`, and stage `git rm --cached` removals, then commit and push.
32
- 21. After changing this skill, run `python3 evals/run_evals.py` and iterate until it passes.
19
+ 4. During initialization, create frontend design docs only when the analysis detects a frontend surface. Frontend repos get `docs/FRONTEND.md`, `docs/DESIGN.md`, and `docs/design-docs/`; backend-only repos do not. Ask the human for the desired visual style direction and use existing frontend style files as evidence. The generated `docs/DESIGN.md` is a project-owned visual specification shaped like DESIGN.md: YAML tokens plus markdown rationale. Do not call external design-generation skills or packages during init.
20
+ 5. Run `python3 scripts/manage_harness.py sample-answers --analysis <analysis.json> --output <answers.json>`.
21
+ 6. Fill the placeholders in `answers.json` from the repository and the human's confirmed answers.
22
+ 7. Run `python3 scripts/manage_harness.py init --repo <target-repo> --answers <answers.json>`. This is the single workspace entrypoint: it creates a new harness when none exists, and reconciles a managed or partial harness when managed harness files are already present. Reconcile refreshes managed files, backfills newly introduced managed files, and preserves unmanaged user files. Pass `--force` only with explicit user approval.
23
+ 8. For any repository-mutating task, run `python3 scripts/manage_harness.py plan-start --repo <target-repo> --slug <task-name> --goal "<goal>"` unless an active plan already covers the exact work. Small changes may use a lightweight plan, but they still require acceptance, validation, quality scoring, plan close, and check.
24
+ 9. Before implementation, run `python3 scripts/manage_harness.py acceptance-set --repo <target-repo> --plan <plan-file> --product "<product criterion>" --ux "<UX criterion>" --architecture "<architecture criterion>" --reliability "<reliability criterion>" --security "<security criterion>"`. Criteria must be concrete to the task; generic templates are rejected.
25
+ 10. If you learn durable facts during the work, run `python3 scripts/manage_harness.py knowledge-log --repo <target-repo> --plan <plan-file> --fact "<fact>" --destination <durable-doc>` and keep the returned `id`. Use `--fact-file <file>` when the fact contains shell-sensitive characters.
26
+ 11. Before closing the task, write those facts into their durable docs.
27
+ 12. Run `python3 scripts/manage_harness.py knowledge-mark-written --repo <target-repo> --plan <plan-file> --id <knowledge-id> --evidence "<verbatim text already in durable doc>"`; prefer `--evidence-file <file>` when evidence contains backticks, globs, quotes, pipes, or other shell-sensitive characters. Evidence must be copied from the destination doc, not summarized. Use `--append` only when the exact fact should be appended mechanically.
28
+ 13. If validation, evals, browser checks, or code review reveal a bug, immediately run `python3 scripts/manage_harness.py defect-log --repo <target-repo> --plan <plan-file> --severity <P0|P1|P2|P3> --summary "<bug>" --evidence "<failing check>"`. This invalidates any existing quality result and makes the defect the next rework input.
29
+ 14. Fix logged defects, then run `python3 scripts/manage_harness.py defect-resolve --repo <target-repo> --plan <plan-file> --id <bug-id> --fix-evidence "<passing check or code evidence>"`.
30
+ 15. Score the finished work with `python3 scripts/manage_harness.py quality-score --repo <target-repo> --plan <plan-file> --product-correctness <0-10> --product-note "<evidence>" --ux-operator-clarity <0-10> --ux-note "<evidence>" --architecture-maintainability <0-10> --architecture-note "<evidence>" --reliability-observability <0-10> --reliability-note "<evidence>" --security-data-handling <0-10> --security-note "<evidence>"`. Every dimension needs an evidence note tied to the ready Acceptance Contract.
31
+ 16. If `quality-score` fails, treat `## Rework Required` in the plan as the next implementation input, fix the work, then run `quality-score` again.
32
+ 17. Before closing, run `python3 scripts/manage_harness.py continuation-set --repo <target-repo> --plan <plan-file> --decision <complete|continue|pause|stop|defer>`. Use `--workstream`, `--next-target`, `--next-action`, `--closure-reason`, `--resume-notes`, and `--goal` as needed; `continue` and `pause` update `workstreams.md` automatically only after required fields validate.
33
+ 18. Before closing, replace generic plan placeholders with task-specific scope, constraints, steps, validation, and completion notes; leave no open durable-knowledge placeholder except the default unused line.
34
+ 19. Close the plan with `python3 scripts/manage_harness.py plan-close --repo <target-repo> --plan <plan-file> --summary "<summary>"`.
35
+ 20. Before handoff, run `python3 .codex/skills/harness-engine/scripts/manage_harness.py check --repo <target-repo>` from an installed target repository.
36
+ 21. To review stale generated evidence, run `python3 scripts/manage_harness.py evidence-prune --repo <target-repo>` first; it is dry-run by default. Add `--apply` only after checking the candidate list.
37
+ 22. To clean transient harness runtime files or remove already committed runtime files from the remote, run `python3 scripts/manage_harness.py clean --repo <target-repo>` first; it is dry-run by default. Add `--apply` to clean local runtime state, update `.gitignore`, and stage `git rm --cached` removals, then commit and push. Clean is limited to local skill installs and generated evidence; execution plans, sidecars, and workstreams are durable project state.
38
+ 23. After changing this skill, run `python3 evals/run_evals.py` and iterate until it passes.
33
39
 
34
40
  ## Reading Order
35
41
 
@@ -37,11 +43,12 @@ Run the packaged script to inspect the target repository before editing files. U
37
43
  - Read [references/file-map.md](references/file-map.md) when deciding which generated file to edit.
38
44
  - Read [references/question-catalog.md](references/question-catalog.md) when the analysis surfaces ambiguous product, security, reliability, or frontend facts.
39
45
  - Read [references/knowledge-capture.md](references/knowledge-capture.md) when you discover facts that should survive chat history.
40
- - Read [references/exec-plans.md](references/exec-plans.md) before planning or updating any multi-step work.
46
+ - Read [references/exec-plans.md](references/exec-plans.md) before planning or updating any repository-mutating work.
41
47
  - Read [references/sop-index.md](references/sop-index.md) to choose the right SOP for architecture, UI validation, observability, or knowledge capture work.
42
48
  - Read [references/template-policy.md](references/template-policy.md) before overwriting existing files.
43
49
  - Read [references/evaluation-loop.md](references/evaluation-loop.md) before changing the skill, templates, scripts, or policy references.
44
50
  - Read [references/evidence-first-evals.md](references/evidence-first-evals.md) before designing evals for product correctness, frontend validation, or bug-discovery coverage.
51
+ - Read `docs/FRONTEND.md` and `docs/DESIGN.md` when they exist for frontend, UI, product design, visual design, canvas, or interface polish work.
45
52
 
46
53
  ## Command Rules
47
54
 
@@ -51,7 +58,7 @@ Run the packaged script to inspect the target repository before editing files. U
51
58
  - Do not overwrite existing files unless the human asked for it or you pass `--force`.
52
59
  - Treat the generated files as starting points. After generation, tighten them with repository-specific details instead of leaving placeholders behind.
53
60
  - Before plan close, replace or remove task placeholders such as "Define in-scope work", "Add the first concrete step", "Describe how the work will be verified", and any ad hoc durable-knowledge TODOs.
54
- - Treat `docs/exec-plans/` as required state for multi-step work, not optional notes.
61
+ - Treat `docs/exec-plans/` as required durable state for repository-mutating work, not optional notes.
55
62
  - Read `docs/exec-plans/workstreams.md` before resuming interrupted feature, refactor, reliability, security, frontend, or cleanup work.
56
63
  - Treat `docs/sops/` as mechanical operating procedures, not background reading.
57
64
  - When you answer a question using facts that are not yet in the repo but should be reusable, write them into a durable doc before finishing.
@@ -59,21 +66,27 @@ Run the packaged script to inspect the target repository before editing files. U
59
66
  - The knowledge evidence text must exist verbatim in the destination doc; if it is only a paraphrase, write the durable doc first or use a file containing exact destination text.
60
67
  - Use `defect-log` for every bug found by tests, evals, browser validation, or code review; unresolved defects must block handoff.
61
68
  - Use `defect-resolve` only after the implementation is fixed and you can cite passing validation or code evidence.
62
- - Use `quality-score` before `plan-close`; include `--product-note`, `--ux-note`, `--architecture-note`, `--reliability-note`, and `--security-note`; failed scores must drive rework, not handoff.
63
- - Use `phase-set` and `workstream-upsert` before `plan-close` for Phase 1/2/3 or any other resumable multi-plan work.
64
- - Use `plan-close` as the final guardrail so plan state, quality score, and durable docs stay synchronized.
65
- - Use `check` as the local handoff guardrail for user repositories.
69
+ - Use `acceptance-set` before implementation and `quality-score` before `plan-close`; include `--product-note`, `--ux-note`, `--architecture-note`, `--reliability-note`, and `--security-note`; failed or stale scores must drive rework, not handoff.
70
+ - Use `continuation-set` before every `plan-close`; choose `complete` for one-off plans, and use `continue` or `pause` for resumable multi-plan work. Invalid continuation input must fail before writing a half-valid workstream.
71
+ - Use `plan-close` as the final guardrail so plan state, quality score, and durable docs stay synchronized. When blocked, it returns JSON with `status`, `reason`, `message`, and `details`; use that output as the next repair input.
72
+ - Use `check` as the local handoff guardrail for user repositories. Active plans require ready Acceptance Contracts; completed plans require passing Quality Results scored against the current contract fingerprint.
66
73
  - Use `evidence-prune` as a cleanup preview for old unreferenced files under `docs/generated/`; it never deletes unless `--apply` is present.
67
- - Use `clean` when `.codex/skills/`, `docs/generated/`, or stale `docs/exec-plans/active|completed/` files need cleanup or were already committed. It never changes files or the git index unless `--apply` is present.
74
+ - Use `clean` when `.codex/skills/` or `docs/generated/` files need cleanup or were already committed. It never changes files or the git index unless `--apply` is present, and it must not remove execution plans, sidecars, or workstreams.
68
75
  - Run `python3 evals/run_evals.py` after skill changes, read the structured report, and treat per-case failures as iteration input.
69
76
  - Do not add CI to user repositories unless the human explicitly asks for it.
70
77
 
78
+ ## Frontend Design Docs
79
+
80
+ Harness-engine has no external design runtime dependency and must not call an external design skill during init. It uses the local `/Users/murphy/code/github/design.md` checkout only as a reference for document shape.
81
+
82
+ For frontend repositories, `docs/FRONTEND.md` records product positioning, requested style direction, existing frontend code signals, scope, stack notes, validation expectations, controlled files, and read order. `docs/DESIGN.md` records the unified visual specification with YAML tokens and markdown rationale. For backend-only repositories, these files are not generated.
83
+
71
84
  ## Output Rules
72
85
 
73
86
  - Keep `AGENTS.md` short and routing-oriented.
74
87
  - Keep durable knowledge in repo docs, not in chat-only explanations.
75
- - Keep plans under `docs/exec-plans/active/` and move finished plans to `docs/exec-plans/completed/`.
76
- - Keep resumable workstreams in `docs/exec-plans/workstreams.md`.
88
+ - Keep plans under `docs/exec-plans/active/` and move finished plans to `docs/exec-plans/completed/`; plan Markdown and JSON sidecars are version-controlled project state.
89
+ - Keep resumable workstreams in `docs/exec-plans/workstreams.md`; this is version-controlled project state.
77
90
  - Keep generated evidence under `docs/generated/`; it is local runtime output and is ignored by git unless the human intentionally promotes a specific artifact into tracked docs.
78
91
  - Keep external, model-friendly references under `docs/references/`.
79
92
  - Keep SOPs explicit and task-triggered so the next agent can follow the same path mechanically.