Skip to content

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”

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.

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):

  1. 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.
  2. Matching is separator-bounded token sets, not string equality (miner.py:537). mcp-eval also matches a bare eval/; q-a-pairs matches q, a and pairs independently. The useful inverse: a compound room NAME still matches its own tokens at priority 0, so ai-tooling needs no ai keyword.
  3. Priority 3 is a raw content.count() over the first 2000 characters, fires before general, 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.
  4. A room projection must re-implement detect_room from source. A projection that encodes the author’s model of the router is worthless however many assertions it passes.
  • 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=general and 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_pairs corpus-level and shared ACROSS applications, so filing them beside procurement would encode the workspace tier DR-038 retired.
  • Rooms survive the domain migration, the cocoindex relocation and the deploy/ move with no re-mine — the property the design exists for. Measured: the procurement room 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 into lib/domains/ did not change their room.
  • Deliberately narrow subsystem keys mean pre-cocoindex code falls through to general rather than being camouflaged by a room implying it belongs. That residue is the id-46 triage worklist and is intended to stay visible.
  • No ui room: components/hooks/contexts are 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.