Skip to content

Design study: lessons from KiroCrew's outer layer for Shepherd #138

Open

Description

@ttmuse

Context

Design-study tracking issue. We studied kirodotdev/KiroCrew, an open-source agent workspace whose outer layer (the "Gateway") takes the opposite route from Shepherd: instead of attaching to a human-shared PTY, the Gateway owns the agent process — it spawns kiro-cli acp --agent <name> as a subprocess and drives it over ACP (JSON-RPC 2.0 over stdio), with sessions, permission gating, schedules, and memory all owned by the Gateway.

Shepherd's premise is different and stays: it attaches to a terminal the human is actively sharing, so floor control and a non-owning posture are core. This issue is not a proposal to adopt ACP or process ownership. It tracks five discipline-level ideas from that design that may transfer to Shepherd's outer layer, for evaluation one by one.

Candidate lessons

1. Verify claimed completion independently — but at the consumer, not in Shepherd

KiroCrew's pipeline conductor patrols its worker fleet with one deterministic probe per cycle and independently verifies results a worker claims before reporting success. The transferable part is the principle, not the placement. A verdict file is the model's prose claim about its work product — a different trust class from OSC 7501 state, which is a protocol fact (like a process exit code) that Shepherd's floor model rightly trusts. But Shepherd has no model; it is a deterministic scaffold. Semantic verification therefore belongs to whoever consumes the verdict — the orchestrator session, which has the model and the tools. Shepherd's only obligation here is to keep verdicts easy to check (see the structured-checkpoint item under P2).

2. Judge-gated nudges with explicit stop conditions — Shepherd takes only the stop condition

KiroCrew's AutoNudge does not push an idle session blindly: a judge decides first, authorization bounds it, a stop sentinel ends it, and a human taking over wins immediately. Shepherd has no model, so the judge does not transfer. What transfers is the discipline around the nudge, expressed purely in state and mechanical facts: a reported state held past a threshold, an attempt counter with a cap, a stop sentinel, and human-takes-over-wins (which floor control already provides). Whether the work is finished is never Shepherd's call — see the P1 items.

3. Treat "the agent died" as a first-class state, distinct from idle

KiroCrew tracks process liveness directly (warm pool, circuit breaker, crash recovery, orphan PID reaping). Candidate: PID-level liveness so dead and idle are never conflated — they need opposite interventions (restart vs. nudge). Shepherd does not own the terminal, so any restart action stays inside its existing authority limits; detection and reporting are the transferable part. Related: #66 (restart survival ADR).

4. Patrol against durable task checkpoints, not just session state

KiroCrew's TaskRunner models work as a durable spec with checkpoints (execute / retry / replan), so a patrol can tell which step a task stalled on. Shepherd's verdict files are a seed of this. Candidate: structured progress in the task state the patrol already reads, so an intervention can reference step state ("stalled at step 3, one retry used") instead of a generic "continue".

5. A governance ceiling the agent cannot weaken

KiroCrew layers an independent PreToolUse gate plus a two-level governance ceiling that the agent itself cannot lower. Candidate: state explicitly which of the outer layer's own powers are fixed and not expandable through anything the agent can influence (self-reported state, files it writes) — the outer-layer least-privilege principle, written down as a contract rather than left implicit.

Non-goals

  • No ACP adoption, no subprocess ownership of the agent CLI.
  • No change to the floor-control model or to OSC 7501 self-report as the state source.
  • This issue proposes nothing for implementation by itself; each item needs its own scoped proposal if it survives evaluation.

Discussion started in the OpenAB Discord #kiro channel (2026-11-18), following the KiroCrew architecture study.

Reference diagram

How KiroCrew's Gateway controls the Kiro CLI as an outer layer, and how it keeps work running unattended (diagram from the 2026-11-18 study; Chinese labels):

KiroCrew outer layer architecture

Comparison table

KiroCrew (Gateway-owned sessions) vs Shepherd (PTY-attached outer layer), side by side, including where each is stronger or weaker (diagram from the 2026-11-18 study; Chinese labels):

KiroCrew vs Shepherd comparison

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

    p3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions