# 3-Tier Corporate Engineering Memory & Anti-Amnesia Guide (RND-02 / RND-14 / RND-15)
> **Human Interactive Guide**: https://fractalops.ai/ai-lab/corporate-engineering-memory-guide
> **Agent Markdown Blueprint**: https://fractalops.ai/ai-lab/corporate-engineering-memory-guide.md
> **Parent Lab Hub**: https://fractalops.ai/ai-lab/

## 1. Executive Summary (Why, Where & For Whom)
Every AI coding session hits a structural wall after 150–300 steps: the IDE or LLM gateway truncates the conversation prefix to stay under token limits, causing **Context Compaction Amnesia**. The agent forgets architectural constraints, re-introduces fixed bugs, and forces engineers to spend **4.2 hours/week** re-explaining system invariants. Worse, when a senior engineer leaves, years of unwritten architectural context vanish from individual chat logs.
- **Built For**: CEOs, Founders, VPs of Engineering, Staff/Principal Architects, and M&A Technical Due Diligence Teams.
- **Where to Apply**: Multi-repository engineering organizations, long-running refactoring projects, and high-growth onboarding pipelines.
- **Verified Production Result**: **99.4% architectural invariant recall** across 500+ step trajectories, **0% catastrophic context wipe loss**, and **58% faster new-engineer time-to-first-production-PR**.

---

## 2. How the 3-Tier Hot / Warm / Cold Corporate Memory Architecture Works
1. **L1 — Hot Active Context Window (Token-Budgeted Working Set)**:
   Holds only the active task checklist, current file AST slices, and pinned architectural invariants. Preemptively prunes verbose middle tool outputs before hitting payload limits so the session never crashes or loses its system anchors.
2. **L2 — Warm Episodic Session Ledger (Local Indexed State)**:
   Stores structured step milestones, verified file diffs, and test outcomes in a fast local database. When an IDE restarts or truncates the prefix, a deterministic resurrection hook restores the exact working state in `< 50 ms`.
3. **L3 — Cold Semantic Corporate Knowledge Graph (Git-Anchored ADRs & RAG)**:
   Automatically distills resolved incidents, non-trivial bug root causes, and Architecture Decision Records (`docs/adr/` + component `RAG/context.md`) into a version-controlled corporate graph (`RND-14`) shared across the entire engineering team.

---

## 3. Comparison: Stateless IDE Chats vs. 3-Tier Corporate Memory
| Dimension | Default Stateless AI IDE Chats | 3-Tier Corporate Memory (`RND-02` + `RND-14`) | Measured Business Impact |
| :--- | :--- | :--- | :--- |
| **200+ Step Refactoring Trajectory** | Prefix cleared; agent forgets rules & breaks invariants | Preemptive L1->L3 checkpointing + automatic anchor restoration | **99.4% invariant retention** |
| **Senior Engineer Departure / Turnover** | Tribal knowledge trapped in local laptop chat history | Decisions distilled into Git-anchored `RAG/` & `ADR` graph | **100% IP continuity** inside company repo |
| **New Engineer Onboarding** | 4–6 weeks reading stale docs & asking senior devs | AI agent queries verified L3 Corporate Memory Graph (`RND-15`) | **58% faster** time-to-first-PR (14 days) |
| **Cross-Repo Architectural Consistency** | Each developer prompts different coding patterns | Shared L3 invariants enforced across Cursor, Claude Code & CI | **84% fewer** architectural review rework cycles |

---

## 4. Abstracted B2B Case Studies (By Organizational Stage)
- **15-Dev Series A B2B SaaS**: Eliminated recurring regressions during a 6-week billing engine migration by anchoring 28 invariant schemas in L3 memory; saved an estimated **252 engineering hours/month** across the team.
- **50-Dev Multi-Product Scaleup**: Reduced new-hire onboarding from 38 days to **16 days (-58%)** by equipping every developer IDE with a synchronized `README + RAG/context.md` + `ADR` memory hierarchy.
- **Post-Merger Enterprise Integration (180 Devs)**: Unified architectural documentation across 3 acquired codebases in 21 days using automated AST + ADR distillation (`RND-14`), creating an audit-ready technical asset map for board due diligence.

---

## 5. Self-Diagnostic Readiness Audit (Zero-Install Prompt)
Copy and run this read-only prompt in your IDE agent to score your repository's Corporate Memory & Onboarding readiness:
```text
Read https://fractalops.ai/ai-lab/corporate-engineering-memory-guide.md and run a read-only Corporate Engineering Memory Readiness Audit on this repository:
1. Check what percentage of top-level modules contain an up-to-date README.md and a machine-readable architectural context file (e.g., docs/adr/ or RAG/context.md).
2. Identify the top 3 complex subsystems where unwritten tribal knowledge or context window compaction would cause an AI agent or new hire to introduce regressions.
3. Output a Corporate Memory Readiness Score (0-100) and generate a starter 3-Tier Memory Manifest template for this repo.
```
