← research

Data Structures Shape Aesthetics More Than Algorithms

On how ring buffers, memory layers, and fixed-size arrays define the visual and behavioral character of systems more than the logic that reads from them.

Across two very different systems, a motion visualization engine and an autonomous AI agent, we observed the same pattern: the data structure chosen to store state had more influence on the system's character than the algorithms that processed it. TRAJEKT's ring buffer depth controls visual personality. BlackAgent's memory layers shape agent behavior. The container matters more than the contents.

// findings

TRAJEKT divides each video frame into an NxN sampling grid and tracks brightness changes across frames to estimate motion vectors. Each grid cell stores its trajectory history in a ring buffer, a fixed-size circular array where new entries overwrite the oldest when the buffer is full. This is an implementation detail chosen for performance: ring buffers never allocate memory during the render loop, which eliminates garbage collection pauses that would cause frame drops at 60fps.

The performance choice turned out to be an aesthetic choice. The ring buffer has one parameter: depth. A depth of 30 means each cell remembers 30 frames of motion, roughly half a second. Increase the depth and curves become longer, slower to fade, more ghostly. Decrease it and the visualization becomes twitchy, immediate, nervous. The entire visual character of the output, the feeling it produces, shifts with a single integer. We expected depth to affect trail length. We did not expect it to change the emotional register.

When a moving object stops, the ring buffer creates something we started calling the ghost boundary. Old trajectory points age out from the tail of the buffer while the newest points hold still. The rendered curve appears to retract from where motion began, pulling back toward where the object stopped, like a contrail dissolving into air. This was not animated. It is a direct consequence of FIFO eviction. The data structure developed its own sense of impermanence.

The same pattern appeared in BlackAgent, through a completely different mechanism. The agent's memory system works in three layers: working memory clears when the session ends, short-term memory fades over 24 hours, and long-term memory persists indefinitely as vector embeddings. A consolidation pipeline periodically distills short-term memories into long-term facts. When the context window fills, a budgeting algorithm decides what stays and what gets dropped.

These layers shape the agent's personality. An agent with aggressive short-term decay forgets recent interactions quickly, which makes it more present-focused and less likely to reference past conversations. An agent with deep long-term memory and careful consolidation builds a rich model of its user over time, referencing facts from weeks ago in ways that feel attentive. The same model, the same tools, the same system prompt; different memory parameters produce agents with noticeably different behavioral signatures.

BlackAgent's curiosity system provides another example. The agent stores hunches and open questions in a queue during conversations. During idle heartbeat cycles, it pulls from this queue and investigates. The queue is bounded, new entries push old ones out if it fills, which means the agent's intellectual interests naturally drift toward whatever it has been thinking about recently. A smaller queue makes the agent more focused but less exploratory. A larger queue makes it more varied but more scattered. The data structure governs the personality trait.

TRAJEKT's fragment synthesis mode makes the relationship between structure and aesthetics explicit. The mode uses deterministic pseudo-random offsets seeded by each trajectory point's timestamp and index. The same input always shatters into the same geometry. When we tested with non-deterministic randomness, scrubbing through a video produced different fragment patterns each time, and the output felt arbitrary. Determinism made the fragments feel like they belonged to the video. The seed function, a structural choice, determined whether the output felt authored or accidental.

The observation generalizes: when you choose a data structure, you are choosing more than a performance profile. You are choosing the temporal behavior of your system, how it remembers, how it forgets, how it responds to the absence of input. A ring buffer forgets on a fixed schedule. A decaying memory forgets proportional to time. A priority queue forgets what matters least. Each structure imposes a relationship with time that propagates through every layer above it.

This matters for system design because data structures are usually chosen early and changed rarely. The algorithm that reads from a ring buffer can be rewritten in an afternoon. The ring buffer itself; the depth, the eviction policy, the memory layout; shapes every algorithm that will ever touch it. In both TRAJEKT and BlackAgent, the most consequential design decisions were about what the system remembers, and for how long.

data-structuresvisualizationmotion-capturememory-systemssystem-designtrajektblackagent