Add your description here
Project description
erk
erk is a CLI tool for plan-oriented agentic engineering.
For the philosophy and design principles behind erk, see The TAO of erk.
User Setup
Prerequisites
Ensure you have these tools installed:
python(3.10+)claude- Claude Code CLIuv- Fast Python environment managementgt- Graphite for stacked PRsgh- GitHub CLI
Initialize Erk
erk init
This command:
- Prompts for worktrees root directory (where all worktrees are stored)
- Creates global config at
~/.erk/config.toml - Detects Graphite (
gt) availability for branch creation - Creates repo-specific
config.tomlwith preset selection (auto,generic,dagster) - Offers to add
.env,.erk/scratch/, and.impl/to.gitignore - Shows shell integration setup instructions (completion + auto-activation)
Shell Integration
erk init will display shell integration instructions to add to your .zshrc or .bashrc. Copy these instructions manually - erk doesn't modify your shell config automatically.
Why manual setup? Shell integration is essential for the core workflow: it enables commands such as erk br co and erk wt co to change your terminal's directory and activate the correct Python environment. Without it, these commands run in a subprocess and have no effect on your shell. We ask you to add it manually so you stay in control of your shell configuration.
To view the instructions again later: erk init --shell
Or append directly:
erk init --shell >> ~/.zshrc # or ~/.bashrc
Verify Setup
Run the doctor command to verify your environment:
erk doctor
This checks that all prerequisites are installed and configured correctly.
Local Plan-Driven Workflow
The primary workflow: create a plan, save it, implement it, ship it. Often completes without touching an IDE.
Planning Phase
-
Start a Claude Code session:
claude
-
Enter plan mode and develop your plan
-
Save plan to GitHub issue (system prompts automatically after plan mode)
Implementation
-
Execute the plan:
erk implement <issue-number>
This creates a worktree, activates the environment, and runs Claude Code with the plan.
PR Submission
-
Submit the PR:
erk pr submit
Or from within Claude Code:
/erk:pr-submit
Code Review Iteration
-
Review PR feedback in GitHub
-
Address feedback:
/erk:pr-address -
Repeat until approved
Landing
- Merge and clean up:
erk pr land
Note: This entire workflow—from planning through shipping—can happen without opening an IDE. You create plans, submit code, review feedback in GitHub, address it via Claude Code, and land.
Iteration Patterns
Quick Iteration
For rapid commits within a worktree:
/quick-submit
Commits all changes and submits with Graphite.
Rebasing and Stack Management
When your stack needs rebasing:
erk pr auto-restack --dangerous
Or from Claude Code: /erk:auto-restack
To fix merge conflicts during a rebase:
/erk:merge-conflicts-fix
Common Workflows
Auto-Restack: Intelligent Conflict Resolution
When working with stacked PRs, rebasing is a frequent operation. erk pr auto-restack automates this process with intelligent conflict resolution.
What it does:
- Runs
gt restackto rebase your stack onto the latest trunk - If conflicts occur, launches Claude Code with the
/erk:merge-conflicts-fixcommand - After resolution, automatically continues the restack process
- Repeats until the entire stack is cleanly rebased
Basic usage:
erk pr auto-restack --dangerous
From within Claude Code:
/erk:auto-restack
Note: The
--dangerousflag acknowledges that auto-restack invokes Claude with--dangerously-skip-permissions.
When to use it:
- After merging a PR that's below yours in the stack
- When trunk has been updated and you need to incorporate changes
- When Graphite shows your stack needs rebasing
- After running
erk pr landon a parent branch
How conflict resolution works:
When conflicts are detected, erk spawns a Claude Code session that:
- Identifies all conflicting files
- Analyzes the nature of each conflict (content vs import conflicts)
- Resolves conflicts while preserving the intent of both changes
- Stages resolved files and continues the rebase
Example scenario:
trunk ← feature-a ← feature-b ← feature-c (you are here)
If feature-a merges into trunk, running erk pr auto-restack --dangerous will:
- Rebase
feature-bonto the new trunk - Resolve any conflicts (with Claude's help if needed)
- Rebase
feature-conto the updatedfeature-b - Resolve any conflicts at this level too
The result: your entire stack is cleanly rebased with minimal manual intervention.
Checkout PR from GitHub
When reviewing or debugging a PR—whether from a teammate or a remote agent run—you can check it out directly using the PR number or URL from the GitHub page.
Basic usage:
# Using PR number
erk pr checkout 123
# Using GitHub URL (copy directly from browser)
erk pr checkout https://github.com/owner/repo/pull/123
This creates a local worktree for the PR branch and changes your shell to that directory.
Syncing with Graphite:
After checkout, sync with Graphite to enable stack management:
erk pr sync --dangerous
This registers the branch with Graphite so you can use standard gt commands (gt pr, gt land, etc.).
Note: The
--dangerousflag acknowledges that sync invokes Claude with--dangerously-skip-permissions.
Complete workflow:
# 1. Checkout the PR (copy URL from GitHub)
erk pr checkout https://github.com/myorg/myrepo/pull/456
# 2. Sync with Graphite
erk pr sync --dangerous
# 3. Now iterate normally
claude
# ... make changes ...
/quick-submit
# 4. Or land when approved
erk pr land
When to use it:
- Reviewing a teammate's PR locally
- Debugging a PR created by remote agent execution
- Taking over a PR that needs local iteration
- Running tests or making fixes on someone else's branch
Documentation Extraction
Erk supports extracting reusable documentation from implementation sessions into the docs/learned/ folder—a directory of agent-generated, agent-consumed documentation.
This documentation:
- Captures patterns discovered during implementation
- Gets loaded by future agent sessions via AGENTS.md routing
- Builds institutional knowledge over time
To extract documentation from a session:
/erk:create-extraction-plan
Remote Execution
For sandboxed, parallel execution via GitHub Actions:
-
Create a plan (via Claude Code plan mode)
-
Submit for remote execution:
erk plan submit <issue-number>
The agent runs in GitHub Actions and creates a PR automatically.
Debugging Remote PRs
When a remote implementation needs local iteration:
erk pr checkout <pr-number>
erk pr sync --dangerous
This checks out the PR into a local worktree for debugging and iteration.
Planless Workflow
For smaller changes that don't require formal planning:
-
Create a worktree:
erk wt create <branch-name>
-
Iterate normally in Claude Code
-
Submit PR:
erk pr submit
-
Merge and clean up:
erk pr land
File Locations
| Location | Contents |
|---|---|
.erk/ |
Erk configuration, scratch storage, session data |
.impl/ |
Implementation plans (at worktree root) |
.claude/ |
Claude Code commands, skills, hooks |
Gitignore
erk init automatically adds these entries to your .gitignore. If you ran erk init, this is already configured:
.erk/scratch/
.impl/
.impl/ contains temporary implementation plans that shouldn't be committed. .erk/scratch/ holds session-specific working files.
Plan Mode GitHub Integration
By default, erk modifies Claude Code's plan mode behavior. When you exit plan mode, erk prompts you to save the plan to GitHub as an issue before proceeding. This enables the plan-driven workflow where plans become trackable issues that can be implemented via erk implement <issue-number>.
To disable this behavior and use standard Claude Code plan mode:
erk config set github_planning false
To re-enable:
erk config set github_planning true
When disabled, exiting plan mode works exactly as it does in standard Claude Code.
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 erk-0.3.0.tar.gz.
File metadata
- Download URL: erk-0.3.0.tar.gz
- Upload date:
- Size: 1.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d07cdf758af90c364eeff6728cfdd6514cf0f958db00ad70b3d3d5012e0c745f
|
|
| MD5 |
46fb1249267405f568959e8b11a764a5
|
|
| BLAKE2b-256 |
da29f0ddad13eaee0f6b37ed8ce951e7773f81b7874bf83ec53f7e7183c62100
|
File details
Details for the file erk-0.3.0-py3-none-any.whl.
File metadata
- Download URL: erk-0.3.0-py3-none-any.whl
- Upload date:
- Size: 509.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6797e53a79cba50fa26f757aa16bd0d239d799199b9280650e132d6818ca305d
|
|
| MD5 |
d64b732b3a8bc04342df796dcac2638b
|
|
| BLAKE2b-256 |
ffa8c97bf3654516af25df90fdd5d31bd6c92ed4b46f239aec47969680d0e785
|