microscope_memory/cli.rs
1//! CLI definitions for Microscope Memory.
2
3use clap::{Parser, Subcommand};
4
5#[derive(Parser)]
6#[command(
7 name = "microscope-mem",
8 about = "Zoom-based hierarchical memory — pure binary, zero JSON"
9)]
10pub struct Cli {
11 #[command(subcommand)]
12 pub cmd: Cmd,
13}
14
15#[derive(Subcommand)]
16pub enum Cmd {
17 /// Build binary from raw layer files
18 Build {
19 #[arg(long)]
20 force: bool,
21 },
22 /// Store a new memory
23 Store {
24 text: String,
25 #[arg(short, long, default_value = "long_term")]
26 layer: String,
27 #[arg(short = 'i', long, default_value = "5")]
28 importance: u8,
29 },
30 /// Recall — natural language query, auto-zoom
31 Recall {
32 query: String,
33 #[arg(default_value = "10")]
34 k: usize,
35 },
36 /// Manual look: x y z zoom [k]
37 Look {
38 x: f32,
39 y: f32,
40 z: f32,
41 zoom: u8,
42 #[arg(default_value = "10")]
43 k: usize,
44 },
45 /// Radial search: find blocks within radius at a depth
46 Radial {
47 x: f32,
48 y: f32,
49 z: f32,
50 depth: u8,
51 #[arg(short, long, default_value = "0.1")]
52 radius: f32,
53 #[arg(default_value = "10")]
54 k: usize,
55 },
56 /// 4D soft zoom: x y z zoom [k]
57 Soft {
58 x: f32,
59 y: f32,
60 z: f32,
61 zoom: u8,
62 #[arg(default_value = "10")]
63 k: usize,
64 /// Use GPU acceleration (requires gpu feature)
65 #[arg(long)]
66 gpu: bool,
67 },
68 /// Benchmark
69 Bench,
70 /// Stats
71 Stats,
72 /// Text search
73 Find {
74 query: String,
75 #[arg(default_value = "5")]
76 k: usize,
77 },
78 /// Build structural fingerprints and wormhole links
79 Fingerprint,
80 /// Show structural links (wormholes) for a block
81 Links {
82 #[arg(help = "Block index")]
83 block_index: usize,
84 },
85 /// Find structurally similar blocks to a text
86 Similar {
87 text: String,
88 #[arg(default_value = "5")]
89 k: usize,
90 },
91 /// Rebuild — incorporate append log into main index
92 Rebuild,
93 /// Semantic search using embeddings
94 Embed {
95 query: String,
96 #[arg(default_value = "10")]
97 k: usize,
98 #[arg(short, long, default_value = "cosine")]
99 metric: String,
100 },
101 /// GPU vs CPU benchmark (requires gpu feature)
102 GpuBench,
103 /// Verify CRC16 integrity of all blocks
104 Verify,
105 /// Verify Merkle tree integrity of the entire index
106 VerifyMerkle,
107 /// Show Merkle proof for a specific block
108 Proof {
109 #[arg(help = "Block index")]
110 block_index: usize,
111 },
112 /// Sequential Thinking — Chain-of-Thought memory sequence
113 Think {
114 query: String,
115 #[arg(default_value = "5")]
116 max_steps: usize,
117 },
118 /// Start the Binary Spine IPC listener (Zero JSON)
119 Spine,
120 /// MQL query (Microscope Query Language)
121 Query {
122 /// MQL expression, e.g. 'layer:long_term depth:2..5 "Ora"'
123 mql: String,
124 },
125 /// Export index to .mscope archive
126 Export {
127 /// Output archive path
128 output: String,
129 },
130 /// Import .mscope archive
131 Import {
132 /// Input archive path
133 input: String,
134 /// Output directory (defaults to config output_dir)
135 #[arg(long)]
136 output_dir: Option<String>,
137 },
138 /// Diff two .mscope archives
139 Diff {
140 /// First archive
141 a: String,
142 /// Second archive
143 b: String,
144 },
145 /// Federated recall across multiple indices
146 FederatedRecall {
147 query: String,
148 #[arg(default_value = "10")]
149 k: usize,
150 },
151 /// Exchange resonance pulses across federated indices (mirror neuron protocol)
152 PulseExchange,
153 /// Federated text search across multiple indices
154 FederatedFind {
155 query: String,
156 #[arg(default_value = "10")]
157 k: usize,
158 },
159 /// Show Hebbian learning state (activations, co-activations, energy)
160 Hebbian,
161 /// Apply Hebbian drift — co-activated blocks pull coordinates closer
162 HebbianDrift,
163 /// Show hottest blocks (most recently/frequently activated)
164 Hottest {
165 #[arg(default_value = "10")]
166 k: usize,
167 },
168 /// Show emerged archetypes (crystallized activation patterns)
169 Archetypes,
170 /// Detect new archetypes from resonance field and Hebbian state
171 Emerge,
172 /// Show resonance protocol state (pulses, field energy)
173 Resonance,
174 /// Integrate received pulses into local Hebbian state
175 Integrate,
176 /// Show mirror neuron state (resonance echoes, boosted blocks)
177 Mirror,
178 /// Show most resonant blocks (strongest mirror neuron signal)
179 Resonant {
180 #[arg(default_value = "10")]
181 k: usize,
182 },
183 /// Export 3D visualization snapshot (Binary)
184 Viz {
185 /// Output file path (default: viz.bin)
186 #[arg(default_value = "viz.bin")]
187 output: String,
188 },
189 /// Export binary density map for fast rendering
190 Density {
191 /// Output file path
192 #[arg(default_value = "density.bin")]
193 output: String,
194 /// Grid resolution (default: 32)
195 #[arg(short, long, default_value = "32")]
196 grid: u16,
197 },
198
199 /// Show thought patterns (crystallized recall sequences)
200 Patterns {
201 #[arg(default_value = "10")]
202 k: usize,
203 },
204 /// Show recent thought paths (recall sequences by session)
205 Paths {
206 #[arg(default_value = "5")]
207 sessions: usize,
208 },
209 /// Show predictive cache stats and active predictions
210 Predictions,
211 /// Show temporal archetype patterns (time-of-day activation profiles)
212 TemporalPatterns,
213 /// Show attention mechanism state (layer weights, quality history)
214 Attention,
215 /// Exchange thought patterns across federated indices
216 PatternExchange,
217 /// Run dream consolidation (offline memory replay and pruning)
218 Dream,
219 /// Show dream consolidation history
220 DreamLog {
221 #[arg(default_value = "10")]
222 k: usize,
223 },
224 /// Show emotional contagion state (local + remote emotional fields)
225 EmotionalField,
226 /// Exchange emotional snapshots across federated indices
227 EmotionalExchange,
228 /// Show multimodal index statistics
229 Modalities,
230 /// Export full cognitive map (all 13 layers) as JSON for Three.js viewer
231 CognitiveMap {
232 /// Output file path (default: cognitive_map.bin)
233 #[arg(default_value = "cognitive_map.bin")]
234 output: String,
235 },
236 /// Store structured data (key=value pairs)
237 StoreData {
238 /// Key-value pairs: key1=val1 key2=val2
239 pairs: Vec<String>,
240 #[arg(short = 'i', long, default_value = "5")]
241 importance: u8,
242 },
243 /// Initialize a demo dataset and configuration for quickstart
244 InitDemo {
245 /// Force overwrite existing layers/demo.txt
246 #[arg(long)]
247 force: bool,
248 },
249 /// Start a local HTTP server for the 3D Viewer (viewer.html)
250 Serve {
251 #[arg(short, long, default_value = "8080")]
252 port: u16,
253 },
254}