Voicebox documentation

26 — Bidirectional Agent Harness & Project Live Loop (voicebox-beads-vv7i / voicebox-beads-b9oz)

1. Root-Cause Analysis (voicebox-beads-vv7i)

Investigation of Voicebox’s task delegation pipeline across ACP adapters (lib/pi-acp.mjs, lib/claude-acp.mjs) and CLI executors (lib/cli-harness-executor.mjs for antigravity, codex, gemini, and opencode) identified three structural gaps that prevented delegated agent harnesses from operating in a tight, live loop with the active project workspace:

  1. Context-blind task prompts: When a user delegated a task from a voice turn or operator room, the executor forwarded the raw task string (input.task) without workspace manifest context (AGENTS.md / README.md instructions, active sub-directory scope, or current top-level project files). CLI and ACP agents had to spend extra turns discovering basic workspace layout or missed repository-specific constraints altogether.
  2. Unobserved workspace mutations: While executors spawned child processes with cwd set to the admitted project root (root.path), neither lib/cli-harness-executor.mjs nor runAcpTask in lib/pi-acp.mjs inspected the project directory before and after execution. File creations, edits, and deletions made by the agent harness on disk were invisible to the task result and room status stream.
  3. One-way output return: Completed delegations returned only a truncated stdout snippet (summary) without structured workspace diff metadata (createdFiles, modifiedFiles, deletedFiles, changedFiles) or optional persisted analysis artifacts in the workspace.

2. Live Project Loop Architecture (voicebox-beads-b9oz)

lib/harness-project-loop.mjs closes the loop between every admitted agent harness and the active project workspace with zero external dependencies and deterministic, bounded I/O:

sequenceDiagram
    participant Room as Voicebox Room / Task Runner
    participant Loop as lib/harness-project-loop.mjs
    participant Exec as ACP or CLI Executor
    participant FS as Project Workspace (root.path)

    Room->>Loop: snapshotProjectWorkspace(root.path)
    Loop->>FS: Walk workspace files (size, mtimeMs, FNV-1a hash) & read instructions
    Loop-->>Exec: Pre-run snapshot + optional buildProjectAwareTaskPrompt()
    Exec->>FS: Spawn harness in cwd = root.path (pi, claude, codex, gemini, antigravity, opencode)
    Room->>Loop: integrateHarnessOutput(root.path, { beforeSnapshot, output })
    Loop->>FS: Re-snapshot workspace & compute diffProjectSnapshots(before, after)
    Loop-->>Room: { summary, changedFiles, createdFiles, modifiedFiles, deletedFiles }

Core Capabilities in lib/harness-project-loop.mjs

3. Executor Integration (lib/cli-harness-executor.mjs, lib/pi-acp.mjs, lib/claude-acp.mjs)

4. Verification

Scoped unit verification lives in tests/multi-harness-execution.test.mjs and runs in the concurrent unit lane without launching a browser or live server:

node --test tests/multi-harness-execution.test.mjs