Loading ACP sessions from disk

Inspect GtLACPClaudeCodeSessionStore GtLACPExternalSessionStore << #GtLACPClaudeCodeSessionStore slots: {}; tag: 'Session discovery'; package: 'Gt4Llm-ACP' or GtLACPCodexSessionStore GtLACPExternalSessionStore << #GtLACPCodexSessionStore slots: {}; tag: 'Session discovery'; package: 'Gt4Llm-ACP' to browse saved sessions and copy a session ID:

claudeStore := GtLACPClaudeCodeSessionStore new read.
claudeStore
  
codexStore := GtLACPCodexSessionStore new read.
codexStore
  

The default storage roots are ~/.claude and ~/.codex. Set CLAUDE_CONFIG_DIR or CODEX_HOME in GT's environment to use another location.

Replace the ID below to load a Claude Code session with GtLACPExternalSessionStore>>#loadSession:configureClient: loadSession: anId configureClient: aBlock | storedSession directory client | storedSession := self sessionWithId: anId. directory := storedSession directory. directory ifNil: [ self error: 'Session found, but its project directory is unknown: ' , anId asString ]. directory isDirectory ifFalse: [ self error: 'The recorded project directory no longer exists: ' , directory fullName ]. client := self newClient. aBlock value: client. ^ client loadSession: storedSession sessionId in: directory . The store finds the project directory and creates the matching client:

sessionId := 'your-session-id'.
session := claudeStore
    loadSession: sessionId
    configureClient: [ :client |
        client configuration requestTimeout: 180 ].
session
  

For Codex, use codexStore in the same expression. Send GtLACPExternalSessionStore>>#read read sessions removeAll. issues removeAll. rootDirectory isDirectory ifFalse: [ self issueFor: rootDirectory line: nil description: 'Storage directory is absent'. ^ self ]. [ self readSessions ] on: Error do: [ :error | self issueFor: rootDirectory line: nil description: error messageText ]. ^ self again to refresh the list.

When only the ID is known, traverse both stores using GtLACPExternalSessionStore>>#sessionWithId:ifPresent: sessionWithId: anId ifPresent: aBlock ^ self sessionWithId: anId ifPresent: aBlock ifAbsent: [ nil ] :

sessionId := 'your-session-id'.
session := nil.
stores := {
    GtLACPClaudeCodeSessionStore new read.
    GtLACPCodexSessionStore new read }.

stores do: [ :store |
    store
        sessionWithId: sessionId
        ifPresent: [ :storedSession |
            session := store
                loadSession: storedSession sessionId
                configureClient: [ :client |
                    client configuration requestTimeout: 180 ] ] ].

session
  

The result is nil when neither store contains the ID. If both match, both sessions are loaded and the last result is retained.

Inspect Read problems if a session is missing. Loading requires a known project directory that still exists and an adapter that supports resuming the session.