agents-initializer
One command to give any AI agent instant project understanding. Auto-generates AGENTS.md + context for Claude Code, Codex, Cursor, Copilot, and more.
π English | νκ΅μ΄ | ζ₯ζ¬θͺ | δΈζ | EspaΓ±ol | FranΓ§ais | Deutsch | Π ΡΡΡΠΊΠΈΠΉ | ΰ€Ήΰ€Ώΰ€¨ΰ₯ΰ€¦ΰ₯ | Ψ§ΩΨΉΨ±Ψ¨ΩΨ©
ai-initializer
One command to give any AI agent instant project understanding.
Scans your project β generates AGENTS.md + knowledge/skill/role context
β any AI tool starts working immediately, every session.
Quick Start
Run this inside your project directory:
cd /path/to/your-project
curl -fsSL https://raw.githubusercontent.com/itdar/agents-initializer/main/install.sh | bash
That's it. Select your AI tool, pick a language, and everything is generated automatically.
After setup, launch agent sessions:
./ai-agency.sh
=== AI Agent Sessions ===
Project: /home/user/your-project
Found: 4 agent(s)
1) [PM] your-project (bg: Warm Brown)
2) backend β API Server (bg: Navy)
3) frontend β Web UI (bg: Forest)
4) infra β DevOps (bg: Plum)
Select agent (number, or 'q' to quit): 1
β Agent reads AGENTS.md + loads .ai-agents/context/ automatically
β Ready to work immediately!
Other install methods
# Download only (don't run setup automatically)
curl -fsSL https://raw.githubusercontent.com/itdar/agents-initializer/main/install.sh | bash -s -- --no-run
# Also download ai-agency.sh (agent session launcher)
curl -fsSL https://raw.githubusercontent.com/itdar/agents-initializer/main/install.sh | bash -s -- --with-agency
# Or clone and copy manually
git clone https://github.com/itdar/agents-initializer.git
cp agents-initializer/setup.sh agents-initializer/HOW_TO_AGENTS.md /path/to/your-project/
cd /path/to/your-project
./setup.sh
Token notice: Initial setup analyzes the full project and may consume tens of thousands of tokens. This is a one-time cost β subsequent sessions load pre-built context instantly.
Why Do You Need This?
The Problem: AI Loses Its Memory Every Session
Session 1 Session 2 Session 3
ββββββββββββ ββββββββββββ ββββββββββββ
β AI reads β β AI reads β β Starting β
β entire β Session β entire β Session β from β
β codebase β ends β codebase β ends β scratch β
β (30 min) β βββββββ β (30 min) β βββββββ β again β
β Starts β Memory β Starts β Memory β (30 min) β
β working β lost! β working β lost! β Starts β
β β β β β working β
ββββββββββββ ββββββββββββ ββββββββββββ
AI agents forget everything when a session ends. Every time, they spend time understanding the project structure, analyzing APIs, and learning conventions.
| Problem | Consequence |
|---|---|
| Doesn't know team conventions | Code style inconsistencies |
| Doesn't know the full API map | Explores entire codebase each time (cost +20%) |
| Doesn't know prohibited actions | Risky operations like direct production DB access |
| Doesn't know service dependencies | Missed side effects |
The Solution: Pre-build a "Brain" for the AI
Session Start
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β Reads AGENTS.md (automatic) β
β β β
β βΌ β
β "I am the backend expert for this service" β
β "Conventions: Conventional Commits, TypeScript β
β strict" β
β "Prohibited: modifying other services, β
β hardcoding secrets" β
β β β
β βΌ β
β Loads .ai-agents/context/ files (5 seconds) β
β "20 APIs, 15 entities, 8 events understood" β
β β β
β βΌ β
β Starts working immediately! β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ai-initializer solves this β generate once, and any AI tool understands your project instantly.
Core Principle: 3-Layer Architecture
Your Project
β
ββββββββββββββΌβββββββββββββ
βΌ βΌ βΌ
ββββββββββββ ββββββββββββ ββββββββββββ
β AGENTS.mdβ β.ai-agentsβ β.ai-agentsβ
β β β /context/β β /skills/ β
β Identity β β Knowledgeβ β Behavior β
β "Who β β "What β β "How β
β am I?" β β do I β β do I β
β β β know?" β β work?" β
β + Rules β β β β β
β + Perms β β + Domain β β + Deploy β
β + Paths β β + Models β β + Review β
ββββββββββββ ββββββββββββ ββββββββββββ
Entry Point Memory Store Workflow Standards
1. AGENTS.md β "Who Am I?"
The identity file for the agent deployed in each directory.
project/
βββ AGENTS.md β PM: The leader who coordinates everything
βββ apps/
β βββ api/
β βββ AGENTS.md β API Expert: Responsible for this service only
βββ infra/
β βββ AGENTS.md β SRE: Manages all infrastructure
β βββ monitoring/
β βββ AGENTS.md β Monitoring specialist
βββ configs/
βββ AGENTS.md β Configuration manager
It works just like a team org chart:
- The PM oversees everything and distributes tasks
- Each team member deeply understands only their area
- They don't directly handle other teams' work β they request it
2. .ai-agents/context/ β "What Do I Know?"
A folder where essential knowledge is pre-organized so the AI doesn't have to read the code every time.
.ai-agents/context/
βββ domain-overview.md β "This service handles order management..."
βββ data-model.md β "There are Order, Payment, Delivery entities..."
βββ api-spec.json β "POST /orders, GET /orders/{id}, ..."
βββ event-spec.json β "Publishes the order-created event..."
Analogy: Onboarding documentation for a new employee. Document it once, and no one has to explain it again.
3. .ai-agents/skills/ β "How Do I Work?"
Standardized workflow manuals for repetitive tasks.
.ai-agents/skills/
βββ develop/SKILL.md β "Feature dev: Analyze β Design β Implement β Test β PR"
βββ deploy/SKILL.md β "Deploy: Tag β Request β Verify"
βββ review/SKILL.md β "Review: Security, Performance, Test checklist"
Analogy: The team's operations manual β makes the AI follow rules like "check this checklist before submitting a PR."
What to Write and What Not to Write
ETH Zurich (2026.03): Including inferable content reduces success rates and increases cost by +20%
Write This Don't Write This
βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ
β β β β
β "Use feat: format for β β "Source code is in β
β commits" β β the src/ folder" β
β AI cannot infer this β β AI can see this with lsβ
β β β β
β "No direct push to β β "React is component- β
β main" β β based" β
β Team rule, not in code β β Already in official β
β β β docs β
β "QA team approval β β "This file is 100 β
β required before β β lines long" β
β deploy" β β AI can read it β
β Process, not inferable β β directly β
β β β β
βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ
Write in AGENTS.md Do NOT write!
Exception: "Things that can be inferred but are too expensive to do every time"
e.g.: Full API list (need to read 20 files to figure out)
e.g.: Data model relationships (scattered across 10 files)
e.g.: Inter-service call relationships (need to check both code + infra)
β Pre-organize these in .ai-agents/context/!
β In AGENTS.md, only write the path: "go here to find it"
Include (non-inferable) .ai-agents/context/ (costly inference) Exclude (cheap inference)
βββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββ
Team conventions Full API map Directory structure
Prohibited actions Data model relationships Single file contents
PR/commit formats Event pub/sub specs Official framework docs
Hidden dependencies Infrastructure topology Import relationships
KPI targets & business metrics
Stakeholder map & approval flows
Ops runbooks & escalation paths
Roadmap & milestone tracking
How It Works
Step 1: Project Scan & Classification
Explores directories up to depth 3 and auto-classifies by file patterns.
deployment.yaml + service.yaml β k8s-workload
values.yaml (Helm) β infra-component
package.json + *.tsx β frontend
go.mod β backend-go
Dockerfile + CI config β cicd
...19 types auto-detected
Step 2: Context Generation
Generates .ai-agents/context/ knowledge files by actually analyzing the code based on detected types.
Backend service detected
β Scan routes/controllers β Generate api-spec.json
β Scan entities/schemas β Generate data-model.md
β Scan Kafka config β Generate event-spec.json
Step 3: AGENTS.md Generation
Generates AGENTS.md for each directory using appropriate templates.
Root AGENTS.md (Global Conventions)
β Commits: Conventional Commits
β PR: Template required, 1+ approvals
β Branches: feature/{ticket}-{desc}
β
βΌ Auto-inherited (not repeated in children)
apps/api/AGENTS.md
β Overrides only: "This service uses Python"
Global rules use an inheritance pattern β write in one place, and it automatically applies downstream.
Root AGENTS.md ββββββββββββββββββββββββββββββββββββββββββ
β Global Conventions:
β - Commits: Conventional Commits (feat:, fix:, chore:)
β - PR: Template required, at least 1 reviewer
β - Branch: feature/{ticket}-{desc}
β
β Auto-inherited Auto-inherited
β ββββββββββββββββββββ ββββββββββββββββββββ
β βΌ β βΌ β
β apps/api/AGENTS.md β infra/AGENTS.md β
β (Only additional β (Only additional β
β rules specified) β rules specified) β
β "This service uses β "When changing Helm β
β Python" β values, Ask First" β
ββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββ
Benefits:
- Want to change commit rules? β Modify only the root
- Adding a new service? β Global rules apply automatically
- Need different rules for a specific service? β Override in that service's AGENTS.md
Step 4: Vendor-Specific Bootstrap
Adds bridges to vendor-specific configs so all AI tools read the generated AGENTS.md.
ββββββββββββββββ βββββββββββββββ βββββββββββββββ
β Claude Code β β Cursor β β Codex β
β CLAUDE.md β β .mdc rules β β AGENTS.md β
β β β β β β β (native) β
β "read β β "read β β β β
β AGENTS.md" β β AGENTS.md" β β β
ββββββββ¬ββββββββ ββββββββ¬βββββββ βββββββββββββββ
ββββββββββββ¬ββββββββββ
βΌ
AGENTS.md (single source of truth)
β
βββββββββββΌββββββββββ
βΌ βΌ βΌ
.ai-agents/ .ai-agents/ .ai-agents/
context/ skills/ roles/
Principle: Bootstrap files are only generated for vendors already in use. Config files for unused tools are never created.
Vendor Compatibility
| Tool | Auto-reads AGENTS.md | Bootstrap |
|---|---|---|
| OpenAI Codex | Yes (native) | Not needed |
| Claude Code | Partial (fallback) | Adds directive to CLAUDE.md |
| Cursor | No | Adds .mdc to .cursor/rules/ |
| GitHub Copilot | No | Generates .github/copilot-instructions.md |
| Windsurf | No | Adds directive to .windsurfrules |
| Aider | Yes | Adds read to .aider.conf.yml |
Auto-generate bootstraps:
bash scripts/sync-ai-rules.sh
Generated Structure
project-root/
βββ AGENTS.md # PM Agent (overall orchestration)
βββ .ai-agents/
β βββ context/ # Knowledge files (loaded at session start)
β β βββ domain-overview.md # Business domain, policies, constraints
β β βββ data-model.md # Entity definitions, relationships, state transitions
β β βββ api-spec.json # API map (JSON DSL, 3x token savings)
β β βββ event-spec.json # Kafka/MQ event specs
β β βββ infra-spec.md # Helm charts, networking, deployment order
β β βββ external-integration.md # External APIs, auth, rate limits
β β βββ business-metrics.md # KPIs, OKRs, revenue model, success criteria
β β βββ stakeholder-map.md # Decision makers, approval flows, RACI
β β βββ ops-runbook.md # Operational procedures, escalation, SLA
β β βββ planning-roadmap.md # Milestones, dependencies, timeline
β βββ skills/ # Behavioral workflows (loaded on demand)
β β βββ develop/SKILL.md # Dev: analyze β design β implement β test β PR
β β βββ deploy/SKILL.md # Deploy: tag β deploy request β verify
β β βββ review/SKILL.md # Review: checklist-based
β β βββ hotfix/SKILL.md # Emergency fix workflow
β β βββ context-update/SKILL.md # Context file update procedure
β βββ roles/ # Role definitions (role-specific context depth)
β βββ pm.md # Project Manager
β βββ backend.md # Backend Developer
β βββ frontend.md # Frontend Developer
β βββ sre.md # SRE / Infrastructure
β βββ reviewer.md # Code Reviewer
β
βββ apps/
β βββ api/AGENTS.md # Per-service agents
β βββ web/AGENTS.md
βββ infra/
βββ helm/AGENTS.md
Session Launcher
./ai-agency.sh # Interactive: select agent + tool
./ai-agency.sh --tool claude # Direct launch with Claude
./ai-agency.sh --agent api # Select agent by keyword
./ai-agency.sh --multi # Parallel agents in tmux
./ai-agency.sh --list # List all available agents
See the Sample Output in Quick Start for a full walkthrough.
Token Optimization
| Format | Token Count | Notes |
|---|---|---|
| Natural language API description | ~200 tokens | |
| JSON DSL | ~70 tokens | 3x savings |
api-spec.json example:
{
"service": "order-api",
"apis": [{
"method": "POST",
"path": "/api/v1/orders",
"domains": ["Order", "Payment"],
"sideEffects": ["kafka:order-created", "db:orders.insert"]
}]
}
AGENTS.md target: Under 300 tokens after substitution
Session Restore Protocol
Session start:
1. Read AGENTS.md (most AI tools do this automatically)
2. Follow context file paths to load .ai-agents/context/
3. Check .ai-agents/context/current-work.md (in-progress work)
4. git log --oneline -10 (understand recent changes)
Session end:
1. In-progress work β Record in current-work.md
2. Newly learned domain knowledge β Update context files
3. Incomplete TODOs β Record explicitly
Context Maintenance
When code changes, .ai-agents/context/ files must be updated accordingly.
API added/changed/removed β Update api-spec.json
DB schema changed β Update data-model.md
Event spec changed β Update event-spec.json
Business policy changed β Update domain-overview.md
External integration changed β Update external-integration.md
Infrastructure config changed β Update infra-spec.md
KPI/OKR targets changed β Update business-metrics.md
Team structure changed β Update stakeholder-map.md
Operational procedure changed β Update ops-runbook.md
Milestone/roadmap changed β Update planning-roadmap.md
Failing to update means the next session will work with stale context.
Overall Flow Summary
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 1. Initial Setup (one-time) β
β β
β Run ./setup.sh (or manually have the AI read HOW_TO_AGENTS.md) β
β β β
β βΌ β
β AI analyzes the project structure β
β β β
β βΌ β
β Creates AGENTS.md in each Organizes knowledge in β
β directory .ai-agents/context/ β
β (agent identity + rules (API, model, event specs) β
β + permissions) β
β β
β Defines workflows in Defines roles in β
β .ai-agents/skills/ .ai-agents/roles/ β
β (development, deploy, review (Backend, Frontend, SRE) β
β procedures) β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 2. Daily Use β
β β
β Run ./ai-agency.sh β
β β β
β βΌ β
β Select agent (PM? Backend? SRE?) β
β β β
β βΌ β
β Select AI tool (Claude? Codex? Cursor?) β
β β β
β βΌ β
β Session starts β AGENTS.md auto-loaded β .ai-agents/context/ β
β loaded β Work! β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 3. Ongoing Maintenance β
β β
β When code changes: β
β - AI automatically updates .ai-agents/context/ β
β - Or a human instructs "This is important, record it" β
β β
β When adding a new service: β
β - Run HOW_TO_AGENTS.md again β New AGENTS.md auto-generated β
β - Global rules automatically inherited β
β β
β When the AI makes mistakes: β
β - "Re-analyze this" β Provide hints β Once it understands, β
β update .ai-agents/context/ β
β - This feedback loop improves context quality β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Analogy: Traditional Team vs AI Agent Team
Traditional Dev Team AI Agent Team
ββββββββββββββββββββ ββββββββββββββββββ
Leader PM (human) Root AGENTS.md (PM agent)
Members N developers AGENTS.md in each directory
Onboarding Confluence/Notion .ai-agents/context/
Manuals Team wiki .ai-agents/skills/
Role Defs Job titles/R&R docs .ai-agents/roles/
Team Rules Team convention docs Global Conventions (inherited)
Clock In Arrive at office Session starts β AGENTS.md loaded
Clock Out Leave (memory retained) Session ends (memory lost!)
Next Day Memory intact .ai-agents/context/ loaded (memory restored)
Key difference: Humans retain their memory after leaving work, but AI forgets everything each time.
That's why .ai-agents/context/ exists β it serves as the AI's long-term memory.
Adoption Checklist
Phase 1 (Basics) Phase 2 (Context) Phase 3 (Operations)
ββββββββββββββββ βββββββββββββββββ ββββββββββββββββββββ
β Generate AGENTS.md β Create .ai-agents/context/ β Define .ai-agents/roles/
β Record build/test commands β domain-overview.md β Run multi-agent sessions
β Record conventions & rules β api-spec.json (DSL) β .ai-agents/skills/ workflows
β Global Conventions β data-model.md β Iterative feedback loop
β Vendor bootstraps β Set up maintenance rules
Deliverables
| File | Audience | Purpose |
|---|---|---|
setup.sh |
Human | One-command interactive setup (tool + language β auto-generate) |
HOW_TO_AGENTS.md |
AI | Meta-instruction manual that agents read and execute |
README.md |
Human | This document β a guide for human understanding |
ai-agency.sh |
Human | Agent selection β AI session launcher |
AGENTS.md (each directory) |
AI | Per-directory agent identity + rules |
.ai-agents/context/*.md/json |
AI | Pre-organized domain knowledge |
.ai-agents/skills/*/SKILL.md |
AI | Standardized work workflows |
.ai-agents/roles/*.md |
AI/Human | Per-role context loading strategies |
References
- Kurly OMS Team AI Workflow β Inspiration for the context design of this system
- AGENTS.md Standard β Vendor-neutral agent instruction standard
- ETH Zurich Research β "Only document what cannot be inferred"
License
MIT
Reduce the time it takes for AI agents to understand your project to zero.
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found