magi-code 0.80.2

Repository-aware CLI coding agent for terminal work
Documentation
# Local transcript images

Mission Control shows actual Kitty graphics below the text of `view_image` cards and completed assistant Markdown containing `![description](path/to/image.png)`. Previews are limited to the main transcript; activity details, subagent viewers, exports, selection, and provider history remain text-only. Markdown previews appear after the card text, not inside a paragraph. Each image reserves 20 scrollable rows, with up to four references per Markdown card. Preview rows use the card body background and contain no overlapping text.

## Terminal support

Automatic detection accepts `TERM=xterm-kitty` or `TERM_PROGRAM=ghostty`, with TTY input/output and nonzero cell pixel dimensions reported by the operating system. This is a conservative terminal-name check, **not a capability-query handshake**. Unknown terminals, tmux, GNU Screen, and terminals without pixel dimensions keep text only. Nothing changes tmux settings or consumes terminal input for detection.

The implementation uses native Kitty placements and source cropping, not colored character approximations or Unicode placeholders. It does not require `ratatui-image`. Cell dimensions refresh before drawing. Images are clipped to visible transcript rows, including when the image's top has scrolled away. Opening a modal, autocomplete, or toast hides all image placements until the overlay closes.

## Local files only

- Only regular PNG, JPEG, GIF, and WebP files with matching signatures are accepted. Animated files show one frame.
- URLs, data URLs, file URLs, network-share references, and paths containing colons or control characters are rejected. No image downloads, browser calls, or subprocesses occur.
- Relative paths resolve from the current workspace and cannot escape it through `..` or symlinks. Absolute paths outside the workspace require `tools.view_image.absolute_paths`. Replayed tool parameters and Markdown destinations are untrusted references, never permission grants; display metadata is not used as a loading authority.
- Missing, disallowed, corrupt, or oversized files retain the card text with an empty preview area. A preview does not call the vision provider or change the `view_image` tool result.

## Work and memory limits

One worker reads, decodes, resizes, and base64-encodes images outside drawing. Request and result channels each hold one item, with at most one request in flight. The controller polls pending results without blocking input. Shutdown closes the channels; it never waits for a blocked filesystem read or decoder before restoring the terminal.

The worker fits pixels within 120 columns and 20 rows without enlarging the source or changing its proportions, then adds transparent padding to whole-cell boundaries. Visible rows crop exact cell-height strips; drawing never resizes pixels. Viewport width or cell-size changes discard cached preparations and stale worker results. Cell sizes exceeding 640×320 pixels keep text only.

Input is bounded by the smaller of `tools.view_image.max_image_bytes` and 8 MiB. Decoder limits are 4096 pixels per dimension and a 64 MiB allocation budget. Prepared images are at most 1280×1280 RGBA pixels. The application cache holds 16 results, including failed loads; the terminal holds at most 16 uploaded images and a frame has at most 64 row placements. Upload payload chunks are at most 4096 base64 bytes.

Files are snapshots while cached, not watched for changes. Cache eviction, session changes, workspace changes, or image-policy changes cause fresh validation and loading. Results from the previous session/policy are discarded. Terminal placements are removed before redraw, and image data is deleted on session/policy changes, normal exit, errors, and panic restoration. Graphics commands never enter transcript text or clipboard content.

## Verification

Unit and TestBackend tests cover local-file policy, corrupt/oversized inputs, pixel preparation, worker request bounds, text fallback, clipping, overlay suppression, and protocol commands. They do not establish physical-terminal rendering. Manual checks should cover Kitty and Ghostty scrolling, resizing, modal open/close, session switching, and exit cleanup.

Protocol reference: [Kitty graphics protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/).