agentleFS
InfiniteRoomLabsInfiniteRoomLabs/agent-ops/skills/tmux-session-capture/SKILL.md

tmux-session-capture

Skill0 starsChanged 5 months agoMITView on GitHub

Ingest the user's pre-agent terminal context by capturing tmux pane scrollback with tdump. Use when the user says 'catch up on what I was doing', 'look at my terminal', 'see my shell history', references commands or output from before the agent session started, or hands you a scrollback dump file.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Default output: /tmp/tmux-session.txt.

    line 23
  2. Very specific:

    If tdump is missing on the machine, fall back to the raw command: tmux capture-pane -p -S - -J > /tmp/tmux-session.txt.

    line 26
  3. Very specific:

    Never treat a mid-session capture as a session transcript.

    line 44
  4. Very specific:

    Run fish -c tdump (or the raw tmux command).

    line 49
  5. Distinctive:

    Read the output file. It may be large.

    line 50
  6. Distinctive:

    Do not echo the whole dump back at the user -- summarize what you learned.

    line 52

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

tmux Session Capture

Capture the user's tmux scrollback so the agent can read their pre-session shell work instead of asking them to copy-paste it.

The mechanism

tdump is a fish function (~/.config/fish/functions/tdump.fish):

tmux capture-pane -p -S - -J > $out   # full scrollback, wrapped lines joined
echo $out                              # echoes path, so (tdump) composes inline
  • Default output: /tmp/tmux-session.txt; optional arg overrides the path.
  • From bash (agent Bash tool): fish -c tdump, then Read the printed path.
  • User-side idiom: claude "read (tdump) and catch up on what I was doing".
  • If tdump is missing on the machine, fall back to the raw command: tmux capture-pane -p -S - -J > /tmp/tmux-session.txt.

When to use

  • The user references shell work you didn't witness: "as you can see", "that error above", "what I was just doing".
  • Bootstrapping an agent session on top of an active terminal workflow.
  • Debugging something the user ran interactively before invoking the agent.

Critical limitation -- the TUI repaint trap

Claude Code (and most TUI agents) repaint the screen in place. Agent conversation history never lands in tmux scrollback. A capture taken mid-session yields only:

  1. Scrollback from before the agent session started, and
  2. A snapshot of the current viewport (which will include the live spinner and statusline, mid-render).

Consequences:

  • Capture is most valuable before entering the agent session -- that is the intended workflow.
  • Never treat a mid-session capture as a session transcript. The real record is the transcript JSONL under ~/.claude/projects/<project-dir>/, searchable via aichat "query".
  • capture-pane grabs the current pane only. Multi-pane workflows need one capture per pane (tmux capture-pane -p -S - -J -t <pane-id>).

Recipe

  1. Run fish -c tdump (or the raw tmux command).
  2. Read the output file. It may be large; prefer tail-first if you only need recent context.
  3. Mine it for: commands run, errors hit, files touched, versions printed.
  4. Do not echo the whole dump back at the user -- summarize what you learned.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.