thor 0.2.1

Git worktree dashboard with AI agent coordination
# Thor

Git worktree dashboard with AI agent coordination.

[![Crates.io](https://img.shields.io/crates/v/thor.svg)](https://crates.io/crates/thor)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

## Features

- **Worktree Management** - List, create, switch, and remove git worktrees
- **Agent Coordination** - Monitor and control AI agents working in worktrees
- **Notification Inbox** - Receive task completion reports from agents
- **Tmux Integration** - Popup support, pane discovery, jump to agent panes
- **Shell Integration** - Automatic `cd` to selected worktree

## Install

```bash
cargo install thor
```

### Shell Integration

Add to your `~/.zshrc`:

```bash
source /path/to/thor/scripts/thor.zsh
```

This enables:
- `thor` - Launch TUI with cd integration
- `thor-popup` - Tmux popup launcher

### Tmux Integration

Add to your `~/.tmux.conf`:

```bash
bind g display-popup -E -w 80% -h 70% -T " thor " "thor popup"
```

## Usage

```bash
thor                   # Open TUI
thor popup             # Open as tmux popup

# Worktree workflow
thor wt list           # List worktrees
thor wt new <branch>   # Create worktree (--track, --base)
thor wt go <query>     # Navigate: fuzzy match, index (1-9), or "-" for previous
thor wt remove <branch> # Remove worktree (--force)
thor wt done [target]  # Finish branch: merge or --pr, then cleanup
thor wt pull           # Pull --rebase (--all for all worktrees)
thor wt rebase [base]  # Fetch + rebase onto origin/{base}
thor wt exec "<cmd>"   # Run command in every worktree
thor wt clean          # Prune stale refs (--merged to delete merged branches)

# Agent management
thor agent register    # Register agent session
thor agent list        # List active agents
thor agent complete    # Mark agent done

# Task management
thor task sync         # Sync tasks from stdin
thor task list         # List tasks
thor task update       # Update task status

# Signal control
thor signal pause      # Pause agent
thor signal resume     # Resume agent
thor signal abort      # Abort agent
thor signal check      # Check for signals (for agents)

# Queue operations
thor queue question    # Add question to queue
thor queue gate        # Request gate approval (--wait to block)
thor queue answer      # Answer a question
thor queue list        # List pending items

# Notifications
thor notify send       # Send a notification
thor notify list       # List notifications
```

## TUI Keybindings

| Key | Action |
|-----|--------|
| `1-4` | Switch tabs (Dashboard/Worktrees/Inbox/Agents) |
| `j`/`k` | Navigate up/down |
| `h`/`l` | Switch focus between list and detail panel |
| `Enter` | Switch to worktree / jump to agent pane |
| `m` | Message agent (auto-replies if question pending) |
| `p` | Pause agent |
| `R` | Resume agent |
| `n` | Create new worktree |
| `d` | Delete worktree |
| `s` | Spawn new agent in worktree |
| `T` | Cycle color theme |
| `?` | Toggle help |
| `q` | Quit |

## Configuration

`~/.config/thor/config.toml`:

```toml
[theme]
preset = "nord"  # nord, catppuccin, tokyo-night, dracula, solarized
```

## Claude Code Integration

Thor integrates with Claude Code via hooks. See `scripts/claude-hooks.json` for the hook definitions to add to your `.claude/settings.json`. Hooks automatically register agents, sync tasks, route questions, and send completion notifications — all outside the token budget.

## Data Locations

- **Config:** `~/.config/thor/config.toml`
- **Agents:** `~/.local/share/thor/agents/`
- **Tasks:** `~/.local/share/thor/sessions/{session}/tasks/`
- **Queue:** `~/.local/share/thor/queue/`

## Project Structure

```
grove/
├── crates/
│   ├── thor-core/     # Git operations, tmux bridge, agent coordination
│   ├── thor-wt/       # Worktree workflow commands
│   ├── thor-notify/   # Notification schema and inbox
│   ├── thor-tui/      # Ratatui TUI interface
│   └── thor-cli/      # CLI entry point
└── scripts/
    ├── thor.zsh       # Shell wrapper for cd integration
    ├── _thor          # Zsh completion script
    └── claude-hooks.json  # Claude Code hook bridge
```

## License

MIT