Kodo - A simple cli agent
Project description
MyCode CLI - Intelligent Coding Assistant
An advanced AI-powered coding assistant that understands your entire codebase through intelligent context management and AST analysis.
๐ Features
Intelligent Context System
- Multi-language AST analysis supporting 30+ programming languages
- Smart context loading that finds relevant files for your queries
- Living project documentation that evolves with your code
- Auto-updating context when significant changes are detected
AI-Powered Commands
chat- Have conversations about your code with full project contextedit- AI-assisted file editing with contextual awarenessgenerate- Create new files that fit your project's patternscontext- View current project understanding and recent activity
Advanced Context Management
overview.md- Concise project summary that serves as AI system prompthistory.md- Complete log of all interactions and changesrules.cline- Customizable AI behavior and coding preferences- AST snapshot - Deep understanding of code structure and relationships
๐ฆ Installation
# Clone the repository
git clone <repository-url>
cd mycode-cli
# Install dependencies
pip install -r requirements.txt
# Configure your LLM provider
python main.py configure
# Initialize in your project
python main.py init
๐ง Supported LLM Providers
- OpenAI (GPT-3.5, GPT-4, GPT-4o)
- Anthropic (Claude 3.5 Sonnet, Claude 3 Opus, Claude 3 Haiku)
- Google Gemini (Gemini 1.5 Flash, Gemini 2.0 Flash)
- Huggingface (DeepSeek R1, Qwen, Llama, Mixtral)
- Ollama (Local models - Llama 3.1, CodeLlama, Mistral, Phi3)
๐ฏ Quick Start
1. Initialize Your Project
python main.py init
This creates:
.mycode/context/snapshot.json- AST analysis of your codebase.mycode/context/overview.md- Project summary and context.mycode/context/history.md- Development timeline.mycode/context/rules.cline- AI assistant preferences.mycode/cache/- Performance optimization data
2. Chat About Your Code
python main.py chat "How does the authentication system work?"
python main.py chat "What's the main entry point of this application?"
python main.py chat "Explain the database schema"
3. AI-Assisted Editing
python main.py edit main.py "Add error handling to the main function"
python main.py edit config.py "Add support for environment variables"
4. Generate New Files
python main.py generate tests/test_auth.py "Create comprehensive tests for authentication"
python main.py generate docs/api.md "Create API documentation based on the code"
5. ๐ค Agentic Mode (NEW!)
# Let the agent plan and execute complex tasks autonomously
python main.py agent "create a REST API with user authentication and database"
python main.py agent "refactor the codebase to use dependency injection" --auto-approve
python main.py agent "add comprehensive error handling throughout the application"
python main.py agent "implement automated testing for all core functions"
๐ Commands Reference
Core Commands
configure- Set up LLM provider and API keysinit- Initialize intelligent context system in current directorystatus- Show current configuration and context status
AI Commands
chat <message>- Ask questions about your codebaseedit <file> <prompt>- Modify files with AI assistancegenerate <file> <prompt>- Create new files with AIagent <goal>- ๐ค NEW: Agentic Mode - Autonomous planning and execution
Context Commands
context- View current project context and recent activityupdate-context- Refresh project analysis and AST snapshot
๐ค Agentic Mode - Autonomous Code Assistant
Planning, Acting, and Reflecting
The Code Agent brings autonomous capabilities to MyCode CLI:
- ๐ง Planning - Breaks down complex goals into actionable steps
- โก Acting - Executes file operations, code analysis, and modifications
- ๐ Observing - Monitors results and validates actions
- ๐ญ Reflecting - Self-corrects errors and adapts plans
How It Works
- Goal Understanding - Analyzes your request using full project context
- Execution Planning - Creates step-by-step plan with safety assessment
- User Approval - Shows plan for approval (or use
--auto-approve) - Autonomous Execution - Carries out actions with progress tracking
- Session Logging - Records all actions to project history
Safety Features
- Risk Assessment - Rates operations on 1-5 safety scale
- User Confirmation - Asks approval for high-risk operations
- Action Validation - Verifies each step before proceeding
- Session History - Complete audit trail of all agent actions
Example Agent Session
๐ค Code Agent activated
๐ Planning phase...
โโ Execution Plan โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ฏ Goal: Create a simple REST API with authentication โ
โ ๐ง Reasoning: Build Flask API with JWT auth and tests โ
โ ๐ Complexity: 7/10 โ
โ โ ๏ธ Safety Level: 3/5 โ
โ ๐ Steps: 6 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# โ Action โ Target โ Reasoning
โโโโผโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1 โ Create Fileโ app.py โ Main Flask application
2 โ Create Fileโ auth.py โ JWT authentication logic
3 โ Create Fileโ models.py โ User model and database
4 โ Create Fileโ requirements.txt โ Project dependencies
5 โ Create Fileโ tests/test_auth.py โ Authentication tests
6 โ Analyze Codeโ . โ Validate project structure
โก Execution phase...
โ
Step 1: Create File
โ
Step 2: Create File
โ
Step 3: Create File
โ
Step 4: Create File
โ
Step 5: Create File
โ
Step 6: Analyze Code
๐ All steps completed successfully!
๐ Session Summary:
โข Steps completed: 6/6
โข Memory items: 12
โข Session ID: 1704123456
๐ง How the Context System Works
Project Analysis
MyCode uses advanced AST (Abstract Syntax Tree) parsing to understand:
- Code structure - Classes, functions, variables, imports
- Dependencies - Import relationships and module connections
- Architecture patterns - Detected patterns (MVC, API, microservices, etc.)
- File relationships - How different parts of your code interact
Intelligent Context Loading
When you ask a question or request changes:
- Query analysis - Extracts keywords and intent from your request
- Relevance scoring - Finds files most relevant to your query
- Context assembly - Builds focused context within token limits
- History integration - Includes relevant past interactions
Living Documentation
overview.mdserves as a system prompt, giving AI essential project contexthistory.mdlogs every interaction, creating institutional memoryrules.clinedefines project-specific preferences and coding standards
๐๏ธ Customization
Project Rules (.mycode/context/rules.cline)
# Context Configuration
max_context_files=8
max_file_size=20000
context_priority=main_files,recent_changes,query_relevant
# Code Style & Standards
- Write clean, readable code with meaningful names
- Add comments for complex logic
- Follow existing patterns in the codebase
- Maintain consistent formatting
# Response Guidelines
- Provide concise, actionable answers
- Include code examples when helpful
- Explain reasoning for significant changes
Supported Languages
Primary Support (Full AST analysis):
- Python, JavaScript, TypeScript, Go, Rust, Java, C/C++
Extended Support (Basic analysis):
- PHP, Ruby, Swift, Kotlin, Scala, Dart, Lua, HTML, CSS, JSON, YAML
๐ Performance Features
Smart Caching
- Only re-analyzes changed files
- Metadata tracking for performance optimization
- Auto-update triggers based on activity patterns
Efficient Context Loading
- Relevance-based file selection
- Configurable context limits
- Preview generation for large files
Auto-Update System
- Detects when context becomes stale
- Updates AST snapshot incrementally
- Maintains performance metrics
๐ Security & Privacy
- Local-first - All analysis happens on your machine
- Configurable sharing - Choose what context to include
- API key security - Secure storage and masked display
- File size limits - Prevents accidental inclusion of large files
๐ ๏ธ Advanced Usage
Team Collaboration
# Share context with team (optional)
git add .mycode/context/overview.md .mycode/context/rules.cline
git commit -m "Add project context for AI assistance"
# Keep history private
echo ".mycode/context/history.md" >> .gitignore
Custom Workflows
# Update context after major refactoring
python main.py update-context
# Review recent development activity
python main.py context
# Batch operations with context awareness
for file in src/*.py; do
python main.py edit "$file" "Add type hints and docstrings"
done
๐ Troubleshooting
Common Issues
"Could not update AST cache" error:
- Ensure file paths are relative to project root
- Check file permissions and existence
- Run
python main.py update-contextto refresh
Context not loading:
- Verify
.mycode/directory exists - Run
python main.py initto reinitialize - Check LLM provider configuration with
python main.py status
Large file warnings:
- Adjust
max_file_sizein.mycode/context/rules.cline - Add specific files to exclude patterns
- Use
.gitignorepatterns to skip generated files
Performance Optimization
# Clear cache and rebuild
rm -rf .mycode/cache/
python main.py update-context
# Adjust context limits
echo "max_context_files=5" >> .mycode/context/rules.cline
echo "max_file_size=15000" >> .mycode/context/rules.cline
๐ค Contributing
MyCode CLI is designed to be extensible. Key areas for contribution:
- Additional language support via Tree-sitter
- New LLM provider integrations
- Enhanced context analysis algorithms
- Performance optimizations
๐ License
[License information]
Built with intelligence, designed for developers. ๐
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kodo_cli-0.1.0.tar.gz.
File metadata
- Download URL: kodo_cli-0.1.0.tar.gz
- Upload date:
- Size: 43.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c48bc48bb59a23ce6d2c61a1de206966aaabdc7df43487459f8377e2182d2ef8
|
|
| MD5 |
487354bf9764009debfefcc2cc5215cc
|
|
| BLAKE2b-256 |
82a94fd4c7dcf81ccd4fffc9cd82cf364310eeb7bcc4616a8c86b048bf8ef606
|
File details
Details for the file kodo_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: kodo_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 36.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed9cf2c1b64d09b206f0221548a7a5821ad4458074eedabcddb1f6e4c2ce77de
|
|
| MD5 |
99f3507b8136b003a48722709d93b089
|
|
| BLAKE2b-256 |
1c9ecddad07cb9c9426eb2fbaeefccb493c5a8eebe173335ed26a1929e0ace29
|