@hallucination-studio/harness-engine 1.0.0-beta.10.9ff10d9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,262 @@
1
+ # Harness Engine
2
+
3
+ Harness Engine packages a Codex skill that bootstraps an agent-first repository harness.
4
+ It turns the repository-shaping ideas from OpenAI's
5
+ ["Harness engineering: leveraging Codex in an agent-first world"](https://openai.com/index/harness-engineering/)
6
+ into an installable `npx` workflow.
7
+
8
+ The package does not install a harness into this repository. This repository builds and publishes
9
+ the installer. Users install the bundled `harness-engine` skill into their own project or
10
+ global Codex skill directory, then ask Codex to use that skill to analyze the target repository,
11
+ ask for missing high-impact facts, create the harness files, and keep future work closed-loop.
12
+
13
+ ## What This Project Does
14
+
15
+ - Installs the `harness-engine` Codex skill locally, globally, or into a custom skills directory.
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.
19
+ - Adds SOPs for architecture setup, knowledge capture, local observability, and UI validation.
20
+ - Reconciles managed harnesses through the same `init` flow, refreshing managed files and backfilling newly introduced managed files while preserving unmanaged docs.
21
+ - Enforces a local harness check without assuming the user's project has CI.
22
+ - Previews and optionally removes stale unreferenced generated evidence under `docs/generated/`.
23
+ - Supports durable knowledge closure with stable knowledge IDs and evidence text, so permanent docs can use natural wording instead of duplicated checklist strings.
24
+ - Enforces a local quality gate for execution plans; failed scores write `## Rework Required` into the plan and block `plan-close`.
25
+ - Tracks resumable workstreams so interrupted features, refactors, reliability work, and cleanup efforts can be recovered from repo state instead of chat history.
26
+
27
+ ## Why It Exists
28
+
29
+ The OpenAI harness engineering article argues that agent-first repositories work better when the
30
+ repo itself becomes the system of record: a short `AGENTS.md` routes agents into deeper docs,
31
+ execution plans live beside the code, and validation loops are mechanical rather than remembered.
32
+ This project packages that shape as a reusable Codex skill.
33
+
34
+ The goal is not to blindly copy a template. The skill first analyzes the target repo, then asks the
35
+ human to confirm product, reliability, security, frontend, and quality facts that cannot be safely
36
+ inferred from code alone.
37
+
38
+ ## Install
39
+
40
+ The npm package is scoped as `@hallucination-studio/harness-engine`. The installed command name is
41
+ still `harness-engine`.
42
+
43
+ Install the latest stable release into the current repository:
44
+
45
+ ```bash
46
+ npx @hallucination-studio/harness-engine install --local
47
+ ```
48
+
49
+ Install the latest beta build from `main`:
50
+
51
+ ```bash
52
+ npx @hallucination-studio/harness-engine@beta install --local
53
+ ```
54
+
55
+ Install globally into `${CODEX_HOME:-~/.codex}/skills`:
56
+
57
+ ```bash
58
+ npx @hallucination-studio/harness-engine install --global
59
+ ```
60
+
61
+ Install into a custom skills directory:
62
+
63
+ ```bash
64
+ npx @hallucination-studio/harness-engine install --path /path/to/skills
65
+ ```
66
+
67
+ Replace an existing installed skill:
68
+
69
+ ```bash
70
+ npx @hallucination-studio/harness-engine install --local --force
71
+ ```
72
+
73
+ Show where the skill would be installed:
74
+
75
+ ```bash
76
+ npx @hallucination-studio/harness-engine where --local
77
+ ```
78
+
79
+ ## Update An Installed Skill Package
80
+
81
+ The `npx` installer only installs or replaces the Codex skill package. To update an already
82
+ installed skill, rerun `install` with `--force` in the same install location.
83
+
84
+ Replace the local skill install:
85
+
86
+ ```bash
87
+ npx @hallucination-studio/harness-engine install --local --force
88
+ ```
89
+
90
+ Replace the global skill install:
91
+
92
+ ```bash
93
+ npx @hallucination-studio/harness-engine install --global --force
94
+ ```
95
+
96
+ Replace a custom skill install:
97
+
98
+ ```bash
99
+ npx @hallucination-studio/harness-engine install --path /path/to/skills --force
100
+ ```
101
+
102
+ After the skill package is installed, the target repository workflow happens inside Codex. In the
103
+ target workspace, invoke the skill:
104
+
105
+ ```text
106
+ $harness-engine
107
+ ```
108
+
109
+ The skill should analyze the workspace and run the single workspace entrypoint:
110
+
111
+ - If the harness is not installed in that repository, `manage_harness.py init` creates it.
112
+ - If a managed harness already exists, `manage_harness.py init` reconciles it by refreshing managed files and backfilling newly introduced managed files.
113
+ - Unmanaged user files are preserved unless `--force` is explicitly used.
114
+
115
+ The underlying command for both cases is:
116
+
117
+ ```bash
118
+ python3 .codex/skills/harness-engine/scripts/manage_harness.py init --repo . --answers answers.json
119
+ ```
120
+
121
+ ## Use The Skill In A Target Repo
122
+
123
+ After installing, open Codex in the target repository and invoke:
124
+
125
+ ```text
126
+ $harness-engine
127
+ ```
128
+
129
+ The intended workflow is:
130
+
131
+ 1. Analyze the target repository.
132
+ 2. Ask the human only for unresolved, high-impact facts.
133
+ 3. Initialize or reconcile the harness files.
134
+ 4. Create execution plans for multi-step work.
135
+ 5. Log durable knowledge into active plans.
136
+ 6. Write the durable facts into permanent docs.
137
+ 7. Mark knowledge as written using ID plus evidence text.
138
+ 8. Score the finished work across product, UX/operator clarity, architecture, reliability, and security.
139
+ 9. If the quality gate fails, implement the generated `## Rework Required` items and score again.
140
+ 10. For phased or resumable work, update `Phase Continuity` and `docs/exec-plans/workstreams.md`.
141
+ 11. Close the execution plan only after the quality gate passes, phase continuity is recorded, and durable docs are updated.
142
+ 12. Run the local harness check before handoff.
143
+ 13. Periodically run `evidence-prune` to preview stale unreferenced generated evidence, and apply it only after reviewing the candidate list.
144
+
145
+ The installed skill exposes the underlying script at:
146
+
147
+ ```bash
148
+ python3 .codex/skills/harness-engine/scripts/manage_harness.py --help
149
+ ```
150
+
151
+ Common commands:
152
+
153
+ ```bash
154
+ python3 .codex/skills/harness-engine/scripts/manage_harness.py analyze --repo . --output analysis.json
155
+ python3 .codex/skills/harness-engine/scripts/manage_harness.py sample-answers --analysis analysis.json --output answers.json
156
+ python3 .codex/skills/harness-engine/scripts/manage_harness.py init --repo . --answers answers.json
157
+ python3 .codex/skills/harness-engine/scripts/manage_harness.py plan-start --repo . --slug feature-name --goal "Implement the feature"
158
+ 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"
159
+ 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"
160
+ 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"
161
+ python3 .codex/skills/harness-engine/scripts/manage_harness.py check --repo .
162
+ python3 .codex/skills/harness-engine/scripts/manage_harness.py evidence-prune --repo . --older-than-days 14
163
+ python3 .codex/skills/harness-engine/scripts/manage_harness.py evidence-prune --repo . --older-than-days 14 --apply
164
+ ```
165
+
166
+ The quality gate is intentionally local and repository-owned. It does not require the user's
167
+ project to have CI. `plan-close` refuses to move a plan to `completed` unless `quality-score`
168
+ has passed, and `check` reports active plans whose quality gate is missing or failing.
169
+
170
+ For multi-phase work, `Phase Continuity` and `docs/exec-plans/workstreams.md` form the recovery
171
+ ledger. A plan like `Local Workbench Phase 1` can close only after it records whether the workstream
172
+ continues, pauses, completes, or stops, and where the next agent should resume.
173
+
174
+ ## Generated Harness Shape
175
+
176
+ A typical initialized target repository receives:
177
+
178
+ ```text
179
+ AGENTS.md
180
+ ARCHITECTURE.md
181
+ docs/
182
+ ├── DESIGN.md
183
+ ├── FRONTEND.md
184
+ ├── PLANS.md
185
+ ├── PRODUCT_SENSE.md
186
+ ├── QUALITY_SCORE.md
187
+ ├── RELIABILITY.md
188
+ ├── SECURITY.md
189
+ ├── design-docs/
190
+ ├── exec-plans/
191
+ │ ├── active/
192
+ │ ├── completed/
193
+ │ ├── workstreams.md
194
+ │ └── tech-debt-tracker.md
195
+ ├── generated/
196
+ ├── product-specs/
197
+ ├── references/
198
+ └── sops/
199
+ ```
200
+
201
+ `AGENTS.md` is intentionally short. It is a router, not an encyclopedia.
202
+
203
+ ## Version Channels
204
+
205
+ - `latest`: Stable releases created from GitHub Release tags. The workflow derives the package version from the release tag and publishes to npm with the `latest` dist-tag.
206
+ - `beta`: Every push to `main` publishes a unique prerelease version like `1.0.0-beta.<run-number>.<short-sha>` with the `beta` dist-tag. npm cannot overwrite an existing version, so the `beta` tag moves forward to the newest main build.
207
+ - `nightly`: A scheduled daily build publishes versions like `1.0.0-nightly.<yyyymmdd>.<run-number>` with the `nightly` dist-tag.
208
+ - Manual test builds: The release workflow can be run manually. By default it performs `npm publish --dry-run` with a generated `-test.<run-number>` version. Set `dry_run=false` to publish a test package to a non-`latest` dist-tag such as `next`.
209
+
210
+ Examples:
211
+
212
+ ```bash
213
+ npx @hallucination-studio/harness-engine install --local
214
+ npx @hallucination-studio/harness-engine@beta install --local
215
+ npx @hallucination-studio/harness-engine@nightly install --local
216
+ ```
217
+
218
+ ## Local Development
219
+
220
+ Run the skill evaluations:
221
+
222
+ ```bash
223
+ npm test
224
+ ```
225
+
226
+ Smoke-test installation:
227
+
228
+ ```bash
229
+ npm run smoke:install
230
+ ```
231
+
232
+ Check npm package contents:
233
+
234
+ ```bash
235
+ npm run pack:check
236
+ ```
237
+
238
+ The publish workflows expect an npm token when trusted publishing is not yet configured:
239
+
240
+ ```text
241
+ GitHub Actions secret: NPM_TOKEN
242
+ ```
243
+
244
+ ## Implementation Quality Score
245
+
246
+ These scores describe the current implementation, not an external guarantee.
247
+
248
+ | Layer | Score | Notes |
249
+ | --- | ---: | --- |
250
+ | 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. |
251
+ | 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. |
252
+ | 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. |
253
+ | 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. |
254
+ | 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. |
255
+ | Evaluation coverage | 9 / 10 | `npm test` runs 12 structured eval cases covering empty-repo init, frontend analysis, init reconciliation, 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. |
256
+ | 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. |
257
+ | 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. |
258
+ | 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. |
259
+
260
+ ## Reference
261
+
262
+ - OpenAI: [Harness engineering: leveraging Codex in an agent-first world](https://openai.com/index/harness-engineering/)
package/bin/install.js ADDED
@@ -0,0 +1,154 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const os = require("os");
5
+ const path = require("path");
6
+
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);
10
+
11
+ function printHelp() {
12
+ console.log(`harness-engine
13
+
14
+ Usage:
15
+ npx @hallucination-studio/harness-engine install [--local | --global | --path <dir>] [--force]
16
+ npx @hallucination-studio/harness-engine where [--local | --global | --path <dir>]
17
+
18
+ Options:
19
+ --local Install into <cwd>/.codex/skills
20
+ --global Install into \${CODEX_HOME:-~/.codex}/skills
21
+ --path <dir> Install into a custom skills directory
22
+ --force Replace an existing installed skill
23
+ -h, --help Show this help text
24
+ `);
25
+ }
26
+
27
+ function parseArgs(argv) {
28
+ const result = {
29
+ command: "install",
30
+ mode: null,
31
+ customPath: null,
32
+ force: false
33
+ };
34
+
35
+ const args = [...argv];
36
+ if (args.length > 0 && !args[0].startsWith("-")) {
37
+ result.command = args.shift();
38
+ }
39
+
40
+ for (let i = 0; i < args.length; i += 1) {
41
+ const arg = args[i];
42
+ if (arg === "--local") {
43
+ result.mode = "local";
44
+ } else if (arg === "--global") {
45
+ result.mode = "global";
46
+ } else if (arg === "--path") {
47
+ result.mode = "custom";
48
+ result.customPath = args[i + 1];
49
+ i += 1;
50
+ } else if (arg === "--force") {
51
+ result.force = true;
52
+ } else if (arg === "-h" || arg === "--help") {
53
+ result.command = "help";
54
+ } else {
55
+ throw new Error(`Unknown argument: ${arg}`);
56
+ }
57
+ }
58
+
59
+ if (result.mode === "custom" && !result.customPath) {
60
+ throw new Error("--path requires a directory value");
61
+ }
62
+
63
+ if (!result.mode) {
64
+ result.mode = "local";
65
+ }
66
+
67
+ return result;
68
+ }
69
+
70
+ function resolveSkillsDir(mode, customPath) {
71
+ if (mode === "local") {
72
+ return path.join(process.cwd(), ".codex", "skills");
73
+ }
74
+
75
+ if (mode === "global") {
76
+ const codexHome = process.env.CODEX_HOME || path.join(os.homedir(), ".codex");
77
+ return path.join(codexHome, "skills");
78
+ }
79
+
80
+ return path.resolve(process.cwd(), customPath);
81
+ }
82
+
83
+ function copyDir(sourceDir, targetDir) {
84
+ fs.mkdirSync(targetDir, { recursive: true });
85
+ for (const entry of fs.readdirSync(sourceDir, { withFileTypes: true })) {
86
+ const sourcePath = path.join(sourceDir, entry.name);
87
+ const targetPath = path.join(targetDir, entry.name);
88
+ if (entry.isDirectory()) {
89
+ copyDir(sourcePath, targetPath);
90
+ } else {
91
+ fs.copyFileSync(sourcePath, targetPath);
92
+ const stat = fs.statSync(sourcePath);
93
+ fs.chmodSync(targetPath, stat.mode);
94
+ }
95
+ }
96
+ }
97
+
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}`);
102
+ }
103
+
104
+ if (fs.existsSync(skillTargetDir)) {
105
+ if (!force) {
106
+ throw new Error(`Skill already exists at ${skillTargetDir}. Re-run with --force to replace it.`);
107
+ }
108
+ fs.rmSync(skillTargetDir, { recursive: true, force: true });
109
+ }
110
+
111
+ fs.mkdirSync(destinationDir, { recursive: true });
112
+ copyDir(SOURCE_SKILL_DIR, skillTargetDir);
113
+ return skillTargetDir;
114
+ }
115
+
116
+ function main() {
117
+ let args;
118
+ try {
119
+ args = parseArgs(process.argv.slice(2));
120
+ } catch (error) {
121
+ console.error(`Error: ${error.message}`);
122
+ printHelp();
123
+ process.exit(1);
124
+ }
125
+
126
+ if (args.command === "help") {
127
+ printHelp();
128
+ return;
129
+ }
130
+
131
+ const destinationDir = resolveSkillsDir(args.mode, args.customPath);
132
+
133
+ if (args.command === "where") {
134
+ console.log(path.join(destinationDir, SKILL_NAME));
135
+ return;
136
+ }
137
+
138
+ if (args.command !== "install") {
139
+ console.error(`Unknown command: ${args.command}`);
140
+ printHelp();
141
+ process.exit(1);
142
+ }
143
+
144
+ try {
145
+ const installedPath = installSkill(destinationDir, args.force);
146
+ console.log(`Installed ${SKILL_NAME} to ${installedPath}`);
147
+ console.log("Invoke it in Codex with $harness-engine.");
148
+ } catch (error) {
149
+ console.error(`Install failed: ${error.message}`);
150
+ process.exit(1);
151
+ }
152
+ }
153
+
154
+ main();
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@hallucination-studio/harness-engine",
3
+ "version": "1.0.0-beta.10.9ff10d9",
4
+ "description": "Install the harness-engine Codex skill for initializing and reconciling advanced repository harness docs.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/hallucination-studio/harness-engine.git"
8
+ },
9
+ "bin": {
10
+ "harness-engine": "bin/install.js"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "scripts": {
16
+ "test": "python3 skills/harness-engine/evals/run_evals.py",
17
+ "smoke:install": "node scripts/smoke_install.js",
18
+ "pack:check": "npm pack --dry-run"
19
+ },
20
+ "files": [
21
+ "bin",
22
+ "skills/**/SKILL.md",
23
+ "skills/**/agents/**",
24
+ "skills/**/assets/**",
25
+ "skills/**/evals/*.json",
26
+ "skills/**/evals/*.py",
27
+ "skills/**/references/**",
28
+ "skills/**/scripts/*.py"
29
+ ],
30
+ "license": "MIT"
31
+ }
@@ -0,0 +1,82 @@
1
+ ---
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.
4
+ ---
5
+
6
+ # Harness Engine
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.
9
+
10
+ ## Workflow
11
+
12
+ 1. Run `python3 scripts/manage_harness.py analyze --repo <target-repo> --output <analysis.json>`.
13
+ 2. Read `analysis.json`.
14
+ 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. After changing this skill, run `python3 evals/run_evals.py` and iterate until it passes.
32
+
33
+ ## Reading Order
34
+
35
+ - Read [references/workflow.md](references/workflow.md) first for the operating model and question policy.
36
+ - Read [references/file-map.md](references/file-map.md) when deciding which generated file to edit.
37
+ - Read [references/question-catalog.md](references/question-catalog.md) when the analysis surfaces ambiguous product, security, reliability, or frontend facts.
38
+ - Read [references/knowledge-capture.md](references/knowledge-capture.md) when you discover facts that should survive chat history.
39
+ - Read [references/exec-plans.md](references/exec-plans.md) before planning or updating any multi-step work.
40
+ - Read [references/sop-index.md](references/sop-index.md) to choose the right SOP for architecture, UI validation, observability, or knowledge capture work.
41
+ - Read [references/template-policy.md](references/template-policy.md) before overwriting existing files.
42
+ - Read [references/evaluation-loop.md](references/evaluation-loop.md) before changing the skill, templates, scripts, or policy references.
43
+ - Read [references/evidence-first-evals.md](references/evidence-first-evals.md) before designing evals for product correctness, frontend validation, or bug-discovery coverage.
44
+
45
+ ## Command Rules
46
+
47
+ - Prefer `analyze` before `init`.
48
+ - Prefer the draft, test, evaluate, iterate loop for changes to this skill.
49
+ - Use `init` as the workspace entrypoint for both creation and reconciliation. It refreshes managed harness files when an existing managed harness is detected and preserves unmanaged user files. Use `--force` only when the human accepts overwriting.
50
+ - Do not overwrite existing files unless the human asked for it or you pass `--force`.
51
+ - Treat the generated files as starting points. After generation, tighten them with repository-specific details instead of leaving placeholders behind.
52
+ - 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.
53
+ - Treat `docs/exec-plans/` as required state for multi-step work, not optional notes.
54
+ - Read `docs/exec-plans/workstreams.md` before resuming interrupted feature, refactor, reliability, security, frontend, or cleanup work.
55
+ - Treat `docs/sops/` as mechanical operating procedures, not background reading.
56
+ - 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.
57
+ - Prefer `knowledge-mark-written --id ... --evidence-file ...` so durable docs can use natural wording without shell quoting failures or duplicated exact fact strings.
58
+ - 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.
59
+ - Use `defect-log` for every bug found by tests, evals, browser validation, or code review; unresolved defects must block handoff.
60
+ - Use `defect-resolve` only after the implementation is fixed and you can cite passing validation or code evidence.
61
+ - 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.
62
+ - Use `phase-set` and `workstream-upsert` before `plan-close` for Phase 1/2/3 or any other resumable multi-plan work.
63
+ - Use `plan-close` as the final guardrail so plan state, quality score, and durable docs stay synchronized.
64
+ - Use `check` as the local handoff guardrail for user repositories.
65
+ - Use `evidence-prune` as a cleanup preview for old unreferenced files under `docs/generated/`; it never deletes unless `--apply` is present.
66
+ - Run `python3 evals/run_evals.py` after skill changes, read the structured report, and treat per-case failures as iteration input.
67
+ - Do not add CI to user repositories unless the human explicitly asks for it.
68
+
69
+ ## Output Rules
70
+
71
+ - Keep `AGENTS.md` short and routing-oriented.
72
+ - Keep durable knowledge in repo docs, not in chat-only explanations.
73
+ - Keep plans under `docs/exec-plans/active/` and move finished plans to `docs/exec-plans/completed/`.
74
+ - Keep resumable workstreams in `docs/exec-plans/workstreams.md`.
75
+ - Keep generated material under `docs/generated/`.
76
+ - Keep external, model-friendly references under `docs/references/`.
77
+ - Keep SOPs explicit and task-triggered so the next agent can follow the same path mechanically.
78
+
79
+ ## Assets
80
+
81
+ - Scaffold templates live under [assets/repo-template](assets/repo-template).
82
+ - SOP starter docs live under [assets/sops](assets/sops).
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Harness Engine"
3
+ short_description: "Scaffold advanced Codex harness docs"
4
+ default_prompt: "Use $harness-engine to analyze this repository and scaffold or refresh its advanced harness documentation."
@@ -0,0 +1 @@
1
+ starter files are generated by scripts/manage_harness.py
@@ -0,0 +1 @@
1
+ sop starter files are generated by scripts/manage_harness.py
@@ -0,0 +1,50 @@
1
+ [
2
+ {
3
+ "id": "empty-repo-init",
4
+ "description": "Empty repositories should receive the full advanced harness scaffold."
5
+ },
6
+ {
7
+ "id": "frontend-analysis",
8
+ "description": "Frontend repositories should trigger frontend-specific confirmation and policy output."
9
+ },
10
+ {
11
+ "id": "init-reconciles-existing-harness",
12
+ "description": "Init should reconcile an existing harness by refreshing managed files and adding newly introduced managed files."
13
+ },
14
+ {
15
+ "id": "closed-loop-plan",
16
+ "description": "Execution plans should refuse to close until durable knowledge is written back."
17
+ },
18
+ {
19
+ "id": "phase-continuity-workstream",
20
+ "description": "Phased plans should record continuation and keep workstream references recoverable."
21
+ },
22
+ {
23
+ "id": "plan-path-canonicalization",
24
+ "description": "Plan commands should canonicalize absolute plan paths before updating workstreams."
25
+ },
26
+ {
27
+ "id": "defect-recovery-loop",
28
+ "description": "Validation or review defects should block quality gates until resolved with evidence."
29
+ },
30
+ {
31
+ "id": "quality-score-requires-notes",
32
+ "description": "Quality scoring should reject missing evidence notes and name the missing dimensions."
33
+ },
34
+ {
35
+ "id": "knowledge-evidence-verbatim",
36
+ "description": "Knowledge closure should reject paraphrased evidence and accept exact destination text."
37
+ },
38
+ {
39
+ "id": "evidence-prune-generated-artifacts",
40
+ "description": "Generated evidence cleanup should dry-run by default and remove only stale unreferenced artifacts when applied."
41
+ },
42
+ {
43
+ "id": "eval-report-shape",
44
+ "description": "Eval output should expose structured per-case scores, findings, user-facing messages, and recommended actions."
45
+ },
46
+ {
47
+ "id": "preserve-unmanaged-docs",
48
+ "description": "Existing user-owned harness files should be skipped unless explicitly forced."
49
+ }
50
+ ]