agent-markdown-preview

Browser previews for coding agents

agent-markdown-preview lists recent sessions from Claude Code, Codex, Pi and OpenCode and renders their responses in a browser, with equations, syntax highlighting and diagrams. It reads the agents’ existing session histories, so no agent configuration is needed.

Sessions in the current directory

Run the command in a project directory to open an index of its recent agent sessions. Open a session to read its responses, or choose All sessions (merged) to follow the latest completed response from any session in that directory.

agent-markdown-preview
Session index for one project, with a merged preview and individual Claude Code, Pi, Codex and OpenCode sessions. The Codex session is marked as working.

The index covers sessions active in the last three days, up to eight per agent. All screenshots on this page use synthetic sessions and can be opened at full size.

Sessions across directories

Add --all to browse recent sessions across project directories, grouped by directory.

agent-markdown-preview --all
Cross-project index showing sessions grouped under decay-model and field-notes, each with a separate merged preview.

Each directory has its own merged preview. Across directories, the index follows up to 64 sessions in total.

Rendered responses

Response preview showing an exponential decay model, a rendered equation, highlighted Python code, an estimates table and a diagram.

The response view renders equations, code and diagrams in the agent’s answer.

Themes

Responses use each agent’s colour palette and follow your system’s light or dark setting by default. The session index and file previews use a neutral palette. Choose a shared theme with --theme, or fix the appearance with --appearance.

agent-markdown-preview --theme neutral --appearance dark
Claude Code response preview in its light palette.

Light

The same Claude Code response in its dark palette.

Dark

To change the palette for one agent, use a per-agent override:

agent-markdown-preview --agent-theme pi=pi-studio

See the theme documentation for more options, including custom Pi theme files.

Following a turn

Preview updates automatically as the agent finishes each turn, even without --live. The --live option adds in-progress activity in Working. With Follow activity enabled in the toolbar, the page switches from Preview to Working when a turn starts, then returns to Preview when it finishes. Working shows the recorded prompts, tool calls and results.

Working view following a prompt to check residuals, with Bash tool calls, recorded output and a call waiting for its result.

In this example, one Bash call has a recorded result while the next is still waiting.

Installation

You need Node.js 22 or later and Pandoc. OpenCode sessions require Node.js 22.13 or later.

npm install -g agent-markdown-preview

From the project directory where you are working with an agent, run:

agent-markdown-preview

This opens an index of the project’s recent agent sessions. Open a session to read its responses as they are completed. To switch to Working during each turn and back to Preview afterwards, add --live and turn on Follow activity.

For a local Markdown, LaTeX, code or diff file, pass its path to the command.

Anyone with a preview link can read its content and use its file actions, so keep these links private. See the security notes and full documentation for details.

Optional shared REPL demo

The REPL page is enabled with --repl and reads recorded submissions from agent-repl, pi-repl or Pi Studio sessions. It shows submitted code and saved plots without running code.

agent-markdown-preview --repl

The REPL page updates code and results as they are recorded, independently of --live. Add --live as well if you want to follow the agent’s in-progress activity in Working.

The video below shows Pi and Claude Code sharing a Python session with an operator.

Pi plots a Lorenz trajectory, the operator adds a nearby trajectory, and Claude Code uses both to plot their separation.

The one-minute video is silent and runs in real time, with automated typing. Internal metadata has been redacted for this recording, but live previews do not redact content.

Details of the demo

The imports and Lorenz function are loaded before filming. The Python example includes that setup.

  1. Pi integrates a Lorenz trajectory, stores it as a and plots the attractor.
  2. The operator sends b = odeint(lorenz, [1.0001, 1, 1], t) with !agent-repl-py, from Pi’s shell mode.
  3. Claude Code uses a and b to plot how their separation grows. Both plots appear inline on the REPL page.