Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Summary

Improves the compaction prompt to help models better respect the word count target and produce more useful summaries.

Changes

The new prompt provides structured guidance:

What to include:

  • User's overall goal and current task
  • Key decisions and rationale
  • Current state of work (what's done, what's in progress)
  • Important technical details (file paths, function names, configurations)
  • Errors encountered and resolutions
  • Unresolved issues/blockers

What NOT to include:

  • Suggestions for next steps
  • Conversational filler or pleasantries
  • Redundant information

Style: Factual, dense writing where every sentence conveys essential context.

Implementation

  • Extracted buildCompactionPrompt() into src/common/constants/ui.ts as a shared function
  • Updated desktop, mobile, and mock scenarios to use the shared function
  • Removed tautological tests

Generated with mux

Added tests to verify that compaction messages include word count instructions:
- Verify word count derived from maxOutputTokens (4096 tokens / 1.3 ≈ 3151 words)
- Verify default word target (2000 words) when maxOutputTokens not specified

Investigation found NO regression - the word count has been consistently present
in prepareCompactionMessage() since the feature was added. The message sent to
the model includes 'Use approximately {targetWords} words.' where:
- targetWords = maxOutputTokens / 1.3 (when specified)
- targetWords = 2000 (default from DEFAULT_COMPACTION_WORD_TARGET)

Note: The UI displays '/compact' for UX simplicity, but the actual message
sent to the model includes the full compaction prompt with word count guidance.
…del compliance

Expanded the compaction prompt to help models better respect the word count
target and produce more useful summaries. The new prompt:

- Emphasizes word count importance ('aim to be within 10% of this target')
- Provides structured guidance on what to include:
  - User's overall goal and current task
  - Key decisions and rationale
  - Current state of work
  - Important technical details
  - Errors encountered and resolutions
  - Unresolved issues/blockers
- Explicitly lists what NOT to include
- Requests factual, dense writing style

This addresses reports of certain models not properly respecting the word
count guidance in the previous simpler prompt.

Updated: desktop, mobile, mock scenarios, and tests.
@ammario ammario merged commit 47c2da0 into main Dec 4, 2025
25 of 26 checks passed
@ammario ammario deleted the fix-compaction-regression branch December 4, 2025 21:01
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.

2 participants