Skip to content

Amanlook/devAgent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 DevAgent

An autonomous AI development assistant framework built in Python.

Unlike standard copilots, DevAgent understands your project, plans before acting, and remembers across sessions.

✨ Key Features

Feature Description
🧭 Project Context Engine Auto-scans your project (language, framework, file tree, README) before reasoning
📋 Planning Phase Generates a step-by-step plan and asks for approval before executing
🧠 Session Memory Persists conversations to .devagent/ — recalls past work on next run
🪝 Event Hooks @hook("before_tool") middleware for logging, alerts, auto-rollbacks
Streaming TUI Live spinners, progress bars, elapsed time, and rich panel output
🛡 Human-in-the-Loop Requires confirmation for dangerous tools (bash, etc.)
🔌 LLM Agnostic Supports OpenAI, Anthropic, and Ollama (local) out of the box
🔧 Extensible Tools Add new tools with a simple @tool decorator

🚀 Quick Start

# Clone & setup
git clone <your-repo-url>
cd devAgent
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

# Configure
cp .env.example .env
# Edit .env → add your API key (OpenAI, Anthropic, or Ollama)

# Run
python main.py "List all files and explain this project"

📦 Project Structure

devAgent/
├── main.py                  # CLI entry point
├── requirements.txt         # Dependencies
├── .env.example             # Environment template
├── core/
│   ├── agent.py             # Think → Act → Observe loop
│   ├── context.py           # Project Context Engine
│   ├── planner.py           # Planning Phase
│   ├── memory.py            # Session Memory
│   ├── hooks.py             # Event Hooks middleware
│   ├── prompts.py           # System prompt personas
│   ├── llm_provider.py      # LLM abstraction (OpenAI/Anthropic/Ollama)
│   └── tool_registry.py     # @tool decorator & registry
└── tools/
    ├── file_io.py            # read_file, write_file, list_directory
    ├── bash.py               # run_command (protected)
    └── git.py                # git_status, git_diff, git_commit

🎮 CLI Usage

# Full experience (plan + memory + context)
python main.py "Add user authentication"

# Auto-approve everything (no prompts)
python main.py -y "Refactor the utils module"

# Skip planning, execute immediately
python main.py --no-plan "What's in README.md?"

# With safety gate (prompts before bash commands)
python main.py -H "Install pandas and run tests"

# Disable memory persistence
python main.py --no-memory "One-off question"

# Choose LLM provider
python main.py --provider anthropic "Review this code"
python main.py --provider ollama "Explain this function"

🔧 Adding Custom Tools

Create a new file in tools/ with the @tool decorator:

# tools/search.py
from core.tool_registry import tool

@tool
def search_in_file(file_path: str, query: str) -> str:
    """Search for a string inside a file and return matching lines."""
    with open(file_path) as f:
        matches = [line.strip() for line in f if query.lower() in line.lower()]
    return "\n".join(matches) if matches else "No matches found."

Then register it in tools/__init__.py:

from tools import search  # noqa: F401

🪝 Adding Hooks

from core.hooks import hook

@hook("before_tool")
def log_tool(tool_name, arguments):
    print(f"About to run: {tool_name}")

@hook("after_tool")
def check_result(tool_name, result):
    if not result.success:
        send_alert(f"Tool {tool_name} failed!")

⚙️ Configuration

Copy .env.example to .env and set your preferred provider:

LLM_PROVIDER=openai          # openai | anthropic | ollama
OPENAI_API_KEY=sk-...
OPENAI_MODEL=gpt-4o

# Or use Anthropic
# ANTHROPIC_API_KEY=sk-ant-...
# ANTHROPIC_MODEL=claude-sonnet-4-20250514

# Or use Ollama (free, local)
# OLLAMA_BASE_URL=http://localhost:11434
# OLLAMA_MODEL=llama3

📄 License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages