Skip to main content

Compact Command

The /compact command is a powerful capability that allows you to compress your conversation history to free up context window space while preserving essential context, architectural decisions, and pending tasks.

PostQode supports two modes of compaction: User-Triggered and Auto-Triggered.


User-Triggered Compaction

When your context window is filling up but you want to continue working in the same task, you can manually trigger compaction:

  1. Type /compact in the chat input field.
  2. PostQode will analyze the conversation history and generate a comprehensive summary.
  3. You will be presented with a preview of the generated summary to review:
    • Accept: If you approve, the detailed conversation history is truncated, and only the summary is kept as context.
    • Feedback: If the summary is missing important details, type your feedback. PostQode will use this feedback to regenerate a revised summary for you to review again.
info

Unlike /newtask, which creates a completely new task, /compact keeps you within the same task workspace and history.


Auto-Triggered Compaction

PostQode includes an intelligent Auto-Compaction (or Auto-Condense) feature (which can be toggled on/off in Settings). When the current context window usage crosses the threshold (default: 75% for next-generation models):

  1. PostQode automatically initiates a silent compaction process without interrupting your flow.
  2. It generates the conversation summary, including a special Required Files section.
  3. Automatic File Restoration: PostQode parses the Required Files list, reads up to 8 of the most critical files (capped at 100KB), and pre-loads their latest content into the new context window. This ensures that the agent doesn't lose access to the files it was actively working on.
  4. Browser Session State Sync: If you are using Web Agent with an active browser session, PostQode automatically resets the element locator snapshots. Since the previous conversation steps are truncated, resetting prevents the agent from referencing stale snapshots.

Summary Structure

When PostQode compacts a conversation, it captures the following sections:

  1. Primary Request and Intent: The user's original goals.
  2. Key Technical Concepts: Coding standards, frameworks, and conventions discussed.
  3. Files and Code Sections: A list of all files created, modified, or examined, along with key code snippets.
  4. Problem Solving: Troubleshooting steps, errors encountered, and how they were resolved.
  5. Pending Tasks & Next Steps: Verbatim quotes and details on what needs to be worked on next, preventing task drift.
  6. Task Progress (Focus Chain): The exact checklist state from the Focus Chain showing what is completed and what remains.

Compact vs. New Task

Feature / Command/compact/newtask
Primary Use CaseContinuing a long/complex task while freeing up memory.Shifting to a new phase or starting a fresh sub-task.
History RetentionSummarizes and truncates history within the same conversation.Creates a new task with a clean context, preserving the old task intact.
MomentumKeeps the developer momentum going without switching tasks.Provides a clean handoff like bringing a new developer to a project.
ApprovalUser-triggered requires approval; Auto-triggered runs silently.Requires user confirmation to launch the new task.

Best Practices

  • Use /compact during deep debugging sessions: If you are exploring multiple files and running commands, your context window will fill up fast. Type /compact to clean the workspace of intermediate noise (like long terminal outputs) while keeping the lessons learned.
  • Keep Settings optimized: If you work with large codebases, turn on useAutoCondense (Auto-Compaction) in settings to let PostQode manage your context window size automatically.