Skip to content

DanielDeshmukh/autobots

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

242 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Version Python PyPI License

Autobots is a hierarchical multi-cluster coding swarm CLI that orchestrates multiple AI models to plan, implement, validate, and repair code against target repositories. It features a full tool system (Read, Write, Edit, Glob, Grep), interactive REPL mode, granular permissions, context management, hooks, MCP integration, and code review — all built on NVIDIA NIM models.


Table of Contents


Features

Core Swarm

  • Hierarchical Model Routing — 9 specialized clusters (Optimus, UltraMagnus, Jazz, RedAlert, Ratchet, Perceptor, Bumblebee, Ironhide, Wheeljack)
  • Phase-Based Execution — Inspect → Implement → Validate → Repair pipeline
  • Context Injection — Reads context/ files and injects project documentation into model prompts
  • Model Routing — Intelligent cluster selection based on task keywords and file extensions
  • Automatic Repair — Self-healing execution with validation-driven repair loops
  • Rollback Support — Snapshots before writes, autobots undo reverts changes
  • Response Streaming — Live character counter during model calls
  • Rich Status Output — Progress bars, estimated time, branch info via Rich

File Operations & Search

  • ReadTool — Read files with offset/limit, line numbers, binary/image support
  • WriteTool — Atomic writes (tmp + rename), directory creation, path sandboxing
  • EditTool — Targeted string replacement with exact match, replaceAll mode
  • GlobTool — Pattern-based file search (**/*.py, src/**/*.ts)
  • GrepTool — Regex content search across files, include filters
  • ToolRegistry — Register, dispatch, and manage tools

REPL & Interactive Mode

  • Interactive REPL — Conversational session with history and streaming
  • One-Shot Modeautobots ask "question" for quick queries
  • Piped Inputcat file.py | autobots ask "explain this"
  • Slash Commands/help, /clear, /cost, /compact, /model, /exit
  • Session Persistence — Save and restore conversations from JSON

Permissions & Safety

  • Tool-Level Permissions — Allow/deny/ask per tool call
  • Interactive Approval — y/n/a/Esc prompt for tool execution
  • Session Whitelisting — "Always allow" for trusted tools
  • Config Merge — Global (~/.autobots/settings.json) + project + env vars
  • Audit Logging — JSON-lines log of all permission decisions
  • Command Policy — Whitelist-based command validation, blocks dangerous patterns

Context Management

  • Token Estimationlen(text) // 4 with tiktoken fallback
  • Auto-Compaction — Summarizes conversation when approaching context limit
  • CLAUDE.md Hierarchy — Global → project → subdirectory instruction loading
  • Budget Tracking — Remaining context display, usage ratios

Hooks & Extensions

  • Pre/Post Tool Hooks — Run scripts or callbacks before/after tool execution
  • Abort on Failure — Hook failure stops the tool chain
  • MCP Integration — Connect to Model Context Protocol servers for custom tools
  • Command Hooks — Shell commands with env injection and 30s timeout

Code Review & Diagnostics

  • Git Diff Review — Analyze changes for large PRs, many files, patterns
  • Doctor Command — Health checks: API key, connectivity, Python version, package
  • PR Review — Review pull requests by number or diff

Workflow

  • Session Management — Durable checkpoints, resumable runs, audit trails
  • Configurable Modes — Supervised, milestone, or fully autonomous execution
  • Multi-Root File Writing — Write to src/, app/, lib/, tests/, docs/, scripts/
  • Validation Commands — Run tests, linters, and build commands automatically
  • Shell Completions — bash, zsh, and fish tab completion
  • Plugin System — before/after hooks for custom extensions
  • Skill Marketplace — Built-in packs for FastAPI, Django, React, Next.js
  • Web Dashboard — Real-time status on port 8080

Architecture

autobots/
├── cli.py                  # CLI entry point (22+ commands)
├── bootstrap.py            # Project profiling and context contract
├── config.py               # TOML + env config with validation
├── catalog.py              # Cluster definitions and model registry
├── workspace.py            # Target workspace safety and locking
├── errors.py               # Structured error classes
├── costs.py                # Token/cost estimation
├── git_utils.py            # Git auto-commit integration
├── preflight.py            # Doctor health checks
├── onboarding.py           # Interactive setup wizard
├── completions.py          # Shell tab completion
├── context_budget.py       # Context window management
├── plugins.py              # Plugin/hook system
├── marketplace.py          # Skill pack marketplace
├── dashboard.py            # Web dashboard
├── diff.py                 # Snapshot comparison
├── tools/                  # File operation tools
│   ├── base.py             # Tool ABC and ToolResult
│   ├── read.py             # ReadTool (offset/limit, binary)
│   ├── write.py            # WriteTool (atomic, sandboxed)
│   ├── edit.py             # EditTool (exact match, replaceAll)
│   ├── glob.py             # GlobTool (pattern search)
│   ├── grep.py             # GrepTool (regex search)
│   ├── registry.py         # ToolRegistry (dispatch)
│   ├── permissions.py      # PermissionRule, PermissionChecker
│   └── formatting.py       # Tool result formatting
├── repl/                   # Interactive REPL
│   ├── session.py          # ReplSession, Message, SessionStats
│   ├── commands.py         # SlashCommand registry
│   └── runner.py           # run_repl, run_one_shot, run_piped
├── permissions/            # Permission system
│   ├── settings.py         # PermissionSettings (global/project/env)
│   ├── logging.py          # PermissionLogger (audit trail)
│   └── interactive.py      # Interactive approval prompt
├── context/                # Context management
│   ├── manager.py          # ContextManager (token tracking)
│   ├── tokenizer.py        # estimate_tokens, count_tokens
│   └── claude_md.py        # CLAUDE.md hierarchy loader
├── hooks/                  # Hook system
│   └── manager.py          # HookManager, HookPoint, HookResult
├── mcp/                    # MCP integration
│   └── client.py           # MCPClient, MCPTool
├── review/                 # Code review
│   ├── git_review.py       # Diff parsing, review
│   └── diagnostics.py      # Doctor checks
├── router/                 # Swarm orchestration
│   ├── core.py             # Main routing orchestration
│   ├── models.py           # Data models
│   ├── planning.py         # Cluster assignment
│   ├── stages.py           # Stage execution
│   └── phases.py           # Phase reading
├── executor/               # Execution engine
│   ├── autonomy.py         # Autonomous loop
│   ├── modes.py            # Execution modes
│   ├── state.py            # Session state and rollback
│   ├── commands.py         # Command validation
│   ├── gate.py             # Test-then-commit gate
│   └── validation.py       # Validation handling
├── planning/               # Plan generation
│   ├── core.py             # Plan entry point
│   ├── scanner.py          # Repository scanning
│   └── synthesis.py        # Phase synthesis
├── skills/                 # Skill injection
│   ├── loader.py           # Skill pack loading
│   ├── cluster_prompts.py  # Cluster-specific prompts
│   └── nvidia/             # 17 NVIDIA skill files
└── utils/
    └── retry.py            # Exponential backoff

Installation

Prerequisites

  • Python 3.11 or higher
  • NVIDIA API Key (for model execution)

PyPI Install

pip install autobot-swarm

Development Install

git clone https://github.com/DanielDeshmukh/autobots.git
cd autobots
python -m pip install -e . --no-build-isolation

Quick Start

# 1. Set your API key
$env:NVIDIA_API_KEY = "your_key_here"

# 2. Navigate to your project
cd C:\path\to\your\project

# 3. Initialize (creates context/ directory)
autobots init

# 4. Generate a plan
autobots plan --goal "Add user authentication"

# 5. Run the swarm
autobots run --supervised

Projects Built by Autobots

Real projects generated entirely by the multi-model swarm — no manual code, no hand-holding. Each project starts from a single sentence and goes through planner → workers → repair pipeline.

Todo App

"Build a todo app with React, TypeScript, and Vite. Features: add todos, toggle complete, delete, filter (all/active/completed), counter showing remaining."

Todo App - Empty State    Todo App - With Todos

Detail Value
Stack React 19, TypeScript, Vite
Files Generated 23
Models Used 2 (qwen3-next-80b, llama-3.3-70b)
Workers 10 parallel (semaphore-limited to 2 concurrent)
Design Dark theme, glass morphism, gradient accents
Features Add, delete, toggle complete, filter (all/active/completed), counter

How it was built:

  1. Planner (qwen3-next-80b) decomposed the goal into 10 subtasks — types, hooks, components (Input, Item, Filter, Counter, List), styles, tests
  2. Critical file injection added index.html, package.json, main.tsx, index.css automatically (planner forgets these ~80% of the time)
  3. Workers executed in parallel with shared context — each model built 1-2 files with type contracts ensuring all components use the same interfaces
  4. Repair phase detected missing files from timed-out workers and regenerated them, then ran TypeScript compilation check to fix any remaining type mismatches
  5. Import path auto-fix resolved wrong import paths between components

Repo: github.com/DanielDeshmukh/todo-by-autobots

Memory Card Flip

"Build a memory card flip game. Match pairs to win. Features: card flip animation, theme selection (animals/flags/emojis), difficulty levels, timer, move counter, and win detection."

Memory Card Flip - 6x6 Hard Mode    Memory Card Flip - Flags Theme

Detail Value
Stack React 19, TypeScript, Vite, Tailwind CSS, Zustand
Design System NVIDIA DESIGN.md (black canvas, green accent)
Pipeline Mark II — Dual-Model Collaboration
Models Used 2 (qwen3.5-122b generator, qwen3-next-80b reviewer)
Workers Sequential (1 at a time due to rate limits)
Features Card flip animation, 3 themes, 3 difficulties, timer, moves, matches, progress bar

How it was built:

  1. Planner (qwen3-next-80b) decomposed the goal into 7 subtasks — store, components (Card, GameGrid, StatsBar, ProgressBar, ThemeSelector, DifficultySelector, Celebration), styles, types, constants
  2. Critical file injection added index.html, package.json, main.tsx, index.css, tsconfig.json automatically
  3. Dual-model workers — each subtask gets a generator (qwen3.5-122b) and reviewer (qwen3-next-80b). Generator creates code, reviewer checks for bugs before writing
  4. Repair phase detected missing files and ran TypeScript validation to fix type mismatches
  5. Design system injection — NVIDIA DESIGN.md was injected into prompts so all components use black (#000000) canvas with green (#76B900) accent, angular 2px radius

Problems faced during generation:

Problem Root Cause Fix
Timer showed NaN:NaN gameStore used timer, StatsBar read timeElapsed Aligned property names across components
Cards rendered as tiny squares framer-motion not installed, no explicit sizing Replaced with pure CSS flip animations
Cards didn't flip on click initializeGame() never called on mount Added useEffect to call it on mount
6x6 showed 32 cards instead of 36 Theme had 16 items, 6x6 needs 18 unique Increased themes to 18+ items with cycling
Missing PostCSS config postcss.config.js incompatible with ESM Renamed to .cjs extension
Cross-file contract mismatches Parallel workers generated independently Switched to single-worker with full context

Repo: github.com/DanielDeshmukh/memory-card-flip


Configuration

API Key Setup

# Option 1: .env file
echo NVIDIA_API_KEY=your_key_here > .env

# Option 2: Environment variable
$env:NVIDIA_API_KEY = "your_key_here"

Configuration File

Create .autobots.toml or autobots.toml in your project root or $HOME:

[autobots]
model_selection_profile = "balanced"   # balanced, speed, or quality
parallel_planning = false
disable_live_catalog = false
safety_branch = "autobots-safety"
default_mode = "supervised"            # supervised, milestone, autonomous
milestone_threshold = 3
max_verification_attempts = 3
temperature = 0.2
max_tokens = 4096

# Optional: custom model registry
# model_registry_path = "./my-registry.json"

# Optional: extra custom clusters
# [autobots.extra_clusters]
# MyCluster = ["nvidia/custom-model-1"]

Permission Settings

Create ~/.autobots/settings.json (global) or .autobots/settings.json (project):

{
  "permissions": {
    "default": "ask",
    "rules": [
      {"tool_pattern": "Read", "permission": "allow"},
      {"tool_pattern": "Glob", "permission": "allow"},
      {"tool_pattern": "Grep", "permission": "allow"},
      {"tool_pattern": "Write", "permission": "ask"},
      {"tool_pattern": "Edit", "permission": "ask"},
      {"tool_pattern": "Bash", "permission": "ask"}
    ]
  }
}

CLI Commands

Command Description
autobots init Check context files in target project
autobots init --interactive Interactive setup wizard
autobots plan Generate implementation roadmap
autobots plan --goal "text" Plan with specific goal
autobots plan --append Append to existing plan
autobots plan --dry-run Preview without writing
autobots run [task] Execute phases with autonomy mode
autobots run --supervised Manual approval per phase (default)
autobots run --milestone Approval every N phases
autobots run --autonomous Fully autonomous execution
autobots resume Resume from last checkpoint
autobots engage Interactive mode with startup screen
autobots ask "question" One-shot question answering
autobots steer "instruction" Add mid-task steering instructions
autobots status Rich status with progress bars
autobots explain <id> Show audit trail for a phase/task
autobots stats Usage statistics and costs
autobots undo Rollback to previous snapshot
autobots snapshots List available snapshots
autobots diff Compare workspace to snapshot
autobots logs View audit trail
autobots doctor Preflight health checks
autobots catalog Browse NVIDIA model registry
autobots config validate Validate TOML configuration
autobots completions Generate shell completions
autobots marketplace Browse skill packs
autobots dashboard Launch web dashboard
autobots validate-models Test NVIDIA API connectivity
autobots publish Build and publish to PyPI

Tool System

Autobots includes a full file operation tool system:

ReadTool

# Read with line numbers
ReadTool.run(file_path="/path/to/file.py")

# Read with offset and limit
ReadTool.run(file_path="/path/to/file.py", offset=10, limit=50)

WriteTool

# Atomic write (creates parent directories automatically)
WriteTool.run(file_path="/path/to/file.py", content="print('hello')")

# Sandboxed write (only allowed paths)
WriteTool(allowed_paths=["/project/src"]).run(file_path="...", content="...")

EditTool

# Exact string replacement
EditTool.run(file_path="main.py", old_string="old_code", new_string="new_code")

# Replace all occurrences
EditTool.run(file_path="main.py", old_string="foo", new_string="bar", replace_all=True)

GlobTool

# Find files by pattern
GlobTool.run(pattern="**/*.py", path="/project")

# Find TypeScript files
GlobTool.run(pattern="src/**/*.tsx", path="/project")

GrepTool

# Regex search
GrepTool.run(pattern=r"def \w+", path="/project/src")

# Search specific file types
GrepTool.run(pattern="TODO", path="/project", include="*.py")

REPL Mode

Interactive Session

autobots
# Autobots REPL (model: meta/llama-3.1-8b-instruct)
# Type /help for commands, /exit to quit.
#
# You> What is this project about?
# Assistant: This project is...

One-Shot Mode

autobots ask "What does the main.py file do?"

Piped Input

cat main.py | autobots ask "Explain this code"

Slash Commands

Command Description
/help Show available commands
/clear Clear conversation history
/cost Show token usage and estimated cost
/compact Summarize conversation to save tokens
/model <name> Switch model mid-session
/exit Exit the REPL

Permissions

Permission Levels

  • allow — Auto-approved, no prompt
  • ask — Interactive approval required
  • deny — Blocked, cannot execute

Interactive Approval

When a tool requires approval:

Allow Write?
  file_path: /project/src/main.py
  content: print('hello')
  [y]es / [n]o / [a]lways / [Esc] cancel
  • y — Approve this once
  • n — Deny this call
  • a — Always allow this tool for the session
  • Esc — Cancel

Configuration

Global (~/.autobots/settings.json):

{
  "permissions": {
    "default": "ask",
    "rules": [
      {"tool_pattern": "Read", "permission": "allow"},
      {"tool_pattern": "Write", "permission": "ask"}
    ]
  }
}

Project (.autobots/settings.json):

{
  "permissions": {
    "rules": [
      {"tool_pattern": "Bash(npm test)", "permission": "allow"},
      {"tool_pattern": "Bash(rm *)", "permission": "deny"}
    ]
  }
}

Environment Variables:

$env:AUTOBOTS_ALLOWED_TOOLS = "Read,Glob,Grep"
$env:AUTOBOTS_DENIED_TOOLS = "Bash(rm *)"

Context Management

Token Tracking

  • Tracks token usage per message
  • Estimates remaining context budget
  • Auto-compacts at 80% threshold

CLAUDE.md Hierarchy

Instructions loaded from multiple locations:

~/.autobots/CLAUDE.md           (global)
./CLAUDE.md                     (project root)
./src/CLAUDE.md                 (subdirectory)

Compaction

You> /compact
Compacted 24 messages into summary.

Hooks & MCP

Pre/Post Tool Hooks

Register callbacks that run before or after tool execution:

from autobots.hooks import HookManager, Hook, HookPoint

mgr = HookManager()
mgr.register(Hook(
    name="lint",
    point=HookPoint.POST_TOOL,
    command="ruff check {file_path}"
))

MCP Integration

Connect to Model Context Protocol servers:

from autobots.mcp import MCPClient

client = MCPClient(command="npx", args=["-y", "@modelcontextprotocol/server-filesystem"])
client.connect()
tools = client.list_tools()
result = client.call_tool("read_file", {"path": "/etc/hosts"})

Code Review & Diagnostics

Git Diff Review

# Review current changes
autobots review

# Review PR by number
autobots pr-review 42

Doctor Command

autobots doctor
# Autobots Doctor Results:
#   [PASS] Python Version: Python 3.13 (OK)
#   [PASS] API Key: NVIDIA_API_KEY set (ends with ...abc1)
#   [PASS] Connectivity: NVIDIA API reachable
#   [PASS] Package: autobot-swarm installed
#   4/4 checks passed

NVIDIA Models & Clusters

Cluster Role Models Keywords
Optimus Command & Routing 9 plan, roadmap, phase, orchestrate
UltraMagnus Backend & Architecture 12 backend, api, database, service
RedAlert Security & Safety 10 security, auth, guardrail, validation
Jazz Frontend & Creative 11 ui, ux, css, image, visual
Ratchet Debug & Repair 10 debug, fix, refactor, patch, repair
Perceptor Retrieval & Parsing 11 ocr, rag, embedding, document
Bumblebee Communication & Media 9 speech, voice, translation, audio
Ironhide Physical & Simulation 8 simulation, physics, autonomous
Wheeljack Scientific Specialist 7 science, molecule, protein, quantum

NVIDIA Skills

Tier 1 (Always Loaded)

Skill Cluster(s) Description
agent-skills.md Optimus, UltraMagnus NemoClaw agent architecture
autonomous-agent-research.md Optimus, Wheeljack Autonomous research workflow
session-memory.md Optimus, Jazz Durable session memory
skill-evolution.md ALL Self-improvement protocol
safety-policy.md Ironhide Safety taxonomy
rag-blueprint.md UltraMagnus, Optimus RAG architecture
rag-eval.md Jazz RAG evaluation metrics
dynamo-deployment.md UltraMagnus, Wheeljack Dynamo K8s recipes
dynamo-router.md UltraMagnus, Optimus Dynamo router modes
retrieval.md UltraMagnus, Bumblebee Document retrieval pipeline

Tier 2 (Conditional)

Skill Loaded When Description
nemotron-customize.md fine-tuning, training Nemotron customization
cuopt-routing.md routing, scheduling cuOpt vehicle routing
cuopt-optimization.md optimization, LP/MILP/QP cuOpt numerical optimization
cudf.md pandas, dataframe cuDF GPU DataFrames
neautomodel-recipe.md training at scale Distributed training
kubernetes-infra.md Kubernetes, K8s Physical AI infra
holoscan.md video, edge AI Holoscan video analytics
cudaq.md quantum computing CUDA-Q quantum simulation

Execution Modes

Supervised (Default)

autobots run --supervised

Requires approval before each phase. Full human control.

Milestone

autobots run --milestone

Requires approval after N phases (configurable via milestone_threshold).

Autonomous

autobots run --autonomous

No approval gates. Fastest execution.


Context Architecture

Autobots expects six context files under context/:

File Purpose
architecture.md Project architecture and structure
roadmap.md Phase definitions with goals and validation
progress-tracker.md Phase status tracking
project-briefing.md Project overview and goals
security-auth.md Security and authentication notes
ui-components.md UI component documentation

Cross-Platform Usage

Windows

pip install autobot-swarm
$env:NVIDIA_API_KEY = "your_key"
cd C:\path\to\your\project
autobots init
autobots plan --goal "Add feature X"
autobots run --supervised

macOS / Linux

pip install autobot-swarm
export NVIDIA_API_KEY="your_key"
cd /path/to/your/project
autobots init
autobots plan --goal "Add feature X"
autobots run --supervised

Environment Variables

Variable Description Default
NVIDIA_API_KEY NVIDIA API key for model access Required
AUTOBOTS_MODEL_SELECTION_PROFILE Model selection: balanced/speed/quality balanced
AUTOBOTS_ENABLE_PARALLEL_PLANNING Enable parallel workstreams false
AUTOBOTS_DISABLE_LIVE_CATALOG Use bundled models only false
AUTOBOTS_SAFETY_BRANCH Required git branch name autobots-safety
AUTOBOTS_DEFAULT_MODE Default execution mode supervised
AUTOBOTS_MILESTONE_THRESHOLD Phases per approval 3
AUTOBOTS_MAX_VERIFICATION_ATTEMPTS Retry limit 3
AUTOBOTS_ALLOWED_TOOLS Comma-separated allowed tools (none)
AUTOBOTS_DENIED_TOOLS Comma-separated denied tools (none)

Troubleshooting

Error Solution
NVIDIA_API_KEY is missing Set NVIDIA_API_KEY in .env or environment variable
Missing: roadmap.md Run autobots plan to generate context files
Switch to autobots-safety branch git checkout -b autobots-safety
Command not in safety whitelist Autobots blocks dangerous commands. Use safe alternatives
No checkpoint found Start fresh with autobots run
old_string not found Provide exact surrounding lines for unique match
old_string found N times Add more context or use replace_all=true

Development

Running Tests

# All tests
python -m pytest tests/ -v

# Specific test file
python -m pytest tests/test_tools.py -v

# With coverage
python -m pytest tests/ --cov=autobots --cov-report=html

Test Suite

Test File Tests Coverage
test_tools.py 46 File operations (Read, Write, Edit, Glob, Grep, Registry, Permissions, Formatting)
test_tools_integration.py 5 Integration: read → edit → verify → read
test_repl.py 20 REPL session, commands, runner
test_permissions.py 12 Permission settings, logging, merge
test_context.py 18 Token estimation, compaction, CLAUDE.md
test_hooks_mcp.py 13 Hooks, MCP client
test_review.py 12 Git review, diagnostics
test_final_decision.py 10 Release readiness
Total 136

License

MIT License — See LICENSE for details.


Acknowledgments

  • Built with NVIDIA NIM for model access
  • Powered by Rich for terminal UI
  • Uses OpenAI compatible API interface

About

Autobots | A decentralized model agentic swarm powered by NVIDIA NIM. Orchestrating high-precision, end-to-end authenticated software development through a specialized 6-file control architecture. Features automated security auditing, non-redundant task routing, and autonomous state management.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages