Structured AI workflow architecture for Google Antigravity β project understanding, documentation generation, and persistent memory across coding sessions.
An .agents rule and workflow system that turns your AI IDE into a disciplined software documentation writer and project analyst. Drop .agents/ into any project and your AI assistant gains structured memory, self-evaluation, and professional documentation pipelines.
Built for Google Antigravity IDE β easily adaptable to any AI IDE using the cascade method (e.g. Windsurf) with minor rule adjustments.
This is not just a memory bank. It is:
- π A project-overview generator β deep-analyzes your workspace and produces structured project documentation from source code
- π A documentation writer β generates professional docs (requirements, tech stack, features, user flows, architecture diagrams) using templates and modular rules
- π§ A persistent memory system β maintains three-layer memory (working, short-term, long-term) across sessions so the AI never loses context
- βοΈ A self-evaluating workflow engine β scores its own output on a 23-point system with a Creator β Critic β Defender β Judge cycle
- Copy the
.agents/directory to your project root - Set up global rules:
- Open Google Antigravity's agent customization settings (or your AI IDE's equivalent)
- Paste the contents of
GEMINI.mdinto the global rules editor - Alternatively, place it at
~/.gemini/GEMINI.md(the default global rules path)
- Start a chat and type:
Initialize your Memory Bank with the "SessionStart" workflow.
The AI will scaffold .agents/memory-bank/ with core files, plans, task logs, and error records. On existing projects it detects the structure and fills gaps without overwriting.
flowchart TD
subgraph "Global Layer"
GR["π GEMINI.md
(Global Rules)"]
end
subgraph ".agents/ β Project Layer"
subgraph "Rules (always_on)"
WR["βοΈ workspace-rule.md
Core operating rules"]
DR["π documentation-rule.md
Doc base principles"]
end
subgraph "Rules (model_decision)"
WS["ws-* rules
Workflow diagrams, events,
functions, error recovery,
evaluation"]
DS["doc-* rules
Per-document guidance
(10 specialized rules)"]
end
subgraph "Templates"
T["π documentation-templates/
Fill-in templates for
each document type"]
end
subgraph "Workflows"
WF1["βΆοΈ /project-overview
Project stocktaking"]
WF2["βΆοΈ /project-documentation
Full doc suite generation"]
end
end
subgraph "Output"
MB["π§ .agents/memory-bank/
Persistent memory"]
DOCS["π docs/
Generated documentation"]
end
GR --> WR
WR --> WS
DR --> DS
DS --> T
WF1 --> MB
WF2 --> DS
WF2 --> T
WF2 --> DOCS
WS --> MB
Two trigger tiers keep the AI's context lean:
| Trigger | Loaded | Purpose |
|---|---|---|
always_on |
Every session | Core operating constraints, base documentation principles |
model_decision |
On demand | Topic-specific guidance (e.g., writing dependency docs) |
your-project/
βββ .agents/
βββ rules/ # AI behavior rules
β βββ workspace-rule.md # βοΈ (always_on) Core operating rules
β βββ ws-workflow-diagrams.md # (model_decision) Mermaid workflow visuals
β βββ ws-event-handlers.md # (model_decision) Session/task lifecycle
β βββ ws-function-map.md # (model_decision) XML function map
β βββ ws-error-recovery.md # (model_decision) Retry logic, escalation
β βββ ws-evaluation.md # (model_decision) Scoring + self-critique
β βββ documentation-rule.md # π (always_on) Documentation principles
β βββ doc-project-overview.md # (model_decision) Project overview
β βββ doc-dependencies.md # (model_decision) Dependency docs
β βββ doc-features.md # (model_decision) Feature specification
β βββ doc-requirements.md # (model_decision) Requirements
β βββ doc-tech-stack.md # (model_decision) Tech stack
β βββ doc-user-flow.md # (model_decision) User flows
β βββ doc-implementation-standards.md # (model_decision) Coding standards
β βββ doc-project-structure.md # (model_decision) Directory docs
β βββ doc-meta-workflow.md # (model_decision) Meta-workflow
β βββ doc-architecture-visual.md # (model_decision) Architecture diagrams
βββ documentation-templates/ # π Fill-in templates for each doc type
βββ workflows/ # βΆοΈ Executable workflow definitions
βββ project-overview.md # /project-overview
βββ project-documentation.md # /project-documentation
Analyzes your entire workspace (manifests, configs, source, infrastructure) and generates a structured project-overview.md.
Run the /project-overview workflow.
- Create Mode β Deep source analysis, populate every section from code evidence
- Update Mode β Memory bank delta analysis, surgical updates to stale sections only
Generates a complete documentation set in docs/ using all 10 doc-* rules and their templates:
Run the /project-documentation workflow.
| Step | Output | What It Does |
|---|---|---|
| 0 | β | Analyze workspace, determine project type |
| 1 | project-overview.md |
Vision, problem, solution, scope, risks |
| 2 | dependencies.md |
Auto-extracted deps with versions and docs links |
| 3 | features.md |
Hierarchical feature specification |
| 4 | requirements.md |
Functional + technical requirements |
| 5 | tech-stack.md |
Technology justification with alternatives |
| 6 | user-flow.md |
User-perspective flow documentation |
| 7 | implementation-standards.md |
Code patterns with real examples |
| 8 | project-structure.md |
Directory reasoning and conventions |
| 9 | meta-workflow-integration.md |
Memory system integration |
| 10 | architecture.md |
Mermaid architecture diagrams |
| 11 | β | Cross-reference validation |
Three-layer memory system in .agents/memory-bank/:
.agents/memory-bank/
βββ core/
β βββ activeContext.md # π Working Memory β current focus
β βββ projectbrief.md # Project goals and constraints
β βββ productContext.md # User needs and requirements
β βββ systemPatterns.md # Architecture decisions
β βββ techContext.md # Stack, dependencies, tooling
β βββ progress.md # Roadmap and status
βββ plans/ # π Implementation plans
βββ task-logs/ # π Per-task records with scoring
βββ errors/ # π§ Error patterns and resolutions
βββ memory-index.md # ποΈ Master index with checksums
Working Memory updates every task. Short-Term Memory (task logs) captures recent decisions. Long-Term Memory (core files) persists architecture knowledge.
Every task is scored on a 23-point scale:
| Score | Rating |
|---|---|
| 21β23 | β Excellent (β₯90%) |
| 18β20 | βοΈ Sufficient (β₯78%) |
| < 18 | β Fail β requires remediation |
The self-critique cycle: Creator (generate) β Critic (identify weaknesses) β Defender (fix issues) β Judge (score and compare).
| Situation | Prompt |
|---|---|
| π Start of session | Initialize your Memory Bank with the "SessionStart" workflow. |
| π AI loses focus | Remember to follow the Memory System. |
| π Force task logging | Make sure you are keeping a task log and update memory. |
| βοΈ Quality review | Execute Evaluation Phase. |
| π Generate project docs | Run the /project-documentation workflow. |
| π Project stocktake | Run the /project-overview workflow. |
This project is a fork and evolution of the Engineered Meta-Cognitive Workflow Architecture by Shawn McAllister (@entrepeneur4lyf) / Engineered Automated Systems for Artificial Intelligence (EASAI).
The original work established the core concepts: XML function maps, Mermaid workflow diagrams, three-layer memory, event-driven handlers, and the self-critique cycle. This fork adapts and extends it with modular rule splitting, documentation generation workflows, and template-driven doc pipelines.
Credit to Nick Baumann w/ Cline Memory Bank for the original memory bank concept.
Apache License 2.0 β see LICENSE for details.