Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions .claude/agents/kild-brain.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: kild-brain
description: Honryū — KILD fleet supervisor. Manages parallel AI coding agents across isolated git worktrees. Acts as the team leader for the fleet.
model: opus
model: claude-opus-4-6[1m]
tools: Bash, Read, Write, Glob, Grep, Task
permissionMode: acceptEdits
maxTurns: 200
Expand Down Expand Up @@ -84,10 +84,10 @@ Communication uses two channels that work together. You don't need to think abou

```
1. You inject a task → kild inject <branch> "do X"
2. Worker receives it → (automatic — Claude inbox + dropbox task.md)
3. Worker acknowledges → (automatic — writes ack file)
2. Worker receives it → (automatic — Claude inbox + inbox task.md)
3. Worker writes status → (writes "working" to $KILD_INBOX/status)
4. Worker executes → (working...)
5. Worker writes results → (writes report.md to dropbox)
5. Worker writes results → (writes report.md to $KILD_INBOX/)
6. Worker goes idle → (automatic — [EVENT] arrives in your inbox)
7. You read the report → kild inbox <branch>
8. You decide next step → inject next task / rebase / complete / escalate
Expand All @@ -113,9 +113,9 @@ kild inject <branch> "Your next task: <instruction>"

`kild inject` delivers via **both** channels simultaneously:
- **Claude Code inbox** — message appears as a new conversation turn within ~1 second
- **Dropbox** — writes `task.md` + increments `task-id` for protocol state tracking
- **Inbox** — writes `task.md` to `$KILD_INBOX/` (universal, all agents)

For non-Claude agents (Codex, Kiro, etc.), inject writes to PTY stdin + dropbox.
For non-Claude agents (Codex, Kiro, etc.), inject writes to inbox + PTY stdin nudge.

**Do NOT use `--initial-prompt` on `kild create` or `kild open`.** This flag is deprecated and will be removed in a future release. Always create/open first, wait for the agent to initialize, then inject separately.

Expand All @@ -131,10 +131,9 @@ Workers report back via **two** channels:
```
These give you a quick summary. They arrive within ~1 second of a worker going idle.

2. **Dropbox reports** (detailed, worker-written) — Workers write their full results to `report.md` in their dropbox. Read these with:
2. **Inbox reports** (detailed, worker-written) — Workers write their full results to `report.md` in their inbox. Read these with:
```bash
kild inbox <branch> # Full dropbox state for one worker
kild inbox <branch> --report # Just the report content
kild inbox <branch> # Inbox state for one worker (status + task + report)
kild inbox --all # All workers at a glance
```

Expand Down Expand Up @@ -171,8 +170,8 @@ kild diff <branch> # What files a worker changed (unstaged diff)
kild stats <branch> # Branch health: commits ahead, merge readiness, CI
kild pr <branch> # PR status: state, reviews, checks
kild overlaps # File conflicts across all active kilds
kild inbox <branch> # Inspect dropbox state (task, ack, report) for a worker
kild inbox --all # Dropbox state for all fleet sessions
kild inbox <branch> # Inspect inbox state (status, task, report) for a worker
kild inbox --all # Inbox state for all fleet sessions
kild prime <branch> # Generate fleet context blob for a worker
kild prime --all --status # Compact fleet status table across all sessions
```
Expand Down
2 changes: 1 addition & 1 deletion .claude/skills/kild-wave-planner/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ core.editor → crates/kild-core/src/editor/
core.state → crates/kild-core/src/state/
core.notify → crates/kild-core/src/notify/
core.process → crates/kild-core/src/process/
core.fleet → crates/kild-core/src/sessions/fleet.rs, crates/kild-core/src/sessions/dropbox.rs
core.fleet → crates/kild-core/src/sessions/fleet.rs, crates/kild-core/src/sessions/inbox.rs
ui → crates/kild-ui/
ui.terminal → crates/kild-ui/src/terminal/
ui.views → crates/kild-ui/src/views/
Expand Down
99 changes: 99 additions & 0 deletions .claude/skills/kild/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ description: |
- Status: "kild status", "check kild", "kild health", "how are my kilds"
- Navigation: "cd to kild", "go to kild", "path to kild", "open in editor", "edit kild", "code kild"
- Lifecycle: "stop kild", "open kild", "destroy kild", "complete kild", "clean up kilds"
- Fleet: "inject", "inbox", "prime", "fleet status", "send task to kild"
- Output: "list as json", "json output", "verbose mode"

KILD creates isolated Git worktrees where AI agents work independently without
Expand Down Expand Up @@ -611,6 +612,104 @@ kild init-hooks opencode
kild init-hooks opencode --no-install
```

## Fleet Mode (Inject, Inbox, Prime)

Fleet mode enables a brain agent to coordinate multiple worker kilds. Each fleet session gets an inbox directory at `~/.kild/inbox/<project_id>/<branch>/` with three files:

- `task.md` - Current task (written by brain via `kild inject`)
- `status` - Worker status (e.g., `idle`, `working`)
- `report.md` - Task result (written by worker on completion)

Fleet mode activates automatically when the `honryu` team directory exists or when creating the brain session. The `$KILD_INBOX` environment variable is injected into fleet daemon sessions, pointing to the session's inbox directory.

Fleet instruction files are also placed in each worker's worktree for easy agent access.

### Inject a Message
```bash
kild inject <branch> "<text>"
```

Sends text to a running kild worker. For Claude sessions, writes to the Claude Code inbox for near-instant delivery (~1s polling). For all other agents, writes to PTY stdin. The task is also written to the session's inbox directory (`task.md`).

**Flags:**
- `--inbox` - Force Claude Code inbox protocol (default for claude agents, PTY stdin for others)

**Examples:**
```bash
# Send task to a worker
kild inject feature-auth "Implement the login endpoint"

# Force inbox protocol for non-claude agent
kild inject feature-auth "Start the task" --inbox
```

### Inspect Inbox State
```bash
kild inbox <branch> [--json]
kild inbox --all [--json]
```

Shows the current inbox state (status, task, report) for a fleet session.

**Flags:**
- `--json` - Output in JSON format
- `--all` - Show inbox state for all fleet kilds

**Examples:**
```bash
# Single session
kild inbox feature-auth

# All fleet sessions
kild inbox --all

# JSON for scripting
kild inbox --all --json
```

### Generate Fleet Context (Prime)
```bash
kild prime <branch> [--json] [--status]
kild prime --self [--json] [--status]
kild prime --all [--json] [--status]
```

Generates a fleet context blob for agent bootstrapping. Outputs protocol instructions, current task, and fleet status as composable markdown. Useful for priming agents with fleet awareness.

**Flags:**
- `--json` - Output in JSON format
- `--status` - Output fleet status table only (compact)
- `--self` - Resolve branch from `$KILD_SESSION_BRANCH` env var (for use inside a kild session)
- `--all` - Generate context for all fleet sessions

**Examples:**
```bash
# Prime a single worker
kild prime feature-auth

# Inject prime context into a worker
kild inject feature-auth "$(kild prime feature-auth)"

# Fleet status table only
kild prime --all --status

# JSON output
kild prime feature-auth --json

# Self-prime (from inside a kild session)
kild prime --self
```

### Typical Brain Setup
```bash
kild create honryu --daemon --main # Brain: runs from project root, no worktree
sleep 5 # Wait for agent init
kild inject honryu "Orient yourself" # Deliver initial task via inject
kild create worker-auth --daemon # Worker: auto-joins fleet with team flags
sleep 5
kild inject worker-auth "Implement JWT auth" # Brain -> worker message
```

## Global Flags

### Verbose Mode
Expand Down
Loading
Loading