Context
Budgeted context assembly for reliable coding agents
Context
A3S Code treats context as a budgeted resource. The model should see the smallest useful context for the current decision, not every available file, skill, memory, and tool log.
Sources
Context can come from:
- user prompt and conversation history
- AGENTS.md project instructions
- skills and agent definitions
- memory stores
- file search and direct tool results
- MCP tools and context providers
- AHP harness responses
- delegated task summaries
- trace events
AGENTS.md injection, skills discovery, memory APIs, direct tool results,
delegated task helpers, and traceEvents() are part of the documented Node SDK
surface. Validate MCP/AHP context behavior against your own live integrations
before documenting it as product behavior.
Assembly
sources -> ContextItem -> rank -> dedupe -> budget -> renderLong grep output, logs, and child transcripts should be preserved outside the prompt and summarized into prompt-safe evidence. Use session.traceEvents() for compact runtime evidence.
Compaction
Enable automatic compaction for long sessions:
const session = agent.session('/repo', {
autoCompact: true,
autoCompactThreshold: 0.75,
});Validate the exact compaction behavior for any product workflow that depends on it.