A CLI application for managing Claude Code configurations across projects.
ctx-tool helps you manage Claude Code configurations by syncing them from the PRPs-agentic-eng repository to your local projects or global configuration.
go install github.com/doodleEsc/ctx-tool@latestOr build from source:
git clone https://github.com/doodleEsc/ctx-tool
cd ctx-tool
go build -o ctx-toolctx-tool follows the XDG Base Directory Specification for configuration file management, providing better organization and cross-platform compatibility.
Configuration files are searched in the following priority order:
-
XDG Config Directory (highest priority):
- Linux/Unix:
~/.config/ctx-tool/config.yaml - macOS:
~/Library/Application Support/ctx-tool/config.yaml - Windows:
%APPDATA%\ctx-tool\config.yaml
- Linux/Unix:
-
Legacy Home Directory:
~/.ctx-tool.yaml
-
Current Directory (lowest priority):
./.ctx-tool.yaml
# ctx-tool Configuration File
version: "1.0"
# Repository configuration
repository:
url: "https://github.com/Wirasm/PRPs-agentic-eng"
branch: "development" # Use "main" for stable version
# Tracking file configuration
tracking:
file: ".ctx-tool-tracking.json"
# Allowed directories to sync
# These directories can be synced in full, and individual files within these
# directories can also be synced. Files outside these directories cannot be synced.
directories:
allowed:
- ".claude" # Allows: .claude directory and files like .claude/config.yaml
- "PRPs" # Allows: PRPs directory and files like PRPs/example.md
- "claude_md_files" # Allows: claude_md_files directory and its files
# Behavior configuration
behavior:
backup_on_conflict: true # Create .backup files when overwriting
verify_md5: true # Check MD5 before overwriting files
clean_empty_dirs: true # Remove empty directories on uninstallWhen syncing individual files, ctx-tool verifies that the file path is within one of the allowed directories specified in your configuration:
# Allowed directories to sync
# These directories can be synced in full, and individual files within these
# directories can also be synced. Files outside these directories cannot be synced.
directories:
allowed:
- ".claude" # Allows: .claude directory and files like .claude/config.yaml
- "PRPs" # Allows: PRPs directory and files like PRPs/example.md
- "claude_md_files" # Allows: claude_md_files directory and its filesExamples:
- ✅
.claude/config.yaml- allowed (in .claude directory) - ✅
.claude/commands/review.md- allowed (in .claude subdirectory) - ✅
PRPs/templates/example.md- allowed (in PRPs directory) - ✅
claude_md_files/guide.md- allowed (in claude_md_files directory) - ❌
README.md- not allowed (not in any allowed directory) - ❌
scripts/test.sh- not allowed (scripts directory not in allowed list)
If you're using a legacy configuration file (.ctx-tool.yaml in your home directory or current directory), ctx-tool will automatically detect it and suggest migration to the XDG-compliant location.
To migrate manually:
-
Create the XDG config directory:
# Linux/Unix mkdir -p ~/.config/ctx-tool # macOS mkdir -p ~/Library/Application\ Support/ctx-tool # Windows mkdir %APPDATA%\ctx-tool
-
Copy your existing configuration:
# Linux/Unix cp ~/.ctx-tool.yaml ~/.config/ctx-tool/config.yaml # macOS cp ~/.ctx-tool.yaml ~/Library/Application\ Support/ctx-tool/config.yaml # Windows copy %USERPROFILE%\.ctx-tool.yaml %APPDATA%\ctx-tool\config.yaml
-
Remove the old configuration (optional):
rm ~/.ctx-tool.yaml
Configuration values can be overridden using environment variables with the CTX_TOOL_ prefix:
export CTX_TOOL_REPOSITORY_URL="https://github.com/your-org/your-repo"
export CTX_TOOL_REPOSITORY_BRANCH="main"Environment variables have the highest priority and will override any configuration file settings.
Install all available configurations:
ctx-tool add --allInstall specific directories:
ctx-tool add .claude PRPsYou can now sync individual files in addition to entire directories:
# Sync a single file
ctx-tool add .claude/commands/review.md
# Sync multiple files
ctx-tool add PRPs/example.md .claude/config.yaml
# Mix files and directories
ctx-tool add PRPs .claude/commands/custom.mdNote: Files must be within allowed directories (configured in config.yaml).
Remove previously installed configurations:
ctx-tool removeRemove with detailed output:
ctx-tool remove --verbose-c, --config: Specify a custom configuration file path-v, --verbose: Enable verbose output
# Use custom config file
ctx-tool --config /path/to/custom/config.yaml add --all
# Install with verbose output
ctx-tool --verbose add --allSettings are applied in the following order (highest to lowest priority):
- Environment Variables (
CTX_TOOL_*) - XDG Configuration File (
~/.config/ctx-tool/config.yaml) - Legacy Configuration Files (
~/.ctx-tool.yamlor./.ctx-tool.yaml) - Default Values
ctx-tool maintains a tracking file (.ctx-tool-tracking.json) to keep track of installed files. This enables:
- Conflict detection and backup creation
- Clean removal of installed files
- MD5 verification to prevent unnecessary overwrites
ctx-tool works on:
- Linux (follows XDG specification)
- macOS (uses Application Support directory)
- Windows (uses APPDATA directory)
All paths are automatically adjusted for the target platform.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For questions, issues, or feature requests, please visit the GitHub repository.