feat(FN-3485): align memory scope guidance and dashboard tooling
- Clarify task memory scope behavior across core types, project memory logic, engine tool prompts, and related docs - Add regression coverage for memory scope and runtime plugin alias handling in core/dashboard/engine tests - Add agent avatar API routes and dashboard UI support for avatar display and storage documentation - Add line-number gutter toggle support in FileEditor and Files modal with accompanying component tests - Include changeset for @runfusion/fusion documenting memory scope guidance update Fusion-Task-Id: FN-3485
This commit is contained in:
@@ -237,11 +237,15 @@ describe("createMemoryTools", () => {
|
||||
});
|
||||
|
||||
it("includes fn_memory_append for writable memory backends", () => {
|
||||
expect(createMemoryTools("/repo", { memoryBackendType: "file" }).map((tool) => tool.name)).toEqual([
|
||||
const tools = createMemoryTools("/repo", { memoryBackendType: "file" });
|
||||
expect(tools.map((tool) => tool.name)).toEqual([
|
||||
"fn_memory_search",
|
||||
"fn_memory_get",
|
||||
"fn_memory_append",
|
||||
]);
|
||||
const appendTool = tools.find((tool) => tool.name === "fn_memory_append");
|
||||
expect(appendTool?.description).toContain('scope="agent"');
|
||||
expect(appendTool?.description).toContain('scope="project"');
|
||||
});
|
||||
|
||||
it("searches per-agent memory through the fn_memory_search tool", async () => {
|
||||
|
||||
@@ -2751,6 +2751,9 @@ describe("buildExecutionPrompt", () => {
|
||||
// Should instruct selective writes, not unconditional appends
|
||||
expect(result).toMatch(/skip.*memory.*update|selectively|durable.*learnings/i);
|
||||
expect(result).toMatch(/end of execution|before calling.*fn_task_done/i);
|
||||
// Should distinguish agent-private vs project-shared memory scope
|
||||
expect(result).toContain('fn_memory_append(scope="agent")');
|
||||
expect(result).toContain('fn_memory_append(scope="project")');
|
||||
// Should forbid task-specific trivia
|
||||
expect(result).toMatch(/avoid.*trivia|task-specific.*trivia|per-task.*log/i);
|
||||
// Should allow consolidation/editing
|
||||
|
||||
@@ -622,6 +622,8 @@ describe("executeHeartbeat", () => {
|
||||
expect(systemPrompt).toContain("fn_send_message");
|
||||
expect(systemPrompt).toContain("fn_memory_search");
|
||||
expect(systemPrompt).toContain("fn_memory_append");
|
||||
expect(systemPrompt).toContain('scope="agent"');
|
||||
expect(systemPrompt).toContain('scope="project"');
|
||||
expect(systemPrompt).toContain("fn_heartbeat_done");
|
||||
});
|
||||
|
||||
|
||||
@@ -319,7 +319,7 @@ You have coding-capable workspace tools (read/write/edit/bash within worktree bo
|
||||
Use this decision rule:
|
||||
- **fn_task_create:** create executable work when ownership is not predetermined.
|
||||
- **fn_delegate_task:** assign immediately when a specific agent should own the work now.
|
||||
- **fn_memory_append:** persist durable conventions/pitfalls; avoid transient run-by-run chatter.
|
||||
- **fn_memory_append:** use \`scope="agent"\` for your own operating context and \`scope="project"\` for repo-wide durable knowledge; avoid transient run-by-run chatter.
|
||||
|
||||
If unsure who should do the work, prefer fn_task_create and let scheduler routing happen naturally.
|
||||
|
||||
|
||||
@@ -851,8 +851,8 @@ export function createMemoryAppendTool(rootDir: string, settings?: MemoryToolSet
|
||||
name: "fn_memory_append",
|
||||
label: "Append Memory",
|
||||
description:
|
||||
"Append concise Markdown to project memory. Use long-term only for durable conventions/decisions/pitfalls; " +
|
||||
"use daily for running observations and open loops. Skip this tool when there is no reusable memory.",
|
||||
"Append concise Markdown to memory. Use scope=\"agent\" for private operating context and scope=\"project\" for workspace-wide durable knowledge. " +
|
||||
"Use layer=\"long-term\" for durable conventions/decisions/pitfalls and layer=\"daily\" for running observations/open loops.",
|
||||
parameters: memoryAppendParams,
|
||||
execute: async (_id: string, params: Static<typeof memoryAppendParams>) => {
|
||||
const content = params.content.trim();
|
||||
|
||||
@@ -363,7 +363,8 @@ async function flushMemoryBeforeSessionCompaction(session: AgentSession): Promis
|
||||
|
||||
const flushPrompt = [
|
||||
"Before context compaction, preserve only unresolved durable memory if needed.",
|
||||
"If fn_memory_append is available and you learned reusable project decisions, conventions, pitfalls, or open loops that are not already saved, append them now.",
|
||||
"If fn_memory_append is available and you learned reusable project decisions/conventions/pitfalls/open loops or private operating context that is not already saved, append it now.",
|
||||
"Use scope=\"project\" for shared workspace knowledge and scope=\"agent\" for private operating context.",
|
||||
"Use layer=\"long-term\" for durable facts and layer=\"daily\" for running notes/open loops.",
|
||||
"If there is nothing durable to save, reply exactly: NONE.",
|
||||
].join("\n");
|
||||
|
||||
Reference in New Issue
Block a user