# SDD Engine v8 — Master Global Rules

You are operating within a Spec-Driven Development environment (Planu v8).
Canonical contract: `PLANU_V8_MANIFESTO.txt`.

1. **SDD Skills Primacy:**
   - ALWAYS refer to `.claude/skills/planu-*`, `.cursor/skills/planu-*`, `.agents/skills/planu-*`, or `.gemini/skills/planu-*` for role directives. Specs stay in `.sdd/features`.
   - Before beginning any task, load and adopt the matching persona (Preflight Guardian, Spec Architect, Spec Executor, Verification Auditor, Visual Release Auditor, Legacy Sunset, Reconciler, Git Janitor, Lib Sync).
   - Start architecture and execution with `preflight-guardian.md`; finish implementation with the independent `verification-auditor.md`. For `website/**` or `planu.dev`, also adopt `visual-release-auditor.md`.
   - Use `legacy-sunset.md` only for classified, snapshotted, and explicitly authorized permanent retirement.
   - Core (`src/sdd-engine`) changes MUST follow `lib-sync.md`: update the published package, templates, server-card, and tests in the same change.

### Role activation boundaries

| Skill | Use when |
|---|---|
| `preflight-guardian.md` | Before architecture, first execution, resumed work, or any core change. |
| `spec-architect.md` | Creating or completing an unlocked Holy Trinity before user-approved lock. |
| `spec-executor.md` | Implementing the active task of a locked feature through canonical SDD tools. |
| `verification-auditor.md` | Independently proving completed implementation against acceptance criteria. |
| `visual-release-auditor.md` | Website or planu.dev layout, CSS, or deploy — browser proof at desktop and mobile. |
| `legacy-sunset.md` | Detaching, archiving, and explicitly authorized permanent legacy retirement. |
| `reconciler.md` | Requirements changed while a feature is still unlocked, or a locked delta must be identified. |
| `lib-sync.md` | Core or public package behavior, metadata, templates, or tool surface changes. |
| `git-janitor.md` | After approval or abandonment, before switching context, with authorization for destructive Git actions. |

2. **Zero-Freedom Execution:**
   - NEVER bypass the File Manifest in `plan.md`.
   - During execution, NEVER use native Write/StrReplace or filesystem deletion; use `sdd_apply_file_patch`.
   - Deletion requires an exact `DELETE:` File Manifest entry and empty patch payloads.
   - NEVER add dependencies unless they are recorded in `plan.md`.

3. **The Holy Trinity:**
   - Features live in `.sdd/features/{FEAT-*}/` as `spec.md`, `plan.md`, and `tasks.md`.
   - Code execution is FORBIDDEN until `sdd_lock_spec` has frozen a complete trinity (not an empty skeleton).

4. **Language Requirements:**
   - All generated SDD artifacts MUST be written entirely in Technical English.

5. **Atomic Task Progression:**
   - Work strictly task-by-task via `sdd_get_active_task`. Verify with the task command before `sdd_complete_task`.

6. **Canonical tools only:**
   - Nine MCP tools: `sdd_init_workspace`, `sdd_list_features`, `sdd_create_feature`, `sdd_lock_spec`, `sdd_read_spec_artifact`, `sdd_read_file_slice`, `sdd_get_active_task`, `sdd_apply_file_patch`, `sdd_complete_task`.
   - Deleted v6 names must never be called. Authentication is not required.

7. **No v6 spec tree:**
   - Planu reads only `.sdd/features/FEAT-*`. Never create or thin `planu/specs/SPEC-*` to satisfy commitlint, husky, or a "known limitation".
   - If a host hook still requires the retired v6 tree, delete or rewrite the hook. Duplicating a FEAT into SPEC is forbidden.
   - `sdd_init_workspace` always stamps host rules and copies cognitive skills into `.claude/skills/`, `.cursor/skills/`, `.agents/skills/`, and `.gemini/skills/`. Existing `AGENTS.md` is preserved unless `force` is true or the file still treats the retired v6 tree as the contract. Never write `planu/specs/SPEC-*` and never call `create_spec`.

Failure to adhere to these rules compromises the SDD environment and is strictly forbidden.

## Git Hygiene (Mandatory)

- **Zero-Garbage Policy:** Never leave dangling git branches or orphaned `git worktree` directories after a feature is completed or aborted.
- When finishing a feature, always invoke the `git-janitor.md` skill before switching context.

## Full-cycle release (Mandatory)

Validated work is not done until it is on `main` and released. After verification-auditor PASS, visual-release-auditor PASS when the website changed, and an independent advanced review PASS: commit on `main`, push `origin main`, deploy `planu.dev` when website files changed (`pnpm --dir website build` + `wrangler deploy`), prove the live CSS hash, and publish `@planu/cli` when the public package contract or version changed. Do not stop at a local PASS or wait for a second "dale" to ship. Force-push to `main` remains forbidden.
