harness-everything 0.11.5 → 0.11.7

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 (55) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +32 -0
  4. package/README.md +7 -3
  5. package/ci/mechanism-2a-rule-of-3.test.js +71 -0
  6. package/ci/mechanism-2ah-workflow-lifecycle.test.js +314 -8
  7. package/ci/mechanism-2c-state-persist.test.js +45 -2
  8. package/ci/mechanism-2t-issue-20.test.js +0 -8
  9. package/ci/mechanism-30-opencode-plugin-loadability.test.js +39 -7
  10. package/docs/architecture.md +17 -0
  11. package/docs/audit.md +52 -5
  12. package/docs/release-evidence.md +3 -0
  13. package/docs/workflow-runtime.md +13 -0
  14. package/docs/workflows/environment-detection.md +47 -37
  15. package/docs/workflows/eval-harness.md +45 -38
  16. package/docs/workflows/fable-discipline.md +45 -33
  17. package/docs/workflows/git-commit.md +53 -45
  18. package/docs/workflows/grill-me.md +36 -38
  19. package/docs/workflows/grill-with-docs.md +36 -46
  20. package/docs/workflows/harness-everything.md +59 -57
  21. package/docs/workflows/improve-codebase-architecture.md +36 -44
  22. package/docs/workflows/install-cognitive-os.md +36 -29
  23. package/docs/workflows/repo-docs.md +29 -40
  24. package/docs/workflows/rewrite-commits.md +40 -36
  25. package/docs/workflows/security-review.md +34 -53
  26. package/docs/workflows/skill-creator.md +39 -56
  27. package/docs/workflows/skill-style.md +35 -40
  28. package/docs/workflows/using-git-worktrees.md +40 -44
  29. package/docs/workflows/verification-loop.md +43 -48
  30. package/docs/workflows/verify-before-claim.md +37 -40
  31. package/docs/workflows/zoom-out.md +39 -51
  32. package/harness-everything/SKILL.md +1 -1
  33. package/harness-everything/scripts/kernel-router.js +38 -10
  34. package/hooks/hooks.json +25 -1
  35. package/hooks/scripts/lib/workflow-isolation.js +111 -6
  36. package/hooks/scripts/lib/workflow-runtime.js +138 -2
  37. package/hooks/scripts/rule-of-3-tracker.js +17 -9
  38. package/hooks/scripts/state-persist.js +52 -9
  39. package/hooks/scripts/workflow-gate.js +22 -7
  40. package/hooks/scripts/workflow-mutation-denied.js +17 -0
  41. package/opencode-plugin/plugin.json +1 -1
  42. package/package.json +1 -1
  43. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  44. package/plugins/harness-everything/hooks/hooks.json +1 -1
  45. package/plugins/harness-everything/hooks/scripts/lib/workflow-isolation.js +111 -6
  46. package/plugins/harness-everything/hooks/scripts/lib/workflow-runtime.js +138 -2
  47. package/plugins/harness-everything/hooks/scripts/rule-of-3-tracker.js +17 -9
  48. package/plugins/harness-everything/hooks/scripts/state-persist.js +52 -9
  49. package/plugins/harness-everything/hooks/scripts/workflow-gate.js +22 -7
  50. package/plugins/harness-everything/hooks/scripts/workflow-mutation-denied.js +17 -0
  51. package/plugins/harness-everything/plugin.json +1 -1
  52. package/plugins/harness-everything/skills/harness-everything/SKILL.md +1 -1
  53. package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router.js +38 -10
  54. package/docs/issue-20-rollup.md +0 -47
  55. package/docs/reviews/pr-142-issue-131.md +0 -89
@@ -40,13 +40,29 @@ function verifyInstall(text) {
40
40
  }
41
41
  }
42
42
 
43
+ function isWorktreeRoot(dir) {
44
+ try {
45
+ return fs.existsSync(path.join(dir, '.git'));
46
+ } catch (_) {
47
+ return false;
48
+ }
49
+ }
50
+
43
51
  function walk(directory) {
44
52
  return fs.readdirSync(directory, { withFileTypes: true }).flatMap(entry => {
45
- if (['node_modules', '.git'].includes(entry.name) || entry.isSymbolicLink()) return [];
53
+ if (['node_modules', '.git', '.worktrees'].includes(entry.name) || entry.isSymbolicLink()) return [];
46
54
  const file = path.join(directory, entry.name);
47
55
  const relative = path.relative(root, file).split(path.sep).join('/');
48
56
  if (relative === 'benchmarks/results' || relative === 'CHANGELOG.md') return [];
49
- return entry.isDirectory() ? walk(file) : [file];
57
+ if (relative === '.worktrees' || relative.startsWith('.worktrees/')) return [];
58
+ if (entry.isDirectory()) {
59
+ // Skip linked worktrees / nested checkouts: a `.git` file marks a
60
+ // linked worktree root, a `.git` dir marks a nested repo. Either way
61
+ // the content belongs to another checkout, not this one (#170).
62
+ if (isWorktreeRoot(file)) return [];
63
+ return walk(file);
64
+ }
65
+ return [file];
50
66
  });
51
67
  }
52
68
 
@@ -68,12 +84,28 @@ try {
68
84
  }
69
85
  assert.deepStrictEqual(invalidTargets('opencode-plugin/index.mjs .opencode/plugins/example.js'), []);
70
86
 
71
- const violations = [];
72
- for (const file of walk(root).filter(file => /\.(?:md|js|mjs|json|jsonc|yml|yaml|txt)$/.test(file))) {
87
+ const scanViolations = (readText = file => fs.readFileSync(file, 'utf8')) => {
88
+ const violations = [];
89
+ for (const file of walk(root).filter(file => /\.(?:md|js|mjs|json|jsonc|yml|yaml|txt)$/.test(file))) {
90
+ const text = readText(file);
91
+ for (const target of invalidTargets(text)) violations.push(`${path.relative(root, file)}: ${target}`);
92
+ }
93
+ return violations;
94
+ };
95
+ assert.deepStrictEqual(scanViolations(), [], 'Unsupported OpenCode install destinations; only .js/.ts are auto-discovered');
96
+
97
+ const scannedFiles = walk(root);
98
+ assert.ok(scannedFiles.includes(readmeFile), 'Tracked OpenCode README must remain in the repository scan');
99
+ const plantedTarget = '.opencode/plugins/' + 'negative-control.mjs';
100
+ const planted = scanViolations(file => {
73
101
  const text = fs.readFileSync(file, 'utf8');
74
- for (const target of invalidTargets(text)) violations.push(`${path.relative(root, file)}: ${target}`);
75
- }
76
- assert.deepStrictEqual(violations, [], 'Unsupported OpenCode install destinations; only .js/.ts are auto-discovered');
102
+ return file === readmeFile ? text + '\n' + plantedTarget + '\n' : text;
103
+ });
104
+ assert.ok(
105
+ planted.some(item => item === `${path.relative(root, readmeFile)}: ${plantedTarget}`),
106
+ 'Scanner negative control must fail when a tracked file contains an unsupported .mjs install target'
107
+ );
108
+
77
109
  const readme = fs.readFileSync(readmeFile, 'utf8');
78
110
  for (const destination of ['.opencode/plugins/harness-enforcement.js', '~/.config/opencode/plugins/harness-enforcement.js']) {
79
111
  assert.ok(readme.includes(`cp opencode-plugin/index.mjs ${destination}`));
@@ -73,6 +73,23 @@ For selected Fable topologies on Claude:
73
73
 
74
74
  Other topologies use their own applicable mechanisms: loop budgets, regular verification stop-gates, action gates, and task-specific skills. Mechanism coverage is not assumed identical across hosts.
75
75
 
76
+ ### Scoped runtime advisories and capabilities
77
+
78
+ Two kernel mechanisms adjust plans without changing the mandatory-workflow contract:
79
+
80
+ - **Ensemble policy (`harness-everything/scripts/ensemble-policy.js`):** an advisory plan annotation, not a separate topology. It is selected only when uncertainty is high (or stakes are high) **and** the task asks for comparable outputs or preserves explicit disagreement **and** the selected strategy is already `fable-*`. Creative generation, mechanical bulk work, an explicit user prohibition, unavailable subagents, or a blocked base plan force exclusion. When selected, the plan caps at 3 candidates with `preserve-disagreement` synthesis, an independent verifier, and `parallel-self-consistency` pattern invariants. Covered by deterministic mechanism tests; no live-host effectiveness claim follows from the annotation alone.
81
+ - **Single-use memory capability (`kernel-router.js#issueMemoryCapability`):** when the selected plan permits memory writes, the router issues one capability token bound to `sessionId`/`workflowId` with a stored SHA-256 hash (`memoryAuthorization`, coordinator-only writer role, `usedAt` tracking). Plans with `memory.write === 'none'` receive no capability. This binds a memory write to the workflow that authorized it; it is not a general credential and proves nothing about a live host honoring the binding.
82
+
83
+ ### PreToolUse guard trio and denied-mutation probes
84
+
85
+ On the Claude hook path, three narrowly scoped `PreToolUse` guards sit alongside the workflow/action gates:
86
+
87
+ - `boundary-guard.js` (Grep/Glob/Read): hard-blocks whole-file reads over 512KB without `offset`/`limit` and searches inside known noise directories (`node_modules`, `.git`, build output, etc.). Fails open on parse/lookup errors.
88
+ - `depth-guard.js` (Write): blocks overwriting an existing file that was never Read earlier in the session transcript. New files are unaffected. Fails open on parse/lookup errors.
89
+ - `context-compact.js`: estimates working-tree context pressure from `git status`/`git diff --numstat` so later stages can compact or halt before lost-in-the-middle degradation.
90
+
91
+ Shell mutation accounting is per-tool-call: `workflow-isolation.js` fingerprints observed effects per tool-use identity, `state-persist.js` settles probes in a single ordered handler, and `workflow-mutation-denied.js` discards probes for denied shell executions so a denial never counts as an observed mutation. See [runtime transitions and limitations](workflow-runtime.md). These are mechanism-tested behaviors on the packaged hook surface, not proof that a live session loaded or fired them.
92
+
76
93
  ## Integration Touchpoints
77
94
 
78
95
  Harness aligns to each host's actual lifecycle/tool APIs. Shared skill text defines a contract; only supported host mechanisms can mechanically block or observe particular transitions.
package/docs/audit.md CHANGED
@@ -2,17 +2,58 @@
2
2
 
3
3
  Maintainer-facing audit record. If you just want to know whether Harness works and how to verify it yourself, start at [VERIFICATION.md](../VERIFICATION.md) instead — this file records *how the scores below were obtained* and what changed between audit cycles.
4
4
 
5
- > **Historical snapshot boundary:** the scorecard below is the 2026-09-01 audit and is intentionally preserved as evidence of what was measured on that date. Platform capabilities have changed since then (including the OpenAI/Codex local plugin work and the OpenCode plugin implementation). Do not treat the 2026-09-01 platform rows as current-state documentation; use [platform-capabilities.md](platform-capabilities.md) for the current matrix.
5
+ > **Historical snapshot boundary:** the scorecards below are dated audits and are intentionally preserved as evidence of what was measured on each date. Platform capabilities have changed since the 2026-09-01 snapshot (including the OpenAI/Codex local plugin work and the OpenCode plugin implementation). Do not treat any dated platform row as current-state documentation; use [platform-capabilities.md](platform-capabilities.md) for the current matrix.
6
6
 
7
- **Last self-audited: 2026-09-01**, by running the actual test suite and the VERIFICATION.md recipes on Windows 11 — not by reading the code and assuming it works.
7
+ **Last self-audited: 2026-09-18**, by running the deterministic test suite and gates on macOS (Node.js 24.14.1) — not by reading the code and assuming it works. The 2026-09-01 Windows 11 snapshot is preserved below. Live-host and behavioral evidence layers were not re-run in this cycle; retained artifacts are referenced, not re-measured.
8
8
 
9
- ## The 2026-07-23 mis-measurement incident
9
+ ## The 2026-09-18 audit cycle
10
+
11
+ Measured on `docs/sync-skills-and-mechanisms` at `45f2123` (docs-only delta over v0.11.6): 26/26 on-disk canonical skills, 26/26 routing-eval directories (`evals/` also holds `evaluation-reports.md`), and the following gate results:
12
+
13
+ | Gate | Result on 2026-09-18 |
14
+ |---|---|
15
+ | `npm test` (self-regression, 43 passing checks) | Green except one pre-existing failure: `mechanism-30-opencode-plugin-loadability`, reproduced on the clean tree and caused by leftover `.worktrees/docs-skill-catalog` fixtures asserting `.mjs` destinations — not by product code |
16
+ | `npm run test:mutations` | Passed: 8 production mutations rejected by focused tests |
17
+ | `npm run test:consistency` (incl. doc-capability + repo-contract) | Passed |
18
+ | `npm run test:references` | Passed: 66 skill path references resolve across 26 skills |
19
+ | `npm run test:collision` | Passed: no description collisions at 0.75 threshold |
20
+ | `npm run test:routing:skills` | Passed: 34 positive cases across 26 direct skills; 4 nested skills classified |
21
+ | `npm run test:routing:invariants` | Passed: 275 checks, 0 failures (incl. workflow execution enforcement) |
22
+ | `node ci/disclosure-check.js` | Passed: 26 skills, 26 workflow docs |
23
+ | `npm run test:plugin:openai` / `test:plugin:submission` / `test:platform:compatibility` / `test:release` | All passed; release catalog green for v0.11.6 at 26/26 |
24
+ | `waza tokens check` | All 26 canonical skills within the 500-token limit; the single exceedance is the intentional `eval-framework/fixtures/over-budget-skill` negative control (855 tokens, exists to exercise the failure path) |
25
+
26
+ Since the 2026-09-01 snapshot, the product gained the mandatory-workflow contract (#142), runtime budget enforcement (#143), structured action gate (#144), memory governance (#145), self-evolve closed loop (#146), telemetry core (#147), contract-integrity phase 1 (#148), workflow controller recovery and isolation hardening (#150/#152/#154/#156/#158), observed-mutation accounting (#160), the Codex local plugin plus Claude certification boundary (#123), OpenCode `.js` loadability guard and partial live-host evidence (#128/#129), and the paired-benchmark contract (#130) — all covered by deterministic mechanism tests. The docs lag this cycle closed: stale `docs/workflows` rewrites, the README index gaps, and the previously undocumented ensemble/memory/guard/probe mechanisms are synced in the same change as this audit entry.
27
+
28
+ ## Five Core Verification Criteria — 2026-09-18 re-measurement
29
+
30
+ | Criterion | Score | Verified basis |
31
+ |---|---|---|
32
+ | **Skill Description Completeness** | 10/10 | 26/26 skill directories carry complete frontmatter and the required trigger sections, verified by the consistency gate in this cycle. Internal hooks remain intentionally non-routable. |
33
+ | **Routing Accuracy** | 9/10 | 34/34 positive prompts across all 26 skills plus 275/275 invariant-routing checks in this cycle. Waza generalization (ambiguous/metaphorical prompts) and live model sessions remain unmeasured. |
34
+ | **Test Coverage of All Skills** | 9.5/10 | Self-regression now spans syntax, CLI, routing matrix, positive route coverage, invariant routing, references, behavioral-case structure, Fable contract, mutations, and 40+ mechanism suites. Waza full-matrix verify and live sessions remain separate on-demand evidence; `mechanism-30` is red only where the stale `.worktrees` leftover exists. |
35
+ | **Configuration Balance** | 9/10 | Hard `exit(2)` blocking hooks on Claude Code, mechanism-tested local Codex plugin package, and partial OpenCode live-host evidence (project `.js` scope, 1.18.31 macOS) — all centralized in `docs/platform-capabilities.md`. Live parity beyond the retained artifacts is still unclaimed. |
36
+ | **Workflow Conformance** | 9/10 | 26/26 skills have matching workflow documents (two stale ones rewritten in this cycle), the selected-workflow contract with escape/budget/stop-gate semantics is mechanism-tested, and disclosure passes. Runtime tool-call sequence conformance remains host-dependent and is not claimed. |
37
+
38
+ ## Overall Scorecard — 2026-09-18
39
+
40
+ | Category | Score | Notes |
41
+ |---|---|---|
42
+ | **Architecture** | 9/10 | Per-session state isolation, worktree-gated Tier 3 mutation, per-tool mutation probes settled in one ordered handler, and single-use memory capabilities — all mechanism-tested in this cycle. |
43
+ | **Test Coverage** | 9.5/10 | 43 passing self-regression checks, 8/8 mutations rejected, 66/66 references resolve. Live model evaluation remains on-demand and is not represented by a local simulation. |
44
+ | **README Completeness** | 9.5/10 | Catalog counts, layer labels, route coverage, and the 26-skill tree match after this cycle's index fix (`contract-integrity`/`telemetry`/`eval-framework` rows added). |
45
+ | **Maintainability** | 9/10 | ~600 commits across 20+ PRs since 09-01 landed without breaking the consistency/release/disclosure gates; new non-skill directories are documented as non-skills rather than left ambiguous. |
46
+ | **Skills Design** | 9.5/10 | All 26 skills keep the Skill Contract format, `USE FOR`/`DO NOT USE FOR` sections, and the 500-token limit (verified by waza in this cycle); internal hooks remain intentionally non-routable. |
47
+ | **Agent Compatibility** | 9/10 | Claude hard-mechanism support measured, Codex local plugin mechanism-tested, OpenCode partial live evidence retained — see the current platform matrix, not this row, for status. |
48
+ | **Beginner Friendliness** | 7.5/10 | Unchanged since 09-01: Tier Routing / Rule of 3 / session-scoped state remain load-bearing concepts. The two rewritten workflow docs reduce stale-doc confusion but add no onboarding track. Not addressed in this audit round. |
49
+
50
+ ## The 2026-07-23 mis-measurement incident (preserved)
10
51
 
11
52
  Seven independent AI-model audits (Gemini 3.1 Pro, Gemini 3.5 Flash, GPT/Copilot on Mistral Medium/Small, and others) ran the same week and disagreed sharply on whether core hooks even functioned. Three of them tested `rule-of-3.js`, `boundary-guard.js`, and `state-persist.js` by piping JSON through `echo '...' | node script.js` in Windows Git Bash, which mangles stdin/TTY state and produced false "broken" verdicts. Re-running the identical payloads through Node's own `child_process` stdin API (the technique VERIFICATION.md's recipes now use) showed every one of those mechanisms working exactly as documented — the scores below reflect that corrected, verified state, not the average of the seven reports.
12
53
 
13
54
  This incident is why VERIFICATION.md's recipes were rewritten to be Windows-safe (`node -e` stdin instead of a shell `echo` pipe), and why the §2 mechanism checks were automated as `ci/mechanism-test.js` (`npm run test:mechanism`) — copy-paste recipes that can be mis-executed are not a reliable verification substrate.
14
55
 
15
- ## Five Core Verification Criteria (per VERIFICATION.md §5a)
56
+ ## Five Core Verification Criteria — 2026-09-01 snapshot (per VERIFICATION.md §5a)
16
57
 
17
58
  | Criterion | Score | Verified basis |
18
59
  |---|---|---|
@@ -22,7 +63,7 @@ This incident is why VERIFICATION.md's recipes were rewritten to be Windows-safe
22
63
  | **Configuration Balance** | 8.5/10 | **Historical 2026-09-01 result:** hard `exit(2)` blocking hooks were measured on Claude Code and the other then-installed platform paths were evaluated as advisory. This row predates the later OpenAI/Codex local plugin and OpenCode plugin work; see `docs/platform-capabilities.md` for current status. |
23
64
  | **Workflow Conformance** | 8.5/10 | Every skill in the snapshot had a matching workflow document, and `ci/skill-routing-check.js` executed every positive route case against the real router. Runtime tool-call sequence conformance remained host-dependent and was not claimed. |
24
65
 
25
- ## Overall Scorecard
66
+ ## Overall Scorecard — 2026-09-01 snapshot
26
67
 
27
68
  | Category | Score | Notes |
28
69
  |---|---|---|
@@ -36,6 +77,12 @@ This incident is why VERIFICATION.md's recipes were rewritten to be Windows-safe
36
77
 
37
78
  ## Change log by audit cycle
38
79
 
80
+ ### 2026-09-18
81
+ - Re-measured the deterministic suite and gates on macOS (Node.js 24.14.1): 43 passing self-regression checks, 8/8 mutations rejected, 66/66 references resolve, 34/34 positive routes, 275/275 invariant checks, disclosure 26/26, release catalog green for v0.11.6. Sole red is the pre-existing `mechanism-30` failure from leftover `.worktrees/docs-skill-catalog` fixtures, reproduced on the clean tree.
82
+ - Closed the docs lag accumulated since 09-01 in the same change: rewrote the stale `docs/workflows/harness-everything.md` and `install-cognitive-os.md`, added the missing README index rows (`contract-integrity`/`telemetry`/`eval-framework`), and documented the ensemble policy, single-use memory capability, guard trio, and mutation-probe lifecycle in `docs/architecture.md` / `docs/workflow-runtime.md`.
83
+ - Product changes since 09-01 now covered by mechanism tests: mandatory-workflow contract, budget enforcement, structured action gate, memory governance, self-evolve closed loop, telemetry core, contract-integrity phase 1, controller recovery/isolation hardening, observed-mutation accounting, Codex local plugin, OpenCode partial live evidence, paired-benchmark contract. Live-host and behavioral layers were not re-run; retained artifacts stand.
84
+ - Beginner Friendliness stays 7.5/10: still no onboarding track. Candidate for the next cycle.
85
+
39
86
  ### 2026-09-01
40
87
  - Fable v3 integration exposed explicit Haiku, Sonnet, and Opus entrypoints, with deterministic model selection and visible inline fallback or blocked escalation in `fable-mode/model-matrix.json` and `fable-mode/scripts/model-selector.js`.
41
88
  - The workflow used native host TODO tracking or Markdown checklists. The older shared TODO CLI/state-machine references below are retained only as historical audit evidence; no current runtime, test, or active workflow depends on them.
@@ -9,6 +9,9 @@ The following evidence was collected on 2026-09-07 before the issue #20 integrat
9
9
  | Version | Registry observation | GitHub release | Workflow run | Gate and publish result |
10
10
  | --- | --- | --- | --- | --- |
11
11
  | 0.3.6 | `npm view harness-everything version dist-tags --json`: version and latest are `0.3.6` | `v0.3.6`, published 2026-09-01T03:50:44Z | [33466676632](https://github.com/dyphn1/Harness-everything/actions/runs/33466676632), commit `5aa74119d08ff241a7d6fe8f163a6a0d40c3c932` | `gate=success`, `publish=success` |
12
+ | 0.11.6 | `npm view harness-everything version dist-tags --json` (collected 2026-09-18): version and latest are `0.11.6` | `v0.11.6`, published 2026-09-18T12:51:58Z | [35346673284](https://github.com/dyphn1/Harness-everything/actions/runs/35346673284), commit `23d87db8230dcb524651dc67e932f54aa6f5c737` | `gate=success` (12/12 jobs incl. skill-quality, runtime-floor, self-regression x3 OS, consistency x3 OS, installer-e2e x3 OS, release-semantics), `publish=success` (job `release`) |
13
+
14
+ Intermediate versions between 0.3.6 and 0.11.6 were published via the same tag-driven workflow but were not individually ledgered here; the rows above are the two deliberately collected observations. A registry/GitHub listing alone is still not a completed row — each field must be a command output or inspectable URL.
12
15
 
13
16
  The source capture for this row is the local review artifact `.git/issue-review-20260907/release-evidence.md`. That review artifact is not expected to be present in every checkout; it is historical evidence, not a release artifact shipped in the npm package.
14
17
 
@@ -63,6 +63,19 @@ have effects a hook cannot infer. OS/host sandboxing is needed to contain them.
63
63
  Agent-writable state is also not tamper-proof. These mechanisms prevent tested
64
64
  bypasses; they do not establish durable containment against a malicious agent.
65
65
 
66
+ ## Mutation probes
67
+
68
+ Shell-effect accounting is keyed per tool call, not per command text. The gate
69
+ registers a pending probe per shell tool-use identity (`workflow-isolation.js`),
70
+ `state-persist.js` settles probes in a single ordered handler, and
71
+ `workflow-mutation-denied.js` discards the probe when that shell execution is
72
+ denied — a denial is never recorded as an observed mutation. Staging-insensitive
73
+ fingerprinting keeps the comparison on visible content, so metadata-only Git
74
+ operations do not register as workspace effects. These lifecycle semantics are
75
+ covered by deterministic workflow mechanism tests (`ci/mechanism-2ah-*`); live
76
+ host loading and behavioral improvement still require separately retained host
77
+ traces and paired evaluations.
78
+
66
79
  ## Escape, replan, and completion
67
80
 
68
81
  Escape names one stage in the correlated run and records the uncovered scope,
@@ -1,63 +1,73 @@
1
1
  # Workflow: Environment Detection
2
2
 
3
- > Active shell, operating system, and toolset environment detection, providing safety guardrails and running preflight syntactic verification.
3
+ > Detect OS, shell variant, and available dev tools at session start so commands use the right path, variable, and CLI syntax and avoid repeated execution errors.
4
4
 
5
- ---
5
+ Source of truth: `environment-detection/SKILL.md`.
6
6
 
7
7
  ## 1. Skill Behavior Workflow
8
8
 
9
- This section visualizes how the `environment-detection` skill executes internally, detailing the sequence of operations, state transitions, and evaluation steps.
10
-
11
9
  ```mermaid
12
10
  graph TD
13
- Start([Session Start / Discover Phase]) --> CheckNode{Node.js Executable?}
14
- CheckNode -->|Yes| RunPreflight["Run scripts/preflight.js"]
15
- CheckNode -->|No / Fails| Heuristic["Inspect <environment_info> & Probe Shell via echo/env"]
16
-
17
- RunPreflight --> ParseOutput["Parse OS, Shell, Path Separators & CLI Runtimes"]
18
- Heuristic --> ParseOutput
19
-
20
- ParseOutput --> SelfHeal["Run self-heal.js if Node available"]
21
- SelfHeal --> AlignSyntax["Adopt Path Slash (/ vs \\) & Env Var Syntax ($VAR vs %VAR%)"]
22
- AlignSyntax --> End([Environment Context Established])
11
+ SessionStart([Session start or complex terminal sequence]) --> Preflight[Run preflight.js from skill dir]
12
+ Preflight --> PreflightOk{Preflight succeeded?}
13
+ PreflightOk -->|yes| ParseOut[Parse OS shell PATH and CLIs]
14
+ PreflightOk -->|no| FallbackProbe[Inspect environment_info and probe shell]
15
+ FallbackProbe --> ParseOut
16
+ ParseOut --> SelfHealAudit[Audit harness touchpoints with self-heal.js]
17
+ SelfHealAudit --> AdoptSyntax[Adopt shell-specific syntax]
18
+ AdoptSyntax --> DoneCtx([Session context aligned])
23
19
  ```
24
20
 
25
- ---
21
+ ```mermaid
22
+ graph TD
23
+ Adopted[Adopted syntax context] --> GitBash[Git Bash: forward slash and dollar-VAR with Unix cmds]
24
+ Adopted --> PowerShell[PowerShell: env-prefix vars with cmdlets]
25
+ Adopted --> CmdShell[CMD: backslash and percent-VAR with dir del copy]
26
+ GitBash --> GuardCwd[Stay inside process cwd]
27
+ PowerShell --> GuardCwd
28
+ CmdShell --> GuardCwd
29
+ GuardCwd --> FailCount{Same command failed 3 times?}
30
+ FailCount -->|yes| ZoomEsc[Trigger zoom-out]
31
+ FailCount -->|no| ContinueRun[Continue with aligned syntax]
32
+ ```
26
33
 
27
34
  ## 2. Triggering and Routing Path
28
35
 
29
- This diagram illustrates how the `environment-detection` skill is triggered through user requests or developer actions, and how it integrates or chains together with other companion skills in the Harness OS ecosystem to form unified workflows.
30
-
31
36
  ```mermaid
32
37
  graph LR
33
- Router["harness-everything / tier-router.js"] -->|Pre-flight command execution| Env["environment-detection / SKILL.md"]
34
- Env -->|Guards runner execution commands in| TDD["tdd / SKILL.md"]
35
- Env -->|Guards script installations in| InstallOS["install-cognitive-os / SKILL.md"]
36
- Env -->|Guards PR quality checks in| VerLoop["verification-loop / SKILL.md"]
38
+ StartTrigger[Session start request] --> EnvDetect[environment-detection SKILL]
39
+ ComplexSeq[Complex terminal sequence] --> EnvDetect
40
+ EnvDetect --> AlignedRun[Aligned command execution]
41
+ AlignedRun --> RepeatedFail{Three failures on same command?}
42
+ RepeatedFail -->|yes| ZoomOut[zoom-out]
43
+ RepeatedFail -->|no| AlignedRun
37
44
  ```
38
45
 
39
- ---
46
+ ## 3. Real-World Use Case
40
47
 
41
- ## 3. Real-World Use Case Flowchart
48
+ A session starts on Windows with PowerShell as the active shell. The agent needs to list files and check Node availability before running tests.
42
49
 
43
- Here we model concrete real-world scenarios and use cases of the `environment-detection` skill, illustrating standard success paths, error handling, or recovery loops.
50
+ 1. Run `node "<skill-dir>/scripts/preflight.js"` to detect Windows + PowerShell + available CLIs.
51
+ 2. Adopt PowerShell syntax for paths and env vars instead of Git Bash assumptions.
52
+ 3. If `preflight.js` cannot run, inspect `<environment_info>` and probe with minimal echo/env commands, then adopt syntax.
53
+ 4. Stay inside `process.cwd()`; ignore other workspace, history, or temp paths shown by the IDE.
54
+ 5. If the same aligned command still fails three times, stop retrying the syntax and trigger `zoom-out`.
44
55
 
45
56
  ```mermaid
46
57
  graph TD
47
- Start["Agent wants to run: 'rm -rf build && mkdir build' on Windows Powershell"] --> Trigger["Environment detection pre-flight check"]
48
- Trigger --> Detect["Identifies OS: Windows, Shell: PowerShell"]
49
- Detect --> AnalyzeSyntax["Identifies that 'rm -rf' will fail or behave unexpectedly in PowerShell"]
50
- AnalyzeSyntax --> Rewrite["Rewrites command to PowerShell equivalent or executes using native node commands"]
51
- Rewrite --> Run["Executes safely with exit code 0"]
52
- Run --> Done([Syntax error and execution crash avoided])
58
+ AgentGoal[Need to list files and check Node on Windows] --> DetectEnv[Run session-start detection]
59
+ DetectEnv --> FoundShell[Detected PowerShell on Windows]
60
+ FoundShell --> UseCmd[Use PowerShell syntax for listing and env lookup]
61
+ UseCmd --> CmdResult{Command works?}
62
+ CmdResult -->|yes| ProceedTask[Proceed with task]
63
+ CmdResult -->|no after 3 tries| ZoomStep[Trigger zoom-out]
53
64
  ```
54
65
 
55
- ---
56
-
57
66
  ## 4. Verification Check
58
67
 
59
- To ensure that the `environment-detection` skill is operating in strict compliance with Harness OS design laws, verify the following:
60
-
61
- - [ ] **Physical Boundary Verification**: The skill boundaries are respected and do not leak context.
62
- - [ ] **State Checkpoint Verification**: The active state is established, validated, and recorded at the beginning and end of each execution branch.
63
- - [ ] **Cognitive Alignment**: The skill conforms to the **Think > Try > Summarize > Record** cognitive loop.
68
+ - [ ] Detection ran at session start via `environment-detection/scripts/preflight.js`, with `<environment_info>` inspection and probing used only as fallback
69
+ - [ ] Adopted syntax matches detected shell: Git Bash uses `/`, `$VAR`, Unix cmds without `dir`/`del`; PowerShell uses `$env:VAR` and cmdlets; CMD uses `\`, `%VAR%`, `dir`/`del`/`copy` without Unix cmds
70
+ - [ ] All commands stayed inside `process.cwd()`; no commands ran outside the current project root
71
+ - [ ] No toolchain installation was attempted; scope stayed to detection, alignment, and touchpoint repair
72
+ - [ ] After three failures of the same command, execution stopped blind retry and triggered `zoom-out`
73
+ - [ ] Shell detail followed `environment-detection/references/shell-syntax-rules.md` where needed
@@ -1,64 +1,71 @@
1
1
  # Workflow: Eval Harness
2
2
 
3
- > Evaluates AI developer agent performance based on accuracy, resource efficiency, and anti-loop metrics.
3
+ > Score an agent execution log or conversation history on correctness, token efficiency, anti-loop focus, and environment awareness, and save the result as a scorecard when a benchmark is requested.
4
4
 
5
- ---
5
+ Source of truth: `eval-harness/SKILL.md`.
6
6
 
7
7
  ## 1. Skill Behavior Workflow
8
8
 
9
- This section visualizes how the `eval-harness` skill executes internally, detailing the sequence of operations, state transitions, and evaluation steps.
10
-
11
9
  ```mermaid
12
10
  graph TD
13
- Start([Trigger: Benchmark / Evaluate Log]) --> ParseLog["1. Parse Log: Actions, Error Loops, Token Indicator"]
14
- ParseLog --> CalcRubric["2. Calculate Scores across 4 Dimensions (0-10)"]
15
- CalcRubric --> CheckScript{3. Is evaluate.js Executable?}
16
-
17
- CheckScript -->|Yes| RunScript["Run node eval-harness/scripts/evaluate.js"]
18
- CheckScript -->|No / Fails| FileFallback{"4. Markdown File Fallback"}
19
-
20
- FileFallback -->|evals/ Exists| WriteEvals["Save Scorecard to evals/scorecard.md"]
21
- FileFallback -->|No evals/ Folder| WritePlatform["Save Scorecard to .github/harness-everything/evals/scorecard.md"]
22
-
23
- RunScript --> End([Evaluation Scorecard Logged])
24
- WriteEvals --> End
25
- WritePlatform --> End
11
+ BenchReq([Benchmark request with log or history]) --> ParseLog[Parse actions errors tokens timing]
12
+ ParseLog --> ScoreDims[Score four dimensions 0-10 via scoring-rubric]
13
+ ScoreDims --> RunEval[Run scripts evaluate.js with scores and insights]
14
+ RunEval --> EvalOk{Evaluate script succeeded?}
15
+ EvalOk -->|yes| SavedCard([Scorecard saved])
16
+ EvalOk -->|no or missing| MdFallback[Write evals scorecard.md fallback]
17
+ MdFallback --> SavedCard
26
18
  ```
27
19
 
28
- ---
20
+ ```mermaid
21
+ graph TD
22
+ ScoreStart[Start scoring] --> Correctness[Score correctness 0-10]
23
+ ScoreStart --> Efficiency[Score efficiency 0-10]
24
+ ScoreStart --> AntiLoop[Score anti-loop focus 0-10]
25
+ ScoreStart --> EnvAware[Score environment awareness 0-10]
26
+ Correctness --> CombineScores[Combine into four-dimension card]
27
+ Efficiency --> CombineScores
28
+ AntiLoop --> CombineScores
29
+ EnvAware --> CombineScores
30
+ CombineScores --> EmitCard[Emit via script or markdown fallback]
31
+ ```
29
32
 
30
33
  ## 2. Triggering and Routing Path
31
34
 
32
- This diagram illustrates how the `eval-harness` skill is triggered through user requests or developer actions, and how it integrates or chains together with other companion skills in the Harness OS ecosystem to form unified workflows.
33
-
34
35
  ```mermaid
35
36
  graph LR
36
- Router["harness-everything / tier-router.js"] -->|Analyzes performance metrics| EH["eval-harness / SKILL.md"]
37
- EH -->|Synthesizes lessons learned for| Evolve["self-evolve / SKILL.md"]
38
- EH -->|Detects error loops triggering| ZoomOut["zoom-out / SKILL.md"]
37
+ UserBench[User asks to run benchmark] --> EvalSkill[eval-harness SKILL]
38
+ LogInput[Execution log or conversation history provided] --> EvalSkill
39
+ EvalSkill --> RubricStep[Apply references scoring-rubric.md]
40
+ RubricStep --> ScriptStep[Run scripts evaluate.js]
41
+ ScriptStep --> OutputLoc[Write to workspace evals or github fallback dir]
39
42
  ```
40
43
 
41
- ---
44
+ ## 3. Real-World Use Case
42
45
 
43
- ## 3. Real-World Use Case Flowchart
46
+ A reviewer wants to compare two runs of a file-migration task.
44
47
 
45
- Here we model concrete real-world scenarios and use cases of the `eval-harness` skill, illustrating standard success paths, error handling, or recovery loops.
48
+ 1. Collect the execution log with tool calls, errors, tokens, and timing.
49
+ 2. Score correctness, efficiency, anti-loop focus, and environment awareness 0–10 using `eval-harness/references/scoring-rubric.md`.
50
+ 3. Run `node <skill-dir>/scripts/evaluate.js <A> <B> <C> <D> "insights"`.
51
+ 4. On script failure or absence, write `<workspace>/evals/scorecard.md`, or `<workspace>/.github/harness-everything/evals/` if needed.
52
+ 5. Leave the evaluated code unchanged; output is only the scorecard and insights.
46
53
 
47
54
  ```mermaid
48
55
  graph TD
49
- Start["Agent session finishes implementing a complete backend server"] --> Trigger["eval-harness skill executed"]
50
- Trigger --> Gather["Collects: 15 minutes elapsed, 32 tool calls, 45,000 tokens consumed"]
51
- Gather --> Score["Scores: Correctness 10/10, Resource Efficiency 9/10, Anti-loop 10/10"]
52
- Score --> Output["Generates benchmark report summarizing optimal execution speed and zero looping errors"]
53
- Output --> Done([Benchmark logged for project history])
56
+ ReviewAsk[Reviewer asks to score migration run] --> GatherLog[Gather execution log]
57
+ GatherLog --> ApplyRubric[Score four dimensions with rubric]
58
+ ApplyRubric --> TryScript[Try evaluate.js]
59
+ TryScript --> ScriptOk{Script ok?}
60
+ ScriptOk -->|yes| DoneScore([Scorecard emitted])
61
+ ScriptOk -->|no| WriteMd[Write scorecard.md fallback]
62
+ WriteMd --> DoneScore
54
63
  ```
55
64
 
56
- ---
57
-
58
65
  ## 4. Verification Check
59
66
 
60
- To ensure that the `eval-harness` skill is operating in strict compliance with Harness OS design laws, verify the following:
61
-
62
- - [ ] **Physical Boundary Verification**: The skill boundaries are respected and do not leak context.
63
- - [ ] **State Checkpoint Verification**: The active state is established, validated, and recorded at the beginning and end of each execution branch.
64
- - [ ] **Cognitive Alignment**: The skill conforms to the **Think > Try > Summarize > Record** cognitive loop.
67
+ - [ ] Input included both a benchmark request and an execution log or conversation history; tasks without a log were declined
68
+ - [ ] All four dimensions were scored 0–10 using `eval-harness/references/scoring-rubric.md`: correctness, efficiency, anti-loop focus, environment awareness
69
+ - [ ] `eval-harness/scripts/evaluate.js` was run with four scores plus insights; markdown fallback was used only if the script failed or was missing
70
+ - [ ] Scorecard was written under `<workspace>/evals/` or `<workspace>/.github/harness-everything/evals/`
71
+ - [ ] No evaluated code was written or fixed, and no general review was substituted for dimension scoring
@@ -1,59 +1,71 @@
1
1
  # Workflow: Fable Discipline
2
2
 
3
- > Shadow guard for fable-mode preventing context bloat, enforcing physical boundaries, and preserving compact stage handoffs.
3
+ > Act as a background guard while staged multi-agent work runs, keeping output compact, stage scope tight, handoffs explicit, and diverging builds halted.
4
4
 
5
- ---
5
+ Source of truth: `fable-discipline/SKILL.md`.
6
6
 
7
7
  ## 1. Skill Behavior Workflow
8
8
 
9
- This section visualizes how the `fable-discipline` skill executes internally, detailing the sequence of operations, state transitions, and evaluation steps.
10
-
11
9
  ```mermaid
12
10
  graph TD
13
- Start([Fable Task Initiated]) --> AuditContext["Audit active context against the stage contract"]
14
- AuditContext --> CheckTokenLimit{Context exceeds the active budget?}
15
- CheckTokenLimit -->|Yes| TrimContext["Evict raw logs, completed tasks, and non-essential file contents"]
16
- CheckTokenLimit -->|No| KeepState["Continue monitoring context state"]
17
- TrimContext --> EnforceLimit["Enforce physical boundary guidelines"]
18
- KeepState --> EnforceLimit
19
- EnforceLimit --> RecordHandoff["Record a compact stage handoff"]
20
- RecordHandoff --> End([Context maintained under safe, high-attention limits])
11
+ FableActive([fable-mode active with staged work]) --> CompactMilestone[Compact state after milestone]
12
+ CompactMilestone --> ScopeCheck[Enforce stage scope and output limits]
13
+ ScopeCheck --> HandoffStep[Require state manifest at handoff]
14
+ HandoffStep --> BuildHealth{Build errors diverging?}
15
+ BuildHealth -->|yes| HaltZoom[HALT and call zoom-out]
16
+ BuildHealth -->|no| KeepGuard[Continue background guard]
17
+ KeepGuard --> CompactMilestone
18
+ HaltZoom --> MapErrors[Map error dependency graph for human]
21
19
  ```
22
20
 
23
- ---
21
+ ```mermaid
22
+ graph TD
23
+ IncomingAgent[Incoming stage agent] --> VerifyManifest[Verify outgoing state manifest first]
24
+ VerifyManifest --> ManifestOk{Manifest complete?}
25
+ ManifestOk -->|yes| DoStage[Run stage within allowed files]
26
+ ManifestOk -->|no| AskManifest[Require missing APIs and IO details]
27
+ AskManifest --> VerifyManifest
28
+ DoStage --> OneCommit[One commit per independent logic block]
29
+ OneCommit --> LeaveManifest[Leave manifest for next agent]
30
+ ```
24
31
 
25
32
  ## 2. Triggering and Routing Path
26
33
 
27
- This diagram illustrates how the `fable-discipline` skill is triggered through user requests or developer actions, and how it integrates or chains together with other companion skills in the Harness OS ecosystem to form unified workflows.
28
-
29
34
  ```mermaid
30
35
  graph LR
31
- Fable["fable-mode / SKILL.md"] -->|Monitors context on every turn| FD["fable-discipline / SKILL.md"]
32
- FD -->|Trims and prunes files from| ActiveContext["Active AI Session Context"]
33
- FD -->|Triggers high-level reflection when overloaded| ZoomOut["zoom-out / SKILL.md"]
36
+ FableMode[fable-mode active] --> FableDisc[fable-discipline shadow guard]
37
+ FableDisc --> WorkspaceGuard[Constrain multi-agent-workspace mutations]
38
+ WorkspaceGuard --> FableMode
39
+ FableDisc --> DivergedBuild{Diverging build errors?}
40
+ DivergedBuild -->|yes| ZoomOut[zoom-out]
41
+ DivergedBuild -->|no| FableMode
34
42
  ```
35
43
 
36
- ---
44
+ ## 3. Real-World Use Case
37
45
 
38
- ## 3. Real-World Use Case Flowchart
46
+ Long architectural migration runs under `fable-mode` with sub-agents handling separate stages.
39
47
 
40
- Here we model concrete real-world scenarios and use cases of the `fable-discipline` skill, illustrating standard success paths, error handling, or recovery loops.
48
+ 1. After each milestone, compact decisions and drop unneeded history; avoid broad regex and avoid reading irrelevant files over 1000 lines.
49
+ 2. Confirm working directory before touching core architecture; keep one commit per independent logic block.
50
+ 3. Outgoing agent leaves a manifest with completed APIs and expected inputs/outputs; incoming agent verifies it first.
51
+ 4. If fixes create more breakage, halt immediately, call `zoom-out`, and map the error dependency graph instead of continued patching.
41
52
 
42
53
  ```mermaid
43
54
  graph TD
44
- Start["Fable-mode is editing a large monorepo with growing context"] --> Monitor["Fable-discipline analyzes active context"]
45
- Monitor --> TriggerPruning["Identifies raw logs & completed sub-task details"]
46
- TriggerPruning --> Clean["Evicts completed step details and logs from immediate active context"]
47
- Clean --> Compress["Summarizes historical state into the stage handoff"]
48
- Compress --> Done([Active context remains bounded while preserving required facts])
55
+ LongTask[Migration stage completes] --> CompactState[Compact milestone state]
56
+ CompactState --> CheckBloat[Check for bloat or oversized reads]
57
+ CheckBloat --> Handoff[Write and verify handoff manifest]
58
+ Handoff --> BuildCheck{Build diverging?}
59
+ BuildCheck -->|yes| HaltNow[HALT and zoom-out]
60
+ BuildCheck -->|no| NextStage[Start next stage guarded]
49
61
  ```
50
62
 
51
- ---
52
-
53
63
  ## 4. Verification Check
54
64
 
55
- To ensure that the `fable-discipline` skill is operating in strict compliance with Harness OS design laws, verify the following:
56
-
57
- - [ ] **Physical Boundary Verification**: The skill boundaries are respected and do not leak context.
58
- - [ ] **State Checkpoint Verification**: The active state is established, validated, and recorded at the beginning and end of each execution branch.
59
- - [ ] **Cognitive Alignment**: The skill conforms to the **Think > Try > Summarize > Record** cognitive loop.
65
+ - [ ] Ran only as a background shadow for the whole `fable-mode` duration; not used standalone, not used for small tasks or routine single-file edits
66
+ - [ ] After each milestone, state was compacted and unneeded history dropped; no broad regex without precise conditions and no irrelevant 1000+ line reads
67
+ - [ ] Working directory was confirmed before core changes, with one commit per independent logic block
68
+ - [ ] Every sub-agent handoff via `multi-agent-workspace` left a state manifest with completed APIs and expected inputs/outputs, verified by the incoming agent first
69
+ - [ ] On diverging build errors, execution halted immediately and called `zoom-out` with an error dependency map instead of continued patching
70
+ - [ ] Made no direct state mutations of its own; only constrained `fable-mode` and `multi-agent-workspace` mutations
71
+ - [ ] Detail followed `fable-discipline/references/discipline-rules.md` where needed