Cook execute 3/N: delta-risk runner (pure gate, no I/O) #51

Merged
pdurlej merged 1 commit from claude-cook3-runner into main 2026-05-30 13:32:04 +02:00
Collaborator

Third execute step for Cook. Pure, deterministic, no I/O.

What

The pre-LLM core of the Cook lane — Iskra's nightly delta-risk feed ("what changed that could bite Piotr"), not an idea generator. One pure pipeline:

raw signals  ->  normalize  ->  fire-gate  ->  request packet | silence

judging_claw/cook_runner.py:

  • CookSignal — a normalized delta-risk signal: source/ref/why/kind + hard (concrete changed-state risk) + piotr_pattern (ties to Piotr himself: a promise, an owed decision, a deadline). Validates source against COOK_EVIDENCE_SOURCES. why is short and paraphrased on purpose.
  • Normalizers (raw → signals):
    • signals_from_judgments — this run's openclaw.judge.v0 output: p0/p1, hard actions (operator_needed/needs_refinement/hermes_candidate), low-confidence, operator escalation. Reuses Judge's already privacy-scrubbed top_caveat as why, so nothing new leaks.
    • signals_from_open_loopsopen-loops.json loops[], promised/working only, with overdue detection from nextCheckpointAt/promisedAt. An open loop is a Piotr-facing promise by definition.
    • signals_from_matrix_search — a sidecar /v1/events/search response. Only the matched marker words enter why (pilnuj/jutro/deadline/nie działa/uciekło), never the raw message text.
  • evaluate_gate — Iskra's runtime spec: ration first (max 1/night), then ≥2 distinct hard refs + a Piotr-pattern signal. Two flags on one target count once — the feed is about his week, not one issue's metadata.
  • run_cook_precheck — pure entry point → a cook_silence_template(reason) object (caller must NOT spend an LLM call) or a request packet for cook_contract.render_cook_prompt.

constants.py: COOK_MAX_PER_NIGHT, COOK_HARD_JUDGE_PRIORITIES/ACTIONS, COOK_ACTIVE_LOOP_STATUSES, COOK_MATRIX_MARKERS. (The older COOK_RATION_PER_JUDGED is now superseded by the 1/night cap; kept as a secondary guard.)

Spec source: issue #46 (Iskra's own answer), refined live ("delta-risk feed, max 1/night, Honcho is per-candidate grounding not the generator").

Boundaries — nothing here is live

The runner does no I/O: no sidecar/Forgejo reads, no LLM call, no grounding-note or issue writes. That is Cook 4/N (nightly wiring + ration enforcement + the staging write), which is production-touching and operator-gated. This PR only makes the fire/silence decision testable.

Recon note for 4/N (operator-gated precondition)

Confirmed live on vps1000: the sidecar's obsidian_write hard-validates root ∈ allowed_obsidian_roots and returns root_not_allowed otherwise. Before 4/N's grounding-note write can land, 01 Projects/Judging Claw/Cook must be added to the sidecar's allowed roots (a gated config change on the running sidecar). Flagging now so it isn't a surprise — the write client (#50) already refuses gold defensively.

Suite: 184 tests OK (157 + 27), py_compile clean.

🤖 Generated with Claude Code

Third execute step for Cook. **Pure, deterministic, no I/O.** ## What The pre-LLM core of the Cook lane — Iskra's nightly **delta-risk feed** ("what changed that could bite Piotr"), not an idea generator. One pure pipeline: ``` raw signals -> normalize -> fire-gate -> request packet | silence ``` `judging_claw/cook_runner.py`: - **`CookSignal`** — a normalized delta-risk signal: `source/ref/why/kind` + `hard` (concrete changed-state risk) + `piotr_pattern` (ties to Piotr himself: a promise, an owed decision, a deadline). Validates `source` against `COOK_EVIDENCE_SOURCES`. `why` is short and paraphrased on purpose. - **Normalizers** (raw → signals): - `signals_from_judgments` — this run's `openclaw.judge.v0` output: `p0/p1`, hard actions (`operator_needed/needs_refinement/hermes_candidate`), low-confidence, operator escalation. Reuses Judge's already privacy-scrubbed `top_caveat` as `why`, so nothing new leaks. - `signals_from_open_loops` — `open-loops.json` `loops[]`, `promised`/`working` only, with overdue detection from `nextCheckpointAt`/`promisedAt`. An open loop is a Piotr-facing promise by definition. - `signals_from_matrix_search` — a sidecar `/v1/events/search` response. **Only the matched marker words enter `why`** (`pilnuj/jutro/deadline/nie działa/uciekło`), never the raw message text. - **`evaluate_gate`** — Iskra's runtime spec: ration first (**max 1/night**), then **≥2 *distinct* hard refs + a Piotr-pattern signal**. Two flags on one target count once — the feed is about his week, not one issue's metadata. - **`run_cook_precheck`** — pure entry point → a `cook_silence_template(reason)` object (caller must NOT spend an LLM call) or a request packet for `cook_contract.render_cook_prompt`. `constants.py`: `COOK_MAX_PER_NIGHT`, `COOK_HARD_JUDGE_PRIORITIES/ACTIONS`, `COOK_ACTIVE_LOOP_STATUSES`, `COOK_MATRIX_MARKERS`. (The older `COOK_RATION_PER_JUDGED` is now superseded by the 1/night cap; kept as a secondary guard.) Spec source: issue #46 (Iskra's own answer), refined live ("delta-risk feed, max 1/night, Honcho is per-candidate grounding not the generator"). ## Boundaries — nothing here is live The runner does **no I/O**: no sidecar/Forgejo reads, no LLM call, no grounding-note or issue writes. That is Cook 4/N (nightly wiring + ration enforcement + the staging write), which is **production-touching and operator-gated**. This PR only makes the fire/silence decision testable. ## Recon note for 4/N (operator-gated precondition) Confirmed live on vps1000: the sidecar's `obsidian_write` hard-validates `root ∈ allowed_obsidian_roots` and returns `root_not_allowed` otherwise. Before 4/N's grounding-note write can land, **`01 Projects/Judging Claw/Cook` must be added to the sidecar's allowed roots** (a gated config change on the running sidecar). Flagging now so it isn't a surprise — the write client (#50) already refuses gold defensively. Suite: **184 tests OK** (157 + 27), `py_compile` clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Add Cook delta-risk runner (Cook execute 3/N)
All checks were successful
CI / test (pull_request) Successful in 19s
1e56c772fc
Deterministic, pure pre-LLM core of the Cook lane: signals -> gate ->
request packet | silence. No I/O — no sidecar/Forgejo reads, no LLM call,
no writes. That keeps Iskra's fire decision unit-testable and stops Cook
from spending an LLM call (or Piotr's attention) until the bar is cleared.

cook_runner.py:
- CookSignal: normalized delta-risk signal (source/ref/why/kind + hard +
  piotr_pattern), validates source against COOK_EVIDENCE_SOURCES.
- Normalizers: signals_from_judgments (openclaw.judge.v0 p0/p1, hard
  actions, low-confidence, operator escalation — reuses the already
  privacy-scrubbed top_caveat), signals_from_open_loops (promised/working
  loops + overdue detection), signals_from_matrix_search (delta markers
  only — raw message text never enters `why`).
- evaluate_gate: Iskra's runtime spec — ration (max 1/night), then >=2
  *distinct* hard refs + a Piotr-pattern signal. Two flags on one target
  count once.
- run_cook_precheck: pure entry point -> silence object or request packet
  for cook_contract.render_cook_prompt.

constants.py: COOK_MAX_PER_NIGHT, COOK_HARD_JUDGE_PRIORITIES/ACTIONS,
COOK_ACTIVE_LOOP_STATUSES, COOK_MATRIX_MARKERS.

Wiring into nightly + the sidecar/Forgejo reads + the grounding-note/issue
writes are Cook 4/N (production-touching, operator-gated). Nothing here is
live.

Suite: 184 tests OK (157 + 27), py_compile clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
pdurlej deleted branch claude-cook3-runner 2026-05-30 13:32:05 +02:00
Sign in to join this conversation.
No description provided.