Pre-release Harn is pre-1.0 — the language, standard library, and CLI may change between releases. See the release notes

Pace cut rules

std/agent/cut_rules decides whether a run should keep going, receive more time, get a wrap-up check, or stop. It does not read a clock, store counters, send feedback, or stop the loop. The caller supplies facts and acts on the result.

Decide from pace facts#

import { pace_cut_rule_decision } from "std/agent/cut_rules"

const decision = pace_cut_rule_decision(
  {extend_max: 6, pace_check_max: 2},
  {
    armed_budget_ms: 60000,
    elapsed_ms: 42000,
    checkpoint_ms: 30000,
    expected_total_ms: 55000,
    made_progress: true,
    verifier_signature_unchanged: false,
    done: false,
    extends_used: 1,
    pace_checks_used: 0,
    env_blame_without_infra: false,
  },
)
harness.stdio.log(decision.action)

pace_cut_rule_decision(policy: PaceCutRulePolicy, obs: PaceCutRuleObservation) -> PaceCutRuleDecision is a pure function. PaceCutRulePolicy has two optional limits:

FieldDefaultMeaning
extend_max6Maximum silent budget extensions
pace_check_max2Maximum wrap-up checks before a cut

The observation accepts these fields:

FieldMeaning
armed_budget_msCurrent wall-clock budget. A missing or non-positive value makes the rule inactive.
elapsed_msTime used since the run started.
checkpoint_msDecision interval. Defaults to armed_budget_ms.
expected_total_msEstimated total time. Defaults to armed_budget_ms.
made_progressWhether verification advanced since the last checkpoint.
verifier_signature_unchangedWhether work landed without improving the verifier result.
doneWhether the run already satisfied its completion check.
extends_usedSilent extensions already granted.
pace_checks_usedWrap-up checks already sent.
env_blame_without_infraWhether the run blamed its environment without an infrastructure signal.

Decision values#

ActionMeaningExtra fields
proceedKeep the current budget.None
extendMove the wall-clock deadline forward.new_budget_ms, reason
pace_checkAsk the run to check its pace and wrap up.reason
cutStop the run.reason

The cut reasons are no_progress_at_checkpoint, no_verifier_progress, env_blame_without_infra, extend_budget_exhausted, and pace_check_budget_exhausted.

pace_cut_rule_action_of(decision) maps these actions to the shared governor vocabulary. cut becomes abort, pace_check becomes warn, and both extend and proceed become proceed.

Use pace_cut_rule_check_max_injections() and pace_cut_rule_extend_max() when another policy needs the default limits.

The caller owns the clock, stored counters, feedback, and loop actuation. See Host-supplied facts for the boundary between those facts and this decision.