Skip to content

Research: Compaction stability #2

@palucdev

Description

@palucdev

post-compact-reminder.sh

Original behavior (Claude Code):

  • Fires after context compaction via SessionStart + compact matcher
  • Checks if .maister/tasks/ directory exists
  • If yes: injects a reminder into the resumed session via additionalContext + systemMessage
  • The reminder appears early in the new (compacted) session context

Current OpenCode implementation (in index.ts):

"experimental.session.compacting": async (input, output) => {
  const tasksDir = `${directory}/.owflow/tasks`;
  try {
    await $`test -d ${tasksDir}`;
    output.context.push(`## Owflow Workflow State\n...`);
  } catch { }
}

Assessment: ✅ Functionally adequate with one caveat.

Key difference: Claude Code injects context after compaction into the resumed session. OpenCode injects context before compaction into what the LLM sees when writing the compaction summary. The reminder must survive as part of the compaction summary text to take effect in the resumed session — this depends on LLM summarization behavior and is not guaranteed verbatim.

Risk: experimental prefix means this hook may change or be removed without notice.

Test and check if it works as expected, try to find another equivalent hook for this in OpenCode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    researchInformation should be gathered before feature request / bugfix / PR

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions