Home · Agent Loop
The Harness

A deterministic, recoverable agent loop

The forme harness models every step as an explicit action and observation. Runs checkpoint after each step, resume exactly where they parked, and never silently lose work — so an agent loop behaves like a transaction, not a black box.

Engraved circular agent harness moving durable state through plan, action, observation, and checkpoint stations
The Loop

Plan → act → observe → fold, repeat

A planner proposes the next action; the engine validates it, runs it, folds the observation back into state, and emits a step event. Every action kind is explicit and bounded.

plan
propose the next action
act
validate & execute
observe
fold a typed observation
checkpoint
persist & emit a step event
↻ repeat until respond, stop, or the step budget is reached
Action kindsforme.Action

Each turn resolves to exactly one action, validated before it runs:

  • think — record reasoning without external effect.
  • tool — call a tool, in-band for one or queued for parallel execution.
  • respond / stop — emit the final answer and end the run.
  • delegate — hand a sub-task to a child agent and harvest its result.
  • wait — park the run until an external event or timeout wakes it.

The per-turn step budget follows the selected model's declared ceiling (local default 1024, absolute backstop 4096; remote ceiling 1024), so every loop terminates without forcing one fixed horizon on every model.

Observationscategorized

Results are folded back as typed observations, so the trace is machine-readable, not free text:

  • thought, tool result, and error observations
  • policy observations when a gate allows, denies, or asks
  • wait observations when the run parks
  • harvest observations when a sub-agent's result is synthesized back
Checkpoint & resumeevidence-checked

A checkpoint records tenant, step frontier, the last tool-call id, and any wait state. Resume validates those correlations before restoring completed steps; a completed call with matching durable evidence is not replayed, while invalid or mismatched evidence fails closed.

  • park on wait, then wake on a child completion or a timeout
  • crash-safe: a run survives process restarts and picks up where it left off
  • replayable and auditable end to end
Lua hooks & inquirytrusted scripting

Trusted Lua hooks inject plans and guidance into the loop, with bindings for inquiry, debate, cost, budget, and the lexicon. The inquiry system collects structured answers through durable, park-and-resume questionnaires — the run blocks on a question and continues once it is answered.

Verify-revise synthesisgated

A final answer can be gated behind a verifier panel: if a majority votes REVISE, the loop re-synthesizes with the critique, up to a bounded number of rounds. Raw tool output can be prevented from short-circuiting the answer, so models reason over results instead of returning unprocessed hits.

Context & budgetstays in window

A model-promotion ladder retries an overflowing turn on the next larger context window and stays promoted. Per-turn dynamic hints feed forward guidance, and a run budget (max tokens, max wall-clock) stops gracefully — producing a synthesized final answer instead of a hard cutoff.

Goal-driven runsset · evaluate · report

Beyond a single prompt, a run can pursue a durable goal. A goal-driven loop carries the work forward across iterations — each one building on everything produced so far — and exits when the model signals the goal is met or a bound is reached.

  • set, enrich, and materialize a goal into concrete work
  • evaluate progress and report status against the goal
  • durable across sessions — a goal outlives any one run
Human in & on the loopapprove · oversee

Human in the loop. Approval gates and inquiry pause the run for a decision — the agent blocks until a person approves, rejects, or answers, then resumes from the checkpoint exactly where it stopped. Nothing risky happens behind your back.

Human on the loop. By default a run streams every step as it happens, so an operator watches live and intervenes only when needed — flip a tool's policy to ask, answer an inquiry, cancel a run, or roll a session back to a known-good snapshot. Oversight without babysitting.

Shape the loop with a planner, named profiles, and Lua hooks:

forme:
  planner: contract        # deterministic action contract
  default_profile: sre
  profiles:
    sre:
      system_prompt: "You are an SRE assistant."
      skills: [incident-response]
  lua_hook:
    enabled: true
    hooks: [plan, before_tool, after_tool]

Every step is emitted as a JSONL event — replayable and auditable:

{"step":0,"action":"think","obs":"thought"}
{"step":1,"action":"tool","tool":"web_search"}
{"step":2,"action":"tool","tool":"file.read"}
{"step":3,"action":"respond","obs":"final"}
# go run ./cmd/jikjictl chat --mode jsonl --prompt "..."
Self-Improving & Extensible

A loop that rewrites its own playbook

The harness isn't fixed at compile time. It learns reusable procedures, reshapes itself through Lua, researches what it doesn't know, and takes on new tools — all without forking the engine.

It learns reusable skills

After a substantial run, a bounded post-run reviser distills what the agent worked out into a durable skill — so the next run starts ahead. Skills load on demand with skill.load and attach to a profile or match the goal by keyword.

Reshape the loop with Lua

Trusted Lua hooks at plan, before_tool, and after_tool let you — and the agent itself — change how the loop plans and calls tools at runtime, all inside a strict time and instruction budget.

Research with verified claims

The research mechanism plans an investigation, pulls sources, and runs web search — and holds its own findings to a scientific bar: a prediction is pre-registered before any evidence exists, the experiment protocol is frozen, and the claim is confirmed only from real, repeated, machine-parsed runs. Mechanical quality metrics (no LLM judging itself) then drive a bounded revise loop. The same mechanism backs deployment gates and regression guards, not just papers.

Extensible by design

Skills, Lua hooks, MCP tools, and signed marketplace installs all extend the same loop. New capability is added around the engine, never by rewriting it.

Harness research

Several bounded loops, measured separately

Jikji maps research ideas onto existing durable primitives instead of treating “self-improvement” as one magic loop. Every mechanism has a separate evidence boundary.

Stacked control loops

Agent, verification, event-driven, hill-climbing, and human-approval loops can compose, while the Go core and Lua hooks keep their enforcement roles explicit.

RHO-inspired proposals

Past traces can propose a harness directive, but mechanical Pareto, quality, Oracle, evidence, and operator-approval gates decide whether it may be tried. It never auto-applies.

The Long Horizon

Ready for long-horizon agentic work

Real agentic workflows don't finish in one breath — they run for hours, wait on the world, and span days. Every primitive on this page exists so a run can go the distance without losing the thread.

State that survives a restart

Durable checkpoints let a validated run resume after a restart or redeploy. Replay guards cover completed calls with matching evidence; external side effects still need downstream idempotency across an ambiguous crash boundary.

Park now, continue later

A run can wait on an external event, an approval, or a child agent and wake hours or days later — nothing has to stay pinned in memory for the whole duration.

Goals that outlive a run

A durable goal is carried forward across many runs and sessions until it is met — long-running work has a memory of its own intent, not just its last turn.

Coherent over the distance

Context compaction and the model-promotion ladder keep very long runs inside the window, and the almanac scheduler drives the recurring work — so a workflow can span days and still hold its thread.

Every turn is gated

Before a scheduled or autonomous turn spends any compute, the loop classifies it — deliver, ask a human, wait on evidence, self-repair, or stay quiet — through a fixed-precedence gate stack, so a health blocker or a pending approval always outranks leftover budget. No run burns tokens just because it can.

Goals with a finish line

Goals are structured and hierarchical — sub-goals roll up into their parent — and carry KPIs behind a mechanical acceptance gate with evidence provenance. A long run is judged done by measurable evidence, not by the model's say-so.