Skip to content

Compaction heuristics: prefer explicit metadata flag for OpenCode prompts #22

@riatzukiza

Description

@riatzukiza

Follow-up from PR #20 review (CodeRabbit comment on compaction heuristics): #20 (comment)

In lib/request/request-transformer.ts, filterOpenCodeSystemPrompts currently relies on text heuristics (regexes over the content) to identify OpenCode auto-compaction prompts and sanitize/remove the summary-file instructions.

The review suggested hardening this by:

  • Tagging OpenCode compaction prompts with an explicit metadata flag (e.g., item.meta?.opencodeCompaction === true or item.metadata?.source === 'opencode-compaction').
  • Preferring that metadata flag over the regex-based detection when present, falling back to heuristics only when metadata is absent.

This issue tracks designing and wiring that explicit metadata marker so we can reduce the risk of future false positives while keeping current behavior intact for untagged prompts.

We kept the existing heuristic-only behavior in PR #20 and are deferring this improvement to a follow-up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    compactionIssues related to conversation compaction and summary handlingeffort-mediumMedium effort issues - 4-12 hours of workpriority-mediumMedium priority issues - important features or significant improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions