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
use clap::{Parser, Subcommand};
use crate::commands::{
branch::BranchArgs, completion::CompletionArgs, config::ConfigCmdArgs, init::InitArgs,
mcp::McpArgs, memory::MemoryArgs, policy::PolicyArgs, recall::RecallArgs,
reflect::ReflectArgs, remember::RememberArgs, search::SearchArgs, session::SessionArgs,
start::StartArgs, status::StatusArgs, stop::StopArgs, sync::SyncArgs,
};
use crate::output::OutputFormat;
#[derive(Parser)]
#[command(
name = "clawdb",
about = "The cognitive database for AI agents.",
version,
author
)]
pub struct Cli {
/// ClawDB server base URL.
#[arg(long, env = "CLAWDB_BASE_URL", default_value = "http://localhost:8080")]
pub base_url: String,
/// Session token for authenticated requests.
#[arg(long, env = "CLAWDB_SESSION_TOKEN", global = true)]
pub token: Option<String>,
/// Output format: table (default), json, tsv.
#[arg(long, global = true, default_value = "table")]
pub output: OutputFormat,
/// Suppress all output except errors.
#[arg(long, short = 'q', global = true)]
pub quiet: bool,
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
/// Initialise the ~/.clawdb directory and config file.
Init(InitArgs),
/// Start the ClawDB server process.
Start(StartArgs),
/// Stop a detached ClawDB server process.
Stop(StopArgs),
/// Check server component health.
Status(StatusArgs),
/// Manage sessions (create / revoke / whoami).
Session(SessionArgs),
/// Store a memory in ClawDB.
Remember(RememberArgs),
/// Search memories semantically or with full-text search.
Search(SearchArgs),
/// Retrieve one or more memories by ID.
Recall(RecallArgs),
/// Grouped memory commands (remember/search/list/delete).
Memory(MemoryArgs),
/// Manage memory branches (create / list / merge / diff / discard).
Branch(BranchArgs),
/// Synchronise memories with the hub.
Sync(SyncArgs),
/// Trigger reflection jobs.
Reflect(ReflectArgs),
/// Manage access control policies.
Policy(PolicyArgs),
/// Read or write local CLI configuration.
Config(ConfigCmdArgs),
/// Install/print MCP editor configuration.
Mcp(McpArgs),
/// Generate shell completion scripts.
Completion(CompletionArgs),
}