Reconcile layout-root-canonical with the store scaffold (top-level artifact dirs)
TASK-MEMORY-261 - Reconcile layout-root-canonical with the store scaffold
Context
cyberos doctor runs the layout-root-canonical invariant (modules/memory/cyberos/core/invariants.py, _CANONICAL_TOP_LEVEL_DIRS), which accepts exactly: memories, meta, company, module, member, client, project, persona, conflicts, exports, index, audit.
CyberOS's own live BRAIN (now at .cyberos/memory/store/) also carries top-level adrs/, audits/, impl-plans/, code-reviews/, obs-injections/ - CUO artifact kinds created by earlier tooling. So doctor reports overall: FAIL (12 pass / 1 error) on an otherwise healthy store. The shell scaffolder was already fixed to stop creating these (commit 0ae91c4), so fresh stores are clean; this task is about the pre-existing dirs and the source-of-truth split.
1. Normative clauses
- There MUST be a single source of truth for the canonical top-level set, shared by the invariant (
_CANONICAL_TOP_LEVEL_DIRS) and both scaffolders (install.shand__main__.py::_auto_init_if_needed). Today the invariant and the scaffolders enumerate the set independently. - A decision MUST be recorded (ADR) on the five artifact dirs: either (a) they are legitimate top-level kinds and MUST be added to the canonical set, or (b) they are not, and their memories MUST nest under an accepted kind (for example
meta/or a dedicatedartifacts/root). - If (b), a one-shot, reversible migration MUST relocate existing rows and remove the empty legacy dirs, and MUST leave the audit ledger intact (no chain rewrite).
- After the change,
cyberos doctorMUST reportoverall: OKon a store that only ever held valid data (no spuriouslayout-root-canonicalerror), and the memory test suite MUST stay green.
2. Scope
modules/memory/cyberos/core/invariants.py, the two scaffolders, and (if clause 3) a migration/cleanup helper. No change to the audit-chain format or the write path.
3. Gate
python -m pytest in modules/memory plus cyberos doctor on a seeded store. Improvement-class task: machine gates plus the two HITL acceptance verdicts.