Summary
engram doctor's session_project_directory_mismatch check flags a session by its
recorded session_project. After correcting the underlying content (soft-delete the
mistagged observation, re-save it under the correct project), the check keeps firing
forever because the original session row is never cleanable: delete session refuses
it as "still has observations" even though the observation is already soft-deleted and
projects list shows 0 active observations for that project, and hard-deleting the
original observation by ID fails as "not found" once it's already soft-deleted.
Version: 1.20.0 (precompiled binary). Have not verified against 2.0.0-rc.10 — noticed
while filing this that the installed binary is far behind current pre-release, and that
2.0 introduced an ownership_mode concept (#1030) that may be relevant to this same
class of problem, so this may already be partially addressed upstream. Filing as-is
since I could not reproduce on rc.10 in this environment.
Repro (literal commands, 1.20.0)
$ engram doctor --json --check session_project_directory_mismatch
...
"findings": [
{"evidence": {"directory": "/home/freddy/Workspace/.agents", "directory_project": "agents",
"directory_project_source": "git_remote", "session_id": "manual-save-.agents",
"session_project": ".agents"}},
{"evidence": {"directory": "/home/freddy/Workspace/.agents", "directory_project": "agents",
"directory_project_source": "git_remote", "session_id": "manual-save-vault",
"session_project": "vault"}}
]
Corrected the content: found the 2 flagged observations (#170, #85), read full content via
mem_get_observation, soft-deleted each (engram delete 170, engram delete 85 — both
succeeded), then re-saved the same content under the correct project (agents for #170's
content, obsidian for #85's content, since #85's actual content was vault/Obsidian work
despite the session's stale vault project tag).
After that:
$ engram projects list
obsidian 80 obs 2 sessions 0 prompts
agents 1 obs 1 session 0 prompts
.agents 0 obs 1 session 0 prompts <- correctly shows 0 obs now
vault 0 obs 1 session 0 prompts <- correctly shows 0 obs now
But cleanup of the stale sessions is impossible via any exposed command:
$ engram delete 170 --hard
engram: observation not found
$ engram delete session manual-save-.agents
engram: session still has observations: session "manual-save-.agents" has 1 observation(s)
$ engram delete session manual-save-vault
engram: session still has observations: session "manual-save-vault" has 1 observation(s)
And engram doctor still reports the original 2 findings, unchanged, even though the
content-level problem is fully fixed and projects list agrees the projects are empty.
Why it matters
There is no way to fully resolve a session_project_directory_mismatch finding once its
observation has been soft-deleted (the normal, non-destructive way to correct mistagged
content) — delete session and delete <id> --hard disagree with each other and with
projects list about whether the session still "has" an observation. The doctor check
never clears, permanently, for any session that goes through the soft-delete correction
path — the only way it seems to.
Expected
Either:
delete session and delete <id> --hard should agree with projects list's definition
of "has observations" (i.e. count only active, non-soft-deleted rows), so a session with
only soft-deleted observations can be deleted; or
session_project_directory_mismatch should not re-fire for sessions whose only
observations are soft-deleted.
Summary
engram doctor'ssession_project_directory_mismatchcheck flags a session by itsrecorded
session_project. After correcting the underlying content (soft-delete themistagged observation, re-save it under the correct project), the check keeps firing
forever because the original session row is never cleanable:
delete sessionrefusesit as "still has observations" even though the observation is already soft-deleted and
projects listshows 0 active observations for that project, and hard-deleting theoriginal observation by ID fails as "not found" once it's already soft-deleted.
Version: 1.20.0 (precompiled binary). Have not verified against
2.0.0-rc.10— noticedwhile filing this that the installed binary is far behind current pre-release, and that
2.0 introduced an
ownership_modeconcept (#1030) that may be relevant to this sameclass of problem, so this may already be partially addressed upstream. Filing as-is
since I could not reproduce on rc.10 in this environment.
Repro (literal commands, 1.20.0)
Corrected the content: found the 2 flagged observations (#170, #85), read full content via
mem_get_observation, soft-deleted each (engram delete 170,engram delete 85— bothsucceeded), then re-saved the same content under the correct project (
agentsfor #170'scontent,
obsidianfor #85's content, since #85's actual content was vault/Obsidian workdespite the session's stale
vaultproject tag).After that:
But cleanup of the stale sessions is impossible via any exposed command:
And
engram doctorstill reports the original 2 findings, unchanged, even though thecontent-level problem is fully fixed and
projects listagrees the projects are empty.Why it matters
There is no way to fully resolve a
session_project_directory_mismatchfinding once itsobservation has been soft-deleted (the normal, non-destructive way to correct mistagged
content) —
delete sessionanddelete <id> --harddisagree with each other and withprojects listabout whether the session still "has" an observation. The doctor checknever clears, permanently, for any session that goes through the soft-delete correction
path — the only way it seems to.
Expected
Either:
delete sessionanddelete <id> --hardshould agree withprojects list's definitionof "has observations" (i.e. count only active, non-soft-deleted rows), so a session with
only soft-deleted observations can be deleted; or
session_project_directory_mismatchshould not re-fire for sessions whose onlyobservations are soft-deleted.