@lannguyensi/harness 0.18.0 → 0.20.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +82 -208
  3. package/dist/cli/approve/understanding.d.ts +38 -0
  4. package/dist/cli/approve/understanding.js +45 -1
  5. package/dist/cli/approve/understanding.js.map +1 -1
  6. package/dist/cli/doctor/format.js +20 -2
  7. package/dist/cli/doctor/format.js.map +1 -1
  8. package/dist/cli/doctor/index.d.ts +8 -0
  9. package/dist/cli/doctor/index.js +27 -1
  10. package/dist/cli/doctor/index.js.map +1 -1
  11. package/dist/cli/doctor/npm-bin-path.d.ts +23 -0
  12. package/dist/cli/doctor/npm-bin-path.js +82 -0
  13. package/dist/cli/doctor/npm-bin-path.js.map +1 -0
  14. package/dist/cli/doctor/types.d.ts +20 -4
  15. package/dist/cli/doctor/types.js.map +1 -1
  16. package/dist/cli/index.js +32 -0
  17. package/dist/cli/index.js.map +1 -1
  18. package/dist/cli/init/agent-tasks-auth.d.ts +32 -0
  19. package/dist/cli/init/agent-tasks-auth.js +75 -0
  20. package/dist/cli/init/agent-tasks-auth.js.map +1 -0
  21. package/dist/cli/init/composer.js +3 -1
  22. package/dist/cli/init/composer.js.map +1 -1
  23. package/dist/cli/init/interactive.d.ts +5 -0
  24. package/dist/cli/init/interactive.js +162 -4
  25. package/dist/cli/init/interactive.js.map +1 -1
  26. package/dist/cli/init/profiles.d.ts +2 -2
  27. package/dist/cli/init/profiles.js +23 -15
  28. package/dist/cli/init/profiles.js.map +1 -1
  29. package/dist/cli/init/templates.d.ts +1 -1
  30. package/dist/cli/init/templates.js +113 -10
  31. package/dist/cli/init/templates.js.map +1 -1
  32. package/dist/cli/pack/hook-branch-protection.js +52 -5
  33. package/dist/cli/pack/hook-branch-protection.js.map +1 -1
  34. package/dist/cli/pack/hook-post-tool-use.d.ts +25 -1
  35. package/dist/cli/pack/hook-post-tool-use.js +103 -10
  36. package/dist/cli/pack/hook-post-tool-use.js.map +1 -1
  37. package/dist/cli/pack/hook-pre-tool-use.js +25 -4
  38. package/dist/cli/pack/hook-pre-tool-use.js.map +1 -1
  39. package/dist/cli/pack/hook-track-active-claim.d.ts +25 -0
  40. package/dist/cli/pack/hook-track-active-claim.js +162 -0
  41. package/dist/cli/pack/hook-track-active-claim.js.map +1 -0
  42. package/dist/policy-packs/builtin/understanding-before-execution-runtime.d.ts +76 -0
  43. package/dist/policy-packs/builtin/understanding-before-execution-runtime.js +272 -1
  44. package/dist/policy-packs/builtin/understanding-before-execution-runtime.js.map +1 -1
  45. package/dist/policy-packs/builtin/understanding-before-execution.js +28 -2
  46. package/dist/policy-packs/builtin/understanding-before-execution.js.map +1 -1
  47. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,53 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.20.0] - 2026-05-18
11
+
12
+ **Headline: two ergonomics gaps closed at the gate surface.** v0.18 introduced per-task understanding-gate marker expiry as opt-in via `--task <id>`; this release auto-resolves the active agent-tasks claim from a PostToolUse-maintained `active-claim` file, so operators with agent-tasks wired never need to type the UUID. The full template's PR-review gates also become tool-agnostic: parallel Bash-surface policies now guard `gh pr merge` / `gh pr create` alongside the agent-tasks MCP variants, with `${BRANCH}` substituting for `${PR_NUMBER}` / `${TASK_ID}` since the extract DSL cannot capture from `tool_input.command`. Two fixes close subtle bypasses: the marker-expiry mechanism now also flips the persisted-report `approvalStatus` from `approved` to `expired` (closing the multi-task silent-bypass that survived v0.18), and branch-protection gates on the target file's repo rather than the cwd's, so writes to memory or cross-repo edits stop falsely refusing when cwd happens to sit on master.
13
+
14
+ ### Added
15
+
16
+ - **understanding-gate v2: auto-resolve active agent-tasks claim** (harness/494fd1e5, PR #187). v1 (PR #184) shipped task-scoped markers as opt-in via `--task <id>`. v2 closes the ergonomics gap: a new PostToolUse hook (`harness pack hook track-active-claim`) maintains `<generatedDir>/active-claim` from agent-tasks `task_start` / `task_finish` / `task_abandon`. `harness approve understanding` reads the file when `--task` is absent and auto-supplies the id. Operators with agent-tasks wired never need to type the UUID; the file is a one-line cat-able artefact. Without agent-tasks (or when no task is claimed), behaviour falls back to v1: only the session-scoped marker is written. `--task` takes precedence over the file when both are present, with the result payload's new `source: "flag" | "active-claim"` field telling the operator which surface fed the id. New runtime helpers: `writeActiveClaim`, `readActiveClaim`, `clearActiveClaim`, `activeClaimPathFor`, `ACTIVE_CLAIM_FILENAME`. 13 new tests across the hook + approve + apply surfaces. No cross-repo coordination needed: harness owns both the writer (PostToolUse hook) and the reader (approve verb), so agent-tasks-bridge stays untouched.
17
+
18
+ - **understanding-gate: task-scoped approval markers** (harness/1ee26e77, PR #184). The marker file the gate consults is now keyed by `task-<taskId>` in addition to `<sessionId>` when the operator passes `--task <id>` to `harness approve understanding`. Either marker satisfies the gate, but the task-scoped one is the design-intent target for multi-task sessions: when the task ends, the post-tool-use hook extracts `tool_input.taskId` from the matched MCP boundary tool (e.g. `mcp__agent-tasks__task_finish`) and deletes the specific task marker (in addition to the session marker, as today). Without `--task`, behaviour is unchanged, the session marker is the only one written, fall-through semantics preserve every existing flow. New helpers in the runtime module: `writeTaskApprovalMarker`, `checkAnyTaskApprovalMarker`, `clearTaskApprovalMarker`, `taskApprovalMarkerPathFor`. 8 new tests across approve / pre-tool-use / post-tool-use surfaces. The intent: enable the cross-session continuity case (operator approved task A from session X, agent continues task A in session Y so the approval still holds) without disrupting the legacy per-session contract for solo workflows.
19
+
20
+ - **Tool-agnostic PR-review gates (Bash-surface parallels)** (harness/7eed0bb2, PR #188). The full template now ships `review-before-merge-bash` and `review-subagent-before-pr-create-bash` alongside the existing agent-tasks MCP variants, so `gh pr merge` / `gh pr create` get the same review-evidence gate. A `PolicyTrigger` can only AND-match one surface (MCP tool-name OR Bash command), so two parallel policies are the minimum-scope answer (V3 from the deferred-2026-05-17 task analysis, picked over a schema-bump V1 that would have introduced a new Array `match` form plus regex-capture from Bash stdout for a single use case). Tag shape switches to `${BRANCH}` on the Bash side because no `PR_NUMBER` / `TASK_ID` is extractable from `tool_input.command` via the JSONPath-only extract DSL. Hybrid operators using both surfaces get both gates active with two tag shapes, which is honest at the ledger layer. New worked example in `docs/writing-custom-policies.md` ("Same gate, two PR-surface variants") plus pointers in `docs/for-humans.md` and `docs/init-interactive.md`.
21
+
22
+ ### Fixed
23
+
24
+ - **understanding-gate: persisted-report bypass** (harness/1ee26e77 root-cause follow-up, PR #185). Forensics on a multi-task session that didn't re-prompt: PR #172 (v0.18, May 17) shipped marker-expiry on task_finish but only deleted the FILESYSTEM MARKER, not the persisted JSON report at `.understanding-gate/reports/...json`. The pre-tool-use gate falls through to the persisted report when the marker is absent, so the report (still `approvalStatus: "approved"`) silently kept satisfying the gate after task_finish. The marker-expiry mechanism was performing its half of the contract, the report's half was missing. This patch closes the gap: the post-tool-use hook now also flips the matching report's `approvalStatus` from `approved` to `expired` (with an `expiredAt` timestamp), atomic rewrite, operator's report body preserved for audit. Hook command is now wrapped with `UNDERSTANDING_GATE_REPORT_DIR` so it resolves the same reports directory the pre-tool-use blocker uses. 3 new tests on the post-tool-use surface (flips approved → expired, degrades gracefully when no reports exist, idempotent on already-expired). Without this fix, the v1 task-scoped marker work from PR #184 was load-bearing on the marker path only, which the bypass would have continued to defeat.
25
+
26
+ - **branch-protection: gate on target path, not cwd** (harness/efdbfa0b, PR #183). The branch-protection PreToolUse hook resolved the branch via `resolveGitContext(cwd)`, so any Write / Edit / MultiEdit / NotebookEdit fired from a checkout on master got refused regardless of where the target path actually lived. Two practical cases hit every session: (1) writes to `~/.claude/memory/*.md` (outside any git repo at all) blocked when cwd was on a protected branch elsewhere; (2) cross-repo edits when cwd was on a protected branch in repo A and the target file lived in repo B on a feature branch, same wrong refusal. Fix introduces `extractTargetPath(toolName, toolInput)` for the single-file mutator tools and resolves the branch context from `dirname(targetPath)` instead of cwd. Relative paths resolve against cwd before the dirname walk. Tools without a single resolvable target (Bash, search verbs) fall back to cwd as before. Same-repo writes on a protected branch still block, the substance of the gate is unchanged, only its anchor moved. 6 new tests, 23 total in the file. Subsumes duplicate friction 5427e455.
27
+
28
+ ### Changed
29
+
30
+ - **preflight-before-push gate message: explain the post-commit re-run requirement** (harness/ec7390c9, PR #186). The error said "a fresh preflight for `${BRANCH}` (within the last 10 minutes)", technically correct but hid the load-bearing detail: a preflight from earlier in the session does not cover a push that landed a new commit since. Result was "I just ran preflight, why is the gate blocking?" and a round-trip to docs. The required clause now splits the two cleanly: state the gate's actual check (time window) and give the operator-side rule (re-run after each commit) as a "what you need to do" hint rather than a "what the gate verifies" claim, since today only the time check is enforced. Same wording mirrored to `templates.ts`, `composer.ts`, the canonical `docs/examples/full-manifest.yaml` example, and its expected-render snapshot used by the parity test. The heavier half (HEAD-match freshness so any preflight whose recorded HEAD matches current HEAD satisfies the gate, removing the per-commit re-preflight churn entirely) is filed as a follow-up at agent-tasks/a0af50cb.
31
+
32
+ ## [0.19.0] - 2026-05-17
33
+
34
+ **Headline: setup UX gap closed for non-agent-tasks operators.** Through v0.18.x several pieces of the harness experience silently degraded for operators picking Solo (or Team without an agent-tasks account): the new per-task understanding-gate marker expiry never fired because the configured boundary list was agent-tasks MCP names, `harness init --interactive` left the bridge wired but unauthenticated, `harness doctor` flagged the deliberately operator-driven `dogfood-before-release` policy as a missing-producer false positive, and an nvm-drift class of bug went undiagnosed. This release closes those four gaps: profile-aware reset defaults plus a new `expire_on_bash_match` regex list for gh-CLI workflows, a post-install auth probe with login / skip / abort dialog, doctor respect for the policy's own `producers:` array, and a doctor warning that catches when `npm prefix -g`'s bin dir is not on PATH. Doc cleanup made the external-account assumptions of each profile explicit up-front.
35
+
36
+ ### Added
37
+
38
+ - **understanding-gate: `approval_lifecycle.expire_on_bash_match`** (harness/f54e0ecb). New optional schema field on the `understanding-before-execution` pack config: a string array of regex patterns matched against the `Bash` tool's `tool_input.command`. When a Bash command matches, the per-session approval marker is deleted on PostToolUse, same semantics as the existing `expire_on_tool_match` does for MCP tool names. Enables gh-CLI / pure-Bash workflows to declare task boundaries (e.g. `^gh pr (merge|close)\b`, `^git push origin (master|main)\b`) so the gate's per-task re-prompt works for them too. Profile defaults updated: Solo drops the agent-tasks tool list (dead weight there) and ships only the Bash list with `max_age: 1h`; Team and Full keep the tool list and add the Bash list for hybrid coverage. Patterns are pre-compiled at parse time, invalid regexes dropped with stderr warnings. Round-trip regression tests in `tests/cli/init-full-template-pins.test.ts` parse each template through `yaml.parse + new RegExp + .test()` to pin the escape-pipeline correctness, since the unit-level tests bypass that surface.
39
+
40
+ - **`harness doctor`: warn when `npm prefix -g`'s bin dir is not on PATH** (harness/4ddd78ed). Surfaces the nvm-drift footgun where `harness init --interactive` runs `npm i -g` against the active Node's prefix but the operator's shell PATH points at a different one, so installed binaries are silently invisible to subsequent doctor probes. Doctor now resolves the bin dir via `npm prefix -g` (the modern replacement for the removed `npm bin -g`) and renders an `Environment` section with the actionable PATH-patch suggestion when the bin dir is not in `process.env.PATH`. The section stays absent on ok and on the unknown branch (npm missing); skipped under `--shallow` so the 100ms timing budget stays intact.
41
+
42
+ - **`harness init --interactive`: post-install auth probe for the agent-tasks bridge** (harness/3f775180). After a successful `npm i -g @agent-tasks/mcp-bridge`, the wizard runs `agent-tasks-mcp-bridge status` to detect whether a token is configured. Three branches:
43
+ - **ok**: prints `✓ agent-tasks token validated against the backend.` and continues.
44
+ - **token present but validation fails** (backend unreachable, expired token, wrong base URL): prints an informational warning naming the bridge's reason and continues. The wizard does not block on this because the recovery is not actionable from inside it.
45
+ - **no token stored**: opens a three-option dialog: (a) run `agent-tasks-mcp-bridge login` interactively now via stdio pass-through, (b) skip with a reminder, (c) abort the wizard with a pointer to the signup URL and the re-run command. After a successful login the wizard re-probes to confirm.
46
+
47
+ Closes the silent footgun where a fresh operator could finish the wizard with `harness doctor` reporting all-green but every `mcp__agent-tasks__*` call returning an auth error.
48
+
49
+ - **FULL_TEMPLATE `git-preflight` hook pin: `min_version: "0.1.1"` + `version_command: ["preflight", "--version"]`** (agent-preflight/cb5a1770). Same pattern as the existing pins for `agent-tasks-mcp-bridge`, `grounding-mcp`, `memory-router-user-prompt-submit`. Floor at agent-preflight 0.1.1, the release that distinguishes "tool not installed" (e.g. an npm script invoking eslint that is not in devDependencies) from real lint/test/typecheck failures. Stale 0.1.0 installs silently emit false-positive blockers that keep the `preflight-before-*` policies closed forever; with the floor wired, `harness doctor` now warns operators to upgrade.
50
+
51
+ ### Changed
52
+
53
+ - **`harness doctor`: producer-gap warning now respects the policy's own `producers:` array** (harness/f97e152f). A `block` policy with a `within:` window used to be flagged with `⚠ ... no manifest hook produces it` whenever no automatic SessionStart hook wrote the required tag, even when the policy itself declared a `producers:` entry pointing the agent at the manual recovery (`mcp__agent-grounding__ledger_add`). For `dogfood-before-release` in the Full template that was a false positive: the gate is deliberately operator-driven (an automatic SessionStart producer would defeat its purpose), and the `producers:` array IS the schema-blessed manual recovery path the agent sees in the deny envelope. Doctor now treats a non-empty `producers:` array as a documented producer and suppresses the warning. The warning still fires when both kinds are absent. Visible effect on the Full template: one fewer false-positive warning (dogfood-before-release flips from `⚠` to `✓`); the two preflight policies were already satisfied by the `git-preflight` SessionStart hook and stay green.
54
+
55
+ - **Profile dependency clarity in README + wizard** (harness/75de11c4). README, `docs/init-interactive.md`, `docs/for-humans.md`, the wizard's profile-choice descriptions, and the Team-profile confirm prompt now state the external-account assumptions of each profile up-front: Solo is standalone, Team requires an agent-tasks account, Full additionally requires `@lannguyensi/agent-preflight` and `gh` on PATH. The wizard also prints a post-init reminder for Team/Full operators naming `agent-tasks-mcp-bridge login` as the auth recovery path and `--template solo` as the fallback for non-agent-tasks workflows.
56
+
10
57
  ## [0.18.0] - 2026-05-17
11
58
 
12
59
  **Headline: per-task understanding-gate marker expiry.** Through v0.17.x the approval marker had no lifetime: one `harness approve understanding` covered every subsequent Edit / Write / Bash for the whole session. That contract was correct when the gate was about "agent starts a session, picks ONE interpretation, runs", but no longer matches multi-task sessions, where a stale interpretation can silently drive the next task's edits. Live failure mode from the v0.17.4 dogfood: three sequential tasks in one session, marker stayed valid across all three, the third task started implementing the wrong fix surface before the operator caught the misdiagnose. v0.18 expires the marker on configurable task-boundary tools and (optionally) on a TTL safety net, so a fresh task gets a fresh Understanding Report. Backing task: agent-tasks/d8ee60ca.
package/README.md CHANGED
@@ -11,18 +11,13 @@ applies, audits, and *enforces*.
11
11
  > exact context, and why.
12
12
 
13
13
  A coding agent like Claude Code is configured across half a dozen
14
- files: `settings.json`, `CLAUDE.md`, memory notes, MCP registrations,
15
- hook scripts, per-project overrides. No single file answers *"what can
16
- this agent do right now, and why is it set up that way?"*, so
17
- configuration drifts between sessions, rules you wrote down in one
18
- place quietly stop firing, and a broken tool is discovered only by
19
- tripping over it.
20
-
21
- `harness` puts all of that in one YAML file you can read, validate,
22
- and diff. From that file it generates the config the agent actually
23
- loads, and at runtime it enforces the rules you declared: it blocks a
24
- tool call that violates one, and records every decision so you can
25
- see what fired and why.
14
+ files (`settings.json`, `CLAUDE.md`, memory notes, MCP registrations,
15
+ hook scripts, per-project overrides), and no single file answers
16
+ *"what can this agent do right now, and why is it set up that way?"*.
17
+ `harness` puts all of it in one YAML you read, validate, and diff;
18
+ generates the config the agent loads from it; and at runtime blocks
19
+ tool calls that violate the declared rules while recording every
20
+ decision.
26
21
 
27
22
  ## See it work
28
23
 
@@ -40,12 +35,10 @@ $ harness policy intercept # Claude Code runs this before each tool call
40
35
  {"decision":"block","reason":"review-before-merge: no matching ledger entry for tag `review:42`","hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"review-before-merge: no matching ledger entry for tag `review:42`"}}
41
36
  ```
42
37
 
43
- Since v0.17.0 every built-in block-enforcement policy ships a `ux:`
44
- block (the warn-only `two-reviewers-required` omits it; the agent
45
- never sees a warn), so the agent actually sees the plain-language
46
- three-section form instead (see
47
- [What the agent sees vs what the engine records](#what-the-agent-sees-vs-what-the-engine-records)
48
- below). The engine-vocabulary text stays in the audit ledger.
38
+ Built-in block-enforcement policies ship a `ux:` block since v0.17.0,
39
+ so the agent sees a plain-language three-section form
40
+ ([`docs/for-agents.md`](docs/for-agents.md#agent-facing-block-messages-ux-block));
41
+ the engine-vocabulary text above stays in the audit ledger.
49
42
 
50
43
  Blocked. `harness explain` says exactly why:
51
44
 
@@ -87,54 +80,6 @@ timestamp policy outcome reason
87
80
  Declare the rule once; every session is held to it, with a paper
88
81
  trail of every decision.
89
82
 
90
- ## What the agent sees vs what the engine records
91
-
92
- A policy has two readers: the audit ledger (which wants every internal
93
- detail) and the agent (which only needs to know what is blocked, what
94
- condition is missing, and which command satisfies it). Declaring a
95
- policy's `ux:` block splits those readers cleanly.
96
-
97
- Engine-internal model (unchanged): session IDs, ledger entries,
98
- attestations, provenance chains, policy DAGs. All of it still feeds
99
- `audit`, `explain --trace`, and the evidence-ledger writes that
100
- `session-export` replays.
101
-
102
- Agent-facing model (new, opt-in per policy): `cannot` (what is
103
- blocked), `required` (the missing precondition, in plain words), and
104
- `run` (the exact command to satisfy it). When `ux:` is declared, the
105
- agent sees only this shape, with `${VAR}` references substituted
106
- against the same context the `ledger_tag` resolved against.
107
-
108
- ```yaml
109
- policies:
110
- - name: preflight-before-investigation
111
- requires: { ledger_tag: "preflight:${REPO}", within: "1h" }
112
- enforcement: block
113
- ux:
114
- cannot: "You cannot investigate this repository yet."
115
- required: ["verified repository preflight"]
116
- run: ["harness preflight"]
117
- ```
118
-
119
- On block, the agent sees:
120
-
121
- ```
122
- You cannot investigate this repository yet.
123
-
124
- Required:
125
- - verified repository preflight
126
-
127
- Run:
128
- harness preflight
129
- ```
130
-
131
- Not `no matching ledger entry for tag preflight:harness`. The
132
- internal failure (tag, hint, matched count) is still written to the
133
- ledger for `audit` and `explain --trace`. Policies without `ux:` keep
134
- the legacy deny envelope unchanged, so existing 0.16.x manifests need
135
- no changes; the canonical form for agents writing new policies lives
136
- in [`docs/for-agents.md`](docs/for-agents.md#agent-facing-block-messages-ux-block).
137
-
138
83
  ## Concepts in six lines
139
84
 
140
85
  | Term | What it is |
@@ -163,25 +108,16 @@ flowchart LR
163
108
  observe -. refine .-> declare
164
109
  ```
165
110
 
166
- One manifest declares grounding, tools, memory, hooks, policies, and
167
- workflows. `apply` materialises that into the files Claude Code
168
- actually reads. At runtime, hooks and policies enforce the contract
169
- and write decision rows to the evidence ledger. The read-side
170
- surfaces (`audit`, `explain --trace`, `session-export`) replay those
171
- rows so you can see what fired, why, and across which session.
172
- Whatever you learn from observing flows back into the manifest. That
173
- loop is the whole product.
111
+ Observe refine declare is the whole loop. The read-side surfaces
112
+ (`audit`, `explain --trace`, `session-export`) replay rows the runtime
113
+ already recorded, so what flows back into the manifest is grounded in
114
+ what actually happened.
174
115
 
175
116
  ## Pick your audience
176
117
 
177
- - **Operator?** Read [`docs/for-humans.md`](docs/for-humans.md). It
178
- walks from `npm i -g @lannguyensi/harness` through your first
179
- `apply`, your first real policy, and the diagnostics cheat sheet.
180
- - **Agent (or onboarding one)?** Read
181
- [`docs/for-agents.md`](docs/for-agents.md). It defines the
182
- workflow lifecycle, the policy / ledger sequence, the CLI cheat
183
- sheet split by side-effect class, and the audit triumvirate
184
- (`audit` vs `explain --trace` vs `session-export`).
118
+ - **Operator?** [`docs/for-humans.md`](docs/for-humans.md): install through first `apply`, first real policy, diagnostics cheat sheet.
119
+ - **Agent (or onboarding one)?** [`docs/for-agents.md`](docs/for-agents.md): workflow lifecycle, policy / ledger sequence, CLI cheat sheet by side-effect class, the audit triumvirate.
120
+ - **Writing your own policy?** [`docs/writing-custom-policies.md`](docs/writing-custom-policies.md): three tripwires, four worked recipes (each validated in CI), author loop, field reference.
185
121
 
186
122
  ## Install
187
123
 
@@ -200,11 +136,21 @@ command path, install to wired-in, no prose.
200
136
  harness init --interactive
201
137
  ```
202
138
 
203
- Guided wizard that detects your environment (existing `~/.claude/` and
204
- `~/.codex/`, MCP servers already wired in `settings.json`, harness
205
- binary version), picks a profile (`solo` / `team` / `custom`), and
206
- writes a starting `harness.yaml`. Ctrl-C at any prompt aborts with no
207
- partial write. Walkthrough + limitations: `docs/init-interactive.md`.
139
+ Guided wizard. Detects `~/.claude/` and `~/.codex/`, MCP servers
140
+ already wired in `settings.json`, harness binary version. Picks a
141
+ profile (`solo` / `team` / `custom`) and writes a starting
142
+ `harness.yaml`. Ctrl-C aborts cleanly. Walkthrough +
143
+ limitations: [`docs/init-interactive.md`](docs/init-interactive.md).
144
+
145
+ ### Profiles at a glance
146
+
147
+ | Profile | External accounts / tools required | Best for |
148
+ |---------|------------------------------------|----------|
149
+ | `solo` | None. `npm` + Claude Code is enough. | Single operators who want the Understanding Gate without committing to a tasking system. |
150
+ | `team` | An **agent-tasks** account ([hosted](https://agent-tasks.opentriologue.ai) or [self-hosted](https://github.com/LanNguyenSi/agent-tasks)). | Teams that already use `agent-tasks` for PR review tracking. The merge gate (`review:<pr-number>` ledger tag) wires against the agent-tasks MCP. |
151
+ | `full` | Same as `team` plus `@lannguyensi/agent-preflight` and `gh` on PATH. | Operators who want every reference policy enforced (dogfood gate, preflight gates, review-subagent gate, merge gate). |
152
+
153
+ **Not using agent-tasks?** Pick `solo`. The `team` and `full` review gates currently match only the agent-tasks MCP tool names, so a `gh pr create` workflow stays unprotected by them today. Tool-agnostic gates that also match `gh pr` are tracked in the backlog.
208
154
 
209
155
  If you prefer non-interactive (CI, fresh-VM provisioning), pick a
210
156
  template directly:
@@ -215,17 +161,14 @@ harness init --template team # solo + agent-tasks MCP + review-before-merge po
215
161
  harness init --template full # everything from the Appendix A reference manifest
216
162
  ```
217
163
 
218
- Debug what the harness sees in your env without writing anything:
164
+ Use `harness init --probe` for a JSON snapshot of detected runtimes
165
+ and MCPs without writing anything.
219
166
 
220
- ```bash
221
- harness init --probe # JSON snapshot of detected runtimes + MCPs + manifest
222
- ```
223
-
224
- ## Try it yourself
167
+ ## Try it without installing
225
168
 
226
- The demo above shows the runtime path. To see policy matching without
227
- installing anything or touching the ledger, run `dry-run` against the
228
- reference manifest:
169
+ `harness dry-run` reports which hooks fire and which policies match
170
+ for a given tool call, against the reference manifest, before any
171
+ ledger I/O:
229
172
 
230
173
  ```bash
231
174
  git clone https://github.com/LanNguyenSi/harness && cd harness
@@ -236,44 +179,23 @@ node dist/cli/main.js dry-run "merge PR 42" \
236
179
  --config docs/examples/full-manifest.yaml
237
180
  ```
238
181
 
239
- `dry-run` reads the reference manifest, runs the trigger matcher,
240
- substitutes `${PR_NUMBER}=42` through the JSONPath-restricted extract
241
- DSL, and tells you exactly which hooks would fire and which policies
242
- would match, before any ledger I/O.
243
-
244
- The reference manifest is a schema-coverage example, not a runnable
245
- config. `harness validate --config docs/examples/full-manifest.yaml`
246
- will report errors for install-specific hook script paths it
247
- references (and warnings for binaries like `git-batch` that only exist
248
- in a real install). That is expected; the file header spells out the
249
- contract. Use `harness init --template full` to get a manifest
250
- tailored to your machine.
251
-
252
- Convinced? Install globally and set up your own:
253
- `npm i -g @lannguyensi/harness && harness init --interactive`.
182
+ `docs/examples/full-manifest.yaml` is a schema-coverage example, not a
183
+ runnable config (the file header spells out the contract). For a
184
+ manifest tailored to your machine, install globally and run
185
+ `harness init --interactive`.
254
186
 
255
187
  ## Uninstall
256
188
 
257
189
  `harness uninstall` is the single-command teardown: dry-run by default,
258
- `--apply` to mutate. It inventories what harness planted under
259
- `~/.claude/` (manifest, lock, `harness.generated/`, harness-owned hook
260
- groups and `mcpServers` entries in `settings.json`, any leftover
261
- `settings.json.pre-harness-<TS>` backups), then removes them after
262
- writing a reversible backup + JSON snapshot next to `settings.json`.
263
-
264
- ```bash
265
- harness uninstall # list, exit 0
266
- harness uninstall --apply # tear down
267
- harness uninstall --restore-from <pre-harness-backup> # atomic restore
268
- npm uninstall -g @lannguyensi/harness # drop the CLI itself
269
- ```
190
+ `--apply` to mutate, `--restore-from <backup>` to roll back. Full
191
+ inventory + recommended order in [`docs/uninstall.md`](docs/uninstall.md).
270
192
 
271
193
  ## Status
272
194
 
273
195
  harness ships in phases. Phases 1 through 6 are released: read-only
274
196
  inventory → managed edits → declarative truth → policy layer → polish
275
197
  and dogfood lessons → the Understanding Gate Policy Pack. Phase 7, the
276
- Risk Gate, is next. The current release is `v0.17.4`.
198
+ Risk Gate, is next. The current release is `v0.20.0`.
277
199
 
278
200
  The phase-by-phase plan with acceptance criteria lives in
279
201
  [`docs/ROADMAP.md`](docs/ROADMAP.md); what shipped in each version is
@@ -281,109 +203,61 @@ in [`CHANGELOG.md`](CHANGELOG.md).
281
203
 
282
204
  ## Policy Packs
283
205
 
284
- A *Policy Pack* is a reusable bundle of instruction template, hooks,
285
- policies, and permission profiles that ships under one name and is
286
- referenced from `harness.yaml` with a single key. The first pack,
287
- `understanding-before-execution` (shipped in `v0.9.0`), forces agents
288
- to expose and confirm their task interpretation before any
289
- write-capable tool fires.
206
+ A *Policy Pack* is a reusable bundle of hooks, policies, instruction
207
+ template, and permission profiles shipped under one name and enabled
208
+ from `harness.yaml` with a single key:
290
209
 
291
210
  ```yaml
292
211
  policy_packs:
293
212
  - name: understanding-before-execution
294
213
  config:
295
- mode: grill_me # fast_confirm | grill_me | strict
296
- permission_profile: safe-start # safe-start | implementation-after-approval | high-risk-grill-me
297
- ```
298
-
299
- Manage packs with `harness pack add / remove / list`. Apply against
300
- either runtime:
301
-
302
- ```sh
303
- harness apply --runtime claude-code # default; writes harness.generated/settings.json
304
- harness apply --runtime codex # writes harness.generated/codex/config.toml
214
+ mode: grill_me # fast_confirm | grill_me | strict
215
+ permission_profile: safe-start # safe-start | implementation-after-approval | high-risk-grill-me
305
216
  ```
306
217
 
307
- Approve a session's Understanding Report via
308
- `harness approve understanding --session <id>` (round-trips both the
309
- evidence-ledger tag and the persisted JSON report). Verify the
310
- adapter wiring with `harness doctor --target codex` (`--json` for
311
- machine-readable). The full reference lives in
312
- [`docs/policy-packs/understanding-before-execution.md`](docs/policy-packs/understanding-before-execution.md);
313
- synthetic-stdin dogfood under
314
- [`dogfood/phase6-6/`](dogfood/phase6-6/run-smoke.sh) exercises the
315
- block / allow / capture / approve round-trip without a real Codex
316
- binary.
218
+ Manage packs with `harness pack add / remove / list`. Two packs ship
219
+ today: [`understanding-before-execution`](docs/policy-packs/understanding-before-execution.md)
220
+ (forces an Understanding Report before any write-capable tool fires)
221
+ and [`branch-protection`](docs/policy-packs/branch-protection.md)
222
+ (blocks source mutations on protected branches without an explicit
223
+ override). Custom packs from `path:`, `npm:`, or `git:` sources are
224
+ out of scope for v1 (see the pack docs for the future-vocabulary
225
+ contract).
317
226
 
318
227
  ## What's next
319
228
 
320
- **Phase 7, Risk Gate.** Today's policy model evaluates a rule per
321
- matching trigger and returns a binary block/allow. Phase 7 makes
322
- harness reason about *the action itself*: an Action Envelope (tool +
323
- raw input + session + runtime context) is enriched by a Context
324
- Resolver (production / staging / dev / unknown), classified by a Risk
325
- Classifier (severity + categories + reversibility), then matched
326
- against policies whose `when:` clauses can reference
327
- `risk.severity_at_least`, `environment.name`, and similar. The
328
- decision space extends to `allow / warn / require_approval / deny`.
329
- Motivating use case: prevent `DROP TABLE users`, `kubectl delete
330
- namespace prod`, `terraform destroy` against an unverified production
331
- target, even if the model would have happily run them.
332
-
333
- Phase 7 builds on Phase 4's `policy intercept` runtime backbone and
334
- Phase 6's Policy Pack distribution surface; neither is replaced.
229
+ **Phase 7, Risk Gate.** Today's policy model returns a binary
230
+ block/allow per matching trigger. Phase 7 lets harness reason about
231
+ the action itself (Action Envelope Context Resolver → Risk
232
+ Classifier) and extends the decision space to `allow / warn /
233
+ require_approval / deny`. Motivating use case: block `DROP TABLE
234
+ users`, `kubectl delete namespace prod`, `terraform destroy` against
235
+ unverified production targets. Full plan in
236
+ [`docs/ROADMAP.md#phase-7--risk-gate`](docs/ROADMAP.md#phase-7--risk-gate).
335
237
 
336
238
  > Bring your favorite agent harness. Add governance.
337
239
 
338
240
  ## Why this exists
339
241
 
340
- A working agent harness today has six to eight configuration
341
- surfaces, each with its own schema and lifecycle: `~/.claude/settings.json`,
342
- `CLAUDE.md` (per repo + root), `~/.claude/projects/*/memory/*.md`
343
- with frontmatter, `~/.claude/keybindings.json`, MCP server
344
- registrations in `~/.claude.json`, skill directories, per-project
345
- overrides, and external CLIs that behave differently per project.
346
-
347
- There is no single place that answers *"what can this agent do right
348
- now, and why is that configured that way?"*. Drift between sessions
349
- is invisible until it breaks something. Humans editing one surface
350
- do not know which other surfaces they need to touch. A fresh agent
351
- instance has no way to audit its own setup.
352
-
353
- Our entry point into this problem: on 2026-04-23, an
354
- `agent-grounding` checkout that was 16 commits behind origin led two
355
- tasks to be incorrectly called "stale". The check that would have
356
- caught it already exists,
242
+ On 2026-04-23, an `agent-grounding` checkout that was 16 commits
243
+ behind origin led two tasks to be incorrectly called "stale". The
244
+ check that would have caught it already existed:
357
245
  [`agent-preflight`](https://github.com/LanNguyenSi/agent-preflight)
358
- runs `git fetch` + `git status` (alongside lint, typecheck, test,
359
- audit) and emits a structured `ready` + confidence-score result. The
360
- missing piece was not the check itself, it was the deterministic
361
- *trigger*: a `SessionStart` hook that invokes `preflight run` and a
362
- policy that gates further work on the result. Building that wiring
363
- needs an agreed-upon place for harness config to live first. That
364
- conversation is the origin of this repo.
246
+ runs `git fetch` + `git status` and emits a structured `ready` +
247
+ confidence-score result. The missing piece was not the check, it was
248
+ the deterministic *trigger*: a `SessionStart` hook that invokes
249
+ `preflight run` and a policy that gates further work on the result.
250
+ Building that wiring needs an agreed-upon place for harness config to
251
+ live first. That conversation is the origin of this repo.
365
252
 
366
253
  ## Related
367
254
 
368
- - [`agent-grounding`](https://github.com/LanNguyenSi/agent-grounding):
369
- grounding primitives (evidence-ledger, claim-gate,
370
- review-claim-gate); `grounding-mcp` is the canonical client surface
371
- harness queries through `queryLedgerByTag`.
372
- - [`agent-memory`](https://github.com/LanNguyenSi/agent-memory):
373
- memory surfaces the control plane inventories.
374
- - [`agent-tasks`](https://github.com/LanNguyenSi/agent-tasks): the
375
- MCP-registered task platform whose registration + health appear in
376
- `harness describe`.
377
- - [`agent-preflight`](https://github.com/LanNguyenSi/agent-preflight):
378
- local preflight validator; the canonical implementation of
379
- preflight-hook content harness wires.
380
- - [`codebase-oracle`](https://github.com/LanNguyenSi/codebase-oracle):
381
- an opt-in MCP surface for multi-repo RAG search. Not in the Full
382
- default; operators wire it via `harness add mcp codebase-oracle
383
- --command codebase-oracle,mcp`.
384
- - [`agent-dx`](https://github.com/LanNguyenSi/agent-dx): ships
385
- `git-batch-cli`, a day-to-day tool whose inventory appears in
386
- `harness describe`.
255
+ - [`agent-grounding`](https://github.com/LanNguyenSi/agent-grounding): evidence-ledger, claim-gate, review-claim-gate; `grounding-mcp` is the canonical client surface harness queries through `queryLedgerByTag`.
256
+ - [`agent-memory`](https://github.com/LanNguyenSi/agent-memory): the memory surfaces the control plane inventories.
257
+ - [`agent-tasks`](https://github.com/LanNguyenSi/agent-tasks): MCP-registered task platform whose registration + health appear in `harness describe`.
258
+ - [`agent-preflight`](https://github.com/LanNguyenSi/agent-preflight): local preflight validator; the canonical implementation of preflight-hook content harness wires.
259
+ - [`codebase-oracle`](https://github.com/LanNguyenSi/codebase-oracle): opt-in MCP for multi-repo RAG search; not in Full, wire via `harness add mcp codebase-oracle --command codebase-oracle,mcp`.
260
+ - [`agent-dx`](https://github.com/LanNguyenSi/agent-dx): ships `git-batch-cli`, a day-to-day tool whose inventory appears in `harness describe`.
387
261
 
388
262
  ## License
389
263
 
@@ -3,6 +3,22 @@ import { type LoaderOptions } from "../loader.js";
3
3
  export interface ApproveUnderstandingOptions extends LoaderOptions {
4
4
  /** Explicit session id (overrides $CLAUDE_SESSION_ID). */
5
5
  session?: string;
6
+ /**
7
+ * Optional agent-tasks task id (harness/1ee26e77). When set, an
8
+ * additional task-scoped marker file is written at
9
+ * `<generatedDir>/.approvals/task-<taskId>`, in addition to the
10
+ * legacy session-scoped marker. Either satisfies the gate; the
11
+ * task-scoped marker is the design-intent target for multi-task
12
+ * sessions so the next task can require its own Understanding Report.
13
+ *
14
+ * When omitted, `harness approve understanding` falls back to reading
15
+ * `<generatedDir>/active-claim` (written by the track-active-claim
16
+ * PostToolUse hook on `task_start`, harness/494fd1e5). If that file
17
+ * exists, its content is used as the task id. If absent, no task
18
+ * marker is written — the session marker is the only one (v1
19
+ * back-compat).
20
+ */
21
+ task?: string;
6
22
  /** Override the reports directory (test injection). */
7
23
  reportsDir?: string;
8
24
  /** Override the harness.generated/ directory (test injection). */
@@ -44,6 +60,28 @@ export interface ApproveUnderstandingResult {
44
60
  ok: false;
45
61
  reason: string;
46
62
  };
63
+ /**
64
+ * Task-scoped marker write outcome. Present when --task / opts.task
65
+ * was supplied OR when the active-claim file resolved one
66
+ * (harness/494fd1e5). Null when no task was resolved through either
67
+ * surface so a regression cannot silently flip session-only sessions
68
+ * into task-mode.
69
+ *
70
+ * The `source` field tells the operator which surface fed the id so
71
+ * a wrong claim file can be spotted before it lands in the marker.
72
+ */
73
+ taskMarker: {
74
+ ok: true;
75
+ taskId: string;
76
+ filePath: string;
77
+ approvedAt: string;
78
+ source: "flag" | "active-claim";
79
+ } | {
80
+ ok: false;
81
+ taskId: string;
82
+ reason: string;
83
+ source: "flag" | "active-claim";
84
+ } | null;
47
85
  ledger: {
48
86
  ok: boolean;
49
87
  tag: string;
@@ -17,7 +17,7 @@ import * as fs from "node:fs";
17
17
  import * as os from "node:os";
18
18
  import * as path from "node:path";
19
19
  import { atomicWriteFile } from "../../io/atomic-write.js";
20
- import { approvedLedgerTagFor, defaultReportsDir, findLatestReportForSession, listPersistedReports, writeApprovalMarker, } from "../../policy-packs/builtin/understanding-before-execution-runtime.js";
20
+ import { approvedLedgerTagFor, defaultReportsDir, findLatestReportForSession, listPersistedReports, readActiveClaim, writeApprovalMarker, writeTaskApprovalMarker, } from "../../policy-packs/builtin/understanding-before-execution-runtime.js";
21
21
  import { addLedgerFact } from "../../runtime/ledger-add.js";
22
22
  import { clearPendingApproval, readPendingApproval, resolveGeneratedDir, } from "../../runtime/pending-approval.js";
23
23
  import { EX_FAIL, HarnessExitError } from "../exit-codes.js";
@@ -237,6 +237,49 @@ export async function approveUnderstanding(opts = {}) {
237
237
  reason: `failed to write approval marker: ${err.message}`,
238
238
  };
239
239
  }
240
+ // Task-scoped marker (harness/1ee26e77 + v2 auto-resolve in
241
+ // harness/494fd1e5). Written alongside the session marker when:
242
+ // - --task / opts.task was supplied (explicit, source: "flag"), OR
243
+ // - the active-claim file resolves to a taskId (source: "active-claim").
244
+ // A failure here is surfaced loudly but does not abort the approve
245
+ // flow; the session marker still satisfies the gate as a fallback.
246
+ let taskMarkerResult = null;
247
+ let resolvedTaskId = null;
248
+ let taskSource = "flag";
249
+ if (typeof opts.task === "string" && opts.task.length > 0) {
250
+ resolvedTaskId = opts.task;
251
+ taskSource = "flag";
252
+ }
253
+ else {
254
+ const fromFile = readActiveClaim(generatedDir);
255
+ if (fromFile !== null) {
256
+ resolvedTaskId = fromFile;
257
+ taskSource = "active-claim";
258
+ }
259
+ }
260
+ if (resolvedTaskId !== null) {
261
+ try {
262
+ const filePath = writeTaskApprovalMarker(generatedDir, resolvedTaskId, {
263
+ approvedAt: approvedAtMarker,
264
+ approvedBy: approvedByMarker,
265
+ });
266
+ taskMarkerResult = {
267
+ ok: true,
268
+ taskId: resolvedTaskId,
269
+ filePath,
270
+ approvedAt: approvedAtMarker,
271
+ source: taskSource,
272
+ };
273
+ }
274
+ catch (err) {
275
+ taskMarkerResult = {
276
+ ok: false,
277
+ taskId: resolvedTaskId,
278
+ reason: `failed to write task marker: ${err.message}`,
279
+ source: taskSource,
280
+ };
281
+ }
282
+ }
240
283
  const tag = approvedLedgerTagFor(sessionId);
241
284
  const ledgerResult = manifest
242
285
  ? await writeLedgerTag(manifest, sessionId, tag, opts)
@@ -306,6 +349,7 @@ export async function approveUnderstanding(opts = {}) {
306
349
  sessionId,
307
350
  sessionSource,
308
351
  marker: markerResult,
352
+ taskMarker: taskMarkerResult,
309
353
  ledger: ledgerResult.ok
310
354
  ? { ok: true, tag }
311
355
  : { ok: false, tag, reason: ledgerResult.reason },
@@ -1 +1 @@
1
- {"version":3,"file":"understanding.js","sourceRoot":"","sources":["../../../src/cli/approve/understanding.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,4CAA4C;AAC5C,yCAAyC;AACzC,EAAE;AACF,6EAA6E;AAC7E,wEAAwE;AACxE,mDAAmD;AACnD,uEAAuE;AACvE,oEAAoE;AACpE,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,qEAAqE;AACrE,oEAAoE;AAEpE,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,sEAAsE,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAsB,MAAM,cAAc,CAAC;AAyC9E,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAElD,SAAS,gBAAgB,CAAC,QAAkB;IAC1C,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,eAAe,CAAC,IAAI,IAAI,CAAC;AAC5E,CAAC;AAED,SAAS,cAAc,CAAC,CAAS;IAC/B,IAAI,CAAC,KAAK,GAAG;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,O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QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;YAC1F,eAAe,GAAG;gBAChB,EAAE,EAAE,IAAI;gBACR,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,cAAc;gBACd,UAAU;aACX,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,eAAe,GAAG;gBAChB,EAAE,EAAE,KAAK;gBACT,MAAM,EAAE,qBAAqB,MAAM,CAAC,QAAQ,KAAM,GAAa,CAAC,OAAO,EAAE;aAC1E,CAAC;QACJ,CAAC;IACH,CAAC;IAED,mEAAmE;IACnE,sEAAsE;IACtE,uEAAuE;IACvE,sEAAsE;IACtE,IAAI,aAAa,KAAK,kBAAkB,IAAI,YAAY,CAAC,EAAE,EAAE,CAAC;QAC5D,oBAAoB,CAAC,YAAY,CAAC,CAAC;IACrC,CAAC;IAED,OAAO;QACL,SAAS;QACT,aAAa;QACb,MAAM,EAAE,YAAY;QACpB,MAAM,EAAE,YAAY,CAAC,EAAE;YACrB,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE;YACnB,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,EAAE;QACnD,eAAe;KAChB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"understanding.js","sourceRoot":"","sources":["../../../src/cli/approve/understanding.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,4CAA4C;AAC5C,yCAAyC;AACzC,EAAE;AACF,6EAA6E;AAC7E,wEAAwE;AACxE,mDAAmD;AACnD,uEAAuE;AACvE,oEAAoE;AACpE,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,qEAAqE;AACrE,oEAAoE;AAEpE,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,C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