# Agent and inline assist

Canonical HTML: [Agent and inline assist](https://getred.dev/docs/agent). Website source: `b212874eefaf200143affa21c770fbb8855a4f5c`. Documented Red release: v0.9.1. Installer source: `b86a2ca4b92e9547d3b174910c82db8a259f5171`.

Set up Codex, use the full Agent workspace or a bounded inline request, and know when a change is saved to disk.

<a id="set-up-codex"></a>

## Set up Codex

Agent features require Codex CLI 0.144.1 or newer. Install Codex, authenticate it, and run Red's offline prerequisite check:

```shell
codex login
red --agent-check --strict
```

Red starts `codex app-server --stdio` when the first Agent session needs it. If startup fails, Red keeps your prompt so you can fix the setup and retry.

<a id="use-the-agent-workspace"></a>

## Use the Agent workspace

1. **Open Agent.**

   Press `Space A` or run `:Agent`.

2. **Write the request.**

   Press `Enter` to send. Use `Alt+Enter`, `Shift+Enter`, or `Ctrl+J` for a newline.

3. **Follow the work.**

   The transcript streams the response and groups tool activity for the turn. Press `Ctrl-c` to interrupt.

4. **Inspect the result.**

   Agent file writes pass through Red's revision-checked editor tools and are saved to disk. Use `:AgentHistory` to inspect attributed transactions.

Press `Alt+m` in the Agent pane or run `:AgentModel` to choose the model and reasoning effort for that conversation. This doesn't change your global Codex settings.

<a id="ask-about-the-current-code"></a>

## Ask about the current code

Press `Space i` for inline assist. In Normal mode, Red targets the enclosing function when syntax information is available and otherwise uses the current line. Visual and Visual Line modes use the exact selection. Visual Block isn't supported.

An exact edit can apply immediately while its original popup remains in the foreground. The result is one **unsaved, undoable** editor transaction. Background results and wider same-file proposals wait for review. In the diff, press `a` to apply or `d` to decline; `Enter` opens the review but doesn't approve it.

> **Full Agent and inline assist write differently**
>
> Full Agent file tools save their editor changes to disk. Inline code edits remain unsaved until you save the buffer. Comments and explanations don't change source text.

<a id="understand-the-boundary"></a>

## Understand the boundary

Agent threads run with a read-only Codex sandbox and no native shell or direct file-edit path. Red supplies bounded tools for workspace files, open-buffer state, diagnostics, navigation, annotations, and revision-checked edits. Reads use the latest Red buffer contents, including unsaved changes.

Paths must remain inside the physical workspace. Red rejects traversal, symlinks, special files, protected paths, stale revisions, and unsafe writes. Secret-like paths are excluded unless you set `allow_sensitive_paths = true` under `[agent]`.

Configured MCP servers and Codex features are disabled unless you name them in `enabled_mcp_servers` or `enabled_codex_features`.

<a id="return-to-earlier-work"></a>

## Return to earlier work

Press `Space H` or run `:InlineHistory` to browse inline prompts, answers, ready edits, and applied changes. Press `Space N` to reopen the latest completed inline result.

Agent conversation state and inline history participate in Red's recovery snapshots. After a restart, Red resumes a persisted Codex thread when possible. If it can't, the old transcript remains visible as archived context and the next prompt begins a new session.
