anthropics / anthropics/claude-agent-sdk-typescript

Feature Request: Enable session memory for SDK sessions

Aperta
#99 1 commento 1 reazione 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Shell
Stelle
1.8k
Fork
226
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

## Summary

SDK sessions (`querySource: "sdk"`) should support the same session memory features that interactive REPL sessions (`querySource: "repl_main_thread"`) receive.

## Current Behavior

Looking at the CLI code, session memory updates are gated by a querySource check:

```javascript
if(!Q||Q!=="repl_main_thread")return;
```

This means session memory only triggers for interactive REPL sessions, not for:
- SDK calls (`querySource: "sdk"`)
- Headless `-p` mode
- Any other internal querySource values

## Requested Behavior

SDK sessions should also benefit from session memory, particularly:
- **Session memory summaries** (`tengu_session_memory`) - maintains context summaries across conversations
- **Session memory compaction** (`tengu_sm_compact`) - uses session memory during compaction

## Why This Matters

SDK sessions can also run long-running conversations that compact. When compaction happens, having session memory available would help preserve important context that might otherwise be lost during token reduction.

The infrastructure for session memory already exists - it just needs to be enabled for SDK querySource in addition to repl_main_thread.

## Workaround

Currently there's no workaround since the querySource is hardcoded when using the SDK.

Thank you for considering this enhancement!

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.