Overview
Forge creates a specific directory structure to organize tasks, worktrees, configuration, and data. Understanding this structure helps you work effectively with Forge.Directory Structure
Always add
.forge/ to .gitignore! This directory contains:- API keys and secrets
- Local database
- Temporary worktrees
- Execution logs
The .forge/ Directory
Configuration Files
Main configuration file containing LLM settings, OAuth tokens, and preferences
SQLite database storing:
- Projects and tasks
- Task attempts and results
- Execution history
- User preferences
This file is created automatically on first run. Backup regularly if you want to preserve history!
Worktrees Directory
Contains Git worktrees for each task attemptEach worktree is a complete copy of your repository at a specific commit, isolated from your main branch.
Execution logs for debugging and audit trail
Git Worktrees Explained
What Are Worktrees?
Git worktrees allow multiple working directories from the same repository. Forge uses this for task isolation.Why Worktrees?
Complete Isolation
Each task works in its own environment - no conflicts!
Parallel Execution
Run multiple AI agents simultaneously on different tasks
Safe Experimentation
Try risky changes without affecting your main codebase
Easy Comparison
Compare different approaches side-by-side
How It Works
1
Create Task
You create a task in Forge: “Add user authentication”
2
Forge Creates Worktree
3
AI Works in Isolation
Claude modifies files in
.forge/worktrees/task-1-auth/Your main directory is untouched4
Review Changes
Compare worktree with main branch:
5
Merge When Ready
If you approve:
Database Schema
The.forge/forge.db SQLite database contains:
Projects Table
Tasks Table
Attempts Table
Backup & Restore
Backing Up Forge Data
Restoring From Backup
Restoring worktrees requires active Git branches. Usually better to just restore config and database.
Cleanup & Maintenance
Clean Old Worktrees
Clean Old Logs
Compact Database
Complete Clean
This deletes all task history, configurations, and worktrees. Backup first!
Multi-User Scenarios
Personal Projects
Standard setup - one developer, one Forge instance
Team Projects
Each team member has their own.forge/ directory:
Add
.forge/ to .gitignore so team members don’t conflictShared Forge Instance (Advanced)
For teams sharing one Forge deployment:Best Practices
Version Control .gitignore
.gitignore
Document Structure
Add a README explaining Forge setup:
Regular Backups
Clean Worktrees
Let Forge auto-cleanup, or manually:
Troubleshooting
Worktree conflicts
Worktree conflicts
Error: “fatal: ‘task-1’ is already checked out at ‘.forge/worktrees/task-1’”Solution:
Database locked
Database locked
Error: “database is locked”Solution:
- Close all Forge instances
- Check for zombie processes:
ps aux | grep forge - Kill if needed:
pkill -f forge - Restart Forge
Missing config.json
Missing config.json
Error: “Configuration file not found”Solution:
Disk space issues
Disk space issues
Error: “No space left on device”Solution:
Worktrees accumulate. Clean them:

