feat(harness): opt-in monitor companion: a second model judges a detected repetition (continue, note, escalate)

Open
#412 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start by reading the existing repetition detectors and [CHECK] notice work described in the issue, then inspect the harness configuration and provider paths. The proposal requires an opt-in monitor, bounded input and output, and behavior for three verdicts plus malformed replies. Done means the acceptance scenarios pass and the architecture decision, Concepts documentation, and release note are added.

Written by the indexing model from the issue text.

Description

enhancement

Problem

The harness detects repetition deterministically (same command again, 2-4 command cycles, N reads of one file, a long run of steps that change no file; AD-21, AD-50, AD-20) but can only answer with fixed text. Fixed text cannot tell a legitimate repetition (polling a job, reading a big codebase for a plan) from a stuck model, so it either steers wrongly (today's [LOOP] notes tell a polling model to "make the edit or call done") or says too little. Measured: the explore nudge moved nothing (next step 38/55 with it, 38/55 without, 11 stored firing points), and nudge wording variants measured flat.

Proposal

An opt-in monitor: a second model call that runs only when a deterministic detector fires, reads a short digest of what the agent is doing and returns one verdict:

verdict what the harness does
continue nothing; the repetition is expected (polling, broad reading). No note, no tokens in the agent's context
note appends one line written by the monitor, in the [CHECK] what happened. what to do form (capped, e.g. 200 chars)
escalate hands the session back as WAITING_INPUT with the monitor's reason (the existing stuck hand-back path; a sub-agent's parent gets it)
  • Trigger: the existing detectors only (the stall guard, the quiet-step streak). No detector, no monitor call: 0 tokens in a normal run.
  • Input digest (bounded, about 1,500 tokens): goal, detector fact (7 reads of x.py, 12 steps, no file changed: cat x8, grep x3), the last N command heads, the tail of the last observation, files changed so far, last test summary.
  • Output: a tiny fixed schema ({"verdict": ..., "note": ...}); anything else counts as continue (fail open, Rule 3: never hang, never crash).
  • Config: --monitor <model> / Harness(monitor=) / providers.yaml / skill frontmatter; off by default. Any provider works (model-agnostic), including the same model as the agent.
  • KV cache: a separate call; the agent's prefix and tools never change (Rule 1).
  • Bounds stay deterministic: the monitor never overrides the sandbox, budgets, done gates or the AD-21 skip of a stalled repeat; it only chooses between silence, one note and a hand-back. It adds no interception outside the list in gate line 8.

Why it could work

  • Self-repair gains come mostly when feedback comes from a stronger model (Olausson et al., ICLR 2024, already cited for AD-21). A small local agent with a strong monitor that is called rarely gets that feedback at a fraction of the cost of running the strong model throughout.
  • The detector supplies the "when" deterministically and cheaply; the model supplies the judgement that fixed text cannot.

Risks to measure before it ships

  • Tokens and latency per call (only on detector firings; report calls per session and tokens per solved task).
  • A small monitor (same model as the agent) may judge no better than the fixed [CHECK] text; a too-eager monitor escalates solvable tasks (in a headless run with no human, an escalation is a failure).
  • Philosophy gate: line 2 (every per-turn addition shows a measured gain), line 8 (model orchestrates: the monitor informs, the agent still decides, except for the escalate bound), line 10.

Depends on

The [CHECK] notice lab (one note form for every repetition, "is that the plan? go on, change approach, or done --ask"), running now. The monitor reuses its detectors and note form; if [CHECK] lands, the monitor is the same pipeline with a model choosing the verdict.

Acceptance

  • Off by default; no detector firing = no extra call (unit test with a scripted provider).
  • Golden trace for a note verdict; e2e scenarios for continue, note, escalate and a malformed monitor reply (fail open).
  • Lab on the repetition scenarios (bug fix from a symptom, read-all summary, code Q&A, web research, legitimate polling, impossible task that should be asked, Polyglot subset) with the monitor = agent model and = a stronger model, against [CHECK] alone: it must beat [CHECK] on outcome or tokens per solved task, with no rise in false escalations.
  • An AD entry in docs/architecture/decisions.md, docs page under Concepts with the citation, release note.
Dominant language
Python
Stars
3
Forks
1
Avg merge
1h 10m
Merged PRs (30d)
175

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from igormcsouza/tether

All issues in igormcsouza/tether

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.