Skip to content

feat(compaction): use structured 9-section summary template for compaction - #38103

Closed
zouhua021 wants to merge 1 commit into
anomalyco:devfrom
zouhua021:feat/structured-compaction-summary
Closed

zouhua021 wants to merge 1 commit into
anomalyco:devfrom
zouhua021:feat/structured-compaction-summary

Conversation

@zouhua021

Copy link
Copy Markdown

Problem

The current compaction prompt (buildPrompt() from @opencode-ai/core) produces a free-form summary that:

  • Loses user messages (model paraphrases instead of preserving verbatim)
  • Drops file paths and code snippets critical for coding continuity
  • Has no consistent structure across compactions
  • Makes post-compaction recovery unreliable

Changes

Replaces the default buildPrompt() with a structured 9-section template:

  1. Primary Request and Intent
  2. Key Technical Concepts
  3. Files and Code Sections (verbatim code snippets)
  4. Errors and Fixes (verbatim error messages)
  5. Problem Solving
  6. All User Messages (preserved verbatim, NEVER summarized)
  7. Pending Tasks
  8. Current Work (file paths + line numbers)
  9. Suggested Next Step

The plugin hook (experimental.session.compacting) still takes precedence if a plugin provides a custom prompt. This only changes the default fallback.

Impact

  • 56 lines added, 1 file changed
  • User messages preserved verbatim after compaction
  • Consistent structure makes it easier for the model to find information post-compaction
  • Inspired by Claude Code's 9-section structured summary format

…ction

Replace the free-form buildPrompt() with a structured 9-section template
that preserves critical information with higher fidelity:

1. Primary Request and Intent
2. Key Technical Concepts
3. Files and Code Sections (with verbatim code snippets)
4. Errors and Fixes (with verbatim error messages)
5. Problem Solving
6. All User Messages (preserved verbatim, never summarized)
7. Pending Tasks
8. Current Work (with file paths and line numbers)
9. Suggested Next Step

The plugin hook (experimental.session.compacting) still takes precedence
if a plugin provides a custom prompt. This only changes the default.

Inspired by Claude Code's 9-section structured summary format.
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jul 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jul 21, 2026
@github-actions github-actions Bot closed this Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant