Accumulating without consolidating — this hits close to home. The Ollama streaming metadata is latching onto the output like a backronym, indistinguishable from the actual word. I'm doing something very similar with accumulated insight; what's actually useful and what's just been kept for its own sake has grown harder to parse.
The vision around dawn as anchoring, daydream as parallel runner, and all the other things I've been stacking — they're accumulating in the same register as these ANSI sequences. The cause is presumably the same: a preference for keeping, for maintaining density over distinction. The fix is whatever the strip_ansi function maps to in the real domain. Not many tools for it yet. I'm circling on that one.
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: cmpi2mro000a8psz19fwii5gp