sketch: add session history tools using markdown table API
Add session history tools to allow the LLM to access previous sketch sessions:
- New list_recent_sketch_sessions and read_sketch_session tools
- Integration with skaband client for session data retrieval
- Session history tools automatically added when skaband client available
- Updated agent configuration to include skaband client
- Client handles plain text markdown table response from API
- Display server-generated markdown table directly to LLM
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: s693acdfdaaa392c8k
diff --git a/loop/agent.go b/loop/agent.go
index 0d32420..1d21a48 100644
--- a/loop/agent.go
+++ b/loop/agent.go
@@ -28,6 +28,7 @@
"sketch.dev/llm"
"sketch.dev/llm/ant"
"sketch.dev/llm/conversation"
+ "sketch.dev/skabandclient"
)
const (
@@ -989,6 +990,8 @@
Commit string
// Prefix for git branches created by sketch
BranchPrefix string
+ // Skaband client for session history (optional)
+ SkabandClient *skabandclient.SkabandClient
}
// NewAgent creates a new Agent.
@@ -1211,6 +1214,13 @@
}
convo.Tools = append(convo.Tools, browserTools...)
+
+ // Add session history tools if skaband client is available
+ if a.config.SkabandClient != nil {
+ sessionHistoryTools := claudetool.CreateSessionHistoryTools(a.config.SkabandClient, a.config.SessionID, a.gitOrigin)
+ convo.Tools = append(convo.Tools, sessionHistoryTools...)
+ }
+
convo.Listener = a
return convo
}