Skip to content
2 min read · 416 words

Interface: WorkingSet

Defined in: src/batteries/context/thrift/subtractive_pass.ts:144

The mutable working set a dispatch starts from — the "everything reasonable" set this pass subtracts down to what fits. Every field is a local structural type from @nhtio/adk/batteries/context/thrift/contracts — nothing here requires a core ADK value.

Properties

PropertyTypeDescriptionDefined in
image?WorkingImageOptional image (or other flat-cost media) attachment. The single biggest token hog.src/batteries/context/thrift/subtractive_pass.ts:179
memoriesWorkingMemory[]Durable memories available to this dispatch — sheds lowest-importance first (step 5).src/batteries/context/thrift/subtractive_pass.ts:160
messagesWorkingMessage[]The conversation history this dispatch would replay — sheds stale ephemeral control messages first (step 6), then the oldest turns (step 7); the newest turn is always kept.src/batteries/context/thrift/subtractive_pass.ts:158
retrievablesWorkingRetrievable[]Retrieved (RAG) passages available to this dispatch — sheds the tail of the ranking (lowest score) first (step 4), keeping the best-ranked chunks.src/batteries/context/thrift/subtractive_pass.ts:163
standingInstructions?(string | ContentLike)[]Durable directives the caller renders into every dispatch (the caller's battery counts these too). They are a FIXED cost like the system prompt — never shed — so the pass only ADDS them to the running total, never trims them. Omit (or pass an empty array) when the caller uses none. A consumer that DOES render standing instructions must pass them here or thrift would undercount relative to the caller's own guard.src/batteries/context/thrift/subtractive_pass.ts:155
systemPromptstring | ContentLikeThe dispatch's system prompt. Measured ctx-resolved (see subtractToFit's renderCtx option) to match what a caller's own overflow guard counts.src/batteries/context/thrift/subtractive_pass.ts:147
thoughtsWorkingThought[]Model-internal guidance content (plans, per-iteration nudges, and — unless stripPriorTurnThoughts is disabled — prior-turn chain-of-thought, dropped in step 1). Surviving thoughts are sheddable oldest-first as a last resort (step 8), except any ids named in protectThoughtIds.src/batteries/context/thrift/subtractive_pass.ts:168
toolCalls?WorkingToolCall[]Prior-turn (and this-turn) tool calls whose RENDERED RESULTS the caller puts in the prompt. Omit (or pass an empty array) when the caller doesn't measure them — the pass then treats tool-result weight as 0.src/batteries/context/thrift/subtractive_pass.ts:177
toolsWorkingToolRegistryThe tool registry this dispatch draws visible tools from — mutated via setHidden as tools are shed (steps 2 and 9).src/batteries/context/thrift/subtractive_pass.ts:171