memorix icon indicating copy to clipboard operation
memorix copied to clipboard

使用opencode plugin时,压缩时没有自动触发memorix_store和memorix_session_start

Open FurryWolfX opened this issue 8 months ago • 2 comments

    /** Inject memorix context into compaction prompt */
    'experimental.session.compacting': async (input, output) => {
      output.context.push(
        '## Memorix Cross-Agent Memory\n' +
        'Before compacting, use memorix_store to save important discoveries, decisions, and gotchas.\n' +
        'After compacting, use memorix_session_start to reload session context, then memorix_search for specific topics.'
      );
    },

目前我看到是通过压缩时注入提示词的方式来做的,但LLM基本上会无视这个提示,我用的opencode+omo+minimax-m2.7

FurryWolfX avatar Apr 04 '26 07:04 FurryWolfX

Thanks — this is a valid report.

You're right that the current OpenCode compaction integration only injects guidance into the prompt; it does not deterministically trigger memorix_store or memorix_session_start. So if the model ignores the instruction, nothing happens.

We'll treat this as an integration/design gap rather than a simple one-line bug. The next step is to check whether OpenCode exposes a compaction lifecycle hook that can perform a real side effect, instead of relying on prompt compliance.


感谢反馈,这个问题是成立的。

你说得对:当前 OpenCode 的 compaction 集成,本质上只是往 prompt 里注入提示,并不会确定性地自动触发 memorix_store 或 memorix_session_start。所以如果模型忽略这段提示,就确实什么都不会发生。

这更像是一个集成/设计缺口,而不是简单的一行 bug。下一步我们会先确认 OpenCode 是否提供可执行真实 side effect 的 compaction 生命周期 hook,而不是继续依赖模型“自觉执行”。

AVIDS2 avatar Apr 04 '26 15:04 AVIDS2

已通过 #51 修复并合入 main。\n\n这次修复做了几件事:\n- OpenCode compaction prompt 不再误导性地暗示会自动调用 memorix_store / memorix_session_start\n- 改成更真实的 structured continuation prompt,让压缩摘要本身保留恢复上下文所需的信息\n- 新增并转发 session.compacted 事件\n- 将错误的 session.compacted -> pre_compact 语义修正为 post_compact\n- 补了对应回归测试\n\n感谢反馈,这条 issue 现在可以收口了。

AVIDS2 avatar Apr 04 '26 16:04 AVIDS2