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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
pub mod context;
pub mod doctor;
pub mod eval;
pub mod index;
pub mod init;
pub mod journal;
pub mod refs;
pub mod research;
pub mod search;
pub mod status;
pub mod task;
use clap::{Parser, Subcommand};
use std::path::PathBuf;
#[derive(Parser)]
#[command(name = "minni")]
#[command(
author,
version,
about = "Local memory and codebase indexing for AI agents"
)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
/// Initialize minni in the current directory
Init,
/// Index the codebase for semantic search
Index {
/// Path to index (defaults to current directory)
#[arg(short, long)]
path: Option<PathBuf>,
/// Force re-index all files
#[arg(short, long)]
force: bool,
},
/// Search for code snippets
Search {
/// Search query (natural language or code)
query: String,
/// Maximum number of results
#[arg(short, long, default_value = "10")]
limit: usize,
/// Output results as JSON
#[arg(long)]
json: bool,
/// Filter by file path (substring match)
#[arg(long)]
path: Option<String>,
/// Filter by language (exact match, case-insensitive)
#[arg(long)]
lang: Option<String>,
/// Filter by chunk type (function, class, file, block)
#[arg(long, value_name = "TYPE")]
chunk_type: Option<String>,
/// Filter by symbol name (substring match, case-insensitive)
#[arg(long)]
symbol: Option<String>,
/// Lines of context before the match
#[arg(long)]
before: Option<usize>,
/// Lines of context after the match
#[arg(long)]
after: Option<usize>,
/// Lines of context before and after the match
#[arg(long)]
context: Option<usize>,
},
/// Experimental deep research retrieval (deterministic, citation-oriented)
Research {
/// Research question
question: String,
/// Number of deterministic query passes
#[arg(long, default_value = "3")]
passes: usize,
/// Maximum number of aggregated findings
#[arg(short, long, default_value = "8")]
limit: usize,
/// Output structured JSON
#[arg(long)]
json: bool,
},
/// Manage session contexts
Context {
#[command(subcommand)]
command: ContextCommands,
},
/// Automatic journaling of project activity
Journal {
#[command(subcommand)]
command: JournalCommands,
},
/// Evaluate search quality against a benchmark query file
Eval {
/// Path to benchmark query file (default: eval/queries.json)
#[arg(short, long, value_name = "FILE")]
file: Option<PathBuf>,
/// Output results as JSON
#[arg(long)]
json: bool,
/// Fail (exit non-zero) if aggregate MRR drops below this value
#[arg(long, value_name = "THRESHOLD")]
min_mrr: Option<f64>,
},
/// Show symbol definitions, importers, and dependencies
Refs {
/// Symbol name to look up
symbol: String,
/// Output as JSON
#[arg(long)]
json: bool,
},
/// Show minni status for current project
Status,
/// Run diagnostic checks and report setup health
Doctor,
/// Manage implementation tasks within a context
Task {
#[command(subcommand)]
command: TaskCommands,
},
}
#[derive(Subcommand, Clone)]
pub enum JournalCommands {
/// Show recent journal entries
Show {
/// Number of entries to show
#[arg(short, long, default_value = "10")]
count: usize,
},
/// Add a note to the journal
Note {
/// Note message
message: String,
},
/// Record current git commit (called by hook)
Record,
/// Clear all journal entries
Clear,
/// Install git hooks for auto-journaling
HooksInstall,
/// Remove git hooks
HooksUninstall,
/// Show context for resuming a session
Resume,
}
#[derive(Subcommand, Clone)]
pub enum ContextCommands {
/// Save current session context
Save {
/// Name for this context
#[arg(short, long)]
name: Option<String>,
/// Description of what was being worked on
#[arg(short, long)]
description: Option<String>,
},
/// Load a saved context
Load {
/// Context ID or name to load
id: String,
},
/// List all saved contexts
List {
/// Show full details
#[arg(short, long)]
verbose: bool,
},
/// Delete a saved context
Delete {
/// Context ID or name to delete
id: String,
},
/// Snapshot current state (files, conversation, tasks)
Snapshot {
/// Name for this snapshot
#[arg(short, long)]
name: Option<String>,
/// Include git diff
#[arg(long)]
include_diff: bool,
/// Include conversation from stdin
#[arg(long)]
conversation: bool,
},
/// Export context for sharing between AI assistants
Export {
/// Context ID or name
id: String,
/// Output file path (default: context.json)
#[arg(short, long)]
output: Option<String>,
},
/// Import context from another session
Import {
/// Input file path
file: String,
/// Optional new name
#[arg(short, long)]
name: Option<String>,
},
/// Show detailed context information
Show {
/// Context ID or name
id: String,
},
/// Add information to the current context
Add {
/// Key for this context item
key: String,
/// Value to store
value: String,
},
}
#[derive(Subcommand, Clone)]
pub enum TaskCommands {
/// Add a new task to a context
Add {
/// Context name (e.g. ORI-9999)
context: String,
#[arg(short, long)]
title: String,
#[arg(short, long)]
description: Option<String>,
#[arg(short, long, default_value = "medium")]
priority: String,
},
/// Update a task's fields
Update {
context: String,
/// Task sequence number
seq: i64,
#[arg(long)]
title: Option<String>,
#[arg(long)]
description: Option<String>,
#[arg(long)]
status: Option<String>,
#[arg(long)]
priority: Option<String>,
},
/// List all tasks in a context
List {
context: String,
#[arg(long)]
json: bool,
},
/// Show full detail for a single task
Show {
context: String,
seq: i64,
#[arg(long)]
json: bool,
},
/// Manage todo items on a task (see task 003)
Todo {
context: String,
seq: i64,
text: Option<String>,
#[arg(long)]
done: Option<i64>,
},
/// Export a task to a Markdown file (see task 004)
Export { context: String, seq: i64 },
}