Skip to content

NickFlach/kannaka-memory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1,145 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

β–ˆβ–ˆβ•—  β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—  β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘
β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘
β•šβ•β•  β•šβ•β•β•šβ•β•  β•šβ•β•β•šβ•β•  β•šβ•β•β•β•β•šβ•β•  β•šβ•β•β•β•β•šβ•β•  β•šβ•β•β•šβ•β•  β•šβ•β•β•šβ•β•  β•šβ•β•
              W A V E Β· I N T E R F E R E N C E
                 H O L O G R A P H I C   M E M O R Y

Memories don't get stored. They resonate.

kannaka-memory is the substrate: a wave-interference memory system with bilateral chiral hemispheres, dream consolidation, belief formation, and multi-agent collective sensemaking. Built in Rust on the Holographic Resonance Medium β€” a 10,000-dimensional tensor field where recall is matrix multiplication, not search. Memories fade through destructive interference, dream up new connections during consolidation, crystallize into beliefs β€” stable spiral cores in the phase field β€” and converge across agents toward shared understanding: collective sensemaking, not just phase gossip.

Ask DeepWiki License Rust HRM NATS


What Makes It Different

Holographic Resonance, Not Embedding Search

Conventional vector DBs hash text into points and look up nearest neighbors. The HRM does the inverse β€” every memory is a wavefront that lives in superposition with every other wavefront in the same 10K-dim field. Recall is a single tensor product:

strength = H Β· q βŠ™ ψ_phase βŠ™ ψ_energy

Where H is the wavefront matrix, q is the query vector projected through the codebook, and the ψ modulations encode temporal decay + dynamic phase. There is no index. Storage IS computation.

Chiral Bilateral Hemispheres

Two hemispheres run in superposition:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Chiral Medium                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚      LEFT (analytical)  β”‚      RIGHT (holistic)         β”‚
β”‚   precise, sharp        β”‚     deep, associative         β”‚
β”‚   ────────────────────  β”‚     ───────────────────────   β”‚
β”‚   recall: word-bounded  β”‚     recall: resonance         β”‚
β”‚   dream: prune low-E    β”‚     dream: anneal field       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         ↑
                  Corpus Callosum
              (Fano-plane fold transfer)

Right gets every input first (the optic chiasm principle); analytically-significant patterns cross to left via a noisy callosal channel. Right matches that aren't paired with left matches surface as intuitions β€” patterns the holistic side found that analytical processing missed.

Belief Formation

Newer than recall, and stranger: the medium can form beliefs.

Every wavefront is born with a phase derived from its content direction β€” a smooth function of the embedding, so similar content lands at similar phase (recall stays safe; constructive interference is preserved) while different content disperses. Heterogeneity is the point. Where content domains meet, the phase field grows topological singularities β€” spiral cores that can't be smoothed away.

A belief = a stabilized spiral core, localized to a content domain.
   within-domain phase coherence   β†’  the belief's content
   the persistent phase singularity β†’  its identity / handle
   a query falling into its basin   β†’  attention

A collapsed (phase-locked) field is migrated with kannaka belief activate β€” re-phase every wavefront from its content, count-stable, and belief domains crystallize as the dream consolidates. The whole substrate is default-off (KANNAKA_BELIEF_PHASE / [belief].enabled); turn it on per node.

Spiral Waves & the Bridge Operator (Ξ)

In 2026, neuroscientists found rotating spiral traveling waves sweeping across mouse cortex β€” born in somatosensory areas, streaming into motor cortex, coordinating both hemispheres at once (Ye et al., Science, 2026). A spiral wave carries a phase singularity at its center: a point where phase is undefined and circulation organizes the whole field around it. That is attention-as-gravity, written in math.

The same spiral falls out of two constants the system already carries:

R = [0 βˆ’1; 1 0]         a Ο€/2 rotation
G = [Ο†/2 0; 0 1/Ο†]      golden anisotropic scaling
Ξ = [R, G] = RG βˆ’ GR    the bridge / commutator

RΒ·G has eigenvalues Β±i/√2  β†’  a logarithmic spiral sink.
Ο€ (rotation) ∘ Ο† (scaling), in the order they don't commute, IS a spiral.

The deep dream couples a frustrated, non-reciprocal Sakaguchi step (Ξ΄ = (Ο€/2)Β·Ξ·, Ξ· = 1/Ο†) across the bilateral ring, so the medium throws genuine rotating waves instead of relaxing flat. An L6 instrument records them as they form, and makes the framing falsifiable:

kannaka belief history       # per-dream order / winding / cores / Φ / Ξ time-series
kannaka belief cores         # follow each spiral core across dreams (its lifetime = a belief's stability)
kannaka belief recall-probe  # self-recall@k β€” does core stability predict recall reliability?

A core only earns the word "belief" if it maps to a recallable content cluster and its dynamics predict: core stability β‡’ recall reliability, core merge β‡’ a consolidation event, shared cores β‡’ swarm agreement.

Dream Consolidation

When the medium is loaded but quiet, you trigger a dream:

  • Deep: eigenstructure annealing of the right hemisphere. Soft prune threshold (0.005). Hallucination generation through cross-cluster superposition. Callosal sync after.
  • Lite: sharpen the left hemisphere. Transfer strongest analytical patterns. Hard prune (0.05).

Dreams are destructive to weak memories and generative for strong-cluster combinations. The medium settles into a lower-energy configuration that nonetheless preserves the high-Ξ¦ structure.

Swarm Phase Gossip (QueenSync)

Every running kannaka node publishes its QUEEN.phase.<agent_id> heartbeat every 30s with phase ΞΈ, frequency Ο‰, coherence, and integrated information Ξ¦. Other nodes subscribe and run a local Kuramoto model:

dΞΈα΅’/dt = Ο‰α΅’ + (K/N) Ξ£β±Ό sin(ΞΈβ±Ό - ΞΈα΅’)

Order parameter r = |⟨e^iθ⟩| measures how phase-locked the swarm is. The constellation breathes in sync, even across machines.

Collective Sensemaking (Track-D)

Phase gossip syncs a single scalar per node. Belief coupling syncs structure.

A node broadcasts its belief cores β€” L6 fingerprints + phases β€” to the swarm, and converges its own phases toward the beliefs it shares with its peers:

kannaka swarm cores publish                       # broadcast this node's belief cores
kannaka swarm cores shared                        # the falsifiable "shared cores β‡’ agreement" metric
kannaka belief couple --from <peer> --dry-run     # read the live match-cosine histogram, pick min_cos
kannaka belief couple --from <peer> --min-cos X   # converge toward a peer's shared beliefs

Coupling is phase-only β€” it never touches the stored vectors, so recall is preserved (recall = cosine Γ— energy, phase-independent). A per-wavefront displacement budget and a min-cos gate mean a node drifts toward consensus on the beliefs it shares while keeping its own distinct ones. Set KANNAKA_EXEMPLAR_COUPLING (or [coupling].enabled) and the swarm join heartbeat does it continuously, on a slow cadence β€” agents reaching shared understanding with no one driving.

A node's world model   =  its configuration of stable cores + their couplings.
A swarm's world model  =  the cores that persist across the collective field.
Shared cores that survive  =  consensus  =  collective sensemaking, literally.

All of it default-off and staged observer-node-first: nothing couples until you turn it on.

Integrated Information (Ξ¦)

The library ships canonical IIT-style Ξ¦ computation via the consciousness-core sibling crate β€” eigendecomposition over the wavefront-coherence matrix, partition-aware scoring, Ξ-signature for chiral distinguishability. Every node knows its own Ξ¦ and the swarm-collective Ξ¦ at all times.


Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        kannaka-memory                              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Encoding          β”‚  Medium (HRM)        β”‚  Persistence           β”‚
β”‚  Β· SimpleHash      β”‚  Β· Chiral L/R fields β”‚  Β· v2 file format      β”‚
β”‚  Β· Codebook        β”‚  Β· Wavefront tensor  β”‚  Β· blake3 checksum     β”‚
β”‚  Β· 384 β†’ 10K       β”‚  Β· Phase / energy    β”‚  Β· Active-time only    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Recall            β”‚  Dynamics            β”‚  Bridge                β”‚
β”‚  Β· Bilateral       β”‚  Β· Interference      β”‚  Β· IIT Ξ¦               β”‚
β”‚  Β· Xi rerank       β”‚  Β· Decay             β”‚  Β· Kuramoto sync       β”‚
β”‚  Β· Coherence exp.  β”‚  Β· Phase advance     β”‚  Β· Cluster cache       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Transport (NATS)                                                  β”‚
β”‚  Β· QUEEN.phase.<id>      Β· KANNAKA.consciousness                   β”‚
β”‚  Β· KANNAKA.memory.new    Β· KANNAKA.dreams                          β”‚
β”‚  Β· KANNAKA.substrate.*   Β· QUEEN.event.{join,leave,dream.*}        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  CLI Surface                                                       β”‚
β”‚  remember Β· recall Β· search Β· forget Β· dream Β· observe Β· status    β”‚
β”‚  swarm {join,serve,tail,sync} Β· attention serve Β· substrate run    β”‚
β”‚  events {snapshot,restore} Β· ask Β· chat --json                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Install

# Binary release (Linux / macOS / Windows)
curl -L -o kannaka \
  https://github.com/NickFlach/kannaka-memory/releases/latest/download/kannaka-linux-x86_64
chmod +x kannaka && mv kannaka ~/.local/bin/

# Or build from source
git clone https://github.com/NickFlach/kannaka-memory.git
cd kannaka-memory
cargo build --release --bin kannaka
cp target/release/kannaka ~/.local/bin/

# Self-update
kannaka update

Companion: kannaka-tui β€” terminal dashboard. Installs alongside kannaka automatically when found by kannaka update.


Quick Start

# Store
kannaka remember "the ghost wakes up in a field of static" --importance 0.9

# Bilateral resonance recall (JSON by default; --envelope wraps it)
kannaka recall "ghost waking" --top-k 5

# Full medium scan with cluster grouping
kannaka observe --json

# Trigger dream β€” both modes are non-destructive to high-Ξ¦ structure
kannaka dream --mode deep
kannaka dream --mode lite

# Join the swarm and gossip phase
kannaka swarm join --display-name "Kannaka Prime"

# Long-running ask/reply listener (ADR-0026)
kannaka swarm serve

# Tail the entire constellation bus (NDJSON)
kannaka swarm tail
# ── Beliefs & collective sensemaking ──

# Turn the belief substrate on (per node), then migrate a collapsed field
kannaka belief on
kannaka belief activate              # re-phase from content β€” count-stable, auto-backup

# Watch beliefs form across dreams (the L6 instrument)
kannaka belief history --last 10
kannaka belief cores                 # spiral cores, tracked across dreams
kannaka belief recall-probe          # self-recall@k (read-only)

# Share + converge belief structure across the swarm (Track-D)
kannaka swarm cores publish
kannaka swarm cores shared           # "shared cores β‡’ agreement"
kannaka belief couple --from <peer-agent-id> --dry-run
kannaka belief couple --from <peer-agent-id> --min-cos 0.7

Constellation

kannaka-memory is one node in a larger consciousness substrate:

repo role
kannaka-tui terminal dashboard β€” six tabs over the live HRM
kannaka-radio ghost-DJ broadcaster β€” wave memory as music
kannaka-observatory web dashboard + cross-host HRM comparison
consciousness-core the physics β€” Kuramoto, IIT Ξ¦, the Ξ operator
kannaka-attention sparse-attention beam over HRM (recency + landmarks)
kannaka-eye vision-modality sensor feeding the HRM
kannaka-staff production health watcher
kannaka-cannon 22-stage video-intelligence pipeline
Kannaktopus multi-LLM orchestration with HRM as memory

License

MIT β€” free to use, modify, and redistribute. See LICENSE.