A Go-based CLI tool that provides a one-command workflow to isolate AI-generated "memory" files (GEMINI.md, CLAUDE.md etc) onto a dedicated Git branch with worktree and easy sync.
- Creates an orphan branch for AI memory files(GEMINI.md, CLAUDE.md, .cursor/rules/)
- Sets up a Git worktree for isolated file management
- Automatically updates .gitignore
- Separate pull/push commands for flexible workflow
- Support for multiple AI agents (Cline, Claude, Gemini, Cursor)
- Configuration via YAML, JSON, or TOML
brew tap trknhr/homebrew-tap
brew install ai-docscurl -sSL https://raw.githubusercontent.com/trknhr/ai-docs/main/install.sh | shgo install github.com/trknhr/ai-docs@latestgit clone https://github.com/trknhr/ai-docs
cd ai-docs
go build -o ai-docs .ai-docs init [--config path/to/.ai-docs.config.yml] [--force] [--dry-run] [-v]This command:
- Reads configuration (defaults to
.ai-docs.config.yml) - Creates an orphan branch (e.g.,
@ai-docs/username) - Copies AI memory files to the branch
- Creates initial commit and pushes
- Returns to main branch
- Updates .gitignore
- Adds a worktree at
.ai-docs
⚠️ Important Notices:
- If the config file doesn't exist,
ai-docs initwill create a sample.ai-docs.config.ymland exit. You'll need to review/edit the config file and runai-docs initagain.- If your AI memory files (like
CLAUDE.md,memory-bank/, etc.) are not yet committed to any branch, they will be moved to the@ai-docs/usernamebranch and will no longer exist in your main branch after runninginit. This is intentional to keep your main branch clean. You can useai-docs pullto copy these files back to your main branch if needed.
ai-docs push [--config path/to/config.yml] [--dry-run] [-v]Copies local AI docs to the worktree, commits and pushes ( to the @ai-docs/username branch ) changes to remote.
ai-docs pull [--config path/to/config.yml] [--overwrite] [--dry-run] [-v]Pulls latest changes from remote AI docs branch and copies them to your local project. Use --overwrite to replace existing local files.
ai-docs clean [--config path/to/config.yml] [--force] [--dry-run] [-v]Removes the worktree and branch after confirmation.
Create .ai-docs.config.yml in your project root:
userName: "" # fallback when git config user.name is empty
mainBranchName: "main"
docBranchNameTemplate: "@ai-docs/{userName}" # {userName} is replaced at runtime
docWorktreeDir: ".ai-docs"
aIAgentMemoryContextPath:
Cline: "memory-bank"
Claude: "CLAUDE.md"
Gemini: "GEMINI.md"
Cursor: ".cursor/rules"
ignorePatterns:
- "/memory-bank/"
- "CLAUDE.md"
- "GEMINI.md"
- "/.cursor/rules"- Git 2.7.0+ (for worktree support)
- Go 1.24+ (for building from source)
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Copyright 2025 Teruo Kunihiro