English | 简体中文
Docker-based Claude Code environment with automated Git/PR setup.
⚠️ Security Notice: This container runs with--dangerously-skip-permissionsby default, allowing Claude to execute commands without confirmation. Use only in isolated environments with trusted repositories.
Tired of approving every single command when pair programming with AI? Yet hesitant to grant full bypass permissions on your local machine? Every GitHub interaction requiring manual confirmation breaks your flow.
CodeMate solves this by running Claude Code in an isolated Docker container where it can operate freely without compromising your system. True pair programming starts here—let Claude focus on coding while you focus on the bigger picture.
- Automated repository cloning and PR management
- Pre-installed: Go, Node.js, Python, Rust, uv
- zsh with Oh My Zsh
- Persistent Claude configuration
- Built-in Claude Code skills for PR workflow automation
- Slack and Lark notifications when Claude stops (via
SLACK_WEBHOOK/LARK_WEBHOOK) - tmux session management with PR comment monitoring
- Docker
- GitHub CLI (
gh) authenticated - Anthropic API key
Run codemate --setup to create the required configuration files (global config in ~/.codemate/ and project .env).
Note:
gitis also required as a prerequisite — the script checks for it at startup.
On macOS, you need a Docker runtime since Docker doesn't run natively. Choose one:
- Docker Desktop - Official Docker GUI application
- Colima - Lightweight Docker runtime (recommended for CLI users)
Install codemate globally to use it from anywhere:
# Install directly to /usr/local/bin (requires sudo)
sudo curl -fsSL https://raw.githubusercontent.com/BoringHappy/CodeMate/main/codemate -o /usr/local/bin/codemate && sudo chmod +x /usr/local/bin/codemate
# Or install to ~/.local/bin without sudo (ensure ~/.local/bin is in your PATH)
curl -fsSL https://raw.githubusercontent.com/BoringHappy/CodeMate/main/codemate -o ~/.local/bin/codemate && chmod +x ~/.local/bin/codemate
# One-time global setup
codemate --setup
# Update to latest version
codemate --update# First time setup - creates global config and project .env
codemate --setup
# Run with explicit repo URL
codemate --repo https://github.com/your-org/your-repo.git --branch feature/xyz
# Run with branch name (auto-detects repo from: --repo > .env > current directory's git remote)
codemate --branch feature/your-branch
# Run with a custom PR title
codemate --branch feature/your-branch --pr-title "My feature title"
# Run with existing PR
codemate --pr 123
# Run with GitHub issue (creates branch issue-NUMBER)
codemate --issue 456
# Fork-based workflow (for open-source contributions)
codemate --repo https://github.com/yourname/project.git --upstream https://github.com/maintainer/project.git --branch fix-bug
codemate --repo https://github.com/yourname/project.git --upstream https://github.com/maintainer/project.git --issue 789
# Skip PR creation on new branches (useful for forks or draft work)
codemate --branch feature/xyz --no-pr
# Run with custom volume mounts (optional)
codemate --branch feature/xyz --mount ~/data:/data
# Run with initial query to Claude
codemate --branch feature/xyz --query "Please review the code and fix any issues"
# Build and run from local Dockerfile
codemate --build --branch feature/xyz
# Build with custom Dockerfile path and tag
codemate --build -f ./custom/Dockerfile --tag my-codemate:v1 --branch feature/xyz
# For Chinese users: Use DaoCloud mirror for faster image pulls
codemate --branch feature/xyz --image ghcr.m.daocloud.io/boringhappy/codemate:latestThe setup command will:
- Create global configuration in
~/.codemate/(Claude config and settings) - Create project-specific
.envfile in your current directory - Prompt you for Anthropic API token and other settings
Configuration Structure:
- Global config:
~/.codemate/- Claude configuration and settings (shared across all projects) - Project config:
.envin each project directory - Project-specific secrets and settings
Repository URL Resolution: The script determines the repository URL in this priority order:
--repocommand-line argument (highest priority)GIT_REPO_URLenvironment variable or.envfile- Current directory's git remote origin URL (auto-detected)
- If none are available, an error is raised
Use --mount <host-path>:<container-path> to mount additional directories or files. Useful for sharing data, configurations, or credentials with the container. Multiple --mount options can be specified.
For development or customization, you can build CodeMate from a local Dockerfile:
# Build from default Dockerfile in current directory
codemate --build --branch feature/xyz
# Build from custom Dockerfile path
codemate --build -f ./path/to/Dockerfile --branch feature/xyz
# Build with custom image tag
codemate --build --tag my-codemate:dev --branch feature/xyz
# Combine all options
codemate --build -f ./custom/Dockerfile --tag my-codemate:v1 --branch feature/xyzOptions:
--build- Build Docker image from local Dockerfile before running-f, --dockerfile PATH- Path to Dockerfile (default:docker/Dockerfile)--tag TAG- Image tag for local build (default:codemate:local)- Note: Only works with
--build. To use a pre-built image, use--imageinstead
- Note: Only works with
When --build is used:
- The script builds the Docker image from the specified Dockerfile
- The default image tag is
codemate:local(unless--tagis specified) - The locally built image is used instead of pulling from the registry
- The
--imageoption is ignored when--buildis used
Adding Custom Toolchains:
To add additional toolchains or tools to the container, create a custom Dockerfile that extends the base image:
# Custom Dockerfile with additional toolchains
FROM ghcr.io/boringhappy/codemate:latest
# Add Java
RUN apt-get update && apt-get install -y openjdk-17-jdk maven
# Add PHP
RUN apt-get install -y php php-cli php-mbstring composer
# Add Ruby
RUN apt-get install -y ruby-full
RUN gem install bundler
# Add any other tools you need
RUN apt-get install -y postgresql-client redis-tools
# Clean up
RUN apt-get clean && rm -rf /var/lib/apt/lists/*Then build and run with your custom Dockerfile:
codemate --build -f ./Dockerfile.custom --tag codemate:custom --branch feature/xyzNote: When using
codemate, these variables are handled automatically through the setup process. This reference is primarily for advanced Docker usage or troubleshooting.
| Variable | Required | Description |
|---|---|---|
GIT_REPO_URL |
No | Repository URL (defaults to current repo's remote) |
UPSTREAM_REPO_URL |
No | Upstream repository URL (for fork-based workflows) |
BRANCH_NAME |
No | Branch to work on |
PR_NUMBER |
No | Existing PR number to work on |
PR_TITLE |
No | PR title for newly created PRs |
ISSUE_NUMBER |
No | GitHub issue number (creates branch issue-NUMBER and uses /issue:read-issue skill) |
NO_PR |
No | Set to true to skip PR creation and branch push for new branches |
CODEMATE_GITHUB_TOKEN |
Auto | GitHub personal access token (defaults to gh auth token if not provided) |
GIT_USER_NAME |
Auto | Git commit author name (defaults to git config user.name if not provided) |
GIT_USER_EMAIL |
Auto | Git commit author email (defaults to git config user.email if not provided) |
CODEMATE_IMAGE |
No | Custom image (default: ghcr.io/boringhappy/codemate:latest) |
SLACK_WEBHOOK |
No | Slack Incoming Webhook URL for notifications when Claude stops (only sent if new commits exist) |
LARK_WEBHOOK |
No | Lark Incoming Webhook URL for notifications when Claude stops (only sent if new commits exist) |
ANTHROPIC_AUTH_TOKEN |
No | Anthropic API token (for custom API endpoints) |
ANTHROPIC_BASE_URL |
No | Anthropic API base URL (for custom API endpoints) |
QUERY |
No | Initial query to send to Claude after startup |
DEFAULT_MARKETPLACES |
No | Comma-separated default plugin marketplaces (default: vercel-labs/agent-browser,BoringHappy/CodeMate) |
DEFAULT_PLUGINS |
No | Comma-separated default plugins (default: agent-browser@agent-browser,git@codemate,pr@codemate,dev@codemate,issue@codemate,workspace@codemate,pm@codemate) |
CUSTOM_MARKETPLACES |
No | Comma-separated list of custom plugin marketplace repositories (e.g., username/repo1,org/repo2) |
CUSTOM_PLUGINS |
No | Comma-separated list of custom plugins to install (e.g., plugin1@marketplace1,plugin2@marketplace2) |
CodeMate uses a separate base image (codemate-base) that is rebuilt weekly to keep system packages and development tools up-to-date.
On startup, the container:
- Configures git user from environment variables
- Authenticates GitHub CLI with token
- Installs/updates plugins from configured marketplaces
- Clones/updates repository to
/home/agent/<repo-name> - Checks out specified branch or PR
- Creates a draft PR if working on a new branch (unless
--no-pror fork workflow) - Starts Claude Code in a tmux session with
--dangerously-skip-permissionsflag - Sends initial query to Claude if
--queryis provided - Runs a cron job every minute to monitor the PR for new comments, CI failures, and review-ready state
CodeMate comes with pre-installed skills from the agent-browser. These skills are automatically available when you start the container and provide workflow automation for Git, PR management, and browser interactions.
Git Plugin (git@codemate):
| Command | Description |
|---|---|
/git:commit |
Stage all changes, create a commit with a meaningful message, and push to remote |
PR Plugin (pr@codemate):
| Command | Description |
|---|---|
/pr:get-details |
Fetch PR information including title, description, file changes, and review comments |
/pr:create |
Create a pull request from the current branch; supports standard and fork workflows |
/pr:fix-comments |
Read PR review comments, fix the issues, commit changes, and reply to comments |
/pr:update |
Update PR title and/or summary. Use --summary-only to update only the summary |
/pr:ack-comments |
Acknowledge PR issue comments by adding 👀 reaction |
Issue Plugin (issue@codemate):
| Command | Description |
|---|---|
/issue:read-issue |
Read GitHub issue details including title, description, labels, and comments |
/issue:refine-issue |
Rewrite issue body to match template (plan-then-execute, requires approval) |
/issue:triage-issue |
Apply priority and category labels based on content analysis |
/issue:classify-issue |
Post clarifying questions for ambiguous issues and add needs-more-info label |
PM Plugin (pm@codemate):
| Command | Description |
|---|---|
/pm:spec-list |
List all spec GitHub Issues with their status and task counts |
/pm:spec-init <name> |
Start a guided brainstorming session to create a new spec as a GitHub Issue |
/pm:spec-plan <issue-number> [--granularity micro|pr|macro] |
Post a technical implementation plan as a comment on the spec issue; user must 👍 the comment to approve before decomposing |
/pm:spec-decompose <issue-number> [--granularity micro|pr|macro] |
Create task sub-issues from the approved plan comment; requires 👍 reaction on the plan comment |
/pm:spec-status <issue-number> |
Show live progress summary from GitHub Issues |
/pm:spec-next <issue-number> |
Find the next actionable task based on dependencies |
/pm:spec-done <issue-number> |
Summarize changes, post a done comment, close the spec issue, and add done label |
/pm:spec-abandon <issue-number> |
Close the spec issue and optionally its linked task issues |
The --granularity flag controls task sizing:
micro— 0.5–1 day tasks (fine-grained, commit-level)pr— 1–3 day tasks, ~200–400 LOC per PR (default)macro— 3–7 day milestones / epics
Workspace Plugin (workspace@codemate):
| Command | Description |
|---|---|
/workspace:best-practice |
Bootstrap a repo with spec issue templates, labels, and PR template |
The workspace plugin also installs session lifecycle hooks:
- SessionStart — records session start time and current commit
- UserPromptSubmit — records each prompt submission timestamp
- Stop — checks for new commits, sends Slack/Lark notifications if
SLACK_WEBHOOKorLARK_WEBHOOKis set
Browser Plugin (agent-browser):
| Command | Description |
|---|---|
/agent-browser |
Automate browser interactions for web testing, form filling, screenshots, and data extraction |
You can extend CodeMate with your own custom plugins by adding them to your .env file:
# Override default marketplaces (optional)
DEFAULT_MARKETPLACES=vercel-labs/agent-browser,BoringHappy/CodeMate
# Override default plugins (optional)
DEFAULT_PLUGINS=agent-browser@agent-browser,git@codemate,pr@codemate,dev@codemate,issue@codemate,workspace@codemate,pm@codemate
# Set to empty to disable all defaults (optional)
DEFAULT_MARKETPLACES=
DEFAULT_PLUGINS=
# Add custom plugin marketplaces (comma-separated GitHub repo paths)
CUSTOM_MARKETPLACES=username/my-marketplace,org/another-marketplace
# Add custom plugins to install (comma-separated plugin names)
CUSTOM_PLUGINS=my-plugin@my-marketplace,another-plugin@my-marketplaceHow it works:
- By default, CodeMate installs marketplaces from
DEFAULT_MARKETPLACESand plugins fromDEFAULT_PLUGINS - You can override these defaults by setting the environment variables to different values
- You can disable all defaults by setting them to empty strings
- Custom marketplaces and plugins are added after defaults during container startup
- All plugins become available as skills (e.g.,
/my-plugin:command) - The setup is idempotent - already installed plugins are skipped
Example:
If you have a custom plugin marketplace at github.com/myorg/my-plugins with a plugin called deploy, you would configure:
CUSTOM_MARKETPLACES=myorg/my-plugins
CUSTOM_PLUGINS=deploy@my-pluginsThen use it in Claude Code:
/deploy:productionCodeMate supports starting work directly from a GitHub issue using the --issue flag. This workflow automatically:
- Creates a branch named
issue-{NUMBER}(or uses existing branch if it already exists) - Sends an initial query to Claude to read and address the issue using
/issue:read-issueskill - Claude analyzes the issue details (title, description, labels, comments)
- Claude implements the requested changes
- Creates a PR when you're ready to commit
Example:
# Start working on issue #456
codemate --issue 456This is equivalent to:
codemate --branch issue-456 --query "Please use /issue:read-issue skill to read and address issue #456"When to use:
- Starting new work from a GitHub issue
- Implementing feature requests tracked as issues
- Fixing bugs documented in issues
CodeMate automatically monitors PR comments and notifies Claude when new feedback arrives. A cron job runs every minute to check for new comments. The monitor only acts when Claude's session is idle (stopped).
Each cron run checks the following in priority order (only one action is taken per run):
- CI failures — if a CI check fails on the current branch, Claude is sent the failure logs and asked to fix them
- PR ready for review — when a draft PR is marked ready for review, Claude is asked to update the PR title and description via
/pr:updateand add apr-updatedlabel - Issue comments — new general PR comments (Conversation tab) without a 👀 reaction are forwarded to Claude
- Review comments — unresolved inline code comments (Files changed tab) trigger
/pr:fix-comments
GitHub PRs have two types of comments that CodeMate monitors:
| Type | Location | API Endpoint | Use Case |
|---|---|---|---|
| Review Comments | Files changed tab (inline) | /pulls/{pr}/comments |
Code-specific feedback on particular lines |
| Issue Comments | Conversation tab | /issues/{pr}/comments |
General discussion, questions, requests |
When someone leaves a review comment (inline code comment):
- Monitor detects unresolved review comments
- Sends message to Claude:
"Please use /fix-comments skill to address comments" - Claude uses
/pr:fix-commentsskill to:- Read the feedback
- Make code changes
- Commit and push
- Reply with "Claude Replied: ..." to mark as resolved
When someone leaves an issue comment (general PR comment):
- Monitor detects new issue comments without 👀 reaction
- Sends the actual comment content to Claude
- Claude processes the request
- Claude uses
/pr:ack-commentsskill to add 👀 reaction - Future runs skip comments with 👀 reaction
Comments are filtered out if they:
- Are posted by bots (login ending in
[bot]) - Start with "Claude Replied:" (already handled)
- Have 👀 reaction (already acknowledged)
Create .github/PULL_REQUEST_TEMPLATE.md in your target repository to standardize PR descriptions:
## Summary
<!-- Brief description of changes -->
## Test Plan
<!-- How to verify the changes -->
## Checklist
- [ ] Tests added/updated
- [ ] Documentation updated- Run CodeMate only on trusted repositories
- Use short-lived GitHub tokens with minimal scopes
- Avoid mounting sensitive host directories
- Review changes before merging PRs created by Claude
MIT