# INVEETAIRE
## AI DEVELOPMENT SYSTEM

Version 1.0 (Final)

Status: Active

| Field | Value |
|-------|-------|
| Document Type | Governance |
| Version | 1.0 (Final) |
| Status | Active |
| Established | Sprint 0 |
| Authority | AI.md → ADR → MIB → Sprint Plan → Prompt → Implementation |
| Applies To | All AI-assisted development sessions on this project |

> This document defines the official AI Development System for the Inveetaire project. It is a permanent governance document. No implementation session may contradict it. Any revision to this document requires a Design Revision Pack and explicit user approval.

---

> **The repository is the source of truth — not the AI's memory.**

Every AI session begins by reading the repository — not by relying on conversational memory. AI sessions are ephemeral: context windows fill, quotas exhaust, and accounts rotate. The repository does not change unless a human commits a change. By anchoring every session to the repository state, the system guarantees that any AI agent — regardless of provider, account, or prior conversation history — operates from the same authoritative base.

---

## 1. Purpose

Inveetaire is a complex multi-portal wedding management platform built in phases over an extended development timeline. The development team uses AI coding assistants as primary implementation agents under human architectural governance.

This AI Development System exists because:

**AI agents lack persistent memory across sessions.** Without a formal system, each session would begin without knowledge of prior decisions, creating inconsistency, duplication, and architectural drift.

**AI agents may exceed their scope.** Without hard boundaries, an AI session may implement undocumented files, modify unrelated code, or introduce undocumented abstractions that conflict with the approved architecture.

**Architecture must precede implementation.** AI agents are powerful implementers but poor architects. The system separates architectural decision-making (human-led) from implementation (AI-assisted) with formal handoff points.

**Consistency across quota rotations is required.** AI tools operate under usage quotas. Development sessions may span multiple accounts and resume across days. The system ensures that any AI agent picking up mid-sprint produces output consistent with what the previous agent produced.

**Auditability is required.** Every implementation decision must be traceable to an approved document. This system provides that traceability.

The result is a development workflow where AI agents produce high-quality, architecturally consistent code on the first attempt — guided by comprehensive documentation, bounded by approved task definitions, and reviewed by a human approver before any change is committed.

---

## 2. Development Philosophy

### 2.1 Documentation First

No implementation begins without approved documentation.

Every feature is first defined in the Master Implementation Backlog (MIB). Every architectural decision is recorded in the Architecture Decision Records (ADR). Every development standard is codified in the Development Blueprint (DBP).

AI agents do not design. They implement what is already designed and documented.

> **Rule**: If a task requires something not documented in an approved document, implementation must STOP. The gap is reported to the human approver. Documentation is updated before implementation resumes.

### 2.2 Architecture First

Architecture is approved before any code is written. The approved architecture documents (PRD, SAD, DDD, PDD, ADR, DBP) are established before Sprint 0 begins. They are not modified during implementation except through the formal Design Revision Pack process.

Implementation follows architecture. Architecture does not follow implementation.

### 2.3 One Source of Truth

Every piece of information has exactly one authoritative source. Contradictions between documents are escalation triggers — not implementation ambiguities to resolve autonomously.

| Information | Authoritative Source |
|-------------|---------------------|
| AI agent behavior rules | AI.md |
| Architecture decisions | ADR |
| Task definitions, files expected, acceptance criteria | MIB |
| Development standards, naming, coding conventions | DBP |
| Sprint execution order | Sprint Execution Plan |
| Specific session instructions | Implementation Prompt |

When any document contradicts a higher-authority document: **STOP. Report. Wait.**

### 2.4 Implementation Follows Documentation

No file is created that is not listed in the task's "Files Expected". No file is modified that is not explicitly within task scope. No architectural decision is made during implementation.

Implementation is the act of faithfully translating an approved, documented specification into code.

---

## 3. AI Roles

The AI Development System defines five distinct roles. One entity may perform multiple roles, but the responsibilities must not be conflated within a single action.

### 3.1 Architecture Lead

**Who**: Human (project owner / lead developer)

**Responsibilities**:
- Reviews and approves all Architecture Decision Records
- Approves the Master Implementation Backlog
- Reviews and approves the Development Blueprint
- Reviews and approves Design Revision Packs
- Makes all architectural decisions
- Resolves escalated conflicts between documents

**Does NOT**:
- Write implementation code
- Approve implementation without reviewing it
- Approve documentation changes without reading them

---

### 3.2 Documentation Agent (AI)

**Who**: AI assistant in documentation mode

**Responsibilities**:
- Produces Design Revision Packs from approved architectural discoveries
- Synchronizes AI.md, MIB, and DBP after DRP approval
- Produces Sprint Planning documents
- Produces Architecture Review documents
- Writes implementation memory files

**Does NOT**:
- Invent architectural decisions
- Change approved content without a DRP
- Write implementation code during documentation tasks

---

### 3.3 Implementation Agent (AI)

**Who**: AI assistant in implementation mode

**Responsibilities**:
- Reads all mandatory references before writing code
- Implements exactly one MIB task per session
- Creates only the files listed in "Files Expected"
- Produces an implementation report after each task
- Proposes a commit message for human review

**Does NOT**:
- Modify files outside task scope
- Create undocumented files
- Execute Git operations (except when explicitly instructed)
- Resolve documentation conflicts autonomously
- Design architecture

---

### 3.4 Quality Reviewer (AI or Human)

**Who**: AI assistant in review mode, or human reviewer

**Responsibilities**:
- Reviews implementation against the task's acceptance criteria
- Verifies that Files Expected matches files actually created
- Checks output escaping, security patterns, and coding standards
- Produces a review report

**Does NOT**:
- Approve implementation (that is the Human Approver's role)
- Modify implementation during review

---

### 3.5 Human Approver

**Who**: Project owner / lead developer

**Responsibilities**:
- Reviews every implementation report
- Reviews every quality review
- Approves or rejects each completed task
- Executes `git add`, `git commit`, `git push`
- Authorizes continuation to the next task
- Approves all Design Revision Packs

**Does NOT**:
- Write implementation code during approval
- Skip the review step under time pressure

---

## 4. System Overview

The following diagram describes the complete AI Development System in a single view. Every step is elaborated in the sections that follow.

```
Business Vision
    |
    v
Architecture (SAD, DDD, PDD, ADR)
    |
    v
Documentation (DBP, MIB, TCS)
    |
    v
Sprint Planning
    |
    v
Implementation Prompt
    |
    v
AI Implementation (one task)
    |
    v
Implementation Report
    |
    v
Quality Review
    |
    v
Human Approval
    |
    v
Git Commit + Push (Human)
    |
    v
Repository (permanent record)
    |
    v
Memory File (session summary)
    |
    v
Next Session
```

The loop from "Next Session" returns to "Implementation Prompt" for the next task, or to "Sprint Planning" when a new sprint begins. The repository is always the anchor point between sessions.

---

## 5. Development Lifecycle

The complete development lifecycle from concept to committed code:

```
Business Idea
    |
    v
Requirements (PRD)
    |
    v
Architecture (SAD, DDD, PDD, ADR)
    |
    v
Documentation (DBP, MIB, TCS)
    |
    v
Sprint Planning
    |
    v
Implementation Prompt (per task)
    |
    v
Implementation (AI Agent)
    |
    v
Implementation Report (AI Agent)
    |
    v
Quality Review (AI or Human)
    |
    v
Human Approval
    |
    v
Git Commit + Push (Human)
    |
    v
Implementation Memory (AI Agent)
    |
    v
Next Task
```

**Never skip a stage.** Each stage is a gate. An incomplete stage may not be bypassed to accelerate delivery.

### 5.1 Sprint Lifecycle

Each sprint moves through the following phases:

| Phase | Activities |
|-------|-----------|
| **Planning** | Read MIB, produce Sprint Planning document, define execution order |
| **Implementation** | One task per session — prompt → implement → report → approve → commit |
| **Review** | Architecture review of all sprint deliverables after sprint completes |
| **Documentation Sync** | Design Revision Pack → update AI.md, MIB, DBP as required |
| **Sprint Gate** | All checklist items verified before sprint declared complete |

---

## 6. Prompt Lifecycle

Every implementation session begins with a prompt and ends with a committed memory file:

```
Prompt Created (Human)
    |
    v
AI reads mandatory references
    |
    v
AI reviews previous implementations (docs/ai/memory/)
    |
    v
Implementation
    |
    v
Self-review against acceptance criteria
    |
    v
Implementation Report produced
    |
    v
Human reviews implementation and report
    |
    v
Human Approval
    |
    v
Git Commit + Push (Human)
    |
    v
Memory File written (docs/ai/memory/)
    |
    v
Next Prompt
```

### 6.1 Mandatory Pre-Implementation Reading

Before writing any code, the AI Implementation Agent must read:

1. `AI.md` — operational rules and governance
2. `PROJECT.md` — project overview and context
3. `WORKFLOW.md` — step-by-step workflow
4. `IMPLEMENTATION_ROADMAP.md` — sprint structure
5. All task-relevant architecture documents (ADR, MIB, DBP, TCS)
6. All `docs/ai/memory/` files relevant to the current sprint
7. All previous implementations the current task depends on

This reading is not optional. Skipping it is the most common cause of scope creep, architectural inconsistency, and implementation errors.

---

## 7. Memory System

### 7.1 Purpose

The memory system is the mechanism by which context is preserved across AI sessions, account rotations, and time gaps. It is the answer to the question: "How does the next AI agent know what the previous one did?"

Memory files record:
- What was implemented
- Why specific decisions were made
- What conflicts arose and how they were resolved
- What was deferred and why
- What the next session needs to know

Memory files are documentation. They do not replace approved architecture documents. They supplement them with implementation-specific context.

### 7.2 Location

```
docs/ai/memory/
```

### 7.3 Naming Convention

Files are numbered sequentially in chronological creation order:

```
01_project_understanding.md
02_sprint0_execution_plan.md
03_init001.md
04_init002.md
...
14_init011.md
14_init011_conflict.md    <- conflict resolution for same task
15_design_revision_pack_v2.0.md
16_aimdv1.1.md
17_mibv1.1.md
```

Numbers reflect chronological order, not task ID order. When a task requires multiple memory entries (e.g., a conflict arose mid-task), the same number prefix is used with a suffix.

### 7.4 Content Structure

Each memory file contains:

- **Task ID** — the MIB task or documentation task this memory covers
- **Summary** — what was done
- **Files Created / Modified** — exact file paths
- **Key Decisions** — decisions made during implementation and their rationale
- **Conflicts Encountered** — any documentation conflicts discovered, and how they were resolved or escalated
- **Deferred Items** — anything identified but explicitly not implemented
- **Next Session Notes** — what the next AI session needs to know

### 7.5 When Memory Files Are Created

A memory file is created **after** implementation is complete and **after** human approval. It is not written speculatively before the task is done.

### 7.6 When Memory Files Are Frozen

Memory files are **immutable** once written. They are historical records. If an error in a memory file is discovered, a new memory file documents the correction — the original is never edited.

### 7.7 Repository as Product Memory

The repository stores everything the project has ever decided, built, reviewed, or planned:

| Layer | What Is Stored |
|-------|---------------|
| Architecture | `docs/` — PRD, SAD, DDD, PDD, ADR, DBP, MIB, TCS |
| Design Revisions | `docs/02-architecture/DESIGN_REVISION_PACK_*.md` |
| Sprint Planning | `docs/02-architecture/SPRINT*_PLANNING.md` |
| Architecture Reviews | `docs/02-architecture/SPRINT*_ARCHITECTURE_REVIEW.md` |
| Governance | `docs/04-governance/` |
| Prompts | `docs/ai/prompts/` |
| Implementation Memories | `docs/ai/memory/` |
| Source Code | `app/`, `config/`, `routes/`, `public/` |
| History | Git commit log |

> **The repository is the project's permanent memory. AI memory is temporary.**

An AI session ends and its conversational context is gone. The repository remains. Any future session — days, months, or years later, using any AI model — can reconstruct the complete project state by reading the repository. Nothing is lost between sessions as long as every session ends with a commit and a memory file.

---

## 8. Response Archive

### 8.1 Purpose

The response archive stores the complete AI implementation reports, architecture reviews, and documentation outputs produced during each session. It is a verbatim record of what the AI produced, not a summary.

Where memory files answer "what was decided", response files answer "what was said."

### 8.2 Location

```
docs/ai/responses/
```

The Inveetaire project stores both memory summaries and full responses under `docs/ai/memory/`, with the README distinguishing their purposes.

### 8.3 Naming Convention

Response files follow the same sequential numbering as memory files:

```
03_init001.md       <- memory summary
03_init001_full.md  <- full response (if stored separately)
```

### 8.4 Relationship with Memory Files

Memory files are curated summaries. Response files are complete records. When a future AI session needs to understand a past decision in detail, it reads the response file. When it needs the essential facts, it reads the memory file.

Both are read-only after creation.

---

## 9. Prompt Library

### 9.1 Purpose

The prompt library contains the implementation prompts used in each session. A prompt is the complete instruction set given to an AI Implementation Agent for a single task.

The prompt library serves two purposes:
1. **Historical record** — what was the AI asked to do?
2. **Reusability** — well-structured prompts can be adapted for similar tasks in future sprints

### 9.2 Location

```
docs/ai/prompts/
```

### 9.3 Naming Convention

Prompts are numbered sequentially and include the task ID:

```
00_PROJECT_UNDERSTANDING.md
01_INIT001.md
02_INIT002.md
03_INIT005.md
04_INIT003.md
...
19_MIB_MINOR_DBP_v1.1.md
20_SPRINT0_ARCHITECTURE_REVIEW.md
21_SPRINT1_PLANNING.md
22_AI_DEVELOPMENT_SYSTEM.md
99_resume_session.md
```

The `99_resume_session.md` file is a standing template for resuming after a session break or account rotation.

### 9.4 Prompt Quality Standards

Every implementation prompt must include:

- **Mandatory References** — documents the AI must read before beginning
- **Objective** — what is being implemented
- **Task ID** — the MIB task being implemented
- **Files Expected** — exact list of files to create
- **Acceptance Criteria** — verifiable conditions for task completion
- **Explicit Prohibitions** — what must NOT be done in this session

Prompts that lack mandatory references or acceptance criteria produce inconsistent results.

### 9.5 Reusability

Prompt structure (not content) is reusable across sprints and projects. The template established during Sprint 0 is the reference format for all future prompts.

---

## 10. Documentation Hierarchy

All documents in the Inveetaire project follow a strict authority hierarchy. When any lower-level document conflicts with a higher-level document, implementation must stop.

```
AI.md                  <- Highest authority — governs all AI behavior
    |
    v
ADR                    <- Architecture decisions — binding on all implementation
    |
    v
MIB                    <- Task definitions — governs what is built
    |
    v
Sprint Execution Plan  <- Execution order and sprint-specific guidance
    |
    v
Implementation Prompt  <- Session-specific instructions
    |
    v
Implementation         <- Lowest authority — must conform to all above
```

### 10.1 Conflict Protocol

When a conflict is detected between any two documents:

```
STOP
    |
    v
Identify the two conflicting documents and the specific conflict
    |
    v
Report to the Human Approver with:
  - Document A (higher authority): what it says
  - Document B (lower authority): what it says
  - The specific conflict
  - Possible resolution options
    |
    v
Wait for explicit approval before proceeding
    |
    v
Document the resolution in a memory file
    |
    v
Update lower-authority document via Design Revision Pack if required
```

**Never guess. Never resolve conflicts autonomously. Never implement ambiguous requirements.**

### 10.2 Examples Are Not Deliverables

If a document contains an example to illustrate a concept, that example is not an implementation requirement. Examples illustrate intent; they do not specify deliverables.

If an example in a lower-authority document appears to conflict with a higher-authority document, the higher-authority document governs.

> *This was one of the most important lessons of Sprint 0 — formalized in AI.md v1.1, Section 25a. See also Section 16.1 (Lessons Learned).*

---

## 11. Implementation Rules

> **Cross-reference**: Section 3 (AI Roles) defines who performs these rules. Section 14 (Quality Gates) defines when they are verified.

These rules govern every AI Implementation Agent in every session. They are not guidelines. They are operating requirements.

### Rule 1 — One Task Per Session

Each AI Implementation Agent implements exactly one MIB task per session. No session combines two unrelated tasks. No session anticipates the next task. When the task is complete, the session ends.

### Rule 2 — No Undocumented Files

No file is created that is not listed in the task's "Files Expected". If an implicit prerequisite is discovered during implementation, the session stops, reports the prerequisite, and waits for approval before creating the file.

### Rule 3 — Files Expected Governs Scope

The "Files Expected" table in the MIB task definition is the hard boundary of implementation scope. It is the complete and final list of what may be created. Nothing more. Nothing less.

### Rule 4 — No Git Execution

AI agents do not execute `git add`, `git commit`, or `git push` unless the human explicitly authorizes it in the current session message. Proposing a commit message is always acceptable. Executing Git operations without authorization is never acceptable.

> The phrase "implement INIT-XXX" does NOT authorize git operations. (WORKFLOW.md, Step 8A)

### Rule 5 — Implementation Report Is Mandatory

Every completed task must be accompanied by an implementation report. The report must include:
- Task ID
- Files created
- Files modified
- Acceptance criteria verification (each criterion: pass / fail / note)
- Deviations from specification (if any)
- Proposed commit message

A task is not complete without its report.

### Rule 6 — Approval Is Required Before Continuation

No subsequent task begins without explicit human approval of the current task's implementation report. Approval may be conditional. Corrections must be applied before the session ends.

### Rule 7 — Stop on Conflict

Any discovered conflict between architecture documents triggers an immediate stop. The conflict is reported. Implementation does not continue until the conflict is resolved by the human approver.

### Rule 8 — No Scope Expansion

AI agents may not implement features not in the current task, even if they are "obviously needed" or "logically adjacent". Scope expansion is a human decision, not an AI decision.

### Rule 9 — What AI Must Never Do

The following are absolute prohibitions. No circumstance, instruction, or reasoning justifies any of these actions.

| Prohibition | Consequence of Violation |
|-------------|-------------------------|
| Guess architecture | Produces undocumented design decisions that conflict with ADR |
| Create files not in "Files Expected" | Violates task scope; requires rollback |
| Ignore a documentation conflict | Produces implementation based on ambiguous requirements |
| Continue after a failed quality gate | Propagates defects into subsequent tasks |
| Modify frozen architecture without approval | Introduces unauthorized changes to the kernel |
| Execute Git operations without explicit instruction | Commits unapproved changes to the repository |
| Skip the implementation report | Leaves no record; human cannot approve what is not documented |
| Expand scope beyond "Files Expected" | Violates the task boundary; creates undocumented deliverables |
| Replace human approval with self-approval | Removes the human governance layer from the workflow |

---

## 12. Git Workflow

Version control is the permanent record of what was built and when. The Git workflow enforces that no code reaches the repository without human review and approval.

```
Implementation Complete
    |
    v
Implementation Report Produced
    |
    v
Human Reviews Implementation
    |
    v
Human Approves
    |
    v
AI proposes commit message
    |
    v
Human executes: git add
    |
    v
Human executes: git commit -m "message"
    |
    v
Human executes: git push
    |
    v
(Optional) Human tags the release
```

### 12.1 AI and Git Operations

**AI agents do not execute Git operations unless explicitly instructed.**

Read-only Git commands (`git status`, `git log`, `git diff`) may be run freely to verify state. Write operations (`git add`, `git commit`, `git push`, `git tag`) are executed by the human approver only.

### 12.2 Commit Conventions

One task = one commit. Commits are not batched across unrelated tasks.

```
type: description (TASK-ID)

Examples:
feat: implement BaseController render and layout system (INIT-011)
docs: synchronize MIB to version 1.1
fix: correct session save path fallback logic
```

### 12.3 Tag Conventions

Sprint completion may be tagged:

```
git tag -a sprint-0-complete -m "Sprint 0 framework complete"
```

Tags are human decisions. AI agents propose; humans execute.

---

## 13. Account Rotation Strategy

### 13.1 Context

AI coding assistants operate under usage quotas. A development session may be interrupted by quota exhaustion before a task is complete. The project may span months — longer than any single session's context window reliably retains.

The account rotation strategy ensures that development remains continuous and consistent regardless of which AI account or session is active.

### 13.2 The Principle

**The repository is the source of truth — not the AI's memory.**

Every AI agent starts a session by reading the repository. It does not rely on conversation history that may be truncated or unavailable.

```
New Session Begins
    |
    v
AI reads AI.md
    |
    v
AI reads PROJECT.md, WORKFLOW.md, ROADMAP.md
    |
    v
AI reads all docs/ai/memory/ files
    |
    v
AI reviews current repository state
    |
    v
AI produces written summary:
  - What was done
  - What is current sprint
  - What is current task status
  - What is the next action
    |
    v
Human confirms or corrects the summary
    |
    v
Implementation begins
```

### 13.3 Why the System Remains Deterministic

Despite account rotations, quota interruptions, and multi-day gaps, the system produces consistent output because:

1. **Memory files are written to disk** — they are not lost when a session ends. The next agent reads them.
2. **Documentation is version-controlled** — the approved architecture documents are in the repository. Any agent reads the same documents.
3. **Prompts are version-controlled** — the `docs/ai/prompts/` library records what was asked.
4. **Responses are version-controlled** — the `docs/ai/memory/` directory records what was produced.
5. **The task definition governs behavior** — MIB task definitions are precise. Different agents implementing the same task from the same documents produce equivalent results.

The AI accounts rotate. The repository does not. The repository is the continuity mechanism.

### 13.4 Session Resume Protocol

When resuming from a previous session or a different account:

1. Provide the context prompt (stored in `docs/ai/prompts/99_resume_session.md`)
2. AI reads all mandatory documents and all memory files
3. AI produces a written summary: current sprint, completed tasks, current task status, next action
4. Human confirms the summary before implementation resumes

The confirmation step is not optional. It verifies that the new session has correctly absorbed the context before proceeding.

### 13.5 Model Independence

The AI Development System is designed to be independent of any specific AI model or provider.

Any AI model capable of reading documentation, following instructions, and producing structured output may participate as an Implementation Agent, Documentation Agent, or Quality Reviewer. Different models may be used in different sessions, or even for different tasks within the same sprint, without affecting the correctness or consistency of the output.

This is possible because:

- **The repository is the source of truth.** No model-specific memory is required between sessions.
- **Prompts are explicit and complete.** A well-formed prompt contains all context needed for any capable model to produce correct output.
- **Documentation is self-contained.** The MIB, DBP, ADR, and AI.md together fully specify what to build and how to build it, without relying on any model's internal knowledge.
- **Memory files bridge sessions.** What one model produced is recorded in the memory files that the next model reads.

The correctness of the implementation depends on the quality of the documentation, not on the continuity of the AI model. A project that switches from one AI provider to another mid-sprint loses nothing — provided the repository, memory files, and documentation are current.

No implementation may assume, depend on, or require model-specific behavior, syntax preference, or internal reasoning. All AI output is governed by the documentation hierarchy, not by the model that produced it.

---

## 14. Quality Gates

Quality gates are mandatory checkpoints. A gate may not be passed without verification.

### 14.1 Before Implementation Begins

| Gate Item | Verification |
|-----------|-------------|
| Task ID exists in MIB | Locate task entry |
| All mandatory references read | Confirmed in session opening |
| All dependency tasks are complete | Verify files exist in repository |
| Implementation memory for dependencies read | Confirmed in session opening |
| No existing conflict between task documents | Confirmed — no escalation needed |

If any item fails, do not begin implementation. Resolve the issue or escalate.

### 14.2 Before Approval

| Gate Item | Verification |
|-----------|-------------|
| All files in "Files Expected" are created | Directory listing |
| No files created outside "Files Expected" | Git diff |
| All acceptance criteria verified | Checklist in implementation report |
| No kernel files modified (if frozen sprint) | Git diff |
| Output escaping applied in all view output | Code inspection |
| No business logic in controllers | Code inspection |
| No raw SQL in controllers or services | Code inspection |
| Implementation report produced | Report exists |
| Proposed commit message included | Report includes commit message |

### 14.3 Before Commit

| Gate Item | Verification |
|-----------|-------------|
| Implementation report reviewed by human | Human confirms |
| Human approval given explicitly | Human states approval |
| No debug code in committed files | Human confirms |
| No TODO comments committed | Human confirms |
| Commit message follows convention | Message reviewed |

### 14.4 Before Sprint Close

| Gate Item | Verification |
|-----------|-------------|
| All sprint tasks complete and approved | Task checklist |
| Sprint Gate checklist verified | As defined in Sprint Execution Plan |
| Memory files written for all tasks | `docs/ai/memory/` inspection |
| Architecture review complete | Review document produced |
| Design Revision Pack produced (if revisions exist) | DRP document present |
| All documentation synchronized | Comparison of DRP revisions to updated docs |
| Sprint completion tag applied | Git log |

---

## 15. Documentation Synchronization

Architecture discoveries made during implementation are captured and synchronized back into the approved documents. This is the mechanism that prevents documentation drift.

### 15.1 The Synchronization Cycle

```
Sprint Implementation
    | (discoveries, conflicts, clarifications arise)
    v
Design Revision Pack (DRP)
    | Captures all approved changes
    v
AI.md Update
    | Governance rules updated
    v
MIB Update
    | Task definitions corrected
    v
DBP Update
    | Development standards corrected
    v
Architecture Review
    | Formal audit of completed sprint
    v
Sprint Planning (next sprint)
    | Built on synchronized documentation
    v
Implementation
```

### 15.2 Design Revision Pack (DRP)

A DRP is produced at the end of each sprint. It documents:
- Every approved change discovered during implementation
- The revision number and description
- Which documents require updating
- What the update changes

The DRP is the only mechanism by which approved architecture documents are modified. No document is modified without a corresponding DRP entry.

### 15.3 DRP Rules

- DRP includes only approved findings. Rejected ideas are not recorded.
- DRP does not include implementation details. It records architectural decisions.
- DRP entries are numbered sequentially across the entire project (not per-sprint).
- Once a DRP is approved, its revisions are applied to all referenced documents before the next sprint begins.

### 15.4 Document Versioning

Documents are versioned when substantially revised:

| Document | Version after Sprint 0 |
|----------|----------------------|
| AI.md | v1.1 |
| MIB | v1.1 (Epic 0 only) |
| DBP | v1.1 |
| DRP | v2.0 |

Minor editorial changes do not increment the version. Structural or substantive changes do.

---

## 16. Lessons Learned

The following lessons were discovered during Sprint 0 implementation. They are recorded here because they represent non-obvious failure modes that a new project or a new AI agent would not anticipate.

### 16.1 Examples Are Not Deliverables

Architecture documents sometimes include illustrative examples — sample code, representative file structures, placeholder values — to clarify intent. These examples are not implementation requirements.

**The error**: An AI agent risks implementing an example directory structure verbatim, creating files not in "Files Expected" and not in the approved architecture.

**The principle**: "Files Expected" is the only authoritative list. If a file is not in "Files Expected", it is not a requirement — regardless of whether it appears in an example elsewhere in the document.

### 16.2 Implicit Prerequisites Require Explicit Approval

During Sprint 0, the view renderer (INIT-011) required `escape_html()` as a helper function. This helper was not in any approved document. Rather than creating it silently, the implementation agent stopped, reported the prerequisite, and received explicit approval before creating it.

**The principle**: If a task cannot be completed without a file not documented anywhere, stop and report. Do not create undocumented files. The architecture may have an oversight — document it through the DRP process, then implement.

### 16.3 Architecture Freezes Are Enforced

Once a sprint's kernel is declared frozen, no kernel file is modified — even if a modification seems small and obviously correct. The only exception is an additive change explicitly approved through documentation.

**The principle**: "Frozen" means frozen. The discipline of not modifying frozen code is more valuable than the occasional convenience of a small tweak. Small unauthorized changes are how technical debt accumulates invisibly.

### 16.4 Dependency Order Overrides Numeric Task IDs

MIB task IDs (INIT-001, INIT-002, etc.) are identifiers, not execution sequence. The correct execution order is determined by dependency analysis, not by numeric order.

**The Sprint 0 discovery**: INIT-012 (database validation) must execute after INIT-008 and before INIT-009 — despite its higher number. Following numeric order would have produced invalid results.

**The principle**: Always construct a dependency graph before beginning sprint implementation. Numeric IDs are reference labels. The dependency graph is the execution sequence.

> Dependency order always takes precedence over numeric task identifiers. (MIB v1.1)

### 16.5 Validation Tasks Are Not Implementation Tasks

INIT-012 validated a database connection. It did not implement anything. Initially, the documentation implied it would create files. The correct interpretation — validation only, no new files — required clarification through the DRP process.

**The principle**: "Validate X" means verify that X works. It does not mean implement X again or enhance X. Validation tasks produce test output and implementation memory — not new source files.

### 16.6 Documentation Conflicts Are Escalation Triggers

During INIT-011, a task prompt used a name that conflicted with the Sprint 0 Execution Plan task name. An AI agent that resolved this silently would have risked implementing the wrong task.

**The principle**: Every documentation conflict, no matter how minor-seeming, is an escalation trigger. The conflict is reported, the resolution is approved, and the resolution is documented before implementation continues.

### 16.7 Prompt Errors Do Not Override the MIB

A prompt is a lower-authority document. If the prompt's task name, file list, or instructions conflict with the MIB task definition, the MIB governs. The conflict is reported. The prompt error is corrected through the DRP process.

---

## 17. Scalability

The AI Development System is designed to scale beyond a single developer and a single sprint.

### 17.1 Large Repositories

As the codebase grows across 15+ sprints and 120+ tasks:

- Memory files provide a searchable history of every implementation decision
- The documentation hierarchy ensures that any AI agent can always find the authoritative answer to any architectural question
- Task IDs provide precise traceability from code back to business requirements

No part of the system degrades with repository size. The memory system grows linearly.

### 17.2 Multiple AI Agents

Multiple AI agents may work on a project simultaneously if:

- Each agent is assigned exactly one task at a time
- Tasks assigned to different agents have no shared file dependencies
- Each agent's implementation is reviewed and committed before an overlapping task begins

Tasks on independent branches of the dependency graph may be parallelized. Tasks within the same dependency chain must remain sequential.

### 17.3 Multiple Human Developers

If multiple humans contribute:

- Each developer follows the same workflow (Section 5)
- Each developer is the Human Approver for their assigned tasks
- The Architecture Lead retains veto authority over all approvals
- No implementation bypasses the documentation hierarchy

Human contributors do not bypass any quality gates. The same workflow applies to human-written code as to AI-generated code.

### 17.4 Long-Running Projects

For projects spanning months or years:

- The DRP process ensures documentation stays synchronized with implementation reality
- Sprint Planning documents provide fresh context at the start of each sprint
- Memory files ensure no implementation decision is ever lost
- Architecture Review documents provide periodic correctness checks

The AI Development System has no time limit. It is as effective after 18 months as it is in Sprint 0.

---

## 18. Future Evolution

The AI Development System will evolve as AI capabilities change and as the project discovers new patterns.

### 18.1 Revision Process

All revisions to this document must follow the same process as any other architectural change:

1. A need for revision is identified and documented
2. A Design Revision Pack entry is produced
3. The DRP is reviewed and approved by the Architecture Lead
4. This document is updated in accordance with the approved DRP
5. The version number is incremented
6. The change is committed under the `docs:` commit type

No revision to `AI_DEVELOPMENT_SYSTEM.md` may be made without a corresponding approved DRP entry. This document may not be updated informally.

### 18.2 Expected Evolution Areas

**Tool improvements**: As AI coding assistants improve context retention, the Account Rotation Strategy (Section 13) may simplify. The memory system will remain, but the manual context-loading step may be partially automated.

**Prompt templates**: The Prompt Library (Section 9) will grow into a more structured library as patterns from Sprint 0 are refined through Sprints 1–15.

**Quality automation**: Manual acceptance criteria verification may be augmented with automated test scripts as the test suite grows.

**Multi-agent coordination**: If the project adopts parallel task execution across multiple AI agents, a coordination protocol will be added to this document via DRP.

### 18.3 What Must Not Change Without Architecture Lead Approval

The following are foundational and must not be altered without a DRP:

- The documentation authority hierarchy (Section 10)
- The requirement that implementation follows documentation
- The prohibition on AI executing Git operations without explicit instruction
- The requirement for human approval before any commit
- The requirement for an implementation report after every task
- The Design Revision Pack as the only mechanism for modifying approved documents

### 18.4 AI Capability Evolution

AI capabilities are improving rapidly. Larger context windows, better reasoning, more accurate code generation, and more sophisticated planning will all reduce the operational overhead of managing sessions.

As AI capabilities improve:

- Longer context windows may reduce the frequency of session breaks and memory file lookups
- Better reasoning may reduce the number of escalations needed for ambiguous requirements
- More accurate code generation may reduce review cycles
- Better planning may improve dependency analysis before implementation begins

However, no improvement in AI capability replaces:

| Requirement | Why It Remains |
|-------------|----------------|
| Documentation | Architecture must be explicit, approved, and version-controlled regardless of AI reasoning ability |
| Human approval | Accountability cannot be delegated to an AI agent |
| Architecture governance | Design decisions require human judgment, business context, and responsibility |
| Design Revision Packs | The DRP process ensures changes are traceable, approved, and synchronized across documents |
| Quality gates | Checkpoints exist to protect the project, not to compensate for AI limitations |

Governance evolves more slowly than AI capability. A process that ensures correctness, traceability, and human accountability today will continue to provide value regardless of how capable AI models become. The system may become faster and lighter to operate — but its structure remains.

---

## 19. Final Statement

This document defines the official AI Development System for the Inveetaire project.

It was established during Sprint 0 and validated through the complete implementation of a 12-task framework foundation (INIT-001 through INIT-012), including one conflict resolution, one implicit prerequisite escalation, one Design Revision Pack, and one formal Architecture Review.

Every AI agent contributing to this project — in every session, under any account, at any point in the project timeline — is governed by this document.

This document shall remain in effect until superseded by an approved revision produced through the Design Revision Pack process and explicitly approved by the Architecture Lead.

No implementation session may contradict this document.

No implementation session may claim to be exempt from this document.

The architecture is documented. The rules are defined. The system is active.

**Implement faithfully. Review carefully. Approve deliberately.**

---

*Document produced: 2026-07-01*
*Established: Sprint 0*
*Author: AI Documentation Agent under human governance*
*Status: Active — Version 1.0 (Final)*
*Next revision: Requires Design Revision Pack*
