Skip to content

Design: depth-1 child agents (agent_start/agent_poll) — worktree isolation, structural depth cap, policy subset, uteke handoff #171

Closed

Description

@ajianaz

What

Native depth-1 child agents: a parent tole session spawns N child tole
sessions (never grandchildren). uteke is the parent↔child communication
channel. Worktree is PARENT-ONLY (decision 2026-10-05, 3rd round):
children never have a worktree knob — per-child worktree options are a
storage-boomerang (N model-spawned worktrees bloat the repo even if the
work is cleaner); the operator decides, once, at parent launch.

User requirements:

  • 1 parent → N children, depth capped at 1.
  • Worktree mode: an operator-level flag on the PARENT session
    (e.g. tole run/chat --agents-worktree), default OFF. When the
    operator enables it, every spawned child gets its own worktree; the
    MODEL cannot request worktrees per-spawn.
  • Hard limits: concurrent children, per-child budget/timeout.
  • uteke mailboxes: ephemeral by default, auto-cleaned — no spam.

Design sketch

Execution — mirror the proven jobs pattern

  • agent_start {prompt, allow?, budget?, keep_mailbox?} (Risk::Write,
    approval-gated; NO worktree parameter) → spawns a durable child
    tole run session with its own JSONL, registry, usage ledger.
  • agent_poll {agent_id} (ReadOnly) → status + log tail; loop-guard
    exempt like job_poll.

Structural depth cap (the security crux)

  • The child's registry is built WITHOUT agent_start — it cannot
    become a grandparent by construction.
  • Bypass to close: the child still has run_command and could spawn
    tole run (verified live 2026-10-05). Fix: in child mode, the
    destructive-payload scan additionally refuses spawning the tole
    binary itself.
  • Child allowlist ⊆ parent allowlist; Destructive still requires an
    interactive approver, unchanged.

Worktree: PARENT-ONLY, operator-gated

  • --agents-worktree on the parent (default OFF). Enabled: each child
    spawns into git worktree add .tole-worktrees/<agent-id> -b agent/<issue>; the child's jail is that worktree. Merge-back stays
    human (push stays human).
  • Storage stays bounded STRUCTURALLY: the model has no worktree
    argument to flip; worktree count ≤ MAX concurrent children (default
    small); worktree removal is part of the child lifecycle (merge →
    remove worktree → clean mailbox).
  • Disabled (default): children share the parent's jail — fine for
    read/analysis subtasks.

uteke mailboxes — scoping AND lifecycle

Scoping (no cross-talk):

  • Each child runs with TOLE_MEMORY_NAMESPACE=agent-<agent-id> —
    siblings structurally cannot see each other's namespaces.
  • Briefs down: ONE uteke_document per child. Results up: the child's
    settle summary only; the parent reads it deterministically (exact
    namespace/tag) — point-to-point mailboxes, never a shared pool.

Lifecycle (no spam):

  • Ephemeral by default: when agent_poll reports settled AND the
    parent consumed the summary, the mailbox is auto-cleaned (uteke
    soft-delete namespace strategy — restorable).
  • keep_mailbox: true opts out for debugging (the child's durable
    JSONL is the real archive; the mailbox is transport).
  • Worktree mode ties cleanup to merge + worktree removal; a janitor TTL
    sweeps orphaned agent-* namespaces if the parent crashed.

Limits (configurable)

  • MAX concurrent children per parent (default small, e.g. 4),
    per-child token budget (existing BudgetExhausted), child timeout.

Phasing

  1. serve-based orchestration + uteke mailbox handoff — available TODAY.
  2. agent_start/agent_poll + structural depth cap + policy subset +
    mailbox lifecycle.
  3. --agents-worktree parent flag.
  4. Optional decision layer: jev/laya decide tool (issue Design: jev_decide tool — TypeSafe Jev (System One) as an optional fast decision layer (probe-gated, Read-Only) #172).

Why

The primitives all exist (jobs pattern, session durability, jail,
memory loop namespace override, allowlist machinery, uteke soft-delete
namespaces). Parent-only worktree gating removes the storage boomerang
by construction rather than by policy; depth-1 caps the exponential
cost docs/orchestration.md warns about.

Activity

  1. ajianaz commented on Oct 5, 2026

    @ajianaz
    ContributorAuthor

    Shipped in PR #174 (c650f71): agent_start/agent_poll, structural depth cap (+ env/wrapper bypass closure), uteke mailboxes (ephemeral default), parent-only --agents-worktree. Three CodeCora rounds hardened it: prompt flag-injection guard, child-allowlist subset enforcement, no-orphan spawn, honest liveness. 323 tests green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions