Skip to main content

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 context
  • edit - AI-assisted file editing with contextual awareness
  • generate - Create new files that fit your project's patterns
  • context - View current project understanding and recent activity

Advanced Context Management

  • overview.md - Concise project summary that serves as AI system prompt
  • history.md - Complete log of all interactions and changes
  • rules.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 keys
  • init - Initialize intelligent context system in current directory
  • status - Show current configuration and context status

AI Commands

  • chat <message> - Ask questions about your codebase
  • edit <file> <prompt> - Modify files with AI assistance
  • generate <file> <prompt> - Create new files with AI
  • agent <goal> - ๐Ÿค– NEW: Agentic Mode - Autonomous planning and execution

Context Commands

  • context - View current project context and recent activity
  • update-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

  1. Goal Understanding - Analyzes your request using full project context
  2. Execution Planning - Creates step-by-step plan with safety assessment
  3. User Approval - Shows plan for approval (or use --auto-approve)
  4. Autonomous Execution - Carries out actions with progress tracking
  5. 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:

  1. Query analysis - Extracts keywords and intent from your request
  2. Relevance scoring - Finds files most relevant to your query
  3. Context assembly - Builds focused context within token limits
  4. History integration - Includes relevant past interactions

Living Documentation

  • overview.md serves as a system prompt, giving AI essential project context
  • history.md logs every interaction, creating institutional memory
  • rules.cline defines 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-context to refresh

Context not loading:

  • Verify .mycode/ directory exists
  • Run python main.py init to reinitialize
  • Check LLM provider configuration with python main.py status

Large file warnings:

  • Adjust max_file_size in .mycode/context/rules.cline
  • Add specific files to exclude patterns
  • Use .gitignore patterns 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


Download files

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

Source Distribution

kodo_cli-0.1.0.tar.gz (43.7 kB view details)

Uploaded Source

Built Distribution

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

kodo_cli-0.1.0-py3-none-any.whl (36.3 kB view details)

Uploaded Python 3

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

Hashes for kodo_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c48bc48bb59a23ce6d2c61a1de206966aaabdc7df43487459f8377e2182d2ef8
MD5 487354bf9764009debfefcc2cc5215cc
BLAKE2b-256 82a94fd4c7dcf81ccd4fffc9cd82cf364310eeb7bcc4616a8c86b048bf8ef606

See more details on using hashes here.

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

Hashes for kodo_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed9cf2c1b64d09b206f0221548a7a5821ad4458074eedabcddb1f6e4c2ce77de
MD5 99f3507b8136b003a48722709d93b089
BLAKE2b-256 1c9ecddad07cb9c9426eb2fbaeefccb493c5a8eebe173335ed26a1929e0ace29

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