You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(openclaw/plugin): correct plugin hook API usage
- api.on() is correct (confirmed from types.d.ts)
- api.pluginConfig is the right path for plugin config (not api.config.plugins.entries...)
- agent_end and before_compaction are void hooks — cannot inject context
- nudge: moved into before_prompt_build as persistent per-turn reminder
- compact: before_compaction writes ~/.mnemon/.compact-pending flag;
before_prompt_build reads and consumes it on the next turn
// Compact flag: was compaction triggered since last turn?
65
+
if(compact&&existsSync(COMPACT_FLAG)){
66
+
try{unlinkSync(COMPACT_FLAG);}catch{/* ignore */}
67
+
parts.push(
68
+
"[mnemon] Context compaction starting. Review this session and remember the most valuable insights (up to 5) before context is compressed. Delegate to Task sub-agents now."
69
+
);
51
70
}
52
71
53
-
parts.push(
54
-
"[mnemon] Evaluate: recall needed? After responding, evaluate: remember needed?"
// Before context compaction: prompt to save key insights.
78
-
if(compact){
79
-
api.on("before_compaction",async()=>{
80
-
return{
81
-
prependContext:
82
-
"[mnemon] Context compaction starting. Review this session and remember the most valuable insights (up to 5) before context is compressed. Delegate to Task sub-agents now.",
83
-
};
89
+
if(parts.length===0)return;
90
+
return{prependContext: parts.join("\n\n")};
84
91
});
85
92
}
93
+
94
+
// ── agent_end (void — no return value supported) ──────────────
95
+
// Placeholder for future diagnostics; memory evaluation is handled
96
+
// by the LLM itself via the before_prompt_build nudge above.
0 commit comments