|
| 1 | +//! The 34 reasoning-tactic **recipes** — the working catalogue spine. |
| 2 | +//! |
| 3 | +//! A *recipe* is a named composition over OUR substrate (atoms, SPO 2³ masks, NARS |
| 4 | +//! truth, CollapseGate SD, markers) that realizes one of the 34 LLM reasoning tactics. |
| 5 | +//! |
| 6 | +//! # Spec source, not dependency |
| 7 | +//! |
| 8 | +//! The 34 are specified by the ladybug-rs `34_TACTICS_x_REASONING_LADDER` doc and the |
| 9 | +//! Sun et al. (2025) reasoning ladder. **ladybug-rs is the failed "empty cathedral" — a |
| 10 | +//! reference for *what each tactic must do*, never a dependency or port target** (see |
| 11 | +//! `.claude/knowledge/ada-rewrite-charter.md` D0). Every recipe composes *our* primitives. |
| 12 | +//! |
| 13 | +//! This module is the **catalogue spine**: the 34 as data + registry + lookups, each |
| 14 | +//! tagged with its difficulty Tier, the structural Mechanism it uses, the hardware |
| 15 | +//! Bucket it lives in, and its SPO-2³ causal coverage. Per-recipe *evaluators* land |
| 16 | +//! incrementally as substrate readiness allows (charter D4). |
| 17 | +
|
| 18 | +/// Sun et al. (2025) reasoning-ladder difficulty tier the tactic addresses. |
| 19 | +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
| 20 | +pub enum Tier { |
| 21 | + /// Hard tier (~65% plateau) — multiplicative error across dependent steps. |
| 22 | + Hard, |
| 23 | + /// Extremely-Hard tier (<10%) — convergent lock-in, no creative leap. |
| 24 | + ExtremelyHard, |
| 25 | + /// Cross-tier infrastructure — helps at every difficulty. |
| 26 | + CrossTier, |
| 27 | +} |
| 28 | + |
| 29 | +/// The structural mechanism (the 3 that LLMs lack) the tactic relies on. |
| 30 | +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
| 31 | +pub enum Mechanism { |
| 32 | + /// Parallel independence vs sequential dependency (breaks `P=p^n`). |
| 33 | + ParallelIndependence, |
| 34 | + /// Truth-aware inference (NARS truth/revision/abduction) vs next-token prob. |
| 35 | + TruthAwareInference, |
| 36 | + /// Structural divergence vs convergent optimization. |
| 37 | + StructuralDivergence, |
| 38 | + /// Cross-cutting infrastructure (memory, fusion, scaffolding, diagnostics). |
| 39 | + Infrastructure, |
| 40 | +} |
| 41 | + |
| 42 | +/// The hardware-design partition the recipe executes in (charter D2). |
| 43 | +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
| 44 | +pub enum Bucket { |
| 45 | + /// Uniform, branch-free, every-cycle SIMD — runs in `cognitive-shader-driver`. |
| 46 | + Datapath, |
| 47 | + /// Branchy decision at a control point — planner + `escalation`. |
| 48 | + Control, |
| 49 | + /// A cheap marker that gates whether deeper work fires — `elevation`/CollapseGate SD. |
| 50 | + Gate, |
| 51 | +} |
| 52 | + |
| 53 | +/// SPO 2³ causal-lattice coverage (see `.claude/knowledge/spo-2cubed-list-coverage.md`). |
| 54 | +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
| 55 | +pub enum Coverage { |
| 56 | + /// Maps onto the causal lattice (the projections / Pearl levels). |
| 57 | + Covered, |
| 58 | + /// Some members ride the lattice, rest orthogonal. |
| 59 | + Partial, |
| 60 | + /// Orthogonal axis (operation / meta / gate / memory / qualia). |
| 61 | + NotCovered, |
| 62 | +} |
| 63 | + |
| 64 | +/// One reasoning-tactic recipe. |
| 65 | +#[derive(Debug, Clone, Copy)] |
| 66 | +pub struct Recipe { |
| 67 | + /// Tactic number 1..=34 (Stakelum/ladybug numbering). |
| 68 | + pub id: u8, |
| 69 | + /// Short code, e.g. `"RCR"`. |
| 70 | + pub code: &'static str, |
| 71 | + /// Human name. |
| 72 | + pub name: &'static str, |
| 73 | + pub tier: Tier, |
| 74 | + pub mechanism: Mechanism, |
| 75 | + pub bucket: Bucket, |
| 76 | + pub spo2cubed: Coverage, |
| 77 | + /// The OUR-substrate primitive(s) that realize it (charter D3). |
| 78 | + pub substrate: &'static str, |
| 79 | +} |
| 80 | + |
| 81 | +use Bucket::*; |
| 82 | +use Coverage::*; |
| 83 | +use Mechanism::*; |
| 84 | +use Tier::*; |
| 85 | + |
| 86 | +/// The 34 recipes. Order = id ascending. |
| 87 | +pub const RECIPES: [Recipe; 34] = [ |
| 88 | + Recipe { id: 1, code: "RTE", name: "Recursive Thought Expansion", tier: Hard, mechanism: ParallelIndependence, bucket: Control, spo2cubed: NotCovered, substrate: "rung depth × Expand/Compress; Berry-Esseen stop" }, |
| 89 | + Recipe { id: 2, code: "HTD", name: "Hierarchical Thought Decomposition", tier: Hard, mechanism: ParallelIndependence, bucket: Control, spo2cubed: NotCovered, substrate: "CLAM bipolar split / Decompose op" }, |
| 90 | + Recipe { id: 3, code: "SMAD", name: "Structured Multi-Agent Debate", tier: ExtremelyHard, mechanism: TruthAwareInference, bucket: Control, spo2cubed: NotCovered, substrate: "a2a_blackboard + InnerCouncil (NARS-revised vote)" }, |
| 91 | + Recipe { id: 4, code: "RCR", name: "Reverse Causality Reasoning", tier: ExtremelyHard, mechanism: StructuralDivergence, bucket: Control, spo2cubed: Covered, substrate: "SPO 2³ backward S_O + Abduction + Granger" }, |
| 92 | + Recipe { id: 5, code: "TCP", name: "Thought Chain Pruning", tier: Hard, mechanism: ParallelIndependence, bucket: Gate, spo2cubed: NotCovered, substrate: "CollapseGate SD BLOCK prunes branch" }, |
| 93 | + Recipe { id: 6, code: "TR", name: "Thought Randomization", tier: ExtremelyHard, mechanism: StructuralDivergence, bucket: Gate, spo2cubed: NotCovered, substrate: "temperature (Staunen) perturb above noise floor" }, |
| 94 | + Recipe { id: 7, code: "ASC", name: "Adversarial Self-Critique", tier: ExtremelyHard, mechanism: TruthAwareInference, bucket: Control, spo2cubed: Partial, substrate: "InnerCouncil split / 5 challenge types (negation projection)" }, |
| 95 | + Recipe { id: 8, code: "CAS", name: "Conditional Abstraction Scaling", tier: CrossTier, mechanism: Infrastructure, bucket: Gate, spo2cubed: NotCovered, substrate: "HDR cascade INT1/4/8/32 × Abstract↔Concretize" }, |
| 96 | + Recipe { id: 9, code: "IRS", name: "Iterative Roleplay Synthesis", tier: ExtremelyHard, mechanism: StructuralDivergence, bucket: Control, spo2cubed: NotCovered, substrate: "persona FieldModulation (structurally distinct kernels)" }, |
| 97 | + Recipe { id: 10, code: "MCP", name: "Meta-Cognition Prompting", tier: Hard, mechanism: TruthAwareInference, bucket: Control, spo2cubed: NotCovered, substrate: "MUL DK + Brier calibration; Meta lane" }, |
| 98 | + Recipe { id: 11, code: "CR", name: "Contradiction Resolution", tier: Hard, mechanism: TruthAwareInference, bucket: Control, spo2cubed: Partial, substrate: "NARS opposing-truth detect + coherence; Contradiction preserved" }, |
| 99 | + Recipe { id: 12, code: "TCA", name: "Temporal Context Augmentation", tier: CrossTier, mechanism: Infrastructure, bucket: Datapath, spo2cubed: NotCovered, substrate: "Granger temporal lane / Markov ±5 / 24 temporal verbs" }, |
| 100 | + Recipe { id: 13, code: "CDT", name: "Convergent & Divergent Thinking", tier: ExtremelyHard, mechanism: StructuralDivergence, bucket: Gate, spo2cubed: NotCovered, substrate: "explore↔exploit temperature; style oscillation" }, |
| 101 | + Recipe { id: 14, code: "MCT", name: "Multimodal Chain-of-Thought", tier: CrossTier, mechanism: Infrastructure, bucket: Datapath, spo2cubed: NotCovered, substrate: "GrammarTriangle: NSM+Causality+Qualia → one fingerprint" }, |
| 102 | + Recipe { id: 15, code: "LSI", name: "Latent Space Introspection", tier: CrossTier, mechanism: Infrastructure, bucket: Control, spo2cubed: NotCovered, substrate: "CRP distribution / Mexican-hat over fingerprint clusters" }, |
| 103 | + Recipe { id: 16, code: "PSO", name: "Prompt Scaffold Optimization", tier: CrossTier, mechanism: Infrastructure, bucket: Control, spo2cubed: NotCovered, substrate: "ThinkingTemplate slots + TD-learned discovery" }, |
| 104 | + Recipe { id: 17, code: "CDI", name: "Cognitive Dissonance Induction", tier: CrossTier, mechanism: TruthAwareInference, bucket: Control, spo2cubed: Partial, substrate: "Festinger dissonance = opposing NARS truth on similar fp; HOLD" }, |
| 105 | + Recipe { id: 18, code: "CWS", name: "Context Window Simulation", tier: CrossTier, mechanism: Infrastructure, bucket: Control, spo2cubed: NotCovered, substrate: "persistent BindSpace / WitnessCorpus / episodic memory" }, |
| 106 | + Recipe { id: 19, code: "ARE", name: "Algorithmic Reverse Engineering", tier: CrossTier, mechanism: Infrastructure, bucket: Datapath, spo2cubed: NotCovered, substrate: "ABBA unbind: A⊗B⊗B=A (exact algebraic inverse)" }, |
| 107 | + Recipe { id: 20, code: "TCF", name: "Thought Cascade Filtering", tier: Hard, mechanism: ParallelIndependence, bucket: Gate, spo2cubed: NotCovered, substrate: "N search strategies + agreement rate; SD select" }, |
| 108 | + Recipe { id: 21, code: "SSR", name: "Self-Skepticism Reinforcement", tier: Hard, mechanism: TruthAwareInference, bucket: Control, spo2cubed: Partial, substrate: "challenge schedule × MUL uncertainty; truth-drop = weak" }, |
| 109 | + Recipe { id: 22, code: "ETD", name: "Emergent Task Decomposition", tier: CrossTier, mechanism: Infrastructure, bucket: Control, spo2cubed: NotCovered, substrate: "CLAM cluster geometry determines subtasks (no spec)" }, |
| 110 | + Recipe { id: 23, code: "AMP", name: "Adaptive Meta-Prompting", tier: ExtremelyHard, mechanism: StructuralDivergence, bucket: Control, spo2cubed: NotCovered, substrate: "TD-learning on ThinkingStyle Q-values (W32-39)" }, |
| 111 | + Recipe { id: 24, code: "ZCF", name: "Zero-Shot Concept Fusion", tier: CrossTier, mechanism: Infrastructure, bucket: Datapath, spo2cubed: NotCovered, substrate: "VSA bind(A,B): new vector valid in both spaces, recoverable" }, |
| 112 | + Recipe { id: 25, code: "HPM", name: "Hyperdimensional Pattern Matching", tier: CrossTier, mechanism: Infrastructure, bucket: Datapath, spo2cubed: NotCovered, substrate: "the substrate: fingerprint cosine/Hamming sweep (SIMD)" }, |
| 113 | + Recipe { id: 26, code: "CUR", name: "Cascading Uncertainty Reduction", tier: Hard, mechanism: ParallelIndependence, bucket: Gate, spo2cubed: NotCovered, substrate: "FreeEnergy / CRP percentiles; coarse-to-fine prune" }, |
| 114 | + Recipe { id: 27, code: "MPC", name: "Multi-Perspective Compression", tier: CrossTier, mechanism: Infrastructure, bucket: Datapath, spo2cubed: NotCovered, substrate: "bundle = majority-vote-per-bit consensus + delta encode" }, |
| 115 | + Recipe { id: 28, code: "SSAM", name: "Self-Supervised Analogical Mapping", tier: ExtremelyHard, mechanism: StructuralDivergence, bucket: Datapath, spo2cubed: Partial, substrate: "NARS analogy A→B,C≈A⊢C→B; bind+similarity (Gentner)" }, |
| 116 | + Recipe { id: 29, code: "IDR", name: "Intent-Driven Reframing", tier: CrossTier, mechanism: Infrastructure, bucket: Control, spo2cubed: NotCovered, substrate: "GrammarTriangle CausalityFlow agent/action/patient/reason" }, |
| 117 | + Recipe { id: 30, code: "SPP", name: "Shadow Parallel Processing", tier: Hard, mechanism: ParallelIndependence, bucket: Control, spo2cubed: Partial, substrate: "independent paths + agreement (ECC/RAID); the CF majority/minority fork" }, |
| 118 | + Recipe { id: 31, code: "ICR", name: "Iterative Counterfactual Reasoning", tier: ExtremelyHard, mechanism: StructuralDivergence, bucket: Control, spo2cubed: Covered, substrate: "world⊗factual⊗counterfactual (XOR self-inverse); SPO=0b111; CausalEdge64 −6 mantissa" }, |
| 119 | + Recipe { id: 32, code: "SDD", name: "Semantic Distortion Detection", tier: CrossTier, mechanism: Infrastructure, bucket: Datapath, spo2cubed: NotCovered, substrate: "Berry-Esseen noise floor + reciprocal A→B,B→A validation" }, |
| 120 | + Recipe { id: 33, code: "DTMF", name: "Dynamic Task Meta-Framing", tier: CrossTier, mechanism: Infrastructure, bucket: Control, spo2cubed: NotCovered, substrate: "template switch on CollapseGate BLOCK (shift all modulation)" }, |
| 121 | + Recipe { id: 34, code: "HKF", name: "Hyperdimensional Knowledge Fusion", tier: ExtremelyHard, mechanism: StructuralDivergence, bucket: Datapath, spo2cubed: NotCovered, substrate: "cross-domain bind(A,rel,B); reversible/auditable fusion" }, |
| 122 | +]; |
| 123 | + |
| 124 | +/// Look up a recipe by tactic id (1..=34). |
| 125 | +#[inline] |
| 126 | +pub fn recipe(id: u8) -> Option<&'static Recipe> { |
| 127 | + RECIPES.iter().find(|r| r.id == id) |
| 128 | +} |
| 129 | + |
| 130 | +/// Look up a recipe by short code (e.g. `"RCR"`). |
| 131 | +#[inline] |
| 132 | +pub fn recipe_by_code(code: &str) -> Option<&'static Recipe> { |
| 133 | + RECIPES.iter().find(|r| r.code == code) |
| 134 | +} |
| 135 | + |
| 136 | +/// All recipes sharing a mechanism. |
| 137 | +pub fn by_mechanism(m: Mechanism) -> impl Iterator<Item = &'static Recipe> { |
| 138 | + RECIPES.iter().filter(move |r| r.mechanism == m) |
| 139 | +} |
| 140 | + |
| 141 | +/// All recipes that ride the SPO 2³ causal lattice (Covered or Partial). |
| 142 | +pub fn causal() -> impl Iterator<Item = &'static Recipe> { |
| 143 | + RECIPES.iter().filter(|r| matches!(r.spo2cubed, Coverage::Covered | Coverage::Partial)) |
| 144 | +} |
| 145 | + |
| 146 | +#[cfg(test)] |
| 147 | +mod tests { |
| 148 | + use super::*; |
| 149 | + |
| 150 | + #[test] |
| 151 | + fn catalogue_is_complete_34_ids_unique() { |
| 152 | + assert_eq!(RECIPES.len(), 34); |
| 153 | + for (i, r) in RECIPES.iter().enumerate() { |
| 154 | + assert_eq!(r.id as usize, i + 1, "recipes must be id-ordered 1..=34"); |
| 155 | + assert!(!r.code.is_empty() && !r.name.is_empty() && !r.substrate.is_empty()); |
| 156 | + } |
| 157 | + } |
| 158 | + |
| 159 | + #[test] |
| 160 | + fn lookups_work() { |
| 161 | + assert_eq!(recipe(4).unwrap().code, "RCR"); |
| 162 | + assert_eq!(recipe(31).unwrap().code, "ICR"); |
| 163 | + assert_eq!(recipe_by_code("HPM").unwrap().id, 25); |
| 164 | + assert!(recipe(0).is_none() && recipe(35).is_none()); |
| 165 | + } |
| 166 | + |
| 167 | + #[test] |
| 168 | + fn only_causal_tactics_are_2cubed_covered() { |
| 169 | + // Exactly RCR (#4) and ICR (#31) fully cover the causal lattice. |
| 170 | + let covered: Vec<u8> = RECIPES.iter().filter(|r| r.spo2cubed == Coverage::Covered).map(|r| r.id).collect(); |
| 171 | + assert_eq!(covered, vec![4, 31]); |
| 172 | + // 2³ is the causal spine only — the rest are Partial or orthogonal. |
| 173 | + assert!(causal().count() < RECIPES.len() / 2, "most tactics are NOT causal"); |
| 174 | + } |
| 175 | + |
| 176 | + #[test] |
| 177 | + fn mechanism_tally_matches_the_ladder_doc() { |
| 178 | + let count = |m: Mechanism| by_mechanism(m).count(); |
| 179 | + assert_eq!(count(Mechanism::ParallelIndependence), 6); // #1,2,5,20,26,30 |
| 180 | + assert_eq!(count(Mechanism::TruthAwareInference), 6); // #3,7,10,11,17,21 |
| 181 | + assert_eq!(count(Mechanism::StructuralDivergence), 8); // #4,6,9,13,23,28,31,34 |
| 182 | + assert_eq!(count(Mechanism::Infrastructure), 14); |
| 183 | + } |
| 184 | +} |
0 commit comments