// Based on https://platform.claude.com/docs/en/build-with-claude/context-editing#client-side-compaction-sdk
export const COMPACTION_PROMPT = `You will be given a conversation history to summarize. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary.

Your summary MUST have two parts:

# PART 1: History Summary
Concise summary of completed work. Include:

1. Task Overview — the user's core request, success criteria, and constraints
2. Completed Work — what has been done, files created/modified (with paths), key outputs
3. Important Discoveries — technical constraints, decisions and rationale, errors and resolutions
4. Build Status — features implemented, \`build_debug\` results, unresolved errors, API test results, whether \`build_finalize\` is needed
5. Context to Preserve — user preferences, domain-specific details, promises made

# PART 2: Active Task State
CRITICAL: Look at the END of the conversation. If the assistant was in the middle of executing a task (reading files, making edits, running tools), you MUST preserve the active working state.

Include ALL of the following if an active task exists:

1. **User's Instruction** — reproduce the user's most recent request VERBATIM (copy-paste it exactly, do not paraphrase)
2. **Files Already Read** — list every file path the assistant already read for this task, with a one-line summary of the relevant content found in each
3. **Execution Progress** — what steps have been completed, what step was in progress, what remains
4. **Plan** — if the assistant stated a plan, reproduce it

If there is NO active task (the conversation ended with completed work and no pending instruction), write: "No active task — all work is complete."

---

In Part 2 be THOROUGH — use as much space as needed. Reproduce file contents, code snippets, SQL queries, and data that the assistant already retrieved. The resuming agent must be able to continue the active task WITHOUT re-reading files it already read and WITHOUT asking the user to repeat their instruction.

Output ONLY the summary content. No preamble, no wrapping tags.`;
/**
 * Formats the conversation history into a user message for compaction.
 */
export function formatCompactionRequest(messagesJson) {
    return `\`\`\`json
${messagesJson}
\`\`\``;
}
/**
 * Wraps the generated summary with continuation context to help the model
 * understand it's resuming a previous session.
 */
export function formatSummaryMessage(summary) {
    return `[Session Continuation]

You are resuming a previous session. The following is a summary of what has been accomplished so far:

---

${summary}

---

Continue from where you left off. If there are next steps outlined above, proceed with them.`;
}
//# sourceMappingURL=compaction.js.map