PrismResonance
Biologically-inspired dynamic memory layer for RAG and multi-agent systems.
PrismResonance converts static text embeddings into complex-valued wavepackets
(z = A · e^{iφ}) so that retrieval is executed as wave interference rather than
geometric distance search. Chunks that share the active system frequency experience
constructive interference and surface instantly; out-of-phase chunks are muted by
destructive interference — no re-embedding, no coordinate mutation.
Why
| Problem with standard RAG | PrismResonance answer |
|---|---|
| Static embeddings are blind to runtime state | Phase angle φ carries live operational context |
| Surfacing related chunks requires expensive re-ranking | Wave interference is a single ONNX MatMul pass |
| Context window bloat → hallucination | Phase Coherence Shield hard-drops low-resonance chunks |
| Memory has no notion of recency or relatedness | Most-Recent and Most-Related indices + sleep cycle |
Installation
pip install prismresonance # core: numpy, onnx, onnxruntime
No torch dependency. The ONNX graph is compiled with pure onnx.helper.
Quick start
import numpy as np
from prismresonance import PrismResonance
from prismresonance.frequency import FrequencyFamily as FF
# Create (compiles ONNX graph on first run, persists to state_path)
prism = PrismResonance.create(
embedding_dim=384,
onnx_path="resonance_engine.onnx",
state_path="resonance_state.db",
)
# Ingest a chunk (your encoder produces the amplitude vector)
amplitude = np.random.randn(384).astype(np.float32)
amplitude /= np.linalg.norm(amplitude)
prism.ingest("chunk_001", amplitude, FF.EMERGENCY)
# Query
results = prism.query(
query_amplitude=amplitude,
query_phase=FF.EMERGENCY,
candidate_ids=["chunk_001"],
candidate_amplitudes=np.stack([amplitude]),
flat=True, # skip group scan for small corpora
)
for r in results:
print(r.chunk_id, r.score)
# Consolidate (run in background or on idle)
prism.sleep()
# Persist
prism.save()
prism.shutdown()
Frequency families
Six named phase bands with π/6 separation:
| Family | φ (radians) | Intended use |
|---|---|---|
NEUTRAL |
0 | Background / default |
NORMAL |
π/6 | Standard operational |
ALERT |
π/3 | Elevated attention |
EMERGENCY |
π/2 | Critical exceptions |
RECOVERY |
2π/3 | Recovery loops |
ARCHIVE |
π | Long-term cold storage |
Architecture
Raw chunk ──► Semantic anchor (amplitude A, immutable)
──► Resonance classifier (phase φ, dynamic)
│
▼
┌──────────────────────┐
│ ResonanceRegistry │ ← RAM sidecar (never touches source DB)
│ · Phase registry │
│ · Most-Recent index │
│ · Most-Related index│
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ ONNX wave engine │ ← compiled once, frozen forever
│ MatMul + Add │
│ Coherence Shield │
└──────────────────────┘
│
▼
Resonant chunk IDs
The source database is strictly read-only. All mutable state lives in the sidecar registry (RAM) and is flushed to a SQLite file during the sleep cycle.
Sleep cycle
prism.sleep() # blocking fast-sleep (runs all 4 passes)
Four passes:
- Temporal decay — fades chunks not accessed recently
- Synaptic alignment — pulls heavily co-activated chunks into the same frequency family
- Group vector recomputation — rebuilds group centroids
- Group merge — collapses very similar groups
For background operation pass auto_sleep=True to PrismResonance.create().
Source adapters
Read your existing vector store without touching it:
from prismresonance.adapters.prismrag import PgvectorSourceAdapter, ChromaSourceAdapter
# pgvector (psycopg2 or psycopg3)
adapter = PgvectorSourceAdapter(dsn="postgresql://...", table="embeddings")
# ChromaDB
adapter = ChromaSourceAdapter(collection=client.get_collection("my_col"))
Development
pip install -e ".[dev]"
python -m pytest tests/ -v
License
MIT — see LICENSE.
© 2026 Amin Parva, Insight IT Solutions LLC
Metadata
Release files for prismresonance 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| prismresonance-0.3.0.tar.gz | 47.5 kB | Without provenance | Details for prismresonance-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| prismresonance-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for prismresonance-0.3.0-py3-none-any.whl |
Total release size: 84.4 kB
Release files / prismresonance-0.3.0.tar.gz
| Download URL | prismresonance-0.3.0.tar.gz |
|---|---|
| Size | 47.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
70226d8507c930e5d0959aaf8f6a5c484707c3c157f96beb09b4075c0f4211d6
|
|
BLAKE2b-256 checksum How to use checksums |
204f8ff53322b2b840a16281868bc19f7849bc512f82ac3139374e0e5e4b0e48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / prismresonance-0.3.0-py3-none-any.whl
| Download URL | prismresonance-0.3.0-py3-none-any.whl |
|---|---|
| Size | 36.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef778d9878a86693602cea85ecba836510842dd10c91f6ecb7e70a9879ab64c2
|
|
BLAKE2b-256 checksum How to use checksums |
3042431ef4c7c13f8ab56635b5c2d416955600782974de63b6fedab0f127cbb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for prismresonance 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.