fix: run pre-reset learning in background, update learn prompt
This commit is contained in:
parent
6351caaf7e
commit
f469c7a439
@ -235,8 +235,10 @@ export async function handleCommands(params: HandleCommandsParams): Promise<Comm
|
||||
}
|
||||
|
||||
// Trigger learning before reset/new commands (after ACP target resolution)
|
||||
// Run in background - don't await, so reset happens immediately
|
||||
if (targetSessionEntry?.sessionId && targetSessionEntry.sessionFile) {
|
||||
const learnResult = await runLearnForSession({
|
||||
const thinkLevel = params.resolvedThinkLevel ?? (await params.resolveDefaultThinkingLevel());
|
||||
runLearnForSession({
|
||||
sessionId: targetSessionEntry.sessionId,
|
||||
sessionKey: targetSessionKey,
|
||||
messageChannel: params.command.channel,
|
||||
@ -251,19 +253,20 @@ export async function handleCommands(params: HandleCommandsParams): Promise<Comm
|
||||
skillsSnapshot: targetSessionEntry.skillsSnapshot,
|
||||
provider: params.provider,
|
||||
model: params.model,
|
||||
thinkLevel: params.resolvedThinkLevel ?? (await params.resolveDefaultThinkingLevel()),
|
||||
thinkLevel,
|
||||
customFocus:
|
||||
"What insights and lessons should be remembered before starting a new session?",
|
||||
senderIsOwner: params.command.senderIsOwner,
|
||||
ownerNumbers: params.command.ownerList.length > 0 ? params.command.ownerList : undefined,
|
||||
}).then((learnResult) => {
|
||||
if (learnResult.ok) {
|
||||
logVerbose(`Background pre-reset learning completed for session ${targetSessionKey}`);
|
||||
} else {
|
||||
logVerbose(
|
||||
`Background pre-reset learning failed for session ${targetSessionKey}: ${learnResult.message ?? "unknown error"}`,
|
||||
);
|
||||
}
|
||||
});
|
||||
if (learnResult.ok) {
|
||||
logVerbose(`Pre-reset learning completed for session ${targetSessionKey}`);
|
||||
} else {
|
||||
logVerbose(
|
||||
`Pre-reset learning failed for session ${targetSessionKey}: ${learnResult.message ?? "unknown error"}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
if (boundAcpKey) {
|
||||
const resetResult = await resetAcpSessionInPlace({
|
||||
|
||||
@ -8,12 +8,14 @@ import type { ThinkLevel } from "./directives.js";
|
||||
|
||||
const LEARN_SYSTEM_PROMPT = [
|
||||
"Learning turn.",
|
||||
"Analyze the session history and remember important insights.",
|
||||
"Analyze the session history and remember important insights in the specific way the user requests.",
|
||||
].join(" ");
|
||||
|
||||
const LEARN_DEFAULT_PROMPT = [
|
||||
"Learning turn.",
|
||||
"What important insights, lessons, or information should be remembered from this session?",
|
||||
"Analyze the session history and remember important insights in the specific way the user requests.",
|
||||
"Focus on: problems identified, solutions discovered, methods that worked, patterns noticed, and any valuable context.",
|
||||
"IMPORTANT: Remember ONLY what is truly useful and worth retaining - filter out noise.",
|
||||
].join(" ");
|
||||
|
||||
async function resolveSessionFileWithResetFallback(sessionFile: string): Promise<string> {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user