Skip to content

feat: deterministic Stop hook for iteration completion (nous-execute-stop) #129

@sriumcp

Description

@sriumcp

TL;DR

A deterministic Stop hook (shell-script-based, not LLM-based) that runs nous validate --execution after each tool burst and signals "stop, work complete" only when validation passes. More reliable and cheaper than the agent self-deciding when to stop.

Why this matters

Today the executor decides on its own when to stop ("I've written findings.json, I'm done"). Sometimes it keeps writing. Sometimes it stops too early. Stop hooks are deterministic — a shell script returning 0 = continue, non-zero with a reason = stop.

What's already shipped

Proposed approach

  1. Implement bin/nous-execute-stop — a small shell script that runs nous validate --dir <iter-dir> --execution and [ -f <iter-dir>/principle_updates.json ]. Exits 0 if both pass.
  2. Register it as a Stop hook for the executor agent (in the per-campaign .claude/settings.json, depends on Test issue #15).
  3. When the hook signals "stop", the agent terminates cleanly. When it doesn't, the agent gets the validation diff back as a structured message and continues.

Acceptance criteria

  • On the first pass that produces a valid findings.json + principle_updates.json, the executor exits within one turn of the hook firing.
  • If validation fails, the next executor turn includes the schema diff (not a re-run from scratch).

Notes


Part of #120.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions