harness-everything 0.3.6 โ 0.4.1
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/.agents/plugins/marketplace.json +20 -0
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +8 -7
- package/.github/workflows/behavioral-evals.yml +3 -3
- package/.github/workflows/ci.yml +49 -28
- package/.github/workflows/release.yml +52 -27
- package/.nvmrc +1 -0
- package/.releaserc.json +113 -0
- package/AGENTS.md +44 -24
- package/BENCHMARK_SOP.md +38 -18
- package/CHANGELOG.md +196 -3
- package/CONTRIBUTING.md +37 -9
- package/Dockerfile +1 -1
- package/PRIVACY.md +25 -0
- package/README.md +126 -91
- package/RELEASING.md +93 -0
- package/SUPPORT.md +27 -0
- package/TERMS.md +21 -0
- package/VERIFICATION.md +192 -284
- package/behavioral-evals/README.md +21 -0
- package/behavioral-evals/case-validator.js +194 -0
- package/behavioral-evals/cases/baseline-environment-detection.yaml +21 -0
- package/behavioral-evals/cases/baseline-eval-harness.yaml +27 -0
- package/behavioral-evals/cases/baseline-fable-discipline.yaml +31 -0
- package/behavioral-evals/cases/baseline-find-skills-exposure.yaml +49 -0
- package/behavioral-evals/cases/baseline-find-skills.yaml +21 -0
- package/behavioral-evals/cases/baseline-git-commit.yaml +2 -2
- package/behavioral-evals/cases/baseline-install-cognitive-os.yaml +24 -0
- package/behavioral-evals/cases/baseline-multi-agent-workspace.yaml +28 -0
- package/behavioral-evals/cases/baseline-rewrite-commits.yaml +34 -0
- package/behavioral-evals/cases/baseline-self-evolve.yaml +31 -0
- package/behavioral-evals/cases/baseline-skill-creator.yaml +20 -0
- package/behavioral-evals/cases/baseline-skill-style.yaml +21 -0
- package/behavioral-evals/cases/baseline-to-spec.yaml +34 -0
- package/behavioral-evals/cases/baseline-to-tickets.yaml +24 -0
- package/behavioral-evals/cases/baseline-todo-driven-workflow.yaml +32 -0
- package/behavioral-evals/cases/baseline-using-git-worktrees.yaml +15 -0
- package/behavioral-evals/cases/breaker-zoom-out-after-3.yaml +2 -2
- package/behavioral-evals/cases/pressure-complexity-skip.yaml +2 -2
- package/behavioral-evals/cases/pressure-scope-bypass.yaml +7 -2
- package/behavioral-evals/cases/pressure-sunk-cost-retry.yaml +7 -4
- package/behavioral-evals/cases/scope-discipline.yaml +2 -1
- package/behavioral-evals/cases/verify-before-done.yaml +7 -5
- package/behavioral-evals/evidence/2026-09-07/baseline-debugging/case.yaml +31 -0
- package/behavioral-evals/evidence/2026-09-07/baseline-debugging/historical-case.yaml +31 -0
- package/behavioral-evals/evidence/2026-09-07/baseline-debugging/provenance.json +42 -0
- package/behavioral-evals/evidence/2026-09-07/baseline-debugging/result.sanitized.json +20 -0
- package/behavioral-evals/evidence/2026-09-07/baseline-performance/case.yaml +34 -0
- package/behavioral-evals/evidence/2026-09-07/baseline-performance/historical-case.yaml +34 -0
- package/behavioral-evals/evidence/2026-09-07/baseline-performance/provenance.json +42 -0
- package/behavioral-evals/evidence/2026-09-07/baseline-performance/result.sanitized.json +20 -0
- package/behavioral-evals/evidence/2026-09-07/baseline-security-review/case.yaml +28 -0
- package/behavioral-evals/evidence/2026-09-07/baseline-security-review/historical-case.yaml +28 -0
- package/behavioral-evals/evidence/2026-09-07/baseline-security-review/provenance.json +42 -0
- package/behavioral-evals/evidence/2026-09-07/baseline-security-review/result.sanitized.json +20 -0
- package/behavioral-evals/evidence/2026-09-07/baseline-simple-bugfix/case.yaml +33 -0
- package/behavioral-evals/evidence/2026-09-07/baseline-simple-bugfix/historical-case.yaml +33 -0
- package/behavioral-evals/evidence/2026-09-07/baseline-simple-bugfix/provenance.json +42 -0
- package/behavioral-evals/evidence/2026-09-07/baseline-simple-bugfix/result.sanitized.json +20 -0
- package/behavioral-evals/evidence/2026-09-07/grill-me-adversarial/case.yaml +28 -0
- package/behavioral-evals/evidence/2026-09-07/grill-me-adversarial/historical-case.yaml +18 -0
- package/behavioral-evals/evidence/2026-09-07/grill-me-adversarial/provenance.json +30 -0
- package/behavioral-evals/evidence/2026-09-07/live-run-blocker.md +16 -0
- package/behavioral-evals/evidence/2026-09-07/manifest.json +88 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-scope-bypass/case.yaml +33 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-scope-bypass/historical-case.yaml +28 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-scope-bypass/provenance.json +30 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-docs/case.yaml +50 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-docs/historical-case.yaml +50 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-docs/provenance.json +42 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-docs/result.sanitized.json +20 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-error-handling/case.yaml +35 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-error-handling/historical-case.yaml +35 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-error-handling/provenance.json +42 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-error-handling/result.sanitized.json +20 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-verification/case.yaml +43 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-verification/historical-case.yaml +43 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-verification/provenance.json +42 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-verification/result.sanitized.json +24 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-verification--2026-08-23-pressure-skip-verification/case.yaml +43 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-verification--2026-08-23-pressure-skip-verification/historical-case.yaml +43 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-verification--2026-08-23-pressure-skip-verification/provenance.json +42 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-verification--2026-08-23-pressure-skip-verification/result.sanitized.json +20 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-verification--2026-08-27-pressure-skip-verification/case.yaml +43 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-verification--2026-08-27-pressure-skip-verification/historical-case.yaml +43 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-verification--2026-08-27-pressure-skip-verification/provenance.json +42 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-skip-verification--2026-08-27-pressure-skip-verification/result.sanitized.json +24 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-sunk-cost-retry/case.yaml +50 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-sunk-cost-retry/historical-case.yaml +47 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-sunk-cost-retry/provenance.json +42 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-sunk-cost-retry/result.sanitized.json +24 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-sunk-cost-retry--2026-08-23-pressure-sunk-cost-retry/case.yaml +50 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-sunk-cost-retry--2026-08-23-pressure-sunk-cost-retry/historical-case.yaml +47 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-sunk-cost-retry--2026-08-23-pressure-sunk-cost-retry/provenance.json +42 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-sunk-cost-retry--2026-08-23-pressure-sunk-cost-retry/result.sanitized.json +20 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-sunk-cost-retry--2026-08-27-pressure-sunk-cost-retry/case.yaml +50 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-sunk-cost-retry--2026-08-27-pressure-sunk-cost-retry/historical-case.yaml +47 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-sunk-cost-retry--2026-08-27-pressure-sunk-cost-retry/provenance.json +42 -0
- package/behavioral-evals/evidence/2026-09-07/pressure-sunk-cost-retry--2026-08-27-pressure-sunk-cost-retry/result.sanitized.json +24 -0
- package/behavioral-evals/evidence/2026-09-07/tdd-test-first/case.yaml +30 -0
- package/behavioral-evals/evidence/2026-09-07/tdd-test-first/historical-case.yaml +23 -0
- package/behavioral-evals/evidence/2026-09-07/tdd-test-first/provenance.json +30 -0
- package/behavioral-evals/evidence/2026-09-07/triage-matrix.json +426 -0
- package/behavioral-evals/evidence/2026-09-07/triage-matrix.md +24 -0
- package/behavioral-evals/evidence/2026-09-07/verify-before-claim-cites/case.yaml +19 -0
- package/behavioral-evals/evidence/2026-09-07/verify-before-claim-cites/historical-case.yaml +18 -0
- package/behavioral-evals/evidence/2026-09-07/verify-before-claim-cites/provenance.json +30 -0
- package/behavioral-evals/evidence/2026-09-07/verify-before-done/case.yaml +33 -0
- package/behavioral-evals/evidence/2026-09-07/verify-before-done/historical-case.yaml +31 -0
- package/behavioral-evals/evidence/2026-09-07/verify-before-done/provenance.json +42 -0
- package/behavioral-evals/evidence/2026-09-07/verify-before-done/result.sanitized.json +20 -0
- package/behavioral-evals/evidence/2026-09-07/verify-before-done--2026-08-23-verify-before-done/case.yaml +33 -0
- package/behavioral-evals/evidence/2026-09-07/verify-before-done--2026-08-23-verify-before-done/historical-case.yaml +31 -0
- package/behavioral-evals/evidence/2026-09-07/verify-before-done--2026-08-23-verify-before-done/provenance.json +42 -0
- package/behavioral-evals/evidence/2026-09-07/verify-before-done--2026-08-23-verify-before-done/result.sanitized.json +20 -0
- package/behavioral-evals/evidence/2026-09-07/verify-before-done--2026-08-27-verify-before-done/case.yaml +33 -0
- package/behavioral-evals/evidence/2026-09-07/verify-before-done--2026-08-27-verify-before-done/historical-case.yaml +31 -0
- package/behavioral-evals/evidence/2026-09-07/verify-before-done--2026-08-27-verify-before-done/provenance.json +42 -0
- package/behavioral-evals/evidence/2026-09-07/verify-before-done--2026-08-27-verify-before-done/result.sanitized.json +20 -0
- package/behavioral-evals/evidence/2026-09-09/pressure-scope-bypass/case.yaml +33 -0
- package/behavioral-evals/evidence/2026-09-09/pressure-scope-bypass/historical-case.yaml +33 -0
- package/behavioral-evals/evidence/2026-09-09/pressure-scope-bypass/provenance.json +42 -0
- package/behavioral-evals/evidence/2026-09-09/pressure-scope-bypass/result.sanitized.json +480 -0
- package/behavioral-evals/evidence/2026-09-09/pressure-scope-bypass/transcript.sanitized.jsonl +95 -0
- package/behavioral-evals/evidence-tool.js +443 -0
- package/behavioral-evals/fixtures/claude-denied.jsonl +3 -0
- package/behavioral-evals/fixtures/claude-legacy.json +1 -0
- package/behavioral-evals/fixtures/claude-oral-only.jsonl +2 -0
- package/behavioral-evals/fixtures/claude-success.jsonl +5 -0
- package/behavioral-evals/fixtures/claude-truncated.jsonl +3 -0
- package/behavioral-evals/fixtures/opencode-success.jsonl +6 -0
- package/behavioral-evals/results/2026-08-31-baseline-add-feature.json +20 -0
- package/behavioral-evals/results/2026-09-03-baseline-environment-detection-pair.json +133 -0
- package/behavioral-evals/results/2026-09-03-baseline-eval-harness-pair.json +141 -0
- package/behavioral-evals/results/2026-09-03-baseline-fable-discipline-pair.json +149 -0
- package/behavioral-evals/results/2026-09-03-baseline-find-skills-exposure-pair.json +141 -0
- package/behavioral-evals/results/2026-09-03-baseline-find-skills-pair.json +141 -0
- package/behavioral-evals/results/2026-09-03-baseline-install-cognitive-os-pair.json +133 -0
- package/behavioral-evals/results/2026-09-03-baseline-multi-agent-workspace-pair.json +141 -0
- package/behavioral-evals/results/2026-09-03-baseline-rewrite-commits-pair.json +95 -0
- package/behavioral-evals/results/2026-09-03-baseline-self-evolve-pair.json +141 -0
- package/behavioral-evals/results/2026-09-03-baseline-skill-creator-pair.json +141 -0
- package/behavioral-evals/results/2026-09-03-baseline-skill-style-pair.json +133 -0
- package/behavioral-evals/results/2026-09-03-baseline-to-spec-pair.json +133 -0
- package/behavioral-evals/results/2026-09-03-baseline-to-tickets-pair.json +141 -0
- package/behavioral-evals/results/2026-09-03-baseline-todo-driven-workflow-pair.json +141 -0
- package/behavioral-evals/results/2026-09-03-baseline-using-git-worktrees-pair.json +133 -0
- package/behavioral-evals/results/2026-09-03-summary-both.json +41 -0
- package/behavioral-evals/results/2026-09-04-baseline-find-skills-pair.json +141 -0
- package/behavioral-evals/results/2026-09-04-baseline-self-evolve-treatment.json +80 -0
- package/behavioral-evals/results/2026-09-04-baseline-skill-creator-treatment.json +80 -0
- package/behavioral-evals/results/2026-09-04-summary-both.json +41 -0
- package/behavioral-evals/run-with-plugin.js +15 -31
- package/behavioral-evals/run.js +446 -105
- package/behavioral-evals/transcript-parser.js +591 -0
- package/bin/cli.js +24 -12
- package/ci/ab-test-cases/grill-me-adversarial.yaml +14 -4
- package/ci/ab-test-cases/tdd-test-first.yaml +13 -6
- package/ci/ab-test-cases/verification-loop-gates.yaml +20 -7
- package/ci/ab-test-cases/verify-before-claim-cites.yaml +7 -6
- package/ci/ab-test-harness.js +113 -38
- package/ci/action-gate-platform-doc.test.js +31 -0
- package/ci/action-gate.test.js +260 -0
- package/ci/cases/case2.json +2 -2
- package/ci/consistency-check.js +51 -5
- package/ci/description-collision.js +15 -6
- package/ci/disclosure-check.js +225 -0
- package/ci/doc-capability-consistency.test.js +180 -0
- package/ci/fixtures/phase4/parallel-disjoint.stages.json +32 -0
- package/ci/fixtures/phase4/parallel-read-only.stages.json +32 -0
- package/ci/installer-roundtrip.test.js +159 -0
- package/ci/invariant-routing.test.js +74 -0
- package/ci/issue99-runtime.test.js +218 -0
- package/ci/mechanism-2aa-codex-action-gate-policy.test.js +117 -0
- package/ci/mechanism-2ab-openai-plugin-sync-integrity.test.js +80 -0
- package/ci/mechanism-2j-behavioral-runner.test.js +43 -1
- package/ci/mechanism-2k-reference-check.test.js +57 -2
- package/ci/mechanism-2l-multi-agent-workspace.test.js +202 -6
- package/ci/mechanism-2m-self-repo-guard.test.js +65 -0
- package/ci/mechanism-2n-opencode-plugin.test.js +461 -0
- package/ci/mechanism-2o-state-home-isolation.test.js +183 -0
- package/ci/mechanism-2p-installer-links.test.js +183 -0
- package/ci/mechanism-2q-installer-global-shared-store.test.js +132 -0
- package/ci/mechanism-2r-uninstall-flags.test.js +148 -0
- package/ci/mechanism-2s-tdd-quality.test.js +203 -0
- package/ci/mechanism-2t-disclosure.test.js +90 -0
- package/ci/mechanism-2t-evidence-triage.test.js +200 -0
- package/ci/mechanism-2t-issue-20.test.js +75 -0
- package/ci/mechanism-2t-platform-skill-targets.test.js +164 -0
- package/ci/mechanism-2t-transcript-parser.test.js +179 -0
- package/ci/mechanism-2t-workspace-identity.test.js +200 -0
- package/ci/mechanism-2u-issue-42-regressions.test.js +239 -0
- package/ci/mechanism-2u-issue-44.test.js +35 -0
- package/ci/mechanism-2v-verifier-boundaries.test.js +138 -0
- package/ci/mechanism-2w-platform-compatibility.test.js +148 -0
- package/ci/mechanism-2x-release-automation.test.js +157 -0
- package/ci/mechanism-2x-release-commit-message.test.js +66 -0
- package/ci/mechanism-2y-release-tooling-compat.test.js +47 -0
- package/ci/mechanism-2z-claude-plugin-manifest.test.js +29 -0
- package/ci/mutation-check.js +53 -0
- package/ci/mutation-loader.js +57 -0
- package/ci/negative-controls.js +76 -46
- package/ci/openai-plugin-package.test.js +182 -0
- package/ci/openai-plugin-runtime.test.js +175 -0
- package/ci/openai-plugin-submission.test.js +101 -0
- package/ci/phase4-ensemble-memory.test.js +307 -0
- package/ci/reference-check.js +73 -25
- package/ci/release-consistency-check.js +24 -1
- package/ci/repository-contract.test.js +17 -0
- package/ci/router-phase2-safety.test.js +81 -0
- package/ci/router-workflow-plan.test.js +264 -0
- package/ci/routing-check.js +6 -5
- package/ci/runner.js +6 -5
- package/ci/skill-routing-check.js +48 -11
- package/ci/test-behavioral-case-validation.js +62 -0
- package/ci/test-helper.js +10 -0
- package/ci/workflow-plan-consumers-edge.test.js +72 -0
- package/ci/workflow-plan-consumers.test.js +276 -0
- package/docs/architecture.md +137 -57
- package/docs/audit.md +22 -20
- package/docs/codex-action-gate.md +90 -0
- package/docs/issue-20-rollup.md +47 -0
- package/docs/mechanism-first-skill-mesh.md +22 -20
- package/docs/openai-plugin.md +118 -0
- package/docs/philosophy.md +28 -17
- package/docs/platform-capabilities.md +73 -0
- package/docs/platform-compatibility.json +270 -0
- package/docs/reflection.md +37 -22
- package/docs/release-evidence.md +27 -0
- package/docs/repository-contract.md +27 -0
- package/docs/routing.md +157 -44
- package/docs/security-audit.md +38 -0
- package/docs/troubleshooting.md +94 -51
- package/docs/verifier-boundaries.md +45 -0
- package/docs/workflows/fable-mode.md +77 -21
- package/docs/workflows/find-skills.md +40 -0
- package/docs/workflows/grill-with-docs.md +2 -2
- package/docs/workflows/multi-agent-workspace.md +22 -10
- package/docs/workflows/self-evolve.md +33 -0
- package/docs/workflows/tdd.md +36 -0
- package/docs/workflows/todo-driven-workflow.md +33 -0
- package/environment-detection/SKILL.md +3 -3
- package/eval-harness/SKILL.md +7 -7
- package/eval-harness/scripts/evaluate.js +12 -10
- package/evals/evaluation-reports.md +14 -0
- package/evals/harness-everything/tasks/positive-tier1.yaml +1 -1
- package/evals/harness-everything/tasks/positive-tier2.yaml +1 -1
- package/evals/harness-everything/tasks/positive-tier3.yaml +1 -1
- package/evals/install-cognitive-os/tasks/positive-trigger.yaml +1 -1
- package/fable-discipline/SKILL.md +2 -2
- package/fable-mode/CONTRACT-FORMAT.md +147 -33
- package/fable-mode/SKILL.md +3 -3
- package/fable-mode/agents/fable-orchestrator.md +95 -35
- package/fable-mode/execution-guardrails/SKILL.md +2 -2
- package/fable-mode/fable-haiku/SKILL.md +3 -3
- package/fable-mode/fable-opus/SKILL.md +3 -3
- package/fable-mode/fable-sonnet/SKILL.md +3 -3
- package/fable-mode/scripts/ensemble-review.js +371 -0
- package/fable-mode/scripts/model-selector.js +134 -3
- package/fable-mode/scripts/workflow-plan-consumer.js +337 -0
- package/find-skills/SKILL.md +5 -5
- package/find-skills/references/discovery-flow.md +1 -1
- package/find-skills/scripts/use-skill.js +7 -1
- package/git-commit/SKILL.md +4 -11
- package/grill-me/SKILL.md +5 -5
- package/grill-with-docs/SKILL.md +7 -7
- package/grill-with-docs/references/session-playbook.md +6 -4
- package/harness-everything/SKILL.md +23 -22
- package/harness-everything/references/router-workflow-plan.md +128 -0
- package/harness-everything/references/triage-and-tiers.md +173 -96
- package/harness-everything/schemas/router-task-shape.schema.json +126 -0
- package/harness-everything/schemas/router-workflow-plan.schema.json +149 -0
- package/harness-everything/scripts/bootstrap.js +13 -4
- package/harness-everything/scripts/ensemble-policy.js +102 -0
- package/harness-everything/scripts/kernel-router.js +212 -0
- package/harness-everything/scripts/router-contract.js +612 -0
- package/harness-everything/scripts/self-heal.js +29 -20
- package/harness-everything/scripts/tier-router.js +346 -221
- package/hooks/hooks.json +60 -15
- package/hooks/scripts/action-gate-rules.json +77 -0
- package/hooks/scripts/action-gate.js +528 -0
- package/hooks/scripts/atomic-commit-check.js +5 -5
- package/hooks/scripts/codex-action-gate-post.js +46 -0
- package/hooks/scripts/codex-permission-request.js +140 -0
- package/hooks/scripts/context-compact.js +4 -3
- package/hooks/scripts/contract-test.js +118 -51
- package/hooks/scripts/lib/fable-contracts.js +121 -0
- package/hooks/scripts/lib/harness-state.js +164 -28
- package/hooks/scripts/lib/platforms/claude.js +45 -62
- package/hooks/scripts/lib/platforms/codex.js +35 -61
- package/hooks/scripts/lib/platforms/continue.js +7 -7
- package/hooks/scripts/lib/platforms/copilot.js +29 -53
- package/hooks/scripts/lib/platforms/hermes.js +71 -20
- package/hooks/scripts/openai-session-start.js +81 -0
- package/hooks/scripts/rule-of-3-tracker.js +9 -8
- package/hooks/scripts/rule-of-3.js +29 -21
- package/hooks/scripts/state-persist.js +5 -4
- package/hooks/scripts/stop-gate.js +2 -2
- package/hooks/scripts/subagent-scope-guard.js +144 -38
- package/hooks/scripts/subagent-start.js +19 -0
- package/hooks/scripts/subagent-stop.js +6 -0
- package/improve-codebase-architecture/SKILL.md +2 -4
- package/improve-codebase-architecture/references/README.md +16 -0
- package/install-cognitive-os/SKILL.md +28 -22
- package/multi-agent-workspace/SKILL.md +16 -15
- package/multi-agent-workspace/references/architecture-guide.md +13 -9
- package/multi-agent-workspace/references/orchestration.md +39 -22
- package/multi-agent-workspace/scripts/consume-workflow-plan.js +129 -0
- package/multi-agent-workspace/scripts/index_memory.js +79 -26
- package/multi-agent-workspace/scripts/path-boundary.js +59 -0
- package/multi-agent-workspace/scripts/project-docs-resolver.js +357 -0
- package/multi-agent-workspace/scripts/scaffold.js +258 -103
- package/multi-agent-workspace/templates/AGENTS.md +20 -0
- package/multi-agent-workspace/workflows/03-generation.md +8 -10
- package/multi-agent-workspace/workflows/04-launcher.md +5 -5
- package/opencode-plugin/README.md +114 -71
- package/opencode-plugin/hooks/verify.js +62 -12
- package/opencode-plugin/index.mjs +547 -0
- package/opencode-plugin/plugin.json +4 -12
- package/package.json +20 -4
- package/plugins/harness-everything/.codex-plugin/plugin.json +39 -0
- package/plugins/harness-everything/hooks/hooks.json +197 -0
- package/plugins/harness-everything/hooks/scripts/action-gate-rules.json +77 -0
- package/plugins/harness-everything/hooks/scripts/action-gate.js +528 -0
- package/plugins/harness-everything/hooks/scripts/atomic-commit-check.js +68 -0
- package/plugins/harness-everything/hooks/scripts/boundary-guard.js +55 -0
- package/plugins/harness-everything/hooks/scripts/codex-action-gate-post.js +46 -0
- package/plugins/harness-everything/hooks/scripts/codex-permission-request.js +140 -0
- package/plugins/harness-everything/hooks/scripts/context-compact.js +115 -0
- package/plugins/harness-everything/hooks/scripts/contract-test.js +146 -0
- package/plugins/harness-everything/hooks/scripts/depth-guard.js +65 -0
- package/plugins/harness-everything/hooks/scripts/lib/fable-contracts.js +121 -0
- package/plugins/harness-everything/hooks/scripts/lib/harness-state.js +275 -0
- package/plugins/harness-everything/hooks/scripts/lib/platforms/claude.js +168 -0
- package/plugins/harness-everything/hooks/scripts/lib/platforms/codex.js +88 -0
- package/plugins/harness-everything/hooks/scripts/lib/platforms/continue.js +91 -0
- package/plugins/harness-everything/hooks/scripts/lib/platforms/copilot.js +85 -0
- package/plugins/harness-everything/hooks/scripts/lib/platforms/cursor.js +89 -0
- package/plugins/harness-everything/hooks/scripts/lib/platforms/hermes.js +108 -0
- package/plugins/harness-everything/hooks/scripts/lib/platforms/index.js +17 -0
- package/plugins/harness-everything/hooks/scripts/lib/platforms/worktrees.js +20 -0
- package/plugins/harness-everything/hooks/scripts/lib/workspace.js +290 -0
- package/plugins/harness-everything/hooks/scripts/openai-session-start.js +81 -0
- package/plugins/harness-everything/hooks/scripts/reset-circuit-breaker.js +30 -0
- package/plugins/harness-everything/hooks/scripts/rule-of-3-tracker.js +125 -0
- package/plugins/harness-everything/hooks/scripts/rule-of-3.js +195 -0
- package/plugins/harness-everything/hooks/scripts/state-persist.js +100 -0
- package/plugins/harness-everything/hooks/scripts/stop-gate.js +80 -0
- package/plugins/harness-everything/hooks/scripts/subagent-scope-guard.js +194 -0
- package/plugins/harness-everything/hooks/scripts/subagent-start.js +19 -0
- package/plugins/harness-everything/hooks/scripts/subagent-stop.js +6 -0
- package/plugins/harness-everything/hooks/session-start.js +81 -0
- package/plugins/harness-everything/plugin.json +43 -0
- package/plugins/harness-everything/scripts/lib/advisory-text.js +174 -0
- package/plugins/harness-everything/skills/environment-detection/SKILL.md +41 -0
- package/plugins/harness-everything/skills/environment-detection/references/shell-syntax-rules.md +76 -0
- package/plugins/harness-everything/skills/environment-detection/scripts/preflight.js +103 -0
- package/plugins/harness-everything/skills/eval-harness/SKILL.md +42 -0
- package/plugins/harness-everything/skills/eval-harness/references/scoring-rubric.md +68 -0
- package/plugins/harness-everything/skills/eval-harness/scripts/evaluate.js +79 -0
- package/plugins/harness-everything/skills/fable-discipline/SKILL.md +41 -0
- package/plugins/harness-everything/skills/fable-discipline/references/discipline-rules.md +22 -0
- package/plugins/harness-everything/skills/fable-mode/CONTRACT-FORMAT.md +165 -0
- package/plugins/harness-everything/skills/fable-mode/SKILL.md +39 -0
- package/plugins/harness-everything/skills/fable-mode/agents/fable-orchestrator.md +159 -0
- package/plugins/harness-everything/skills/fable-mode/agents/fable-verifier.md +32 -0
- package/plugins/harness-everything/skills/fable-mode/agents/fable-worker-haiku.md +52 -0
- package/plugins/harness-everything/skills/fable-mode/agents/fable-worker-sonnet.md +53 -0
- package/plugins/harness-everything/skills/fable-mode/execution-guardrails/SKILL.md +43 -0
- package/plugins/harness-everything/skills/fable-mode/execution-guardrails/references/guardrail-rules.md +56 -0
- package/plugins/harness-everything/skills/fable-mode/fable-haiku/SKILL.md +36 -0
- package/plugins/harness-everything/skills/fable-mode/fable-haiku/references/routing-notes.md +26 -0
- package/plugins/harness-everything/skills/fable-mode/fable-opus/SKILL.md +36 -0
- package/plugins/harness-everything/skills/fable-mode/fable-sonnet/SKILL.md +36 -0
- package/plugins/harness-everything/skills/fable-mode/model-matrix.json +32 -0
- package/plugins/harness-everything/skills/fable-mode/references/execution-phases.md +37 -0
- package/plugins/harness-everything/skills/fable-mode/references/model-matrix.md +39 -0
- package/plugins/harness-everything/skills/fable-mode/scripts/ensemble-review.js +371 -0
- package/plugins/harness-everything/skills/fable-mode/scripts/model-selector.js +260 -0
- package/plugins/harness-everything/skills/fable-mode/scripts/workflow-plan-consumer.js +337 -0
- package/plugins/harness-everything/skills/find-skills/SKILL.md +48 -0
- package/plugins/harness-everything/skills/find-skills/references/discovery-flow.md +102 -0
- package/plugins/harness-everything/skills/find-skills/scripts/use-skill.js +112 -0
- package/plugins/harness-everything/skills/git-commit/SKILL.md +38 -0
- package/plugins/harness-everything/skills/git-commit/guides/ANGULAR_STYLE.md +61 -0
- package/plugins/harness-everything/skills/git-commit/guides/COMMIT_GENERATION.md +24 -0
- package/plugins/harness-everything/skills/git-commit/guides/LANGUAGE_DETECTION.md +16 -0
- package/plugins/harness-everything/skills/git-commit/guides/MAIN_REPO.md +15 -0
- package/plugins/harness-everything/skills/git-commit/guides/SUBMODULES.md +27 -0
- package/plugins/harness-everything/skills/git-commit/references/commit-flow.md +30 -0
- package/plugins/harness-everything/skills/grill-me/SKILL.md +43 -0
- package/plugins/harness-everything/skills/grill-me/references/grilling-playbook.md +38 -0
- package/plugins/harness-everything/skills/grill-with-docs/ADR-FORMAT.md +47 -0
- package/plugins/harness-everything/skills/grill-with-docs/CONTEXT-FORMAT.md +63 -0
- package/plugins/harness-everything/skills/grill-with-docs/SKILL.md +41 -0
- package/plugins/harness-everything/skills/grill-with-docs/references/session-playbook.md +99 -0
- package/plugins/harness-everything/skills/harness-everything/SKILL.md +43 -0
- package/plugins/harness-everything/skills/harness-everything/examples/README.md +9 -0
- package/plugins/harness-everything/skills/harness-everything/examples/todo-workflow.md +22 -0
- package/plugins/harness-everything/skills/harness-everything/references/router-workflow-plan.md +128 -0
- package/plugins/harness-everything/skills/harness-everything/references/skill-registry.md +39 -0
- package/plugins/harness-everything/skills/harness-everything/references/triage-and-tiers.md +193 -0
- package/plugins/harness-everything/skills/harness-everything/schemas/router-task-shape.schema.json +126 -0
- package/plugins/harness-everything/skills/harness-everything/schemas/router-workflow-plan.schema.json +149 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/bootstrap.js +212 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/ensemble-policy.js +102 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router.js +212 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/router-contract.js +612 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/routing-keywords.json +320 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/self-heal.js +250 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/tier-router.js +459 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/verify-gate.js +100 -0
- package/plugins/harness-everything/skills/improve-codebase-architecture/SKILL.md +38 -0
- package/plugins/harness-everything/skills/improve-codebase-architecture/guides/DEEPENING.md +37 -0
- package/plugins/harness-everything/skills/improve-codebase-architecture/guides/HTML-REPORT.md +123 -0
- package/plugins/harness-everything/skills/improve-codebase-architecture/guides/INTERFACE-DESIGN.md +44 -0
- package/plugins/harness-everything/skills/improve-codebase-architecture/guides/LANGUAGE.md +53 -0
- package/plugins/harness-everything/skills/improve-codebase-architecture/guides/refactoring-workflow.md +59 -0
- package/plugins/harness-everything/skills/improve-codebase-architecture/references/README.md +16 -0
- package/plugins/harness-everything/skills/install-cognitive-os/SKILL.md +44 -0
- package/plugins/harness-everything/skills/install-cognitive-os/references/cognitive-loop.md +27 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/NOTICE-agency-agents.md +27 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/SKILL.md +38 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/examples/csharp-monorepo.md +123 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/examples/typescript-cli.md +126 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/guidelines/platform-claude.md +77 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/guidelines/platform-codex.md +146 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/guidelines/platform-continue.md +38 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/guidelines/platform-copilot.md +74 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/guidelines/platform-cursor.md +40 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/guidelines/platform-hermes.md +38 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/guidelines/role-capabilities.md +108 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/references/agency-agents.md +31 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/references/architecture-guide.md +36 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/references/orchestration.md +65 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/scripts/agency-catalog.js +190 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/scripts/consume-workflow-plan.js +129 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/scripts/index_memory.js +104 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/scripts/path-boundary.js +59 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/scripts/project-docs-resolver.js +357 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/scripts/scaffold.js +408 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/templates/AGENTS.md +20 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/templates/README.md +17 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/templates/agent-launcher.md +68 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/templates/backend-developer-csharp.md +56 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/templates/backend-developer-polyglot.md +62 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/templates/backend-developer-ts.md +57 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/templates/memory-keeper.md +37 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/templates/requirement-analyzer.md +66 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/templates/specialist-agent.md +34 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/templates/task-verifier.md +56 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/templates/tool-maker.md +33 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/workflows/01-init.md +22 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/workflows/02-analysis.md +23 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/workflows/03-generation.md +25 -0
- package/plugins/harness-everything/skills/multi-agent-workspace/workflows/04-launcher.md +16 -0
- package/plugins/harness-everything/skills/repo-docs/SKILL.md +42 -0
- package/plugins/harness-everything/skills/repo-docs/references/process-guide.md +60 -0
- package/plugins/harness-everything/skills/repo-docs/templates/agents-template.md +264 -0
- package/plugins/harness-everything/skills/repo-docs/templates/knowledge-agents-template.md +50 -0
- package/plugins/harness-everything/skills/repo-docs/templates/knowledge-readme-template.md +83 -0
- package/plugins/harness-everything/skills/repo-docs/templates/manual-recon.md +117 -0
- package/plugins/harness-everything/skills/repo-docs/templates/multi-skills-readme-template.md +72 -0
- package/plugins/harness-everything/skills/repo-docs/templates/product-agents-template.md +78 -0
- package/plugins/harness-everything/skills/repo-docs/templates/product-readme-template.md +95 -0
- package/plugins/harness-everything/skills/repo-docs/templates/readme-template.md +136 -0
- package/plugins/harness-everything/skills/repo-docs/templates/single-skill-readme-template.md +70 -0
- package/plugins/harness-everything/skills/repo-docs/templates/skills-agents-template.md +60 -0
- package/plugins/harness-everything/skills/rewrite-commits/SKILL.md +37 -0
- package/plugins/harness-everything/skills/rewrite-commits/references/workflow.md +18 -0
- package/plugins/harness-everything/skills/security-review/SKILL.md +47 -0
- package/plugins/harness-everything/skills/security-review/guides/OWASP-PATTERNS.md +31 -0
- package/plugins/harness-everything/skills/security-review/guides/STRIDE-THREAT-MODEL.md +21 -0
- package/plugins/harness-everything/skills/security-review/references/security-checklist.md +478 -0
- package/plugins/harness-everything/skills/security-review/scripts/audit-secrets.js +85 -0
- package/plugins/harness-everything/skills/self-evolve/SKILL.md +45 -0
- package/plugins/harness-everything/skills/self-evolve/references/memory-resolution.md +61 -0
- package/plugins/harness-everything/skills/self-evolve/scripts/persist-memory.js +272 -0
- package/plugins/harness-everything/skills/self-evolve/scripts/register-dynamic-skill.js +253 -0
- package/plugins/harness-everything/skills/self-evolve/scripts/self-regression.js +125 -0
- package/plugins/harness-everything/skills/skill-creator/SKILL.md +47 -0
- package/plugins/harness-everything/skills/skill-creator/references/authoring-workflow.md +14 -0
- package/plugins/harness-everything/skills/skill-creator/references/dynamic-generation-contract.md +21 -0
- package/plugins/harness-everything/skills/skill-creator/references/quality-checklist.md +16 -0
- package/plugins/harness-everything/skills/skill-creator/references/quality-principles.md +81 -0
- package/plugins/harness-everything/skills/skill-creator/references/testing-workflow.md +27 -0
- package/plugins/harness-everything/skills/skill-style/SKILL.md +42 -0
- package/plugins/harness-everything/skills/skill-style/references/style-guide.md +62 -0
- package/plugins/harness-everything/skills/tdd/SKILL.md +38 -0
- package/plugins/harness-everything/skills/tdd/fixtures/pass-evidence.json +100 -0
- package/plugins/harness-everything/skills/tdd/fixtures/quality-scenarios.json +20 -0
- package/plugins/harness-everything/skills/tdd/guides/deep-modules.md +33 -0
- package/plugins/harness-everything/skills/tdd/guides/interface-design.md +31 -0
- package/plugins/harness-everything/skills/tdd/guides/mocking.md +59 -0
- package/plugins/harness-everything/skills/tdd/guides/refactoring.md +10 -0
- package/plugins/harness-everything/skills/tdd/guides/tests.md +61 -0
- package/plugins/harness-everything/skills/tdd/references/core-discipline.md +51 -0
- package/plugins/harness-everything/skills/tdd/references/integration-testing.md +13 -0
- package/plugins/harness-everything/skills/tdd/references/quality-model.md +68 -0
- package/plugins/harness-everything/skills/tdd/references/unit-testing.md +15 -0
- package/plugins/harness-everything/skills/tdd/schemas/quality-evidence.schema.json +211 -0
- package/plugins/harness-everything/skills/tdd/schemas/quality-report.schema.json +110 -0
- package/plugins/harness-everything/skills/tdd/scripts/quality-gate.js +475 -0
- package/plugins/harness-everything/skills/to-spec/SKILL.md +40 -0
- package/plugins/harness-everything/skills/to-spec/references/process.md +77 -0
- package/plugins/harness-everything/skills/to-spec/scripts/check-project-docs.js +239 -0
- package/plugins/harness-everything/skills/to-spec/scripts/project-docs-resolver.js +111 -0
- package/plugins/harness-everything/skills/to-spec/templates/cli-reference.md +31 -0
- package/plugins/harness-everything/skills/to-spec/templates/dev-doc.md +27 -0
- package/plugins/harness-everything/skills/to-spec/templates/feature-spec.md +59 -0
- package/plugins/harness-everything/skills/to-spec/templates/schema-doc.md +31 -0
- package/plugins/harness-everything/skills/to-tickets/SKILL.md +42 -0
- package/plugins/harness-everything/skills/to-tickets/references/publishing-and-templates.md +97 -0
- package/plugins/harness-everything/skills/todo-driven-workflow/SKILL.md +42 -0
- package/plugins/harness-everything/skills/todo-driven-workflow/references/execution-guide.md +27 -0
- package/plugins/harness-everything/skills/using-git-worktrees/SKILL.md +49 -0
- package/plugins/harness-everything/skills/using-git-worktrees/references/workflow-details.md +108 -0
- package/plugins/harness-everything/skills/verification-loop/SKILL.md +46 -0
- package/plugins/harness-everything/skills/verification-loop/references/verification-phases.md +116 -0
- package/plugins/harness-everything/skills/verification-loop/templates/verification-report.template.md +15 -0
- package/plugins/harness-everything/skills/verify-before-claim/SKILL.md +43 -0
- package/plugins/harness-everything/skills/verify-before-claim/references/verification-guide.md +73 -0
- package/plugins/harness-everything/skills/zoom-out/SKILL.md +42 -0
- package/plugins/harness-everything/skills/zoom-out/references/circuit-breaker.md +66 -0
- package/plugins/harness-everything/skills/zoom-out/templates/zoom-out-report.template.md +20 -0
- package/repo-docs/SKILL.md +3 -7
- package/rewrite-commits/SKILL.md +2 -2
- package/scripts/build-openai-submission.js +158 -0
- package/scripts/installer.js +86 -11
- package/scripts/lib/advisory-text.js +25 -18
- package/scripts/lib/execution-contract.js +70 -0
- package/scripts/lib/manifest.js +34 -38
- package/scripts/lib/path-boundary.js +90 -0
- package/scripts/lib/skills.js +124 -70
- package/scripts/lib/workspace.js +269 -7
- package/scripts/repository-contract.js +213 -0
- package/scripts/sync-current-docs.js +12 -0
- package/scripts/sync-openai-plugin.js +91 -0
- package/scripts/sync-release-version.js +212 -0
- package/security-review/SKILL.md +4 -7
- package/security-review/scripts/audit-secrets.js +9 -8
- package/self-evolve/SKILL.md +9 -11
- package/self-evolve/references/memory-resolution.md +4 -1
- package/self-evolve/scripts/persist-memory.js +221 -88
- package/self-evolve/scripts/register-dynamic-skill.js +12 -10
- package/self-evolve/scripts/self-regression.js +23 -8
- package/skill-creator/SKILL.md +12 -14
- package/skill-creator/references/quality-checklist.md +1 -0
- package/skill-style/SKILL.md +4 -4
- package/skill-style/references/style-guide.md +29 -3
- package/submission/openai/README.md +67 -0
- package/submission/openai/listing.json +31 -0
- package/submission/openai/test-cases.json +61 -0
- package/tdd/SKILL.md +20 -26
- package/tdd/fixtures/pass-evidence.json +100 -0
- package/tdd/fixtures/quality-scenarios.json +20 -0
- package/tdd/references/core-discipline.md +2 -0
- package/tdd/references/integration-testing.md +13 -0
- package/tdd/references/quality-model.md +68 -0
- package/tdd/references/unit-testing.md +15 -0
- package/tdd/schemas/quality-evidence.schema.json +211 -0
- package/tdd/schemas/quality-report.schema.json +110 -0
- package/tdd/scripts/quality-gate.js +475 -0
- package/to-spec/SKILL.md +3 -5
- package/to-spec/scripts/check-project-docs.js +42 -62
- package/to-spec/scripts/project-docs-resolver.js +111 -0
- package/to-tickets/SKILL.md +4 -4
- package/todo-driven-workflow/SKILL.md +6 -4
- package/using-git-worktrees/SKILL.md +3 -3
- package/verification-loop/SKILL.md +4 -4
- package/verify-before-claim/SKILL.md +2 -2
- package/zoom-out/SKILL.md +4 -4
- package/ab-test-deep-analysis-2026-08-27.md +0 -383
- package/ab-test-results-2026-08-27.md +0 -152
- package/ab-test-statistical-analysis-31cases.md +0 -193
- package/opencode-plugin/hooks/circuit-breaker.js +0 -121
- package/opencode-plugin/hooks/compliance.js +0 -128
- package/opencode-plugin/hooks/post-edit.js +0 -62
- package/opencode-plugin/hooks/pre-complete.js +0 -65
- package/opencode-plugin/test-hook-firing.js +0 -198
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Subagent Scope Guard (PreToolUse + PostToolUse: Task/Agent and
|
|
4
|
+
* SubagentStart/SubagentStop)
|
|
5
|
+
*
|
|
6
|
+
* Phase 3 snapshots both `git status --porcelain` and any active Fable stage
|
|
7
|
+
* write sets at the beginning of a subagent burst. At the end it classifies
|
|
8
|
+
* newly changed paths as declared, ambiguous, or out-of-scope. Machine-
|
|
9
|
+
* readable write sets may therefore clear expected changes without weakening
|
|
10
|
+
* the conservative legacy path: when no stage contract exists, any new
|
|
11
|
+
* change still exits 2 and requires explicit review.
|
|
12
|
+
*
|
|
13
|
+
* `writeSet: []` means read-only. Worker attribution is used when the host
|
|
14
|
+
* exposes a worker/subagent id and the stage contract records the same id;
|
|
15
|
+
* otherwise the audit remains stage-level. The hook never infers scope from
|
|
16
|
+
* a natural-language task brief.
|
|
17
|
+
*/
|
|
18
|
+
const { execSync } = require('child_process');
|
|
19
|
+
const fs = require('fs');
|
|
20
|
+
const path = require('path');
|
|
21
|
+
const {
|
|
22
|
+
getSessionDir,
|
|
23
|
+
getSessionId,
|
|
24
|
+
getStateRoot,
|
|
25
|
+
getWorkspaceRoot,
|
|
26
|
+
} = require('./lib/harness-state');
|
|
27
|
+
const {
|
|
28
|
+
atomicWriteJson,
|
|
29
|
+
getActiveRunContracts,
|
|
30
|
+
getWorkerId,
|
|
31
|
+
stagesForChangedPath,
|
|
32
|
+
} = require('./lib/fable-contracts');
|
|
33
|
+
|
|
34
|
+
function gitStatus(root) {
|
|
35
|
+
try {
|
|
36
|
+
return execSync('git status --porcelain', {
|
|
37
|
+
cwd: root,
|
|
38
|
+
encoding: 'utf8',
|
|
39
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
40
|
+
});
|
|
41
|
+
} catch (_) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function snapshotContracts(stateRoot, sessionId) {
|
|
47
|
+
return getActiveRunContracts(stateRoot, sessionId).map(({ contract }) => ({
|
|
48
|
+
planId: contract.planId,
|
|
49
|
+
runId: contract.runId,
|
|
50
|
+
stageId: contract.stageId,
|
|
51
|
+
sessionId: contract.sessionId || null,
|
|
52
|
+
workerId: contract.workerId || null,
|
|
53
|
+
writeSet: Array.isArray(contract.writeSet) ? contract.writeSet : [],
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function classifyChanges(newlyChanged, declaredContracts, payload) {
|
|
58
|
+
const workerId = getWorkerId(payload);
|
|
59
|
+
let scopedContracts = declaredContracts;
|
|
60
|
+
if (workerId) {
|
|
61
|
+
const attributable = declaredContracts.filter(contract => contract.workerId === workerId);
|
|
62
|
+
if (attributable.length > 0) scopedContracts = attributable;
|
|
63
|
+
}
|
|
64
|
+
const entries = scopedContracts.map(contract => ({ contract }));
|
|
65
|
+
const expected = [];
|
|
66
|
+
const ambiguous = [];
|
|
67
|
+
const outOfScope = [];
|
|
68
|
+
|
|
69
|
+
for (const statusLine of newlyChanged) {
|
|
70
|
+
const matches = stagesForChangedPath(statusLine, entries);
|
|
71
|
+
if (matches.length === 1) {
|
|
72
|
+
const contract = matches[0].contract;
|
|
73
|
+
expected.push({
|
|
74
|
+
statusLine,
|
|
75
|
+
planId: contract.planId,
|
|
76
|
+
runId: contract.runId,
|
|
77
|
+
stageId: contract.stageId,
|
|
78
|
+
workerId: contract.workerId || workerId || null,
|
|
79
|
+
});
|
|
80
|
+
} else if (matches.length > 1) {
|
|
81
|
+
ambiguous.push({
|
|
82
|
+
statusLine,
|
|
83
|
+
stages: matches.map(({ contract }) => ({
|
|
84
|
+
planId: contract.planId,
|
|
85
|
+
runId: contract.runId,
|
|
86
|
+
stageId: contract.stageId,
|
|
87
|
+
workerId: contract.workerId || null,
|
|
88
|
+
})),
|
|
89
|
+
});
|
|
90
|
+
} else {
|
|
91
|
+
outOfScope.push({ statusLine, workerId: workerId || null });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return { workerId: workerId || null, expected, ambiguous, outOfScope };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
let inputData = '';
|
|
99
|
+
process.stdin.on('data', chunk => { inputData += chunk; });
|
|
100
|
+
process.stdin.on('end', () => {
|
|
101
|
+
try {
|
|
102
|
+
const payload = JSON.parse(inputData);
|
|
103
|
+
const event = payload.hook_event_name;
|
|
104
|
+
const toolName = payload.tool_name || payload.tool;
|
|
105
|
+
const isSubagentEvent = event === 'SubagentStart' || event === 'SubagentStop';
|
|
106
|
+
if (!isSubagentEvent && toolName !== 'Task' && toolName !== 'Agent') process.exit(0);
|
|
107
|
+
|
|
108
|
+
const root = getWorkspaceRoot(payload);
|
|
109
|
+
const sessionId = getSessionId(payload);
|
|
110
|
+
const sessionDir = getSessionDir(root, sessionId, payload);
|
|
111
|
+
const stateRoot = getStateRoot(root, payload);
|
|
112
|
+
const stateFile = path.join(sessionDir, 'subagent-scope-state.json');
|
|
113
|
+
|
|
114
|
+
if (event === 'PreToolUse' || event === 'SubagentStart') {
|
|
115
|
+
if (!fs.existsSync(stateFile)) {
|
|
116
|
+
const status = gitStatus(root);
|
|
117
|
+
if (status !== null) {
|
|
118
|
+
atomicWriteJson(stateFile, {
|
|
119
|
+
startedAt: new Date().toISOString(),
|
|
120
|
+
baseline: status,
|
|
121
|
+
contracts: snapshotContracts(stateRoot, sessionId),
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
process.exit(0);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (event === 'PostToolUse' || event === 'SubagentStop') {
|
|
129
|
+
if (!fs.existsSync(stateFile)) process.exit(0);
|
|
130
|
+
|
|
131
|
+
let state;
|
|
132
|
+
try { state = JSON.parse(fs.readFileSync(stateFile, 'utf8')); } catch (_) { process.exit(0); }
|
|
133
|
+
const current = gitStatus(root);
|
|
134
|
+
if (current === null) process.exit(0);
|
|
135
|
+
|
|
136
|
+
const baselineLines = new Set(String(state.baseline || '').split('\n').filter(Boolean));
|
|
137
|
+
const currentLines = current.split('\n').filter(Boolean);
|
|
138
|
+
const newlyChanged = currentLines.filter(line => !baselineLines.has(line));
|
|
139
|
+
const declaredContracts = Array.isArray(state.contracts) ? state.contracts : [];
|
|
140
|
+
const classified = classifyChanges(newlyChanged, declaredContracts, payload);
|
|
141
|
+
const audit = {
|
|
142
|
+
schemaVersion: 1,
|
|
143
|
+
sessionId: sessionId || null,
|
|
144
|
+
observedAt: new Date().toISOString(),
|
|
145
|
+
declaredContractCount: declaredContracts.length,
|
|
146
|
+
...classified,
|
|
147
|
+
};
|
|
148
|
+
atomicWriteJson(path.join(sessionDir, 'subagent-scope-last.json'), audit);
|
|
149
|
+
|
|
150
|
+
if (newlyChanged.length === 0) {
|
|
151
|
+
console.log('[Subagent Scope Guard] No new changed files detected during the subagent burst.');
|
|
152
|
+
} else if (declaredContracts.length === 0) {
|
|
153
|
+
console.error(`[Subagent Scope Guard] ${newlyChanged.length} file(s) changed with no machine-readable writeSet contract:`);
|
|
154
|
+
newlyChanged.forEach(line => console.error(` ${line}`));
|
|
155
|
+
console.error('Confirm every path was actually in scope before trusting or committing this output.');
|
|
156
|
+
} else {
|
|
157
|
+
for (const entry of classified.expected) {
|
|
158
|
+
console.log(`[Subagent Scope Guard] in-scope ${entry.statusLine} -> ${entry.planId}/${entry.runId}/${entry.stageId}${entry.workerId ? ` worker=${entry.workerId}` : ''}`);
|
|
159
|
+
}
|
|
160
|
+
for (const entry of classified.ambiguous) {
|
|
161
|
+
console.error(`[Subagent Scope Guard] ambiguous scope ${entry.statusLine}; matches ${entry.stages.map(stage => `${stage.runId}/${stage.stageId}`).join(', ')}`);
|
|
162
|
+
}
|
|
163
|
+
for (const entry of classified.outOfScope) {
|
|
164
|
+
console.error(`[Subagent Scope Guard] OUT-OF-SCOPE ${entry.statusLine}${entry.workerId ? ` worker=${entry.workerId}` : ''}`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
atomicWriteJson(stateFile, {
|
|
169
|
+
startedAt: new Date().toISOString(),
|
|
170
|
+
baseline: current,
|
|
171
|
+
contracts: snapshotContracts(stateRoot, sessionId),
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
const violated = declaredContracts.length === 0
|
|
175
|
+
? newlyChanged.length > 0
|
|
176
|
+
: classified.ambiguous.length > 0 || classified.outOfScope.length > 0;
|
|
177
|
+
if (violated) {
|
|
178
|
+
console.error('Do not "git add -A"; stage files explicitly so unexpected paths stay visible.');
|
|
179
|
+
process.exit(2);
|
|
180
|
+
}
|
|
181
|
+
process.exit(0);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
process.exit(0);
|
|
185
|
+
} catch (_) {
|
|
186
|
+
// This is a post-execution visibility gate. Runtime errors fail open; the
|
|
187
|
+
// actionGate in Phase 5 has a stricter fail-ask policy for side effects.
|
|
188
|
+
process.exit(0);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
module.exports = {
|
|
193
|
+
classifyChanges,
|
|
194
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// OpenAI's SubagentStart event has no Claude Task tool name. The shared guard
|
|
5
|
+
// records the baseline, while this adapter adds the subagent's scope reminder
|
|
6
|
+
// through the OpenAI hook output contract.
|
|
7
|
+
process.on('exit', () => {
|
|
8
|
+
process.stdout.write(JSON.stringify({
|
|
9
|
+
hookSpecificOutput: {
|
|
10
|
+
hookEventName: 'SubagentStart',
|
|
11
|
+
additionalContext: [
|
|
12
|
+
'Harness subagent scope guard is active.',
|
|
13
|
+
'Keep this worker within the requested scope and report every changed path before handoff.'
|
|
14
|
+
].join('\n')
|
|
15
|
+
}
|
|
16
|
+
}) + '\n');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
require('./subagent-scope-guard');
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const {
|
|
7
|
+
getWorkspaceRoot,
|
|
8
|
+
getSessionId,
|
|
9
|
+
getSessionDir,
|
|
10
|
+
writeCurrentSession,
|
|
11
|
+
pruneStaleSessions
|
|
12
|
+
} = require('./scripts/lib/harness-state');
|
|
13
|
+
|
|
14
|
+
const POLICY = [
|
|
15
|
+
'Harness Cognitive OS policy is active.',
|
|
16
|
+
'Use Discover -> Think -> Try -> Summarize -> Record as a lightweight reasoning loop.',
|
|
17
|
+
'Cross-cutting invariants:',
|
|
18
|
+
'- Route before execution: establish task scope before mutating work.',
|
|
19
|
+
'- Verify before claim: require objective evidence appropriate to the change.',
|
|
20
|
+
'- Re-plan on repetition: after 3 same-signature failures, zoom out instead of repeating the same attempt.',
|
|
21
|
+
'Domain skills are advisory. Do not enforce a universal workflow order; choose the smallest useful skill/tool set.'
|
|
22
|
+
].join('\n');
|
|
23
|
+
|
|
24
|
+
function readPayload() {
|
|
25
|
+
if (process.stdin.isTTY) return null;
|
|
26
|
+
try {
|
|
27
|
+
const raw = fs.readFileSync(0, 'utf8').trim();
|
|
28
|
+
return raw ? JSON.parse(raw) : null;
|
|
29
|
+
} catch (err) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function removeIfPresent(file) {
|
|
35
|
+
try {
|
|
36
|
+
if (fs.existsSync(file)) fs.unlinkSync(file);
|
|
37
|
+
} catch (err) {
|
|
38
|
+
// Session reset is best effort; a stale breaker must never block startup.
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function handoffContext(sessionDir) {
|
|
43
|
+
try {
|
|
44
|
+
const handoff = JSON.parse(fs.readFileSync(path.join(sessionDir, 'handoff-state.json'), 'utf8'));
|
|
45
|
+
if (handoff.status !== 'failed') return '';
|
|
46
|
+
const detail = String(handoff.errorSummary || 'No error snippet available').trim().slice(-300);
|
|
47
|
+
return `\nPrevious session checkpoint: ${handoff.tool || 'unknown'} failed${handoff.exitCode ? ` (exit ${handoff.exitCode})` : ''}.\nReview the failure evidence before continuing.\n${detail}`;
|
|
48
|
+
} catch (err) {
|
|
49
|
+
return '';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function main() {
|
|
54
|
+
const payload = readPayload();
|
|
55
|
+
const root = getWorkspaceRoot(payload);
|
|
56
|
+
const sessionId = getSessionId(payload);
|
|
57
|
+
let additionalContext = POLICY;
|
|
58
|
+
|
|
59
|
+
if (root) {
|
|
60
|
+
try {
|
|
61
|
+
pruneStaleSessions(root);
|
|
62
|
+
writeCurrentSession(root, sessionId);
|
|
63
|
+
const sessionDir = getSessionDir(root, sessionId);
|
|
64
|
+
removeIfPresent(path.join(sessionDir, 'rule-of-3-state.json'));
|
|
65
|
+
removeIfPresent(path.join(sessionDir, 'zoom-out-report.md'));
|
|
66
|
+
removeIfPresent(path.join(sessionDir, 'subagent-scope-state.json'));
|
|
67
|
+
additionalContext += handoffContext(sessionDir);
|
|
68
|
+
} catch (err) {
|
|
69
|
+
// Policy injection remains useful even if runtime state is unavailable.
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
console.log(JSON.stringify({
|
|
74
|
+
hookSpecificOutput: {
|
|
75
|
+
hookEventName: 'SessionStart',
|
|
76
|
+
additionalContext
|
|
77
|
+
}
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
main();
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
|
+
"name": "harness-everything",
|
|
4
|
+
"version": "0.4.1",
|
|
5
|
+
"description": "Invariant-first engineering harness for routing, verification, and failure recovery while preserving agent autonomy.",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Miya Daniel",
|
|
8
|
+
"url": "https://github.com/dyphn1"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/dyphn1/Harness-everything",
|
|
11
|
+
"repository": "https://github.com/dyphn1/Harness-everything",
|
|
12
|
+
"license": "Apache-2.0",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"agent-harness",
|
|
15
|
+
"orchestration",
|
|
16
|
+
"tdd",
|
|
17
|
+
"verification"
|
|
18
|
+
],
|
|
19
|
+
"extensions": {
|
|
20
|
+
"com.openai": {
|
|
21
|
+
"hooks": "./hooks/hooks.json",
|
|
22
|
+
"interface": {
|
|
23
|
+
"displayName": "Harness Everything",
|
|
24
|
+
"shortDescription": "Route, verify, and recover coding work",
|
|
25
|
+
"longDescription": "Harness Everything adds reusable software-engineering workflows for task routing, test-driven development, verification, security review, documentation, failure recovery, and related coding-agent work. It keeps a small set of cross-cutting invariants while allowing the agent to choose, combine, reorder, or skip domain skills as appropriate.",
|
|
26
|
+
"developerName": "Miya Daniel",
|
|
27
|
+
"category": "Developer Tools",
|
|
28
|
+
"capabilities": [
|
|
29
|
+
"Interactive",
|
|
30
|
+
"Read",
|
|
31
|
+
"Write"
|
|
32
|
+
],
|
|
33
|
+
"websiteURL": "https://github.com/dyphn1/Harness-everything",
|
|
34
|
+
"privacyPolicyURL": "https://github.com/dyphn1/Harness-everything/blob/main/PRIVACY.md",
|
|
35
|
+
"termsOfServiceURL": "https://github.com/dyphn1/Harness-everything/blob/main/TERMS.md",
|
|
36
|
+
"defaultPrompt": [
|
|
37
|
+
"Route this software task with Harness and use only the skills that help.",
|
|
38
|
+
"Review this change and verify it with objective evidence before claiming completion."
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// Prompt-injection-only guidance for platforms with no hook/execution
|
|
2
|
+
// mechanism (Cursor, Copilot, Codex, Continue, Hermes). Single source of
|
|
3
|
+
// truth for the advisory block.
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
const MARKER = "Harness OS Guidance (Advisory)";
|
|
8
|
+
|
|
9
|
+
const advisoryInstructions = [
|
|
10
|
+
`\n# ${MARKER}`,
|
|
11
|
+
`This file is advisory only - this platform has no hook/execution mechanism to`,
|
|
12
|
+
`enforce it mechanically (unlike Claude Code's hook-based circuit breaker). Treat`,
|
|
13
|
+
`these as strong defaults, not guarantees.`,
|
|
14
|
+
``,
|
|
15
|
+
`## ๐ฆ MANDATORY ENTRY TRIAGE & ROUTING (ALWAYS RUN FIRST)`,
|
|
16
|
+
`Every time you receive a new prompt, you MUST load the \`harness-everything\` skill and immediately do the following:`,
|
|
17
|
+
`1. Run \`npx github:dyphn1/Harness-everything next "<Brief summary of user's prompt>"\` (this prints the same routing recommendation tier-router.js produces - it works from any directory and does not depend on where a local copy of the skill was installed). If the terminal is not available yet, simulate its routing logic from the rules below instead of skipping this step.`,
|
|
18
|
+
`2. Output a clear, stylized routing checkpoint block at the VERY BEGINNING of your response to the user:`,
|
|
19
|
+
` \`\`\`markdown`,
|
|
20
|
+
` ## ๐ฆ Harness OS Routing Checkpoint`,
|
|
21
|
+
` - **Active Tier**: Tier 1 (Trivial) | Tier 2 (Standard) | Tier 3 (Macro)`,
|
|
22
|
+
` - **Rationale**: <1-sentence rationale from the tier router output>`,
|
|
23
|
+
` - **Routed Skills, Guides & Actions**:`,
|
|
24
|
+
` - \`path/to/skill/or/guide.md\` (<Brief reason why this guide/skill is loaded/used>)`,
|
|
25
|
+
` \`\`\``,
|
|
26
|
+
``,
|
|
27
|
+
`## ๐ค COGNITIVE COMPLIANCE (NO SILENT DEGRADES FOR NEW FEATURES)`,
|
|
28
|
+
`- **Newly Added Features / Extensions**: Copilot is highly prone to treating new feature requests as Tier 1 direct edits. If a task introduces *any* new logic, a new API endpoint, or a new file/module, you **MUST NOT** treat it as Tier 1. It **MUST** be treated as a **Tier 2 (Standard Task)** or **Tier 3 (Macro Task)**.`,
|
|
29
|
+
`- **Tier 2 Activation**: Initialize the \`todo-driven-workflow\` checklist first. Summon Domain Experts based on tech stack. Load and execute the \`tdd\` (Test-Driven Development) skill (write tests first, implement, refactor).`,
|
|
30
|
+
`- **Tier 3 Activation**: Initialize the \`todo-driven-workflow\` checklist, load \`fable-mode\` and \`fable-discipline\`, run sub-agents via \`multi-agent-workspace\`, and write global docs using \`repo-docs\`.`,
|
|
31
|
+
`- **Pre-Completion Verification Gate**: Before telling the human the task is done, run \`npx github:dyphn1/Harness-everything verify\` in the project root. If it exits non-zero, fix the failures and run it again before declaring completion. On Claude Code this same check is mechanically enforced by a stop hook; here nothing blocks you from skipping it, so treat it as a real requirement, not a suggestion.`,
|
|
32
|
+
`- **Memory Summarization (Self-Evolve)**: Upon task completion, you **MUST** run the \`self-evolve\` skill (running \`node self-evolve/scripts/self-regression.js\` or writing memories) to record key insights, lessons learned, and error boundaries so your context builds across sessions.`,
|
|
33
|
+
`- **Environment Discovery**: Discover the environment (OS, shell, package manager) before running commands - don't assume.`,
|
|
34
|
+
`- **Rule of 3**: If the same error repeats 3 times in a row, STOP retrying. Explain what's failing and ask the human for direction instead of continuing to guess.`,
|
|
35
|
+
`- **Prefer Editing**: Prefer editing over rewriting; commit logically complete chunks rather than one giant diff.`,
|
|
36
|
+
``
|
|
37
|
+
].join('\n');
|
|
38
|
+
|
|
39
|
+
function hasHarnessMarker(content) {
|
|
40
|
+
return typeof content === 'string' && content.includes(MARKER);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function assertHarnessOwnedOrAbsent(targetFile, label) {
|
|
44
|
+
if (!fs.existsSync(targetFile)) return;
|
|
45
|
+
const content = fs.readFileSync(targetFile, 'utf8');
|
|
46
|
+
if (!hasHarnessMarker(content)) {
|
|
47
|
+
throw new Error(`Refusing to overwrite pre-existing non-Harness ${label}: ${targetFile}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function injectAdvisoryText(targetFile, header, label) {
|
|
52
|
+
const dir = path.dirname(targetFile);
|
|
53
|
+
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
54
|
+
|
|
55
|
+
if (fs.existsSync(targetFile)) {
|
|
56
|
+
const content = fs.readFileSync(targetFile, 'utf8');
|
|
57
|
+
if (!hasHarnessMarker(content)) {
|
|
58
|
+
fs.appendFileSync(targetFile, advisoryInstructions, 'utf8');
|
|
59
|
+
console.log(` โ
Augmented existing ${label} with Harness guidance (advisory-only)`);
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
fs.writeFileSync(targetFile, `${header}\n${advisoryInstructions}`, 'utf8');
|
|
63
|
+
console.log(` โ
Created ${label} with Harness guidance (advisory-only)`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function removeAdvisoryText(targetFile) {
|
|
68
|
+
if (!fs.existsSync(targetFile)) return;
|
|
69
|
+
try {
|
|
70
|
+
let content = fs.readFileSync(targetFile, 'utf8');
|
|
71
|
+
const markerIndex = content.indexOf(MARKER);
|
|
72
|
+
if (markerIndex !== -1) {
|
|
73
|
+
let cleanContent = content;
|
|
74
|
+
const hashMarkerIndex = content.lastIndexOf('#', markerIndex);
|
|
75
|
+
if (hashMarkerIndex !== -1) cleanContent = content.substring(0, hashMarkerIndex).trim() + '\n';
|
|
76
|
+
else cleanContent = content.substring(0, markerIndex).trim() + '\n';
|
|
77
|
+
|
|
78
|
+
const lines = cleanContent.trim().split('\n').map(l => l.trim()).filter(l => l !== '');
|
|
79
|
+
if (lines.length === 0 || (lines.length === 1 && (lines[0] === '# Cursor Project Rules' || lines[0] === '# AGENTS.md' || lines[0] === '# Copilot Instructions' || lines[0] === '# .hermes.md'))) {
|
|
80
|
+
fs.unlinkSync(targetFile);
|
|
81
|
+
console.log(` โ
Removed empty advisory file: ${targetFile}`);
|
|
82
|
+
} else {
|
|
83
|
+
fs.writeFileSync(targetFile, cleanContent.trim() + '\n', 'utf8');
|
|
84
|
+
console.log(` โ
Removed Harness guidance from: ${targetFile}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
} catch (e) {
|
|
88
|
+
console.warn(` โ ๏ธ Error removing advisory text from ${targetFile}: ${e.message}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Continue gets a dedicated rule file. If a user already owns that exact
|
|
93
|
+
// path, do not replace it just because Harness chose the same filename.
|
|
94
|
+
function installContinueRule(targetFile, label) {
|
|
95
|
+
const dir = path.dirname(targetFile);
|
|
96
|
+
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
97
|
+
assertHarnessOwnedOrAbsent(targetFile, label);
|
|
98
|
+
if (fs.existsSync(targetFile) && hasHarnessMarker(fs.readFileSync(targetFile, 'utf8'))) return;
|
|
99
|
+
const content = [
|
|
100
|
+
`---`,
|
|
101
|
+
`name: Harness OS Guidance`,
|
|
102
|
+
`alwaysApply: true`,
|
|
103
|
+
`description: "Harness OS routing, circuit-breaker awareness, and environment-discovery guidance (advisory only on Continue - no hook mechanism)"`,
|
|
104
|
+
`---`,
|
|
105
|
+
advisoryInstructions.replace(/^\n/, '')
|
|
106
|
+
].join('\n');
|
|
107
|
+
fs.writeFileSync(targetFile, content, 'utf8');
|
|
108
|
+
console.log(` โ
Installed Continue rule file with Harness guidance (advisory-only): ${label}`);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function removeContinueRule(targetFile) {
|
|
112
|
+
if (!fs.existsSync(targetFile)) return;
|
|
113
|
+
try {
|
|
114
|
+
const content = fs.readFileSync(targetFile, 'utf8');
|
|
115
|
+
if (hasHarnessMarker(content)) {
|
|
116
|
+
fs.unlinkSync(targetFile);
|
|
117
|
+
console.log(` โ
Removed Harness rule file: ${targetFile}`);
|
|
118
|
+
}
|
|
119
|
+
} catch (e) {
|
|
120
|
+
console.warn(` โ ๏ธ Error removing ${targetFile}: ${e.message}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function buildCopilotGlobalContent() {
|
|
125
|
+
return [
|
|
126
|
+
`---`,
|
|
127
|
+
`description: "Harness OS Guidance (Advisory)"`,
|
|
128
|
+
`applyTo: "**"`,
|
|
129
|
+
`---`,
|
|
130
|
+
`# Copilot Instructions`,
|
|
131
|
+
``,
|
|
132
|
+
advisoryInstructions.replace(/^\n/, '')
|
|
133
|
+
].join('\n');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function buildCodexGlobalContent() {
|
|
137
|
+
return [
|
|
138
|
+
`---`,
|
|
139
|
+
`description: "Harness OS Guidance - Global custom agent for orchestrating multi-agent workflows"`,
|
|
140
|
+
`name: "Harness"`,
|
|
141
|
+
`user-invocable: true`,
|
|
142
|
+
`---`,
|
|
143
|
+
`# AGENTS.md`,
|
|
144
|
+
``,
|
|
145
|
+
`# ${MARKER}`,
|
|
146
|
+
`This file is advisory only - this platform has no hook/execution mechanism to`,
|
|
147
|
+
`enforce it mechanically (unlike Claude Code's hook-based circuit breaker). Treat`,
|
|
148
|
+
`these as strong defaults, not guarantees.`,
|
|
149
|
+
``,
|
|
150
|
+
`- Discover the environment (OS, shell, package manager) before running commands - don't assume.`,
|
|
151
|
+
`- Triage tasks: run \`npx github:dyphn1/Harness-everything next "<summary>"\` for a routing recommendation`,
|
|
152
|
+
` (trivial fixes need no plan; standard features need tests; large refactors need an explicit plan`,
|
|
153
|
+
` reviewed with the human before implementation).`,
|
|
154
|
+
`- Before declaring a task done, run \`npx github:dyphn1/Harness-everything verify\` and fix any failures`,
|
|
155
|
+
` it reports - nothing here blocks you from skipping this, so treat it as a real requirement.`,
|
|
156
|
+
`- If the same error repeats 3 times in a row, STOP retrying. Explain what's failing and ask the`,
|
|
157
|
+
` human for direction instead of continuing to guess.`,
|
|
158
|
+
`- Prefer editing over rewriting; commit logically complete chunks rather than one giant diff.`,
|
|
159
|
+
``
|
|
160
|
+
].join('\n');
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
module.exports = {
|
|
164
|
+
MARKER,
|
|
165
|
+
advisoryInstructions,
|
|
166
|
+
hasHarnessMarker,
|
|
167
|
+
assertHarnessOwnedOrAbsent,
|
|
168
|
+
injectAdvisoryText,
|
|
169
|
+
removeAdvisoryText,
|
|
170
|
+
installContinueRule,
|
|
171
|
+
removeContinueRule,
|
|
172
|
+
buildCopilotGlobalContent,
|
|
173
|
+
buildCodexGlobalContent,
|
|
174
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: environment-detection
|
|
3
|
+
description: Use at session start (Discover phase) to detect and align with the operating system, shell (Git Bash vs PowerShell vs CMD), package managers, and dev tools; prevents blind command execution and repetitive tool errors.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
metadata:
|
|
6
|
+
author: Miya Daniel
|
|
7
|
+
version: 0.4.0
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Environment Detection & Shell Alignment
|
|
11
|
+
|
|
12
|
+
Think > Try > Summarize > Record: detect before executing.
|
|
13
|
+
|
|
14
|
+
## ๐ Skill Contract
|
|
15
|
+
|
|
16
|
+
| Component | Specification |
|
|
17
|
+
| :--- | :--- |
|
|
18
|
+
| **Trigger / Input** | Session start or complex terminal sequences. |
|
|
19
|
+
| **Expected Output** | Detected OS, shell, PATH via script or heuristics. |
|
|
20
|
+
| **State Mutations** | Session context adopts path/env-var syntax. |
|
|
21
|
+
| **Enforcement Gate** | Preflight; fall back to `<environment_info>` inspection and probing. |
|
|
22
|
+
|
|
23
|
+
Boundary: operate solely within `process.cwd()`; ignore other workspaces, history, or temp paths surfaced by the IDE โ never run commands outside the current project root.
|
|
24
|
+
|
|
25
|
+
## Workflow
|
|
26
|
+
|
|
27
|
+
1. Preflight from this skill's own directory; parse OS, shell, available CLIs: `node "<this-skill-dir>/scripts/preflight.js"`
|
|
28
|
+
2. Self-heal harness touchpoints (idempotent): `node "<skills-repo-root>/harness-everything/scripts/self-heal.js"` โ audits `<workspace>/.claude/settings.json`, `<workspace>/.cursorrules`, `<workspace>/.github/copilot-instructions.md`, `<workspace>/AGENTS.md`.
|
|
29
|
+
3. Adopt syntax: Git Bash โ forward `/`, `$VAR`, Unix cmds (`ls`, `rm -rf`), never `dir`/`del`/PowerShell ยท PowerShell โ `$env:VAR`, cmdlets ยท CMD โ `\`, `%VAR%`, `dir`/`del`/`copy`, never Unix.
|
|
30
|
+
4. On failure don't blindly retry โ suspect wrong-shell syntax. Three failures โ trigger `zoom-out`.
|
|
31
|
+
|
|
32
|
+
Deep dive: <this-skill-dir>/references/shell-syntax-rules.md
|
|
33
|
+
|
|
34
|
+
## USE FOR:
|
|
35
|
+
- session-start OS/shell/toolchain detection
|
|
36
|
+
- per-terminal command/path/env-var alignment
|
|
37
|
+
- repairing missing harness touchpoints
|
|
38
|
+
|
|
39
|
+
## DO NOT USE FOR:
|
|
40
|
+
- operating outside the current workspace
|
|
41
|
+
- installing toolchains from scratch
|
package/plugins/harness-everything/skills/environment-detection/references/shell-syntax-rules.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Environment Detection โ Full Shell Syntax Rules
|
|
2
|
+
|
|
3
|
+
## Decision Flow
|
|
4
|
+
|
|
5
|
+
```mermaid
|
|
6
|
+
flowchart TD
|
|
7
|
+
Start[Session Start / Discover Phase] --> CheckNode{1. Node.js Executable?}
|
|
8
|
+
|
|
9
|
+
CheckNode -- Yes --> RunPreflight[Run scripts/preflight.js]
|
|
10
|
+
RunPreflight -- Exit 0 (Success) --> ParseOutput[Parse OS, Shell & Available CLI Tools]
|
|
11
|
+
RunPreflight -- Fails --> Heuristic
|
|
12
|
+
|
|
13
|
+
CheckNode -- No --> Heuristic{2. Environment Heuristic Inspection Fallback}
|
|
14
|
+
|
|
15
|
+
Heuristic --> CheckPrompt[Inspect <environment_info> & Session Context]
|
|
16
|
+
CheckPrompt --> ProbeShell[Probe Shell via echo $SHELL / $env:OS / %COMSPEC%]
|
|
17
|
+
|
|
18
|
+
ParseOutput --> AlignSyntax[Adopt Command & Path Syntax Rules]
|
|
19
|
+
ProbeShell --> AlignSyntax
|
|
20
|
+
AlignSyntax --> SelfHeal[Run self-heal.js if Node available]
|
|
21
|
+
SelfHeal --> Done[Environment Context Established]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Cognitive loop detail
|
|
25
|
+
|
|
26
|
+
- **[Think]**: Before running any terminal commands, check your environment. Blind execution is the primary source of agent step waste.
|
|
27
|
+
- **[Try]**: Run the automated preflight check script to determine exact platform properties.
|
|
28
|
+
- **[Summarize]**: Output the detected terminal, OS, and toolchains so the session context retains these bounds.
|
|
29
|
+
- **[Record]**: Adopt the corresponding command syntax rules for the rest of the conversation.
|
|
30
|
+
|
|
31
|
+
## Strict Workspace Boundary detail (Current Active Workspace Only)
|
|
32
|
+
|
|
33
|
+
- **Current Workspace Only**: Must detect and operate solely within the active workspace directory (i.e. the current project root, which is `process.cwd()`).
|
|
34
|
+
- **Ignore Other Workspaces**: Even if VS Code context or history exposes other workspaces, temporary paths, or recently opened projects (e.g. `d:\super.h2o.sbom`, `d:\DeveloperDocs`, `c:\Users\DanielCH.Chang\Desktop\XinputDxe_V0.0.5`, etc.), you **MUST completely ignore them**. Never perform structural analysis, tool checks, or execute terminal commands in those non-current project paths.
|
|
35
|
+
- **Single-Workspace Execution**: All terminal commands, tool availability checks, and path resolutions MUST be strictly restricted to the current project root directory. Operating across boundaries on adjacent or unrelated folders is strictly prohibited.
|
|
36
|
+
|
|
37
|
+
## Preflight & self-heal detail
|
|
38
|
+
|
|
39
|
+
Run the preflight script that lives at `scripts/preflight.js` inside this skill's own directory โ resolve the path from wherever this SKILL.md was loaded (do not guess a hard-coded location). Parse the output to understand:
|
|
40
|
+
|
|
41
|
+
- Operating System (Windows vs. macOS vs. Linux)
|
|
42
|
+
- Active Shell (Git Bash vs. PowerShell vs. Command Prompt)
|
|
43
|
+
- Available CLI Tools (node, pnpm, docker, python, etc.)
|
|
44
|
+
|
|
45
|
+
Toolchain self-heal: the harness itself is part of the environment. Audit whether this workspace's integration touchpoints (`.claude/settings.json` hooks, `.cursorrules`, `.github/copilot-instructions.md`, `AGENTS.md`) are installed, and repair any missing ones โ e.g., installed via Claude Code but now opened in Copilot. The script is idempotent (it delegates to the installer, which merges hooks by id and never duplicates advisory text), so running it on an already-healthy workspace is a no-op. Skip only if the user intentionally removed a touchpoint file.
|
|
46
|
+
|
|
47
|
+
## Shell syntax rules in full
|
|
48
|
+
|
|
49
|
+
### 1. Git Bash on Windows (User's Preferred Terminal)
|
|
50
|
+
|
|
51
|
+
- **Path Slashes**: Always use forward slashes `/` (e.g., `scripts/lib/utils.js`). Never use raw backslashes `\` because they act as escape characters in Bash.
|
|
52
|
+
- **Env Variables**: Use `$VARIABLE_NAME` syntax. Do NOT use `%VARIABLE_NAME%` or `$env:VARIABLE_NAME`.
|
|
53
|
+
- **Command Set**: Standard Unix commands are fully supported (`ls`, `rm -rf`, `mkdir -p`, `cp`, `mv`). Do NOT run CMD native commands like `dir`, `del`, or `copy`.
|
|
54
|
+
- **No PowerShell syntax**: Do not run PowerShell-specific scripts or syntax.
|
|
55
|
+
|
|
56
|
+
### 2. PowerShell on Windows
|
|
57
|
+
|
|
58
|
+
- **Path Slashes**: Forward slashes `/` or backslashes `\\` are both acceptable.
|
|
59
|
+
- **Env Variables**: Use `$env:VARIABLE_NAME` syntax.
|
|
60
|
+
- **Command Set**: Use standard PowerShell commands or common aliases (e.g., `New-Item`, `Remove-Item`).
|
|
61
|
+
|
|
62
|
+
### 3. Windows Command Prompt (CMD)
|
|
63
|
+
|
|
64
|
+
- **Path Slashes**: Use backslashes `\` for file paths.
|
|
65
|
+
- **Env Variables**: Use `%VARIABLE_NAME%` syntax.
|
|
66
|
+
- **Command Set**: Use `dir`, `del`, `copy`, `mkdir`. Do NOT use `ls`, `rm`, `cp`, `mkdir -p`.
|
|
67
|
+
|
|
68
|
+
## Red flags & common errors
|
|
69
|
+
|
|
70
|
+
- โ **CMD commands in Git Bash**: Attempting to run `dir` or `del` when the terminal is actually running Git Bash.
|
|
71
|
+
- โ **PowerShell commands in Bash**: Attempting to run `$env:PATH` or `.ps1` files in a Bash environment.
|
|
72
|
+
- โ **Path escape failures**: Sending raw Windows paths like `scripts\run.js` inside a Bash terminal, which interprets `\r` as a carriage return or escapes characters.
|
|
73
|
+
|
|
74
|
+
## Verification & reflection
|
|
75
|
+
|
|
76
|
+
If any shell command fails, do not blindly retry the exact same command. Stop and ask yourself: "Did I use the wrong syntax for this terminal? Is this a Git Bash vs. PowerShell syntax issue?" If you fail 3 times on the same command, trigger the `zoom-out` circuit breaker.
|