Architecture-As-Memory LogoARCHITECTURE-AS-MEMORY
v1.0.4

AI Assistant Orchestration & Reinforcement

AAM protects repositories against architectural erosion by implementing a multi-layered cognition reinforcement pipeline. Rather than force-feeding an LLM the entire codebase, AAM structures developer intent across four modular layers.

The 4 Cognitive Reinforcement Layers

Layer 1: Persistent Target Detection (Idempotent Anchors)

During AAM initialization (aam init), the scaffolder scans the root workspace up to a depth of 3 for active AI provider instructions. It safely appends a non-invasive, lightweight cognition marker referencing AAM into: CLAUDE.md, .gemini/GEMINI.md, .cursorrules, .github/copilot-instructions.md, and AGENT.md (as well as detecting .claude/, .cursor/, and .gemini/ directories).

markdown
<!-- AAM REINFORCEMENT START -->
## Architecture-As-Memory (AAM) Cognition Anchor
This repository uses AAM to persist architectural intent and prevent cognitive drift.
- Read /architecture/agents/aam-skill.md to align with active system topology.
- Maintain stable IDs (FNV-1a) and avoid global graph regeneration.
- Run `aam validate` / `aam doctor` after making changes to verify ontology.
- Already-running AI session? Reload cognition by manually reading the AAM skill file.
<!-- AAM REINFORCEMENT END -->

Layer 2: Slash Command Context Protocol (On-Demand Hydration)

To keep context windows lightweight and cost-efficient, AAM supports selective context hydration. When prompting your assistant, use the slash command trigger followed by the target capability:

bash
/aam FEAT-AUTHENTICATION Add password reset support via SMTP.

This immediately injects only the related YAML files (domains, features, and components) matching that specific capability, bypassing irrelevant code files and preventing cognitive overload.

Layer 3: Local-First Non-Destructive Hooks (Verify on Tasks)

AAM registers Git post-commit hooks and post-task instruction hooks. For instance, running aam hooks install claude registers a post-task verification hook. Before any changes are committed or after an AI task completes, the engine runs aam validate and aam doctor in the background, rendering a clear visual warning report to the developer if a mutation breaks architectural boundaries.

Layer 4: CLI Success Reinforcement Alert (Live Session Recovery)

Already running an active AI chat session when installing AAM? To reactivate architectural context instantly, the CLI outputs a concise 2-line recovery nudge encouraging the engineer to ask the running agent to read /architecture/agents/aam-skill.md manually. This forces the active LLM context window to instantly align with AAM schemas.

Injecting Reinforcement Manually

You can manually inject the AAM cognition anchors at any time for specific platforms:

bash
# Reinforce AAM rules for Claude Code and Claude Desktop
npx @architecture-as-memory/aam reinforce claude

# Reinforce rules for Gemini Workspace
npx @architecture-as-memory/aam reinforce gemini