feat(FN-1022): add project memory bootstrap with agent integration

- Add project-memory module in @fusion/core with read/write/resolve helpers and upsert-on-store hook
- Bootstrap project memory during task creation (store) with structured task context
- Inject resolved project memory into executor and triage agent system prompts
- Add comprehensive tests for project-memory module, store integration, and agent prompt changes
- Document project memory architecture and usage in README
This commit is contained in:
gsxdsm
2026-04-07 00:41:19 -07:00
parent c4a0da027e
commit 92b516e5fa
10 changed files with 566 additions and 16 deletions

View File

@@ -12,6 +12,7 @@ import { MissionStore } from "./mission-store.js";
import { BackwardCompat, ProjectRequiredError } from "./migration.js";
import { CentralCore } from "./central-core.js";
import { getTaskMergeBlocker } from "./task-merge.js";
import { ensureMemoryFile } from "./project-memory.js";
export interface TaskStoreEvents {
"task:created": [task: Task];
@@ -146,6 +147,17 @@ export class TaskStore extends EventEmitter<TaskStoreEvents> {
}
this.setupActivityLogListeners();
// Bootstrap project memory file if memory is enabled
try {
const config = await this.readConfig();
const mergedSettings: Settings = { ...DEFAULT_SETTINGS, ...config.settings };
if (mergedSettings.memoryEnabled !== false) {
await ensureMemoryFile(this.rootDir);
}
} catch {
// Non-fatal — memory bootstrap failure should not block startup
}
}
// ── Row <-> Task Conversion ────────────────────────────────────────
@@ -550,6 +562,16 @@ export class TaskStore extends EventEmitter<TaskStoreEvents> {
await this.writeConfig(config);
const updatedMerged: Settings = { ...DEFAULT_SETTINGS, ...globalSettings, ...updatedProjectSettings } as Settings;
this.emit("settings:updated", { settings: updatedMerged, previous: previousMerged });
// Bootstrap project memory file when memory is toggled on
if (updatedMerged.memoryEnabled !== false && previousMerged.memoryEnabled === false) {
try {
await ensureMemoryFile(this.rootDir);
} catch {
// Non-fatal — memory bootstrap failure should not block settings update
}
}
return updatedMerged;
});
}