Skip to content

Conversation

@charles-cooper
Copy link
Collaborator

Summary

  • Add concrete "WHEN TO COMPACT" triggers to all system prompts (going in circles, context noisy, task switch, etc.)
  • Compaction now auto-writes .agent-files/ via structured files field in schema
  • Fix spinner text: "Optimizing context..." for manual, "Auto-optimizing context..." for overflow
  • Reframe compaction guidance around effectiveness ("would make you more effective")
  • Inject <context-status> into compaction prompt for model awareness

Changes

  • compaction.ts - add files schema, auto-write to .agent-files/, remove hidden text part
  • prompt.ts - inject context status into compaction system prompt
  • compact.ts - update tool description with quality-based triggers
  • session/index.tsx - distinguish manual vs auto spinner text
  • All 5 model prompts - add WHEN TO COMPACT section, effectiveness framing
  • compaction.txt - detailed guidance for summary/continue/files output

Position reminder at END of prompt for salience.
Key elements:
- Specific trigger: 'before your final response'
- User expectation framing: 'expects to resume where you left off'
- Clear skip condition: informational interactions only
- Add IMPORTANT block in system prompts: preserve error messages, file paths, decisions
- Add CRITICAL line in compaction prompt: user constraints/preferences must be preserved
- Replace vague 'loses detail but gains clarity' with explicit preservation requirements
Lost info = repeating work or wrong directions, not just user expectations
Some models may not generate the files field reliably, causing
AI_NoObjectGeneratedError. Making it optional with empty default
prevents schema validation failures.
@charles-cooper charles-cooper marked this pull request as ready for review December 14, 2025 16:19
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