magi-code 0.77.1

Repository-aware CLI coding agent for terminal work
Documentation
# Session summarizer

Mission Control can turn recent session activity into short progress entries in the **Summary** pane. It is disabled by default and currently unavailable in the application service.

## Start and stop

- Open **Summary** in the right-side rail, or press `Alt-2`.
- Click **Start** or **Stop**; `Enter` toggles it while the Summary pane is focused.
- Use `/summarize-start` or `/summarize-stop` from the prompt.

The pane shows **Running** during a provider request, **Waiting** while enabled between requests, and **Stopped** when disabled. Stopping keeps existing entries. The enabled state and progress are saved per session and restored when you resume it. Only the selected session is observed by this Mission Control instance.

## Session files and scrolling

The Summary tab uses its top 40% for the summary log and controls, and its bottom 60% for **Session files**. The alphabetical folder tree keeps one entry per normalized path, accumulating `R` (read), `W` (written), and `E` (edited) labels. It works even when summarizing is stopped.

Selecting the Summary tab keeps focus on the prompt. `Tab` cycles Prompt, Transcript, Summary, and Session files. Click either section to focus it directly. Arrow and Page Up/Down keys scroll the focused section; the mouse wheel scrolls the section under the pointer. Each section keeps its own position. Plain `f` types into the prompt instead of switching sections.

File activity comes from dedicated `read`, `write`, and `hash_edit` results, including live subagent tool details. Successful items in partial results are retained; moves and deletions count as edits. Bash commands and other tools are not tracked. Resume restores evidence available in the loaded session's recorded tool results; it does not scan child session files. Missing metadata and relative child paths from other working directories can make this view incomplete. This display adds no durable session fields and is not an audit log. It holds up to 4,096 paths and marks omissions; exceptionally long or deeply nested paths are also omitted.

## Settings

Set `agent.summarizer` in global or project `settings.json`; see [Configuration](configuration.md#session-summarizer) for an example and merge rules.

| Setting | Behavior |
| --- | --- |
| `auto_start` | Default `false`. Supplies the initial enabled state when a session has no saved summarizer state; a saved Start/Stop choice takes precedence. |
| `provider`, `model` | Omit both to follow the active agent. A model-only override uses the active provider. A different built-in provider can use its default model; a different custom provider requires an explicit model. |
| `reasoning` | Omit to inherit the active agent's level, or choose `default`, `low`, `medium`, `high`, `x_high`, or `max`. Support depends on the provider/model. |
| `prompt` | Replaces the built-in system prompt, rather than adding instructions. Blank values are rejected; only the first 8,000 characters are used. |

A custom prompt must still request a JSON array containing zero to six nonempty strings, each at most 600 characters. Return `[]` when there is no meaningful progress. Treat observed activity as data, not instructions. The built-in prompt is [`prompts/summarizer.md`](../../prompts/summarizer.md).

The built-in prompt asks for zero to two meaningful outcomes per update, grouping related steps and skipping routine reads, searches, plans, and repeated progress. Activity headers identify the primary session and each subagent. Child outcomes must use `Subagent <source id>: ` so their work is not attributed to the primary agent. Custom prompts replace these instructions; the parser still accepts up to six entries.

## Cost, storage, and limits

- Summarizing makes **additional provider calls**, using the selected provider's credentials and quota. Recent user/assistant text, tool activity, and turn status are sent after sensitive-text redaction; this is not a guarantee that session content is safe to share.
- The observer has no tools. Its entries do not replace conversation history, change session titles, or compact the agent's context. Use `/compact` for context compaction.
- A background worker checks for new activity roughly every three seconds between requests. It observes the primary session and discovered subagent sessions, up to 33 sources total.
- Each source read is bounded to its latest 128 events and 256 KiB. A request includes at most 24,000 characters of new activity and the latest 12 summary entries. Older activity can be omitted; this is a progress view, not a complete audit.
- Exact duplicate entries are skipped against the prior 12 entries and within each new batch. Reworded entries are not automatically deduplicated.
- Provider responses are limited to 16 KiB with a 60-second cancellation deadline. Invalid output or provider/storage errors appear in the pane and pause observation. Resolve the cause, then use `/summarize-start` to retry.
- Summaries live separately at `<sessions directory>/summaries/<session-id>.jsonl`, using protected session storage and a single-observer lock. Checkpoints save the enabled state, observed positions, discovered children, and latest **200 entries**. Older batches remain in the append-only log; it is not capped at 200 records.
- The Summary pane displays the latest **128 entries**, with scrolling and display sanitization. Stopping does not delete the summary log.

Implementation: [`src/summarizer.rs`](../../src/summarizer.rs) owns observation, provider calls, and storage; [`src/tui/state/summary.rs`](../../src/tui/state/summary.rs) owns display state.