# 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/)