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:

  1. Set an environment variable:

    export ANTHROPIC_API_KEY=your-api-key
    
  2. 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

OptionDescription
[prompt]Main prompt text (positional argument)
-i, --interactiveRun in interactive mode, asking for prompts
-f, --fileRead prompt from a specified file
-l, --logLevelSet minimum logging level (debug, verbose, info, warn, error)
--tokenUsageOutput token usage at info log level
--headlessUse browser in headless mode with no UI showing (default: true)
--userSessionUse user's existing browser session instead of sandboxed session (default: false)
--pageFilterMethod to process webpage content (simple, none, readability)
-h, --helpShow help
-V, --versionShow version number

Available Tools

MyCoder has access to a variety of tools that enable it to perform complex tasks:

ToolDescriptionUse Case
readFileReads file content with size limitsUnderstanding project code and configuration
updateFileCreates or updates filesImplementing features, fixing bugs, refactoring code
shellStartExecutes shell commandsRunning builds, tests, installations, git operations
shellMessageInteracts with running shell processesWorking with interactive CLIs, monitoring long-running processes
fetchMakes HTTP requestsAccessing APIs, downloading resources
browseStartStarts a browser sessionResearching documentation, exploring solutions
browseMessagePerforms actions in an active browserNavigating websites, extracting information
subAgentCreates specialized sub-agentsHandling complex tasks in parallel
userPromptRequests input from the userGetting clarification or confirmation
respawnResets agent contextStarting fresh after completing a subtask
sleepPauses executionWaiting for asynchronous processes to complete
sequenceCompleteFinalizes the agent's workReturning 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:

  1. Ensure your project has a descriptive README.md
  2. Be specific about file paths in your prompts
  3. Explain any non-standard patterns or conventions

Task Complexity

For optimal results with complex tasks:

  1. Start with smaller, well-defined tasks
  2. Build up to more complex changes as you get comfortable
  3. For major refactorings, consider a step-by-step approach

Security Considerations

Since MyCoder can execute any command on your system:

  1. Review the actions MyCoder proposes before confirming them
  2. Use in trusted codebases and environments
  3. Be cautious when allowing network access or third-party tool installation

Limitations

As a research preview, MyCoder has some limitations:

  1. Context Window: Limited by Claude's context window size, which may affect reasoning about very large codebases

  2. Language Model Limitations: May occasionally produce hallucinations or misunderstandings

  3. Tool Constraints: Some tools have built-in constraints (like file size limits) to prevent resource issues

  4. External Dependencies: Requires an internet connection to access the Claude API

Getting Help

If you encounter issues or have questions about MyCoder:

  1. Join the MyCoder Discord community for support
  2. Check the GitHub repository for documentation and updates
  3. 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.