fix(hindsight): scoped project mental model seeds

Project-tagged Hindsight mental-model seeds now use project-qualified ids and legacy bare ids only satisfy the matching project tag. The injected mental-model block also filters tagged models to the active project while retaining untagged models.\n\nFixes #2218
This commit is contained in:
roboomp
2026-06-10 01:25:02 +00:00
parent f2137becb8
commit a30eafdf24
5 changed files with 131 additions and 17 deletions
@@ -21,6 +21,7 @@ import {
loadHindsightConfig,
reloadMentalModelsForSession,
resolveSeedsForScope,
seedAlreadyExists,
summarizeMentalModel,
} from "../../hindsight";
import { resolveMemoryBackend } from "../../memory-backend";
@@ -712,11 +713,11 @@ export class CommandController {
return;
}
const list = await state.client.listMentalModels(state.bankId, { detail: "metadata" });
const existing = new Set((list.items ?? []).map(m => m.id));
const existing = list.items ?? [];
let created = 0;
let skipped = 0;
for (const seed of seeds) {
if (existing.has(seed.id)) {
if (seedAlreadyExists(seed, existing)) {
skipped++;
continue;
}