# ANVIL Tenant Architecture — Phase D 2026-05-07

Organizational tenant restructure: multi-tenant home tree, personal/business/client isolation, agent personas relocated, BasicConsulting clarified, ucenje extracted. Follow-on to mechanical sweep (ADR-022). Defines canonical tree structure going forward.

# ADR-023 — Tenant Restructure Decision

<div id="bkmrk-status%3A-accepted-202" style="padding:12px;background:#fef3c7;border-left:4px solid #f59e0b;margin-bottom:20px;">**Status:** Accepted 2026-05-07</div><div id="bkmrk-cross-reference%3A-thi" style="padding:12px;background:#dbeafe;border-left:4px solid #3b82f6;margin-bottom:20px;">**Cross-reference:** This follows the [ANVIL Filesystem Sweep (Mechanical)](https://docs.alai.no/books/anvil-filesystem-sweep-2026-05-07) — ADR-022. Phase D addresses organizational/tenant concerns.</div>## Context

ADR-022 documented the mechanical filesystem sweep — orphans, broken refs, PHANTOM daemons. After completion CEO observed that the home tree, while mechanically clean, remained **semantically misorganized:**

> "Zelim da sam ponosan file strukture, a ne da sam zabrinut."  
> "alai.no/ucenje" — Alem's personal Quran-19 scholarly site lives inside the ALAI commercial brand tree.

A 6-agent multi-perspective audit (Petter / Brad / Parisa / Lexicon / Kelsey / Skybound) produced ~84 findings, ~22 convergent across 3+ angles. The unanimous top finding: **personal scholarly content under commercial brand surface = brand contamination + GDPR exposure + blocks divestment**.

Beyond ucenje, the audit surfaced:

- BasicConsulting AS treated as separate legal entity in tree (vedtekter, share register expectations) when in fact it is **a domain only** owned by ALAI Holding AS (CEO clarified post-audit)
- ALAI-Tech-DOO is a **real** legal subsidiary (RS d.o.o., Bosnia/Serbia distribution of Bilko/Tok/Drop) but lived under `~/companies/` mixed with agent personas
- 12 agent personas (CodeCraft, Vizu, FlowForge, etc.) mislabeled as "companies" in `~/companies/`
- Client work scattered across `~/projects/` mixed with ALAI internal engineering
- CEO personal data (CV 19×, NAV records, employment-verification PII) scattered across business trees
- `~/Public/` containing CEO PII (employment-verification, ownership cert, firmaattest) — local-network readable
- Lumiscare client `.env` files committed to git history (auth bypass flags)
- Planka `.env` at 644 perms; Snowit terraform.tfstate one accidental `git add .` from leak

## Decision

Implement **multi-tenant home tree** with strict isolation per legal entity / personal scope / client scope:

```
~/business/                # legal entities (ALAI corporate group)
├── ALAI-Holding-AS/      # commercial parent (renamed from ~/ALAI/)
└── ALAI-Tech-DOO/        # RS d.o.o. subsidiary

~/personal/                # CEO natural-person scope (NEW)

~/clients-external/        # one canonical subdir per client (NEW)

~/system/                  # orchestration runtime
└── agents/personas/      # agent persona definitions (12)

~/projects/                # ALAI internal engineering repos ONLY (8 entries, was 23)

```

**Backward compatibility:**

- `~/ALAI` symlinked to `~/business/ALAI-Holding-AS/` for 158 LaunchAgent paths grace period
- `~/companies` symlinked to `~/system/agents/personas/` for 10+ daemon/tool refs grace period

## Sub-decisions

<table id="bkmrk-%23decisionrationaled-"><thead><tr><th>\#</th><th>Decision</th><th>Rationale</th></tr></thead><tbody><tr><td>D-1</td><td>`~/ALAI/` renamed to `~/business/ALAI-Holding-AS/`</td><td>Tenant isolation, name reflects legal entity</td></tr><tr><td>D-2</td><td>Symlink `~/ALAI` → canonical preserved</td><td>158 daemons hardcode old path; rewrite is non-urgent TD</td></tr><tr><td>D-3</td><td>`~/companies/` removed entirely</td><td>Was anti-pattern; entities → `~/business/`, personas → `~/system/agents/personas/`, brand-only domains → not a tree</td></tr><tr><td>D-4</td><td>ALAI-Tech-DOO promoted to peer entity</td><td>Real legal subsidiary per `company.json`</td></tr><tr><td>D-5</td><td>BasicConsulting NOT a tree</td><td>CEO clarified: domain only (`basicconsulting.no`), no firma. Domain assets → `~/business/ALAI-Holding-AS/brand-surfaces/basicconsulting.no/`</td></tr><tr><td>D-6</td><td>`~/personal/` created</td><td>Separation of CEO personal scope from business; GDPR purpose limitation</td></tr><tr><td>D-7</td><td>`~/clients-external/` created</td><td>Tenant isolation per client; ends `~/projects/` sprawl</td></tr><tr><td>D-8</td><td>`ucenje` extracted</td><td>Personal scholarly project moved to own repo (`johnatbasicas/ucenje`) + own subdomain (`ucenje.alai.no`); 301 redirect from `alai.no/ucenje/*`</td></tr><tr><td>D-9</td><td>Agent personas relocated</td><td>12 personas (CodeCraft / Vizu / etc.) → `~/system/agents/personas/`; symlink `~/companies` → here for tool/daemon backward compat</td></tr><tr><td>D-10</td><td>KenanHot reclassified product → client</td><td>Kenan Hot is a person (soccer player, knyhot.pro), not an ALAI product</td></tr><tr><td>D-11</td><td>FreeMyEV stub merged into client</td><td>Was duplicate (stub in products/, active in clients-external)</td></tr><tr><td>D-12</td><td>`ufs/` renamed `unified-form-service/`</td><td>Opaque acronym → descriptive; placed under products/ (deployed at forms.alai.no)</td></tr><tr><td>D-13</td><td>`architecture/` and `services/` renamed in ALAI-Holding-AS</td><td>Disambiguate from `~/system/architecture/` and `~/system/services/` (operational vs commercial) — `architecture` → `product-architecture`, `services` → `service-catalog`</td></tr></tbody></table>

## Consequences

### Positive

- 13 named clients in `~/clients-external/` (one tenant per subdir, no cross-contamination)
- 9 ALAI products in `~/business/ALAI-Holding-AS/products/` (no client-as-product misclassifications)
- 12 agent personas in `~/system/agents/personas/` (correct semantic home; no longer "companies")
- 2 legal entities under `~/business/` (Holding AS + Tech DOO; no third entity confusion)
- CEO personal scope isolated under `~/personal/` (cv, nav, scholarly, code, real-estate, legal-personal)
- `~/projects/` narrowed from 23 → 8 entries (ALAI internal engineering only)
- ucenje brand contamination resolved (ucenje.alai.no separate, alai.no/ucenje 301)
- 26 GB freed (ollama.tar.gz cleanup) + 16 GB freed (test scaffolds + companies archive)
- ~/Public PII quarantined to ~/personal/legal-personal/ (5 sensitive PDFs no longer local-network readable)
- `~/companies/` completely removed (anti-pattern eliminated)

### Negative

- 158 LaunchAgent paths still resolve via `~/ALAI` symlink (TD: rewrite to canonical, ≥30d grace)
- 10+ tool/daemon refs to `~/companies/` resolve via symlink (TD: same grace, lower priority)
- `_legacy-bc-2026-05-07/` content from BasicConsulting unwind required manual reconciliation into `clients/Entur/` and `clients/RPG/` (DONE, but added one-time manual step)
- 19 CV references across grant submissions remain in place (each is a submission artifact, not a duplicate to dedup)
- Some opaque-name decisions deferred (`internal/` left as-is — well-organized but generic name)

### Neutral

- Boot health unchanged (29/29 daemons loaded, 0 failing, before and after)
- Git histories preserved (used `git mv` for in-repo moves, plain `mv` for cross-repo)
- ALAI-Tech-DOO retains its own git repo and `.alai/` orchestration metadata

## Alternatives Considered

<table id="bkmrk-alternativewhy-rejec"><thead><tr><th>Alternative</th><th>Why rejected</th></tr></thead><tbody><tr><td>Status quo (semantic chaos accepted)</td><td>CEO explicit "zelim da sam ponosan, ne zabrinut" + Lexicon legal exposure findings</td></tr><tr><td>Storage-only deeper sweep (no rename)</td><td>ucenje brand contamination is structural, not storage</td></tr><tr><td>`~/tenants/` umbrella with per-tenant subdir</td><td>Equivalent to chosen `~/business/` + `~/personal/` + `~/clients-external/`, but less natural-language for CEO solo founder</td></tr><tr><td>Hard rewrite of all LaunchAgent paths in same operation</td><td>High risk; symlink grace period is industry-standard</td></tr><tr><td>Move ucenje to `broj19.com` (own domain, $12/year)</td><td>Subdomain `ucenje.alai.no` is sufficient (CEO Decision #1B); domain purchase deferred</td></tr><tr><td>Keep BasicConsulting as separate entity tree</td><td>CEO clarified there is no separate firma; would create maintenance burden for non-existent legal entity</td></tr></tbody></table>

## Implementation

<table id="bkmrk-wavescoperesultw1-a-"><thead><tr><th>Wave</th><th>Scope</th><th>Result</th></tr></thead><tbody><tr><td>W1-A (BLOCKER)</td><td>Unload 3 PHANTOM daemons (mlx-router, db-ttl-sweep, distillation-scorer)</td><td>DONE — boot failure resolved, 56 → 53 com.alai daemons</td></tr><tr><td>W1-B (bulk cleanup)</td><td>Archive + delete 35 paths; settings.bak retention; ~/~ cleanup; ~/projects/ALAI collision</td><td>DONE — 30 valid tar archives in `~/backups/_archive/anvil-fs-sweep-2026-05-07/`, ~9GB freed</td></tr><tr><td>W1-C (split-brain)</td><td>6 active pairs merged/renamed; ~/ALAI/CLAUDE.md surgical update</td><td>DONE — agents merged, architecture/services renamed for disambiguation</td></tr><tr><td>W2 (docs)</td><td>canonical-registry.md, ADR-022, drift-detection-design.md</td><td>DONE — MC #99701</td></tr><tr><td>W3 (validation + publish)</td><td>Proveo E2E, BookStack publish</td><td>DONE — Proveo 9/10 PASS, BookStack shelf 2845</td></tr><tr><td>Phase A (org-audit quick wins)</td><td>chmod planka, gitignore tfstate, PII quarantine, ollama.tar.gz delete</td><td>DONE</td></tr><tr><td>Phase B (ucenje extract)</td><td>New repo + CF Pages + 301 redirect</td><td>DONE — ucenje.alai.no live, 301 verified</td></tr><tr><td>Phase D.1 (personal + clients-external)</td><td>Skeleton + AlemPersonal + client repo migration</td><td>DONE</td></tr><tr><td>Phase D.2 (~/ALAI rename)</td><td>Symlink-based canonical rename</td><td>DONE</td></tr><tr><td>Phase D.3 (agent personas)</td><td>12 personas → ~/system/agents/personas/</td><td>DONE</td></tr><tr><td>Phase D.4 (BasicConsulting unwind + companies removal)</td><td>Tenant cleanup + symlink for daemon backward compat</td><td>DONE</td></tr><tr><td>Phase D push-through</td><td>\_multi-client-hub split, virtual-serbia classification, \_legacy-bc reconciliation, futureProjects removal, ufs rename, KenanHot reclassification, FreeMyEV stub merge, nav-bc-residual merge</td><td>DONE</td></tr></tbody></table>

## References

- **Multi-perspective audit:** `~/system/specs/anvil-organizational-audit-2026-05-07.md`
- **Sub-agent reports:** `/tmp/anvil-org-audit/01-petter*.md` … `06-skybound*.md`
- **Mechanical sweep ADR:** `~/system/architecture/decisions/ADR-022-anvil-fs-sweep-2026-05-07.md`
- **Canonical registry:** `~/system/specs/canonical-registry.md` (post-D updates)
- **Tree blueprint (NEW):** `~/system/specs/anvil-tree-blueprint-2026-05-07.md`
- **Git structure rules (NEW):** `~/system/specs/anvil-git-structure-2026-05-07.md`
- **Memory entries:** `project_alai_entity_identity_clarified_2026-05-07.md`, `project_anvil_phase_d_done_2026-05-07.md`
- **MC chain:** #99710 (org audit parent), #99742 (Phase B.1), #99744 (Phase B.2), #99722 (Brønnøysund — closed), #99723 (BC clarification — pending close), #99724 (Lumiscare notification), #99725 (Telegram revoke)
- **Live deployment:** [https://ucenje.alai.no](https://ucenje.alai.no), [https://github.com/johnatbasicas/ucenje](https://github.com/johnatbasicas/ucenje)

# Tree Blueprint — Where to Put Things

<div id="bkmrk-%E2%9A%A0%EF%B8%8F-read-first-when-d" style="padding:16px;background:#dc2626;color:#FFFFFF;margin-bottom:20px;font-size:18px;font-weight:bold;">⚠️ READ FIRST when deciding any new path</div><div id="bkmrk-purpose%3A-single-answ" style="padding:12px;background:#dbeafe;border-left:4px solid #3b82f6;margin-bottom:20px;">**Purpose:** Single answer to "where does this go?" — read FIRST before any new path creation, repo clone, or directory move.</div>> **One rule:** every file has exactly one canonical home determined by *what it is* + *whose it is*, not by *who created it* or *when*.

## 1. Top-level decision tree

For any new content, answer 4 questions in order:

```
Q1: Is it CODE / file content / data?  No → it's a process artefact, not a tree concern.
Q2: Whose data is it? (CEO personal / ALAI Holding AS / ALAI Tech DOO / a specific client / regenerable)
Q3: What kind? (product, client deliverable, internal tool, scholarly, financial record, brand asset, …)
Q4: What stage? (active draft, in-flight, completed deliverable, archive)

```

## 2. Routing matrix

<table id="bkmrk-whose%3Fwhat-kind%3Fcano"><thead><tr><th>Whose?</th><th>What kind?</th><th>Canonical home</th></tr></thead><tbody><tr><td>**CEO personal**</td><td>CV, NAV records, ID docs</td><td>`~/personal/{cv,nav,legal-personal}/`</td></tr><tr><td>**CEO personal**</td><td>Scholarly research (Quran-19, etc.)</td><td>`~/personal/scholarly/<topic>/` (or own repo + own domain — see ucenje precedent)</td></tr><tr><td>**CEO personal**</td><td>Personal coding (games, hobby projects)</td><td>`~/personal/code/<project>/`</td></tr><tr><td>**CEO personal**</td><td>Real estate, family property</td><td>`~/personal/real-estate/<property>/`</td></tr><tr><td>**CEO personal**</td><td>Personal accounting (NOT ALAI Holding)</td><td>`~/personal/finance-personal/`</td></tr><tr><td>**ALAI Holding AS**</td><td>A product (own SaaS, own brand within ALAI)</td><td>`~/business/ALAI-Holding-AS/products/<product-name>/`</td></tr><tr><td>**ALAI Holding AS**</td><td>Client deliverable / engagement</td><td>`~/business/ALAI-Holding-AS/clients/<CLIENT-NAME>/`</td></tr><tr><td>**ALAI Holding AS**</td><td>Brand surface (alai.no, basicconsulting.no, forms.alai.no)</td><td>`~/business/ALAI-Holding-AS/brand-surfaces/<domain>/` OR `~/business/ALAI-Holding-AS/web/` if alai.no main</td></tr><tr><td>**ALAI Holding AS**</td><td>Brand assets (logo, palette, typography)</td><td>`~/business/ALAI-Holding-AS/brand/` (single source of truth)</td></tr><tr><td>**ALAI Holding AS**</td><td>Finance (accounting, grants, invoices, timesheets)</td><td>`~/business/ALAI-Holding-AS/finance/`</td></tr><tr><td>**ALAI Holding AS**</td><td>Legal (contracts, ROPA, vedtekter, certificates)</td><td>`~/business/ALAI-Holding-AS/legal/`</td></tr><tr><td>**ALAI Holding AS**</td><td>Internal libraries / shared packages</td><td>`~/business/ALAI-Holding-AS/internal/packages/`</td></tr><tr><td>**ALAI Holding AS**</td><td>Sales pipeline, partners, comms, marketing</td><td>`~/business/ALAI-Holding-AS/{sales,partners,comms,content}/`</td></tr><tr><td>**ALAI Holding AS**</td><td>Internal product architecture decisions</td><td>`~/business/ALAI-Holding-AS/product-architecture/` (NOT system architecture)</td></tr><tr><td>**ALAI Holding AS**</td><td>Service catalog / commercial offerings</td><td>`~/business/ALAI-Holding-AS/service-catalog/` (NOT system services)</td></tr><tr><td>**ALAI Tech DOO**</td><td>RS subsidiary content (Bilko/Tok/Drop distribution)</td><td>`~/business/ALAI-Tech-DOO/{products,deliverables,legal,ops}/`</td></tr><tr><td>**External client**</td><td>Client-owned repo (we work IN their repo)</td><td>`~/clients-external/<client-name>/` (matches their org name when possible)</td></tr><tr><td>**External client**</td><td>Engagement records, contracts with that client</td><td>`~/business/ALAI-Holding-AS/clients/<CLIENT>/engagement-docs/`</td></tr><tr><td>**External client**</td><td>Client's brand assets we use</td><td>`~/clients-external/<client-name>/branding/`</td></tr><tr><td>**System runtime**</td><td>Daemons, schedulers, hooks</td><td>`~/system/{daemons,tools,hooks}/`</td></tr><tr><td>**System runtime**</td><td>Architecture decisions (system-level)</td><td>`~/system/architecture/decisions/ADR-XXX.md`</td></tr><tr><td>**System runtime**</td><td>Operational services (authentik, planka, vault)</td><td>`~/system/services/<service>/`</td></tr><tr><td>**System runtime**</td><td>Agent persona definitions</td><td>`~/system/agents/personas/<PersonaName>/`</td></tr><tr><td>**System runtime**</td><td>Specs, plans, runbooks</td><td>`~/system/specs/`, `~/system/runbooks/`</td></tr><tr><td>**System runtime**</td><td>Active databases (Mission Control, HiveMind, …)</td><td>`~/system/databases/` (symlinked) or `~/Library/Application Support/ALAI/db/`</td></tr><tr><td>**ALAI engineering tools**</td><td>Internal CLI / SDK / library used across ALAI</td><td>`~/projects/<repo-name>/` (must have GitHub remote, must be tracked, must NOT mix client work)</td></tr><tr><td>**ALAI infra deploy workspace**</td><td>CF/DNS/Tailscale/Vault/BookStack systemic configs</td><td>`~/aisystem/` (Mehanik gate reads BUILD-BLUEPRINT.md here)</td></tr><tr><td>**Regenerable**</td><td>node\_modules, .gradle, .next, target, venv, build outputs</td><td>INSIDE the repo, gitignored, never outside</td></tr><tr><td>**Backups**</td><td>Tar archives, snapshot dumps</td><td>`~/backups/_archive/<sweep-name-date>/`</td></tr><tr><td>**OS-managed**</td><td>Library data (apps), Caches</td><td>`~/Library/` (DO NOT TOUCH)</td></tr></tbody></table>

## 3. Anti-patterns — explicitly forbidden

<table id="bkmrk-anti-patterncorrect-"><thead><tr><th>Anti-pattern</th><th>Correct alternative</th></tr></thead><tbody><tr><td>Putting personal scholarly content under commercial brand site</td><td>Own repo + own domain (see ucenje → `johnatbasicas/ucenje` + `ucenje.alai.no`)</td></tr><tr><td>Client deliverable in `~/projects/`</td><td>`~/clients-external/<client>/`</td></tr><tr><td>Agent persona in `~/companies/<Name>/`</td><td>`~/system/agents/personas/<Name>/`</td></tr><tr><td>Pretending a domain is a separate firma (vedtekter for it, etc.)</td><td>Domain → `brand-surfaces/<domain>/` under owning entity</td></tr><tr><td>Mixing two clients in one tree</td><td>One tenant per top-level subdir under `~/clients-external/`</td></tr><tr><td>Creating new top-level home dir without entry in `~/system/specs/canonical-registry.md`</td><td>Update registry first, then create dir</td></tr><tr><td>Writing CEO PII (CV, NAV, ID) anywhere outside `~/personal/`</td><td>`~/personal/legal-personal/`, `~/personal/cv/`, `~/personal/nav/`</td></tr><tr><td>Auto-generated `_pii-staging-*` quarantine pattern (one-time fix)</td><td>Process docs/forms BEFORE landing them in tree</td></tr><tr><td>`~/Public` for sensitive content (it is local-network readable)</td><td>Never. Move to private tree.</td></tr><tr><td>Build artefacts (node\_modules, target) outside their repo</td><td>Always inside repo with .gitignore entry</td></tr><tr><td>`.env` files committed to git</td><td>`.env*` in .gitignore; secrets in Bitwarden / Keychain</td></tr><tr><td>Terraform state on local disk</td><td>Remote state (S3/Azure/CF KV); `*.tfstate*` in .gitignore</td></tr></tbody></table>

## 4. References

- ADR-023: `~/system/architecture/decisions/ADR-023-anvil-tenant-restructure-2026-05-07.md`
- Canonical registry: `~/system/specs/canonical-registry.md`
- Git structure rules: `~/system/specs/anvil-git-structure-2026-05-07.md`

# Git Structure Rules

<div id="bkmrk-purpose%3A-standard-gi" style="padding:12px;background:#dbeafe;border-left:4px solid #3b82f6;margin-bottom:20px;">**Purpose:** Standard git hygiene for the multi-tenant tree. Read BEFORE `git init`, `gh repo create`, or any commit decision.</div>## 1. Repo placement matrix

<table id="bkmrk-repo-typecanonical-h"><thead><tr><th>Repo type</th><th>Canonical home</th><th>GitHub org/owner</th><th>Visibility default</th></tr></thead><tbody><tr><td>ALAI product (Bilko, Drop, Tok)</td><td>`~/business/ALAI-Holding-AS/products/<product>/`</td><td>`johnatbasicas/<product>`</td><td>private until launch</td></tr><tr><td>ALAI internal CLI / SDK / library</td><td>`~/projects/<repo-name>/`</td><td>`johnatbasicas/<repo>`</td><td>public if open-source</td></tr><tr><td>ALAI infra workspace</td><td>`~/aisystem/`</td><td>n/a</td><td>n/a</td></tr><tr><td>ALAI Tech DOO (RS subsidiary)</td><td>`~/business/ALAI-Tech-DOO/`</td><td>`alai-tech-doo/<repo>`</td><td>private</td></tr><tr><td>Client-owned repo</td><td>`~/clients-external/<client>/`</td><td>client's GitHub org</td><td>client's choice</td></tr><tr><td>Personal scholarly project</td><td>`~/personal/scholarly/<topic>/`</td><td>`johnatbasicas/<topic>`</td><td>public (transparency)</td></tr><tr><td>System orchestration</td><td>`~/system/`</td><td>`johnatbasicas/alai-system`</td><td>private</td></tr></tbody></table>

## 2. Required files per repo type

<table id="bkmrk-filewhen-requiredrea"><thead><tr><th>File</th><th>When required</th></tr></thead><tbody><tr><td>`README.md`</td><td>Always</td></tr><tr><td>`CLAUDE.md`</td><td>Every repo where agents will be dispatched</td></tr><tr><td>`BUILD-BLUEPRINT.md`</td><td>Repos that build/deploy (per ZAKON PI2)</td></tr><tr><td>`DEPLOY-MAP.md`</td><td>Repos with live deploys (CF Pages, Cloud Run, App Runner, etc.)</td></tr><tr><td>`.gitignore`</td><td>Always — see Section 4</td></tr><tr><td>`.github/workflows/deploy*.yml`</td><td>Repos with CI/CD</td></tr><tr><td>`LICENSE`</td><td>Public repos (default MIT for ALAI products)</td></tr></tbody></table>

## 3. Commit conventions — Conventional Commits (mandatory)

```
<type>(<scope>): <subject> (MC #<id>)

<body — what changed and why>

Co-Authored-By: <persona-name> <noreply@alai.no>

```

**type** ∈ `feat | fix | chore | docs | style | refactor | perf | test | ci | build`

## 4. .gitignore standards

### Universal (every repo)

```
# OS
.DS_Store
Thumbs.db

# Editor / IDE
.vscode/
.idea/
*.swp
.aider*
.claude-scratch/

# Secrets — NEVER COMMIT
.env
.env.*
!.env.example
*.pem
*.key
id_rsa*
*.p12
.bw-session

# Logs
*.log
logs/

# Build outputs
dist/
build/
out/
target/
.next/
.nuxt/
.output/
.turbo/

```

### Node-specific

```
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

```

### Terraform / IaC (CRITICAL after Parisa finding)

```
*.tfstate
*.tfstate.*
*.tfplan
.terraform/
.terraform.lock.hcl
crash.log

```

## 5. Anti-patterns — explicitly forbidden

<table id="bkmrk-anti-patternwhy-it%27s"><thead><tr><th>Anti-pattern</th><th>Why it's bad</th><th>Correct alternative</th></tr></thead><tbody><tr><td>`git add .` without reviewing diff</td><td>Commits unwanted files (.env, tfstate, secrets, IDE configs)</td><td>`git add -p` or explicit paths</td></tr><tr><td>Committing `.env` "for now"</td><td>Secrets in git history forever</td><td>Bitwarden / .env.example pattern</td></tr><tr><td>Force-push to shared/master</td><td>Destroys teammates' work</td><td>PRs only; force-push only on private feat branches</td></tr><tr><td>Cross-tenant repos</td><td>Tenant contamination, IP confusion</td><td>Split into 2 repos, separate orgs ideally</td></tr><tr><td>Tags pushed before work is verified live</td><td>Tag points to broken state</td><td>Tag AFTER `curl 200` + Playwright pass</td></tr></tbody></table>

## 6. References

- ADR-023: `~/system/architecture/decisions/ADR-023-anvil-tenant-restructure-2026-05-07.md`
- Tree blueprint: `~/system/specs/anvil-tree-blueprint-2026-05-07.md`
- Canonical registry: `~/system/specs/canonical-registry.md`
- ZAKON PI2 (deploy verification): `~/system/rules/zakon-pi2-deploy-verification.md`
- Conventional Commits spec: [https://www.conventionalcommits.org/en/v1.0.0/](https://www.conventionalcommits.org/en/v1.0.0/)

# Canonical Registry (Phase D Updated)

<div id="bkmrk-note%3A-this-is-a-live" style="padding:12px;background:#fef3c7;border-left:4px solid #f59e0b;margin-bottom:20px;">**Note:** This is a live snapshot of the canonical paths registry. Manual sync from `~/system/specs/canonical-registry.md`. Last updated: 2026-05-07 (ANVIL Phase D)</div><div id="bkmrk-purpose%3A-industry-st" style="padding:12px;background:#dbeafe;border-left:4px solid #3b82f6;margin-bottom:20px;">**Purpose:** Industry-standard ITIL CMDB / Spotify Backstage pattern. Catalog of canonical paths, their owners, scope, and anti-drift rules. This is the authoritative source for "where does X belong" questions.</div>## Tree Ownership Table

One row per major tree. These are the **canonical locations** — creating parallel structures elsewhere violates the registry.

<table id="bkmrk-treepurposeowner%7E%2Fsy"><thead><tr><th>Tree</th><th>Purpose</th><th>Owner</th></tr></thead><tbody><tr><td>`~/system/`</td><td>Orchestration runtime, daemons, tools, agents, specs, rules, hooks (git), schemas</td><td>John (orchestrator)</td></tr><tr><td>`~/business/ALAI-Holding-AS/`</td><td>Company state — clients, brand, products, sales, legal, org, processes, pipelines, web-worktrees</td><td>ALAI (CEO)</td></tr><tr><td>`~/business/ALAI-Tech-DOO/`</td><td>RS d.o.o. legal subsidiary (Bilko/Tok/Drop distribution)</td><td>ALAI Tech DOO</td></tr><tr><td>`~/personal/`</td><td>CEO Alem Basic personal scope (NOT business)</td><td>CEO (personal capacity)</td></tr><tr><td>`~/clients-external/`</td><td>Client-owned content + state, one tenant per subdir</td><td>Per client</td></tr><tr><td>`~/projects/`</td><td>Code repositories (libraries, internal tools, experiments) — ALAI internal engineering only</td><td>Per repo</td></tr><tr><td>`~/.claude/`</td><td>Claude Code harness (settings.json, hooks, agents, projects, memory, skills)</td><td>Anthropic Claude Code</td></tr><tr><td>`~/Library/`</td><td>macOS system and vendor-managed application state</td><td>OS / app vendors</td></tr><tr><td>`~/aisystem/`</td><td>Canonical infra deploy workspace (Cloudflare Pages/DNS, BookStack, Vault, fleet configs)</td><td>John, Mehanik gate reads this path</td></tr><tr><td>`~/backups/`</td><td>Tar archives + offsite backup source (7-day + 30-day retention)</td><td>John</td></tr></tbody></table>

## Phase D Additions (2026-05-07) — Final Tenant-Isolated Structure

```
~/business/
  ├── ALAI-Holding-AS/   (was ~/ALAI; symlink kept for 158 daemons grace)
  └── ALAI-Tech-DOO/     (RS d.o.o. subsidiary, real legal entity)

~/personal/              (NEW — CEO scope, 9 typed dirs)
~/clients-external/      (NEW — 13 named clients + 1 variants umbrella)
~/companies              SYMLINK → ~/system/agents/personas/  (10+ daemon backward compat)
~/system/agents/personas/  (12 personas)
~/projects/              (8 ALAI eng repos only)

```

## Renamed for Disambiguation (Phase D)

- `~/business/ALAI-Holding-AS/architecture/` → `product-architecture/` (was conflicting with `~/system/architecture/`)
- `~/business/ALAI-Holding-AS/services/` → `service-catalog/` (was conflicting with `~/system/services/`)
- `~/business/ALAI-Holding-AS/templates/` → `doc-templates/` (was conflicting with `~/system/templates/`)
- `~/business/ALAI-Holding-AS/ufs/` → `products/unified-form-service/` (deployed at forms.alai.no)

## 4-Way CLAUDE.md Scope Rules

CLAUDE.md files exist at **4 different scope levels**. Each loads based on current working directory (CWD).

<table id="bkmrk-filescopeloads-whenp"><thead><tr><th>File</th><th>Scope</th><th>Loads When</th><th>Purpose</th></tr></thead><tbody><tr><td>`~/.claude/CLAUDE.md`</td><td>User-global</td><td>**Always loaded** (all Claude Code sessions)</td><td>John's identity, ZAKONs, specialist routing, hard constraints</td></tr><tr><td>`~/CLAUDE.md`</td><td>Home directory project</td><td>CWD = `/Users/makinja`</td><td>Orchestration mode guardrails, session boot protocol, routing one-liners</td></tr><tr><td>`~/system/CLAUDE.md`</td><td>System tree project</td><td>CWD inside `~/system/`</td><td>System-specific build/deploy rules, tool usage</td></tr><tr><td>`~/business/ALAI-Holding-AS/CLAUDE.md`</td><td>ALAI tree project</td><td>CWD inside `~/business/ALAI-Holding-AS/`</td><td>ALAI brand guidelines, client-facing constraints</td></tr></tbody></table>

## What MUST NOT Recreate

These paths were **archived during ANVIL FS Sweep**. Recreating them silently reintroduces filesystem chaos and split-brain drift.

**From ~/system/ (archived):**

- `~/system/archive/`, `~/system/deprecated/`, `~/system/deployments/`, `~/system/plans/`
- `~/system/clients/` (migrated to ~/business/ALAI-Holding-AS/clients/)
- `~/system/infrastructure/`, `~/system/internal/`, `~/system/legal/`, `~/system/org/`
- `~/system/pipeline/`, `~/system/processes/`, `~/system/products/`, `~/system/sales/`, `~/system/web/`

**Post-D additions (MUST NOT recreate):**

- `~/companies/` as a real directory tree (it's a symlink only, for backward compat)
- `~/ALAI/` as a real directory (it's a symlink only)
- `~/projects/personal/` (use `~/personal/`)
- `~/projects/client/` (use `~/clients-external/`)
- `~/projects/Basicconsulting/` (now at `~/business/ALAI-Holding-AS/brand-surfaces/basicconsulting.no/`)
- `~/companies/BasicConsulting/AlemPersonal/` (CEO content moved to `~/personal/`)

## Live Deployments (post-D)

- `https://ucenje.alai.no` ← `~/personal/scholarly/` extracted to `johnatbasicas/ucenje` repo + Cloudflare Pages
- `https://alai.no/ucenje/*` → 301 → `https://ucenje.alai.no/` (verified live)

## References

- **Decision Records:** `~/system/architecture/decisions/ADR-022-anvil-fs-sweep-2026-05-07.md`, `ADR-023-anvil-tenant-restructure-2026-05-07.md`
- **MC chain:** #99710 (org audit parent), #99637 (mechanical sweep parent)
- **Memory:** `project_anvil_phase_d_done_2026-05-07.md`, `project_alai_entity_identity_clarified_2026-05-07.md`