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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
use super::*;
#[derive(Subcommand)]
pub(crate) enum ProjectsCommand {
/// List registered workspaces.
List,
}
#[derive(Subcommand)]
pub(crate) enum FeedbackCommand {
/// List feedback records for the workspace.
List {
#[arg(long)]
workspace: Option<PathBuf>,
/// project name shorthand for --workspace (mutually exclusive)
#[arg(long, conflicts_with = "workspace")]
project: Option<String>,
#[arg(long, value_enum)]
label: Option<FeedbackLabel>,
#[arg(long)]
since: Option<String>,
#[arg(long)]
json: bool,
},
}
#[derive(Subcommand)]
pub(crate) enum PromptCommand {
/// List all recorded prompt snapshots.
List {
/// workspace root (default: cwd)
#[arg(long)]
workspace: Option<PathBuf>,
/// project name shorthand for --workspace (mutually exclusive)
#[arg(long, conflicts_with = "workspace")]
project: Option<String>,
/// Emit JSON array.
#[arg(long)]
json: bool,
},
/// Show files in a snapshot by fingerprint prefix.
Show {
fingerprint: String,
/// workspace root (default: cwd)
#[arg(long)]
workspace: Option<PathBuf>,
/// project name shorthand for --workspace (mutually exclusive)
#[arg(long, conflicts_with = "workspace")]
project: Option<String>,
/// Emit JSON.
#[arg(long)]
json: bool,
},
/// Diff two snapshots.
Diff {
fingerprint_a: String,
fingerprint_b: String,
/// workspace root (default: cwd)
#[arg(long)]
workspace: Option<PathBuf>,
/// project name shorthand for --workspace (mutually exclusive)
#[arg(long, conflicts_with = "workspace")]
project: Option<String>,
},
}
#[derive(Subcommand)]
pub(crate) enum SessionsCommand {
/// List sessions for current workspace.
List {
/// workspace root (default: cwd)
#[arg(long)]
workspace: Option<PathBuf>,
/// project name shorthand for --workspace (mutually exclusive)
#[arg(long, conflicts_with = "workspace")]
project: Option<String>,
/// Read from every registered workspace on this machine.
#[arg(long)]
all_workspaces: bool,
/// Emit JSON (same as MCP with json=true)
#[arg(long)]
json: bool,
/// Cap rows after sorting (newest first). Omit for 100 rows; 0 returns all.
#[arg(long)]
limit: Option<usize>,
/// Force a full agent transcript rescan before reading. This can take a while on large workspaces.
#[arg(short, long)]
refresh: bool,
},
/// Load previous local agent sessions into Kaizen stores.
Load {
/// workspace root; omit to load all registered workspaces
#[arg(long)]
workspace: Option<PathBuf>,
/// project name shorthand for --workspace (mutually exclusive)
#[arg(long, conflicts_with = "workspace")]
project: Option<String>,
/// Emit JSON load summary.
#[arg(long)]
json: bool,
},
/// Show full details for a session.
Show {
id: String,
/// workspace root (default: cwd)
#[arg(long)]
workspace: Option<PathBuf>,
/// project name shorthand for --workspace (mutually exclusive)
#[arg(long, conflicts_with = "workspace")]
project: Option<String>,
},
/// Attach human feedback (score/label/note) to a session.
Annotate {
id: String,
#[arg(long, value_parser = clap::value_parser!(u8).range(1..=5))]
score: Option<u8>,
#[arg(long, value_enum)]
label: Option<FeedbackLabel>,
#[arg(long)]
note: Option<String>,
#[arg(long)]
workspace: Option<PathBuf>,
/// project name shorthand for --workspace (mutually exclusive)
#[arg(long, conflicts_with = "workspace")]
project: Option<String>,
},
/// Render nested tool-span tree for a session.
Tree {
id: String,
#[arg(long, default_value = "999")]
depth: u32,
#[arg(long)]
json: bool,
#[arg(long)]
workspace: Option<PathBuf>,
/// project name shorthand for --workspace (mutually exclusive)
#[arg(long, conflicts_with = "workspace")]
project: Option<String>,
},
/// Render Datadog-style trace spans for a session.
Trace {
id: String,
#[arg(long)]
json: bool,
#[arg(long)]
workspace: Option<PathBuf>,
/// project name shorthand for --workspace (mutually exclusive)
#[arg(long, conflicts_with = "workspace")]
project: Option<String>,
},
/// Full-text search session events.
Search {
query: String,
#[arg(long)]
since: Option<String>,
#[arg(long)]
agent: Option<String>,
#[arg(long)]
kind: Option<String>,
#[arg(long, default_value_t = 50)]
limit: usize,
#[arg(long)]
workspace: Option<PathBuf>,
/// project name shorthand for --workspace (mutually exclusive)
#[arg(long, conflicts_with = "workspace")]
project: Option<String>,
},
}
#[derive(Subcommand)]
pub(crate) enum SearchCommand {
/// Drop and rebuild the workspace search index.
Reindex {
/// workspace root (default: cwd)
#[arg(long)]
workspace: Option<PathBuf>,
/// project name shorthand for --workspace (mutually exclusive)
#[arg(long, conflicts_with = "workspace")]
project: Option<String>,
},
}
#[derive(Subcommand)]
pub(crate) enum OutcomesCommand {
/// Show stored JSON row for a session.
Show {
id: String,
/// workspace root (default: cwd)
#[arg(long)]
workspace: Option<PathBuf>,
/// project name shorthand for --workspace (mutually exclusive)
#[arg(long, conflicts_with = "workspace")]
project: Option<String>,
},
/// Internal: run tests/lint and upsert `session_outcomes` (ingest spawns this).
#[command(hide = true)]
Measure {
/// workspace root (db + repo path)
#[arg(long)]
workspace: PathBuf,
/// Session id
#[arg(long)]
session: String,
},
}
#[derive(Subcommand)]
pub(crate) enum MetricsCommand {
/// Rebuild repo snapshot and Ladybug sidecar.
Index {
/// workspace root (default: cwd)
#[arg(long)]
workspace: Option<PathBuf>,
/// project name shorthand for --workspace (mutually exclusive)
#[arg(long, conflicts_with = "workspace")]
project: Option<String>,
/// Rebuild even when fingerprint unchanged.
#[arg(long)]
force: bool,
},
/// Field coverage and trace-correlation health.
Quality {
/// workspace root (default: cwd)
#[arg(long)]
workspace: Option<PathBuf>,
/// project name shorthand for --workspace (mutually exclusive)
#[arg(long, conflicts_with = "workspace")]
project: Option<String>,
/// Trailing window in days.
#[arg(long, default_value_t = 7)]
days: u32,
/// Emit JSON report.
#[arg(long)]
json: bool,
},
}