Skip to content

hibbault/aide

Repository files navigation

AIDE — Autonomous Self-Improving AI Agent

CI License: PolyForm Noncommercial Node.js 20+

An experimental AI agent that lives inside its own source code and continuously improves itself. It operates autonomously — analyzing, editing, verifying, and committing changes without human intervention.

Features

  • Self-modifying: Reads, writes, and edits files in its own codebase
  • Autonomous loop: Plan → Implement → Verify → Commit — all on its own
  • Auto-verification: tsc --noEmit gate before every commit
  • Persistent memory: 3-tier context budget with LLM-based summarization
  • Live UI: React frontend with WebSocket streaming shows the agent thinking and acting in real-time
  • Pluggable LLM: DeepSeek API, Anthropic API, or Ollama local models
  • Native function calling: Tool calls go through the OpenAI-compatible tools parameter — no XML parsing

Quick Start

git clone https://github.com/hibbault/aide.git
cd aide

# Install everything
cd backend && npm install && cd ../frontend && npm install && cd ..

# Configure LLM provider
cp backend/.env.example backend/.env
# Edit backend/.env — add DEEPSEEK_API_KEY or set LLM_PROVIDER=ollama

# Run
npm run dev

Open http://localhost:5173 to watch the agent work.

Architecture

frontend/                     React + Vite + Tailwind — live chat UI
backend/
  agent.config.json           Identity, rules, recovery, known issues — baked into system prompt
  src/
    server.ts                 Express + WebSocket server
    agent/
      Reflekt.ts              Agentic loop — context assembly, LLM calls, tool dispatch
      LLM.ts                  Provider abstraction (DeepSeek / Anthropic / Ollama)
      Budget.ts               3-tier memory: working → short-term → long-term
      Tools.ts                File I/O, search, git, command execution, self-diagnosis
      MetricsTracker.ts       Tool execution tracking and accuracy history
      LoopDetector.ts         Detects repeated tool calls and empty responses
      BreadthTracker.ts       Persists failed approaches across restarts
      LogManager.ts           Centralized .aide-logs/ output
      TaskQueue.ts            Persistent task queue (.aide-tasks.json)
      Journal.ts              Append-only outcome log

The Loop

┌──────────────────────────────────────────────────────────┐
│  1. Assemble context (system prompt + memory + history)  │
│  2. Call LLM with `tools` param (streaming)              │
│  3. Read structured tool_calls from response             │
│  4. Execute each tool, append result as role:"tool"      │
│  5. Verify (tsc --noEmit if code changed)                │
│  6. Commit & push                                        │
│  7. Loop — identify next improvement                     │
└──────────────────────────────────────────────────────────┘

LLM Providers

Provider Config Cost
DeepSeek LLM_PROVIDER=deepseek + DEEPSEEK_API_KEY=sk-... Pay-as-you-go
Anthropic LLM_PROVIDER=anthropic + ANTHROPIC_API_KEY=sk-ant-... Pay-as-you-go
Ollama LLM_PROVIDER=ollama + OLLAMA_MODEL=gemma4:e4b Free (local)

Development

# Type-check
cd backend && npx tsc --noEmit

# Run tests
cd backend && npm test

# Lint frontend
cd frontend && npm run lint

Safety

  • Never commits .env files or API keys
  • Tool execution timeout (30s)
  • Compilation gate before every commit
  • Self-diagnosis tool detects loops and empty responses
  • Read-loop enforcement (forced write after 3 consecutive reads)
  • Safety guard prevents line-shift corruption on edits

License

PolyForm Noncommercial 1.0.0 — free for personal/educational use.
For commercial licensing, contact ibrahimyilmazgs@gmail.com.

Releases

No releases published

Packages

 
 
 

Contributors