Studio Notebook

Claude Code Atlas

Query Prompts And Recovery Messages

See the direct text instructions the query system injects during compaction and continuation.

Why this matters

The query layer does not only move data around. It also injects direct instructions that reshape what the model is allowed to do next.

Big picture first

Two especially important messages live in this subtree: the compaction prompt, which asks the model to summarize old history, and the continuation nudge, which tells the model to keep working instead of stopping early.

Compaction prompt preamble

services/compact/prompt.ts

CRITICAL: Respond with TEXT ONLY. Do NOT call any tools.

- Do NOT use Read, Bash, Grep, Glob, Edit, Write, or ANY other tool.
- You already have all the context you need in the conversation above.
- Tool calls will be REJECTED and will waste your only turn — you will fail the task.
- Your entire response must be plain text: an <analysis> block followed by a <summary> block.

The compaction agent gets only one turn, so the prompt is aggressive. It is not trying to be polite. It is trying to prevent a failed recovery path.

Code walk

The continuation message is much shorter, but it has a clear behavioral job. The exact runtime code is:

export function getBudgetContinuationMessage(
  pct: number,
  turnTokens: number,
  budget: number,
): string {
  const fmt = (n: number): string => new Intl.NumberFormat('en-US').format(n)
  return `Stopped at ${pct}% of token target (${fmt(turnTokens)} / ${fmt(budget)}). Keep working — do not summarize.`
}

In plain shape, that message starts as Stopped at {pct}% of token target. That last sentence matters. The runtime is telling the model that the turn is not done yet.

Takeaways

  • Prompt text is part of the runtime, not just a side note.
  • Compaction prompts are strict because a denied tool call would waste the only turn.
  • Short recovery messages can still strongly steer model behavior.