MyCoder
MyCoder is an AI-powered coding assistant that helps you accomplish a wide range of coding tasks through natural language commands. It's designed to understand your project context, implement features, fix bugs, and transform code based on your instructions.
What is MyCoder?
MyCoder is a command-line tool that uses AI to help you with software development tasks. By understanding your project's structure and requirements, MyCoder can autonomously execute complex coding tasks that would typically require significant manual effort.
Currently available as a research preview, MyCoder is built to work alongside developers, enhancing productivity while maintaining full control over the development process.
Key Features
- AI-Powered: Leverages Anthropic's Claude API for intelligent decision-making
- Extensible Tool System: Includes tools for file operations, shell commands, web browsing, and more
- Parallel Execution: Can spawn sub-agents to work on different parts of a task simultaneously
- Self-Modification: Capable of modifying code, including its own codebase
- Smart Logging: Hierarchical, color-coded logging for clear visibility into actions
- Human-Compatible: Works with standard project structures without special formatting
Getting Started
Prerequisites
- OS: MacOS, Windows, or Linux
- Node.js >= 20.0.0
- An Anthropic API key
Installation
# Install globally
npm install -g mycoder
# Or use with npx
npx mycoder
Setting Up Your API Key
Before using MyCoder, you need to provide an Anthropic API key in one of two ways:
-
Set an environment variable:
export ANTHROPIC_API_KEY=your-api-key
-
Create a
.env
file in your working directory:ANTHROPIC_API_KEY=your-api-key
You can obtain an API key from Anthropic's website.
Basic Usage
Running with a Prompt
The simplest way to use MyCoder is to provide a natural language prompt:
mycoder "Fix all TypeScript build errors and ensure tests pass"
Interactive Mode
You can run MyCoder in interactive mode for ongoing conversation:
mycoder -i
Reading Prompts from Files
For complex tasks, you can prepare your prompt in a file:
mycoder --file=my-task-description.txt
Command Line Options
Option | Description |
---|---|
[prompt] | Main prompt text (positional argument) |
-i, --interactive | Run in interactive mode, asking for prompts |
-f, --file | Read prompt from a specified file |
-l, --logLevel | Set minimum logging level (debug, verbose, info, warn, error) |
--tokenUsage | Output token usage at info log level |
--headless | Use browser in headless mode with no UI showing (default: true) |
--userSession | Use user's existing browser session instead of sandboxed session (default: false) |
--pageFilter | Method to process webpage content (simple, none, readability) |
-h, --help | Show help |
-V, --version | Show version number |
Available Tools
MyCoder has access to a variety of tools that enable it to perform complex tasks:
Tool | Description | Use Case |
---|---|---|
readFile | Reads file content with size limits | Understanding project code and configuration |
updateFile | Creates or updates files | Implementing features, fixing bugs, refactoring code |
shellStart | Executes shell commands | Running builds, tests, installations, git operations |
shellMessage | Interacts with running shell processes | Working with interactive CLIs, monitoring long-running processes |
fetch | Makes HTTP requests | Accessing APIs, downloading resources |
browseStart | Starts a browser session | Researching documentation, exploring solutions |
browseMessage | Performs actions in an active browser | Navigating websites, extracting information |
subAgent | Creates specialized sub-agents | Handling complex tasks in parallel |
userPrompt | Requests input from the user | Getting clarification or confirmation |
respawn | Resets agent context | Starting fresh after completing a subtask |
sleep | Pauses execution | Waiting for asynchronous processes to complete |
sequenceComplete | Finalizes the agent's work | Returning final results and summaries |
Example Use Cases
MyCoder can help with a wide range of development tasks:
Code Migration & Updates
# Converting test frameworks
mycoder "Convert all Jest tests in the src/ directory to Vitest, updating any necessary configuration files and dependencies"
# Dependency updates
mycoder "Update all dependencies to their latest versions, handle any breaking changes, and ensure all tests pass"
Code Refactoring
# Class refactoring
mycoder "Refactor the UserService class in src/services/UserService.ts to use the repository pattern, update all files that use this class, and ensure tests pass"
# API modernization
mycoder "Convert all callback-based functions in the project to use async/await, update tests accordingly"
Feature Implementation
# CLI enhancement
mycoder "Add a new global --debug command line option that enables verbose logging throughout the application"
# New functionality
mycoder "Create a new caching system for API responses using Redis, including configuration options and unit tests"
Maintenance & Fixes
# Build fixes
mycoder "Fix all TypeScript build errors and ensure all tests pass"
# Test coverage
mycoder "Add unit tests for all untested functions in the src/utils directory, aiming for 80% coverage"
Documentation
# Documentation generation
mycoder "Generate comprehensive JSDoc documentation for all exported functions and update the API documentation in the docs/ directory"
# Architecture documentation
mycoder "Analyze the current codebase and create detailed architecture documentation including component diagrams and data flow"
Best Practices
Providing Context
MyCoder works best when it has clear context about your project:
- Ensure your project has a descriptive README.md
- Be specific about file paths in your prompts
- Explain any non-standard patterns or conventions
Task Complexity
For optimal results with complex tasks:
- Start with smaller, well-defined tasks
- Build up to more complex changes as you get comfortable
- For major refactorings, consider a step-by-step approach
Security Considerations
Since MyCoder can execute any command on your system:
- Review the actions MyCoder proposes before confirming them
- Use in trusted codebases and environments
- Be cautious when allowing network access or third-party tool installation
Limitations
As a research preview, MyCoder has some limitations:
-
Context Window: Limited by Claude's context window size, which may affect reasoning about very large codebases
-
Language Model Limitations: May occasionally produce hallucinations or misunderstandings
-
Tool Constraints: Some tools have built-in constraints (like file size limits) to prevent resource issues
-
External Dependencies: Requires an internet connection to access the Claude API
Getting Help
If you encounter issues or have questions about MyCoder:
- Join the MyCoder Discord community for support
- Check the GitHub repository for documentation and updates
- Use the
--help
command line option for quick reference
Warning: MyCoder can execute any command on your system that you ask it to. It can delete files, install software, and send data to remote servers. By using this tool, you acknowledge that the authors and contributors are not responsible for any damage that may occur as a result of using this tool.