Thoughts Tool v2
A flexible thought management tool that helps developers organize notes and documentation across git repositories using filesystem mounts (mergerfs on Linux, fuse-t on macOS) with a three-space architecture.
What is Thoughts Tool?
Thoughts Tool creates a unified filesystem view of documentation through three distinct mount spaces:
- thoughts/ - Your personal workspace for work documents, plans, and research
- context/ - Team-shared documentation and context repositories
- references/ - Read-only external code repositories for reference
It automatically mounts and syncs git-backed directories, allowing you to access all your project notes, decisions, and documentation from a single location while keeping them versioned with their respective repositories.
Key Features
- 🗂️ Three-Space Architecture: Organized separation of thoughts, context, and references
- 🔄 Automatic Git Sync: Keep your documentation synchronized across repositories
- 🖥️ Cross-Platform: Works on Linux (mergerfs) and macOS (fuse-t)
- 📚 Reference Management: Read-only mounts for external code repositories
- 🌿 Branch-Based Work Organization: Automatic directory structure based on current branch
- 🔧 Repository Integration: Seamlessly integrates with existing git workflows
- 🎯 Worktree Support: Full support for git worktrees
- 🚀 Auto-Mount System: Automatic mount management for all three spaces
Installation
Prerequisites
Linux
- mergerfs installed (
apt install mergerfsoryum install mergerfs) - FUSE support enabled
- Git installed
macOS
- fuse-t installed (
brew install macos-fuse-t/homebrew-cask/fuse-t) - Git installed
Building from Source
# Clone the repository
# Build the project
# Install globally
Quick Start
1. Initialize Thoughts for Your Repository
This creates:
.thoughts/directory for configuration.thoughts-data/directory for mount storage- Three symlinks:
thoughts/,context/, andreferences/pointing to the mount spaces
2. Configure Your Thoughts Mount (optional)
Edit .thoughts/config.json to add your personal workspace repository:
3. Add Context Mounts
# Add a team documentation repository
4. Add Reference Repositories
# Add a reference repository (automatically organized by org/repo)
5. Update All Mounts
# Mount everything configured
# Sync all git repositories
6. Start Working
# Initialize a work directory for current branch
Usage
Command Structure
Available Commands
Core Commands
init- Initialize thoughts for a repositorysync [<mount>]- Sync specific mount or all with --allstatus- Show current mount status and configuration
Mount Management (Context Mounts)
mount add <source> <name>- Add a new context mountmount remove <name>- Remove a context mountmount list- List all configured mountsmount update- Update/refresh all active mountsmount clone <url> [<path>]- Clone a repository to local path
Reference Management
references add <url>- Add a reference repositoryreferences remove <url>- Remove a reference repositoryreferences list- List all configured referencesreferences sync- Clone missing reference repositories
Work Management
work init- Initialize work directory for current branchwork complete- Move current work to completed with date rangework list [--recent N]- List active and completed work directories
Configuration Management
config create- Create a new configurationconfig show- Display current configurationconfig edit- Edit configuration with $EDITORconfig validate- Validate configuration syntax
Configuration
Thoughts Tool uses a repository-based configuration system with automatic v1 to v2 migration support.
Configuration Structure
The configuration file (.thoughts/config.json) defines:
- thoughts_mount - Your personal workspace repository (optional)
- context_mounts - Team-shared documentation repositories
- references - External code repositories for reference
- mount_dirs - Directory names for the three spaces (defaults: thoughts, context, references)
v2 Configuration Example
Migration from v1
Automatic migration happens on the first write operation (e.g., thoughts init, thoughts mount add, thoughts references add):
- V1 configs are automatically converted to v2 format
- A timestamped backup is created if you have non-empty mounts or rules (
.thoughts/config.v1.bak-*.json) - Migration rules:
- Mounts with
sync: noneor paths starting withreferences/→ become references - Other mounts → become context mounts
- Rules field → dropped (preserved in backup only)
- Mounts with
- One-line message confirms migration with link to full guide
You can also explicitly migrate with:
For detailed migration instructions, see MIGRATION_V1_TO_V2.md.
Architecture
Three-Space Design
The tool organizes all mounts into three distinct spaces:
-
Thoughts Space (
thoughts/)- Single git repository for personal work
- Organized by branch name with
completed/directory for archives - Supports subpath mounting for monorepo scenarios
-
Context Space (
context/)- Multiple team-shared repositories
- Each mount gets its own subdirectory
- Full read-write access for collaboration
-
References Space (
references/)- Read-only external code repositories
- Auto-organized by
{org}/{repo}structure - Never synced to prevent accidental modifications
Platform Abstraction
The tool automatically detects your platform and uses the appropriate mount technology:
- Linux: Uses mergerfs for high-performance union filesystem
- macOS: Uses fuse-t for FUSE support on Apple Silicon and Intel Macs
Mount Resolution
- Uses type-safe
MountSpaceenum for mount identification - Resolves to unique paths under
.thoughts-data/ - Handles automatic cloning for missing repositories
- Maintains mappings in
~/.thoughts/repos.json
Git Integration
- Full support for worktrees (see Git Worktree Support section)
- Automatic detection of repository boundaries
- Smart sync strategies (auto for thoughts/context, none for references)
- Branch-based work organization
Git Worktree Support
thoughts_tool automatically detects and handles git worktrees. When you run thoughts init in a worktree:
- It detects you're in a worktree
- Verifies the main repository is initialized
- Creates a symlink to share the main repository's mounts
- No duplicate FUSE mounts are created
Usage
# Initialize main repository first
# Create a worktree
# Initialize the worktree (shares main repo's mounts)
How It Works
Worktrees use a simple symlink approach:
.thoughts-data-> Points to main repository's.thoughts-data- The
thoughts,context, andreferencessymlinks are already tracked in git
This ensures:
- No duplicate mounts
- Consistent access to all three spaces across worktrees
- Automatic cleanup when worktree is removed
Development
Building and Testing
# Run checks (fmt + clippy)
# Run tests
# Build the project
# Format code
# Output mode variants
OUTPUT_MODE=normal OUTPUT_MODE=verbose
# Run specific test types via cargo
THOUGHTS_INTEGRATION_TESTS=1
Project Structure
thoughts_tool/
├── src/
│ ├── commands/ # CLI command implementations
│ ├── config/ # Configuration management
│ ├── git/ # Git integration
│ ├── mount/ # Mount implementations
│ ├── platform/ # Platform detection and abstraction
│ └── utils/ # Utility functions
├── tests/ # Integration tests
└── justfile # Build automation
Advanced Features
Branch Protection
All branch-specific workspace operations are blocked on 'main' and 'master' branches. Create a feature branch first, then re-run:
Legacy weekly directories (e.g., 2025-W01/) are automatically archived to completed/ on first run. If a completed item already exists with the same name, a -migrated suffix will be used to avoid collisions.
Branch-agnostic commands like thoughts work list and thoughts references list remain available on main.
Work Organization
The work commands help organize your documentation by branch:
# On feature branch - creates thoughts/my-feature/
# Complete work - moves to thoughts/completed/2025-01-15_to_2025-01-22_my-feature/
Each work directory includes:
research/- Investigation notes and findingsplans/- Design documents and implementation plansartifacts/- Generated files, diagrams, exportsmanifest.json- Metadata about the work session
Reference Repository Management
References are read-only external repositories organized by org/repo:
# Add multiple references
# They mount to:
# references/rust-lang/rust/
# references/tokio-rs/tokio/
# Sync all references (clones if missing)
Subpath Mounting
Mount specific subdirectories from larger repositories:
Troubleshooting
Mount Permission Issues
If you encounter permission errors:
- Ensure FUSE is properly installed and configured
- Check that your user has permission to mount filesystems
- On Linux, you may need to add your user to the
fusegroup
Platform Detection Failed
The tool will inform you if required mount utilities are missing:
- Linux: Install mergerfs
- macOS: Install fuse-t via Homebrew
Git Sync Conflicts
When sync conflicts occur:
- The tool will notify you of conflicts
- Resolve conflicts in the affected repository
- Run
thoughts syncagain
Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.
Development Setup
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests:
just test - Format code:
just fmt - Submit a pull request
License
MIT - See LICENSE in the root of the repository.
Acknowledgments
Built with excellent Rust libraries: