Retrieve flattened content
retrieve_flattenedRetrieve original tool result content from a flattened session backup by specifying the tool use ID and session ID from the conversation.
Instructions
Retrieve original tool result content from a flattened session, read straight from its backup. When you see [FLATTENED id=XXX tool=Read ... | text NNNB/NNL | session=YYY | ...] in the conversation, call this with the value after "id=" as tool_use_id and the value after "session=" as session_id, and set agent to match the session ("claude" default, or "codex"). Returns the original text output, or — for flattened screenshots (claude) — the actual image so you can view it again.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent | No | Which agent's session store the flattened session lives in: "claude" (default) or "codex". | claude |
| claude_dir | No | Absolute path (or ~/...) to the Claude config dir whose sessions to target — the dir holding projects/, e.g. ~/.claude-2 for a second profile. Default: $CLAUDE_CONFIG_DIR if set, else ~/.claude. Applies to agent "claude" only. | |
| codex_home | No | Absolute path (or ~/...) to the Codex home whose sessions to target — the dir holding sessions/. Default: $CODEX_HOME if set, else ~/.codex. Applies to agent "codex" only. | |
| session_id | Yes | Value after "session=" in the [FLATTENED ... session=YYY ...] marker | |
| project_dir | No | Absolute path to project. Default: the project the CLI runs in (cwd). Ignored under codex (rollouts are located by UUID globally). | |
| tool_use_id | Yes | Value after "id=" in the [FLATTENED id=XXX ...] marker |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | Yes | "text", "image", or "mixed". | |
| slot | Yes | "content"/"toolUseResult" (claude) or "output" (codex). | |
| tool_name | Yes | Originating tool name of the retrieved result. | |
| line_count | Yes | Line count of the original text projection. | |
| tool_use_id | Yes | The tool_use_id that was retrieved. | |
| original_size | Yes | Byte size of the original content. |