Skip to content

fix: filter system-reminder messages in OpenCode transcript parser#671

Open
mvanhorn wants to merge 1 commit intoentireio:mainfrom
mvanhorn:osc/564-fix-opencode-system-reminder
Open

fix: filter system-reminder messages in OpenCode transcript parser#671
mvanhorn wants to merge 1 commit intoentireio:mainfrom
mvanhorn:osc/564-fix-opencode-system-reminder

Conversation

@mvanhorn
Copy link
Contributor

Summary

Fixes #564

Filters out <system-reminder> messages that are injected by tools like oh-my-opencode with user role. These messages were incorrectly counted as user prompts in attribution and checkpoint data.

Changes

  • cmd/entire/cli/agent/opencode/transcript.go - Added isSystemReminderOnly() and stripSystemReminders() functions; updated ExtractAllUserPrompts() to skip or strip system-reminder content
  • cmd/entire/cli/agent/opencode/transcript_test.go - Added 6 test functions covering pure system-reminder messages, mixed content, and whitespace handling

Approach

Content-based heuristic: messages entirely wrapped in <system-reminder>...</system-reminder> tags are skipped. Mixed messages have the reminder tags stripped. This is the best approach given that OpenCode doesn't expose x-initiator metadata.

Test plan

  • System-reminder-only messages excluded from prompts
  • Mixed messages have reminder sections stripped
  • Normal user messages unaffected
  • gofmt and go vet clean

This contribution was developed with AI assistance (Claude Code).

Messages sent with role "user" that consist entirely of
<system-reminder>...</system-reminder> tags (injected by oh-my-opencode
for multi-agent orchestration) are now excluded from
ExtractAllUserPrompts. Mixed messages have system-reminder sections
stripped, preserving the actual user content.

Closes entireio#564

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[OpenCode] <system-reminder> messages from oh-my-opencode is tracked as user message instead of opencode

1 participant