@holmes-lab/holmes-kit 0.36.1 → 0.37.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 CHANGED
@@ -7,6 +7,68 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
  <!-- @implements A-SPEC-209 -->
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.37.0] - 2026-10-21
11
+
12
+ Approvals happen in the session. The owner asked on 2026-10-20 whether approvals still need a command typed in a
13
+ separate terminal. An audit found they did. Only spec seals, critical-finding resolutions and runtime binding were
14
+ asked in the session, and those forms closed after 240 seconds. Every shell, config, code-write, autonomy, reappraisal
15
+ and reconcile approval, and every independent review verdict, needed a terminal. The same audit found that an agent's
16
+ own shell could approve its own refused command. That hole is closed first in this release.
17
+
18
+ Upgrading: recommended for every workspace (security fix). From inside a session, `! holmes-kit approve --grant …`
19
+ now refuses. Answer the session's approval form instead (call `approval_ask`), or grant from your own terminal.
20
+
21
+ ### Security
22
+
23
+ - **An agent's own shell can no longer approve its own refused command** (A-SPEC-779.4).
24
+ - Measured on 0.36.1 in a throwaway fixture: `git push --force origin main` was denied with
25
+ `[승인 대기 req-…] 운영자: npx holmes-kit approve --grant req-…`. The hook allowed that command from a tool call,
26
+ `grantGuard` let a non-terminal grant through outside a run, and the refused command was then **allowed**.
27
+ - After: `approve --grant`, `approve --watch`, the interactive approval screen, and the terminal path of
28
+ `autonomy on` and `autonomy delegate` refuse when the process carries an agent harness's environment marker, has a
29
+ harness among its parents, or its parents cannot be read. Measured live: refused with `CLAUDECODE`, refused again
30
+ with the markers removed (`process:claude`), and no grant written.
31
+ - Deny, revoke, ask, withdraw and the read-only views are unchanged. A grant from your own terminal is unchanged.
32
+ - Residual, named: a script that loads the package's modules and calls `grantRequest` itself runs as the same user
33
+ and is not refused.
34
+
35
+ ### Added
36
+
37
+ - **`approval_ask`: decide any pending request in the session's approval form** (A-SPEC-718.4).
38
+ - It takes the id a refusal names, from the inbox or this machine's refusal log, and shows it to the person in the
39
+ harness's MCP form. The person's answer is recorded exactly as `approve --grant/--deny/--ask` records it, under
40
+ actor `elicitation:<client>`. Silence records nothing.
41
+ - Measured live in Claude Code: a refused `rm -rf <scratch dir>` was asked, the owner chose approve, and the retry
42
+ passed once.
43
+ - Shell, config and code-write requests are asked only on a client measured to wait for a person: claude-code today.
44
+ Codex and Antigravity are a named gap until their auto-answer modes are measured.
45
+ - **`review_verdict`: an independent review verdict from the session's approval form** (A-SPEC-102.9).
46
+ - approve records pass, deny records fail with the person's reason. The verdict is `person: true`,
47
+ `channel: elicitation:<client>`, `independent: true`, so it satisfies the review gate without a separate terminal.
48
+ - `holmes-kit review record` is unchanged: it is independent only from a person's own terminal.
49
+ - Measured live: the owner answered pass for `a633d753..41b82c30` in the form. The ledger line reads
50
+ `person: true, channel: elicitation:claude-code, independent: true`, and the review gate for that range passes.
51
+ - **A request a run awaits is decided in the interactive session's form** (A-SPEC-779.5).
52
+ - The run's own server still never asks. The CLI's terminal-only rule for such a request is unchanged.
53
+
54
+ ### Changed
55
+
56
+ - **Every approval refusal tells the agent to call `approval_ask` with its id** (A-SPEC-718.5).
57
+ - The hint now ends with `Agent: call approval_ask with id "req-…" — the person decides …`, in two rows inside the
58
+ 80-column approval screen. The `approval.required` envelope names `approval_ask` first. The operator's terminal
59
+ line above it is unchanged.
60
+ - **The in-session approval form waits for the person** (A-SPEC-718.6).
61
+ - Before: a lock-free form expired after 240 s, shown at most twice.
62
+ - After: it waits up to 24 h, and its last line says it waits. Measured live: a form left open about 6 minutes was
63
+ approved and the retry passed. review-resolve keeps 120 s because it holds the findings-ledger lock.
64
+
65
+ ### Known issues
66
+
67
+ - "Approve by typing it as the next prompt" was considered and left out (owner, 2026-10-21). The clients without forms
68
+ (`claude -p`, `codex exec`) have no person typing a next prompt, and interactive sessions already have the form.
69
+ - On Windows, five reds in four suites new in 0.36.0 are test-side or fail closed (747.7, 747.10, 747.9 ×2, 476.3),
70
+ plus a PowerShell-only 747.4 over-block (Windows report of 2026-10-20).
71
+
10
72
  ## [0.36.1] - 2026-10-20
11
73
 
12
74
  A Windows patch. On a Windows host, Codex and Antigravity run the shell text they send under a Bash name in Windows
package/README.md CHANGED
@@ -9,8 +9,8 @@
9
9
  <!-- holmes-kit:attest:begin -->
10
10
  ![traced files](.ax/badges/traced.svg)
11
11
 
12
- **473/481** source files (98.3%) trace to an approved spec · **928/1005** approved A-SPECs (92.3%) are anchored from code.
13
- Measured at `8b45cd0dcb78` (specs `sha256:0b3ecc947d6c`) — reproduce with `holmes-kit attest`.
12
+ **476/484** source files (98.3%) trace to an approved spec · **934/1011** approved A-SPECs (92.3%) are anchored from code.
13
+ Measured at `39b323f6dcb9` (specs `sha256:0ff5569ceab1`) — reproduce with `holmes-kit attest`.
14
14
  <!-- holmes-kit:attest:end -->
15
15
 
16
16
  ---
@@ -22,6 +22,7 @@ Measured at `8b45cd0dcb78` (specs `sha256:0b3ecc947d6c`) — reproduce with `hol
22
22
  ---
23
23
 
24
24
  ### 🛡️ Currently Supported Features (Production Features)
25
+ - **Approvals happen in the session, not in a separate terminal** *(new in 0.37.0 — security fix, upgrade recommended)*: a refusal now ends with `Agent: call approval_ask with id "req-…"`. The MCP tool `approval_ask` shows that request in the harness's approval form, and the person's answer is recorded exactly as `holmes-kit approve` records it. That covers shell, config and code-write approvals (on Claude Code today; Codex and Antigravity are a named gap until measured) and a request a run awaits. `review_verdict` records an independent review verdict the same way. The form waits for the person (no 240-second limit). An agent's own shell, and the session's `!`, can no longer run `approve --grant`, `--watch` or `autonomy on`: through 0.36.1 an agent could approve its own refused command by running the command its refusal printed.
25
26
  - **An orchestrator can run governed agents, and reviews become gates** *(new in 0.36.0)*: `holmes-kit run start --worktree <dir> --engine claude|codex|agy [--scope <A-SPEC>]…` opens a run that pins the CLI, MCP and hook builds, prints the headless command and a stop key, and ends only with that key (`run status`, `run transition`, `run stop`). Inside a run every judgement fails closed: agent launches are refused, refusals are logged with a repeat stop, an approval pauses the run until the operator decides it in a terminal, a declared stage machine (analysis → design → implement → review → test → done) denies writes per stage, and Stop and push wait for an independent passing review. `holmes-kit review record|status|gate|mrp` records verdicts bound to a commit range, refuses self-review (an agent-harness ancestor process included), and assembles the merge-ready package. Every deny ends with a `[holmes-refusal]` line carrying a stable code. A project can cap its semantic tier (`semantic.maxTier`) and its automatic approval (`autonomy.ceiling`) in `ax.config.json`, and only an approval can raise either. doctor counts cloud embedding requests. `approve --withdraw` lets a run close its own request. Interactive sessions keep 0.35.25 verdicts, except for the gate holes this release closes: path-less spec staging, computed shell writes, executable files and side paths under a role policy, and Claude Code's PowerShell tool on Windows. Interactive agent launches may carry the autonomy options measured to keep the child's Holmes gate. This is an interim release of the role/phase goal: the acceptance scenario with a reference orchestrator has not been run yet.
26
27
 
27
28
  - **Agents clean up their own temporary work** *(new in 0.35.25)*: `holmes-kit scratch --new <label>` makes a directory under a per-user Holmes scratch root (`os.tmpdir()/holmes-scratch-<uid>`, mode 0700), and on macOS and Linux the gate lets an agent in Claude Code, Codex or Antigravity remove it with one plain `rm -rf <absolute path>` without an operator act; the root itself, tracked source, every other path and any compound command keep their verdict. Where another holmes-kit install sits in an ancestor `node_modules` of the workspace or the home directory (npm, Windows shims and pnpm alike), approval hints name the running install's own path so that copy cannot answer them (a PowerShell form on Windows), and doctor's `npx resolution` row names it.
@@ -42,7 +43,7 @@ Measured at `8b45cd0dcb78` (specs `sha256:0b3ecc947d6c`) — reproduce with `hol
42
43
  - **`doctor` shows when a checkout's hooks are not the ones its sessions run** *(new in 0.35.5)*: when you develop Holmes-Kit itself with sessions routed to a released install, the `development hooks` row compares the compiled files and has both hook programs judge the same payloads, so a hook change that is not live yet is visible instead of assumed. In the same release, `runtime-binding setup` refuses a plan that would write the Codex gate where Codex has it switched off *(security fix — if you ran setup with 0.35.2–0.35.4, check `doctor` for `FAIL codex user hooks`)*.
43
44
  - **No in-session shortcut around a person while autonomy is on** *(new in 0.35.4 — security fix, upgrade recommended)*: on a client without the MCP form dialog, the `approval_commit` continuation is no longer offered or accepted while autonomous approval is on — the request goes to the approval queue. Its only human check is the host's own tool confirmation, which an allow rule or auto mode removes. With autonomy off it works as before; seals made through it are recorded as `host-gated:<harness>`.
44
45
  - **An unanswered approval is held, never approved** *(new in 0.35.3 — security fix, upgrade recommended)*: with autonomous approval on, an in-session approval dialog that ran out of time used to be recorded as an approval (actor `autonomous-timeout:<harness>`) — for exactly the seals and critical-finding resolutions autonomy reserves for a person. An unanswered dialog now returns the request to the approval queue in every mode. To audit earlier sessions, search the provenance ledger for `autonomous-timeout`.
45
- - **Approvals that fit how people work** *(new in 0.35.2)*: an approval for a request that carries the approved content's digest (a spec seal) no longer expires after 30 minutes — it stays valid until used, revoked, or the content changes (`--ttl` still bounds it; requests without a digest keep the default). With autonomous approval on, a gate change declared `gate-behavior: tightens — …` or `gate-behavior: wording — …` is sealed without the operator; any other gate change still asks, and a seal handed to the operator says which rule handed it over. On a machine with a runtime registry the in-session approval dialog is reachable again, and `init`/`upgrade` no longer replace wiring the registry owns. Not yet changed: the in-session dialog's own time limit.
46
+ - **Approvals that fit how people work** *(new in 0.35.2)*: an approval for a request that carries the approved content's digest (a spec seal) no longer expires after 30 minutes — it stays valid until used, revoked, or the content changes (`--ttl` still bounds it; requests without a digest keep the default). With autonomous approval on, a gate change declared `gate-behavior: tightens — …` or `gate-behavior: wording — …` is sealed without the operator; any other gate change still asks, and a seal handed to the operator says which rule handed it over. On a machine with a runtime registry the in-session approval dialog is reachable again, and `init`/`upgrade` no longer replace wiring the registry owns.
46
47
  - **Separate development and consumer runtimes** *(new in 0.35.0)*: `runtime-binding setup` explicitly registers a checkout and its built package in an operator-owned registry. Normal Claude, Codex and Antigravity launches select that development package for the registered workspace; other workspaces select the configured release. Missing or conflicting bindings refuse with diagnosis instead of silently switching builds. Setup previews exact changes and requires authority for a changed installation; a validated unchanged plan needs no new grant. Normal migration preserves disabled hooks and native trust. `--activate-hooks` explicitly restores selected Holmes entries, while native trust and global disable switches still require native review. See [development runtime setup and recovery](docs/install-guide.md#development-and-consumer-runtime-binding) for the workflow and current approval limitation. Configuration readiness does not prove live three-harness enforcement.
47
48
  - **Bounded routed-hook recovery** *(new in 0.35.0)*: routed hooks share an 18-second input/selection/execution budget and allow up to 8 seconds for owned-process cleanup. Failure reports the selected runtime and diagnosis commands, retains unresolved findings, and directs an approved repair followed by retry of the original operation. Cleanup uncertainty is reported; persistent MCP sessions have no hook lifetime deadline. Literal recovery prompts and recognized installer previews are distinguished from actual shell writes without permitting command substitutions or protected output targets.
48
49
  - **Maintenance evidence survives the RED commit, and test evidence records what ran** *(new in 0.35.0)*: persisted `maintenance_analyze` evidence includes the request and explicit `changedFiles`, allowing the pre-edit advisory to cover named new files and analyses up to 20 ancestor commits back when every intervening change is covered. A passing `test_run` records the tree captured before execution, so edits made during a run remain unverified changes. The static test counter handles literals and same-file aliases, and recognizes suite skips only in code. The shared shell gate accepts read-only loops, prose literals, and commit messages mentioning `.ax`, and classifies file redirects using `>&` and `>|` as protected writes where applicable.
package/dist/.build-id CHANGED
@@ -1 +1 @@
1
- 0ddc829e-mvgdgz84
1
+ 2753ffd6-mvh0z08f
@@ -471,10 +471,27 @@ async function main(argv) {
471
471
  const str = (k) => (typeof flags[k] === 'string' ? flags[k] : undefined);
472
472
  const extra = { run: str('run'), allow: str('allow'), limits: str('limit')?.split('\n'), rationale: str('rationale') };
473
473
  return (0, cli_execution_1.runOperatorExecution)(root, () => {
474
- const r = runAutonomy(root, positionals[0], forStr, {
475
- now: new Date().toISOString(),
474
+ const now = new Date().toISOString();
475
+ const approval = readApproval();
476
+ // @implements A-SPEC-779.4 — the terminal path proves a person only when no agent harness started this process;
477
+ // a covering out-of-band approval is its own proof and keeps its path.
478
+ const sub = positionals[0];
479
+ if (sub === 'on' || sub === 'delegate') {
480
+ const { approvalCovers } = require('../guardrail/risk-gate');
481
+ if (!approvalCovers(approval, { kind: 'autonomy-grant', target: root }, now)) {
482
+ const { operatorActGuard } = require('../guardrail/operator-person');
483
+ const why = operatorActGuard(sub === 'on' ? 'enabling session autonomy' : 'issuing a run delegation');
484
+ if (why !== null) {
485
+ const { withRefusalLine } = require('../guardrail/refusal-codes');
486
+ process.stderr.write(`${withRefusalLine(why)}\n`);
487
+ return 2;
488
+ }
489
+ }
490
+ }
491
+ const r = runAutonomy(root, sub, forStr, {
492
+ now,
476
493
  isTTY: !!process.stdin.isTTY && !!process.stdout.isTTY,
477
- approval: readApproval(),
494
+ approval,
478
495
  }, extra);
479
496
  process[r.ok ? 'stdout' : 'stderr'].write(`${r.message}\n`);
480
497
  return r.exitCode;
@@ -1030,6 +1047,17 @@ async function main(argv) {
1030
1047
  catch {
1031
1048
  return 'operator';
1032
1049
  } })();
1050
+ // @implements A-SPEC-779.4 — the granting acts (a grant, the two screens that grant) are a person's, never an
1051
+ // agent's own shell; a denial, a revocation, a question and the read-only views grant nothing and stay open.
1052
+ const operatorRefusal = (act) => require('../guardrail/operator-person').operatorActGuard(act);
1053
+ const refuseOperatorAct = (act) => {
1054
+ const why = operatorRefusal(act);
1055
+ if (why === null)
1056
+ return false;
1057
+ const { withRefusalLine } = require('../guardrail/refusal-codes');
1058
+ process.stdout.write(`${withRefusalLine(`✗ ${why}`)}\n`);
1059
+ return true;
1060
+ };
1033
1061
  if (flags.help) {
1034
1062
  process.stdout.write(APPROVE_USAGE);
1035
1063
  return 0;
@@ -1048,7 +1076,9 @@ async function main(argv) {
1048
1076
  }
1049
1077
  // @implements A-SPEC-779 \u2014 never from inside a run; a run's awaited request only from a terminal.
1050
1078
  const { grantGuard } = require('../guardrail/run-refusals');
1051
- const guarded = grantGuard(root, ref.id, { env: process.env, interactive: process.stdin.isTTY === true && process.stdout.isTTY === true });
1079
+ // @implements A-SPEC-779.4 \u2014 and never from a process an agent harness started.
1080
+ const guarded = operatorRefusal(`a grant of ${ref.id}`)
1081
+ ?? grantGuard(root, ref.id, { env: process.env, interactive: process.stdin.isTTY === true && process.stdout.isTTY === true });
1052
1082
  if (guarded !== null) {
1053
1083
  // @implements A-SPEC-779.1 \u2014 the refusal carries its envelope, so an orchestrator reads its class.
1054
1084
  const { withRefusalLine } = require('../guardrail/refusal-codes');
@@ -1173,6 +1203,8 @@ async function main(argv) {
1173
1203
  process.stderr.write('✗ interactive resident mode (--watch) requires a TTY — use --list in scripts\n');
1174
1204
  return 1;
1175
1205
  }
1206
+ if (refuseOperatorAct('the approval screen (--watch)'))
1207
+ return 1; // @implements A-SPEC-779.4
1176
1208
  // @implements A-SPEC-497.2 — the resident surface decides on ONE raw keypress (a/d/q/s, no
1177
1209
  // Enter, no deadline) and pings the OS on each new arrival. Raw mode is restored on the way
1178
1210
  // out whatever happens; Ctrl-C arrives as \x03 through decideByKey and ends the loop.
@@ -1216,6 +1248,8 @@ async function main(argv) {
1216
1248
  process.stdout.write(renderPending(state, listView) + (hint ? '\n\n' + hint : '') + '\n');
1217
1249
  return 0;
1218
1250
  }
1251
+ if (refuseOperatorAct('the approval screen'))
1252
+ return 1; // @implements A-SPEC-779.4
1219
1253
  // @implements A-SPEC-262.1
1220
1254
  // AWAITED, not fire-and-forget. Measured 2026-08-25 against the shipped bin with a real pty: the
1221
1255
  // prompt printed and the session ended with zero grants, because `void runInteractive(...)`
@@ -30,6 +30,11 @@ export declare const DECISION_KINDS: ReadonlySet<string>;
30
30
  */
31
31
  export declare function requestLabel(kind: string | undefined, target: string | undefined, title: string | undefined): string;
32
32
  export declare function pendingRequestLine(id: string, kind?: string, root?: string, title?: string, target?: string): string;
33
+ /**
34
+ * @implements A-SPEC-718.5 — the in-session route, addressed to the agent: since A-SPEC-779.4 neither the agent's shell
35
+ * nor the session's `!` can type the operator line above, so without this line an agent has no way to ask.
36
+ */
37
+ export declare function approvalAskLine(id: string): string;
33
38
  export interface RefusalRecord {
34
39
  event: 'requested';
35
40
  id: string;
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.DECISION_KINDS = exports.QUEUE_RELPATH = void 0;
37
37
  exports.requestLabel = requestLabel;
38
38
  exports.pendingRequestLine = pendingRequestLine;
39
+ exports.approvalAskLine = approvalAskLine;
39
40
  exports.refusalsFilename = refusalsFilename;
40
41
  exports.isRefusalsFilename = isRefusalsFilename;
41
42
  exports.readRefusals = readRefusals;
@@ -126,9 +127,17 @@ function pendingRequestLine(id, kind, root, title, target) {
126
127
  // @implements A-SPEC-770.1 — the id rides the `--grant` flag: the CLI refuses a positional id (`unexpected
127
128
  // argument: req-…`, measured by the operator on 0.35.17 with the command this line used to name).
128
129
  if (kind !== undefined && !exports.DECISION_KINDS.has(kind)) {
129
- return `\n[승인 대기 ${id}${label}] 운영자: ${command} --grant ${id}${targetFlag} — 인박스 화면에는 뜨지 않는 거부입니다(${command} --refusals${targetFlag} 로 조회)`;
130
+ return `\n[승인 대기 ${id}${label}] 운영자: ${command} --grant ${id}${targetFlag} — 인박스 화면에는 뜨지 않는 거부입니다(${command} --refusals${targetFlag} 로 조회)${approvalAskLine(id)}`;
130
131
  }
131
- return root === undefined ? `\n[승인 대기 ${id}${label}] 운영자: ${command}` : `\n[승인 대기 ${id}${label}] 운영자: ${command} --grant ${id}${targetFlag}`;
132
+ return root === undefined ? `\n[승인 대기 ${id}${label}] 운영자: ${command}${approvalAskLine(id)}` : `\n[승인 대기 ${id}${label}] 운영자: ${command} --grant ${id}${targetFlag}${approvalAskLine(id)}`;
133
+ }
134
+ /**
135
+ * @implements A-SPEC-718.5 — the in-session route, addressed to the agent: since A-SPEC-779.4 neither the agent's shell
136
+ * nor the session's `!` can type the operator line above, so without this line an agent has no way to ask.
137
+ */
138
+ function approvalAskLine(id) {
139
+ // Two rows, each inside the 80-column screen rule the approval screens hold (approve-corpus).
140
+ return `\nAgent: call approval_ask with id "${id}" — the person decides\nin this session's approval form; after granted, retry once.`;
132
141
  }
133
142
  const REFUSALS_FILE_RE = /^refusals\.([^.]+)\.jsonl$/;
134
143
  function refusalsFilename(replica) {
@@ -98,7 +98,9 @@ function runPushReviewRefusal(cwd, env, sha) {
98
98
  if (g.ok)
99
99
  return null;
100
100
  return `[Holmes-Kit push gate] the run's commits ${rec.base}..${sha} are not reviewed (${g.reasons.join('; ')}) — an independent reviewer records a verdict with `
101
- + `holmes-kit review record --base ${rec.base} --head ${sha} --verdict pass`;
101
+ + `holmes-kit review record --base ${rec.base} --head ${sha} --verdict pass`
102
+ // @implements A-SPEC-102.9 — a person in the session answers the same verdict in the form.
103
+ + ` (a person in the session: review_verdict with base ${rec.base}, head ${sha})`;
102
104
  }
103
105
  catch (e) {
104
106
  return cannot(e instanceof Error ? e.message : String(e));
@@ -40,6 +40,10 @@ exports.TOOL_ACTIONS = {
40
40
  issue_localize: NONE, maintenance_calibration: NONE, impact_gate_check: NONE, rtm_impact: NONE, rtm_reindex: NONE,
41
41
  context_bundle: NONE, review_scope: NONE, review_prepare: NONE, review_status: NONE, reverse_scan: NONE,
42
42
  approval_status: NONE, rtm_dashboard: NONE,
43
+ // @implements A-SPEC-718.4 — the person decides in the form; the agent only asks, so no role act is the agent's.
44
+ approval_ask: NONE,
45
+ // @implements A-SPEC-102.9 — it writes a review verdict, the act a role policy names RECORD_REVIEW.
46
+ review_verdict: always('RECORD_REVIEW'),
43
47
  // approval_commit changes only the server's in-memory continuation; the act it completes is spec_approve's
44
48
  approval_commit: always('APPROVE_SPEC'),
45
49
  // evidence
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Who may grant. The refusal text prints the very command that approves it, so a model following that text from its
3
+ * own shell approved itself (measured on 0.36.1). A granting act here refuses a process that an agent harness started:
4
+ * its environment marker (A-SPEC-102.7), a harness among its parents (A-SPEC-102.8), or parents that cannot be read.
5
+ * A person's terminal and a CI operator without a TTY are unchanged. Named residual: a script that loads these modules
6
+ * and calls `grantRequest` itself, or a process reparented away with its markers removed, is the same user.
7
+ */
8
+ import { HarnessAncestry } from '../review/verdicts';
9
+ /** Null for a person's process, else why it is not one. */
10
+ export type OperatorProbe = () => string | null;
11
+ export declare function agentProcessReason(env: NodeJS.ProcessEnv, ancestry: () => HarnessAncestry): string | null;
12
+ /** Test seam only: code that can call this can call grantRequest itself, so it adds no authority. */
13
+ export declare function setOperatorProbeForTests(next: OperatorProbe | null): void;
14
+ export declare function operatorActGuard(act: string): string | null;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.agentProcessReason = agentProcessReason;
4
+ exports.setOperatorProbeForTests = setOperatorProbeForTests;
5
+ exports.operatorActGuard = operatorActGuard;
6
+ // @implements A-SPEC-779.4
7
+ /**
8
+ * Who may grant. The refusal text prints the very command that approves it, so a model following that text from its
9
+ * own shell approved itself (measured on 0.36.1). A granting act here refuses a process that an agent harness started:
10
+ * its environment marker (A-SPEC-102.7), a harness among its parents (A-SPEC-102.8), or parents that cannot be read.
11
+ * A person's terminal and a CI operator without a TTY are unchanged. Named residual: a script that loads these modules
12
+ * and calls `grantRequest` itself, or a process reparented away with its markers removed, is the same user.
13
+ */
14
+ const verdicts_1 = require("../review/verdicts");
15
+ const harness_attestation_1 = require("../mcp/harness-attestation");
16
+ function agentProcessReason(env, ancestry) {
17
+ const marker = (0, verdicts_1.agentHarnessMarker)(env);
18
+ if (marker !== null)
19
+ return marker;
20
+ const walk = ancestry();
21
+ if (walk.kind === 'harness')
22
+ return `process:${walk.harness}`;
23
+ if (walk.kind === 'unreadable')
24
+ return `the parent processes cannot be read (${walk.reason})`;
25
+ return null;
26
+ }
27
+ const liveProbe = () => agentProcessReason(process.env, () => (0, verdicts_1.harnessAncestor)(process.ppid, (0, harness_attestation_1.systemProcLookup)()));
28
+ let probe = liveProbe;
29
+ /** Test seam only: code that can call this can call grantRequest itself, so it adds no authority. */
30
+ function setOperatorProbeForTests(next) { probe = next ?? liveProbe; }
31
+ function operatorActGuard(act) {
32
+ const why = probe();
33
+ return why === null ? null
34
+ : `${act} is the operator's — this process runs under an agent harness (${why}). `
35
+ + 'The operator decides in the session\'s approval dialog, or from their own terminal.';
36
+ }
@@ -57,7 +57,8 @@ exports.REFUSAL_CODES = [
57
57
  // @implements A-SPEC-779.1 — a grant refused because it is not the operator's, or a run may await it.
58
58
  code: 'grant.operator-only', class: 'needs_hitl',
59
59
  remediation: ['the operator grants the request from their own terminal'],
60
- test: /a grant is the operator's|is awaited by run|cannot tell whether a run awaits/i,
60
+ // @implements A-SPEC-779.4 — and a granting act from a process an agent harness started.
61
+ test: /a grant is the operator's|is awaited by run|cannot tell whether a run awaits|runs under an agent harness/i,
61
62
  },
62
63
  {
63
64
  // @implements A-SPEC-476.4 — a run cannot change an owner cap in ax.config.json (A-SPEC-476.3).
@@ -67,7 +68,8 @@ exports.REFUSAL_CODES = [
67
68
  },
68
69
  {
69
70
  code: 'approval.required', class: 'needs_hitl',
70
- remediation: ['the act needs an operator approval', 'run the approve command the refusal names, or ask the operator'],
71
+ // @implements A-SPEC-718.5 — the in-session route first; the terminal command is the operator's alternative.
72
+ remediation: ['call approval_ask with the request id — the person decides in the session form', 'or the operator runs the approve command the refusal names'],
71
73
  // @implements A-SPEC-476.4 — and raising an owner cap, or a shell write over one (A-SPEC-476.3).
72
74
  test: /hard-hitl|Integrity\]|Governance Path Destruction|requires operator|raises or removes a project cap|sets a project cap/i,
73
75
  },
@@ -936,7 +936,9 @@ function evaluateStop(specs, evidence) {
936
936
  if (evidence?.reviewGate) {
937
937
  const g = evidence.reviewGate;
938
938
  const detail = `the run's commits ${g.base}..${g.head} are not reviewed (${g.reasons.join('; ')}) — an independent reviewer records a verdict with `
939
- + `holmes-kit review record --base ${g.base} --head ${g.head} --verdict pass`;
939
+ + `holmes-kit review record --base ${g.base} --head ${g.head} --verdict pass`
940
+ // @implements A-SPEC-102.9 — a person in the session answers the same verdict in the form.
941
+ + ` (a person in the session: review_verdict with base ${g.base}, head ${g.head})`;
940
942
  problems.push(`[ART-7] ${detail}`);
941
943
  structured.push({ article: 'ART-7', detail });
942
944
  }
@@ -62,6 +62,8 @@ export type Elicitor = (req: ElicitApprovalRequest) => Promise<ElicitOutcome>;
62
62
  * the findings-ledger lock while the dialog waits, so its ceiling never grows (REQ-497 기아 방지).
63
63
  */
64
64
  export declare const ELICIT_TIMEOUT_MS = 120000;
65
+ /** @implements A-SPEC-718.6 — a form that holds no lock waits for the person (owner, 2026-10-04: "wait until I decide"). */
66
+ export declare const WAIT_FOR_PERSON_MS: number;
65
67
  /**
66
68
  * Per-path dialog deadline — the ONE number the ⏱ forewarning, the SDK timeout option and the
67
69
  * summed `waitedMs` all derive from. Lock-free kinds (spec-approve) get 240s: nothing starves
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MAX_PRESENTATIONS = exports.ELICIT_TIMEOUT_MS = exports.ELICITABLE_KINDS = void 0;
3
+ exports.MAX_PRESENTATIONS = exports.WAIT_FOR_PERSON_MS = exports.ELICIT_TIMEOUT_MS = exports.ELICITABLE_KINDS = void 0;
4
4
  exports.elicitationDisabled = elicitationDisabled;
5
5
  exports.elicitTimeoutMsFor = elicitTimeoutMsFor;
6
6
  exports.classifyElicitError = classifyElicitError;
@@ -53,6 +53,8 @@ function elicitationDisabled(env) {
53
53
  * the findings-ledger lock while the dialog waits, so its ceiling never grows (REQ-497 기아 방지).
54
54
  */
55
55
  exports.ELICIT_TIMEOUT_MS = 120_000;
56
+ /** @implements A-SPEC-718.6 — a form that holds no lock waits for the person (owner, 2026-10-04: "wait until I decide"). */
57
+ exports.WAIT_FOR_PERSON_MS = 24 * 60 * 60 * 1000;
56
58
  // @implements A-SPEC-497.3
57
59
  /**
58
60
  * Per-path dialog deadline — the ONE number the ⏱ forewarning, the SDK timeout option and the
@@ -61,7 +63,8 @@ exports.ELICIT_TIMEOUT_MS = 120_000;
61
63
  * lock-holding kind keeps 120s (see ELICIT_TIMEOUT_MS above).
62
64
  */
63
65
  function elicitTimeoutMsFor(kind) {
64
- return kind === 'review-resolve' ? exports.ELICIT_TIMEOUT_MS : 240_000;
66
+ // @implements A-SPEC-718.6 — the 240 s the owner rejected is gone: a lock-free form waits for the person.
67
+ return kind === 'review-resolve' ? exports.ELICIT_TIMEOUT_MS : exports.WAIT_FOR_PERSON_MS;
65
68
  }
66
69
  // @implements A-SPEC-497.3
67
70
  /**
@@ -110,7 +113,10 @@ const flat = (s, max) => s.replace(/[\u0000-\u001f\u007f\u0085\u2028\u2029\u200b
110
113
  function buildDecisionForm(req, attempt, timeoutMs) {
111
114
  const redisplay = attempt > 1 ? `⚠ 재표시 ${attempt}/${exports.MAX_PRESENTATIONS} — 이전 다이얼로그는 만료되어 무효입니다\n` : '';
112
115
  // @implements A-SPEC-718.2 — one outcome for silence, in every mode: the request returns to the queue.
113
- const timeoutNotice = `⏱ ${timeoutMs / 1000}초 내 미결정 시 승인 큐로 회송됩니다(운영자: ${(0, npx_bin_1.holmesKitCommand)()} approve).`;
116
+ // @implements A-SPEC-718.6 — a form that waits for the person says so instead of counting seconds.
117
+ const timeoutNotice = timeoutMs >= exports.WAIT_FOR_PERSON_MS
118
+ ? `⏱ 결정할 때까지 기다립니다 — 결정 없이 세션이 끝나면 요청은 승인 큐에 남습니다(운영자: ${(0, npx_bin_1.holmesKitCommand)()} approve).`
119
+ : `⏱ ${timeoutMs / 1000}초 내 미결정 시 승인 큐로 회송됩니다(운영자: ${(0, npx_bin_1.holmesKitCommand)()} approve).`;
114
120
  return {
115
121
  // @implements A-SPEC-497.1 — the forewarning is the LAST line and template-owned: it survives a
116
122
  // cap-filling summary (appended after the caps) and tells the human, before the clock runs out,
@@ -0,0 +1,19 @@
1
+ import type { Elicitor } from '../elicit-approval';
2
+ export interface ApprovalAskContext {
3
+ rootOf: (root: string | undefined) => string;
4
+ elicit?: Elicitor;
5
+ clientName: () => string;
6
+ attestation: () => {
7
+ attested: boolean;
8
+ reason?: string;
9
+ };
10
+ env: () => NodeJS.ProcessEnv;
11
+ }
12
+ /** Clients whose form waits for the person in every mode measured (claude-code: forms expired unanswered, 2026-10-19). */
13
+ export declare const FORM_WAITS_FOR_PERSON: ReadonlySet<string>;
14
+ export declare function createApprovalAskHandlers(context: ApprovalAskContext): {
15
+ approval_ask(a: {
16
+ root?: string;
17
+ id: string;
18
+ }): Promise<Record<string, unknown>>;
19
+ };
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FORM_WAITS_FOR_PERSON = void 0;
4
+ exports.createApprovalAskHandlers = createApprovalAskHandlers;
5
+ // @implements A-SPEC-718.4
6
+ /**
7
+ * approval_ask — the person decides a pending request in the session's approval form, so no approval needs a typed
8
+ * command (owner audit 2026-10-20). Since A-SPEC-779.4 neither the agent's shell nor the session's `!` can run
9
+ * `approve --grant`; this tool is the in-session route. The agent only asks: what is recorded is the person's answer,
10
+ * through the same grant, denial and hold functions the CLI calls, so a refused act's retry finds an ordinary grant.
11
+ *
12
+ * A hard-HITL kind (outside ELICITABLE_KINDS) is asked only on a client measured to wait for a person: a client that
13
+ * answers forms by itself would turn this tool into self-approval (the A-SPEC-551.1 side door).
14
+ */
15
+ const elicit_approval_1 = require("../elicit-approval");
16
+ const approval_queue_1 = require("../../governance/approval-queue");
17
+ const approve_1 = require("../../cli/approve");
18
+ const npx_bin_1 = require("../../project/npx-bin");
19
+ const screen_safe_1 = require("../../cli/screen-safe");
20
+ /** Clients whose form waits for the person in every mode measured (claude-code: forms expired unanswered, 2026-10-19). */
21
+ exports.FORM_WAITS_FOR_PERSON = new Set(['claude-code']);
22
+ /** The one line the form shows for a request's field: the screen-safe flattening the approval screens use. */
23
+ const oneLine = (s, max) => (0, screen_safe_1.flattenField)(s, max);
24
+ /** interpretElicitResult's reasons: a client's automatic decline is not a person's denial, and a question holds. */
25
+ const AUTOMATIC_DECLINE = 'the session client declined the approval form';
26
+ const QUESTION = '질문: ';
27
+ const RUN = ['HOLMES', 'RUN', 'ID'].join('_');
28
+ function createApprovalAskHandlers(context) {
29
+ return {
30
+ async approval_ask(a) {
31
+ const root = context.rootOf(a.root);
32
+ const id = typeof a.id === 'string' ? a.id.trim() : '';
33
+ const fallback = `The operator can decide it from their own terminal: ${(0, npx_bin_1.holmesKitCommand)()} approve --grant ${id} --target ${root}`;
34
+ const refuse = (why) => ({ ok: false, id, reason: `${why}. ${fallback}` });
35
+ // @implements A-SPEC-779.5 — a run's own server never asks; a request a run awaits is the person's to decide in the
36
+ // interactive session's form (owner, 2026-10-20). The CLI keeps A-SPEC-779's terminal-only rule (grantGuard).
37
+ const runMarker = context.env()[RUN];
38
+ if (typeof runMarker === 'string' && runMarker.trim() !== '') {
39
+ return refuse('a run\'s own server does not ask; the session that started the run asks the person');
40
+ }
41
+ const request = (0, approval_queue_1.grantableRequests)(root).find((p) => p.id === id);
42
+ if (!request)
43
+ return { ok: false, id, reason: `no pending request ${oneLine(id, 40)} in the approval inbox or this machine's refusal log` };
44
+ const client = context.clientName();
45
+ const attestation = context.attestation();
46
+ if ((0, elicit_approval_1.elicitationDisabled)(context.env()))
47
+ return refuse('this session cannot show an approval form (HOLMES_ELICIT is off)');
48
+ if (!attestation.attested)
49
+ return refuse(`this session cannot show an approval form (${attestation.reason ?? 'not launched by a harness'})`);
50
+ if (!context.elicit)
51
+ return refuse('this session cannot show an approval form (the client did not advertise forms)');
52
+ if (!elicit_approval_1.ELICITABLE_KINDS.has(request.kind) && !exports.FORM_WAITS_FOR_PERSON.has(client)) {
53
+ return refuse(`a ${request.kind} approval in the form is not yet measured for ${client} (it might answer forms by itself)`);
54
+ }
55
+ const title = typeof request.title === 'string' && request.title.trim() !== '' ? ` 「${oneLine(request.title, 80)}」` : '';
56
+ const outcome = await context.elicit({
57
+ kind: request.kind,
58
+ target: oneLine(request.target, 400),
59
+ summary: `${id}${title} — ${oneLine(request.why, 120)}`,
60
+ });
61
+ const actor = `elicitation:${client}`;
62
+ const base = { ok: true, id, kind: request.kind };
63
+ if (outcome.kind !== 'answered') {
64
+ return { ...base, decision: 'undecided', nextAction: 'Nobody answered the form; the request is still pending. Ask again when the person is there.' };
65
+ }
66
+ const { granted, reason } = outcome.decision;
67
+ if (granted) {
68
+ const r = (0, approve_1.grantRequest)(root, id, { actor, rationale: reason ?? `approved in the session form (${client})` });
69
+ if (!r.ok)
70
+ return { ok: false, id, reason: r.reason };
71
+ return { ...base, decision: 'granted', nextAction: 'Retry the refused act once; the grant covers it.' };
72
+ }
73
+ if (typeof reason === 'string' && reason.startsWith(AUTOMATIC_DECLINE)) {
74
+ return { ...base, decision: 'undecided', nextAction: `The client declined the form without a person. ${fallback}` };
75
+ }
76
+ if (typeof reason === 'string' && reason.startsWith(QUESTION)) {
77
+ const r = (0, approve_1.holdRequest)(root, id, reason.slice(QUESTION.length), actor);
78
+ if (!r.ok)
79
+ return { ok: false, id, reason: r.reason };
80
+ return { ...base, decision: 'held', question: reason.slice(QUESTION.length), nextAction: 'Answer the person\'s question, then ask again.' };
81
+ }
82
+ const why = reason ?? 'denied in the session form';
83
+ const r = (0, approve_1.denyRequest)(root, id, why, actor);
84
+ if (!r.ok)
85
+ return { ok: false, id, reason: r.reason };
86
+ return { ...base, decision: 'denied', reason: why, nextAction: 'Do not retry the act; the person denied it.' };
87
+ },
88
+ };
89
+ }
@@ -0,0 +1,18 @@
1
+ import type { Elicitor } from '../elicit-approval';
2
+ export interface ReviewVerdictContext {
3
+ rootOf: (root: string | undefined) => string;
4
+ elicit?: Elicitor;
5
+ clientName: () => string;
6
+ attestation: () => {
7
+ attested: boolean;
8
+ reason?: string;
9
+ };
10
+ env: () => NodeJS.ProcessEnv;
11
+ }
12
+ export declare function createReviewVerdictHandlers(context: ReviewVerdictContext): {
13
+ review_verdict(a: {
14
+ root?: string;
15
+ base: string;
16
+ head: string;
17
+ }): Promise<Record<string, unknown>>;
18
+ };
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createReviewVerdictHandlers = createReviewVerdictHandlers;
4
+ // @implements A-SPEC-102.9
5
+ /**
6
+ * review_verdict — the person records an independent review verdict in the session's approval form. A-SPEC-102.7/102.8
7
+ * make a CLI verdict independent only from a person's own terminal, so a review meant leaving the session (the owner's
8
+ * `!` record during the 0.36.1 release came out independent:false). The form is answered by the person, not the model,
9
+ * so the answer is recorded as the person's — on a client measured to wait for a person (A-SPEC-718.4).
10
+ */
11
+ const elicit_approval_1 = require("../elicit-approval");
12
+ const verdicts_1 = require("../../review/verdicts");
13
+ const approval_ask_1 = require("./approval-ask");
14
+ /** interpretElicitResult's reasons: a client's automatic decline and a question are not a verdict. */
15
+ const AUTOMATIC_DECLINE = 'the session client declined the approval form';
16
+ const QUESTION = '질문: ';
17
+ const RUN = ['HOLMES', 'RUN', 'ID'].join('_');
18
+ function createReviewVerdictHandlers(context) {
19
+ return {
20
+ async review_verdict(a) {
21
+ const root = context.rootOf(a.root);
22
+ const env = context.env();
23
+ const fallback = `The person can record it from their own terminal: holmes-kit review record --base ${a.base} --head ${a.head} --verdict pass`;
24
+ const refuse = (why) => ({ ok: false, reason: `${why}. ${fallback}` });
25
+ const marker = env[RUN];
26
+ if (typeof marker === 'string' && marker.trim() !== '')
27
+ return refuse('a run\'s own server does not ask for a person\'s verdict');
28
+ const client = context.clientName();
29
+ const attestation = context.attestation();
30
+ if ((0, elicit_approval_1.elicitationDisabled)(env))
31
+ return refuse('this session cannot show an approval form (HOLMES_ELICIT is off)');
32
+ if (!attestation.attested)
33
+ return refuse(`this session cannot show an approval form (${attestation.reason ?? 'not launched by a harness'})`);
34
+ if (!context.elicit)
35
+ return refuse('this session cannot show an approval form (the client did not advertise forms)');
36
+ if (!approval_ask_1.FORM_WAITS_FOR_PERSON.has(client))
37
+ return refuse(`a review verdict in the form is not yet measured for ${client} (it might answer forms by itself)`);
38
+ const range = (0, verdicts_1.resolveRange)(root, a.base, a.head);
39
+ if ('error' in range)
40
+ return { ok: false, reason: range.error };
41
+ const touched = (0, verdicts_1.rangeAnchors)(root, range.base, range.head);
42
+ const files = 'error' in touched ? '?' : String(touched.files.length);
43
+ const specs = 'error' in touched || touched.aspecs.length === 0 ? 'no A-SPEC anchors'
44
+ : `${touched.aspecs.slice(0, 6).join(', ')}${touched.aspecs.length > 6 ? ` +${touched.aspecs.length - 6}` : ''}`;
45
+ const target = `${range.base.slice(0, 8)}..${range.head.slice(0, 8)}`;
46
+ const outcome = await context.elicit({
47
+ kind: 'review-verdict',
48
+ target,
49
+ summary: `review verdict — approve records pass, deny records fail with your reason · ${files} files · ${specs}`,
50
+ });
51
+ if (outcome.kind !== 'answered')
52
+ return { ok: true, decision: 'undecided', nextAction: 'Nobody answered the form; no verdict was recorded.' };
53
+ const { granted, reason } = outcome.decision;
54
+ if (!granted && typeof reason === 'string' && (reason.startsWith(AUTOMATIC_DECLINE) || reason.startsWith(QUESTION))) {
55
+ return { ok: true, decision: 'undecided', ...(reason.startsWith(QUESTION) ? { question: reason.slice(QUESTION.length) } : {}),
56
+ nextAction: reason.startsWith(QUESTION) ? 'Answer the person\'s question, then ask again.' : `The client declined the form without a person. ${fallback}` };
57
+ }
58
+ const r = (0, verdicts_1.recordVerdict)(root, {
59
+ base: range.base, head: range.head, verdict: granted ? 'pass' : 'fail',
60
+ findings: granted ? [] : [reason ?? 'failed in the session form'],
61
+ }, { env, cwd: root, interactive: false, answeredBy: `elicitation:${client}` });
62
+ if (!r.ok)
63
+ return { ok: false, reason: r.reason };
64
+ return { ok: true, decision: r.record.verdict, independent: r.record.independent, base: range.base, head: range.head };
65
+ },
66
+ };
67
+ }
@@ -387,6 +387,15 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
387
387
  operation?: string;
388
388
  plan?: unknown;
389
389
  }) => Promise<Record<string, unknown>>;
390
+ approval_ask: (a: {
391
+ root?: string;
392
+ id: string;
393
+ }) => Promise<Record<string, unknown>>;
394
+ review_verdict: (a: {
395
+ root?: string;
396
+ base: string;
397
+ head: string;
398
+ }) => Promise<Record<string, unknown>>;
390
399
  rtm_impact: (a: {
391
400
  root: string;
392
401
  changed: string[];
@@ -74,6 +74,8 @@ const runtime_binding_tool_1 = require("./handlers/runtime-binding-tool");
74
74
  const runtime_binding_1 = require("../cli/runtime-binding");
75
75
  const workspace_preflight_1 = require("./handlers/workspace-preflight");
76
76
  const operator_inspection_1 = require("./handlers/operator-inspection");
77
+ const approval_ask_1 = require("./handlers/approval-ask");
78
+ const review_verdict_1 = require("./handlers/review-verdict");
77
79
  const phase_queries_1 = require("./handlers/phase-queries");
78
80
  const risk_assessment_1 = require("./handlers/risk-assessment");
79
81
  const adoption_1 = require("./handlers/adoption");
@@ -858,6 +860,27 @@ function makeRawHandlers(store, opts) {
858
860
  return { kind: 'silent' };
859
861
  }
860
862
  };
863
+ // @implements A-SPEC-718.4 — the in-session route for every pending request: the person answers the form, and the
864
+ // answer is recorded through the CLI's own decision functions. The root is the caller's, checked against the store.
865
+ const formContext = {
866
+ rootOf: (root) => {
867
+ const foreign = foreignRootReason(store, root);
868
+ if (foreign)
869
+ throw new HandlerRefusal(foreign);
870
+ if (typeof root === 'string' && root !== '')
871
+ return projectRootOf(root);
872
+ if (store instanceof spec_store_1.LocalMarkdownRepository)
873
+ return projectRootOf(store.specsRoot);
874
+ throw new HandlerRefusal('this tool needs root: this server is not bound to a file store');
875
+ },
876
+ elicit: opts?.elicit,
877
+ clientName: () => opts?.clientName?.() ?? 'unknown',
878
+ attestation,
879
+ env: () => process.env,
880
+ };
881
+ const approvalAsk = (0, approval_ask_1.createApprovalAskHandlers)(formContext);
882
+ // @implements A-SPEC-102.9 — the person's review verdict, answered in the same form.
883
+ const reviewVerdict = (0, review_verdict_1.createReviewVerdictHandlers)(formContext);
861
884
  // A granted answer becomes a synthesized Approval that rides the EXISTING seal path unchanged —
862
885
  // the ledger's authorizationRef then honestly names the channel (`elicitation:<client>`), and
863
886
  // single-use is structural: the object exists only inside this call, persisted nowhere.
@@ -1072,6 +1095,8 @@ function makeRawHandlers(store, opts) {
1072
1095
  }),
1073
1096
  // @implements A-SPEC-700.2 — same unpinned slot: `spec_retire..spec_unseal` is a pinned run.
1074
1097
  spec_reconcile: specLifecycle.spec_reconcile,
1098
+ approval_ask: approvalAsk.approval_ask, // @implements A-SPEC-718.4 — a slot no pinned key order covers
1099
+ review_verdict: reviewVerdict.review_verdict, // @implements A-SPEC-102.9
1075
1100
  rtm_impact: graphOperations.rtm_impact,
1076
1101
  rtm_reindex: graphOperations.rtm_reindex,
1077
1102
  context_bundle: reviewQueries.context_bundle,
@@ -64,7 +64,9 @@ function operatorRecovery(root, target, operation, options) {
64
64
  return `\n[승인 대기 ${id}${label}] 운영자: ${command} --grant ${literal(id, platform)}`
65
65
  + `\nOr keep the approval surface open and decide each arriving request with one key: ${command} --watch`
66
66
  + `\nAfter official approval, retry ${operation ? display(operation) : 'the original MCP operation'} for target ${display(target)} in the same workspace. Do not retry until approval is available.`
67
- + '\nAgent: check approval_status for the target; sealed:true or request.state granted means retry now — polling a sealed spec is wasted; request.state held carries the operator\'s question.';
67
+ // @implements A-SPEC-718.5 — the in-session route first: the person answers the form, nobody types a command.
68
+ + `\nAgent: call approval_ask with id "${id}" — the person decides in this session's approval form; after granted, retry once.`
69
+ + ' Otherwise check approval_status for the target; sealed:true or request.state granted means retry now — polling a sealed spec is wasted; request.state held carries the operator\'s question.';
68
70
  },
69
71
  };
70
72
  }
@@ -223,6 +223,31 @@ exports.TOOL_SCHEMAS = {
223
223
  required: ['id'],
224
224
  },
225
225
  },
226
+ // @implements A-SPEC-718.4
227
+ approval_ask: {
228
+ description: "Ask the person to decide ONE pending approval request in this session's approval form — the id a refusal named (`[승인 대기 req-…]`), from the approval inbox or this machine's refusal log. The person chooses approve / deny / question; the answer is recorded exactly as `holmes-kit approve --grant/--deny/--ask` would record it (actor `elicitation:<client>`), so after `granted` retry the refused act once. Returns { ok, id, kind, decision: granted|denied|held|undecided, nextAction }. Nothing is recorded without the person's answer: silence leaves the request pending. A request a run awaits is asked here too, from the interactive session (the run resumes on the grant). Refuses, recording nothing, from a run's own server, when the session cannot show a form (HOLMES_ELICIT=off, a server no harness launched, a client without forms), and for a shell/config/code-write request on a client not yet measured to wait for a person (only claude-code today).",
229
+ inputSchema: {
230
+ type: 'object',
231
+ properties: {
232
+ id: str('The request id the refusal named, e.g. req-0123456789ab.'),
233
+ root: str('Optional when the server is bound to a file store; if supplied it must resolve to the SAME project.'),
234
+ },
235
+ required: ['id'],
236
+ },
237
+ },
238
+ // @implements A-SPEC-102.9
239
+ review_verdict: {
240
+ description: "Ask the person for an independent review verdict on base..head in this session's approval form. approve records pass, deny records fail with the person's reason as the finding; the verdict is recorded as the person's (reviewer.person true, channel elicitation:<client>, independent true), so it satisfies the review gate without a separate terminal. Returns { ok, decision: pass|fail|undecided, independent? }. Silence, a question and an automatic decline record nothing. Refuses, recording nothing, inside a run, when the session cannot show a form, and on a client not yet measured to wait for a person (only claude-code today).",
241
+ inputSchema: {
242
+ type: 'object',
243
+ properties: {
244
+ base: str('Base revision of the reviewed range (a commit id or ref).'),
245
+ head: str('Head revision of the reviewed range.'),
246
+ root: str('Optional when the server is bound to a file store; if supplied it must resolve to the SAME project.'),
247
+ },
248
+ required: ['base', 'head'],
249
+ },
250
+ },
226
251
  ledger_timeline: {
227
252
  description: "Read-only: return the provenance ledger's events in time order — { events: [{ ts, kind, actor, summary, inputs }] } ascending by ts (tiebroken by chain seq). Pass an `id` to narrow to one spec (only events whose `inputs` reference it: spec-approved, spec-unsealed, spec-retired, review-needed …). The chain-integrity fields (hash/prevHash/seq/replicaId) are plumbing and are projected away — this is the governance history, not the tamper-evidence chain. No writes. An absent ledger is an empty history, not an error.",
228
253
  inputSchema: {
@@ -19,12 +19,14 @@ export interface VerdictRecord {
19
19
  verdict: 'pass' | 'fail';
20
20
  findings: string[];
21
21
  /** `harness`: a marker variable, or `process:<name>` for an ancestor (A-SPEC-102.8); `ancestry`: why the process table could not be read. */
22
+ /** `channel`: the session form a person answered through (A-SPEC-102.9). */
22
23
  reviewer: {
23
24
  run?: string;
24
25
  session?: string;
25
26
  engine?: string;
26
27
  model?: string;
27
28
  person: boolean;
29
+ channel?: string;
28
30
  harness?: string;
29
31
  ancestry?: string;
30
32
  };
@@ -79,6 +81,8 @@ export interface VerdictContext {
79
81
  interactive: boolean;
80
82
  now?: () => Date;
81
83
  ancestry?: () => HarnessAncestry;
84
+ /** @implements A-SPEC-102.9 — the form channel a person answered this verdict through; only review_verdict passes it. */
85
+ answeredBy?: string;
82
86
  }
83
87
  export declare const verdictsFile: (main: string) => string;
84
88
  /** Both revisions as full commit ids, or the one that does not resolve. */
@@ -230,14 +230,17 @@ function recordVerdict(root, input, ctx) {
230
230
  if (issue)
231
231
  return { ok: false, reason: issue };
232
232
  }
233
+ // @implements A-SPEC-102.9 — a person answered this verdict in the session's form (review_verdict). The server that
234
+ // asked is under the harness by design, so its markers and parents say nothing about who answered; a run ignores it.
235
+ const answered = !mode.run && typeof ctx.answeredBy === 'string' && ctx.answeredBy !== '';
233
236
  // @implements A-SPEC-102.7 — a person is a terminal outside an agent harness: an agent session's own review is not one.
234
- const marker = agentHarnessMarker(ctx.env);
237
+ const marker = answered ? null : agentHarnessMarker(ctx.env);
235
238
  // @implements A-SPEC-102.8 — the walk runs only when the cheaper conditions already hold.
236
- const ancestry = !mode.run && ctx.interactive && marker === null
239
+ const ancestry = !answered && !mode.run && ctx.interactive && marker === null
237
240
  ? (ctx.ancestry ?? (() => harnessAncestor(process.ppid, (0, harness_attestation_1.systemProcLookup)())))()
238
241
  : { kind: 'none' };
239
242
  const harness = marker ?? (ancestry.kind === 'harness' ? `process:${ancestry.harness}` : null);
240
- const person = !mode.run && ctx.interactive && harness === null && ancestry.kind === 'none';
243
+ const person = answered || (!mode.run && ctx.interactive && harness === null && ancestry.kind === 'none');
241
244
  const touched = rangeAnchors(root, range.base, range.head);
242
245
  const anchored = 'error' in touched ? [] : touched.aspecs;
243
246
  const stated = statedSpecs(root, range.base, range.head);
@@ -253,6 +256,7 @@ function recordVerdict(root, input, ctx) {
253
256
  ...(input.engine ? { engine: input.engine } : {}),
254
257
  ...(input.model ? { model: input.model } : {}),
255
258
  person,
259
+ ...(answered ? { channel: ctx.answeredBy } : {}), // @implements A-SPEC-102.9
256
260
  ...(harness ? { harness } : {}),
257
261
  ...(ancestry.kind === 'unreadable' ? { ancestry: ancestry.reason } : {}),
258
262
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "//": "@implements A-SPEC-209",
3
3
  "name": "@holmes-lab/holmes-kit",
4
- "version": "0.36.1",
4
+ "version": "0.37.0",
5
5
  "description": "Holmes-Kit — deterministic Agentic Software Engineering (ASE) harness with causal traceability (spec chain + D-CPG + RTM + phase guardrail)",
6
6
  "main": "dist/holmes/mcp/server.js",
7
7
  "types": "dist/holmes/mcp/server.d.ts",
@@ -13,8 +13,9 @@ description: >-
13
13
  계산 → `status: approved` + `approved_digest` + 부모 봉인 스냅샷 기록 → 원장 append를 한 번에.
14
14
  손으로 `status:`만 바꾸는 것으로는 부족하다: 봉인 없이 approved가 된 스펙은 `unsealed-approval`로
15
15
  검증에 걸리고, 봉인 후 본문을 고치면 `post-approval-edit`으로, 부모가 움직이면 `stale-parent`로
16
- 걸린다(REQ-132). `spec_approve`는 **서버 환경의** 유효한 `HOLMES_APPROVAL`을 요구한다(fail-closed) —
17
- 요청 인자로는 대체되지 않는다.
16
+ 걸린다(REQ-132). `spec_approve`는 사람의 승인을 요구한다(fail-closed) — 요청 인자로는 대체되지 않는다.
17
+ 사람은 세션의 승인 창에서 답한다. 거부가 `[승인 대기 req-…]`를 지목했다면 `approval_ask`에 그 id를 넘겨
18
+ 창을 띄운다(0.37.0). 창이 없는 세션에서는 운영자가 자기 터미널에서 `holmes-kit approve --grant <id>`로 결정한다.
18
19
 
19
20
  이 플레이북은 그 승인을 **언제·무엇에·어떤 근거로** 하는지를 다룬다. 문서를 새로 쓰는 일이라면
20
21
  이것이 아니라 `author-slice`다 — 판별은 3단계에 있다.