@lannguyensi/harness 0.13.0 → 0.15.0
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/CHANGELOG.md +55 -0
- package/README.md +11 -1
- package/dist/cli/approve/understanding.d.ts +15 -0
- package/dist/cli/approve/understanding.js +26 -6
- package/dist/cli/approve/understanding.js.map +1 -1
- package/dist/cli/explain.js +11 -1
- package/dist/cli/explain.js.map +1 -1
- package/dist/cli/index.js +9 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/composer.d.ts +29 -0
- package/dist/cli/init/composer.js +377 -0
- package/dist/cli/init/composer.js.map +1 -0
- package/dist/cli/init/dependencies.d.ts +25 -0
- package/dist/cli/init/dependencies.js +100 -10
- package/dist/cli/init/dependencies.js.map +1 -1
- package/dist/cli/init/index.d.ts +18 -1
- package/dist/cli/init/index.js +17 -7
- package/dist/cli/init/index.js.map +1 -1
- package/dist/cli/init/interactive.d.ts +31 -2
- package/dist/cli/init/interactive.js +321 -79
- package/dist/cli/init/interactive.js.map +1 -1
- package/dist/cli/init/templates.d.ts +1 -1
- package/dist/cli/init/templates.js +60 -9
- package/dist/cli/init/templates.js.map +1 -1
- package/dist/cli/pack/hook-codex-pre-tool-use.d.ts +2 -0
- package/dist/cli/pack/hook-codex-pre-tool-use.js +35 -9
- package/dist/cli/pack/hook-codex-pre-tool-use.js.map +1 -1
- package/dist/cli/pack/hook-pre-tool-use.d.ts +1 -1
- package/dist/cli/pack/hook-pre-tool-use.js +80 -25
- package/dist/cli/pack/hook-pre-tool-use.js.map +1 -1
- package/dist/cli/validate/checks.d.ts +1 -1
- package/dist/cli/validate/checks.js +1 -7
- package/dist/cli/validate/checks.js.map +1 -1
- package/dist/io/harness-lock.js +1 -9
- package/dist/io/harness-lock.js.map +1 -1
- package/dist/policies/index.d.ts +1 -1
- package/dist/policies/index.js +1 -1
- package/dist/policies/index.js.map +1 -1
- package/dist/policies/ledger-client.js +3 -9
- package/dist/policies/ledger-client.js.map +1 -1
- package/dist/policies/producers.d.ts +12 -0
- package/dist/policies/producers.js +61 -0
- package/dist/policies/producers.js.map +1 -0
- package/dist/policies/requires.d.ts +23 -0
- package/dist/policies/requires.js +39 -0
- package/dist/policies/requires.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution-runtime.d.ts +44 -6
- package/dist/policy-packs/builtin/understanding-before-execution-runtime.js +126 -10
- package/dist/policy-packs/builtin/understanding-before-execution-runtime.js.map +1 -1
- package/dist/runtime/expand-home.d.ts +14 -0
- package/dist/runtime/expand-home.js +54 -0
- package/dist/runtime/expand-home.js.map +1 -0
- package/dist/runtime/intercept.d.ts +8 -0
- package/dist/runtime/intercept.js +24 -1
- package/dist/runtime/intercept.js.map +1 -1
- package/dist/runtime/ledger-add.js +10 -3
- package/dist/runtime/ledger-add.js.map +1 -1
- package/dist/runtime/ledger-record.js +11 -10
- package/dist/runtime/ledger-record.js.map +1 -1
- package/dist/schema/index.d.ts +281 -101
- package/dist/schema/permission-profiles.d.ts +125 -125
- package/dist/schema/policies.d.ts +261 -0
- package/dist/schema/policies.js +50 -0
- package/dist/schema/policies.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const MINIMAL_TEMPLATE = "# ~/.claude/harness.yaml\n#\n# Bootstrapped by `harness init --template minimal`.\n#\n# This is the empty-but-valid manifest. Run `harness validate` to confirm it\n# parses, then add entries under the five top-level keys:\n#\n# grounding: evidence-ledger + claim-gate config (see docs/ARCHITECTURE.md \u00A72)\n# tools: mcp / cli / skills / builtin inventory (\u00A73)\n# memory: directories, retention, scopes (\u00A74)\n# hooks: event-bound shell commands (\u00A75)\n# policies: named rules that bind hooks to triggers (\u00A76)\n#\n# Phase 2 verbs to add entries safely: `harness add mcp <name> ...`,\n# `harness add cli`, `harness add hook`, `harness add skill`.\n# Per-machine overrides live at ~/.claude/machines/<discriminator>.harness.overrides.yaml\n# (ARCHITECTURE.md \u00A78) for paths that vary per host.\n#\n# Docs: https://github.com/LanNguyenSi/harness\n\nversion: 1\n";
|
|
2
|
-
export declare const FULL_TEMPLATE = "# ~/.claude/harness.yaml\n#\n# Bootstrapped by `harness init --template full`. The reference manifest:\n# every example policy from docs/examples/full-manifest.yaml wired through\n# the generic `harness policy intercept` engine, so no external shell\n# scripts under ~/.claude/hooks/ are required.\n#\n# Canonical source for the policy + policy_packs sections is\n# docs/examples/full-manifest.yaml. A parity vitest\n# (tests/cli/init-full-template-parity.test.ts) fails the build if the\n# two diverge on policy names or load-bearing fields.\n#\n# What you still need on PATH (the wizard offers to `npm i -g` these on\n# init): agent-tasks-mcp-bridge, grounding-mcp, memory-router-*,\n# understanding-gate-claude-*. Optional add-on: a local codebase-oracle\n# MCP server (see comment under tools.mcp below).\n\nversion: 1\n\ngrounding:\n session:\n auto_start: true\n id_format: \"gs-{repo}-{rand:8}\"\n evidence_ledger:\n path: ~/.evidence-ledger/ledger.db\n retention_days: 90\n policies_source: ~/.claude/harness.d/policies/claim-gate.yaml\n\ntools:\n mcp:\n # codebase-oracle (the Pandora RAG MCP server) is intentionally NOT\n # in this default. The npm name `codebase-oracle` is already taken\n # by an unrelated CLI, and the Pandora variant is not yet published\n # under a non-colliding scope. Operators who run from a local\n # checkout can add it back with (note: `harness add` splits the\n # command on commas, not whitespace):\n # harness add mcp codebase-oracle \\\n # --command 'npx,tsx,~/git/pandora/codebase-oracle/src/mcp-server.ts'\n - name: agent-tasks\n # Zero-setup entry: `@agent-tasks/mcp-bridge` exposes the\n # `agent-tasks-mcp-bridge` binary on PATH. The bridge owns token\n # storage and defaults to the hosted backend; override with\n # `AGENT_TASKS_BASE_URL` / `AGENT_TASKS_TOKEN` for self-hosted.\n # `min_version` floor: 0.6.0 added the `--version` short-circuit\n # the doctor probe needs (PR agent-tasks/240, release-cut PR 241).\n # Bump the floor whenever a fix you depend on lands; loose floors\n # are fine, the point is the drift signal not pinning a specific cut.\n command: [agent-tasks-mcp-bridge]\n min_version: \"0.6.0\"\n health:\n verb: projects_list\n timeout_ms: 5000\n enabled: true\n - name: grounding-mcp\n # Published bin from `@lannguyensi/grounding-mcp`. No env is set:\n # the bundled default resolves to `~/.evidence-ledger/ledger.db`\n # via os.homedir() at startup. Passing a literal tilde in env\n # bypasses shell expansion and creates rogue cwd-relative DB files\n # (see agent-tasks/42d224a6 incident). `min_version` floor: 0.2.0\n # added the `--version` short-circuit the doctor probe needs (PR\n # agent-grounding/76, release-cut PR 77).\n command: [grounding-mcp]\n min_version: \"0.2.0\"\n health:\n verb: ledger_status\n timeout_ms: 5000\n enabled: true\n\n cli:\n - name: gh\n binary: gh\n required: true\n\n skills:\n enabled:\n - simplify\n - init\n - review\n - security-review\n source_dirs:\n - ~/.claude/skills\n\n builtin:\n known: [Read, Edit, Write, Bash, Agent, Skill, TaskCreate, Glob, Grep]\n\nmemory:\n directories:\n - path: ~/.claude/projects/{project}/memory\n scope: project\n router:\n # Published bin from `@lannguyensi/memory-router`.\n # `min_version` floor: 0.3.0 added the `--version` short-circuit\n # the doctor probe needs (PR agent-memory/40, release-cut PR 41).\n command: [memory-router-user-prompt-submit]\n min_version: \"0.3.0\"\n enabled: true\n retention:\n staleness_days: 180\n broken_refs: warn\n scopes:\n default: project\n allowed: [project, user]\n\n# All PreToolUse hooks share the generic `harness policy intercept` CLI\n# entrypoint. The engine reads the tool event on stdin, evaluates whichever\n# policy below has a matching trigger (`match` + optional `bash_match`),\n# and emits Claude Code's deny envelope when the required ledger tag is\n# absent. No external shell scripts are required.\n#\n# The `git-preflight` SessionStart hook is the producer side of the\n# `preflight-before-*` policies: `harness session-start preflight` runs\n# agent-preflight against the session cwd and, on a ready:true result,\n# records `preflight:${REPO}` to the evidence ledger. It needs the\n# `preflight` binary on PATH (`npm i -g @lannguyensi/agent-preflight`); when\n# that is absent the hook logs to stderr and exits 0, so the session is\n# never broken \u2014 the preflight gates just stay closed until a tag is\n# produced some other way.\nhooks:\n - name: git-preflight\n event: SessionStart\n command: harness session-start preflight\n blocking: false\n budget_ms: 30000\n\n - name: require-review-evidence\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_merge\"\n command: harness policy intercept\n blocking: hard\n budget_ms: 2000\n\n - name: require-dogfood-evidence\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*(npm publish\\b|git( -C \\S+)* tag v)'\n command: harness policy intercept\n blocking: hard\n budget_ms: 2000\n\n - name: require-preflight-evidence\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*git( -C \\S+)* (status|log|diff|branch)\\b'\n command: harness policy intercept\n blocking: hard\n budget_ms: 1000\n\n - name: require-review-subagent-evidence\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_create\"\n command: harness policy intercept\n blocking: hard\n budget_ms: 2000\n\n - name: require-preflight-push-evidence\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*git( -C \\S+)* push\\b'\n command: harness policy intercept\n blocking: hard\n budget_ms: 1000\n\npolicies:\n - name: review-before-merge\n description: Block PR merges unless a ledger entry tagged review:<pr-number> exists for this session.\n trigger:\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_merge\"\n extract:\n PR_NUMBER: \"toolArgs.prNumber\"\n requires:\n ledger_tag: \"review:${PR_NUMBER}\"\n hook: require-review-evidence\n enforcement: block\n\n - name: dogfood-before-release\n description: Block npm publish / git tag v* without a recent dogfood ledger entry.\n trigger:\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*(npm publish\\b|git( -C \\S+)* tag v)'\n requires:\n ledger_tag: \"dogfood:${SESSION_ID}\"\n within: 24h\n hook: require-dogfood-evidence\n enforcement: block\n\n - name: two-reviewers-required\n description: At least two distinct reviewer ledger entries must exist for the PR.\n trigger:\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_merge\"\n extract:\n PR_NUMBER: \"toolArgs.prNumber\"\n requires:\n ledger_tag: \"review:${PR_NUMBER}\"\n count:\n min: 2\n hook: require-review-evidence\n enforcement: warn\n\n - name: preflight-before-investigation\n description: Block investigative git reads (status/log/diff/branch) when agent-preflight has not run recently with ready:true for the current repo.\n trigger:\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*git( -C \\S+)* (status|log|diff|branch)\\b'\n requires:\n ledger_tag: \"preflight:${REPO}\"\n within: 1h\n hook: require-preflight-evidence\n enforcement: block\n\n - name: review-subagent-before-pr-create\n description: Block agent-tasks PR creation unless a review-subagent ledger entry tagged for this task already exists. Forces the rigorous review BEFORE the PR opens, not after.\n trigger:\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_create\"\n extract:\n TASK_ID: \"toolArgs.taskId\"\n requires:\n ledger_tag: \"review-subagent:${TASK_ID}\"\n hook: require-review-subagent-evidence\n enforcement: block\n\n - name: preflight-before-push\n description: Block git push unless a fresh preflight ledger entry exists for the current branch. Catches the stale-checkout class of incident at the last reversible step.\n trigger:\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*git( -C \\S+)* push\\b'\n requires:\n ledger_tag: \"preflight:${BRANCH}\"\n within: 10m\n hook: require-preflight-push-evidence\n enforcement: block\n\n# Full inherits the Solo/Team understanding-gate stack: the Stop hook\n# persists each Understanding Report and the PreToolUse pre-tool-use\n# blocker refuses Edit/Write/Bash until the report is approved. Drop\n# this block if you want the reference policies above without the\n# baseline gate.\npolicy_packs:\n - name: understanding-before-execution\n source: builtin\n enabled: true\n description: Force agents to expose their task interpretation and wait for explicit human approval before any write-capable tool fires.\n config:\n mode: grill_me\n";
|
|
2
|
+
export declare const FULL_TEMPLATE = "# ~/.claude/harness.yaml\n#\n# Bootstrapped by `harness init --template full`. The reference manifest:\n# every example policy from docs/examples/full-manifest.yaml wired through\n# the generic `harness policy intercept` engine, so no external shell\n# scripts under ~/.claude/hooks/ are required.\n#\n# Canonical source for the policy + policy_packs sections is\n# docs/examples/full-manifest.yaml. A parity vitest\n# (tests/cli/init-full-template-parity.test.ts) fails the build if the\n# two diverge on policy names or load-bearing fields.\n#\n# What you still need on PATH (the wizard offers to `npm i -g` these on\n# init): agent-tasks-mcp-bridge, grounding-mcp, memory-router-*,\n# understanding-gate-claude-*.\n\nversion: 1\n\ngrounding:\n session:\n auto_start: true\n id_format: \"gs-{repo}-{rand:8}\"\n evidence_ledger:\n path: ~/.evidence-ledger/ledger.db\n retention_days: 90\n policies_source: ~/.claude/harness.d/policies/claim-gate.yaml\n\ntools:\n mcp:\n # codebase-oracle (the Pandora RAG MCP server) is intentionally NOT\n # in the Full default. It is published as\n # `@lannguyensi/codebase-oracle` and works fine standalone, but it\n # is an opinionated workflow add-on (multi-repo semantic search)\n # rather than infrastructure harness itself assumes. Operators who\n # want it wire it explicitly:\n # npm i -g @lannguyensi/codebase-oracle\n # harness add mcp codebase-oracle --command codebase-oracle,mcp\n # Set ORACLE_SCAN_ROOT (absolute path; tilde is not expanded by the\n # MCP env block) and OPENAI_API_KEY (or switch providers via\n # ORACLE_LLM_PROVIDER) before the first call.\n - name: agent-tasks\n # Zero-setup entry: `@agent-tasks/mcp-bridge` exposes the\n # `agent-tasks-mcp-bridge` binary on PATH. The bridge owns token\n # storage and defaults to the hosted backend; override with\n # `AGENT_TASKS_BASE_URL` / `AGENT_TASKS_TOKEN` for self-hosted.\n # `min_version` floor: 0.6.0 added the `--version` short-circuit\n # the doctor probe needs (PR agent-tasks/240, release-cut PR 241).\n # Bump the floor whenever a fix you depend on lands; loose floors\n # are fine, the point is the drift signal not pinning a specific cut.\n command: [agent-tasks-mcp-bridge]\n min_version: \"0.6.0\"\n health:\n verb: projects_list\n timeout_ms: 5000\n enabled: true\n - name: grounding-mcp\n # Published bin from `@lannguyensi/grounding-mcp`. No env is set:\n # the bundled default resolves to `~/.evidence-ledger/ledger.db`\n # via os.homedir() at startup. Passing a literal tilde in env\n # bypasses shell expansion and creates rogue cwd-relative DB files\n # (see agent-tasks/42d224a6 incident). `min_version` floor: 0.2.0\n # added the `--version` short-circuit the doctor probe needs (PR\n # agent-grounding/76, release-cut PR 77).\n command: [grounding-mcp]\n min_version: \"0.2.0\"\n health:\n verb: ledger_status\n timeout_ms: 5000\n enabled: true\n\n cli:\n - name: gh\n binary: gh\n required: true\n\n skills:\n enabled:\n - simplify\n - init\n - review\n - security-review\n source_dirs:\n - ~/.claude/skills\n\n builtin:\n known: [Read, Edit, Write, Bash, Agent, Skill, TaskCreate, Glob, Grep]\n\nmemory:\n directories:\n - path: ~/.claude/projects/{project}/memory\n scope: project\n router:\n # Published bin from `@lannguyensi/memory-router`.\n # `min_version` floor: 0.3.0 added the `--version` short-circuit\n # the doctor probe needs (PR agent-memory/40, release-cut PR 41).\n command: [memory-router-user-prompt-submit]\n min_version: \"0.3.0\"\n enabled: true\n retention:\n staleness_days: 180\n broken_refs: warn\n scopes:\n default: project\n allowed: [project, user]\n\n# All PreToolUse hooks share the generic `harness policy intercept` CLI\n# entrypoint. The engine reads the tool event on stdin, evaluates whichever\n# policy below has a matching trigger (`match` + optional `bash_match`),\n# and emits Claude Code's deny envelope when the required ledger tag is\n# absent. No external shell scripts are required.\n#\n# The `git-preflight` SessionStart hook is the producer side of the\n# `preflight-before-*` policies: `harness session-start preflight` runs\n# agent-preflight against the session cwd and, on a ready:true result,\n# records `preflight:${REPO}` to the evidence ledger. It needs the\n# `preflight` binary on PATH (`npm i -g @lannguyensi/agent-preflight`); when\n# that is absent the hook logs to stderr and exits 0, so the session is\n# never broken \u2014 the preflight gates just stay closed until a tag is\n# produced some other way.\nhooks:\n - name: git-preflight\n event: SessionStart\n command: harness session-start preflight\n blocking: false\n budget_ms: 30000\n\n - name: require-review-evidence\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_merge\"\n command: harness policy intercept\n blocking: hard\n budget_ms: 2000\n\n - name: require-dogfood-evidence\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*(npm publish\\b|git( -C \\S+)* tag v)'\n command: harness policy intercept\n blocking: hard\n budget_ms: 2000\n\n - name: require-preflight-evidence\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*git( -C \\S+)* (status|log|diff|branch)\\b'\n command: harness policy intercept\n blocking: hard\n budget_ms: 1000\n\n - name: require-review-subagent-evidence\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_create\"\n command: harness policy intercept\n blocking: hard\n budget_ms: 2000\n\n - name: require-preflight-push-evidence\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*git( -C \\S+)* push\\b'\n command: harness policy intercept\n blocking: hard\n budget_ms: 1000\n\npolicies:\n - name: review-before-merge\n description: Block PR merges unless a ledger entry tagged review:<pr-number> exists for this session.\n trigger:\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_merge\"\n extract:\n PR_NUMBER: \"toolArgs.prNumber\"\n requires:\n ledger_tag: \"review:${PR_NUMBER}\"\n hook: require-review-evidence\n enforcement: block\n producers:\n - kind: mcp\n verb: mcp__agent-grounding__ledger_add\n example: '{type:\"fact\", content:\"review:${PR_NUMBER} \u2014 <verdict + key findings + nits>\", source:\"Agent(general-purpose) review\"}'\n description: Spawn a review subagent against the PR diff, capture its verdict, then persist a ledger entry tagged with the PR number. The content should be self-contained enough for an auditor to read without re-opening the chat.\n\n - name: dogfood-before-release\n description: Block npm publish / git tag v* without a recent dogfood ledger entry.\n trigger:\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*(npm publish\\b|git( -C \\S+)* tag v)'\n requires:\n ledger_tag: \"dogfood:${SESSION_ID}\"\n within: 24h\n hook: require-dogfood-evidence\n enforcement: block\n producers:\n - kind: mcp\n verb: mcp__agent-grounding__ledger_add\n example: '{type:\"fact\", content:\"dogfood:${SESSION_ID} \u2014 <end-to-end smoke summary against the live system>\", source:\"manual smoke test\"}'\n description: Before tagging or publishing, run the release path end-to-end against the live system (not just unit tests) and persist the result as a session-tagged ledger entry. Document what you exercised (install, CLI happy path, MCP handshake, etc.) so a future auditor can tell whether the smoke covered the change.\n\n - name: two-reviewers-required\n description: At least two distinct reviewer ledger entries must exist for the PR.\n trigger:\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_merge\"\n extract:\n PR_NUMBER: \"toolArgs.prNumber\"\n requires:\n ledger_tag: \"review:${PR_NUMBER}\"\n count:\n min: 2\n hook: require-review-evidence\n enforcement: warn\n producers:\n - kind: mcp\n verb: mcp__agent-grounding__ledger_add\n example: '{type:\"fact\", content:\"review:${PR_NUMBER} \u2014 <verdict + key findings + nits>\", source:\"Agent(general-purpose) review (reviewer 2)\"}'\n description: Same shape as review-before-merge but TWO DISTINCT reviewer entries must exist before the gate is satisfied (count.min 2). Distinguish reviewers by source so the count is honest. Warn-level enforcement, so the agent CAN merge with one reviewer but should consider spawning a second for load-bearing changes.\n\n - name: preflight-before-investigation\n description: Block investigative git reads (status/log/diff/branch) when agent-preflight has not run recently with ready:true for the current repo.\n trigger:\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*git( -C \\S+)* (status|log|diff|branch)\\b'\n requires:\n ledger_tag: \"preflight:${REPO}\"\n within: 1h\n hook: require-preflight-evidence\n enforcement: block\n producers:\n - kind: bash\n command: harness session-start preflight\n description: Runs agent-preflight against the current cwd; on ready:true, records preflight:${REPO} to the ledger. Standard producer.\n - kind: mcp\n verb: mcp__agent-grounding__ledger_add\n example: '{type:\"fact\", content:\"preflight:${REPO}\", source:\"manual\"}'\n description: Direct ledger write. Use when the Bash hook is locked down (e.g. understanding-gate active) or when the standard producer is unavailable.\n\n - name: review-subagent-before-pr-create\n description: Block agent-tasks PR creation unless a review-subagent ledger entry tagged for this task already exists. Forces the rigorous review BEFORE the PR opens, not after.\n trigger:\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_create\"\n extract:\n TASK_ID: \"toolArgs.taskId\"\n requires:\n ledger_tag: \"review-subagent:${TASK_ID}\"\n hook: require-review-subagent-evidence\n enforcement: block\n producers:\n - kind: mcp\n verb: mcp__agent-grounding__ledger_add\n example: '{type:\"fact\", content:\"review-subagent:${TASK_ID} \u2014 <verdict + key findings + nits>\", source:\"Agent(general-purpose) review\"}'\n description: After running a review subagent against the staged diff, persist its verdict + load-bearing findings as a ledger entry tagged with the task UUID. The content should be self-contained enough to audit later without re-reading the chat.\n\n - name: preflight-before-push\n description: Block git push unless a fresh preflight ledger entry exists for the current branch. Catches the stale-checkout class of incident at the last reversible step.\n trigger:\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*git( -C \\S+)* push\\b'\n requires:\n ledger_tag: \"preflight:${BRANCH}\"\n within: 10m\n hook: require-preflight-push-evidence\n enforcement: block\n producers:\n - kind: bash\n command: harness session-start preflight\n description: Runs agent-preflight against the current cwd; on ready:true, records preflight:${BRANCH} to the ledger. Standard producer.\n - kind: mcp\n verb: mcp__agent-grounding__ledger_add\n example: '{type:\"fact\", content:\"preflight:${BRANCH} \u2014 <summary of what is on the branch + smoke results>\", source:\"manual\"}'\n description: Direct ledger write. The branch is the WIP review surface; the content should summarise what is staged + the smoke evidence so a reviewer can audit later without re-reading the chat.\n\n# Full inherits the Solo/Team understanding-gate stack: the Stop hook\n# persists each Understanding Report and the PreToolUse pre-tool-use\n# blocker refuses Edit/Write/Bash until the report is approved. Drop\n# this block if you want the reference policies above without the\n# baseline gate.\npolicy_packs:\n - name: understanding-before-execution\n source: builtin\n enabled: true\n description: Force agents to expose their task interpretation and wait for explicit human approval before any write-capable tool fires.\n config:\n mode: grill_me\n # Producers (agent-tasks/25bced52): rendered into the gate's deny\n # envelope by the same engine as policy producers. Constraint at\n # this layer: at-least-one `ask`. Post-v0.14.0 the gate signal\n # is a filesystem marker and the mcp ledger_add path no longer\n # satisfies the gate; the canonical unblock surface is the\n # operator-approval prompt.\n producers:\n - kind: ask\n command: harness approve understanding\n description: \"Bare command, no pipes or chaining. The hook recognises it via isEscapeCommand and emits permissionDecision:ask; the operator's go on that prompt IS the gate approval. Golden path.\"\n - kind: bash\n command: harness approve understanding\n description: Same command from any un-hooked terminal (operator only, not reachable from inside the gated session). Writes the canonical marker at harness.generated/.approvals/${SESSION_ID}.\n";
|
|
3
3
|
export type TemplateName = "minimal" | "full" | "solo" | "team";
|
|
4
4
|
export declare function getTemplate(name: TemplateName): string;
|
|
@@ -34,8 +34,7 @@ export const FULL_TEMPLATE = `# ~/.claude/harness.yaml
|
|
|
34
34
|
#
|
|
35
35
|
# What you still need on PATH (the wizard offers to \`npm i -g\` these on
|
|
36
36
|
# init): agent-tasks-mcp-bridge, grounding-mcp, memory-router-*,
|
|
37
|
-
# understanding-gate-claude-*.
|
|
38
|
-
# MCP server (see comment under tools.mcp below).
|
|
37
|
+
# understanding-gate-claude-*.
|
|
39
38
|
|
|
40
39
|
version: 1
|
|
41
40
|
|
|
@@ -51,13 +50,16 @@ grounding:
|
|
|
51
50
|
tools:
|
|
52
51
|
mcp:
|
|
53
52
|
# codebase-oracle (the Pandora RAG MCP server) is intentionally NOT
|
|
54
|
-
# in
|
|
55
|
-
#
|
|
56
|
-
#
|
|
57
|
-
#
|
|
58
|
-
#
|
|
59
|
-
#
|
|
60
|
-
#
|
|
53
|
+
# in the Full default. It is published as
|
|
54
|
+
# \`@lannguyensi/codebase-oracle\` and works fine standalone, but it
|
|
55
|
+
# is an opinionated workflow add-on (multi-repo semantic search)
|
|
56
|
+
# rather than infrastructure harness itself assumes. Operators who
|
|
57
|
+
# want it wire it explicitly:
|
|
58
|
+
# npm i -g @lannguyensi/codebase-oracle
|
|
59
|
+
# harness add mcp codebase-oracle --command codebase-oracle,mcp
|
|
60
|
+
# Set ORACLE_SCAN_ROOT (absolute path; tilde is not expanded by the
|
|
61
|
+
# MCP env block) and OPENAI_API_KEY (or switch providers via
|
|
62
|
+
# ORACLE_LLM_PROVIDER) before the first call.
|
|
61
63
|
- name: agent-tasks
|
|
62
64
|
# Zero-setup entry: \`@agent-tasks/mcp-bridge\` exposes the
|
|
63
65
|
# \`agent-tasks-mcp-bridge\` binary on PATH. The bridge owns token
|
|
@@ -194,6 +196,11 @@ policies:
|
|
|
194
196
|
ledger_tag: "review:\${PR_NUMBER}"
|
|
195
197
|
hook: require-review-evidence
|
|
196
198
|
enforcement: block
|
|
199
|
+
producers:
|
|
200
|
+
- kind: mcp
|
|
201
|
+
verb: mcp__agent-grounding__ledger_add
|
|
202
|
+
example: '{type:"fact", content:"review:\${PR_NUMBER} — <verdict + key findings + nits>", source:"Agent(general-purpose) review"}'
|
|
203
|
+
description: Spawn a review subagent against the PR diff, capture its verdict, then persist a ledger entry tagged with the PR number. The content should be self-contained enough for an auditor to read without re-opening the chat.
|
|
197
204
|
|
|
198
205
|
- name: dogfood-before-release
|
|
199
206
|
description: Block npm publish / git tag v* without a recent dogfood ledger entry.
|
|
@@ -206,6 +213,11 @@ policies:
|
|
|
206
213
|
within: 24h
|
|
207
214
|
hook: require-dogfood-evidence
|
|
208
215
|
enforcement: block
|
|
216
|
+
producers:
|
|
217
|
+
- kind: mcp
|
|
218
|
+
verb: mcp__agent-grounding__ledger_add
|
|
219
|
+
example: '{type:"fact", content:"dogfood:\${SESSION_ID} — <end-to-end smoke summary against the live system>", source:"manual smoke test"}'
|
|
220
|
+
description: Before tagging or publishing, run the release path end-to-end against the live system (not just unit tests) and persist the result as a session-tagged ledger entry. Document what you exercised (install, CLI happy path, MCP handshake, etc.) so a future auditor can tell whether the smoke covered the change.
|
|
209
221
|
|
|
210
222
|
- name: two-reviewers-required
|
|
211
223
|
description: At least two distinct reviewer ledger entries must exist for the PR.
|
|
@@ -220,6 +232,11 @@ policies:
|
|
|
220
232
|
min: 2
|
|
221
233
|
hook: require-review-evidence
|
|
222
234
|
enforcement: warn
|
|
235
|
+
producers:
|
|
236
|
+
- kind: mcp
|
|
237
|
+
verb: mcp__agent-grounding__ledger_add
|
|
238
|
+
example: '{type:"fact", content:"review:\${PR_NUMBER} — <verdict + key findings + nits>", source:"Agent(general-purpose) review (reviewer 2)"}'
|
|
239
|
+
description: Same shape as review-before-merge but TWO DISTINCT reviewer entries must exist before the gate is satisfied (count.min 2). Distinguish reviewers by source so the count is honest. Warn-level enforcement, so the agent CAN merge with one reviewer but should consider spawning a second for load-bearing changes.
|
|
223
240
|
|
|
224
241
|
- name: preflight-before-investigation
|
|
225
242
|
description: Block investigative git reads (status/log/diff/branch) when agent-preflight has not run recently with ready:true for the current repo.
|
|
@@ -232,6 +249,14 @@ policies:
|
|
|
232
249
|
within: 1h
|
|
233
250
|
hook: require-preflight-evidence
|
|
234
251
|
enforcement: block
|
|
252
|
+
producers:
|
|
253
|
+
- kind: bash
|
|
254
|
+
command: harness session-start preflight
|
|
255
|
+
description: Runs agent-preflight against the current cwd; on ready:true, records preflight:\${REPO} to the ledger. Standard producer.
|
|
256
|
+
- kind: mcp
|
|
257
|
+
verb: mcp__agent-grounding__ledger_add
|
|
258
|
+
example: '{type:"fact", content:"preflight:\${REPO}", source:"manual"}'
|
|
259
|
+
description: Direct ledger write. Use when the Bash hook is locked down (e.g. understanding-gate active) or when the standard producer is unavailable.
|
|
235
260
|
|
|
236
261
|
- name: review-subagent-before-pr-create
|
|
237
262
|
description: Block agent-tasks PR creation unless a review-subagent ledger entry tagged for this task already exists. Forces the rigorous review BEFORE the PR opens, not after.
|
|
@@ -244,6 +269,11 @@ policies:
|
|
|
244
269
|
ledger_tag: "review-subagent:\${TASK_ID}"
|
|
245
270
|
hook: require-review-subagent-evidence
|
|
246
271
|
enforcement: block
|
|
272
|
+
producers:
|
|
273
|
+
- kind: mcp
|
|
274
|
+
verb: mcp__agent-grounding__ledger_add
|
|
275
|
+
example: '{type:"fact", content:"review-subagent:\${TASK_ID} — <verdict + key findings + nits>", source:"Agent(general-purpose) review"}'
|
|
276
|
+
description: After running a review subagent against the staged diff, persist its verdict + load-bearing findings as a ledger entry tagged with the task UUID. The content should be self-contained enough to audit later without re-reading the chat.
|
|
247
277
|
|
|
248
278
|
- name: preflight-before-push
|
|
249
279
|
description: Block git push unless a fresh preflight ledger entry exists for the current branch. Catches the stale-checkout class of incident at the last reversible step.
|
|
@@ -256,6 +286,14 @@ policies:
|
|
|
256
286
|
within: 10m
|
|
257
287
|
hook: require-preflight-push-evidence
|
|
258
288
|
enforcement: block
|
|
289
|
+
producers:
|
|
290
|
+
- kind: bash
|
|
291
|
+
command: harness session-start preflight
|
|
292
|
+
description: Runs agent-preflight against the current cwd; on ready:true, records preflight:\${BRANCH} to the ledger. Standard producer.
|
|
293
|
+
- kind: mcp
|
|
294
|
+
verb: mcp__agent-grounding__ledger_add
|
|
295
|
+
example: '{type:"fact", content:"preflight:\${BRANCH} — <summary of what is on the branch + smoke results>", source:"manual"}'
|
|
296
|
+
description: Direct ledger write. The branch is the WIP review surface; the content should summarise what is staged + the smoke evidence so a reviewer can audit later without re-reading the chat.
|
|
259
297
|
|
|
260
298
|
# Full inherits the Solo/Team understanding-gate stack: the Stop hook
|
|
261
299
|
# persists each Understanding Report and the PreToolUse pre-tool-use
|
|
@@ -269,6 +307,19 @@ policy_packs:
|
|
|
269
307
|
description: Force agents to expose their task interpretation and wait for explicit human approval before any write-capable tool fires.
|
|
270
308
|
config:
|
|
271
309
|
mode: grill_me
|
|
310
|
+
# Producers (agent-tasks/25bced52): rendered into the gate's deny
|
|
311
|
+
# envelope by the same engine as policy producers. Constraint at
|
|
312
|
+
# this layer: at-least-one \`ask\`. Post-v0.14.0 the gate signal
|
|
313
|
+
# is a filesystem marker and the mcp ledger_add path no longer
|
|
314
|
+
# satisfies the gate; the canonical unblock surface is the
|
|
315
|
+
# operator-approval prompt.
|
|
316
|
+
producers:
|
|
317
|
+
- kind: ask
|
|
318
|
+
command: harness approve understanding
|
|
319
|
+
description: "Bare command, no pipes or chaining. The hook recognises it via isEscapeCommand and emits permissionDecision:ask; the operator's go on that prompt IS the gate approval. Golden path."
|
|
320
|
+
- kind: bash
|
|
321
|
+
command: harness approve understanding
|
|
322
|
+
description: Same command from any un-hooked terminal (operator only, not reachable from inside the gated session). Writes the canonical marker at harness.generated/.approvals/\${SESSION_ID}.
|
|
272
323
|
`;
|
|
273
324
|
import { SOLO_TEMPLATE, TEAM_TEMPLATE } from "./profiles.js";
|
|
274
325
|
export function getTemplate(name) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/cli/init/templates.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;CAqB/B,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/cli/init/templates.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;CAqB/B,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4S5B,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAI7D,MAAM,UAAU,WAAW,CAAC,IAAkB;IAC5C,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,MAAM;YACT,OAAO,aAAa,CAAC;QACvB,KAAK,MAAM;YACT,OAAO,aAAa,CAAC;QACvB,KAAK,MAAM;YACT,OAAO,aAAa,CAAC;QACvB,KAAK,SAAS;YACZ,OAAO,gBAAgB,CAAC;IAC5B,CAAC;AACH,CAAC"}
|
|
@@ -7,6 +7,8 @@ export interface PackHookCodexPreToolUseOptions extends LoaderOptions {
|
|
|
7
7
|
pack?: string;
|
|
8
8
|
/** Override report directory (test injection). */
|
|
9
9
|
reportsDir?: string;
|
|
10
|
+
/** Override harness.generated/ directory (test injection). */
|
|
11
|
+
generatedDir?: string;
|
|
10
12
|
/** Override timeout per ledger call. */
|
|
11
13
|
ledgerTimeoutMs?: number;
|
|
12
14
|
/** Defaults to process.stdin. */
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
// stderr). The package's optional standalone blocker remains a safety
|
|
21
21
|
// net for solo users; the harness blocker is strictly more powerful.
|
|
22
22
|
import { queryLedgerByTag } from "../../policies/index.js";
|
|
23
|
-
import { checkPersistedReport, defaultReportsDir, matchLedgerEntries, } from "../../policy-packs/builtin/understanding-before-execution-runtime.js";
|
|
23
|
+
import { checkApprovalMarker, checkPersistedReport, defaultReportsDir, matchLedgerEntries, } from "../../policy-packs/builtin/understanding-before-execution-runtime.js";
|
|
24
|
+
import { resolveGeneratedDir } from "../../runtime/pending-approval.js";
|
|
24
25
|
import { loadManifest } from "../loader.js";
|
|
25
26
|
const PACK_NAME = "understanding-before-execution";
|
|
26
27
|
const EXIT_BLOCK = 2;
|
|
@@ -105,8 +106,16 @@ export async function runPackHookCodexPreToolUseCli(opts = {}) {
|
|
|
105
106
|
// Load manifest (or use injection). Bail to allow on any failure so a
|
|
106
107
|
// missing harness install never bricks the session.
|
|
107
108
|
let manifest;
|
|
109
|
+
let manifestPath;
|
|
108
110
|
try {
|
|
109
|
-
|
|
111
|
+
if (opts.manifest) {
|
|
112
|
+
manifest = opts.manifest;
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
const loaded = loadManifest(opts);
|
|
116
|
+
manifest = loaded.manifest;
|
|
117
|
+
manifestPath = loaded.resolved.base;
|
|
118
|
+
}
|
|
110
119
|
}
|
|
111
120
|
catch (err) {
|
|
112
121
|
return allowResult(`manifest load failed (${err.message})`, "none", stderr);
|
|
@@ -122,10 +131,23 @@ export async function runPackHookCodexPreToolUseCli(opts = {}) {
|
|
|
122
131
|
if (sessionId === "") {
|
|
123
132
|
return allowResult("no session_id resolvable from input or $CODEX_SESSION_ID/$CLAUDE_SESSION_ID", "none", stderr);
|
|
124
133
|
}
|
|
125
|
-
//
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
134
|
+
// Resolve generatedDir up-front for the marker check.
|
|
135
|
+
const generatedDir = opts.generatedDir ??
|
|
136
|
+
(manifestPath !== undefined
|
|
137
|
+
? resolveGeneratedDir({
|
|
138
|
+
...(opts.homeDir !== undefined ? { homeDir: opts.homeDir } : {}),
|
|
139
|
+
manifestPath,
|
|
140
|
+
})
|
|
141
|
+
: undefined);
|
|
142
|
+
// Source 1: filesystem marker (agent-tasks/88ca4bb3). Same boundary
|
|
143
|
+
// as the Claude blocker: operator-authored marker beats ledger
|
|
144
|
+
// self-approval. Falls through to ledger-as-audit when generatedDir
|
|
145
|
+
// is unresolvable (test injection without a manifest path).
|
|
146
|
+
if (generatedDir !== undefined) {
|
|
147
|
+
const marker = checkApprovalMarker(generatedDir, sessionId);
|
|
148
|
+
if (marker.matched) {
|
|
149
|
+
return allowResult(marker.detail, "marker", stderr);
|
|
150
|
+
}
|
|
129
151
|
}
|
|
130
152
|
// Source 2: persisted report.
|
|
131
153
|
const reportsDir = opts.reportsDir ?? defaultReportsDir();
|
|
@@ -133,9 +155,13 @@ export async function runPackHookCodexPreToolUseCli(opts = {}) {
|
|
|
133
155
|
if (report.approved) {
|
|
134
156
|
return allowResult(report.detail, "persisted-report", stderr);
|
|
135
157
|
}
|
|
136
|
-
//
|
|
137
|
-
|
|
138
|
-
|
|
158
|
+
// Audit-only ledger probe.
|
|
159
|
+
const ledger = await checkLedger(manifest, sessionId, opts);
|
|
160
|
+
// Neither operator source approved. Codex blocks via non-zero exit
|
|
161
|
+
// + stderr reason; there is no JSON-decision wire to write to stdout.
|
|
162
|
+
const reason = generatedDir !== undefined
|
|
163
|
+
? `no approval marker for session ${sessionId}; ${report.detail}; ${ledger.detail}`
|
|
164
|
+
: `generatedDir not resolvable (test/injection path); ${report.detail}; ${ledger.detail}`;
|
|
139
165
|
const diagnostic = `harness pack hook codex: BLOCK: ${reason}. Tool: ${toolName}. ` +
|
|
140
166
|
"Run `harness approve understanding` once you have produced and confirmed an Understanding Report.";
|
|
141
167
|
stderr.write(`${diagnostic}\n`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook-codex-pre-tool-use.js","sourceRoot":"","sources":["../../../src/cli/pack/hook-codex-pre-tool-use.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,qEAAqE;AACrE,wEAAwE;AACxE,4BAA4B;AAC5B,EAAE;AACF,+DAA+D;AAC/D,wEAAwE;AACxE,+DAA+D;AAC/D,0CAA0C;AAC1C,mEAAmE;AACnE,sCAAsC;AACtC,qEAAqE;AACrE,oEAAoE;AACpE,sEAAsE;AACtE,0DAA0D;AAC1D,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,sEAAsE;AACtE,qEAAqE;AAErE,OAAO,EAAE,gBAAgB,EAAoB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,GAEnB,MAAM,sEAAsE,CAAC;
|
|
1
|
+
{"version":3,"file":"hook-codex-pre-tool-use.js","sourceRoot":"","sources":["../../../src/cli/pack/hook-codex-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AM,MAAM,GAAG,MAAM,WAAW,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAE5D,mEAAmE;IACnE,sEAAsE;IACtE,MAAM,MAAM,GAAG,YAAY,KAAK,SAAS;QACvC,CAAC,CAAC,kCAAkC,SAAS,KAAK,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE;QACnF,CAAC,CAAC,sDAAsD,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;IAC5F,MAAM,UAAU,GACd,mCAAmC,MAAM,WAAW,QAAQ,IAAI;QAChE,mGAAmG,CAAC;IACtG,MAAM,CAAC,KAAK,CAAC,GAAG,UAAU,IAAI,CAAC,CAAC;IAChC,OAAO;QACL,QAAQ,EAAE,UAAU;QACpB,OAAO,EAAE,IAAI;QACb,aAAa,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;QAClE,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type LedgerEntry } from "../../policies/index.js";
|
|
2
2
|
import { type ApprovalCheckResult } from "../../policy-packs/builtin/understanding-before-execution-runtime.js";
|
|
3
|
-
import type
|
|
3
|
+
import { type Manifest } from "../../schema/index.js";
|
|
4
4
|
import { type LoaderOptions } from "../loader.js";
|
|
5
5
|
export interface PackHookPreToolUseOptions extends LoaderOptions {
|
|
6
6
|
/** Pack name to evaluate. Defaults to understanding-before-execution. */
|
|
@@ -21,8 +21,11 @@
|
|
|
21
21
|
// secondary safety net for solo users, and `harness explain --trace`
|
|
22
22
|
// (Phase 4 #6) surfaces the runtime audit trail when configured.
|
|
23
23
|
import { queryLedgerByTag, } from "../../policies/index.js";
|
|
24
|
-
import {
|
|
24
|
+
import { renderProducers } from "../../policies/producers.js";
|
|
25
|
+
import { checkApprovalMarker, checkPersistedReport, defaultReportsDir, matchLedgerEntries, } from "../../policy-packs/builtin/understanding-before-execution-runtime.js";
|
|
25
26
|
import { resolveGeneratedDir, writePendingApproval, } from "../../runtime/pending-approval.js";
|
|
27
|
+
import { ProducerSchema, } from "../../schema/index.js";
|
|
28
|
+
import { z } from "zod";
|
|
26
29
|
import { loadManifest } from "../loader.js";
|
|
27
30
|
const PACK_NAME = "understanding-before-execution";
|
|
28
31
|
async function readStdin(stream) {
|
|
@@ -46,8 +49,38 @@ function findGroundingMcp(manifest) {
|
|
|
46
49
|
// PreToolUse (the pack contributes only a PreToolUse hook), so the
|
|
47
50
|
// envelope is unconditional here — no event-kind branch like
|
|
48
51
|
// runtime/intercept.ts needs.
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
// Producers list from the pack's config (agent-tasks/25bced52). Same
|
|
53
|
+
// shape as the policy engine's `producers:` field, surfaced through the
|
|
54
|
+
// understanding-gate's separate deny path. The constraint differs from
|
|
55
|
+
// the policy engine: here we require at-least-one `ask` (the canonical
|
|
56
|
+
// unblock surface) rather than at-least-one `mcp`, because post-v0.14.0
|
|
57
|
+
// the gate signal is a filesystem marker and the mcp ledger_add path no
|
|
58
|
+
// longer satisfies the gate. Only the operator-approval (`ask`) or a
|
|
59
|
+
// shell from an un-hooked terminal can write the marker.
|
|
60
|
+
const ProducersConfigSchema = z
|
|
61
|
+
.array(ProducerSchema)
|
|
62
|
+
.min(1)
|
|
63
|
+
.refine((arr) => arr.some((p) => p.kind === "ask"), "understanding-gate config.producers must include at least one kind:ask entry (the canonical unblock surface)");
|
|
64
|
+
function parseConfigProducers(raw, stderr) {
|
|
65
|
+
if (raw === undefined)
|
|
66
|
+
return undefined;
|
|
67
|
+
const result = ProducersConfigSchema.safeParse(raw);
|
|
68
|
+
if (!result.success) {
|
|
69
|
+
stderr.write(`harness pack hook: config.producers ignored (${result.error.issues
|
|
70
|
+
.map((i) => `${i.path.join(".") || "<root>"}: ${i.message}`)
|
|
71
|
+
.join("; ")})\n`);
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
return result.data;
|
|
75
|
+
}
|
|
76
|
+
function blockJson(toolName, reason, producers, sessionId) {
|
|
77
|
+
// Legacy suffix kept unchanged so existing operators / docs that quote
|
|
78
|
+
// the old surface still find the recognizable string. The producers
|
|
79
|
+
// block (when configured) appends AFTER, so a reader's eye lands on
|
|
80
|
+
// the structured recipe last.
|
|
81
|
+
const suffix = `Run \`harness approve understanding\` once you have produced and confirmed an Understanding Report.`;
|
|
82
|
+
const producersBlock = renderProducers(producers, { SESSION_ID: sessionId });
|
|
83
|
+
const reasonText = `Understanding Gate: ${reason}. Tool: ${toolName}. ${suffix}${producersBlock}`;
|
|
51
84
|
return JSON.stringify({
|
|
52
85
|
decision: "block",
|
|
53
86
|
reason: reasonText,
|
|
@@ -202,19 +235,39 @@ export async function runPackHookPreToolUseCli(opts = {}) {
|
|
|
202
235
|
diagnostic,
|
|
203
236
|
};
|
|
204
237
|
}
|
|
205
|
-
//
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
238
|
+
// Resolve generatedDir up-front: marker check and pending-approval
|
|
239
|
+
// staging both depend on it.
|
|
240
|
+
const generatedDir = opts.generatedDir ??
|
|
241
|
+
(manifestPath !== undefined
|
|
242
|
+
? resolveGeneratedDir({
|
|
243
|
+
...(opts.homeDir !== undefined ? { homeDir: opts.homeDir } : {}),
|
|
244
|
+
manifestPath,
|
|
245
|
+
})
|
|
246
|
+
: undefined);
|
|
247
|
+
// Source 1: filesystem marker (agent-tasks/88ca4bb3). Canonical for
|
|
248
|
+
// harnessed sessions. The ledger check is no longer authoritative
|
|
249
|
+
// because the agent has direct MCP access to the same ledger and
|
|
250
|
+
// could self-approve; the marker file lives in harness.generated/
|
|
251
|
+
// which Edit / Write / Bash are all gated from writing to. Bail to
|
|
252
|
+
// ledger-as-audit only when generatedDir is unresolvable (injected
|
|
253
|
+
// manifest without a resolved path: only happens in tests).
|
|
254
|
+
if (generatedDir !== undefined) {
|
|
255
|
+
const marker = checkApprovalMarker(generatedDir, sessionId);
|
|
256
|
+
if (marker.matched) {
|
|
257
|
+
const diagnostic = `harness pack hook: ${marker.detail}, allowing.`;
|
|
258
|
+
stderr.write(`${diagnostic}\n`);
|
|
259
|
+
return {
|
|
260
|
+
exitCode: 0,
|
|
261
|
+
blocked: false,
|
|
262
|
+
approvalCheck: { approved: true, source: "marker", detail: marker.detail },
|
|
263
|
+
diagnostic,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
216
266
|
}
|
|
217
|
-
// Source 2: persisted report.
|
|
267
|
+
// Source 2: persisted report. Operator-authored (the agent's Stop
|
|
268
|
+
// hook only writes `pending`; flipping to `approved` requires the
|
|
269
|
+
// operator-side rewrite path in `harness approve understanding`),
|
|
270
|
+
// and the agent has no Edit / Write / Bash path to forge it.
|
|
218
271
|
const reportsDir = opts.reportsDir ?? defaultReportsDir();
|
|
219
272
|
const report = checkPersistedReport(reportsDir, sessionId);
|
|
220
273
|
if (report.approved) {
|
|
@@ -227,20 +280,21 @@ export async function runPackHookPreToolUseCli(opts = {}) {
|
|
|
227
280
|
diagnostic,
|
|
228
281
|
};
|
|
229
282
|
}
|
|
230
|
-
//
|
|
231
|
-
|
|
283
|
+
// Audit-only ledger probe: the ledger row is still recorded by
|
|
284
|
+
// `harness approve understanding`, and we surface its presence in
|
|
285
|
+
// the diagnostic so an operator chasing a flapping gate can see the
|
|
286
|
+
// historic trail. The result intentionally does NOT influence the
|
|
287
|
+
// allow/block decision.
|
|
288
|
+
const ledger = await checkLedger(manifest, sessionId, opts);
|
|
289
|
+
// Neither operator source approved.
|
|
290
|
+
const reason = generatedDir !== undefined
|
|
291
|
+
? `no approval marker for session ${sessionId}; ${report.detail}; ${ledger.detail}`
|
|
292
|
+
: `generatedDir not resolvable (test/injection path); ${report.detail}; ${ledger.detail}`;
|
|
232
293
|
// Stage the session id so `harness approve`, run from the operator's
|
|
233
294
|
// shell where $CLAUDE_SESSION_ID is unset, can resolve it without
|
|
234
295
|
// guessing from transcript filenames. Covers both the ask and the
|
|
235
296
|
// block branches below. Best-effort: a staging-write failure must not
|
|
236
297
|
// escalate a gate block into a hook error.
|
|
237
|
-
const generatedDir = opts.generatedDir ??
|
|
238
|
-
(manifestPath !== undefined
|
|
239
|
-
? resolveGeneratedDir({
|
|
240
|
-
...(opts.homeDir !== undefined ? { homeDir: opts.homeDir } : {}),
|
|
241
|
-
manifestPath,
|
|
242
|
-
})
|
|
243
|
-
: undefined);
|
|
244
298
|
if (generatedDir !== undefined) {
|
|
245
299
|
try {
|
|
246
300
|
writePendingApproval(generatedDir, sessionId);
|
|
@@ -269,7 +323,8 @@ export async function runPackHookPreToolUseCli(opts = {}) {
|
|
|
269
323
|
}
|
|
270
324
|
const diagnostic = `harness pack hook: BLOCK — ${reason}`;
|
|
271
325
|
stderr.write(`${diagnostic}\n`);
|
|
272
|
-
|
|
326
|
+
const configProducers = parseConfigProducers(declared.config["producers"], stderr);
|
|
327
|
+
stdout.write(`${blockJson(toolName, "no approved Understanding Report for this session", configProducers, sessionId)}\n`);
|
|
273
328
|
return {
|
|
274
329
|
exitCode: 0,
|
|
275
330
|
blocked: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook-pre-tool-use.js","sourceRoot":"","sources":["../../../src/cli/pack/hook-pre-tool-use.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,EAAE;AACF,yDAAyD;AACzD,wEAAwE;AACxE,qEAAqE;AACrE,kEAAkE;AAClE,yEAAyE;AACzE,2CAA2C;AAC3C,EAAE;AACF,kEAAkE;AAClE,sEAAsE;AACtE,oEAAoE;AACpE,sEAAsE;AACtE,sEAAsE;AACtE,sEAAsE;AACtE,EAAE;AACF,iEAAiE;AACjE,wEAAwE;AACxE,qEAAqE;AACrE,oEAAoE;AACpE,qEAAqE;AACrE,iEAAiE;AAEjE,OAAO,EACL,gBAAgB,GAE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AO,EAAE,IAAI;QACb,aAAa,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;QAClE,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { expandHome } from "../../runtime/expand-home.js";
|
|
1
2
|
import type { Manifest } from "../../schema/index.js";
|
|
2
3
|
import type { Diagnostic } from "./types.js";
|
|
3
4
|
export interface CheckOptions {
|
|
@@ -6,7 +7,6 @@ export interface CheckOptions {
|
|
|
6
7
|
builtinRuntimeProbe?: () => string[];
|
|
7
8
|
versionProbe?: (cmd: string[]) => string | null;
|
|
8
9
|
}
|
|
9
|
-
declare function expandHome(p: string, home: string): string;
|
|
10
10
|
declare function isRootedPath(p: string): boolean;
|
|
11
11
|
declare function firstToken(command: string): string;
|
|
12
12
|
declare function resolveOnPath(binary: string, pathEnv: string): string | null;
|
|
@@ -3,6 +3,7 @@ import * as os from "node:os";
|
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import { isBuiltinPackName } from "../../policy-packs/index.js";
|
|
5
5
|
import { parsePackSource } from "../../policy-packs/source.js";
|
|
6
|
+
import { expandHome } from "../../runtime/expand-home.js";
|
|
6
7
|
const DEFAULT_RUNTIME_BUILTINS = [
|
|
7
8
|
"Read",
|
|
8
9
|
"Edit",
|
|
@@ -14,13 +15,6 @@ const DEFAULT_RUNTIME_BUILTINS = [
|
|
|
14
15
|
"Glob",
|
|
15
16
|
"Grep",
|
|
16
17
|
];
|
|
17
|
-
function expandHome(p, home) {
|
|
18
|
-
if (p === "~")
|
|
19
|
-
return home;
|
|
20
|
-
if (p.startsWith("~/"))
|
|
21
|
-
return path.join(home, p.slice(2));
|
|
22
|
-
return p;
|
|
23
|
-
}
|
|
24
18
|
function isRootedPath(p) {
|
|
25
19
|
return path.isAbsolute(p) || p === "~" || p.startsWith("~/");
|
|
26
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checks.js","sourceRoot":"","sources":["../../../src/cli/validate/checks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"checks.js","sourceRoot":"","sources":["../../../src/cli/validate/checks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAW1D,MAAM,wBAAwB,GAAG;IAC/B,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,YAAY;IACZ,MAAM;IACN,MAAM;CACP,CAAC;AAEF,SAAS,YAAY,CAAC,CAAS;IAC7B,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,UAAU,CAAC,OAAe;IACjC,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC9C,CAAC;AAED,SAAS,YAAY,CAAC,QAAgB;IACpC,IAAI,CAAC;QACH,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,SAAS,C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,gBAAgB,CAAC,UAAU;gBACjC,OAAO,EAAE,kBAAkB,IAAI,CAAC,SAAS,CACvC,IAAI,CAAC,MAAM,CACZ,yDAAyD;aAC3D,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QACD,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC;gBACT,QAAQ,EAAE,OAAO;gBACjB,IAAI,EAAE,gBAAgB,CAAC,QAAQ;gBAC/B,OAAO,EAAE,6BAA6B,IAAI,CAAC,SAAS,CAClD,IAAI,CAAC,IAAI,CACV,+CAA+C;aACjD,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,QAAkB,EAClB,OAAqB,EAAE;IAEvB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;IAC1C,OAAO;QACL,GAAG,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;QAC3B,GAAG,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;QAC3B,GAAG,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC;QAC9B,GAAG,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC;QAC7B,GAAG,iBAAiB,CAAC,QAAQ,EAAE,IAAI,CAAC;QACpC,GAAG,uBAAuB,CAAC,QAAQ,CAAC;QACpC,GAAG,gBAAgB,CAAC,QAAQ,CAAC;KAC9B,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,UAAU;IACV,YAAY;IACZ,UAAU;IACV,eAAe;IACf,aAAa;IACb,wBAAwB;CACzB,CAAC"}
|
package/dist/io/harness-lock.js
CHANGED
|
@@ -26,21 +26,13 @@
|
|
|
26
26
|
// to assets the user has explicitly opted out of.
|
|
27
27
|
import * as crypto from "node:crypto";
|
|
28
28
|
import * as fs from "node:fs";
|
|
29
|
-
import * as os from "node:os";
|
|
30
29
|
import * as path from "node:path";
|
|
30
|
+
import { expandHome } from "../runtime/expand-home.js";
|
|
31
31
|
import { atomicWriteFile } from "./atomic-write.js";
|
|
32
32
|
export const LOCK_BASENAME = "harness.lock";
|
|
33
33
|
function sha256Hex(input) {
|
|
34
34
|
return crypto.createHash("sha256").update(input).digest("hex");
|
|
35
35
|
}
|
|
36
|
-
function expandHome(p, homeDir) {
|
|
37
|
-
const home = homeDir ?? os.homedir();
|
|
38
|
-
if (p === "~")
|
|
39
|
-
return home;
|
|
40
|
-
if (p.startsWith("~/"))
|
|
41
|
-
return path.join(home, p.slice(2));
|
|
42
|
-
return p;
|
|
43
|
-
}
|
|
44
36
|
export function computeAssetEntry(absolutePath) {
|
|
45
37
|
const buf = fs.readFileSync(absolutePath);
|
|
46
38
|
return { kind: "asset", path: absolutePath, sha256: sha256Hex(buf) };
|