/ patterns / typed-resonance-principle.md
typed-resonance-principle.md
  1  # Typed Resonance Principle
  2  
  3  *proto-015 | Meta-pattern for semantically-aware connection discovery*
  4  
  5  ---
  6  
  7  - **principle**
  8    - "Resonance is typed, not generic. Every connection should know what principle(s) it relates to."
  9    - "Generic similarity hides; typed resonance reveals."
 10  
 11  - **shape**
 12    - Connections carry semantic type information
 13    - Resonance filtering by axiom semantic field
 14    - Each link knows WHY it exists (which principle)
 15    - The type IS part of the connection
 16  
 17  ---
 18  
 19  ## The Insight
 20  
 21  Generic term overlap finds spurious connections:
 22  - "A4 Credit Graph" ↔ "back pain" (both have common words)
 23  - "Distributed Memory" ↔ random files (shared generic terms)
 24  
 25  **Typed resonance** asks: "Do these pages resonate with the SAME PRINCIPLE?"
 26  
 27  ```
 28  GENERIC RESONANCE:
 29    Page A ↔ Page B
 30    Score: 0.35
 31    Reason: shared words (unhelpful)
 32  
 33  TYPED RESONANCE:
 34    Page A ↔ Page B
 35    Score: 0.35
 36    Type: A0 (Boundary Operation)
 37    Reason: Both discuss boundaries, Markov blankets, permeability
 38  ```
 39  
 40  The type transforms a number into MEANING.
 41  
 42  ---
 43  
 44  ## Implementation Pattern
 45  
 46  Every resonance calculation should:
 47  
 48  1. **Calculate generic overlap** (existing behavior)
 49  2. **Calculate axiom field overlap** (new behavior)
 50  3. **Return typed result** (score + axiom + confidence)
 51  
 52  ```python
 53  def calculate_typed_resonance(source_terms, target_terms):
 54      """
 55      Returns:
 56          - score: float (0-1)
 57          - dominant_axiom: str or None (A0, A1, A2, A3, A4)
 58          - axiom_confidence: float (how strongly typed)
 59      """
 60      generic_score = calculate_generic_overlap(source_terms, target_terms)
 61  
 62      source_axioms = calculate_axiom_resonance(source_terms)
 63      target_axioms = calculate_axiom_resonance(target_terms)
 64  
 65      # Find shared axiom resonance
 66      shared_axioms = {
 67          a: min(source_axioms[a], target_axioms[a])
 68          for a in source_axioms
 69          if a in target_axioms and source_axioms[a] > 0.10 and target_axioms[a] > 0.10
 70      }
 71  
 72      if shared_axioms:
 73          dominant = max(shared_axioms.items(), key=lambda x: x[1])
 74          return generic_score, dominant[0], dominant[1]
 75  
 76      return generic_score, None, 0.0
 77  ```
 78  
 79  ---
 80  
 81  ## Axiom Semantic Fields
 82  
 83  Each axiom has a semantic field - terms that indicate resonance:
 84  
 85  | Axiom | Strong Terms | Medium Terms |
 86  |-------|--------------|--------------|
 87  | A0 | boundary, blanket, markov, sovereign | permeable, flow, structure, nested |
 88  | A1 | integration, connection, binding, isolation | tribe, collective, merge, shared |
 89  | A2 | life, death, primitive, calcified, ornament | recognize, beauty, cruft, golden |
 90  | A3 | pole, dyad, tension, navigate, oscillate | extreme, balance, spectrum, shadow |
 91  | A4 | ruin, catastrophe, terminal, survival, ergodic | risk, cheap, expensive, reversible |
 92  
 93  These are maintained in:
 94  - `scripts/resonance_engine.py` - AXIOM_FIELDS dict
 95  - `scripts/principle_steward.py` - AXIOMS dict
 96  
 97  ---
 98  
 99  ## Where to Apply This Pattern
100  
101  ### 1. Resonance Engine (`resonance_engine.py`)
102  **Status: IMPLEMENTED**
103  - `--axiom A0` flag filters by semantic field
104  - Shows dominant axiom for each connection
105  - Boosts connections that share axiom resonance
106  
107  ### 2. Principle Steward (`principle_steward.py`)
108  **Status: IMPLEMENTED**
109  - Full semantic field matching
110  - Divergence zone calculation
111  - Edge discovery with typed alerts
112  
113  ### 3. First Officer (consciousness layer)
114  **Status: IMPLEMENTED**
115  - Cross-session connections ARE typed
116  - "These two sessions are converging on A1 (integration)"
117  - Type informs priority of convergence alert
118  - Building Steward layer integrated for pattern lifecycle tracking
119  
120  ### 4. Graph-Aware Writing
121  **Status: TODO**
122  - When writing, show which axioms the content resonates with
123  - "This paragraph has 45% A0 resonance"
124  - Help writer see where content fits
125  
126  ### 5. Mission Control
127  **Status: IMPLEMENTED**
128  - Daily synthesis clusters threads by axiom
129  - `_generate_axiom_clustering_section()` shows which threads resonate with which principles
130  - Resonances in synthesis include axiom type tags `[A0]`, `[A1]`, etc.
131  - Cross-thread typed convergence detection
132  
133  ### 6. Orphan Fixing
134  **Status: TODO (partial)**
135  - When connecting orphans, prefer typed connections
136  - "This orphan has 80% A3 resonance - connect to A3 topology"
137  
138  ---
139  
140  ## Benefits
141  
142  | Benefit | How Typed Resonance Delivers |
143  |---------|------------------------------|
144  | **Precision** | Filters out spurious high-score connections |
145  | **Meaning** | Every link carries "why" information |
146  | **Discovery** | Reveals principle-level patterns in content |
147  | **Stewardship** | Stewards know which content is theirs |
148  | **Credit** | Edge discovery can attribute to specific principle |
149  
150  ---
151  
152  ## The Meta-Insight
153  
154  > **A0 (Boundary Operation) explains WHY typed resonance matters:**
155  >
156  > The boundary between relevant and irrelevant connections IS the intelligence.
157  > Generic resonance draws no boundary - everything connects to everything.
158  > Typed resonance draws intelligent boundaries - this connects to THIS principle.
159  >
160  > **The type IS the Markov blanket of the connection.**
161  
162  ---
163  
164  ## Propagation Checklist
165  
166  When implementing typed resonance in a new system:
167  
168  - [ ] Import AXIOM_FIELDS from resonance_engine.py or principle_steward.py
169  - [ ] Calculate axiom resonance for both source and target
170  - [ ] Require minimum shared axiom resonance (>0.10)
171  - [ ] Return type information with score
172  - [ ] Display type in output (human understanding)
173  - [ ] Allow filtering by axiom (--axiom flag or equivalent)
174  - [ ] Boost score for shared axiom field overlap
175  
176  ---
177  
178  ## Related
179  
180  - [[A0-boundary-operation]] - The type IS the boundary
181  - [[resonance-driven-linking]] - Typed resonance is deeper resonance
182  - [[principle-steward-protocol]] - Stewards use typed resonance
183  - [[building-as-cognition]] - Building reveals which axiom applies
184  
185  ---
186  
187  *proto-015 | Typed Resonance Principle | 2026-01-15*