Context
Currently, fleet context (dropbox protocol, current task, fleet status) must be manually injected into worker sessions via kild prime <branch> → kild inject worker "$(kild prime worker)". This is a manual step the brain must perform when (re)opening workers.
Opportunity
Claude Code now supports SessionStart hooks. A command hook on SessionStart can output text or JSON with additionalContext that gets injected into the session automatically at startup.
{
"SessionStart": [{
"hooks": [{
"type": "command",
"command": "kild prime --self --raw",
"statusMessage": "Loading fleet context..."
}]
}]
}
The stdout from this command becomes context injected into the new session — no manual prime step needed.
Benefits
- Workers automatically get fleet context on every session start/resume
- Eliminates manual
kild prime + kild inject step
- Works on
resume too (source: startup, resume, clear, compact)
- Brain doesn't need to orchestrate priming for each worker
Considerations
SessionStart input includes source field — can match on startup vs resume for different behavior
- May need a
kild prime --self --raw variant that outputs plain text (no markdown formatting)
- The
CLAUDE_ENV_FILE env var is available at SessionStart for persisting env vars
- Should be registered per-session (in project
.claude/settings.json or via fleet setup), not globally
Files involved
crates/kild-core/src/sessions/integrations/claude.rs — settings patching
crates/kild-core/src/sessions/dropbox.rs — generate_prime_context()
crates/kild/src/commands/prime.rs — may need --self --raw flag
Context
Currently, fleet context (dropbox protocol, current task, fleet status) must be manually injected into worker sessions via
kild prime <branch>→kild inject worker "$(kild prime worker)". This is a manual step the brain must perform when (re)opening workers.Opportunity
Claude Code now supports
SessionStarthooks. A command hook onSessionStartcan output text or JSON withadditionalContextthat gets injected into the session automatically at startup.{ "SessionStart": [{ "hooks": [{ "type": "command", "command": "kild prime --self --raw", "statusMessage": "Loading fleet context..." }] }] }The stdout from this command becomes context injected into the new session — no manual prime step needed.
Benefits
kild prime+kild injectstepresumetoo (source:startup,resume,clear,compact)Considerations
SessionStartinput includessourcefield — can match onstartupvsresumefor different behaviorkild prime --self --rawvariant that outputs plain text (no markdown formatting)CLAUDE_ENV_FILEenv var is available at SessionStart for persisting env vars.claude/settings.jsonor via fleet setup), not globallyFiles involved
crates/kild-core/src/sessions/integrations/claude.rs— settings patchingcrates/kild-core/src/sessions/dropbox.rs—generate_prime_context()crates/kild/src/commands/prime.rs— may need--self --rawflag