Documentation Index
Fetch the complete documentation index at: https://mintlify.com/21st-dev/1code/llms.txt
Use this file to discover all available pages before exploring further.
Overview
1Code uses chat sessions to interact with AI coding agents like Claude Code and Codex. Each chat can run in its own isolated worktree, keeping your work organized and your main branch safe.Before You Start
Set up API keys
Set up API keys
You’ll need API keys for the agents you want to use:
- Claude Code: Anthropic API key with Claude access
- Codex: 21st.dev API key (get one at 1code.dev)
Choose or create a project
Choose or create a project
1Code works with git repositories. You can:
- Open an existing local repository
- Clone a repository from GitHub
- Create a new project directory
Creating Your First Chat
Open the new chat form
Click the New Chat button (Plus icon) in the top-left corner, or press
Cmd+N (macOS) / Ctrl+N (Windows/Linux).Select your project
Click the Project dropdown to choose where the agent will work:
- Select an existing project from the list
- Click Add Project to browse for a new repository
- Recent projects appear at the top for quick access
Choose your work mode
Select how the agent will work:
- Worktree (Recommended): Creates an isolated git worktree on a new branch. Safe for experimentation.
- Branch: Works directly on an existing branch in your main repository
- Local: Works directly in your project without git isolation (not recommended)
Pick a base branch (Worktree mode only)
If using Worktree mode, choose which branch to start from:
- The default branch (usually
mainormaster) is selected automatically - Click the branch selector to choose a different starting point
- Your new worktree will branch off from this point
Select your agent and model
Choose the AI agent to work with:Claude Code
- Best for: Complex refactoring, architecture changes, full-stack development
- Models: Claude 3.5 Sonnet, Claude 3 Opus, Claude 3 Haiku
- Best for: Fast iteration, specific bug fixes, quick features
- Models: Various Codex reasoning models with different thinking levels
Extended Thinking is enabled by default for supported models, allowing deeper reasoning on complex tasks.
Write your first prompt
In the input field, describe what you want the agent to do:Good prompts:
- “Add user authentication using JWT tokens”
- “Fix the bug causing crashes when uploading large files”
- “Refactor the payment service to use async/await”
- Be specific about what you want changed
- Mention relevant files or areas if you know them
- Describe the desired outcome, not just the implementation
Optional: Add context
Help the agent understand your project better:Attach files: Click the paperclip icon to attach:
- Code files to reference
- Screenshots of bugs or UI
- Documentation files
- Error logs or stack traces
@ to reference:@file: Mention specific files from your project@mcp: Access MCP server tools if configured
Understanding the Chat Interface
Message Types
User Messages
Your prompts and instructions appear on the right side with a blue accent.
Assistant Messages
Agent responses appear on the left with tool calls, file edits, and explanations.
System Messages
Status updates about worktree creation, git operations, and background tasks.
Error Messages
Red-colored alerts when something goes wrong, with suggestions for fixes.
Tool Execution Display
As the agent works, you’ll see real-time tool usage:- Bash commands: Terminal output with syntax highlighting
- File edits: Side-by-side diffs showing before/after
- File reads: Quick previews of files the agent is examining
- Web searches: Results from searching documentation or references
Git Activity Badges
Git operations appear as badges on messages:- Created branch: When a new worktree branch is created
- Committed: When changes are committed to git
- Pushed: When commits are pushed to remote
- Created PR: When a pull request is opened
Next Steps
Working with Worktrees
Learn how to manage multiple isolated development environments.
Git Integration
Master the built-in git client for commits, branches, and PRs.
Background Agents
Run agents in the cloud that continue working when you close your laptop.
Plan Mode
Use Plan Mode for complex tasks that need upfront planning.
Troubleshooting
Chat won't start - API key error
Chat won't start - API key error
Solution: Go to Settings > Models and verify your API keys are entered correctly.
- Claude Code needs an Anthropic API key
- Codex needs a 21st.dev API key
- Test the connection using the Test button
Worktree creation failed
Worktree creation failed
Common causes:
- Another git operation is in progress - wait and retry
- Git LFS is required but not installed - run
brew install git-lfs(macOS) or equivalent - Repository is locked - remove
.git/index.lockif no git operations are running
Agent seems stuck or slow
Agent seems stuck or slow
Check:
- Network connection if using Claude Code or Codex
- System resources - agent operations can be CPU intensive
- Background processes - git operations or dependency installs may be running
Can't select my project
Can't select my project
Solution:
- Make sure the directory is a valid git repository
- Try Add Project to browse and add it manually
- Check that you have read/write permissions for the directory
- For remote repositories, ensure they’re cloned locally first
Stuck on something? Join our Discord community or check the troubleshooting guide for more help.