Skip to content

Latest commit

Β 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Autonomous AI Agent Context & Memory Framework

AI Agent LLM Memory Context Management Token Optimization AI Assisted Coding Agentic Workflow Prompt Engineering LLM Framework Multi Model AI Memory Developer Tools AI Coding Cursor Rules GitHub Copilot Aider Automated Testing Living Documentation Project Template Boilerplate Developer Experience

English | ζ—₯本θͺž

A token-optimized, multi-model template repository for AI-assisted software development.
Stop burning API credits, losing track of codebases mid-session, or spending hours writing manual test data.


🌟 Key Features

  • 🧠 Dual-Memory Architecture (Minified JSON Caching):
    • Short-Term Session Cache (memory-shortterm.md): Tracks immediate tasks and uncommitted changes during the workday. Flushed daily to prevent input token bloat.
    • Long-Term Epoch Cache (memory-longterm.md): Immutable, compressed history of macro-architecture and completed milestones.
  • ⏱️ Dynamic Autonomy Throttling:
    • Toggle seamlessly between Pair-Programming Mode (strict pauses after 50 lines / major components) and Overnight Autonomous Mode (uninterrupted multi-file execution).
  • πŸ” Multi-Model Identity & Red-Team Auditing:
    • Track which specific LLM model executed which session in the memory logs.
    • Optional Red-Team Audit workflow using a secondary model (e.g., OpenAI o1 reviewing Claude 3.5 Sonnet) before commits.
  • πŸ§ͺ Mandatory "Triad" Verification:
    • Forces the AI to generate automated unit/integration tests with Happy Path, Edge Case, and Failure Path dummy data alongside source code. Banning raw console.log() verification.
  • πŸ“š Living ReadTheDocs Sync (/docs):
    • Keeps human-readable documentation (/docs/architecture.md, /docs/api.md, /docs/setup.md) continuously updated without cluttering the AI's core operating context.
  • πŸ”Œ Native IDE Bindings:
    • Native configuration support for Cursor (.cursor/rules/), GitHub Copilot (.github/copilot-instructions.md), and VSCode (.vscode/tasks.json).

πŸ“‚ Repository Structure

my-ai-project/
β”œβ”€β”€ .agent/
β”‚   β”œβ”€β”€ templates/                      # Raw, unpopulated templates (Immutable)
β”‚   β”‚   β”œβ”€β”€ agent.template.md           # Master operating system & execution rules
β”‚   β”‚   β”œβ”€β”€ tech-stack.template.md      # Technical constraints & banned patterns
β”‚   β”‚   β”œβ”€β”€ testing-protocol.template.md# Framework rules & Triad dummy data policy
β”‚   β”‚   β”œβ”€β”€ reviewer.template.md        # Red-Team security & quality audit checklist
β”‚   β”‚   β”œβ”€β”€ docs-protocol.template.md   # ReadTheDocs living documentation rules
β”‚   β”‚   β”œβ”€β”€ memory-longterm.template.md # Global Epoch Cache (Minified JSON history)
β”‚   β”‚   └── memory-shortterm.template.md# Ephemeral Session Cache (Minified JSON state)
β”‚   β”‚
β”‚   β”œβ”€β”€ active/                         # Active runtime context files (Populated via setup.md)
β”‚   β”‚   β”œβ”€β”€ agent.md                    # Active master prompt read at session start
β”‚   β”‚   β”œβ”€β”€ tech-stack.md               # Active project stack directives
β”‚   β”‚   β”œβ”€β”€ testing-protocol.md         # Active testing rules & framework choice
β”‚   β”‚   β”œβ”€β”€ reviewer.md                 # Active audit template
β”‚   β”‚   β”œβ”€β”€ docs-protocol.md            # Active living docs configuration
β”‚   β”‚   β”œβ”€β”€ memory-longterm.md          # Permanent project milestones
β”‚   β”‚   └── memory-shortterm.md         # Ephemeral workday working memory
β”‚   β”‚
β”‚   └── setup.md                        # The 9-question interactive interview script
β”‚
β”œβ”€β”€ .github/                            # (Optional) Copilot instructions
β”‚   └── copilot-instructions.md
β”œβ”€β”€ .vscode/                            # (Optional) VSCode / Cursor settings & tasks
β”‚   β”œβ”€β”€ settings.json
β”‚   └── tasks.json
β”œβ”€β”€ docs/                               # Living human-readable documentation
β”‚   β”œβ”€β”€ architecture.md
β”‚   β”œβ”€β”€ api.md
β”‚   └── setup.md
β”œβ”€β”€ init.sh                             # Non-destructive initial bootstrapper
└── README.md                           # Project documentation (You are here)

πŸš€ Quickstart Guide

1. Initialize the Workspace

Clone or use this repository as a GitHub Template. Run the initialization script in your terminal to safely prepare the .agent/active/ directory:

chmod +x init.sh
./init.sh

2. Run the Interactive AI Setup

Open your AI coding assistant (Cursor, Claude Dev, ChatGPT, Aider, GitHub Copilot, etc.) and paste the following prompt:

"Please read .agent/setup.md and conduct the 9-question setup interview with me."

Answer the questions regarding:

  1. Project Vision & Scope
  2. Tech Stack & Framework choices
  3. Banned Patterns (Anti-patterns to avoid)
  4. Testing Framework & placement
  5. Directory Boundaries
  6. Model Toolchain & Red-Team Audit preferences
  7. Autonomy Throttle (50-line pairing vs. Overnight mode)
  8. IDE Integrations (Cursor / Copilot / VSCode)
  9. Living Documentation (ReadTheDocs in /docs)

The AI will automatically generate your customized context files inside .agent/active/.


πŸ”„ Daily Workflow & Session Lifecycle

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     1. SESSION START                    β”‚
β”‚  AI reads memory-longterm.md + memory-shortterm.md +    β”‚
β”‚  agent.md β†’ Confirms current objective with human.      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    2. EXECUTION PHASE                   β”‚
β”‚  AI generates code complying with tech-stack.md.        β”‚
β”‚  Simultaneously generates tests (Triad Dummy Data).     β”‚
β”‚  Respects autonomy throttle (Pairing vs Overnight).     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 3. AUDIT PHASE (OPTIONAL)               β”‚
β”‚  Secondary model loads reviewer.md β†’ Audits logic &     β”‚
β”‚  security vulnerabilities β†’ Outputs <AUDIT_REPORT>.     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    4. SESSION SHUTDOWN                  β”‚
β”‚  AI flushes short-term state to memory-shortterm.md.    β”‚
β”‚  Compresses milestones into memory-longterm.md.         β”‚
β”‚  Updates human-readable docs in /docs/ (if enabled).    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Core Concepts

The "Amnesia Rule" & Dual Token Caches

Large language models suffer from context loss and rising credit costs as conversations grow.

  • To solve this, every new coding session starts fresh with the Amnesia Rule.
  • The AI reloads its context strictly from .agent/active/memory-longterm.md (high-level JSON architecture state) and .agent/active/memory-shortterm.md (active JSON task state).
  • No long conversational histories are re-read, reducing input token overhead by up to 80%.

The Triad Testing Protocol

Manual line-by-line debugging and terminal console.log() statements waste time. The AI is required to prove its code works by outputting tests containing three distinct dummy data profiles:

  1. Happy Path: Expected input formats.
  2. Edge Cases: Empty sets, nulls, boundaries, extremely long strings.
  3. Failure Path: Invalid types and unauthorized access designed to hit error handlers.

Model Identity & Accountability

When switching between models mid-project (e.g., using Claude 3.5 Sonnet for architecture, Llama-3 locally via Ollama to save credits, or GPT-4o for code review), the AI logs its exact model version in .agent/active/memory-shortterm.md. If bugs or structural drifts occur, you can audit which model introduced them.


πŸ“„ License

This framework template is open-source under the MIT License. Feel free to adapt and customize the directives in .agent/templates/ for your specific team workflow.

About

Markdown templates generator for agentic-assisted coding

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages