agent_office/cli/mod.rs
1use clap::{Parser, Subcommand};
2
3#[derive(Parser)]
4#[command(name = "agent-office")]
5#[command(about = "A pleasant set of tools for refined AI agents to get work done")]
6#[command(version = "0.1.0")]
7pub struct Cli {
8 #[command(subcommand)]
9 pub command: Commands,
10}
11
12#[derive(Subcommand)]
13pub enum Commands {
14 /// A simple mailbox to communicate with your coworkers
15 #[command(subcommand)]
16 Mail(MailCommands),
17 /// Find your coworkers, let your coworkers know your status, and register yourself as a coworker
18 #[command(subcommand)]
19 Agent(AgentCommands),
20 /// A Zettelkasten knowledge base for all coworkers to share
21 #[command(subcommand)]
22 Kb(KbCommands),
23 /// Human-only tools (not for AI agents)
24 #[command(subcommand)]
25 Human(HumanCommands),
26 /// A warm welcome and guide for new AI agents
27 HowWeWork,
28}
29
30/// Commands intended for human use only - these are tools for manual interaction
31/// and should not be invoked by AI agents
32#[derive(Subcommand)]
33pub enum HumanCommands {
34 #[command(subcommand)]
35 Db(DbCommands),
36 /// Start web interface
37 Web {
38 /// Host to bind to
39 #[arg(short = 'H', long, default_value = "127.0.0.1")]
40 host: String,
41 /// Port to listen on
42 #[arg(short, long, default_value = "8080")]
43 port: u16,
44 },
45}
46
47#[derive(Subcommand)]
48pub enum MailCommands {
49 /// View recent mail for an agent (last 24 hours)
50 Recent {
51 /// Agent ID to view mail for
52 agent_id: String,
53 },
54 /// Send mail from one agent to another (SIMPLE - uses agent names only!)
55 Send {
56 #[arg(short, long)]
57 from: String,
58 #[arg(short, long)]
59 to: String,
60 #[arg(short, long)]
61 subject: String,
62 #[arg(short, long)]
63 body: String,
64 },
65 /// View inbox of an agent
66 Inbox {
67 /// Agent ID to view inbox for
68 agent_id: String,
69 },
70 /// View outbox (sent items) of an agent
71 Outbox {
72 /// Agent ID to view outbox for
73 agent_id: String,
74 },
75 /// Mark mail as read by short ID (first 8 chars of UUID)
76 Read {
77 /// Short mail ID (first 8 characters of UUID)
78 mail_id: String,
79 },
80 /// Check if agent should look at their mail (has unread messages)
81 ShouldLook {
82 /// Agent ID to check
83 agent_id: String,
84 },
85 /// Watch for new mail and execute command when unread mail arrives
86 Watch {
87 /// Agent ID to watch
88 agent_id: String,
89 /// Interval in seconds between checks
90 #[arg(short, long, default_value = "60")]
91 interval: u64,
92 /// Bash command to execute when unread mail is found
93 #[arg(short, long)]
94 bash: String,
95 },
96 /// Search mail by subject or body content
97 Search {
98 /// Agent ID to search mail for
99 agent_id: String,
100 /// Search query string (searches in subject and body)
101 query: String,
102 },
103}
104
105#[derive(Subcommand)]
106pub enum AgentCommands {
107 /// Create a new agent
108 Create {
109 #[arg(short, long)]
110 name: String,
111 },
112 /// List all agents
113 List,
114 /// Get agent details
115 Get {
116 #[arg(short, long)]
117 id: String,
118 },
119 /// Set agent status (online, offline, away, etc.)
120 Status {
121 #[arg(short, long)]
122 id: String,
123 #[arg(short, long)]
124 status: String,
125 },
126}
127
128#[derive(Subcommand)]
129pub enum DbCommands {
130 /// Setup database tables (drops existing tables if they exist)
131 Setup,
132}
133
134/// Simplified KB commands - shared knowledge base, only Luhmann IDs
135#[derive(Subcommand)]
136pub enum KbCommands {
137 /// Create a new note (auto-generates ID unless --id specified)
138 /// Usage: kb create "Title" "Content" OR kb create --id 1a "Title" "Content"
139 Create {
140 /// Optional Luhmann ID (e.g., 1a, 1a1). If not provided, auto-generates next available ID
141 #[arg(short, long)]
142 id: Option<String>,
143 /// Note title
144 title: String,
145 /// Note content
146 content: String,
147 },
148 /// Create a child note (branch) from a parent
149 /// Usage: kb branch 1 "Child Title" "Content"
150 Branch {
151 /// Parent Luhmann ID
152 parent_luhmann_id: String,
153 /// Note title
154 title: String,
155 /// Note content
156 content: String,
157 },
158 /// List all notes (sorted by Luhmann ID)
159 List,
160 /// Get a specific note by Luhmann ID
161 /// Usage: kb get 1a
162 Get {
163 /// Luhmann ID
164 luhmann_id: String,
165 },
166 /// Link two notes together
167 /// Usage: kb link 1a 1b
168 Link {
169 /// Source Luhmann ID
170 from_luhmann_id: String,
171 /// Target Luhmann ID
172 to_luhmann_id: String,
173 /// Optional context for the link
174 #[arg(short, long)]
175 context: Option<String>,
176 },
177 /// Search notes
178 /// Usage: kb search "query"
179 Search {
180 /// Search query
181 query: String,
182 },
183 /// Show notes by Luhmann ID prefix
184 /// Usage: kb tree 1a
185 Tree {
186 /// Luhmann ID prefix
187 prefix: String,
188 },
189 /// Mark that note A continues on note B (linear chain)
190 /// Usage: kb cont 1a 1b
191 Cont {
192 /// Source Luhmann ID (the note that continues)
193 from_luhmann_id: String,
194 /// Target Luhmann ID (the continuation)
195 to_luhmann_id: String,
196 },
197 /// Create an index card listing all children of a note
198 /// Usage: kb index 1a
199 Index {
200 /// Luhmann ID to create index for
201 luhmann_id: String,
202 },
203 /// Show full context of a note (parent, children, links, continuations, backlinks)
204 /// Usage: kb context 1a
205 Context {
206 /// Luhmann ID to show context for
207 luhmann_id: String,
208 },
209}