# State Mapping
[Back to README](../../README.md)
Most lifecycle events from agents (Claude Code hooks, Codex JSONL, Copilot hooks) map to the same animation states.
Subagent events still map to the logical `juggling` state, but Clawd now chooses a tiered asset by live subagent count: 1 subagent uses `clawd-headphones-groove.svg`, while 2+ subagents use `clawd-working-juggling.svg`. The old Clawd conducting asset is retired; Calico and Cloudling still use their conducting animations for their 2+ subagent tier.
| Agent Event | State | Animation | Clawd | Calico | Cloudling |
|---|---|---|---|---|---|
| Idle (no activity) | idle | Eye-tracking follow |
|
|
|
| Idle (random) | idle | Reading / patrol |
| |
|
| UserPromptSubmit | thinking | Thought bubble + spark |
|
|
|
| PreToolUse / PostToolUse (1 session) | working (typing) | Typing |
|
|
|
| PreToolUse / PostToolUse (2 sessions) | working (2-session tier) | Headphones groove |
|
|
|
| PreToolUse (3+ sessions) | working (building) | Building |
|
|
|
| SubagentStart (1) | juggling | Headphones groove |
|
|
|
| SubagentStart (2+) | juggling (2+ tier) | Three-ball juggling |
|
|
|
| PostToolUseFailure | error | Error |
|
|
|
| Stop / PostCompact | attention | Happy |
|
|
|
| PermissionRequest | notification | Alert |
|
|
|
| PreCompact | sweeping | Sweeping |
|
|
|
| WorktreeCreate | carrying | Carrying |
|
|
|
| 60s mouse idle | sleeping | Sleep |
|
|
|
| SessionEnd | remove session; idle if no live sessions | No sleep transition | | | |
## Kimi Code CLI (Kimi-CLI) Hook Events
Kimi Code CLI (Kimi-CLI) now uses hook-only integration (`~/.kimi/config.toml`), and maps these 13 hook events to shared Clawd states:
| Kimi Hook Event | State |
|---|---|
| SessionStart | idle |
| SessionEnd | remove session; idle if no live sessions |
| UserPromptSubmit | thinking |
| PreToolUse | working by default. Permission animation only flips when payload carries explicit approval signals (`permission_required` / `requires_approval` / `waiting_for_approval` / `is_permission_request`). Persistent mode switch: `CLAWD_KIMI_PERMISSION_MODE=explicit` (default — only explicit signals trigger notification) or `CLAWD_KIMI_PERMISSION_MODE=suspect` (deferred heuristic for gated tools). The installer (`npm run install:kimi-hooks` and the auto-sync at startup) bakes this value into the `command` field of `~/.kimi/config.toml` so it survives Clawd restarts. Other optional knobs: `CLAWD_KIMI_PERMISSION_IMMEDIATE=1` forces immediate remap for permission-gated tools; `CLAWD_KIMI_PERMISSION_SUSPECT=1` (legacy alias) enables deferred suspect mode for the current process only; `CLAWD_KIMI_PERMISSION_SUSPECT_MS=` tunes the suspect window; `CLAWD_KIMI_DISABLE_PRETOOL_PERMISSION=1` keeps explicit-only behavior even when optional modes are set. |
| PostToolUse | working |
| PostToolUseFailure | error |
| Stop | attention |
| StopFailure | error |
| SubagentStart | juggling |
| SubagentStop | working |
| PreCompact | sweeping |
| PostCompact | attention |
| Notification | notification |
## Gemini CLI Hook Notes
Gemini CLI stays on hook-only integration, but two Gemini-native events are intentionally not forced into the shared Claude/Codex semantics:
| Gemini Hook Event | Clawd behavior |
|---|---|
| AfterAgent | Recorded as `AfterAgent` and the session returns to `idle`. It does not remap to shared `Stop`, so Gemini turns no longer auto-show the `attention` / done animation. |
| PreCompress | Recorded as `PreCompress` in session history, but does not switch the pet to `sweeping`. The current visible state (usually `thinking` or `working`) stays in place. |
## Pi Extension Events
Pi uses a global extension (`~/.pi/agent/extensions/clawd-on-desk`) and maps interactive-session lifecycle events to shared Clawd states:
| Pi Extension Event | Clawd Event | State |
|---|---|---|
| session_start | SessionStart | idle |
| before_agent_start | UserPromptSubmit | thinking |
| tool_call | PreToolUse | working |
| tool_result (ok) | PostToolUse | working |
| tool_result (isError) | PostToolUseFailure | error |
| agent_end | Stop | attention |
| session_before_compact | PreCompact | sweeping |
| session_compact | PostCompact | attention |
| session_shutdown | SessionEnd | remove session; idle if no live sessions |
Pi is state-only in Clawd for now: permission approvals remain in Pi's own terminal/TUI.
## Mini Mode
Drag to the right screen edge (or right-click → "Mini Mode") to enter mini mode — half-body visible at screen edge, peeking out on hover.
| Trigger | Mini Reaction | Clawd | Calico | Cloudling |
|---|---|---|---|---|
| Default | Breathing + blinking + eye tracking |
|
|
|
| Hover | Peek out + wave |
|
|
|
| Notification | Alert pop |
|
|
|
| Task complete | Happy celebration |
|
|
|
## Click Reactions
Easter eggs — try double-clicking, rapid 4-clicks, or poking Clawd repeatedly to discover hidden reactions.