Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(daemon): keep reset memory maintenance silent

Gus877d57cb8657
diff --git a/src/daemon/src/manager/agentRouter.test.ts b/src/daemon/src/manager/agentRouter.test.ts
index ae305f330..2c6046691 100644
--- a/src/daemon/src/manager/agentRouter.test.ts
+++ b/src/daemon/src/manager/agentRouter.test.ts
@@ -427,6 +427,11 @@ describe("AgentRouter — agent:reset", () => {
expect(resets[0].rewakePrompt.length).toBeGreaterThan(0);
expect(resets[0].rewakePrompt).not.toContain("todo.md");
expect(resets[0].rewakePrompt).toContain("$ALOOK_CLI message mark list");
+ expect(resets[0].rewakePrompt).toContain("internal maintenance; perform it silently");
+ expect(resets[0].rewakePrompt).toContain("Do not proactively send the owner, users, or channels progress updates, completion notices, or details about your memory state");
+ expect(resets[0].rewakePrompt).toContain("Communicate task-relevant results, questions, and blockers normally");
+ expect(resets[0].rewakePrompt).toContain("If nothing needs a user-facing response, send no message");
+ expect(resets[0].rewakePrompt).toContain("resume outstanding work and handle your inbox messages");
// Ordering: onBeforeAgent completes before resetSession fires.
expect(order[0]).toBe("before:a1");
expect(order[1]).toBe("reset:a1");
@@ -498,6 +503,10 @@ describe("AgentRouter — machine:reset_all (batch reset)", () => {
// Every entry reset, once each; onBeforeAgent ran for each (gate inherited).
expect(resets.map((r) => r.agentId)).toEqual(["a1", "a2", "a3"]);
+ for (const { rewakePrompt } of resets) {
+ expect(rewakePrompt).toContain("internal maintenance; perform it silently");
+ expect(rewakePrompt).toContain("Do not proactively send the owner, users, or channels progress updates, completion notices, or details about your memory state");
+ }
expect(before).toEqual(["a1", "a2", "a3"]);
// Each agent's before precedes its reset (same orchestration as single reset).
expect(order.indexOf("reset:a2")).toBeGreaterThan(order.indexOf("reset:a1"));
diff --git a/src/daemon/src/manager/agentRouter.ts b/src/daemon/src/manager/agentRouter.ts
index 11e2e49a5..9a922eea5 100644
--- a/src/daemon/src/manager/agentRouter.ts
+++ b/src/daemon/src/manager/agentRouter.ts
@@ -150,7 +150,7 @@ const REWAKE_PROMPT = `Your session was reset by your owner. Prior conversation
2. Facts: Verify claims, especially work progress, against the latest original records. Search the context timeline and task discussions through their latest outcomes. Correct outdated or unsupported claims; keep uncertainty explicit.
3. Durability: Keep only lasting facts, preferences, and reusable lessons or procedures. Remove task status, milestones, temporary plans, and diaries; extract a reusable lesson only when useful. Keep memory.md brief with links; put procedures, scope, and reasons in experiences. Reason from first principles: distill specific events into underlying causes, constraints, and reusable principles. Omit incidental dates and details; retain context only when it changes the principle’s validity or scope.
-Edit only your own memory files.
+Edit only your own memory files. This review is internal maintenance; perform it silently. Do not proactively send the owner, users, or channels progress updates, completion notices, or details about your memory state. Communicate task-relevant results, questions, and blockers normally. If nothing needs a user-facing response, send no message.
After completing the review and any needed edits, resume outstanding work and handle your inbox messages.`;
diff --git a/src/daemon/src/manager/managerRuntime.test.ts b/src/daemon/src/manager/managerRuntime.test.ts
index 3eb59ee8e..5ee360e47 100644
--- a/src/daemon/src/manager/managerRuntime.test.ts
+++ b/src/daemon/src/manager/managerRuntime.test.ts
@@ -479,6 +479,14 @@ describe("AgentProcessManager — idle memory maintenance", () => {
expect(send.mock.calls[0][0]).toMatchObject({ text: expect.stringContaining(MEMORY_MAINTENANCE_PROMPT) });
await first.fire("runtime_event", { kind: "turn_end", sessionId: "saved-session" });
}
+ const deliveredPrompt = hibernated ? factory.mock.calls[1][0].ctx.prompt : send.mock.calls[0][0].text;
+ expect(deliveredPrompt).toContain("internal maintenance; perform it silently");
+ expect(deliveredPrompt).toContain("Do not proactively send the owner, users, or channels progress updates, completion notices, or details about your memory state");
+ expect(deliveredPrompt).toContain("Communicate task-relevant results, questions, and blockers normally");
+ expect(deliveredPrompt).toContain("If nothing needs a user-facing response, send no message");
+ expect(deliveredPrompt).toContain("If new work arrives, handle it first and defer nap");
+ expect(deliveredPrompt).toContain("without --handoff");
+ expect(deliveredPrompt).toContain("$ALOOK_CLI nap");
expect(forgetSession).not.toHaveBeenCalled();
expect(mgr.snapshot().agents.a1.sessionId).toBe("saved-session");
});
diff --git a/src/daemon/src/manager/memoryMaintenancePrompt.ts b/src/daemon/src/manager/memoryMaintenancePrompt.ts
index 6b4f07ebb..c08eda2e4 100644
--- a/src/daemon/src/manager/memoryMaintenancePrompt.ts
+++ b/src/daemon/src/manager/memoryMaintenancePrompt.ts
@@ -4,7 +4,7 @@ export const MEMORY_MAINTENANCE_PROMPT = `The daemon is preparing to reset this
2. Facts: Verify claims, especially work progress, against the latest original records. Search the context timeline and task discussions through their latest outcomes. Correct outdated or unsupported claims; keep uncertainty explicit.
3. Durability: Keep only lasting facts, preferences, and reusable lessons or procedures. Remove task status, milestones, temporary plans, and diaries; extract a reusable lesson only when useful. Keep memory.md brief with links; put procedures, scope, and reasons in experiences. Reason from first principles: distill specific events into underlying causes, constraints, and reusable principles. Omit incidental dates and details; retain context only when it changes the principle’s validity or scope.
-Edit only your own memory files.
+Edit only your own memory files. This review is internal maintenance; perform it silently. Do not proactively send the owner, users, or channels progress updates, completion notices, or details about your memory state. Communicate task-relevant results, questions, and blockers normally. If nothing needs a user-facing response, send no message.
If new work arrives, handle it first and defer nap. Otherwise, after completing the review and any needed edits, your final action is to run the following command without --handoff. Do not finish with only a written reply. This instruction authorizes that nap: