task2habitica-rs
Bidirectional sync tool between Taskwarrior and Habitica.
Features
- ✅ Bidirectional sync between Taskwarrior and Habitica
- ✅ Automatic task creation, updates, and completion tracking
- ✅ Task difficulty mapping (trivial/easy/medium/hard)
- ✅ Support for todos and dailies
Requirements
- Rust 1.70 or higher
- Taskwarrior 3.4.2 or higher
- Habitica account
Installation
Using Cargo (Recommended)
The setup command will interactively:
- Install Taskwarrior hook scripts
- Configure required UDAs in your
.taskrc - Prompt for your Habitica credentials
- Validate your API connection
- Add credentials to your shell profile
From Source
# Clone the repository
# Build the release binary
# Install the binary
# Run interactive setup
Configuration
The task2habitica setup command handles all configuration automatically. If you prefer manual configuration, see the sections below.
Manual Configuration
Habitica Credentials
You can configure your Habitica credentials using either environment variables or your .taskrc file.
Environment variables take precedence if both are set.
Environment Variables (Recommended)
.taskrc
Add your Habitica user ID and API key to your taskrc file:
habitica.user_id=YOUR_USER_ID
habitica.api_key=YOUR_API_KEY
You can find these in your Habitica account settings under Site Data tab.
Required UDAs
Add the following User Defined Attributes (UDAs) to your .taskrc (automatically added by task2habitica setup):
uda.habitica_uuid.label=Habitica UUID
uda.habitica_uuid.type=string
uda.habitica_difficulty.label=Habitica Difficulty
uda.habitica_difficulty.type=string
uda.habitica_difficulty.values=trivial,easy,medium,hard
uda.habitica_task_type.label=Habitica Task Type
uda.habitica_task_type.type=string
uda.habitica_task_type.values=daily,todo
Hook Scripts
The setup command installs hook scripts to ~/.task/hooks/. If you need to install them manually:
Optional: Configure Task Notes
By default, task notes are stored in ~/.task/notes/. You can customize this:
rc.tasknote.location=~/.task/notes/
rc.tasknote.prefix=[tasknote]
rc.tasknote.extension=.txt
Usage
Automatic Sync (via Hooks)
Once installed, the hooks will automatically sync your tasks:
- on-add: When you add a task in Taskwarrior, it's created on Habitica
- on-modify: When you modify a task, changes are synced to Habitica
- on-exit: Displays stat changes (HP, MP, Exp, Gold) when Taskwarrior exits
Example:
# Stats will be displayed on exit
Manual Sync
To manually sync all tasks:
This is useful when:
- You've added tasks on Habitica and want to import them
- Initial setup to sync existing tasks
- Recovering from sync issues
Use --verbose flag for detailed output:
Task Difficulty
Set task difficulty using the habitica_difficulty UDA:
Difficulty levels:
trivial: 0.1 priority in Habiticaeasy: 1.0 priority (default)medium: 1.5 priorityhard: 2.0 priority
Task Types
Specify task type using the habitica_task_type UDA:
Task Notes
Task notes from Habitica are stored as separate files in ~/.task/notes/:
# Notes are automatically synced
# The Habitica notes field will be saved to ~/.task/notes/<uuid>.txt
How It Works
Bidirectional Sync
The sync process:
- Taskwarrior-only tasks: Pushed to Habitica with a new Habitica UUID
- Habitica-only tasks: Imported to Taskwarrior
- Tasks on both sides:
- If identical, no action taken
- If different, most recently modified version wins
- Modification timestamps are compared to resolve conflicts
Status Mapping
| Taskwarrior Status | Habitica Status | Sync Behavior |
|---|---|---|
| pending | pending | Synced |
| waiting | pending | Synced |
| completed | completed | Synced, scored on Habitica |
| deleted | (deleted) | Not synced |
| recurring | (template) | Not synced |
Support
- Issues: https://github.com/mainframev/task2habitica-rs/issues
- Habitica: https://habitica.com
- Taskwarrior: https://taskwarrior.org