pi-harness-model-proposer

Dedicated-model proposer for pi-continual-harness. Registers a /refine proposer ('model') that makes its own one-shot LLM call (via the harness's injected complete closure) to produce evidence-backed CRUD deltas directly — hidden from the transcript but a

Packages

Package details

extension

Install pi-harness-model-proposer from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-harness-model-proposer
Package
pi-harness-model-proposer
Version
0.1.0
Published
Aug 9, 2026
Downloads
150/mo · 14/wk
Author
ngsoftware
License
MIT
Types
extension
Size
21.5 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-harness-model-proposer

A dedicated-model proposer companion for pi-continual-harness (repo) — the online self-improvement layer for the pi coding agent.

pi-continual-harness's /refine splits into propose then apply, with the propose stage pluggable via a registry. The built-in proposers are steering (delegates reasoning to the agent loop — visible) and dedupe (rule-based, no model). This package adds a third:

Name What it does
model Makes its own one-shot LLM call (via the harness's injected complete closure) to propose evidence-backed CRUD deltas directly. The call is hidden from the transcript but audited — model, tokens, and latency are recorded in the harness-refinement entry (branchable via /tree).

This is the alternate pi-continual-harness flags in its roadmap as "interface-ready, intentionally not shipped": the hidden-model-spend tradeoff is kept out of the core and resolved here by making the spend audited rather than shipping it invisible.

Install

pi install npm:pi-harness-model-proposer

Requires pi-continual-harness >= 0.6.2 (which injects the complete closure and records modelCall telemetry). Both install together.

Usage

Select the proposer per run or as the default:

/refine --proposer model          # one run
/refine 50 --proposer model       # with a lookback window

Or set it as the default in the harness config (~/.pi/agent/harness.json):

{ "proposer": "model" }

It then also drives opt-in auto-refine (autoRefine) when that is enabled.

How it works

  1. /refine (in pi-continual-harness) gathers trajectory evidence and hands it — plus the current state and a one-shot complete(prompt, opts?) closure — to this proposer.
  2. This proposer builds a strict prompt: a digest of the current state (so the model can update/delete by real id), the schema for the CRUD delta union, and the trajectory evidence. It asks for a JSON array of deltas only.
  3. It calls complete (a hidden completion built by the harness from ctx.modelRegistry), honoring the agent abort signal and a token budget.
  4. It parses, then validates + sanitizes each delta against the current state before returning it. This is the safety-critical step: the harness's applyDeltas is all-or-nothing and re-throws on an unknown id, so a single hallucinated id would otherwise abort the whole batch. Unknown-id updates/deletes, evidence-less creates, and malformed entries are dropped, never applied.
  5. It returns ProposedDelta[] + ModelCallTelemetry. The harness applies the deltas through its normal audited, branchable path and records the telemetry (model, input/output tokens, latency, ok/error) in the harness-refinement entry.

So the model call never appears in the agent transcript, but what it cost and what it proposed are visible and reviewable, and every mutation still flows through the same audited applyDeltas with /tree rollback.

Configuration

Optional config at ~/.pi/agent/harness-model.json (missing/malformed → defaults):

{
  "model": "anthropic/claude-3-5-haiku",
  "maxOutputTokens": 4096,
  "maxDeltas": 20
}
  • model — model id ("provider/id" or bare) for the proposal completion. When unset, the proposer uses the active session model.
  • maxOutputTokens — token budget for the completion (default 4096).
  • maxDeltas — cap on deltas applied per run; excess is dropped to bound spend (default 20).

Behavior on failure

This proposer has no access to ctx, so it cannot fall back to the steering proposer. Instead it degrades to an audited no-op: when there is no model, the call fails, or the output is unparseable, it returns no deltas and records a modelCall with ok: false + an error in the audit entry. Nothing throws; the harness shows "applied 0".

Scope and non-goals

  • In scope: the dedicated-model propose strategy, registered as "model".
  • Out of scope: the state store, /refine, the apply path, durable I/O, auto-refine cadence, outcome loop — all owned by pi-continual-harness. This package owns no state and makes no model calls of its own; it calls the complete closure the harness injects.

License

MIT