Qwen Cloud Hackathon · Track 1 — MemoryAgent

Memory is a field,
not a lookup table.

raven-memory gives AI agents a living memory substrate: Voronoi geometry, ternary logic, spectral optics — with synapses that learn, contradictions that inhibit, and nights in which it dreams.

REINFORCED — validated truth NEUTRAL — open hypothesis FORGOTTEN — silenced inhibitory link
Why a field

Flat vector search remembers everything — and learns nothing.

Most agent memory is a cosine ranking over a static index. Every memory is equally true forever; contradictions live side by side; nothing consolidates. raven-memory replaces the index with a dynamical system.

Flat vector store

  • Similarity is the only signal — no notion of validation
  • Contradictions are retrieved together, confidence-free
  • The index only grows; old noise ranks like new truth
  • Retrieval is stateless — recalling changes nothing

raven-memory field

  • Ternary states: REINFORCED truths outshine, FORGOTTEN noise goes dark
  • Contradictions auto-wire inhibitory links — validated memories silence rivals
  • Sleep consolidation merges episodic clusters into semantic nodes
  • Every recall is plastic: STDP strengthens co-activated synapses
Three borrowed physics

Geometry, logic, and light.

Each memory lives in a spatial cell, carries a three-valued state, and resonates — or doesn't — with the spectral modes of the whole field.

Voronoi geometry

Embeddings seed a Voronoi tessellation: each memory owns a cell, and cell adjacency defines hops. Recall activates a neighborhood, decaying as e^(−0.15·hops) — relevance has a literal shape.

KDTreek=6 neighborsBFS hops

Ternary computing

States and links are three-valued. Memories are REINFORCED, NEUTRAL or FORGOTTEN; links are RESONANT, NEUTRAL or INHIBITORY. When a memory is validated, its inhibitory links silence contradictors: the field collapses around truth.

×1.5 / ×1.0 / ×0.1auto-inhibition

Spectral optics

An SVD over all active embeddings extracts the field's eigen-modes — properties of the cavity, not of any source. A query that projects onto strong modes resonates. Resonance and coherence ship as epistemic metadata, never as score hacks.

SVD≥99% variancedeterministic
Interactive simulation — same rules as the Python engine

Touch the field.

This widget reimplements the engine's rules in the browser — ternary states, hop-decay recall, auto-inhibition, cluster-and-merge — so you can feel the dynamics. The production engine (FastAPI · SQLite · SVD · STDP) runs in Python; the README and demo video show it end to end.

Sleep consolidation

At night, the field dreams.

An offline consolidator — run it like a cron at 3 a.m. — clusters redundant episodic memories and fuses each cluster into one semantic node, in a single atomic transaction. Then the spectral field is rebuilt over the new space.

REM·1

Cluster

Greedy cosine clustering (θ≈0.83) groups episodic NEUTRAL memories that say the same thing.

REM·2

Merge

Recall-weighted centroid embedding + extractive summary. The memories the agent actually used weigh more.

REM·3

Commit atomically

Insert node, delete sources, cascade links — one BEGIN IMMEDIATE transaction. A crash can never duplicate the past.

WAKE

Re-tune the cavity

The SVD spectral field is rebuilt over the consolidated space: the agent wakes with sharper eigen-modes.

Episodic and semantic memories share one spectral field — deliberately. Dreaming migrates clusters across layers, and the consolidated structure should shape how new experience resonates. The cavity is one.

Forensic layer

Every recall leaves a scar you can verify.

Recalls, consolidations — every operation is chained with SHA-256 over its full payload, including the content hash of each retrieved memory. Click any block below to tamper with it, then verify.

Chain not verified yet

This widget mirrors the production scheme exactly: hash = SHA-256(canonical payload + prev_hash), where the payload carries each retrieved memory's content hash. Tampering edits the memory content inside a block — recomputation then fails, just like editing a row in the real SQLite audit log.

Stylometric forensics

Each memory carries its author's writing fingerprint: function-word frequencies, sentence rhythm, punctuation density — language-aware (ES/EN). A memory whose style breaks from its claimed author is degraded to FORGOTTEN and an alert is raised. A bilingual author switching languages is never flagged.

No silent degradation

Embeddings fall back three tiers: local model → Qwen API (with retries) → deterministic dummy. The dummy tier screams: SEMANTIC QUALITY DEGRADED in the logs, degraded: true in /health and in every response. The agent always knows what its memory is made of.

Engineering, not vibes

Audited without mercy. Then fixed.

A 55-finding internal audit plus an external review, mapped fix-by-fix: tamper-evident audit chain made cryptographically recomputable, WAL-mode SQLite, atomic consolidation, authenticated WebSockets, rate limiting, dimension-validated tensors.

17/17engine integration tests
11/11spectral tests, incl. cross-process determinism
20 P0critical findings closed in v1.1
0external JS dependencies on this page
Python 3.12 Qwen embeddings + LLM FastAPI + WebSocket SQLite · WAL NumPy SVD scikit-learn k-NN SHA-256 audit chain Apache 2.0