Skip to content

feat(cli): observe one session with a filtered, windowed transcript - #895

Merged
huichen merged 1 commit into
mainfrom
feat/session-transcript
Oct 3, 2026
Merged

huichen merged 1 commit into
mainfrom
feat/session-transcript

Conversation

@huichen

@huichen huichen commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

What

future session info gives a session's shape, future session history search|get finds one passage. Nothing let a caller process a whole conversation: read every user message, separate a tool's arguments from its result, pull out the paths it touched, or page a long session without loading it all into context.

This adds future session transcript --session <id>, which projects the display entries the Agent already serves (get_session_entries, honouring its forward-page cursor) through a selectable lens. Read-only: no model call, no tool execution, no session mutation.

Option Effect
--select user,assistant,thinking,tool-call,tool-result,session,compaction,all which slices to keep (default user,assistant,tool-call,tool-result; thinking is opt-in because reasoning dominates a real session's bytes)
--tool <list> one tool's calls and results
--input / --output a tool call's arguments only / a tool result's text only
--paths only the file paths a call's arguments or a result's text mention
--grep <text> literal, case-insensitive content filter
--cursor N / --limit N / --all / --max-bytes N the window, paged via nextCursor
--truncate N, --counts, --json shaping and machine-readable output

--counts gives the window's distribution (entries, block kinds, tools, errors, bytes) as a cheap first look at an unfamiliar session.

Honest limits, both documented and reported: --paths is a heuristic, and --tool attributes a tool result through the name of the call it pairs with — a result whose call is outside the scanned window cannot be attributed, so it is skipped and counted in skippedUnattributedToolResults rather than silently mislabelled.

future session info <id> also gains --json (cwd, model, thinking level, computed stats, plus the raw session metadata), which is the direct answer to "what is this session's cwd".

Why

A personal agent reading its own record (the future-self skill's use case) needs to slice a conversation, not just search it. Both new surfaces are reachable from the ordinary shell tool, so nothing new is added to the model's tool set.

Testing

  • cargo test -p future-cli --lib — 815 passed (24 new transcript tests: option strictness, selection, tool attribution, paths, grep, truncate, counts, paging/cursor, error propagation, plus session info --json)
  • cargo fmt -p future-cli --check, cargo clippy -p future-cli --no-deps --all-targets -- -D warnings
  • python3 scripts/docs/check-docs.py (+ --strict-pending), check-channel-matrix.py
  • Verified live against a real 243-entry session (typed payload path): counts, --select user --all, --paths, --tool shell --select tool-result --output, --truncate, --grep --all, --cursor continuation, --max-bytes, session info --json

Also fixes a pre-existing flake the new tests made reproducible: tools::find_tool_entry_and_image_output_dir reads HOME/FUTURE_HOME (home policy + browser catalog) but did not take the shared env lock, so a concurrent test repointing FUTURE_HOME could fail it. It now takes lock_env() like every other env-sensitive test in the crate.

`session info` gives a session's shape and `session history search|get`
finds one passage, but nothing let a caller *process* a conversation:
read every user message, separate a tool's arguments from its result, pull
out the paths it touched, or page through a long session without loading it
all into context.

Add `future session transcript --session <id>`, which projects the same
display entries `session info` already reads through a selectable lens:

- `--select` (user/assistant/thinking/tool-call/tool-result/session/
  compaction/all; thinking is opt-in because reasoning dominates bytes),
  `--tool`, `--input`/`--output`, `--paths`, `--grep`;
- a window with `--cursor`/`--limit`/`--all` and `--max-bytes`, paged
  through the Agent's existing forward-page cursor and reported as
  `cursor`/`nextCursor`/`hasMore`;
- `--truncate`, `--counts` (distribution of the window) and `--json`.

`--tool` attributes a tool result through the name of the call it pairs
with; a result whose call is outside the window is skipped and counted in
`skippedUnattributedToolResults` rather than silently mislabelled.

`future session info <id>` also gains `--json`, reporting `cwd`, model,
thinking level and the computed stats with the raw session metadata.

Docs: session-history gains the option table and the two documented limits;
self-inspection and the CLI wiki list the new surface.

Also fixes a pre-existing flake the new tests made reproducible:
`tools::find_tool_entry_and_image_output_dir` reads HOME/FUTURE_HOME but
did not take the shared env lock, so a concurrent test repointing
FUTURE_HOME could fail it.
@huichen
huichen enabled auto-merge (squash) October 3, 2026 09:27
@huichen
huichen merged commit d1ca712 into main Oct 3, 2026
12 checks passed
@huichen
huichen deleted the feat/session-transcript branch October 3, 2026 09:34
huichen added a commit that referenced this pull request Oct 3, 2026
future-skills#69 teaches future-self the session-observation surface added in
#895 (`future session transcript`, and `future session info --json`), so the
installed skill matches the CLI that ships beside it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant