Skip to content

Commit 920fdbe

Browse files
Research tools contributorsclaude
andcommitted
Rule #0, first pass: seven fail-open hooks deleted, cadence gh fixed, sunset fields and net-deletion
Ricardo, 11-21: "We should have a process, which is to remove process... rstack should be trying to kill itself." Anything that is not a hard line stays only while it changes an outcome. - Deleted (git rm): results-report-guard (83 warnings in two days, none heeded), results-brief-guard (9, one on a one-line brief), poll-guard and its old tools/ copy, agent-stdin-guard, block-main-tree-commit, model-instruction-gate (0 each), and the review-not-open registry entry; with their tests, registry entries, wiring examples and doc rows. Hard lines untouched. - Kept: gate-pipe-guard. It answers a realized incident and its warnings on 11-21 were heeded. - cadence.public-activity was a real bug, not noise: all 144 warnings were gh missing from a scheduled job's PATH. gh now resolves via RH_GH, PATH, then ~/.local/bin, ~/dev/.bin (the M4's only copy), /opt/homebrew/bin and /usr/local/bin; it warns at most once per lane per day. - Sunset: every gates.json entry has added, why, last_changed_outcome and sunset (false for hard lines). harness_blocks: outcome heeded, lists gates with no heeded/rerun/ override/retract row in the window. RSTACK_ABLATE=1 turns every sunset gate off for an ablation day (docs/ablation.md). rstack/tools/net-deletion: the weekly lines/hooks/skills/memories/gates line. - rstack/principles/rstack-deletes-itself.md; AGENTS.md points to it. Built by a Codex worker, reviewed here (gh fallbacks, gate-pipe-guard restored, the KB template's _hookfail copy synced). Tests: harness/tests, rstack/tests and tests/ 3,282 passed, 86 skipped, 0 failed, on the m5 in a login shell; gates_lint PASS. Net -141 lines. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LKxc9LVmdGH7UVrkqUyfyB
1 parent 5ca74ed commit 920fdbe

33 files changed

Lines changed: 1149 additions & 1290 deletions

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Agent entry point
22

3-
> **HARD RULE (11-04): the goal must not turn into process, and success is never activity.** A lane exists to find something new. Our failure mode is the ask being reframed into gates, receipts, audits and validation layers, then tests, checks, ideas and verdicts being counted as progress. Enforced in code, not prose: `launch.sh` refuses new specs over 1,000 words without `SPEC_OVER_CAP=<reason>` and lints every job for `You asked: ... I will: ...` (STATUS.md) and `Shipped: ...` (REPORT.md) into a job-yield ledger; `lane-yield` fails any lane that spends 20+ job-hours with no refereed new result (`lanes/<lane>/RESULTS.jsonl`, written by `log-result`) or whose referee passes 90%+.
3+
> **HARD RULE (11-04): the goal must not turn into process, and success is never activity.** A lane exists to find something new. Our failure mode is the ask being reframed into gates, receipts, audits and validation layers, then tests, checks, ideas and verdicts being counted as progress. Enforced in code, not prose: `launch.sh` refuses new specs over 1,000 words without `SPEC_OVER_CAP=<reason>` and lints every job for `You asked: ... I will: ...` (STATUS.md) and `Shipped: ...` (REPORT.md) into a job-yield ledger; `lane-yield` fails any lane that spends 20+ job-hours with no refereed new result (`lanes/<lane>/RESULTS.jsonl`, written by `log-result`) or whose referee passes 90%+. Rule #0: rstack's goal is to delete itself, and anything that is not a hard line stays only while it changes an outcome ([ablation](docs/ablation.md)).
44
55

66
**Please let's do normal things unless they don't work.** Standard method first; deviate only after it fails, and say where. Trivial predictor and simple baseline before any predictive claim. Every result answers one question: did you find something new, yes or no? [Normal first](docs/normal-first.md).

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ mechanism that enforces it, or an admission that there isn't one.
132132
verify a copy exists before removing anything you did not just create.
133133
- [**Architecture, not prose**](rstack/principles/architecture-not-prose.md): when a rule is broken
134134
twice, build a mechanism, not a firmer sentence.
135+
- [**rstack deletes itself**](rstack/principles/rstack-deletes-itself.md): anything that is not a hard
136+
line stays only while it changes an outcome; [an ablation pass](docs/ablation.md) on each new model.
135137
- [**Short asks to the human**](rstack/principles/short-asks.md): a question they can answer, where
136138
they actually read.
137139
- [**The goal must not become process**](rstack/principles/goal-not-process.md): gates counted as

‎docs/ablation.md‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# The ablation pass
2+
3+
Rule #0 (11-21): rstack's goal is to delete itself. Anything that is not a hard line stays only while
4+
it changes an outcome. The hard lines (money, sign-ins and credentials, sends in the owner's name,
5+
permanent deletes, privacy and IP egress, unsandboxed third-party code) are exempt and are never
6+
switched off here. This page is how the rest earns its place.
7+
8+
## What counts as a gate that changes an outcome
9+
10+
Every entry in `rstack/gates.json` has `added`, `why`, `sunset` and `last_changed_outcome`. Hard lines
11+
are `sunset: false`; everything else is `sunset: true`. A gate changed an outcome when a warning
12+
made the agent change course (`harness_blocks.py mark --gate NAME --outcome heeded --reason TEXT`),
13+
or when a block it caused was rerun, overridden or retracted. `harness_blocks.py sunset --days 14`
14+
lists every `sunset: true` gate older than 14 days with none of those rows in the last 14 days, and how
15+
many warnings it gave. It only reads, and it exits 0.
16+
17+
## On each new model release
18+
19+
Models change what they get wrong, so a gate written for the last one may be dead weight on this one.
20+
For one day of real work:
21+
22+
1. Set `RSTACK_ABLATE=1` in the environment of the sessions and jobs. `_hookfail.run` then allows every
23+
`sunset: true` hook without running its body, and `harness_blocks.gate` and `warn` allow every
24+
`sunset: true` check without printing anything. Each skipped check is a row with outcome `ablated`
25+
in `harness-blocks.jsonl`. Hard lines ignore the variable.
26+
2. Switch off every skill that is not a hard line the same way: move its folder aside to the Trash
27+
(`/usr/bin/trash`, never rm), and note the names so the next step can put back the ones that mattered.
28+
3. Do the normal work. Do not add anything new that day.
29+
30+
## The next day
31+
32+
Compare the ablation day with the day before, on the same measures the harness already keeps: job
33+
grades, reruns, and harness-blocks (blocks, warnings, harness bugs). Use the `ablated` rows to see what
34+
would have fired. For each gate or skill, ask one question: did the outcome measurably get worse
35+
with it off? Put back only what did. Delete the rest with `git rm` (it stays in git history), remove
36+
its registry entry and its tests, and let `rstack/tools/net-deletion` count the week as a deletion
37+
week. A gate nobody can show an effect for is gone by default.
38+
39+
## Limits
40+
41+
One day is a small sample, so a gate that guards a rare failure can look useless. If a removed gate's
42+
failure comes back, put the gate back with the incident named in `why`
43+
([a guard needs a real failure](../rstack/principles/guards-need-a-real-failure.md)). The weekly
44+
`net-deletion` line is the check that the stack is shrinking, not just being reorganised.

‎docs/configuration.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ Use an isolated writable root with `python3 harness/rh.py --root PATH ...`. It c
5656
| `LAUNCH_HOST` (or `--host HOST`) | Run the executor on another machine over ssh; empty means here. `HOST` is an ssh alias, validated before it reaches an ssh argv. The work dir must exist at the **same absolute path** there, or the run refuses rather than landing in the remote `$HOME`. Admission, the word cap, the registry, model selection, the prompt and the log stay on the controller. |
5757
| `LAUNCH_SSH`, `LAUNCH_REMOTE_EXECUTOR`, `LAUNCH_PULL_MAX_SIZE` | With `--host`: the ssh command (default `ssh`), the remote `agent_executor.py` (default `$HOME/.local/share/research-harness/agent_executor.py`, expanded on the host) and the cap on each pulled-back file (default `4m`). After every attempt the heavy outputs stay on the host and only `STATUS.md`, `REPORT.md`, `PLAN.md`, `RESULTS.jsonl`, `*.selection.json` and the job's `.last.md` come back, so status reads here as it did before. A failed pull is logged and does not fail the run. |
5858
| `EVENT_WATCH_CONF`, `EVENT_WATCH_STATE`, `EVENT_WATCH_NOTIFY` | Watch rules (default `.runtime/event-watch/config`), cursor/event state (default `.runtime/event-watch/state`) and optional notification executable. |
59-
| `POLL_GUARD_STATE` | Private hook fingerprint directory; default `.runtime/poll-guard`. |
6059
| `CS_BASE`, `CS_BIN`, `CS_STATE`, `CS_AUTO_READ` | Optional daemon URL, CLI, cookie directory (default `.runtime/cs`) and path-separated auto-readable roots. Auto-read roots default to empty. No port is assumed when the URL is unset: the CLI is asked. |
6160
| `CS_HOST`, `CS_REMOTE_BIN`, `CS_TUNNEL_PORT` | Drive the daemon on another machine (an ssh alias) over a tunnel, for science whose data lives there. The auto-readable roots are then checked on that machine, and a prompt for a path missing there is held. |
6261

‎docs/lane-cadence.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ A fixed release epoch bounds initial grace. Restarting a monitor does not reset
88

99
Lane-health notifications append to `RH_AGENT_ALERTS`, an on-disk agent queue. Payloads carry lane/check summaries, not log or dataset contents. A consuming agent must be scheduled separately; writing the queue does not itself wake a model. Pod/provider alerts use a separately configured notification adapter.
1010

11-
`tools/event-watch` can wait for new paths, stale files, process exit, matching log lines and deadlines. It establishes an initial baseline and tracks offsets, so old lines do not repeatedly trigger. Optional notifications are off unless configured. `tools/poll-guard.py` allows two identical foreground status checks in a 30-minute window and denies the third. Background commands, mutations and `# poll-ok` bypass it; errors fail open. It is a backstop, not a polling ban.
11+
`tools/event-watch` can wait for new paths, stale files, process exit, matching log lines and deadlines. It establishes an initial baseline and tracks offsets, so old lines do not repeatedly trigger. Optional notifications are off unless configured.
1212

1313
Code: [cadence.py](../harness/cadence.py), [lane_alerts.py](../harness/lane_alerts.py). Tests: [test_lane_health.py](../harness/tests/test_lane_health.py).

‎harness/cadence.py‎

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
import json
1111
import math
1212
from pathlib import Path
13+
import os
1314
import re
15+
import shutil
1416
import subprocess
1517
import time
1618
import harness_blocks
@@ -121,12 +123,55 @@ def delivery_time(lane, cfg, clock):
121123
return newest
122124

123125

126+
# ~/dev/.bin is where the M4 keeps gh (its only copy there); ~/.local/bin is first on the m5, as in launch.sh.
127+
GH_FALLBACKS = (os.path.expanduser('~/.local/bin/gh'), os.path.expanduser('~/dev/.bin/gh'),
128+
'/opt/homebrew/bin/gh', '/usr/local/bin/gh')
129+
130+
131+
def gh_binary():
132+
"""The gh to run. A scheduled job has a bare PATH, and `gh` was then a FileNotFoundError warning 144 times
133+
a day. RH_GH wins; then PATH (the bare name, so subprocess resolves it the same way); then the usual
134+
install locations. Nothing found returns 'gh', which fails the way it always did."""
135+
if os.environ.get('RH_GH'):
136+
return os.environ['RH_GH']
137+
if shutil.which('gh'):
138+
return 'gh'
139+
for path in GH_FALLBACKS:
140+
if os.access(path, os.X_OK) and os.path.isfile(path):
141+
return path
142+
return 'gh'
143+
144+
145+
def warn_once_a_day(lane, reason):
146+
"""cadence.public-activity warns at most once per lane per day. The state file (day per lane and reason)
147+
sits next to the harness-blocks ledger. A state file that cannot be read or written never hides a warning."""
148+
path = harness_blocks.ledger_path().parent / 'cadence-public-warned.json'
149+
today = dt.datetime.now(UTC).date().isoformat()
150+
key = '{}|{}'.format(lane.name, reason)
151+
try:
152+
seen = json.loads(path.read_text())
153+
if not isinstance(seen, dict):
154+
seen = {}
155+
except (OSError, ValueError):
156+
seen = {}
157+
if seen.get(key) == today:
158+
return
159+
harness_blocks.warn('cadence.public-activity', reason, lane=lane.name)
160+
try:
161+
seen = {k: v for k, v in seen.items() if v == today}
162+
seen[key] = today
163+
path.parent.mkdir(parents=True, exist_ok=True)
164+
path.write_text(json.dumps(seen, sort_keys=True))
165+
except OSError:
166+
pass
167+
168+
124169
def github_delivery_time(clock, since=None):
125170
"""Latest authored comment on our public PRs/issues, or public PR review."""
126171
deadline = time.monotonic() + 15
127172

128173
def api(*args):
129-
return subprocess.run(['gh', 'api', '--hostname', 'github.com', *args],
174+
return subprocess.run([gh_binary(), 'api', '--hostname', 'github.com', *args],
130175
check=True, capture_output=True, text=True,
131176
timeout=max(0, deadline - time.monotonic())).stdout
132177

@@ -184,14 +229,12 @@ def public_delivery_time(lane, cfg, clock):
184229
when = delivery_time(lane, cfg, clock)
185230
except (OSError, ValueError, OverflowError) as exc:
186231
complete = False
187-
harness_blocks.warn('cadence.public-activity',
188-
'could not read the delivery ledger ({})'.format(type(exc).__name__), lane=lane.name)
232+
warn_once_a_day(lane, 'could not read the delivery ledger ({})'.format(type(exc).__name__))
189233
try:
190234
activity = github_delivery_time(clock, since=when)
191235
except (OSError, subprocess.SubprocessError, ValueError, TypeError, KeyError, AttributeError) as exc:
192236
complete = False
193-
harness_blocks.warn('cadence.public-activity',
194-
'could not read public GitHub activity ({})'.format(type(exc).__name__), lane=lane.name)
237+
warn_once_a_day(lane, 'could not read public GitHub activity ({})'.format(type(exc).__name__))
195238
else:
196239
if activity is not None:
197240
when = activity

0 commit comments

Comments
 (0)