> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lostmindai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# LostMind AI - ContextKeeper - Architecture

> architecture documentation for LostMind AI - ContextKeeper

# Architecture Overview

## System Overview

ContextKeeper anchors project memory behind a Sacred Layer that locks approved architectural plans while a RAG agent serves contextual answers to developers and AI assistants. The system is designed to keep day-to-day coding aligned with strategic intent.

## Core Services

* **Sacred Layer Service** — Immutable plan registry with dual-factor approval
* **RAG Agent** — Clusters repository knowledge in ChromaDB and answers natural-language queries
* **Git Activity Tracker** — Watches commits to detect drift from the Sacred Layer
* **CLI & MCP Tools** — Shell tooling and Claude Code MCP endpoints for interactive access

## Data Storage

* **ChromaDB** stores per-project embeddings plus the Sacred Layer corpus
* **Project State Files** persist objectives, decisions, and alignment metrics
* **Environment Variables** (SACRED\_APPROVAL\_KEY, API tokens) gate access to write paths

## Integration Points

* **Google Cloud GenAI** supplies embeddings and responses when cloud inference is permitted
* **Local Security Mode** falls back to on-device models for sensitive repositories
* **Claude Code MCP** exposes Sacred-aware tooling directly inside the IDE

## Security Model

* Immutable plan hashes plus the Sacred Approval Key prevent unreviewed changes
* Drift detection flags commits that contradict Sacred Layer directives
* All secrets stay local; network calls are limited to configured AI providers

*Architecture distilled from the upstream ContextKeeper repository and Sacred Layer specs.*
