Java implementation of Athlon Code CLI tool for AI-powered software engineering tasks, adapted from advanced AI coding assistant projects.
- Code Understanding & Editing - Query and edit codebases with AI assistance
- File System Operations - Read, write, and manage files through AI commands
- Shell Command Execution - Run system commands safely with user confirmation
- Long-term Memory Management - Save and retrieve context across sessions via ATHLON.md files
- Interactive CLI - Chat-based interface for natural language programming tasks
- Non-Interactive Mode - Batch processing support for automation
- AI Model Integration - Supports various AI models through OpenAI-compatible API
- Java 8 or higher
- Maven 3.6 or higher
- AI model API key (supports OpenAI-compatible APIs)
- Clone and build the project:
git clone <repository-url>
cd athlon-code-java
mvn clean install- Set up your API key:
# For users in mainland China
export OPENAI_API_KEY="your_api_key_here"
export OPENAI_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1"
# For international users
export OPENAI_API_KEY="your_api_key_here"
export OPENAI_BASE_URL="https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
# Optional: specify model
export OPENAI_MODEL="qwen3-coder-max"- Run the CLI:
# Interactive mode
java -jar athlon-cli/target/athlon-code.jar
# Non-interactive mode
java -jar athlon-cli/target/athlon-code.jar --non-interactive "Explain this code file" src/main/java/Main.java$ java -jar athlon-cli/target/athlon-code.jar
Athlon Code Java - Interactive Mode
Type 'exit' or 'quit' to end the session
> Read the README.md file and summarize the project structure
> Create a new Java class for handling HTTP requests
> Run tests and show me any failures# Code analysis
java -jar athlon-cli/target/athlon-code.jar --non-interactive "Analyze the main method in src/main/java/App.java"
# File operations
java -jar athlon-cli/target/athlon-code.jar --non-interactive "Create a new utility class for string operations"
# Project tasks
java -jar athlon-cli/target/athlon-code.jar --non-interactive "Run mvn test and fix any compilation errors"The project follows a modular architecture with three main components:
- AthlonApiClient: HTTP client for AI API communication
- Model Classes: Request/response models for OpenAI-compatible API
- Configuration: API settings and model configuration
- Tool Registry: Manages available AI tools
- File Tools: Read and write file operations
- Shell Tool: Execute system commands with safety checks
- Memory Tools: Long-term memory management via ATHLON.md files
- Extensible Framework: Easy to add new tool implementations
- Command-Line Interface: Interactive and batch processing modes
- Conversation Manager: Handles AI conversations and tool execution
- User Confirmation: Safety prompts for destructive operations
| Tool | Description | Requires Confirmation |
|---|---|---|
read_file |
Read file contents with line numbers | No |
write_file |
Create or overwrite files | Yes |
shell |
Execute shell commands | Yes |
save_memory |
Save facts to long-term memory (ATHLON.md) | No |
load_memory |
Load and display memory content from ATHLON.md files | No |
Athlon Code Java includes a powerful long-term memory system that allows the AI to remember important information across sessions and projects.
- ATHLON.md Files: Memory is stored in
ATHLON.mdfiles - Hierarchical Loading: System automatically loads memory from:
- Project root:
./ATHLON.md(project-specific context) - User home:
~/.athlon/ATHLON.md(global context)
- Project root:
- Automatic Context: Memory content is automatically included in AI conversations
- Persistent Storage: Information persists across sessions and restarts
The AI can automatically save important facts using the save_memory tool:
# The AI will automatically save important information like:
# - Project structure and conventions
# - API endpoints and configurations
# - Development guidelines and preferences
# - Frequently used commands or patternsYou can also manually create or edit ATHLON.md files:
# Project Context
## Project Overview
This is a Spring Boot application for user management.
## Development Guidelines
- Use Java 11 features
- Follow REST API conventions
- Use JUnit 5 for testing
## Athlon Added Memories
- The project uses PostgreSQL as the database
- API endpoints follow the pattern /api/v1/*
- Authentication is handled via JWT tokensOPENAI_API_KEY: Your AI API key (required)OPENAI_BASE_URL: API endpoint URL (optional, auto-detected by region)OPENAI_MODEL: Model name (optional, default: qwen3-coder-max)
java -jar athlon-code.jar [OPTIONS] [COMMAND]
Options:
-c, --config FILE Configuration file path
-m, --model MODEL Model to use (default: qwen3-coder-max)
-t, --temperature TEMP Temperature for generation (default: 0.7)
--non-interactive Run in non-interactive mode
-h, --help Show help message
-V, --version Print version information# Compile all modules
mvn clean compile
# Run tests
mvn test
# Build JAR files
mvn clean package
# Install to local repository
mvn clean installathlon-code-java/
├── athlon-core/ # Core API client and models
│ ├── src/main/java/
│ │ └── com/athlon/code/core/
│ │ ├── client/ # HTTP client
│ │ ├── config/ # Configuration
│ │ └── model/ # Data models
│ └── pom.xml
├── athlon-tools/ # Tool implementations
│ ├── src/main/java/
│ │ └── com/athlon/code/tools/
│ │ ├── impl/ # Tool implementations
│ │ └── *.java # Tool framework
│ └── pom.xml
├── athlon-cli/ # Command-line interface
│ ├── src/main/java/
│ │ └── com/athlon/code/cli/
│ └── pom.xml
└── pom.xml # Parent POM
- Extend the
Toolabstract class:
public class MyCustomTool extends Tool {
public MyCustomTool() {
super("my_tool", "Description of what this tool does");
}
@Override
public ToolResult execute(String arguments) throws ToolExecutionException {
// Implementation here
return ToolResult.success("Tool completed successfully");
}
@Override
public Map<String, Object> getParametersSchema() {
// Return JSON schema for parameters
}
}- Register in
ToolRegistry:
toolRegistry.register(new MyCustomTool());Get your AI API key:
- China mainland: Bailian Console
- International: Model Studio
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-tool) - Make your changes
- Add tests for new functionality
- Commit your changes (
git commit -am 'Add new tool') - Push to the branch (
git push origin feature/new-tool) - Create a Pull Request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.