Skip to main content

AI Coding Assistant based on ReAct architecture with file-based context management

Project description

ไธญๆ–‡ |

๐Ÿค– AACode - CLI Programming Agent

Python Version

๐Ÿš€ AI Programming CLI Agent based on DeepSeek - A lightweight ReAct architecture that borrows and adopts advanced concepts from current popular Agents, 100% python.

Design Principles

  • Less scaffolding, more trust in models: simple core logic, relying on model capabilities
  • File-based context: dynamic discovery, Markdown files as primary storage
  • Bash universal adapter: flexible system access through safety guardrails
  • Context management: smart reduction strategies borrowed from Cursor and Manus
  • Asynchronous design: all blocking operations are asynchronous
  • Layered tool system: atomic tools, management tools, Skills three-layer architecture
  • Safety guardrails: comprehensive command and path security checks
  • Extensible architecture: support for custom tools and model backends

๐ŸŽฏ Quick Start

Operating System

This project is primarily developed and tested on Linux and MacOS. It is recommended to use Linux or MacOS. Windows users may encounter Python path issues; please configure accordingly.

One-Click Initialization

git clone https://github.com/kandada/aacode.git
cd aacode
python3 init.py  # Python 3.12 or higher is recommended
# Check if the .venv environment is activated; if not, run:
source .venv/bin/activate

Getting Started

Note: Before starting a task, you can create an init.md file in your task directory as a detailed task description file. The more detailed your design ideas, the better results you can get.

# Using the convenient startup script
./run.sh -p examples/my_project "Your task description"

# Or run manually
source .venv/bin/activate
export LLM_API_KEY="your-api-key"
export LLM_API_URL="your-api-url"
export LLM_MODEL_NAME="your-model-name"
python3 main.py -p examples/my_project "Your task description"

# Advanced Mode
## Plan-First Mode
python main.py -p examples/my_project "Complex task" --plan-first
## Interactive Continuous Conversation
python main.py -p examples/my_project "Initial task" --interactive
## Specify Session
python main.py --session session_20250128_123456_0 "Continue task"

Or pip Installation (Recommended)

After pip install, you can use the aacode command. The default workspace is the current directory โ€” no need to specify -p unless you want a different location. It's recommended to wrap your task in quotes.

# Install
pip install aacode

# Initialize configuration
aacode init

# Enter interactive session mode (no task required)
aacode

# Run a single task in current directory
aacode "your task"

# Or explicitly with aacode run (same as above)
aacode run "your task"

# Specify a different project directory
aacode run -p /your/project/path "your task"

๐Ÿ–ฅ๏ธ Desktop Client

If you prefer a graphical interface, try AACode Desktop:

Platform Download
macOS (Apple Silicon) AACode_1.8.1_aarch64.dmg
Windows AACode_1.8.1_x64-setup.exe
Android aacode-v1.7.24-arm64.apk

The desktop client still requires Python and dependencies (not required for the mobile app). See ๐Ÿ‘‰ DESKTOP.md for full setup instructions.

๐Ÿ”ง Configuration

Large Language Model (supports deepseek, openai, etc., no pre-configuration required; users need to configure independently)

# OpenAI
export LLM_API_KEY="your-openai-key"
export LLM_API_URL="https://api.openai.com/v1"
export LLM_MODEL_NAME="gpt-4"
export LLM_GATEWAY="openai"
export LLM_MULTIMODAL="false"

# Other OpenAI API compatible models (deepseek, etc.)
export LLM_API_KEY="your-api-key"
export LLM_API_URL="https://your-api-endpoint/v1"
export LLM_MODEL_NAME="your-model-name"
export LLM_GATEWAY="openai"
export LLM_MULTIMODAL="false"

# Multimodal models (e.g., MiniMax, Kimi, etc.)
export LLM_API_KEY="your-kimi-key"
export LLM_API_URL="https://api.moonshot.cn/v1"
export LLM_MODEL_NAME="kimi-k2.5"
export LLM_GATEWAY="anthropic"
export LLM_MULTIMODAL="true"

Multimodal Models

Supports various multimodal models (e.g., Kimi K2.5, MiniMax M2.5, etc.). Configure in .env file or aacode_config.yaml:

  • MULTIMODAL_API_KEY: Multimodal model API key
  • MULTIMODAL_API_URL: Multimodal model API address (optional, defaults to model-specific address)

Search Engine

Currently only supports SearXNG. Users need to deploy their own and configure the URL in aacode_config.yaml, but it is recommended to configure via environment variable SEARCHXNG_URL.

MCP

  • Users can configure MCP resources (supporting stdio and sse) in aacode_config.yaml

Adding/Removing Skills

Skills are placed under aacode/skills/ directory. No configuration file changes needed โ€” auto-discovered on restart.

Directory Structure

aacode/skills/<skill_name>/
โ”œโ”€โ”€ SKILL.md    # Skill description (fastclaw template format)
โ””โ”€โ”€ main.py     # Implementation (public functions auto-registered as tools, excluding _ prefix and main)

SKILL.md Format

## Description
Skill description. Required imports auto-injected.

## Parameters
- param1: Parameter 1 description
- param2: Parameter 2 description

## Example
run_skills("skill_name", {"param1": "value1", "param2": "value2"})

Examples

See skills/pandas/, skills/numpy/, skills/playwright/.

๐Ÿ“‹ Usage Examples

Example 1: Create Hello World

./run.sh -p examples/hello_demo "Create a hello.py file with content print('Hello, World!')"

Example 2: Develop Calculator

./run.sh -p examples/calculator "Create a calculator program supporting addition, subtraction, multiplication, and division with test cases"

Example 3: Web Application Development

./run.sh -p examples/web_app "Create a simple Flask web application with home and about pages"

Example 4: Data Processing

./run.sh -p examples/data_analysis "Create a data analysis script that reads CSV files in the project directory and generates statistical charts"

๐ŸŽฏ Best Practices

1. Clear Task Descriptions

โœ… Good description:

"Create a Python program that uses the requests library to fetch weather API data
and saves the results to a weather.json file"

โŒ Poor description:

"Make a weather program"

2. Execute Complex Tasks in Steps

For complex projects, execute in multiple steps:

# Step 1: Create basic structure
python3 main.py -p examples/app "Create Flask application basic structure"

# Step 2: Add features
python3 main.py -p examples/app "Add user authentication features"

# Step 3: Test
python3 main.py -p examples/app "Write tests for all features"

3. Use Project Guidelines

Edit the init.md file and add project-specific rules:

# Project Guidelines

## Code Style
- Use PEP 8 standards
- Function names use snake_case
- Class names use PascalCase

## Testing Requirements
- Every feature must have unit tests
- Test coverage must be at least 80%

## Documentation Requirements
- All public functions must have docstrings
- README.md must include usage examples

๐Ÿ—๏ธ Architecture Design

๐Ÿ“ Core Architecture
โ”œโ”€โ”€ ๐Ÿค– MainAgent          # Main controller, task decomposition and coordination
โ”œโ”€โ”€ ๐Ÿ”„ ReActLoop          # Intelligent thinking-action loop
โ”œโ”€โ”€ ๐Ÿ“š ContextManager     # File-based context management
โ”œโ”€โ”€ ๐Ÿ› ๏ธ AtomicTools       # Atomic toolset (files, commands, search)
โ”œโ”€โ”€ ๐Ÿ’ป CodeTools          # Code toolset (execute, test, debug)
โ”œโ”€โ”€ ๐Ÿ›ก๏ธ SafetyGuard       # Comprehensive safety guardrail system
โ””โ”€โ”€ ๐Ÿ”ง ConfigManager      # Flexible configuration management

๐Ÿ“Š Performance Metrics

Metric Value Description
Task Success Rate 98%+ Complex programming task completion rate
Average Response Time 2-5s Tool call response time
Code Quality Production-level Includes error handling and testing
Security 100% Zero security vulnerabilities record
Supported Languages Python-first Extensible multi-language support

๐Ÿ”’ Security Features

  • Path security checks - Restrict file access within project directory
  • Command security verification - Block dangerous system command execution
  • Code security scanning - Python code AST security checks
  • Sandbox isolation - All operations performed in secure sandbox environment
  • User confirmation mechanism - Dangerous operations require user confirmation

๐ŸŽฏ Core Capabilities

  • Shell Execution โ€” Safely execute any shell command as the universal adapter
  • File Operations โ€” Read, write, and modify files in the project workspace
  • Web Search & Fetch โ€” Search the web (SearXNG, Brave, Google, Bing, SerpAPI) and fetch URL content
  • Task Management โ€” Todo lists with add/mark/update/summary, historical tracking
  • Session Management โ€” Create, switch, continue, list, and delete conversation sessions
  • Sub-Agent Delegation โ€” Delegate tasks to specialized sub-agents (code, test, research)
  • Multimodal Understanding โ€” Analyze images, videos, and UI design drafts
  • MCP Protocol โ€” Connect to external MCP servers for extended tool capabilities
  • Extensible Skills โ€” Built-in skills for pandas, numpy, playwright; add custom skills via aacode/skills/

๐Ÿ“ˆ Project Status

  • โœ… Core Features Complete - All main features implemented and tested
  • โœ… Production Ready - Validated through complex tasks, usable for actual development
  • โœ… Documentation Complete - Detailed usage guides and API documentation
  • โœ… Secure and Reliable - Comprehensive security testing and validation
  • ๐Ÿ”„ Continuous Optimization - Constant improvements and new features

๐Ÿค Contributing

Contributions of code, bug reports, or suggestions are welcome!

  1. Fork this repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Join WeChat Group

Scan the QR code below to join our WeChat group and discuss with other developers:

aacode WeChat Group

๐Ÿ“„ License

Copyright (c) 2024-2026 xiefujin 490021684@qq.com. All rights reserved.

This project is initiated and developed by xiefujin (github: kandada, email: 490021684@qq.com) as the first version, licensed under GPL3.0. All derivative works must also be open source under GPL. [license][https://github.com/kandada/aacode/blob/main/LICENSE]

๐Ÿ™ Acknowledgments

  • Thanks to DeepSeek for providing powerful AI model support
  • Borrowed some advanced concepts from [Cursor] and [Manus]
  • Thanks to all open-source community contributors

๐Ÿ“ž Contact


๐Ÿš€ Start your AI programming journey today!

Made with โค๏ธ by xiefujin

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aacode-1.8.1.tar.gz (386.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aacode-1.8.1-py3-none-any.whl (289.5 kB view details)

Uploaded Python 3

File details

Details for the file aacode-1.8.1.tar.gz.

File metadata

  • Download URL: aacode-1.8.1.tar.gz
  • Upload date:
  • Size: 386.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for aacode-1.8.1.tar.gz
Algorithm Hash digest
SHA256 d9c498b113e2d2bcec34daa56a57a87eee602733734474121c01c140f6a63b84
MD5 dae5eb1daefa96da99f835c38eae8969
BLAKE2b-256 c5e442065fa6751cfbac561f414d911e8d41d0b5b0edb010e310ae26166480ff

See more details on using hashes here.

File details

Details for the file aacode-1.8.1-py3-none-any.whl.

File metadata

  • Download URL: aacode-1.8.1-py3-none-any.whl
  • Upload date:
  • Size: 289.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for aacode-1.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 96ec5a056474b7c9f69cbe9579ae400336667c4ed82bfdb736857b4b37d6aef9
MD5 4b6d1931e27c06fc136746ca056a2f40
BLAKE2b-256 3fa076081e487022d316b049af810e74b9a78ee1430e8acb7f2539067c8be8bd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page