A lightweight memory protocol inspired by cognitive structure
Project description
NASPy: Neural Associative Structure (Python Edition)
NASPy is a minimal, hash-based memory framework designed to mimic how associative memory works, storing and reconstructing structured data using atomic units. Built in Python, NASPy provides the tools to build memory streams, deduplicate data, and serialize complex structures into verifiable, non-redundant records.
🧠 Core Concepts
🔹 Datom
A "data atom," the smallest unit of memory. Each Datom has:
- A data type (e.g.,
text,int,symbol) - A value (e.g.,
"login",42) - A hash computed from the above
🔹 DatomIndex
A lookup table that deduplicates datoms. Prevents storing the same value twice.
🔹 Scanner
Accepts objects (dicts, classes) and flattens them into lists of Datom hashes. Adds new Datoms to the index as needed.
🔹 DataculeStream
An append-only list of memory entries. Each entry is:
(datacule_hash, [datom_hash1, datom_hash2, ...])
Where datacule_hash is the hash of the ordered list of datom hashes.
🔹 .nason files
Serialized memory: stores the DatomIndex and DataculeStream as JSON. You can export and reload entire memory sessions using:
export_nason(index, stream, "file.nason")index, stream = load_nason("file.nason")
📦 Installation
Clone the repo and import the package locally:
git clone https://github.com/yourname/naspy.git
cd naspy
Then in your Python files:
from naspy.datom import Datom
from naspy.scanner import Scanner
✅ Usage Example
from naspy.datom_index import DatomIndex
from naspy.dataculestream import DataculeStream
from naspy.scanner import Scanner
from naspy.io import export_nason, load_nason
index = DatomIndex()
stream = DataculeStream()
scanner = Scanner(index)
obj = {"user": "user", "event": "login"}
datacule = scanner.observe(obj)
stream.add_datacule(datacule)
export_nason(index, stream, "memory.nason")
🧪 Tests
Run the test suite from the root:
python -m unittest discover -s tests
🧩 Use Cases
- Cognitive memory simulation
- Game state snapshotting
- Transparent logging
- AI input tracking
- Behavioral analytics
🛠 Future Work
- NASPy CLI tools
- Visual datacule explorer
- Integration with
Feeds™ .nasonfile versioning and metadata
📄 License
MIT — free to use, build on, and enhance.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file naspy-1.0.0.tar.gz.
File metadata
- Download URL: naspy-1.0.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f256fc0e83278eb69585b1833d6ee2e9bbe3c648a51a8d22f5f10f9715307000
|
|
| MD5 |
dc60a6ade016765deed96c21b9916f60
|
|
| BLAKE2b-256 |
c2990b33c6078e5406847409c5f7b725165da9447212171edcb9742d6f3dc2b6
|
File details
Details for the file naspy-1.0.0-py3-none-any.whl.
File metadata
- Download URL: naspy-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f6523e99e5cdeb38921c2937ecae14ecd6a53e149f555e3bae143751f0ea524
|
|
| MD5 |
4a6fe8abec718997f81320a8b53e8c40
|
|
| BLAKE2b-256 |
10ac447988748df28ca78e43f1694a7e8872af9d05ff654a2a22b24edce498dc
|