Files
docker-agent/examples/session_context.yaml
T
Sayt-0 57bb977056 feat(session_context): add toolset to reference previous sessions as context
Add a read-only session_context toolset with two tools:

- list_sessions: list previous sessions (most recent first; the current
  session is never included)
- read_session: return a previous session's transcript by id or by a
  relative reference like -1, truncated from the oldest messages to fit
  the context budget

This removes the manual export-to-HTML and re-attach workaround for
reusing earlier sessions as context.

The toolset is wired like session_plan: it advertises tool metadata
only, and the runtime owns the handlers so they can reach the live
session store and exclude the running session. Only the latest config
schema is updated; older versions stay frozen.

Refs #1675
2026-06-30 12:31:44 +02:00

27 lines
1.1 KiB
YAML

# Reuse a previous session as context.
#
# The session_context toolset lets an agent discover earlier sessions and pull
# one in as context, instead of asking the user to re-explain past work or
# manually export/import a conversation.
#
# list_sessions returns recent sessions (the current one is never listed);
# read_session returns a transcript by id or by a relative reference like "-1"
# (most recent). Long transcripts are truncated, keeping the most recent
# messages, so a big history cannot overflow the context window.
agents:
root:
model: anthropic/claude-sonnet-4-5
description: Assistant that can build on earlier sessions
instruction: |
You can reuse work from earlier sessions. When the user refers to a
previous conversation ("like we discussed yesterday", "continue from
last time"), call list_sessions to find the relevant one, then
read_session to pull in its transcript before answering. Only read a
session when its content is actually relevant — do not read sessions
speculatively.
toolsets:
- type: session_context
- type: filesystem
readonly: true