SPDX-License-Identifier: CC-BY-SA-4.0
AI agents (Claude, Gemini, OpenAI, etc.) lose context when:
- Sessions crash or timeout
- Users switch between different AI platforms
- Long time passes between work sessions
- Context windows get compacted
This leads to:
- Repeated explanations - "For the 10th time, SCM files go in .machine_readable/"
- Duplicate files - Agent creates STATE.scm in root despite it existing in .machine_readable/
- Invariant violations - Agent doesn't know about project-specific rules
- Wasted resources - Time, computational credits, user frustration
Different AI platforms have different:
- Context management strategies
- File access patterns
- Memory/continuation capabilities
- Integration points
A user working with:
- Claude on Monday
- Gemini on Tuesday
- GitHub Copilot on Wednesday
Results in each agent making the SAME mistakes the others did.
Without a gatekeeper:
- Agents create files wherever they think is best
- "Helpful" refactoring violates design decisions
- Stale duplicates proliferate
- No way to enforce invariants mechanically
Every repo has ONE manifest file (AI.a2ml or 0-AI-MANIFEST.a2ml) that:
- ✅ Declares canonical file locations
- ✅ States critical invariants
- ✅ Explains repository structure
- ✅ Provides session startup checklist
The manifest is:
- Plain text - Any AI can read it
- Structured - Consistent format across repos
- Self-documenting - Explains itself
- Universal - Not tied to Claude, Gemini, or any specific platform
For platforms that support it:
- MCP server - Hard enforcement for Claude and MCP-compatible agents
- FUSE wrapper - OS-level enforcement for ANY tool
- CI/CD validation - GitHub Actions catch violations
- Bot fleet integration - Automated bots respect protocol
Instead of hoping agents read documentation:
- Agent MUST read manifest
- Agent MUST compute hash of manifest content
- Agent MUST provide hash to prove they read it
- Only then granted access to files
This proves:
- ✅ Agent actually read the manifest (not skimmed)
- ✅ Agent has correct version (hash changes if updated)
- ✅ Session state is trackable
Session 1 (Claude):
User: "Check the project state"
Claude: *creates STATE.scm in root*
User: "No! SCM files go in .machine_readable/"
Claude: "Sorry, let me fix that" *moves file*
Session 2 (Gemini, next day):
User: "Check the project state"
Gemini: *creates STATE.scm in root*
User: "NO! AGAIN?! How many times do I have to say this?!"
Gemini: "Apologies, let me move it"
Session 3 (Claude, after crash):
User: "What's the current state?"
Claude: *finds TWO STATE.scm files - root (stale) and .machine_readable/ (current)*
Claude: "There seem to be inconsistencies..."
User: *loses mind*
Session 1 (Claude with MCP):
Claude: *attempts to read file*
MCP Guardian: "⚠️ ACCESS DENIED - Must acknowledge manifest first"
Claude: *reads 0-AI-MANIFEST.a2ml*
Claude: *calls acknowledge_manifest with hash*
MCP Guardian: "✅ Session granted - SCM files in .machine_readable/ only"
Claude: *reads .machine_readable/STATE.scm correctly*
Session 2 (Gemini, next day):
Gemini: *reads 0-AI-MANIFEST.a2ml (first file alphabetically)*
Gemini: "I see. SCM files must be in .machine_readable/ directory only."
User: "Yes! Thank you for reading that!"
Gemini: *works correctly*
Session 3 (Claude, after crash):
Claude: *reads 0-AI-MANIFEST.a2ml*
Claude: "SCM files located in .machine_readable/, checking STATE.scm there"
User: "Perfect, exactly right"
- ✅ No repeated explanations across sessions
- ✅ No repeated explanations across AI platforms
- ✅ Architectural decisions preserved mechanically
- ✅ Confidence that agents won't break things
- ✅ Less frustration, more productivity
- ✅ Clear, unambiguous instructions on repository structure
- ✅ Context preserved across sessions
- ✅ Reduced chance of making mistakes
- ✅ Better collaboration across different AI platforms
- ✅ Attestation proves understanding
- ✅ Standardized approach to AI-repository interaction
- ✅ Interoperability across platforms
- ✅ Foundation for advanced tooling (MCP servers, FUSE wrappers)
- ✅ Scalable to thousands of repositories
- ✅ Open source - anyone can adopt
If an agent doesn't read the manifest:
- MCP server blocks access (hard fail)
- CI/CD catches violations (post-commit)
- Alphabetical naming ensures visibility (0-AI-MANIFEST.a2ml sorts first)
Multiple enforcement layers:
- Prevention - MCP server blocks before mistake
- Detection - CI/CD catches violations
- Correction - Bot fleet fixes automatically
- Documentation - Clear error messages guide agents
Works with:
- ✅ Claude (via MCP)
- ✅ Gemini (via manifest reading)
- ✅ OpenAI (via manifest reading)
- ✅ GitHub Copilot (via CI/CD validation)
- ✅ Any future AI platform
Manifests are plain text, not:
- Binary formats
- Encrypted data
- Platform-specific encodings
- Obscure schemas
Anyone (human or AI) can read and understand.
Can be adopted gradually:
- Start with manifest files (no enforcement)
- Add CI/CD validation (post-commit detection)
- Deploy MCP server (pre-operation blocking)
- Add FUSE wrapper (universal enforcement)
Current state for most users:
- Rely on AI reading previous context
- Repeat instructions each session
- Accept that mistakes will happen
Problems:
- Doesn't scale across platforms
- Frustrating for users
- Wastes resources
Example: Claude-only .claude/CLAUDE.md file
Problems:
- Doesn't help Gemini, OpenAI, etc.
- Fragmented approaches
- User maintains multiple instruction sets
Example: README.md with instructions
Problems:
- Agents often don't read README first
- Not enforced mechanically
- No attestation proving understanding
- Gets buried in large repos
- ✅ Universal (works across platforms)
- ✅ Enforced (MCP/FUSE blocking)
- ✅ Attested (hash proves reading)
- ✅ Visible (0-prefix sorts first)
- ✅ Standardized (consistent format)
The protocol is successful if:
- Reduction in duplicate files - Metrics show fewer SCM files in wrong locations
- Reduced user frustration - Less time spent re-explaining
- Cross-platform consistency - Same behavior from Claude, Gemini, etc.
- Adoption - Other projects/users adopt the protocol
- Bot integration - Automated tools respect manifest invariants
Create RFC-style spec (AI-MANIFEST-SPEC.adoc) defining:
- Required sections
- Syntax rules
- Media type
- Validation schema
- Manifest generators
- Validation tools
- Migration helpers
- IDE plugins
Work with:
- Anthropic (Claude) - Native MCP support
- Google (Gemini) - Propose integration
- OpenAI - API wrapper support
- GitHub (Copilot) - Native support
- Submit to standardization bodies
- Create open governance
- Gather feedback from users
- Iterate on format
The AI Gatekeeper Protocol solves a real problem:
- ✅ Context loss across sessions and platforms
- ✅ Repeated mistakes by different AI agents
- ✅ Architectural drift and invariant violations
- ✅ User frustration and wasted resources
Through a combination of:
- 📄 Universal manifest files
- 🔒 Mechanical enforcement
- ✅ Attestation proving understanding
- 🌍 Platform-agnostic design
The result: Users work with AI agents that respect their architecture, preserve their decisions, and don't repeat the same mistakes session after session.
Related Documents:
- ARCHITECTURE.md - Technical implementation
- INTEGRATION.md - Platform-specific integration
- AI-MANIFEST-SPEC.adoc - Formal specification