Street AI - Architecture Specification
======================================

1. OVERVIEW
-----------
Street AI is a continuously learning AI model that grows with every interaction.
Unlike traditional models that are trained once and deployed frozen, Street AI
adds new data, updates weights, and self-prunes through natural decay — all
during live operation.

The core innovation is Reverse Signal Retrieval: instead of scanning all stored
data to find matches, input signals cause matching stored signals to "rise" by
resonance — like a magnet attracting others of similar strength from a collection.


2. CORE TERMS
-------------

2.1 Signal (Data)
  - The atomic unit of information in Street AI
  - A small piece of data with its own weight and timestamp
  - Comparable to a token in traditional models
  - Each signal carries:
      * content   — the actual data/information
      * weight    — a vector determining strength and relatedness (see 2.3)
      * age       — time since creation or last retrieval
      * stack_id  — which stack it belongs to

2.2 Block (Stack)
  - A vertical storage structure of signals that share relatable weights
  - Signals within a stack are ordered by recency (newest on top)
  - When a new signal arrives:
      * If a stack exists with a matching weight profile → signal is added to
        the top of that stack
      * If no matching stack exists → a new stack is created with this signal
        as the first entry
  - A stack corresponds to a "color" of data — all signals in it share a
    common theme/domain

2.3 Weight
  - A multi-dimensional vector that determines:
      * How a signal stands out compared to others (magnitude)
      * How it relates to other signals (direction/similarity)
  - Analogy: if a stack is a color, the weight is the color's hue + intensity
  - Signals with similar weight vectors land in the same stack
  - Weight is NOT static — it gets updated during signal processing (see 5)

2.4 Stack Assignment Threshold
  - A configurable similarity threshold that determines whether a new signal
    joins an existing stack or creates a new one
  - Too low → fragmentation (many tiny stacks with near-duplicates)
  - Too high → noise (unrelated signals clumped together)
  - Should be tunable per deployment


3. REVERSE SIGNAL RETRIEVAL
----------------------------
The defining mechanism of Street AI.

3.1 Concept
  When an input signal is received, it does NOT scan every stored signal.
  Instead, it "broadcasts" its weight into the storage space, and stored signals
  with compatible weights respond — they elevate themselves into the thinking
  space.

  Analogy: A collection of magnets with different strengths. Bring an external
  magnet close to the collection — it attracts specific magnets based on their
  strength without checking each one individually. The matching magnets rise on
  their own.

3.2 Mechanism
  - Input signal's weight vector is used as a query
  - Storage is organized so that signals with similar weights are co-located
    (via stack structure)
  - Retrieval is sub-linear: only relevant stacks and their top signals
    respond, not the entire memory
  - Implementation candidates: locality-sensitive hashing (LSH), approximate
    nearest neighbor (ANN/HNSW), or content-addressable memory patterns

3.3 Retrieval Result
  - A set of signals loaded into the "thinking space"
  - These signals form the context for response generation
  - Signals that are retrieved have their age clock reset (see 4.3)


4. SIGNAL DECAY (Temporal Strength Loss)
-----------------------------------------
Signals lose their strength as they get older. This gives Street AI natural
memory management — useful knowledge stays alive through use, while irrelevant
data fades away.

4.1 Decay Function
  Exponential decay (like radioactive half-life):

    effective_weight = base_weight * e^(-decay_rate * time_since_last_access)

  Properties:
  - Rapid initial drop, long tail
  - A signal at weight 0.9 might decay to 0.5 in hours, but take days to go
    from 0.1 to 0.05
  - decay_rate is a configurable parameter (can vary per stack or globally)

4.2 Decay Evaluation
  Lazy evaluation: a signal's effective weight is only recalculated when:
  - It is a candidate during reverse retrieval
  - A stack audit/cleanup is triggered
  This avoids the cost of continuously updating every signal's weight.

4.3 Retrieval Resets Age
  When a signal is pulled into the thinking space during reverse retrieval,
  its age clock resets. This creates a use-it-or-lose-it dynamic:
  - Frequently retrieved signals stay strong indefinitely
  - Rarely accessed signals fade naturally
  - This mirrors how human memory works — recall strengthens retention

4.4 Death Threshold
  When a signal's effective weight drops below a configurable minimum
  (death_threshold), it is considered dead:
  - Dead signals are no longer candidates for retrieval
  - They can be garbage-collected during periodic stack cleanup
  - A stack with all dead signals is itself removed

4.5 Effects on the System
  - Self-pruning: the model naturally manages its own size
  - Recency bias: recent interactions dominate responses
  - Reinforcement loop: useful knowledge is continuously refreshed
  - Signal Bounce priority: decayed signals have low interrupt strength


5. SIGNAL PROCESSING (Response Generation)
--------------------------------------------

5.1 Thinking Space
  After reverse retrieval loads relevant signals, the thinking space contains:
  - The input signal(s)
  - All retrieved signals from matching stacks
  This is the working context for generating a response.

5.2 Processing
  The model processes the loaded signals to determine its response.
  The processing evaluates:
  - Signal weights (stronger signals have more influence)
  - Signal recency (newer signals within retrieved set are prioritized)
  - Signal relationships (how retrieved signals relate to each other)

5.3 Post-Processing Update
  During signal processing, weights may shift based on new context.
  After processing completes:
  - Each signal's weight is updated to reflect its new value
  - Signals that were highly relevant get weight boosts
  - Signals that were retrieved but not useful may get weight reductions
  - Updated weights are written back to their stacks


6. SIGNAL BOUNCE (Interrupt Handling)
--------------------------------------
If a new signal arrives while processing is ongoing:

6.1 Priority Check
  The incoming signal's weight is compared against the aggregate weight of the
  current processing context.

6.2 Outcomes
  - If incoming weight > current processing weight:
      * Current processing is interrupted
      * Current state is saved (partial results preserved)
      * New signal triggers fresh reverse retrieval and processing
  - If incoming weight <= current processing weight:
      * The new signal "bounces off"
      * It is queued for processing after current cycle completes
      * Bounced signals do NOT get dropped — they wait their turn

6.3 Queue
  Bounced signals are held in a priority queue ordered by weight.
  After current processing completes, the highest-weight queued signal is
  processed next.


7. BLOCK/STACK LIFECYCLE
-------------------------

7.1 Stack Creation
  - Triggered when a new signal has no matching stack (similarity below threshold)
  - The signal becomes the foundation of the new stack
  - Stack inherits its initial weight profile from the founding signal

7.2 Stack Update
  - When signals are added, the stack's aggregate weight profile adjusts
  - Post-processing weight updates propagate to the stack level
  - Stack weight = function of its living signals' weights

7.3 Stack Death
  - When all signals in a stack decay below death_threshold
  - Stack is marked for garbage collection
  - Cleanup can run periodically or when memory pressure is detected


8. CONTINUOUS LEARNING
-----------------------
Street AI is never "done training."

8.1 Learning Through Interaction
  - Every input adds new signals to existing or new stacks
  - Every processing cycle updates weights based on what was useful
  - Every passage of time naturally decays unused knowledge

8.2 Growth Model
  - New interactions → new signals → stacks grow or new stacks form
  - Decay → old unused signals die → stacks shrink or disappear
  - Net growth depends on interaction rate vs. decay rate
  - System reaches natural equilibrium where active knowledge is retained
    and stale knowledge is pruned

8.3 No Retraining Required
  The model adapts in real-time. There is no separate training phase,
  no dataset preparation, no gradient computation. Knowledge enters and
  exits through the signal lifecycle.


9. OPEN QUESTIONS (To Be Defined)
-----------------------------------

9.1 Weight Vector Dimensions
  - How many dimensions should the weight vector have?
  - Should dimensions be fixed or grow with the model?

9.2 Stack Similarity Function
  - Cosine similarity? Euclidean distance? Custom metric?
  - How is the assignment threshold calibrated?

9.3 Response Generation
  - How exactly do loaded signals in the thinking space produce output?
  - Is there a separate generation layer, or do signals compose directly?

9.4 Multi-Modal Signals
  - Can signals represent text, images, audio, etc.?
  - Do different modalities need different weight spaces?

9.5 Concurrency
  - How does the model handle multiple simultaneous inputs?
  - One thinking space per session, or shared?

9.6 Persistence
  - How are stacks stored? In-memory, on disk, distributed?
  - What's the serialization format?

9.7 Initial State
  - Does the model start completely empty (cold start)?
  - Or is it seeded with a base set of signals?
