1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
use std::path::PathBuf;
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(
name = "tam",
about = "Terminal agent multiplexer — manage units of work, not just processes"
)]
pub struct Cli {
#[command(subcommand)]
pub command: Option<Commands>,
}
#[derive(Subcommand)]
pub enum Commands {
/// Create a new task and start an agent
New {
/// Task name (used as branch name for owned worktrees)
name: String,
/// Create an owned worktree for this task
#[arg(short, long)]
worktree: bool,
/// Branch from a specific ref (implies -w)
#[arg(short, long)]
source: Option<String>,
/// Don't start an agent after creating the task
#[arg(long)]
no_start: bool,
},
/// Start or resume an agent in a task
Run {
/// Task name (resolved from current directory if omitted)
name: Option<String>,
/// Skip session picker, always start a new session
#[arg(long)]
new_session: bool,
/// Agent tool to use (e.g. claude, codex)
#[arg(short, long)]
agent: Option<String>,
/// Initial prompt text
prompt: Option<String>,
/// Extra arguments passed to the agent command
#[arg(last = true)]
args: Vec<String>,
},
/// Stop the agent in a task
Stop {
/// Task name (resolved from current directory if omitted)
name: Option<String>,
},
/// Attach to a running agent
Attach {
/// Task name (resolved from current directory if omitted)
name: Option<String>,
},
/// Remove a task and optionally its worktree/branch
Drop {
/// Task name
name: String,
/// Also delete the git branch (owned tasks only)
#[arg(short, long)]
branch: bool,
},
/// List tasks with computed status
Ps {
/// Output as JSON
#[arg(long)]
json: bool,
},
/// Discover projects and worktrees
Ls {
/// Directory to search (default: discovery roots)
path: Option<PathBuf>,
/// Output as JSON
#[arg(long)]
json: bool,
/// Output paths only, one per line
#[arg(long)]
raw: bool,
/// Output pretty names only, one per line (same format as `tam pick`)
#[arg(long)]
porcelain: bool,
},
/// Fuzzy project picker
Pick {
/// Finder command (overrides config finder, e.g. fzf, "dmenu -l 20")
#[arg(short = 'F', long)]
finder: Option<String>,
},
/// Configure agent hooks for state detection
Init {
/// Agent to configure (e.g. claude)
#[arg(long)]
agent: String,
},
/// Stop all agents and shut down the daemon
Shutdown,
/// Check if the daemon is running
Status,
/// Run the daemon (used internally by auto-start)
#[command(hide = true)]
Daemon,
/// Notify the daemon of a hook event (called by agent hooks)
#[command(hide = true)]
HookNotify {
/// Agent ID (defaults to $TAM_AGENT_ID; exits quietly if absent)
#[arg(short, long, env = "TAM_AGENT_ID")]
agent: Option<String>,
/// Hook event name (e.g. stop, notification:permission_prompt)
#[arg(short, long)]
event: String,
},
}