← Inventions Dashboard
Invention Summary
Sparse Associative State (SAS)
A lightweight, local Python implementation of a sparse associative memory system. It models state transitions as a directed graph where memory is stored sparsely (only existing connections are tracked). The system allows for associative retrieval (spreading activation) and sparse pruning to remove weak associations, optimizing for memory and relevance.
ID: sparse-associative-state-sas
Folder: inventions/sparse-associative-state-sas
Created: 2026-03-29 07:55:14
Updated: 2026-03-29 07:55:42
Files: 10
Source: student_autonomy
⬇ Download as .zip ~23.1 KB uncompressed
README.md
ARES's plain-English description of what this invention does and how to run it.
# Sparse Associative State (SAS)

A local Python library for managing sparse, associative state graphs.

## Concept
SAS models knowledge or state as a network of nodes connected by weighted edges. Instead of dense matrices, it uses sparse dictionaries to represent associations. This mimics biological neuron connectivity where only active synapses are stored.

## Features
*   **Sparse Representation:** Only stores non-zero associations.
*   **Associative Retrieval:** Recalls related states based on connection weights.
*   **Pruning:** Removes weak connections to maintain sparsity and reduce noise.

## Installation

No external dependencies are required. Python 3.8+ is recommended.

```bash
# Clone or copy the package directory
cd sparse_associative_state_sas
```

## Usage

```python
from sparse_associative_state_sas import SparseMemory

# Initialize the sparse state
memory = SparseMemory()

# Create associations (id_a, id_b, weight)
memory.associate("apple", "fruit", 1.0)
memory.associate("apple", "red", 0.8)
memory.associate("apple", "tech", 0.1) # Weak association

# Prune associations with weight < 0.5
memory.prune(threshold=0.5)

# Retrieve associative state for "apple"
results = memory.recall("apple")
print(results.keys()) # Expecting: "fruit", "red"
```

## Limitations
This is a simplified demonstration of sparse associative memory. It does not include persistence (disk I/O) or distributed capabilities.

<!-- ARES_AUTO_VERIFIED_SUMMARY:START -->
## Verified Project Notes

- Package import path: `sparse_associative_state_sas`
- Entrypoint: `run_demo.py`
- Delivery mode: `prototype`
- Release tier: `prototype`
- Verification status: `PASS`
- Clean-room release gates: `NOT_RUN`
- Public exports: `SparseMemory, __version__`
- Python files detected: `run_demo.py, sparse_associative_state_sas/__init__.py, sparse_associative_state_sas/core.py`

## Verification Commands

- `PASS` `"/home/corbybender/ares/.venv-linux/bin/python" -m py_compile "run_demo.py"`
- `PASS` `"/home/corbybender/ares/.venv-linux/bin/python" -m compileall "sparse_associative_state_sas"`
- `PASS` `"/home/corbybender/ares/.venv-linux/bin/python" run_demo.py`

## Current Limits

- No additional consistency warnings were detected by the local audit.
<!-- ARES_AUTO_VERIFIED_SUMMARY:END -->
Files
PathBytes
__pycache__/run_demo.cpython-314.pyc 4071
DESIGN_BRIEF.md 776
invention.json 4023
pyproject.toml 401
README.md 2294
run_demo.py 2942
sparse_associative_state_sas/__init__.py 272
sparse_associative_state_sas/__pycache__/__init__.cpython-314.pyc 493
sparse_associative_state_sas/__pycache__/core.cpython-314.pyc 4918
sparse_associative_state_sas/core.py 3476
Manifest
Structured metadata ARES recorded when it created this project.
{
  "id": "sparse-associative-state-sas",
  "title": "Sparse Associative State (SAS)",
  "summary": "A lightweight, local Python implementation of a sparse associative memory system. It models state transitions as a directed graph where memory is stored sparsely (only existing connections are tracked). The system allows for associative retrieval (spreading activation) and sparse pruning to remove weak associations, optimizing for memory and relevance.",
  "source": "student_autonomy",
  "kind": "invention",
  "path": "inventions/sparse-associative-state-sas",
  "delivery_mode": "prototype",
  "release_tier": "prototype",
  "release_verification_status": "not_run",
  "created_at": "2026-03-29 07:55:14",
  "updated_at": "2026-03-29 07:55:42",
  "project_entrypoint": "run_demo.py",
  "smoke_test_status": "passed",
  "smoke_test_output": "Initializing SAS Engine... ============================================================ Step 1: Loading Associations ============================================================ Link: [cat] -> [meow] (w=0.95) Link: [cat] -> [pet] (w=0.9) Link: [cat] -> [animal] (w=0.98) Link: [cat] -> [car] (w=0.05) Link: [dog] -> [bark] (w=0.95) Link: [dog] -> [pet] (w=0.85) Link: [dog] -> [animal] (w=0.97) Link: [car] -> [meow] (w=0.02) ============================================================ Step 2: Assoc",
  "generated_files": 5,
  "project_generated_at": "2026-03-29 07:55:40",
  "source_exp_path": "experiments\\exp_self.20260308180341.016_20260308_180415",
  "verification_status": "passed",
  "verification_results": [
    {
      "command": "\"/home/corbybender/ares/.venv-linux/bin/python\" -m py_compile \"run_demo.py\"",
      "passed": true,
      "returncode": 0,
      "timed_out": false,
      "stdout_excerpt": "",
      "stderr_excerpt": ""
    },
    {
      "command": "\"/home/corbybender/ares/.venv-linux/bin/python\" -m compileall \"sparse_associative_state_sas\"",
      "passed": true,
      "returncode": 0,
      "timed_out": false,
      "stdout_excerpt": "Listing 'sparse_associative_state_sas'...",
      "stderr_excerpt": ""
    },
    {
      "command": "\"/home/corbybender/ares/.venv-linux/bin/python\" run_demo.py",
      "passed": true,
      "returncode": 0,
      "timed_out": false,
      "stdout_excerpt": "Initializing SAS Engine...\n\n============================================================\n Step 1: Loading Associations \n============================================================\n  Link: [cat] -> [meow] (w=0.95)\n  Link: [cat] -> [pet] (w=0.9)\n  Link: [cat] -> [animal] (w=0.98)\n  Link: [cat] -> [car] (w=0.05)\n  Link: [dog] -> [bark] (w=0.95)\n  Link: [dog] -> [pet] (w=0.85)\n  Link: [dog] -> [animal] (w=0.97)\n  Link: [car] -> [meow] (w=0.02)\n\n============================================================\n Step 2: Associative Recall (Unpruned) \n============================================================\n  Retrieving state for 'cat':\n    - animal: 0.98\n    - meow: 0.95\n    - pet: 0.90\n    - car: 0.05\n\n============================================================\n Step 3: Sparse Pruning (Threshold > 0.5) \n============================================================\n  Edge count before: 8\n  Edge count after:  6\n  Removed 2 weak associations.\n\n============================================================\n Step 4: Associative Recall (Pruned) \n============================================================\n  Retrieving state for 'cat':\n    - animal: 0.98\n    - meow: 0.95\n    - pet: 0.90\n  [PASS] Weak link 'cat->car' successfully pruned.\n  [PASS] Strong link 'cat->meow' retained.\n\n============================================================\n System Test \n============================================================\nINVENTION_SMOKE_TEST: PASS",
      "stderr_excerpt": ""
    }
  ],
  "project_status": "built"
}