feat: auto memory pipeline — host-driven Memento recall/reflect
Add automatic memory integration so EJClaw host directly calls Memento MCP for recall at session start and reflect on compact, removing reliance on agent voluntary tool use. Stage 1: New sessions get room memory briefing injected into system prompt (CLAUDE.md / AGENTS.md) via host-side MCP client. Stage 2: PreCompact hook automatically calls reflect + remember to persist session summaries as room-memory fragments. Also restores missing source files (token-rotation, codex-token-rotation, claude-usage exports) to fix full build from source. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -157,6 +157,7 @@ function prepareCodexSessionEnvironment(args: {
|
||||
chatJid: string;
|
||||
isMain: boolean;
|
||||
isPairedRoom: boolean;
|
||||
memoryBriefing?: string;
|
||||
}): void {
|
||||
const openaiKey =
|
||||
args.envVars.CODEX_OPENAI_API_KEY ||
|
||||
@@ -213,6 +214,7 @@ function prepareCodexSessionEnvironment(args: {
|
||||
args.isPairedRoom
|
||||
? readPairedRoomPrompt('codex', args.projectRoot)
|
||||
: undefined,
|
||||
args.memoryBriefing,
|
||||
]
|
||||
.filter((value): value is string => Boolean(value))
|
||||
.join('\n\n---\n\n')
|
||||
@@ -298,6 +300,7 @@ export function prepareGroupEnvironment(
|
||||
isMain: boolean,
|
||||
chatJid: string,
|
||||
options?: {
|
||||
memoryBriefing?: string;
|
||||
runtimeTaskId?: string;
|
||||
useTaskScopedSession?: boolean;
|
||||
},
|
||||
@@ -352,6 +355,7 @@ export function prepareGroupEnvironment(
|
||||
claudePlatformPrompt,
|
||||
claudePairedRoomPrompt,
|
||||
globalClaudeMemory,
|
||||
options?.memoryBriefing,
|
||||
]
|
||||
.filter((value): value is string => Boolean(value))
|
||||
.join('\n\n---\n\n')
|
||||
@@ -409,6 +413,7 @@ export function prepareGroupEnvironment(
|
||||
chatJid,
|
||||
isMain,
|
||||
isPairedRoom,
|
||||
memoryBriefing: options?.memoryBriefing,
|
||||
});
|
||||
} else {
|
||||
prepareClaudeEnvironment({ env, envVars, group });
|
||||
|
||||
Reference in New Issue
Block a user