feat(terminal): persist user terminal history for agents#1540
Merged
Conversation
Persist rotating plain-text transcripts for user-created terminal sessions, including command metadata, exit codes, cwd changes, and shell-attributed output. Configure transcript storage for desktop and CLI, recover transcript indexes across restarts, and retain active sessions plus the most recent completed sessions. Add progressive READ_TERMINAL prompt guidance so agents can inspect local terminal evidence when command or output context is missing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
terminalsdirectory.AGENTS.mdthat explains how agents can search and inspect the transcript files.{READ_TERMINAL}prompt placeholder so local agents can progressively discover terminal history when relevant execution evidence is missing from the conversation.Fixes #
Type and Areas
Type: Feature
Areas: Rust core, terminal service, desktop/Tauri, CLI, agent prompt assembly
Motivation / Impact
Users often refer to commands they previously ran or report command-line, build, test, script, or process failures without including the exact command or complete output. Previously, agents could not recover that execution evidence after it had scrolled out of the visible terminal.
This change provides durable, bounded terminal transcripts that agents can inspect when the missing terminal context materially affects the task. Transcript discovery follows a progressive-loading model: the normal prompt only identifies when terminal history may be useful and points to the generated
AGENTS.md; the transcript files are read only when needed.Shell-integrated terminals record actual executed commands and attributed output rather than intermediate command-line editing. The PowerShell/ConPTY handling also preserves late or reordered command output after command completion.
Transcript storage defaults to:
The on-disk layout is:
Verification
pnpm run fmt:rscargo check -p terminal-corecargo test -p terminal-corecargo test -p terminal-core transcript::tests -j 1cargo test -p bitfun-core --lib local_terminal_transcript_placeholder_includes_the_agents_path -j 1cargo test -p bitfun-core --lib remote_terminal_transcript_placeholder_is_omitted -j 1node scripts/check-core-boundaries.mjsReviewer Notes
<user-data>/terminals.index.jsonstores session metadata and the shorttranscript_id; segment lists remain internal and are discovered by listing the transcript directory.terminal-transcriptsdirectory name is included because the feature has not been released.Checklist