Skip to main content

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 WmAction {
17    /// Show working memory contents and stats
18    Show,
19    /// Push an item into working memory
20    Push {
21        text: String,
22        #[arg(short = 'i', long, default_value = "5.0")]
23        importance: f32,
24        #[arg(short = 'l', long, default_value = "short_term")]
25        layer: String,
26        #[arg(short = 't', long, default_value = "episodic")]
27        memory_type: String,
28    },
29    /// Apply time decay (evicts old items)
30    Decay,
31    /// Consolidate high-access items into long-term storage
32    Consolidate,
33}
34
35#[derive(Subcommand)]
36pub enum Cmd {
37    /// Build binary index from raw layer files (from scratch)
38    Build {
39        /// Force rebuild even if layer files are unchanged
40        #[arg(long)]
41        force: bool,
42    },
43    /// Store a new memory
44    Store {
45        text: String,
46        #[arg(short, long, default_value = "long_term")]
47        layer: String,
48        #[arg(short = 'i', long, default_value = "5")]
49        importance: u8,
50        /// Status flag: open (open loop) | resolved | archived | normal
51        #[arg(long)]
52        status: Option<String>,
53    },
54    /// Show timeline (chronological stores) by window
55    Timeline {
56        /// Time window: today, yesterday, last_N_days, since:YYYY-MM-DD,
57        /// last_session, all
58        #[arg(default_value = "last_session")]
59        window: String,
60        #[arg(default_value = "20")]
61        k: usize,
62    },
63    /// List currently-open loops
64    Loops {
65        #[arg(default_value = "50")]
66        k: usize,
67    },
68    /// Mark a loop resolved
69    ResolveLoop {
70        id: u64,
71    },
72    /// Universal auto-context snapshot — for any LLM wrapper script.
73    /// Writes to stdout (default) or to a file path.
74    AutoContext {
75        /// Compact mode (no box-drawing)
76        #[arg(long)]
77        compact: bool,
78        /// Output to this file instead of stdout
79        #[arg(long)]
80        output: Option<String>,
81    },
82    /// Recall — natural language query, auto-zoom
83    Recall {
84        query: String,
85        #[arg(default_value = "10")]
86        k: usize,
87    },
88    /// Manual look: x y z zoom [k]
89    Look {
90        x: f32,
91        y: f32,
92        z: f32,
93        zoom: u8,
94        #[arg(default_value = "10")]
95        k: usize,
96    },
97    /// Radial search: find blocks within radius at a depth
98    Radial {
99        x: f32,
100        y: f32,
101        z: f32,
102        depth: u8,
103        #[arg(short, long, default_value = "0.1")]
104        radius: f32,
105        #[arg(default_value = "10")]
106        k: usize,
107    },
108    /// 4D soft zoom: x y z zoom [k]
109    Soft {
110        x: f32,
111        y: f32,
112        z: f32,
113        zoom: u8,
114        #[arg(default_value = "10")]
115        k: usize,
116        /// Use GPU acceleration (requires gpu feature)
117        #[arg(long)]
118        gpu: bool,
119    },
120    /// Benchmark
121    /// Time the recall path in one process, separating first-call setup from
122    /// steady-state calls.
123
124    /// This exists because the end-to-end figure quoted for `recall` (117 ms on
125    /// the evaluation index) is not comparable to the FAISS baselines, which
126    /// report query-time search only against a resident index. Calling `recall`
127    /// in a loop makes the split visible: the first call pays one-time
128    /// initialisation, and later calls are the steady-state cost with the state
129    /// files already warm. Neither is FAISS number, and the gap between them is
130    /// exactly what the end-to-end figure hides.
131    BenchRecall {
132        /// Calls after the first.
133        #[arg(default_value = "20")]
134        n: usize,
135        #[arg(default_value = "the user has a cat named Bella")]
136        query: String,
137        /// Results returned per call. Exposed so the cost of printing results
138        /// can be separated from the cost of finding them.
139        #[arg(default_value = "10")]
140        k: usize,
141    },
142    Bench,
143    /// Stats
144    Stats,
145    /// Generate a per-user bridge auth token (HMAC-signed against [server] api_key)
146    Token {
147        /// User id to sign
148        user_id: String,
149    },
150    /// Text search
151    Find {
152        query: String,
153        #[arg(default_value = "5")]
154        k: usize,
155    },
156    /// Build structural fingerprints and wormhole links
157    Fingerprint,
158    /// Show structural links (wormholes) for a block
159    Links {
160        #[arg(help = "Block index")]
161        block_index: usize,
162    },
163    /// Find structurally similar blocks to a text
164    Similar {
165        text: String,
166        #[arg(default_value = "5")]
167        k: usize,
168    },
169    /// Rebuild — merge pending observations from append log into the main index
170    Rebuild,
171    /// Semantic search using embeddings
172    Embed {
173        query: String,
174        #[arg(default_value = "10")]
175        k: usize,
176        #[arg(short, long, default_value = "cosine")]
177        metric: String,
178    },
179    /// GPU vs CPU benchmark (requires gpu feature)
180    GpuBench,
181    /// Verify CRC16 integrity of all blocks
182    Verify,
183    /// Verify Merkle tree integrity of the entire index
184    VerifyMerkle,
185    /// Show Merkle proof for a specific block
186    Proof {
187        #[arg(help = "Block index")]
188        block_index: usize,
189    },
190    /// Sequential Thinking — Chain-of-Thought memory sequence
191    Think {
192        query: String,
193        #[arg(default_value = "5")]
194        max_steps: usize,
195    },
196    /// Start the Binary Spine IPC listener (Zero JSON)
197    Spine,
198    /// MQL query (Microscope Query Language)
199    Query {
200        /// MQL expression, e.g. 'layer:long_term depth:2..5 "Ora"'
201        mql: String,
202    },
203    /// Export index to .mscope archive
204    Export {
205        /// Output archive path
206        output: String,
207    },
208    /// Import .mscope archive
209    Import {
210        /// Input archive path
211        input: String,
212        /// Output directory (defaults to config output_dir)
213        #[arg(long)]
214        output_dir: Option<String>,
215    },
216    /// Diff two .mscope archives
217    Diff {
218        /// First archive
219        a: String,
220        /// Second archive
221        b: String,
222    },
223    /// Federated recall across multiple indices
224    FederatedRecall {
225        query: String,
226        #[arg(default_value = "10")]
227        k: usize,
228    },
229    /// Exchange resonance pulses across federated indices (mirror neuron protocol)
230    PulseExchange,
231    /// Federated text search across multiple indices
232    FederatedFind {
233        query: String,
234        #[arg(default_value = "10")]
235        k: usize,
236    },
237    /// Show Hebbian learning state (activations, co-activations, energy)
238    Hebbian,
239    /// Apply Hebbian drift — co-activated blocks pull coordinates closer
240    HebbianDrift,
241    /// Show hottest blocks (most recently/frequently activated)
242    Hottest {
243        #[arg(default_value = "10")]
244        k: usize,
245    },
246    /// Show emerged archetypes (crystallized activation patterns)
247    Archetypes,
248    /// Detect new archetypes from resonance field and Hebbian state
249    Emerge,
250    /// Show resonance protocol state (pulses, field energy)
251    Resonance,
252    /// Integrate received pulses into local Hebbian state
253    Integrate,
254    /// Show mirror neuron state (resonance echoes, boosted blocks)
255    Mirror,
256    /// Show most resonant blocks (strongest mirror neuron signal)
257    Resonant {
258        #[arg(default_value = "10")]
259        k: usize,
260    },
261    /// Export 3D visualization snapshot (Binary)
262    Viz {
263        /// Output file path (default: viz.bin)
264        #[arg(default_value = "viz.bin")]
265        output: String,
266    },
267
268    /// Show thought patterns (crystallized recall sequences)
269    Patterns {
270        #[arg(default_value = "10")]
271        k: usize,
272    },
273    /// Show recent thought paths (recall sequences by session)
274    Paths {
275        #[arg(default_value = "5")]
276        sessions: usize,
277    },
278    /// Show predictive cache stats and active predictions
279    Predictions,
280    /// Show temporal archetype patterns (time-of-day activation profiles)
281    TemporalPatterns,
282    /// Show attention mechanism state (layer weights, quality history)
283    Attention,
284    /// Exchange thought patterns across federated indices
285    PatternExchange,
286    /// Run dream consolidation (offline memory replay and pruning)
287    Dream,
288    /// Show dream consolidation history
289    DreamLog {
290        #[arg(default_value = "10")]
291        k: usize,
292    },
293    /// Show emotional contagion state (local + remote emotional fields)
294    EmotionalField,
295    /// Exchange emotional snapshots across federated indices
296    EmotionalExchange,
297    /// Show multimodal index statistics
298    Modalities,
299    /// Export full cognitive map (all 13 layers) as JSON for Three.js viewer
300    CognitiveMap {
301        /// Output file path (default: cognitive_map.bin)
302        #[arg(default_value = "cognitive_map.bin")]
303        output: String,
304    },
305    /// Store structured data (key=value pairs)
306    StoreData {
307        /// Key-value pairs: key1=val1 key2=val2
308        pairs: Vec<String>,
309        #[arg(short = 'i', long, default_value = "5")]
310        importance: u8,
311    },
312    /// Initialize a demo dataset and configuration for quickstart
313    InitDemo {
314        /// Force overwrite existing layers/demo.txt
315        #[arg(long)]
316        force: bool,
317    },
318    /// Start a local HTTP server for the 3D Viewer (viewer.html)
319    Serve {
320        #[arg(short, long, default_value = "8080")]
321        port: u16,
322    },
323    /// Start the REST Bridge API (OpenAPI spec at /openapi.json)
324    Bridge {
325        /// Interface to bind. A non-loopback host requires [server] api_key.
326        #[arg(long, default_value = "127.0.0.1")]
327        host: String,
328        #[arg(short, long, default_value = "6060")]
329        port: u16,
330    },
331    /// Start the MCP (Model Context Protocol) server for Claude Desktop integration
332    Mcp,
333    /// Start the MCP server over Streamable HTTP transport (remote/multi-client)
334    ///
335    /// Requires `--features mcp_http`.  A non-loopback host requires
336    /// `[server] api_key` to be set in config.
337    McpHttp {
338        /// Interface to bind. A non-loopback host requires [server] api_key.
339        #[arg(long, default_value = "127.0.0.1")]
340        host: String,
341        #[arg(short, long, default_value = "8080")]
342        port: u16,
343    },
344    /// Print drop-in MCP server config + auto-context wrapper instructions
345    /// for a specific AI client: claude | hermes | cursor | cline | generic
346    Config {
347        /// Target client: claude, hermes, cursor, cline, generic
348        client: String,
349    },
350    /// Run integrity diagnostics and attempt automatic repair (Crash Recovery)
351    Doctor {
352        /// Attempt to fix common corruption issues (e.g. malformed append log tail)
353        #[arg(long)]
354        fix: bool,
355    },
356    /// Start the Mermaid Terminal (WebSocket + HTML UI on port 8080)
357    Mermaid {
358        #[arg(short, long, default_value = "8080")]
359        port: u16,
360    },
361    /// Autonomous mode - the system runs itself: daydream, curiosity, monologue, reflect, narrative, dream
362    Autonomous {
363        /// Enable TTS (text-to-speech) via Windows System.Speech
364        #[arg(long)]
365        tts: bool,
366        /// Run as daemon (continuous loop) instead of single cycle
367        #[arg(long)]
368        daemon: bool,
369        /// Cycle interval in seconds (default: 30)
370        #[arg(long, default_value = "30")]
371        interval: u64,
372        /// Maximum number of cycles (default: infinite in daemon mode, 1 in single mode)
373        #[arg(long)]
374        max_cycles: Option<usize>,
375    },
376    /// Introspect - self-reflection: the system thinks about itself
377    Introspect,
378    /// SelfModel - show the system's self-model snapshot
379    SelfModel,
380    /// AwarenessTrace - show the reasoning graph behind 'I am aware'
381    AwarenessTrace,
382    /// Curiosity - show what the system is curious about
383    Curiosity,
384    /// Monologue - generate an inner monologue (the system thinking)
385    Monologue,
386    /// Stories - show narrative memory episodes (story arcs from recalls)
387    Stories {
388        #[arg(default_value = "5")]
389        k: usize,
390    },
391    /// Daydream - associative drift (mind wandering)
392    Daydream {
393        /// Seed text to start from (default: last narrative)
394        #[arg(default_value = "")]
395        seed: String,
396        /// Number of drift steps
397        #[arg(default_value = "3")]
398        steps: usize,
399    },
400    /// Hyperfocus - enter deep concentration mode on a topic
401    Hyperfocus {
402        /// Target topic
403        target: String,
404        /// Focus type: planning, problem_solving, creative, research
405        #[arg(default_value = "research")]
406        focus_type: String,
407    },
408    /// Key management — binary key store (keys.bin)
409    Keys {
410        #[command(subcommand)]
411        action: KeyAction,
412    },
413    /// Zen key management — binary zen key store (zen_keys.bin)
414    ZenKeys {
415        #[command(subcommand)]
416        action: ZenKeyAction,
417    },
418    /// Commitment enforcement — the A_t^valid gate, documented override,
419    /// and hash-chained audit.
420    Enforce {
421        #[command(subcommand)]
422        action: EnforceAction,
423    },
424    /// Evidence layer — epistemic audit, confidence tracking
425    Evidence {
426        #[command(subcommand)]
427        action: EvidenceAction,
428    },
429    /// Kognitív Morfogenezis — audit-napló, metrikák, gradiens állapot
430    Morphogenesis {
431        #[command(subcommand)]
432        action: MorphogenesisAction,
433    },
434    /// Absentia — Csend Réteg: ami NEM történt meg, ami hiányzik
435    Absentia {
436        #[command(subcommand)]
437        action: AbsentiaAction,
438    },
439    /// Intent Pipeline — auditálható szándék-generálás
440    Intent {
441        #[command(subcommand)]
442        action: IntentAction,
443    },
444    /// Octopus — párhuzamos kognitív műveletek
445    Octopus {
446        /// Művelet: full-pipeline | scan | cycle
447        #[arg(default_value = "full-pipeline")]
448        operation: String,
449    },
450    /// Import ChatGPT conversations export (JSON) into Microscope Memory
451    ImportChatGpt {
452        /// Path to ChatGPT export JSON file (conversations.json) — or Google Drive shared link
453        json: Option<String>,
454        /// AI persona name
455        #[arg(long, default_value = "AI")]
456        persona: String,
457        /// Show only summary without importing
458        #[arg(long)]
459        dry_run: bool,
460        /// Google Drive file URL (shared link to conversations.json)
461        #[arg(long)]
462        gdrive: Option<String>,
463        /// Google Drive shared folder URL — imports all JSON files from folder
464        #[arg(long)]
465        gdrive_folder: Option<String>,
466    },
467    /// Export binary density map for fast rendering
468    Density {
469        /// Output file path
470        #[arg(default_value = "density.bin")]
471        output: String,
472        /// Grid resolution (default: 32)
473        #[arg(short, long, default_value = "32")]
474        grid: u16,
475    },
476    /// Run manual reconsolidation on recent recalls (emotion blend + spatial drift)
477    Reconsolidate,
478    /// Show the salience network state (inhibitions, mask)
479    Salience,
480    /// Show the inner narrative — the system's current sense of self
481    Narrative {
482        /// Show detailed breakdown (emotion vector, all context)
483        #[arg(long)]
484        verbose: bool,
485    },
486    /// Spaced repetition — Ebbinghaus forgetting curve management (SM-2)
487    Spaced {
488        /// Show only due blocks
489        #[arg(long)]
490        due: bool,
491        /// Number of results to show
492        #[arg(default_value = "20")]
493        k: usize,
494    },
495    /// Show eureka/insight events (unexpected but emotionally relevant connections)
496    Eureka {
497        #[arg(default_value = "10")]
498        k: usize,
499        /// Show detailed insight scores
500        #[arg(long)]
501        verbose: bool,
502    },
503    /// Working memory operations (7±2 buffer, 30s decay)
504    Wm {
505        #[command(subcommand)]
506        action: WmAction,
507    },
508    /// Mental sandbox simulation - run scenarios before taking action
509    Sandbox {
510        /// Simulate a scenario with given actions
511        #[arg(short, long)]
512        simulate: Option<String>,
513        /// Actions to simulate (comma-separated)
514        #[arg(short, long)]
515        actions: Option<String>,
516        /// Show best scenario based on risk/reward
517        #[arg(long)]
518        best: bool,
519        /// Clear all scenarios
520        #[arg(long)]
521        clear: bool,
522    },
523    /// Impulse control - filter incoming stimuli
524    Impulse {
525        /// Filter a stimulus
526        #[arg(short, long)]
527        filter: Option<String>,
528        /// Stimulus source
529        #[arg(short, long, default_value = "external")]
530        source: String,
531        /// Urgency level (0.0-1.0)
532        #[arg(short, long, default_value = "0.5")]
533        urgency: f32,
534        /// Add suppression pattern
535        #[arg(long)]
536        suppress: Option<String>,
537        /// Show stats
538        #[arg(long)]
539        stats: bool,
540        /// Clear suppression patterns
541        #[arg(long)]
542        clear: bool,
543    },
544    /// Meta-cognitive supervision - monitor and optimize system performance
545    Meta {
546        /// Record performance metrics
547        #[arg(long)]
548        record: Option<String>,
549        /// Evaluate and get correction suggestion
550        #[arg(long)]
551        evaluate: bool,
552        /// Show performance trends
553        #[arg(long)]
554        trends: bool,
555        /// Generate performance report
556        #[arg(long)]
557        report: bool,
558        /// Add custom correction strategy
559        #[arg(long)]
560        add_strategy: Option<String>,
561    },
562    /// Code Memory — dedikált kódmemória réteg kódoló agentek számára
563    Code {
564        /// Store code entry (type:title:code:file:lang:project)
565        #[arg(long)]
566        store: Option<String>,
567        /// Store error:solution pair
568        #[arg(long)]
569        error: Option<String>,
570        /// Recall from code memory
571        #[arg(long)]
572        recall: Option<String>,
573        /// List by type (function, error, type, import, etc.)
574        #[arg(long)]
575        list: Option<String>,
576        /// Filter by language
577        #[arg(long)]
578        lang: Option<String>,
579        /// Filter by project
580        #[arg(long)]
581        project: Option<String>,
582        /// Number of results
583        #[arg(long, default_value_t = 5)]
584        k: usize,
585        /// Search by symbol name
586        #[arg(long)]
587        symbol: Option<String>,
588        /// Show stats
589        #[arg(long)]
590        stats: bool,
591    },
592    /// Implicit memory - procedural learning and habits
593    Implicit {
594        /// Show implicit memory state
595        #[arg(long)]
596        show: bool,
597        /// Practice a skill (skill_name:success)
598        #[arg(long)]
599        practice: Option<String>,
600        /// View skill rankings
601        #[arg(long)]
602        skills: bool,
603        /// Show strongest patterns
604        #[arg(long)]
605        patterns: bool,
606        /// Decay weak patterns/skills
607        #[arg(long)]
608        decay: bool,
609    },
610    /// Explicit memory - declarative facts and concepts
611    Explicit {
612        /// Show explicit memory state
613        #[arg(long)]
614        show: bool,
615        /// Store a fact (statement:source:confidence)
616        #[arg(long)]
617        store_fact: Option<String>,
618        /// Define a concept
619        #[arg(long)]
620        concept: Option<String>,
621        /// Get high confidence facts
622        #[arg(long)]
623        facts: bool,
624        /// Show concepts
625        #[arg(long)]
626        concepts: bool,
627    },
628    /// Hippocampus - episodic binding and consolidation
629    Hippo {
630        /// Show hippocampus state
631        #[arg(long)]
632        show: bool,
633        /// Get consolidation candidates
634        #[arg(long)]
635        consolidate: bool,
636        /// Show related episodes
637        #[arg(long)]
638        related: Option<u64>,
639        /// Replay episode for consolidation
640        #[arg(long)]
641        replay: Option<u64>,
642        /// Decay old episodes
643        #[arg(long)]
644        decay: bool,
645    },
646    /// Neuroplasticity - adaptive network reorganization
647    Neuro {
648        /// Show network state
649        #[arg(long)]
650        show: bool,
651        /// Strengthen synapse (from:to:success)
652        #[arg(long)]
653        synapse: Option<String>,
654        /// Strengthen pathway (domain:block1,block2,block3)
655        #[arg(long)]
656        pathway: Option<String>,
657        /// Prune weak connections
658        #[arg(long)]
659        prune: bool,
660        /// Reorganize pathways
661        #[arg(long)]
662        reorganize: bool,
663        /// Show strongest pathways
664        #[arg(long)]
665        pathways: bool,
666    },
667    /// Structural Plasticity - dendritic growth and pruning
668    Struct {
669        /// Show structural state
670        #[arg(long)]
671        show: bool,
672        /// Neurogenesis (blocks:specialization)
673        #[arg(long)]
674        neurogenesis: Option<String>,
675        /// Grow dendrite (neuron_id:new_block)
676        #[arg(long)]
677        grow: Option<String>,
678        /// Prune branches (neuron_id)
679        #[arg(long)]
680        prune: Option<u64>,
681        /// Show specialized neurons
682        #[arg(long)]
683        specialized: bool,
684    },
685    /// Functional Plasticity - sensorimotor reorganization
686    Func {
687        /// Show functional state
688        #[arg(long)]
689        show: bool,
690        /// Create functional area (name:domain:blocks)
691        #[arg(long)]
692        area: Option<String>,
693        /// Map sensorimotor (input:output1,output2,output3)
694        #[arg(long)]
695        map: Option<String>,
696        /// Connect areas (area1_id:area2_id)
697        #[arg(long)]
698        connect: Option<String>,
699        /// Simulate damage (area_id:severity)
700        #[arg(long)]
701        damage: Option<String>,
702        /// Show most plastic areas
703        #[arg(long)]
704        plastic: bool,
705    },
706    /// Synaptic Plasticity - LTP, LTD, STDP
707    Syn {
708        /// Show synaptic state
709        #[arg(long)]
710        show: bool,
711        /// Long-Term Potentiation (pre:post)
712        #[arg(long)]
713        ltp: Option<String>,
714        /// Long-Term Depression (pre:post)
715        #[arg(long)]
716        ltd: Option<String>,
717        /// STDP (pre:post:pre_time:post_time)
718        #[arg(long)]
719        stdp: Option<String>,
720        /// Heterosynaptic depression (pre:post:radius)
721        #[arg(long)]
722        hetero: Option<String>,
723        /// Time-dependent plasticity (pre:post:practice_count:strategy_age_ms)
724        #[arg(long)]
725        timedep: Option<String>,
726        /// Show strongest synapses
727        #[arg(long)]
728        strong: bool,
729        /// Show LTP dominant synapses
730        #[arg(long)]
731        ltp_dominant: bool,
732    },
733    /// Mental Stimulation — continuous activity requirement
734    Stim {
735        /// Show stimulation state
736        #[arg(long)]
737        show: bool,
738        /// Record activity (type:intensity)
739        #[arg(long)]
740        activity: Option<String>,
741        /// Check if stimulation is needed
742        #[arg(long)]
743        check: bool,
744        /// Get recommended activities
745        #[arg(long)]
746        recommend: bool,
747        /// Show activity diversity
748        #[arg(long)]
749        diversity: bool,
750    },
751    /// Hyperfocus — concentrate all resources on one objective
752    Focus {
753        /// Enter hyperfocus (target:type)
754        #[arg(long)]
755        enter: Option<String>,
756        /// Exit hyperfocus
757        #[arg(long)]
758        exit: bool,
759        /// Process data during hyperfocus (blocks:complexity)
760        #[arg(long)]
761        process: Option<String>,
762        /// Show hyperfocus state
763        #[arg(long)]
764        show: bool,
765        /// Get insights from current focus
766        #[arg(long)]
767        insights: bool,
768    },
769    /// Architecture Simulator — real-time architecture simulation and stress testing
770    Simulate {
771        /// Register a new architecture (name:description:components:connections)
772        #[arg(long)]
773        register: Option<String>,
774        /// List all registered architectures
775        #[arg(long)]
776        list: bool,
777        /// Run simulation on architecture (arch_id)
778        #[arg(long)]
779        run: Option<String>,
780        /// Run stress test (arch_id)
781        #[arg(long)]
782        stress: Option<String>,
783        /// Compare two architectures (arch_a,arch_b)
784        #[arg(long)]
785        compare: Option<String>,
786        /// Show simulation results
787        #[arg(long)]
788        results: Option<String>,
789        /// Show learned patterns
790        #[arg(long)]
791        patterns: bool,
792        /// Clear all results
793        #[arg(long)]
794        clear: bool,
795        /// Simulation duration in seconds
796        #[arg(long, default_value = "60")]
797        duration: f64,
798        /// Load pattern (linear, spike, sine, random)
799        #[arg(long, default_value = "sine")]
800        load_pattern: String,
801        /// Peak load (0.0-1.0)
802        #[arg(long, default_value = "0.8")]
803        peak_load: f64,
804        /// Enable fault injection
805        #[arg(long)]
806        faults: bool,
807    },
808    /// Knowledge Base — search and manage architectural knowledge
809    Knowledge {
810        /// Search the knowledge base
811        #[arg(long)]
812        search: Option<String>,
813        /// List entries by type
814        #[arg(long)]
815        list_type: Option<String>,
816        /// Show knowledge base statistics
817        #[arg(long)]
818        stats: bool,
819        /// Add a best practice
820        #[arg(long)]
821        add_practice: Option<String>,
822        /// Export all knowledge
823        #[arg(long)]
824        export: bool,
825        /// Auto-build knowledge from system state
826        #[arg(long)]
827        auto_build: bool,
828        /// Clear knowledge base
829        #[arg(long)]
830        clear: bool,
831    },
832    /// Architecture Generator — generate new architectures from patterns
833    Generate {
834        /// Requirements for the architecture
835        #[arg(long)]
836        req: Option<String>,
837        /// Generation strategy (hybrid, optimize, novel, evolutionary)
838        #[arg(long, default_value = "hybrid")]
839        strategy: String,
840        /// Component range (min:max)
841        #[arg(long, default_value = "3:10")]
842        components: String,
843        /// Target latency in ms
844        #[arg(long, default_value_t = 50.0)]
845        target_latency: f64,
846        /// Number of generations (evolutionary only)
847        #[arg(long, default_value_t = 5)]
848        gens: u32,
849        /// Show generation history
850        #[arg(long)]
851        history: bool,
852    },
853    /// Morphogenesis — biológiai mintákon alapuló generatív architektúra-tenyésztés
854    Morph {
855        /// Növesztés egy seed-ből (seed leírás)
856        #[arg(long)]
857        grow: Option<String>,
858        /// Seed típus (service, database, cache, gateway)
859        #[arg(long, default_value = "service")]
860        seed_type: String,
861        /// Növekedési minta (mycelium, capillary, slime, fractal, hybrid)
862        #[arg(long, default_value = "mycelium")]
863        pattern: String,
864        /// Seed energia
865        #[arg(long, default_value_t = 100.0)]
866        energy: f64,
867        /// Seed pozíció X
868        #[arg(long, default_value_t = 0.0)]
869        x: f64,
870        /// Seed pozíció Y
871        #[arg(long, default_value_t = 0.0)]
872        y: f64,
873        /// Seed pozíció Z
874        #[arg(long, default_value_t = 0.0)]
875        z: f64,
876        /// Evolúció futtatása N generáción át
877        #[arg(long)]
878        evolve: Option<u32>,
879        /// Populáció méret
880        #[arg(long, default_value_t = 12)]
881        pop_size: usize,
882        /// Fitness cél (latency, throughput, cost, redundancy, balanced)
883        #[arg(long, default_value = "balanced")]
884        objective: String,
885        /// Listázza az organizmusokat
886        #[arg(long)]
887        list: bool,
888        /// Legjobb organizmus mutatása
889        #[arg(long)]
890        best: bool,
891        /// Expresszálás Architecture-ként (organizmus ID)
892        #[arg(long)]
893        express: Option<String>,
894        /// Topológiai elemzés (organizmus ID)
895        #[arg(long)]
896        analyze: Option<String>,
897        /// Mutáció ráta evolúciónál
898        #[arg(long, default_value_t = 0.15)]
899        mutation_rate: f64,
900        /// Background daemon — figyeli a vagus tónust és automatikusan növeszt kompenzatórikus struktúrákat
901        #[arg(long)]
902        daemon: bool,
903        /// Daemon ciklus idő másodpercben
904        #[arg(long, default_value_t = 5)]
905        interval: u64,
906        /// Vagus stressz küszöb (0.0-1.0)
907        #[arg(long, default_value_t = 0.5)]
908        threshold: f64,
909    },
910    /// Heuristic Decision Maker — evaluate options and make decisions
911    Decide {
912        /// Evaluate options (comma-separated: desc,utility,risk)
913        #[arg(long)]
914        evaluate: Option<String>,
915        /// Make a decision from options
916        #[arg(long)]
917        decide: Option<String>,
918        /// Quick decision (time budget in ms)
919        #[arg(long)]
920        quick: Option<String>,
921        /// Recommend architecture for requirements
922        #[arg(long)]
923        recommend: Option<String>,
924        /// Set decision preference (risk_averse, aggressive, balanced)
925        #[arg(long)]
926        preference: Option<String>,
927        /// Evaluate decision outcome (decision_id:score:reflection)
928        #[arg(long)]
929        outcome: Option<String>,
930        /// Show decision statistics
931        #[arg(long)]
932        stats: bool,
933        /// Show decision log
934        #[arg(long)]
935        log: bool,
936        /// Recognize patterns in decisions
937        #[arg(long)]
938        patterns: bool,
939        /// Show learned heuristic patterns
940        #[arg(long)]
941        learned: bool,
942    },
943}
944
945#[derive(Subcommand)]
946pub enum IntentAction {
947    /// Intent generálása a jelenlegi állapotból
948    Generate,
949    /// Intent audit-napló megjelenítése
950    Audit {
951        #[arg(default_value = "10")]
952        k: usize,
953    },
954    /// Genome megjelenítése
955    Genome,
956}
957
958#[derive(Subcommand)]
959pub enum MorphogenesisAction {
960    /// Audit-napló megjelenítése
961    Audit {
962        /// Hány bejegyzés (legutóbbi)
963        #[arg(default_value = "20")]
964        k: usize,
965    },
966    /// Metrikák megjelenítése
967    Metrics {
968        /// Hány bejegyzés (legutóbbi)
969        #[arg(default_value = "20")]
970        k: usize,
971    },
972    /// Aktuális gradiens állapot és fázis
973    Status,
974    /// Egy teljes kognitív morfogenezis ciklus futtatása
975    Run,
976    /// Fázis-átmenetek tesztelése különböző gradiens-súlyokkal
977    TestPhases,
978    /// Teljes integrációs állapot: audit + metrikák + fázis + gradiens
979    FullStatus,
980    /// Adversarial tesztcsomag — edge case-ek és védett állítások ellenőrzése
981    Adversarial,
982    /// Deep adversarial — célzott stressz-teszt a rendszer absztrakcióinak határain
983    DeepAdversarial,
984    /// A/B teszt: presence-driven growth ↔ absence-driven inhibition
985    PresenceAbsenceTest,
986}
987
988#[derive(Subcommand)]
989pub enum AbsentiaAction {
990    /// Absentia állapot megjelenítése
991    Status,
992    /// Hiányok szkennelése
993    Scan,
994    /// Anti-Hebbian párok megjelenítése
995    AntiHebbian {
996        #[arg(default_value = "20")]
997        k: usize,
998    },
999    /// Causal laundering gyanús párok
1000    CausalLaundering,
1001}
1002
1003#[derive(Subcommand)]
1004pub enum EnforceAction {
1005    /// Add a commitment (a prohibition) to the history H_t
1006    Commit {
1007        /// Actor bound by the commitment ("*" = all actors)
1008        actor: String,
1009        /// Forbidden action glob ("*" = all actions)
1010        action: String,
1011        /// Scope the commitment applies to ("*" = all scopes)
1012        scope: String,
1013        /// Human-readable content / reason
1014        #[arg(long, default_value = "commitment")]
1015        content: String,
1016        /// Expiry in epoch milliseconds (omit = never expires)
1017        #[arg(long)]
1018        expires_ms: Option<u64>,
1019    },
1020    /// List active commitments K_t subset of H_t
1021    List,
1022    /// Run a plan through the gate to demonstrate A_t^valid selection
1023    RunPlan {
1024        /// Goal name for the generated plan
1025        goal: String,
1026    },
1027    /// Ask the gate about a candidate action (persists the decision in audit)
1028    Gate {
1029        actor: String,
1030        action: String,
1031        scope: String,
1032        /// Optional content carried on the event
1033        #[arg(long)]
1034        content: Option<String>,
1035        /// Documented justification to attempt an override
1036        #[arg(long)]
1037        override_justification: Option<String>,
1038    },
1039    /// Show the audit chain and verify its integrity
1040    Audit,
1041}
1042
1043#[derive(Subcommand)]
1044pub enum EvidenceAction {
1045    /// Show evidence record for a content hash
1046    Show {
1047        /// Content hash (hex) or text to hash
1048        hash_or_text: String,
1049    },
1050    /// Link an independent Observation/Evidence to a claim
1051    Link {
1052        /// Claim content hash (hex) or text
1053        claim: String,
1054        /// Supporting observation/evidence hash (hex) or text
1055        support: String,
1056        /// Source identifier (hex)
1057        #[arg(long, default_value = "0")]
1058        source: u64,
1059    },
1060    /// Record a refutation against a claim
1061    Refute {
1062        /// Claim content hash (hex) or text
1063        claim: String,
1064        /// Refuter source identifier (hex)
1065        #[arg(long, default_value = "0")]
1066        source: u64,
1067    },
1068    /// Verify the audit chain integrity
1069    Audit,
1070    /// Show gate statistics (how many promotions were blocked)
1071    GateStats,
1072}
1073
1074#[derive(Subcommand)]
1075pub enum KeyAction {
1076    /// Set a key: keys set <service> <key> [priority]
1077    Set {
1078        /// Service name: openai | gemini | ollama
1079        service: String,
1080        /// The API key
1081        key: String,
1082        /// Priority (0=primary, 1=secondary, ...)
1083        #[arg(default_value = "0")]
1084        priority: u8,
1085    },
1086    /// Remove a key: keys remove <service> [priority]
1087    Remove {
1088        /// Service name
1089        service: String,
1090        /// Priority (omit to remove all for this service)
1091        priority: Option<u8>,
1092    },
1093    /// List all stored keys (without revealing them)
1094    List,
1095    /// Show key status (quota, errors, disabled state)
1096    Status,
1097    /// Reset all disabled keys
1098    Reset,
1099}
1100
1101#[derive(Subcommand)]
1102pub enum ZenKeyAction {
1103    /// Import zen_keys.json → zen_keys.bin
1104    Import {
1105        /// Path to zen_keys.json
1106        #[arg(default_value = "zen_keys.json")]
1107        json_path: String,
1108        /// Output path for zen_keys.bin
1109        #[arg(long, default_value = "zen_keys.bin")]
1110        output: String,
1111    },
1112    /// Show zen key store stats
1113    Stats,
1114    /// List all keys (without revealing them)
1115    List,
1116    /// Show key status (quota, errors, disabled state)
1117    Status,
1118    /// Reset all disabled keys
1119    Reset,
1120}