magi-code 0.80.2

Repository-aware CLI coding agent for terminal work
Documentation
<!-- Generated by generate-agent-docs; preserve verified project-specific guidance when regenerating. -->
# Mission Control agent guide

Mission Control connects terminal input, worker events, and display projections. Non-interactive clients use `../service/`.

## Where to look

| Task | Location |
| --- | --- |
| Entry, event variants, send helpers | `mod.rs` |
| Output sink and delivery classification | `events/mod.rs`, `events/delivery.rs` |
| Terminal restoration and graphics | `terminal.rs`, `terminal/` |
| Loop, input capture, pacing, worker reconciliation | `controller/`, `worker.rs` |
| Semantic input, display state, drawing | `input/`, `state/`, `render/` |
| Session picker and hydration | `sessions/` |
| Transcript storage, cards, selection projection | `transcript.rs`, `transcript_cards/`, `transcript_projection.rs` |
| Diff page and refresh/save worker | `diff.rs`, `diff/render.rs`, `diff/worker.rs` |
| Settings drafts and geometry | `settings_editor.rs`, `settings_editor/render.rs` |
| Shared modal shell, sizing and tabs | `modal_container.rs` |
| Usage recording and quota | `session_usage.rs`, `usage.rs`, `controller/app/codex_quota.rs` |
| Side conversation | `controller/app/side.rs`, `render/transcript_modal.rs` |
| Child prompt editing and runtime controls | `controller/app/subagent_prompt.rs`, `../subagents/control.rs` |
| Image previews | `images.rs`, `terminal/graphics.rs` |
| Prompt editing, completion, selection | `prompt_editor.rs`, `single_line_field.rs`, `autocomplete.rs`, `selection.rs` |
| Repository-shared prompt suggestions | `prompt_history.rs`; load: `controller/app/startup.rs`; durable submission: `events/mod.rs` |
| Initial agent screen | `screens/primary_agent_startup.rs` |
| First-launch release notes and paging | `release_notes.rs`, `render/transcript/welcome.rs`, `../../docs/features/release-notes.md` |

## Local contracts
- Modal containers use `modal_container.rs`: plain border, `theme.app()` background, name at top left, truthful Esc hint at top right, shortcuts on the bottom border, and shared Settings-style tabs. Normal sizing defaults to 60% × 60% and stays within 30–80% per dimension; diff comments explicitly use compact 40% × 20% sizing. Drawing and input must use the same geometry.

- The main event channel holds 1024 events. Best-effort previews reserve 64 slots when capacity permits; critical sends use bounded waits and report failure. Keep synchronous delivery and worker-outcome reconciliation when final delivery fails.
- Record usage starts and snapshots before event delivery; reconcile worker usage before folding completed runs. Totals outlive transcript/activity retention.
- `/settings` retains scoped drafts, saves changed paths, and requires restart. Model availability belongs in Settings → Models; `/models` is retired. `/model` uses cache only, even when stale or missing; explicit refresh retains completion outside the wake queue.
- `/side` has its own session, worker, events, steering, and MCP connections but shares prompt execution and the primary renderer. Hiding does not cancel. Reset reconciles and joins old work before replacement and closes old MCP connections off-thread. Side history stays outside primary selection; only `/reset` is accepted inside the modal.
- Diff replaces the body but retains Prompt and the rail. Git reads and comment saves belong in `diff/worker.rs`; worktree comment storage belongs in `../diff_review/`.
- `TranscriptEntries` owns row ids, timestamps, activity links, and revisions. Move the whole store during hydration and decode historical tool text at ingestion. History indexes are lazy and width-specific; streaming cache reuse must preserve final Markdown and width/theme/focus invalidation.
- Image references are untrusted. The bounded preview worker reuses `tools.view_image` path policy with separate decode limits. Drawing records visible rows; the controller requests them. Kitty writes/cleanup belong to the terminal owner, never transcript or copy text; unsupported terminals and multiplexers remain text-only.
- Child drafts stay separate from the primary prompt. The viewer uses skill-only completion, rejects slash commands, and treats `!` literally. Steering/cancellation use runtime controls. Completed children are read-only except pending-input recall; pending child steering blocks a new primary run.
- Prompt history is local display data, never provider context. Filesystem work stays in startup/run workers; durable user-prompt and steering announcements record submissions, not automatic continuations. Child and side prompts remain excluded. Right Arrow accepts only a painted suggestion at draft end; token completion takes priority.
- `perf.rs` measures scroll apply-to-successful-draw time, not input queue wait or physical display latency.
- Terminal restoration must cover errors and panics. Use the owning module's existing tests and inherited verification commands.