Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions packages/agent/src/adapters/claude/session/jsonl-hydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,12 @@ export function rebuildConversation(
return turns;
}

const CHARS_PER_TOKEN = 4;
const DEFAULT_MAX_TOKENS = 150_000;
const LARGE_CONTEXT_MAX_TOKENS = 800_000;
// JSON-heavy tool payloads tokenize at ~2.5-3 chars/token, so estimate low.
const CHARS_PER_TOKEN = 3;
// Target ~half the context window, leaving headroom for the system prompt,
// tools, skills, estimation error, and the resumed run's own work.
const DEFAULT_MAX_TOKENS = 80_000;
Comment thread
tatoalo marked this conversation as resolved.
const LARGE_CONTEXT_MAX_TOKENS = 400_000;

function estimateTurnTokens(turn: ConversationTurn): number {
let chars = 0;
Expand Down
Loading