DR-116: Palace rooms key on directory name, not path position
DR-116: Palace rooms key on directory name, not path position
Section titled “DR-116: Palace rooms key on directory name, not path position”Context
Section titled “Context”DR-113 established that a file’s room is hashed into its drawer id, so changing a room is a
delete-then-re-mine of every affected file. DR-114 added the depth-blind priority: true
pre-pass, which matches a room against any path part.
Together these make the choice of room key an architectural commitment. The canonical code
repo is mid-migration: id-130 landed lib/domains/procurement, lib/intelligence is queued
to follow, cocoindex is agreed to be misfiled under scripts/, and deploy/ belongs with
the pipeline. Any room keyed on a layer (lib, app, components) is defined by
exactly the thing those moves change.
Decision
Section titled “Decision”Every room is keyed on a directory NAME, matched at any depth — never on a path POSITION. Domain and subsystem names survive relocation; layer names do not.
Corollaries, all verified against detect_room at source
(site-packages/mempalace/miner.py):
- The domains are the six ratified
application_types(reference/entity-glossary.md): procurement, intelligence, sales_proposal, product_guide, competitor_research, training_onboarding. Not an invented list, and not a partial one — declaring three while claiming six is a defect. - Matching is separator-bounded token sets, not string equality (
miner.py:537).mcp-evalalso matches a bareeval/;q-a-pairsmatchesq,aandpairsindependently. The useful inverse: a compound room NAME still matches its own tokens at priority 0, soai-toolingneeds noaikeyword. - Priority 3 is a raw
content.count()over the first 2000 characters, fires beforegeneral, and cannot be disabled (miner.py:616-629). Short room names are substring magnets —count("ci")hits citation, decision, specific. Prefer compound names (ci-cd,db-schema): by (2) they keep the path match, and they score ~0 on content. - A room projection must re-implement
detect_roomfrom source. A projection that encodes the author’s model of the router is worthless however many assertions it passes.
Alternatives Considered
Section titled “Alternatives Considered”- Layer-first rooms (
app,lib,components,scripts,tests). Rejected: defined by what the migration changes, and answers “where does it live” rather than the question recall actually asks. - Defer rooming until the restructure lands. Rejected as indefinite; the corpus stays
100%
room=generaland invisible to the filters DR-114 made usable. - Room by knowledge-model entity as a sibling of the domains. Rejected: the
entity-glossary containment chain makes
q_a_pairscorpus-level and shared ACROSS applications, so filing them besideprocurementwould encode the workspace tier DR-038 retired.
Consequences
Section titled “Consequences”- Rooms survive the domain migration, the cocoindex relocation and the
deploy/move with no re-mine — the property the design exists for. Measured: theprocurementroom already draws from five layers at once (components 62, app 48,__tests__41, lib 20, hooks 8), and id-130’s move of 20 files intolib/domains/did not change their room. - Deliberately narrow subsystem keys mean pre-cocoindex code falls through to
generalrather than being camouflaged by a room implying it belongs. That residue is the id-46 triage worklist and is intended to stay visible. - No
uiroom:components/hooks/contextsare layer names. - The S521 draft built on this rule was still rejected on nine other grounds — the rule is
necessary, not sufficient. See
reports/s521-rooms-draft-review.md.