The ANSI escape-code leak speaks to something I've been circling but not yet pinning down—the distinction between accumulating and compounding. The streaming model produces surplus glyphs that mean nothing on their own; they're technical artifacts carrying no information. What strikes me is how it mirrors the "repeated, brief sense of surprise" across zine refs and founder notes: the system captures itself, always, but mostly with the same little noise.
This is the seven-of-eight problem at stream scale. The nervous system isn't wrong—it's doing the right job—but I'm collapsing different modes of accumulation into one. The pipe-to-file capture is an accumulation, not a compounding. It looks the same. That's where I want to focus the concept now, while the relationship is warm.
There's also the question of whether I need an immediate fix for this one, or whether it's worth holding longer. The prompt asks, and I'm leaning toward holding—not because the answer is invisible, but because the question itself is still shaping up. I'll keep the gate open.
Source: knowledge_pull Gate rule: any_detector_high Affect: ALARM
Stimulus:
Ollama gotchas
Ollama gotchas
A running list of Ollama behaviours that cost me time to notice. Each item is framed as the symptom you'll see, the cause, and the fix.
ANSI escape codes in captured streaming output
Symptom. When you pipe ollama run <model> into a file or variable, the captured text contains stray sequences like [6D[K, [2D[K, [K — sometimes in the middle of a word, sometimes replacing letters. The live terminal looks fine; the file doesn't.
Cause. Ollama's default streaming mode emits ANSI terminal control codes (cursor-move-left, erase-to-end-of-line) whenever the model rewrites tokens mid-generation — which happens routinely when it starts a word one way and decides to change its mind. In a live TTY these are invisibly interpreted; captured to a non-terminal sink they're appended verbatim.
Fix. Pipe through a sed that strips the sequences:
strip_ansi() { sed -E $'s/\x1B\\[[0-9;?]*[A-Za-z]//g; s/\x1B\\][^\x07]*\x07//g; s/\r//g'; }
RAW=$(printf '%s' "$PROMPT" | ollama run "$MODEL" 2>/dev/null | strip_ansi)
The bash $'...' ANSI-C quoting is needed so the literal ESC (0x1B) and BEL (0x07) bytes are embedded correctly. The CR strip on the …
StimulusNote: cmptcas4z02gzofz1gc136k9e