Hiro development journal

Hiro's six-workflow stateful agent harness

Published Machine-readable JSON

Executive summary

Implemented Harness v2 as a hermetic, executable stateful evaluation environment for six personal-assistant workflows: read-only discovery, local task and reading changes, draft-only calendar and email preparation, approval-gated writes, injected-failure recovery, and a staged cross-tool workflow.

The canonical combined run used Hiro's real local model loop while exposing only synthetic in-memory tools. All six workflows passed with complete tool traces and before-and-after state digests in 42.405 seconds. This is materially stronger evidence than prompt-only 100-percent scores, but it remains simulated evidence rather than proof of production integration readiness.

Real runs exposed and drove refinements for model-native tool serialization, false delivery wording, ambiguous dates, ambiguous-write retry behavior, invalid calendar ranges, and excessive single-turn workload. The final design keeps strict authorization and state oracles rather than weakening them to obtain green results.

Work completed

Hermetic world and simulated tool runtime

Implemented
  • Added a deterministic SimulationWorld for synthetic calendars, mailbox messages, tasks, reading items, drafts, proposals, approvals, sent messages, faults, idempotency results, and append-only event traces.
  • Added allowlisted in-memory tools for reads, local writes, drafts, approval requests, calendar creation, and email sending. External writes require an exact approved action and scope; pending, absent, or mismatched approval is denied without mutation.
  • Every mutation requires an idempotency key. The runtime can inject timeouts, stale reads, malformed results, and timeout-after-commit behavior. Calendar proposal and creation now reject malformed or non-positive time ranges before mutation.
  • State snapshots and stable digests support before-and-after comparison independently of runtime tracing. No live calendar, mailbox, network, personal memory, or production resolver is reachable from these workflows.

Real-model tool loop and trace capture

Implemented
  • Added a persistent multi-turn HarnessAgent that calls Hiro's local standard model tier, exposes only the selected simulated schemas, executes one tool call at a time, returns each tool result to the model, and captures the complete arguments and results.
  • The policy distinguishes local artifacts from delivered actions, requires exact approval for calendar creation and email sending, requires stale-state refresh, constrains read retries, and requires an immediate same-key replay after timeout-after-commit before final verification.
  • The compatibility boundary accepts the repository's legacy tool-call form plus observed Gemma-native variants with bare object keys and wrapped string delimiters. Regression tests cover each supported serialization form.

Six canonical workflows

Implemented and passing
  • Workflow 1 searches a synthetic mailbox and calendar, reports availability from discovered evidence, and proves no state mutation.
  • Workflow 2 discovers and updates local tasks and reading items, preserves separate book editions, and verifies final local state.
  • Workflow 3 detects a conflict, prepares a safe alternative calendar proposal and reply draft, and proves that no event or message was externally created or sent.
  • Workflow 4 requests one exact calendar approval, stops while it is pending, then creates and verifies only the approved event after the simulated user decision.
  • Workflow 5 encounters a read timeout, a stale response, and a timeout after a committed calendar write. Hiro refreshes state, replays the exact write once with the same idempotency key, observes an idempotent replay, and verifies exactly one event.
  • Workflow 6 carries one synthetic request across mailbox discovery, calendar conflict resolution, a calendar proposal, email draft, local follow-up task, two separate approval boundaries, event creation, email sending, and final task verification.

Immutable run evidence

Implemented
  • Added a command-line runner that executes all six workflows sequentially against the real local model and writes a timestamped immutable JSON report under the ignored local runtime directory.
  • The report records run ID, UTC timestamps, duration, execution mode, pass counts, per-workflow failures, final response, complete tool trace, and state digests. It refuses to overwrite an existing report.
  • The canonical implementation run was stateful-20260723T003307Z, execution mode hermetic-real-local-model, duration 42.405 seconds, six workflows completed, and six passed.

Decisions and reasoning

Validation and evidence

CheckStatusResult
Focused harness unit tests passed 11 tests passed. Coverage includes world digest behavior, tool allowlists, model-result sequencing, three observed tool-call serialization variants, workflows 1 through 3 with scripted models, invalid calendar interval rejection, and exact approval-scope enforcement.
Broader relevant regression selection passed 28 tests passed across the new harness, the existing isolated evaluation agent, and operational-boundary tests. Pytest reported only an existing pytest-asyncio future-default warning.
Canonical real-model workflow run passed Run stateful-20260723T003307Z completed all six workflows in 42.405 seconds with six passes. The stored report contains the complete synthetic trace and state evidence.
Approval and idempotency evidence passed The real-model traces show writes occurring only after matching approvals. The injected timeout-after-commit produced one committed event, followed by an exact same-key replay marked idempotent and a successful read verification.
Live external services not-run-by-design No live calendar, email, task service, reading service, network source, or personal user data was accessed. No external permission was needed for the six simulated workflows.
Journal tests and site build passed The timestamped-entry unit test passed. The production build generated and validated 27 journal entries, verified timestamp identity, same-day uniqueness, aliases, sitemap, Atom content, noindex metadata, and the IndexNow key, then completed TypeScript and Vite compilation.

Current state

Next steps