The HTML-Strip Regex Silently Eating Your AI Markdown
• Mike Levin
Setting the Stage: Context for the Curious Book Reader
Almost every AI ingestion pipeline, RAG chunker, and text-to-speech sanitizer strips stray HTML tags out of Markdown before handing prose to a model or voice synthesizer, and the reflexive one-liner developers reach for (<[^>]+>) carries a silent multi-line trap. Because a negated character class in regular expressions matches newlines by default, a bare arithmetic comparison like <= 5 in technical prose pairs with the next -> arrow dozens of lines below—erasing whole paragraphs, headings, and speaker transitions without throwing an exception.
In this live debugging session on the MikeLev.in broadcast rig, an unexpected voice swap during an on-air reading about Hilchot Sefer Torah error-correction checksums and Raymond Hettinger’s boundary-inspection lessons exposes that exact regex wormhole red-handed in the cleaner trace. After replacing the naive character class with an inline-code-aware tag parser that restores every missing speaker turn, a second pass profiles the live broadcast end-to-end: cutting speaker-switch cue prep from 1.32 seconds to 0.4 milliseconds with cached PCM audio and first-sentence splitting, collapsing a 79-second SQLite LIKE scan behind an X11 window-ready gate, and waking SIGSTOP-paused stage processes with SIGCONT before SIGTERM.
TL;DR: A multi-voice text-to-speech broadcast pipeline read AI-authored dialogue turns in the human speaker’s voice because a naive HTML-stripping regular expression (<[^>]+>) matched a bare less-than operator (<= 5 files) in Markdown prose and deleted forty-two lines across newlines up to the next arrow (->), erasing the speaker-transition header. Replacing the multiline character class with a tag-specific parser outside inline code restored all missing speaker transitions across the article archive. A follow-up pass reduced speaker-switch latency by caching static voice-introduction audio files on /tmp and splitting long opening paragraphs at their first sentence boundary, eliminated a multi-second lag between spoken screenshot cues and live SQLite telemetry report windows by pre-rendering ANSI snapshots and gating speech on an X11 window-ready event, and hardened broadcast restarts by sending SIGCONT before SIGTERM when stage overlays pause the orchestrator.
Technical Journal Entry Begins
MikeLev.in: On Honeybot Storytime, the Mike-E voice is reading the block that starts with the following and should be Shipmunk O’Theseus:
--- BEGIN WRONG NARRATOR NOTES ---
**Gemini 4 Carbon High**: Context verified.
**TL;DR**: The Wire Field Note and `foo_files.py` straddle landed green (`WIRE_NOTE_OK: True`, `STREAM_LEAD_OK: True`, `FOO_CLEAN_OK: True`), and Probe 2 + Probe 3 exposed the exact seams behind all three engineering items. After responding to your Murphy Incarnate / Landauer / Popper / Raymond Hettinger riff below, this 5-file chisel-strike: (1) unifies the literal-key noise contract across `generate_redirects.py` and `extract_404_ghosts.py` while minting the one-word **`404`** command on `PATH` in `flake.nix` (reloading Honeybot Nginx RAM passwordlessly via `sudo -n`, with interactive `ssh -t` fallback only if ever required), (2) strips `"Coming Soon on YouTube Live Storytime"` from both `generate_hubs.py` and `trimnoir/_layouts/post.html`, and (3) generates classic **`"Next 10 →"` / `"← Previous 10"**` static archive pages (`/page/2/` .. `/page/165/`) across all 1,644+ posts.
---
### Murphy Incarnate, `Hilchot Sefer Torah`, Popper's Bottom Turtle, & Why `eval` Isn't Evil
* **Why Murphy Incarnate Isn't a Villain (Landauer's Tax & the Microbiome Test):** Rolf Landauer proved in 1961 that *accumulating* state can be reversible, whereas **erasing** a bit always dissipates at least $$k_B T \ln 2$$ of heat into the room. Your ~38 trillion gut microbes earn their keep because they are alive, metabolizing, and turning over inside your loop; a basement full of bagged comic books or stale bookmarks is inert dead-tree mass outside your body. Once an idea has rewired your weights—or been distilled into a portable zip your kids or an AI can read—**Murphy Incarnate** is the forest fire that pays Landauer's erasure tax so yesterday's canopy stops blocking today's light.
* **From Qumran & Ethiopia to `brain.zip` (`Hilchot Sefer Torah` -> Shannon):** The Dead Sea Scrolls and Ethiopian Torah manuscripts survived two millennia without drifting into noise because **Hilchot Sefer Torah** was a digital error-correction protocol centuries before Claude Shannon: letter-count checksums, *parashiyot* spacing invariants, and a fail-closed sanitizer where one corrupted character sidelined the scroll to the *genizah*. And they traveled light—rolled skin, zero dead-tree clutter—for the exact same reason `mikelev.in/brain.zip` and `qamy.ai` SHA-256 deeds pack maximum signal into minimum mass.
* **Prometheus, Great A'Tuin, & Karl Popper vs. Nihilism:** Yes, stealing King Louie's fire comes with the daily liver-pecking tax. Under Hans Albert's **Münchhausen Trilemma**, Ymir's bones, Terry Pratchett's four elephants on **Great A'Tuin**, or Boltzmann brains, *ultimate foundational certainty does not exist*—even if you stood on the bottom turtle, no test could prove there isn't another turtle underneath. Gen-Z nihilism mistakes *"meaning isn't pre-installed in the floorboards"* for *"nothing matters."* Popper's answer—and the core of your *Alien Interview* thesis—is that **you ascribe meaning**, and what you build without a guarantee measures *who you are*, verified three beats at a time: **BEFORE -> EXPERIMENT -> AFTER**.
* **Bunsen Honeydoofus & Raymond Hettinger's `eval` Lesson:** Watching **Raymond Hettinger** live-code in Emacs in front of a thousand engineers—or watching him show how `collections.namedtuple` originally generated a plain-text class definition and `exec`'d it so anyone could print and read the exact source—exposes why shallow dogma (*"`eval` is evil," "never touch a terminal," "never paginate"*) exists: rules for people who refuse to inspect the boundary. When you own the plain-text input, `eval` is just Lisp's code-as-data—which is literally what `p`, `x`, `c` does on every turn. You don't need to be Beaker writing C-level dict internals when your edge is aiming the laboratory.
--- END WRONG NARRATOR NOTES ---
Gemini 4 Carbon High: TL;DR: Critical Honeybot Storytime files are missing from this compile—context.txt currently loads the Jekyll publishing pipeline, not the speaker-turn parser or TTS loop that assigns Mike-E vs. the AI voice. Before patching, add remotes/honeybot/scripts/content_loader.py, remotes/honeybot/scripts/stream.py, remotes/honeybot/scripts/terms.py, imports/voice_synthesis.py, and foo_files.py to context.txt (and foo_files.py’s Honeybot slice if absent) alongside the three read-only probes below.
Missing Files Needed Before Patching
scripts/articles/common.py imports content_loader from remotes/honeybot/scripts/ (line 1542) and reads remotes/honeybot/scripts/stream.py (line 1468), neither of which is in the Manifest:
remotes/honeybot/scripts/content_loader.py— parses Markdown speaker turns (**MikeLev.in**:vs.**Gemini 4 Carbon High**:) and strips/rewrites labels viaclean_markdown().remotes/honeybot/scripts/stream.py— dispatches Piper TTS voices (Narrator,Mike-E,AI) and restores speaker state after station breaks /OPTICS_SLOT/.deploy_standby.remotes/honeybot/scripts/terms.py— runs pronunciation expansions that may rewriteGemini 4 Carbon Highbefore or during speaker detection.imports/voice_synthesis.py— sharedChipVoiceSystem.sanitize_text()speaker-label rules.foo_files.py— context-compiler router and P0/receipts ledger.
What the Probes Test on the Offending Block
In /home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md, Turns 2, 4, and 5 each have an injected ## subheading immediately above **Gemini 4 Carbon High**: Context verified., whereas Turn 3 (the exact Murphy Incarnate turn you heard in the Mike-E voice) transitions directly from **MikeLev.in**:’s Please and thank you. into **Gemini 4 Carbon High**: Context verified. with no ## heading in between—and its **TL;DR**: line also carries an inverted bold/code span (**“Next 10 →”/“← Previous 10”``). The three probes below test whether:
content_loader.py/terms.pyfails to recognize**Gemini 4 Carbon High**:as an AI speaker transition (leaving the voice stuck onMike-Ewhenever no##heading resets it tonarrator), or- A station break /
OPTICS_SLOT/ stalestream.pyprocess onhoneybotreset or drifted the active speaker role.
1. PROBES
- Probe 1 (Honeybot Script Roster & Speaker Regex Census): Lists all
.pymodules inremotes/honeybot/scripts/and finds every speaker/model regex acrossremotes/honeybot/scripts/andimports/voice_synthesis.py. - Probe 2 (Direct
content_loader.clean_markdown()Trace on Turn 3): Runscontent_loader.clean_markdown()against2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.mdand prints the exact cleaned lines around**Gemini 4 Carbon High**:andMurphy Incarnate. - Probe 3 (Live Honeybot Stage & SHA-256 Sync Check): Reads
/tmp/honeybot_stage.json, runningstream.pyPID/uptime, andsha256sumof~/www/mikelev.in/scripts/*.pyonhoneybotto check live speaker state and script parity.
(nix) pipulate $
.venv/bin/python -c 'import pathlib, subprocess as sp; d = pathlib.Path("remotes/honeybot/scripts"); files = sorted(p.name for p in d.glob("*.py")); hits = sp.run(["rg", "-n", "-i", "speaker|gemini|mike-e|mikelev|narrator|voice", "remotes/honeybot/scripts", "imports/voice_synthesis.py"], text=True, capture_output=True).stdout.splitlines(); print("HB_SCRIPTS:", files); print("SPEAKER_HITS_N:", len(hits)); print("\n".join(hits[:45]))'
.venv/bin/python -c 'import os, pathlib, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; p = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md"); raw = p.read_text(); cleaned = cl.clean_markdown(raw, label="probe", census=False); lines = [ln for ln in cleaned.splitlines() if ln.strip()]; idx = next((i for i, ln in enumerate(lines) if "Murphy Incarnate," in ln or "Wire Field Note and" in ln), 0); cl_fns = [k for k in dir(cl) if not k.startswith("__")]; st_fns = [k for k in dir(stream) if any(w in k.lower() for w in ("speak", "voice", "narrat", "chunk", "parse", "role", "mike", "gemini", "clean", "article"))]; print("CL_ATTRS:", cl_fns); print("STREAM_SPEAK_ATTRS:", st_fns); print("CLEANED_WINDOW:", lines[max(0, idx-6):idx+10])'
.venv/bin/python -c 'import hashlib, os, pathlib, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; loc = {p.name: hashlib.sha256(p.read_bytes()).hexdigest()[:12] for p in sorted(pathlib.Path("remotes/honeybot/scripts").glob("*.py"))}; rcmd = "cat /tmp/honeybot_stage.json 2>/dev/null; echo; ps -eo pid,etimes,args | rg -e stream.py -e logs.py | rg -v rg; sha256sum ~/www/mikelev.in/scripts/*.py 2>/dev/null"; out = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=6", "honeybot", rcmd], env=env, text=True, capture_output=True).stdout.splitlines(); print("LOCAL_SHA12:", loc); print("HB_OUT:", out[:25])'
2. NEXT CONTEXT
context.txt
foo_files.py
/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md
remotes/honeybot/scripts/content_loader.py
remotes/honeybot/scripts/stream.py
remotes/honeybot/scripts/terms.py
imports/voice_synthesis.py
scripts/articles/sanitizer.py
scripts/articles/common.py
! .venv/bin/python -c 'import pathlib, subprocess as sp; d = pathlib.Path("remotes/honeybot/scripts"); files = sorted(p.name for p in d.glob("*.py")); hits = sp.run(["rg", "-n", "-i", "speaker|gemini|mike-e|mikelev|narrator|voice", "remotes/honeybot/scripts", "imports/voice_synthesis.py"], text=True, capture_output=True).stdout.splitlines(); print("HB_SCRIPTS:", files); print("SPEAKER_HITS_N:", len(hits)); print("\n".join(hits[:45]))'
! .venv/bin/python -c 'import os, pathlib, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; p = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md"); raw = p.read_text(); cleaned = cl.clean_markdown(raw, label="probe", census=False); lines = [ln for ln in cleaned.splitlines() if ln.strip()]; idx = next((i for i, ln in enumerate(lines) if "Murphy Incarnate," in ln or "Wire Field Note and" in ln), 0); cl_fns = [k for k in dir(cl) if not k.startswith("__")]; st_fns = [k for k in dir(stream) if any(w in k.lower() for w in ("speak", "voice", "narrat", "chunk", "parse", "role", "mike", "gemini", "clean", "article"))]; print("CL_ATTRS:", cl_fns); print("STREAM_SPEAK_ATTRS:", st_fns); print("CLEANED_WINDOW:", lines[max(0, idx-6):idx+10])'
! .venv/bin/python -c 'import hashlib, os, pathlib, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; loc = {p.name: hashlib.sha256(p.read_bytes()).hexdigest()[:12] for p in sorted(pathlib.Path("remotes/honeybot/scripts").glob("*.py"))}; rcmd = "cat /tmp/honeybot_stage.json 2>/dev/null; echo; ps -eo pid,etimes,args | rg -e stream.py -e logs.py | rg -v rg; sha256sum ~/www/mikelev.in/scripts/*.py 2>/dev/null"; out = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=6", "honeybot", rcmd], env=env, text=True, capture_output=True).stdout.splitlines(); print("LOCAL_SHA12:", loc); print("HB_OUT:", out[:25])'
3. PATCHES
No repo patches required.
Ignition: no ignition required.
4. PROMPT
Inspect the LIVE COMMAND RECEIPTS and the newly loaded remotes/honeybot/scripts/{content_loader.py,stream.py,terms.py} and imports/voice_synthesis.py to pinpoint why the Mike-E voice read the `**Gemini 4 Carbon High**:` block starting above `### Murphy Incarnate` on Honeybot Storytime. Patch the root cause with a before/after straddle probe (and fix any malformed Markdown in the post or sanitizer if implicated), plus provide the exact Honeybot sync/reboot ignition command so live Storytime switches cleanly to the AI narrator voice on `**Gemini ...**:` turns.
5. EXTERNAL DELIVERABLES
No external deliverables this turn.
MikeLev.in:
THE AI-EDIT METHOD
Same commands, run twice, one change between them. Where the readings differ is what the change did; the diff in the middle is the receipt.
1: BEFORE (PROBE):
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
GIT repo clean. Take BEFORE reading, make CHANGE, record AFTER diff.
(nix) pipulate $ .venv/bin/python -c 'import pathlib, subprocess as sp; d = pathlib.Path("remotes/honeybot/scripts"); files = sorted(p.name for p in d.glob("*.py")); hits = sp.run(["rg", "-n", "-i", "speaker|gemini|mike-e|mikelev|narrator|voice", "remotes/honeybot/scripts", "imports/voice_synthesis.py"], text=True, capture_output=True).stdout.splitlines(); print("HB_SCRIPTS:", files); print("SPEAKER_HITS_N:", len(hits)); print("\n".join(hits[:45]))'
.venv/bin/python -c 'import os, pathlib, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; p = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md"); raw = p.read_text(); cleaned = cl.clean_markdown(raw, label="probe", census=False); lines = [ln for ln in cleaned.splitlines() if ln.strip()]; idx = next((i for i, ln in enumerate(lines) if "Murphy Incarnate," in ln or "Wire Field Note and" in ln), 0); cl_fns = [k for k in dir(cl) if not k.startswith("__")]; st_fns = [k for k in dir(stream) if any(w in k.lower() for w in ("speak", "voice", "narrat", "chunk", "parse", "role", "mike", "gemini", "clean", "article"))]; print("CL_ATTRS:", cl_fns); print("STREAM_SPEAK_ATTRS:", st_fns); print("CLEANED_WINDOW:", lines[max(0, idx-6):idx+10])'
.venv/bin/python -c 'import hashlib, os, pathlib, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; loc = {p.name: hashlib.sha256(p.read_bytes()).hexdigest()[:12] for p in sorted(pathlib.Path("remotes/honeybot/scripts").glob("*.py"))}; rcmd = "cat /tmp/honeybot_stage.json 2>/dev/null; echo; ps -eo pid,etimes,args | rg -e stream.py -e logs.py | rg -v rg; sha256sum ~/www/mikelev.in/scripts/*.py 2>/dev/null"; out = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=6", "honeybot", rcmd], env=env, text=True, capture_output=True).stdout.splitlines(); print("LOCAL_SHA12:", loc); print("HB_OUT:", out[:25])'
HB_SCRIPTS: ['build_bot_miner.py', 'card.py', 'content_loader.py', 'db.py', 'dye_injector_v2.py', 'education.py', 'forest.py', 'logs.py', 'radar.py', 'report.py', 'routing.py', 'score.py', 'stream.py', 'terms.py', 'test_forest.py']
SPEAKER_HITS_N: 515
imports/voice_synthesis.py:3:🎤 Chip O'Theseus Voice Synthesis System
imports/voice_synthesis.py:6:This module provides voice synthesis capabilities for Chip O'Theseus,
imports/voice_synthesis.py:24:# Try to import voice synthesis dependencies
imports/voice_synthesis.py:26: from piper import PiperVoice
imports/voice_synthesis.py:28: VOICE_SYNTHESIS_AVAILABLE = True
imports/voice_synthesis.py:30: VOICE_SYNTHESIS_AVAILABLE = False
imports/voice_synthesis.py:79:# THE VOICE ASKS BEFORE IT SPEAKS (2026-09-17). Two functions, one file.
imports/voice_synthesis.py:80:# voice_consent() is the BARRIER: every path to sound reads it, fresh, on every
imports/voice_synthesis.py:81:# call. The answer comes from PIPULATE_VOICE (an unattended shell declaring
imports/voice_synthesis.py:82:# intent, the way PIPULATE_BOOT_MENU=0 does) or from ~/.config/pipulate/voice,
imports/voice_synthesis.py:85:# ask_voice_consent() is the CEREMONY: it prints the card and reads one line
imports/voice_synthesis.py:88:# the foreground on the same terminal; a speaker that ASKED would print the
imports/voice_synthesis.py:90:# see. So the speaker never asks. The rider asks at the start of a walk, and
imports/voice_synthesis.py:91:# the `voice` word asks again later; both own a terminal.
imports/voice_synthesis.py:92:# NOTHING IS DOWNLOADED BEFORE A YES: the model loads in ensure_voice(), on
imports/voice_synthesis.py:94:# to fetch the voice and spend seconds before anyone had asked to speak or
imports/voice_synthesis.py:97:# AMENDED 2026-10-01 (THE VOICE ASKS ONCE, OUT LOUD): first_contact() below,
imports/voice_synthesis.py:98:# run once per machine right before the first menu, prints what the voice is,
imports/voice_synthesis.py:99:# fetches the model with setup_voice_model's own one-line disclosure, and lets
imports/voice_synthesis.py:100:# the voice ask the question itself, because a voice nobody has heard is a
imports/voice_synthesis.py:101:# voice nobody can answer for (CONSENT CANNOT PRECEDE ITS OBJECT). The download
imports/voice_synthesis.py:105:VOICE_CONSENT_FILE = Path.home() / ".config" / "pipulate" / "voice"
imports/voice_synthesis.py:106:VOICE_CARD = (
imports/voice_synthesis.py:108: "The voice is Piper, a small text-to-speech program that runs on this\n"
imports/voice_synthesis.py:111: "sent anywhere. Answering yes downloads the voice once, about 60 MB.\n\n"
imports/voice_synthesis.py:116:def voice_consent() -> str:
imports/voice_synthesis.py:118: env = os.environ.get("PIPULATE_VOICE", "").strip().lower()
imports/voice_synthesis.py:124: recorded = VOICE_CONSENT_FILE.read_text(encoding="utf-8").strip().lower()
imports/voice_synthesis.py:132:def ask_voice_consent(later_hint: str = "talk", force: bool = False) -> str:
imports/voice_synthesis.py:135: Asks only when nothing is recorded, unless force is set (the `voice` word),
imports/voice_synthesis.py:136: and never when PIPULATE_VOICE decides. Without a terminal to ask on -- a
imports/voice_synthesis.py:141: env = os.environ.get("PIPULATE_VOICE", "").strip().lower()
imports/voice_synthesis.py:143: return voice_consent()
imports/voice_synthesis.py:144: recorded = voice_consent()
imports/voice_synthesis.py:154: print(VOICE_CARD, end="", flush=True)
imports/voice_synthesis.py:162: error = _record_voice_answer(decision)
imports/voice_synthesis.py:166: print(f"Staying quiet. To turn the voice on later, type: {later_hint}")
imports/voice_synthesis.py:173:def _record_voice_answer(decision: str):
imports/voice_synthesis.py:177: format voice_consent() reads has one spelling, the word and a newline.
imports/voice_synthesis.py:180: VOICE_CONSENT_FILE.parent.mkdir(parents=True, exist_ok=True)
imports/voice_synthesis.py:181: VOICE_CONSENT_FILE.write_text(decision + "\n", encoding="utf-8")
imports/voice_synthesis.py:191: in VOICE_CONSENT_FILE, and voice_consent() reads it fresh on every call,
imports/voice_synthesis.py:196: on never downloads the voice undisclosed. PIPULATE_VOICE set to a word
imports/voice_synthesis.py:197: voice_consent() reads outranks the file, so talk names it and writes
imports/voice_synthesis.py:210: raw = os.environ.get("PIPULATE_VOICE", "").strip()
CL_ATTRS: ['BASE_URL', 'LIVE_MESSAGE_FILE', 'POSTS_DIR', 'Path', 'STANDBY_FILE', 'TRIGGER_FILE', '_AI_SPEAKER_LABEL_PAT', '_FILEPATH_RE', '_HONEYBOT_POSTS_DIR', '_KNOWN_DOMAIN_DIRS', '_LOCAL_POSTS_DIR', '_TEX_SPOKEN_MAP', '_TTS_PRONUNCIATION_MAP', '_apply_tts_pronunciations', '_get_pinned_storytime_file', '_humanize_tex_expr', '_is_single_dollar_mathjax', '_is_storytime_enabled', '_last_file_count', '_last_scan_time', '_last_standby', '_last_trigger', '_simplify_filepath_match', '_simplify_filepaths_for_tts', '_storytime_effective_rank', '_strip_mathjax_for_tts', '_strip_single_dollar_mathjax_line', '_terms_mod', '_truncate_after_editorial_take', 'check_for_updates', 'check_live_message', 'check_standby', 'clean_markdown', 'datetime', 'get_featured_article_id', 'get_playlist', 'has_pending_update', 'os', 'random', 're', 'sys', 'time', 'trigger_is_fresh', 'urlparse', 'yaml']
STREAM_SPEAK_ATTRS: ['CAST_VOICE_URLS', 'MIKE_MODEL_NAME', 'MIKE_TTS_SAMPLE_RATE', 'MIKE_TURN_CUE_TEXT', 'Narrator', '_AI_SPEAKER_RE', '_HUMAN_SPEAKER_RE', '_active_stage_article', 'ensure_cast_voice_models', 'get_featured_article_id', 'narrator', 'resolve_current_article_info', 'resolve_current_article_line', 'wait_for_voice_or_live_interrupt']
CLEANED_WINDOW: ['Oh yeah, and when shallow-minded draconian folks tell you eval is evil, Raymond is the one who can school them.', 'Very meta.', "Long-form people will enjoy those but they won't show you how to become a millionaire in the 1st 5 seconds nor spike your dopamine so the Veruca Salt people will hate them. But like how Murphy Incarnate is not really a bad guy because somebody has to pay Lan-dower's tax", '3: CHANGE (PATCHES): ', 'Ignition: often "exit", "nix develop". Instructions may vary.', '4: PROMPT: ', 'Verify the Wire Field Note and foofiles.py straddle from LIVE COMMAND RECEIPTS (WIRENOTEOK: True, STREAMLEADOK: True, FOOCLEANOK: True), then use the file path and Storytime/pagination census receipts to execute the next bite-size chisel-strike ( Shannon): The Dead Sea Scrolls and Ethiopian Torah manuscripts survived two millennia without drifting into noise because Hilchot Sefer Torah was a digital error-correction protocol centuries before Claude Shannon: letter-count checksums, parashiyot spacing invariants, and a fail-closed sanitizer where one corrupted character sidelined the scroll to the genizah. And they traveled light—rolled skin, zero dead-tree clutter—for the exact same reason brain.zip and Q A my dot A I S H A 256 deeds pack maximum signal into minimum mass.', 'Prometheus, Great A\'Tuin, & Karl Popper vs. Nihilism: Yes, stealing King Louie\'s fire comes with the daily liver-pecking tax. Under Hans Albert\'s Moonk-how-zen Trilemma, Ymir\'s bones, Terry Pratchett\'s four elephants on Great A\'Tuin, or Boltzmann brains, ultimate foundational certainty does not exist—even if you stood on the bottom turtle, no test could prove there isn\'t another turtle underneath. Gen-Z nihilism mistakes "meaning isn\'t pre-installed in the floorboards" for "nothing matters." Popper\'s answer—and the core of your Alien Interview thesis—is that you ascribe meaning, and what you build without a guarantee measures who you are, verified three beats at a time: BEFORE, EXPERIMENT, AFTER.', 'Bunsen Honeydoofus & Raymond Hettinger\'s eval Lesson: Watching Raymond Hettinger live-code in Emacs in front of a thousand engineers—or watching him show how collections.namedtuple originally generated a plain-text class definition and exec\'d it so anyone could print and read the exact source—exposes why shallow dogma ("eval is evil," "never touch a terminal," "never paginate") exists: rules for people who refuse to inspect the boundary. When you own the plain-text input, eval is just Lisp\'s code-as-data—which is literally what p, x, c does on every turn. You don\'t need to be Beaker writing C-level dict internals when your edge is aiming the laboratory.', "[[HEADING:What the Census Exposed for Today's 5-File Chisel-Strike]]", 'One. Why HOTN: 250 Persisted & Why 404 Needs Zero Nix O S Rebuilds (flake.nix + generateredirects.py + extract404ghosts.py):', "Substring false-positive: generateredirects.py checked '/api/' in oldurl.lower() across the entire U R L, silently dropping legitimate old K-Means topic hubs like file path and file path back out of rawmap.csv while S Q Lite only excluded leading /api/%. Splitting NOISEPREFIXSIGNATURES (startswith) from NOISESUBSTRINGSIGNATURES and sharing one isnoiseorunmappablesource() helper across both scripts closes the gap permanently.", 'Zero-rebuild RAM reload: HOOKLINES confirmed Honeybot already allows passwordless sudo -n file path reload Engine X over redirects.map. Because Bash forbids all-digit function names, flake.nix mints 404 via pkgs.writeShellScriptBin "404", which drains up to 15,000 ghosts in memory, commits rawmap.csv + redirects.map in trimnoir, hot-ships redirects.map to Honeybot Engine X RAM in approximately 1s without interrupting Storytime, and falls back to ssh -t honeybot sudo systemctl reload Engine X (prompting for your password) only if sudo -n ever fails.', 'Two. Retiring "Coming Soon" + Adding Classic "Next 10" Static Paging (generatehubs.py + post.html):', 'generatehubs.py no longer stuffs older storytime: false posts onto the homepage or stamps ⏳ Coming Soon on YouTube Live Storytime badges, and post.html drops all three Coming Soon branches so --aside posts look identical to standard articles while still leaving the live broadcast undisturbed.', 'Using CSafeLoader over 4 kilobytes frontmatter slices (plus &123;&123; / &123;% Liquid-tag escaping), generatehubs.py now appends a "Next 10 →" bar on / and generates file path .. file path (file path.md) with top-and-bottom "← Previous 10" / "Next 10 →" controls through the very first post.']
LOCAL_SHA12: {'build_bot_miner.py': 'ec508164495a', 'card.py': '11dfcc3e2d9a', 'content_loader.py': '87e7e1bf0ae9', 'db.py': '96959d9242e1', 'dye_injector_v2.py': '009b320d51b7', 'education.py': '82aa75b1f9ec', 'forest.py': '031996d06fdd', 'logs.py': 'beb85a0032b8', 'radar.py': 'a3c8aea28486', 'report.py': '43e6aaefdf83', 'routing.py': 'db0e8b6ddae4', 'score.py': '4171fcb348b2', 'stream.py': '5dc66f45ec7d', 'terms.py': 'eca4cb6d4830', 'test_forest.py': 'ca57311f62cb'}
HB_OUT: ['{"speaker": "narrator", "left": "inactive", "right": "inactive", "hud_focus": "", "article": "2026-11-14:The Upstream Bot Stream Chat G P T\'s Dashboard Won\'t Show You", "curtain_side": "", "curtain_until": 0.0, "seq": 617, "updated_at": 1794680735.964}', '2231408 12023 python3 -u /home/mike/www/mikelev.in/scripts/stream.py', '2231688 11958 /nix/store/wjm7brjz81q0k8pa15xijb9a0vhfx78s-python3-3.13.9-env/bin/python3 /home/mike/www/mikelev.in/scripts/logs.py', 'ec508164495aa489357c0f8072fe47d22ede980d6ff0a9a9ba5fd1c1a4a38031 /home/mike/www/mikelev.in/scripts/build_bot_miner.py', '11dfcc3e2d9a16800122c396d3527e3490392435f0d76b5590541da5090ce624 /home/mike/www/mikelev.in/scripts/card.py', '87e7e1bf0ae9c8f1e95f9e0242a3bf99c0857f2d0204d18f8e584033b87a0997 /home/mike/www/mikelev.in/scripts/content_loader.py', '96959d9242e1136aebb3fdfb23ed5bdba548e6686abdbc41e34ecc73e83e8d76 /home/mike/www/mikelev.in/scripts/db.py', '009b320d51b75f2bc88bf924b5ac6a72e98180763206f7b0b5c5db37ed635a38 /home/mike/www/mikelev.in/scripts/dye_injector_v2.py', '82aa75b1f9ecf310693b220780c72aac5363583c1f6c42ac8924e6cac4c5a999 /home/mike/www/mikelev.in/scripts/education.py', '031996d06fdd35aa4bbddc0eca662c8f68d8f0deb6fecebd48c5a98f4d2ecb07 /home/mike/www/mikelev.in/scripts/forest.py', 'beb85a0032b8859533bc85681b6426275a55b7010a43baf7d7aa04a835743743 /home/mike/www/mikelev.in/scripts/logs.py', 'a3c8aea28486fe1a41904e82e9225fa20b875d8166101d94200087d8ce4b496f /home/mike/www/mikelev.in/scripts/radar.py', '43e6aaefdf83ca36a64b2d5db2943df2df7b92580318e855469639e16e6eb018 /home/mike/www/mikelev.in/scripts/report.py', 'db0e8b6ddae4b96b7fa384f17a08d061b28ae44c09a92b536e396d85bf1f9b40 /home/mike/www/mikelev.in/scripts/routing.py', '4171fcb348b2901f24c2046f57bf7c5e3f864b1d3aabda92855e773fd8726448 /home/mike/www/mikelev.in/scripts/score.py', '5dc66f45ec7def1635fd5ae17148f1a32fc17a99261171089a168803f2ee84d3 /home/mike/www/mikelev.in/scripts/stream.py', 'eca4cb6d4830962137b293909998adf4d7100a0e2f2785935fce2b62d6d29565 /home/mike/www/mikelev.in/scripts/terms.py', 'ca57311f62cb7b2b3f5ceaa4de08a3a64b7dbbc610fdeaaf829eb05546a56b75 /home/mike/www/mikelev.in/scripts/test_forest.py']
(nix) pipulate $
2: AFTER (NEXT CONTEXT):
# # Context 1
# context.txt
# /home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md
#
# # THE JEKYLL BLOG LIKE A HACKER (INVENTED SKILL.md & AGENTS.md FORMAT) PUBLISHING PIPELINE
# ~/repos/nixos/blogs.nix
# ~/.config/pipulate/blogs.json
# scripts/articles/publishizer.py
# scripts/articles/common.py
# scripts/articles/articleizer.py
# scripts/articles/link_injector.py
# scripts/articles/build_knowledge_graph.py
# scripts/articles/editing_prompt.txt
# scripts/articles/sanitizer.py
# scripts/articles/contextualizer.py
# scripts/articles/generate_hubs.py
# scripts/articles/generate_llms_txt.py
# scripts/articles/generate_post_nav.py
# assets/jekyll/common-packages.nix
# Context 2
context.txt
foo_files.py
/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md
remotes/honeybot/scripts/content_loader.py
remotes/honeybot/scripts/stream.py
remotes/honeybot/scripts/terms.py
imports/voice_synthesis.py
scripts/articles/sanitizer.py
scripts/articles/common.py
! .venv/bin/python -c 'import pathlib, subprocess as sp; d = pathlib.Path("remotes/honeybot/scripts"); files = sorted(p.name for p in d.glob("*.py")); hits = sp.run(["rg", "-n", "-i", "speaker|gemini|mike-e|mikelev|narrator|voice", "remotes/honeybot/scripts", "imports/voice_synthesis.py"], text=True, capture_output=True).stdout.splitlines(); print("HB_SCRIPTS:", files); print("SPEAKER_HITS_N:", len(hits)); print("\n".join(hits[:45]))'
! .venv/bin/python -c 'import os, pathlib, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; p = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md"); raw = p.read_text(); cleaned = cl.clean_markdown(raw, label="probe", census=False); lines = [ln for ln in cleaned.splitlines() if ln.strip()]; idx = next((i for i, ln in enumerate(lines) if "Murphy Incarnate," in ln or "Wire Field Note and" in ln), 0); cl_fns = [k for k in dir(cl) if not k.startswith("__")]; st_fns = [k for k in dir(stream) if any(w in k.lower() for w in ("speak", "voice", "narrat", "chunk", "parse", "role", "mike", "gemini", "clean", "article"))]; print("CL_ATTRS:", cl_fns); print("STREAM_SPEAK_ATTRS:", st_fns); print("CLEANED_WINDOW:", lines[max(0, idx-6):idx+10])'
! .venv/bin/python -c 'import hashlib, os, pathlib, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; loc = {p.name: hashlib.sha256(p.read_bytes()).hexdigest()[:12] for p in sorted(pathlib.Path("remotes/honeybot/scripts").glob("*.py"))}; rcmd = "cat /tmp/honeybot_stage.json 2>/dev/null; echo; ps -eo pid,etimes,args | rg -e stream.py -e logs.py | rg -v rg; sha256sum ~/www/mikelev.in/scripts/*.py 2>/dev/null"; out = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=6", "honeybot", rcmd], env=env, text=True, capture_output=True).stdout.splitlines(); print("LOCAL_SHA12:", loc); print("HB_OUT:", out[:25])'
3: CHANGE (PATCHES):
None this turn.
4: PROMPT:
Inspect the LIVE COMMAND RECEIPTS and the newly loaded remotes/honeybot/scripts/{content_loader.py,stream.py,terms.py} and imports/voice_synthesis.py to pinpoint why the Mike-E voice read the **Gemini 4 Carbon High**: block starting above ### Murphy Incarnate on Honeybot Storytime. Patch the root cause with a before/after straddle probe (and fix any malformed Markdown in the post or sanitizer if implicated), plus provide the exact Honeybot sync/reboot ignition command so live Storytime switches cleanly to the AI narrator voice on **Gemini ...**: turns.
5: DELIVERABLE:
What does “DONE” look like?
Better abiding by narrator roles.
Catching the Multiline HTML-Strip Regex in Clean Markdown
I had to delete both the article and foo_file.py out to fit.
(nix) pipulate $ x
(nix) pipulate $ p
(nix) pipulate $ c
🗺️ Codex Mapping Coverage: 75.6% (223/295 tracked files) (was 223/295: +0 claimed, +0 tracked).
✅ Topological Integrity Verified: 22 candidate reference(s) scanned, all exist.
-> Executing: .venv/bin/python -c 'import pathlib, subprocess as sp; d = pathlib.Path("remotes/honeybot/scripts"); files = sorted(p.name for p in d.glob("*.py")); hits = sp.run(["rg", "-n", "-i", "speaker|gemini|mike-e|mikelev|narrator|voice", "remotes/honeybot/scripts", "imports/voice_synthesis.py"], text=True, capture_output=True).stdout.splitlines(); print("HB_SCRIPTS:", files); print("SPEAKER_HITS_N:", len(hits)); print("\n".join(hits[:45]))' ... [0.0815s]
-> Executing: .venv/bin/python -c 'import os, pathlib, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; p = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md"); raw = p.read_text(); cleaned = cl.clean_markdown(raw, label="probe", census=False); lines = [ln for ln in cleaned.splitlines() if ln.strip()]; idx = next((i for i, ln in enumerate(lines) if "Murphy Incarnate," in ln or "Wire Field Note and" in ln), 0); cl_fns = [k for k in dir(cl) if not k.startswith("__")]; st_fns = [k for k in dir(stream) if any(w in k.lower() for w in ("speak", "voice", "narrat", "chunk", "parse", "role", "mike", "gemini", "clean", "article"))]; print("CL_ATTRS:", cl_fns); print("STREAM_SPEAK_ATTRS:", st_fns); print("CLEANED_WINDOW:", lines[max(0, idx-6):idx+10])' ... [0.5910s]
-> Executing: .venv/bin/python -c 'import hashlib, os, pathlib, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; loc = {p.name: hashlib.sha256(p.read_bytes()).hexdigest()[:12] for p in sorted(pathlib.Path("remotes/honeybot/scripts").glob("*.py"))}; rcmd = "cat /tmp/honeybot_stage.json 2>/dev/null; echo; ps -eo pid,etimes,args | rg -e stream.py -e logs.py | rg -v rg; sha256sum ~/www/mikelev.in/scripts/*.py 2>/dev/null"; out = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=6", "honeybot", rcmd], env=env, text=True, capture_output=True).stdout.splitlines(); print("LOCAL_SHA12:", loc); print("HB_OUT:", out[:25])' ... [0.2328s]
Python file(s) detected. Generating codebase tree diagram... (3,018 tokens | 9,870 bytes)
UML unavailable for 8 file(s): Skipping: Required command(s) not found: `pyreverse` (from pylint).
-> Ruff exit 0 (clean).
📦 Payload Ledger (biggest first)
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━┓
┃ File / Source ┃ Tokens ┃ Bytes ┃ % Bytes ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━┩
│ /home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md │ 119,474 │ 432,896 │ 31.5% │
│ foo_files.py │ 83,659 │ 322,493 │ 23.4% │
│ scripts/articles/common.py │ 48,986 │ 191,773 │ 13.9% │
│ remotes/honeybot/scripts/stream.py │ 37,428 │ 157,416 │ 11.4% │
│ imports/voice_synthesis.py │ 13,135 │ 57,928 │ 4.2% │
│ apply.py │ 11,320 │ 48,182 │ 3.5% │
│ PROMPT (checklist + prompt.md) │ 12,428 │ 45,823 │ 3.3% │
│ remotes/honeybot/scripts/content_loader.py │ 11,303 │ 41,649 │ 3.0% │
│ scripts/articles/sanitizer.py │ 5,559 │ 21,519 │ 1.6% │
│ remotes/honeybot/scripts/terms.py │ 7,583 │ 21,303 │ 1.5% │
│ AUTO: Codebase Structure (eza --tree + token sizes) │ 3,018 │ 9,870 │ 0.7% │
│ .gitignore │ 2,017 │ 7,492 │ 0.5% │
│ ! .venv/bin/python -c 'import os, pathlib, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import │ 1,459 │ 5,841 │ 0.4% │
│ content_loader as cl, stream; p = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md"); raw │ │ │ │
│ = p.read_text(); cleaned = cl.clean_markdown(raw, label="probe", census=False); lines = [ln for ln in cleaned.splitlines() if ln.strip()]; idx = │ │ │ │
│ next((i for i, ln in enumerate(lines) if "Murphy Incarnate," in ln or "Wire Field Note and" in ln), 0); cl_fns = [k for k in dir(cl) if not │ │ │ │
│ k.startswith("__")]; st_fns = [k for k in dir(stream) if any(w in k.lower() for w in ("speak", "voice", "narrat", "chunk", "parse", "role", │ │ │ │
│ "mike", "gemini", "clean", "article"))]; print("CL_ATTRS:", cl_fns); print("STREAM_SPEAK_ATTRS:", st_fns); print("CLEANED_WINDOW:", lines[max(0, │ │ │ │
│ idx-6):idx+10])' │ │ │ │
│ ! .venv/bin/python -c 'import pathlib, subprocess as sp; d = pathlib.Path("remotes/honeybot/scripts"); files = sorted(p.name for p in │ 1,232 │ 4,504 │ 0.3% │
│ d.glob("*.py")); hits = sp.run(["rg", "-n", "-i", "speaker|gemini|mike-e|mikelev|narrator|voice", "remotes/honeybot/scripts", │ │ │ │
│ "imports/voice_synthesis.py"], text=True, capture_output=True).stdout.splitlines(); print("HB_SCRIPTS:", files); print("SPEAKER_HITS_N:", │ │ │ │
│ len(hits)); print("\n".join(hits[:45]))' │ │ │ │
│ context.txt │ 904 │ 2,982 │ 0.2% │
│ ! .venv/bin/python -c 'import hashlib, os, pathlib, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; loc = {p.name: │ 1,201 │ 2,668 │ 0.2% │
│ hashlib.sha256(p.read_bytes()).hexdigest()[:12] for p in sorted(pathlib.Path("remotes/honeybot/scripts").glob("*.py"))}; rcmd = "cat │ │ │ │
│ /tmp/honeybot_stage.json 2>/dev/null; echo; ps -eo pid,etimes,args | rg -e stream.py -e logs.py | rg -v rg; sha256sum │ │ │ │
│ ~/www/mikelev.in/scripts/*.py 2>/dev/null"; out = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=6", "honeybot", rcmd], env=env, │ │ │ │
│ text=True, capture_output=True).stdout.splitlines(); print("LOCAL_SHA12:", loc); print("HB_OUT:", out[:25])' │ │ │ │
│ AUTO: Recent Git Diff Telemetry │ 489 │ 1,689 │ 0.1% │
│ .gitattributes │ 33 │ 76 │ 0.0% │
│ AUTO: Static Analysis Diagnostics │ 11 │ 39 │ 0.0% │
├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼─────────┼───────────┼─────────┤
│ TOTAL │ 361,239 │ 1,376,143 │ 100.0% │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴─────────┴───────────┴─────────┘
Assembled payload (pre-scrub): 370,277 tokens | 1,406,692 bytes
🧼 Identity scrub: substitutions=MISSING (/home/mike/.config/pipulate/pii_substitutions.txt) | denylist=MISSING (/home/mike/.config/pipulate/commit_denylist.txt)
🔐 Secrets tripwire: ARMED -- 0 hit(s) in payload.
📦 Canonical QA archive written to /home/mike/pipulate/qamy.ai.zip (sha256=25829d26ebac…, members=3)
🗂️ Rotated archive snapshot: qamy.ai_1078-25829d26.zip (keeping newest 20 of 20)
Markdown output copied to clipboard
(nix) pipulate $
Gemini 4 Carbon High: Context verified.
TL;DR: Receipt 2 (CLEANED_WINDOW) caught the exact culprit red-handed: text = re.sub(r'<[^>]+>', '', text) in remotes/honeybot/scripts/content_loader.py matched the bare < in Mike’s unfenced (<= 5 files): prompt line and swallowed 42 lines of Markdown across newlines up to the > in -> Shannon—deleting **Gemini 4 Carbon High**: Context verified., **TL;DR**:, ### Murphy Incarnate..., and the first bullet so Narrator._stage_dialogue_role stayed stuck on Mike-E (left) for the entire response (and did the exact same thing a second time in Turn 4 from (<= 5 files): to /api -> /api/). We replace r'<[^>]+>' in both TTS lanes (content_loader.py and imports/voice_synthesis.py) with a non-multiline HTML comment/tag stripper that ignores comparison operators and inline code, add <=/>= ear-orthography in terms.py, add symmetric AI-turn structural recovery in stream.py, and widen sanitizer.py to heal multi-span inverted bold/code closures.
Forensic Receipt from CLEANED_WINDOW
Look at item 7 of CLEANED_WINDOW in Receipt 2:
'4: PROMPT: ',
'Verify the Wire Field Note and foofiles.py straddle from LIVE COMMAND RECEIPTS ..., then use the file path and Storytime/pagination census receipts to execute the next bite-size chisel-strike ( Shannon): The Dead Sea Scrolls and Ethiopian Torah manuscripts ...'
- Multiline
<[^>]+>Devoured Two**Gemini 4 Carbon High**:Turns: Because[^>]is a negated character class without\n,re.sub(r'<[^>]+>', '', text)incontent_loader.pyopened on<in(<= 5 files):inside Mike’s unfenced4: PROMPTand ate every character through>in(Hilchot Sefer Torah-> Shannon):—erasing**Gemini 4 Carbon High**:soNarratornever switched fromMike-E(left) toShipmunk O'Theseus(right). The exact same<->>bridge fired again in Turn 4 between(<= 5 files):and/api -> /api/. - Inline-Code Tag Stripping Order:
clean_markdown()previously unwrapped<nav>,<footer>, and<div>before stripping HTML tags, turning"grouped by HTML landmarks (,,)"into"grouped by HTML landmarks (, , )". Stripping real HTML tags while inline code is still backtick-protected—and then unwrapping<div>todiv—fixes both bugs at once. - Defense-in-Depth on Stage Roles:
stream.pyalready had structural recovery forMike-E("same commands, run twice","1: before (probe):"), but none forShipmunk O'Theseus. Adding"context verified."/"tool calls this turn:"recovery ensuresShipmunkstill takes the stage even if a speaker label is omitted by hand in a future draft.
1. PROBES
- Probe 1 (STRADDLE on
clean_markdown+Narrator.plan_utterancesfor the Live Post): PredictsGEMINI_TURNS: 3 MURPHY_HEAD: MISSING MURPHY_B1: MISSING SHANNON: mike TURN4_GOOD_NEWS: mikebefore patching andGEMINI_TURNS: 5 MURPHY_HEAD: norma MURPHY_B1: shipmunk SHANNON: shipmunk TURN4_GOOD_NEWS: shipmunkafter patching. - Probe 2 (STRADDLE on
voice_synthesis.py,sanitizer.py, & Recent 15-Post Speaker Audit): PredictsVS_SAFE: False SAN_MULTI_CODE_OK: False(withCLEANED_AI_TURNS < RECENT15_RAW_AI_TURNS) before patching andVS_SAFE: True SAN_MULTI_CODE_OK: True(withCLEANED_AI_TURNS == RECENT15_RAW_AI_TURNS) after patching. - Probe 3 (GATE on Ruff, Honeybot SHA-256 Parity, & Fresh
stream.pyPID): VerifiesRUFF_RC: 0and confirmsHB_PARITY: Trueplus a freshstream.pyuptime onhoneybotafter running theytrebootignition.
(nix) pipulate $
.venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; raw = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md").read_text(); body = raw.split("---", 2)[2]; cleaned = cl.clean_markdown(body, label="probe", census=False); nar = stream.Narrator(); pairs = []; [pairs.extend((s["voice"], s["text"]) for s in nar.plan_utterances(re.sub(r"^\[\[HEADING:(.+)\]\]$", r"[[HEADING]]\1", ln.strip()))) for ln in cleaned.splitlines() if ln.strip() and not ln.strip().startswith(("[[PATRONUS:", "[[MEDIA:"))]; g_cnt = sum(1 for ln in cleaned.splitlines() if ln.strip().startswith("Gemini 4 Carbon High:")); v_of = lambda needle: next((v for v, t in pairs if needle in t), "MISSING"); print("GEMINI_TURNS:", g_cnt, "MURPHY_HEAD:", v_of("Murphy Incarnate, Hilchot"), "MURPHY_B1:", v_of("Why Murphy Incarnate"), "SHANNON:", v_of("The Dead Sea Scrolls"), "TURN4_GOOD_NEWS:", v_of("Good News First"))'
.venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); sys.path.insert(0, "scripts/articles"); import content_loader as cl, sanitizer; from imports.voice_synthesis import ChipVoiceSystem; vs_out = ChipVoiceSystem().sanitize_text("budget (<= 5 files) and 7231 -> 9110"); vs_ok = ("5 files" in vs_out and "7231" in vs_out); bt = chr(96); san_in = f"classic **{bt}Next 10{bt} / {bt}Prev 10**{bt} pages"; san_out = sanitizer.neutralize_inception_artifacts(san_in); san_ok = san_out.endswith(f"{bt}Prev 10{bt}** pages"); posts = sorted(pathlib.Path("/home/mike/repos/trimnoir/_posts").glob("2026-*.md"))[-15:]; bodies = [(p.name, re.sub(r"^[triple-backtick][^\n]*\n.*?^[triple-backtick][ \t]*$", "", p.read_text().split("---", 2)[-1], flags=re.M | re.S)) for p in posts]; raw_ai = sum(len(re.findall(r"(?m)^[ \t]*\*\*(?:Gemini|Claude)[^*\n]+\*\*:", b)) for _, b in bodies); cln_ai = sum(len(re.findall(r"(?m)^(?:Gemini|Claude)\b[^:\n]*:", cl.clean_markdown(b, label=n, census=False))) for n, b in bodies); print("VS_SAFE:", vs_ok, "SAN_MULTI_CODE_OK:", san_ok, "RECENT15_RAW_AI_TURNS:", raw_ai, "CLEANED_AI_TURNS:", cln_ai)'
.venv/bin/python -c 'import hashlib, os, pathlib, shutil, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; ruff_bin = shutil.which("ruff") or "ruff"; rf = sp.run([ruff_bin, "check", "remotes/honeybot/scripts/content_loader.py", "remotes/honeybot/scripts/terms.py", "remotes/honeybot/scripts/stream.py", "imports/voice_synthesis.py", "scripts/articles/sanitizer.py"], text=True, capture_output=True); names = ("content_loader.py", "terms.py", "stream.py"); loc = {n: hashlib.sha256((pathlib.Path("remotes/honeybot/scripts") / n).read_bytes()).hexdigest()[:12] for n in names}; rcmd = "sha256sum ~/www/mikelev.in/scripts/content_loader.py ~/www/mikelev.in/scripts/terms.py ~/www/mikelev.in/scripts/stream.py; ps -eo pid,etimes,args | rg stream.py | rg -v rg"; hb_lines = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=6", "honeybot", rcmd], env=env, text=True, capture_output=True).stdout.splitlines(); rem = {pathlib.Path(ln.split()[1]).name: ln.split()[0][:12] for ln in hb_lines if len(ln.split()) == 2 and "/" in ln.split()[1]}; pid_ln = [ln.strip() for ln in hb_lines if "stream.py" in ln and "sha256" not in ln and "/scripts/stream.py" in ln and len(ln.split()) >= 3]; print("RUFF_RC:", rf.returncode, "HB_PARITY:", loc == rem, "STREAM_PS:", pid_ln)'
2. NEXT CONTEXT
context.txt
foo_files.py
remotes/honeybot/scripts/content_loader.py
remotes/honeybot/scripts/stream.py
remotes/honeybot/scripts/terms.py
imports/voice_synthesis.py
scripts/articles/sanitizer.py
! .venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; raw = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md").read_text(); body = raw.split("---", 2)[2]; cleaned = cl.clean_markdown(body, label="probe", census=False); nar = stream.Narrator(); pairs = []; [pairs.extend((s["voice"], s["text"]) for s in nar.plan_utterances(re.sub(r"^\[\[HEADING:(.+)\]\]$", r"[[HEADING]]\1", ln.strip()))) for ln in cleaned.splitlines() if ln.strip() and not ln.strip().startswith(("[[PATRONUS:", "[[MEDIA:"))]; g_cnt = sum(1 for ln in cleaned.splitlines() if ln.strip().startswith("Gemini 4 Carbon High:")); v_of = lambda needle: next((v for v, t in pairs if needle in t), "MISSING"); print("GEMINI_TURNS:", g_cnt, "MURPHY_HEAD:", v_of("Murphy Incarnate, Hilchot"), "MURPHY_B1:", v_of("Why Murphy Incarnate"), "SHANNON:", v_of("The Dead Sea Scrolls"), "TURN4_GOOD_NEWS:", v_of("Good News First"))'
! .venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); sys.path.insert(0, "scripts/articles"); import content_loader as cl, sanitizer; from imports.voice_synthesis import ChipVoiceSystem; vs_out = ChipVoiceSystem().sanitize_text("budget (<= 5 files) and 7231 -> 9110"); vs_ok = ("5 files" in vs_out and "7231" in vs_out); bt = chr(96); san_in = f"classic **{bt}Next 10{bt} / {bt}Prev 10**{bt} pages"; san_out = sanitizer.neutralize_inception_artifacts(san_in); san_ok = san_out.endswith(f"{bt}Prev 10{bt}** pages"); posts = sorted(pathlib.Path("/home/mike/repos/trimnoir/_posts").glob("2026-*.md"))[-15:]; bodies = [(p.name, re.sub(r"^[triple-backtick][^\n]*\n.*?^[triple-backtick][ \t]*$", "", p.read_text().split("---", 2)[-1], flags=re.M | re.S)) for p in posts]; raw_ai = sum(len(re.findall(r"(?m)^[ \t]*\*\*(?:Gemini|Claude)[^*\n]+\*\*:", b)) for _, b in bodies); cln_ai = sum(len(re.findall(r"(?m)^(?:Gemini|Claude)\b[^:\n]*:", cl.clean_markdown(b, label=n, census=False))) for n, b in bodies); print("VS_SAFE:", vs_ok, "SAN_MULTI_CODE_OK:", san_ok, "RECENT15_RAW_AI_TURNS:", raw_ai, "CLEANED_AI_TURNS:", cln_ai)'
! .venv/bin/python -c 'import hashlib, os, pathlib, shutil, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; ruff_bin = shutil.which("ruff") or "ruff"; rf = sp.run([ruff_bin, "check", "remotes/honeybot/scripts/content_loader.py", "remotes/honeybot/scripts/terms.py", "remotes/honeybot/scripts/stream.py", "imports/voice_synthesis.py", "scripts/articles/sanitizer.py"], text=True, capture_output=True); names = ("content_loader.py", "terms.py", "stream.py"); loc = {n: hashlib.sha256((pathlib.Path("remotes/honeybot/scripts") / n).read_bytes()).hexdigest()[:12] for n in names}; rcmd = "sha256sum ~/www/mikelev.in/scripts/content_loader.py ~/www/mikelev.in/scripts/terms.py ~/www/mikelev.in/scripts/stream.py; ps -eo pid,etimes,args | rg stream.py | rg -v rg"; hb_lines = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=6", "honeybot", rcmd], env=env, text=True, capture_output=True).stdout.splitlines(); rem = {pathlib.Path(ln.split()[1]).name: ln.split()[0][:12] for ln in hb_lines if len(ln.split()) == 2 and "/" in ln.split()[1]}; pid_ln = [ln.strip() for ln in hb_lines if "stream.py" in ln and "sha256" not in ln and "/scripts/stream.py" in ln and len(ln.split()) >= 3]; print("RUFF_RC:", rf.returncode, "HB_PARITY:", loc == rem, "STREAM_PS:", pid_ln)'
3. PATCHES
Target: remotes/honeybot/scripts/content_loader.py
[[[SEARCH]]]
import os
import re
import sys
[[[DIVIDER]]]
import html
import os
import re
import sys
[[[REPLACE]]]
Target: remotes/honeybot/scripts/content_loader.py
[[[SEARCH]]]
def _simplify_filepaths_for_tts(text):
"""Replace slash-heavy filesystem paths with their filename.ext or 'file path'."""
return _FILEPATH_RE.sub(_simplify_filepath_match, text)
[[[DIVIDER]]]
def _simplify_filepaths_for_tts(text):
"""Replace slash-heavy filesystem paths with their filename.ext or 'file path'."""
return _FILEPATH_RE.sub(_simplify_filepath_match, text)
_INLINE_CODE_OR_HTML_TAG_RE = re.compile(
r'(`+(?:[^`\n]|\n(?!\s*\n))*`+)'
r'|<!--[\s\S]*?-->'
r'|<!DOCTYPE[ \t]+[^<>\n]+>'
r'|<(https?://[^>\s]+)>'
r'|</?[A-Za-z][A-Za-z0-9:-]*(?:(?:[ \t]+|\n[ \t]*(?=[A-Za-z_:][A-Za-z0-9_.:-]*\s*=))(?:[^<>"\'`\n]|"[^"\n]*"|\'[^\'\n]*\')*)?[ \t]*/?>',
re.IGNORECASE,
)
def _strip_html_tags_for_tts(text):
"""Strip real HTML comments and tags outside inline code without eating '<=' or '<' across lines."""
def _repl(match):
if match.group(1) is not None:
return match.group(1)
if match.group(2) is not None:
return f" {match.group(2)} "
return " "
return _INLINE_CODE_OR_HTML_TAG_RE.sub(_repl, text)
def _unwrap_inline_code_for_tts(match):
"""Unwrap inline backticks and strip angle brackets from tag-name examples like `<div>`."""
inner = match.group(1)
return re.sub(r'</?([A-Za-z][A-Za-z0-9._:-]*(?:[ \t]+[A-Za-z0-9._:-]+)*)\s*/?>', r'\1', inner)
[[[REPLACE]]]
Target: remotes/honeybot/scripts/content_loader.py
[[[SEARCH]]]
# Remove Inline Code
text = re.sub(r'`([^`]+)`', r'\1', text)
[[[DIVIDER]]]
# Strip HTML comments/tags outside inline code BEFORE unwrapping backticks so '<=' never eats across lines
text = _strip_html_tags_for_tts(text)
text = html.unescape(text)
# Remove Inline Code (unwrapping `<tag>` examples to `tag`)
text = re.sub(r'`((?:[^`\n]|\n(?!\s*\n))+)`', _unwrap_inline_code_for_tts, text)
[[[REPLACE]]]
Target: remotes/honeybot/scripts/content_loader.py
[[[SEARCH]]]
# Remove HTML tags
text = re.sub(r'<[^>]+>', '', text)
# Tag Markdown ATX headings on their own paragraph boundaries so Norma Centroid reads every headline
[[[DIVIDER]]]
# Strip any HTML tags exposed inside unwrapped Markdown link labels without matching '<=' across lines
text = _strip_html_tags_for_tts(text)
# Tag Markdown ATX headings on their own paragraph boundaries so Norma Centroid reads every headline
[[[REPLACE]]]
Target: remotes/honeybot/scripts/content_loader.py
[[[SEARCH]]]
# Remove Headers/Bold/Italic markers
text = re.sub(r'[*_#]', '', text)
[[[DIVIDER]]]
# Remove leading blockquote markers and Headers/Bold/Italic markers
text = re.sub(r'(?m)^[ \t]*>[ \t]?', '', text)
text = re.sub(r'[*_#]', '', text)
[[[REPLACE]]]
Target: remotes/honeybot/scripts/terms.py
[[[SEARCH]]]
(re.compile(r"\bdx/dy\b", re.IGNORECASE), "D X over D Y"),
(re.compile(r"\bdy/dx\b", re.IGNORECASE), "D Y over D X"),
[[[DIVIDER]]]
(re.compile(r"\bdx/dy\b", re.IGNORECASE), "D X over D Y"),
(re.compile(r"\bdy/dx\b", re.IGNORECASE), "D Y over D X"),
(re.compile(r"(?<![<=-])<=(?!=)\s*(?=\$?\d|[A-Za-z])"), "less than or equal to "),
(re.compile(r"(?<![>=-])>=(?!=)\s*(?=\$?\d|[A-Za-z])"), "greater than or equal to "),
[[[REPLACE]]]
Target: remotes/honeybot/scripts/terms.py
[[[SEARCH]]]
AI_SPEAKER_LABEL_PAT = (
r"(?:(?:Gemini|Claude|ChatGPT|OpenAI|Opus|Sonnet|Shipmunk)\b"
r"(?:[ \t]+(?:\d+(?:\.\d+)*"
r"|Argon|Carbon|Neon|Helium|Krypton|Xenon|Radon"
r"|Pro|Flash|Ultra|Nano|High|Medium|Low"
r"|Opus|Sonnet|Haiku|Code|User|Web|Bot"
r"|Thinking|Exp|Experimental|Preview|Lite|Mini|Max|Plus|Turbo"
r"|o\d+|O'Theseus"
r"|[A-Za-z][A-Za-z0-9-]{1,15}(?=[ \t]+(?:High|Medium|Low|Pro|Flash|Ultra|Nano|Lite|Mini|Max|Plus|Thinking|Preview|Exp)\b))){0,4}"
r"|AI)"
)
[[[DIVIDER]]]
AI_SPEAKER_LABEL_PAT = (
r"(?:(?:Gemini|Claude|ChatGPT|OpenAI|Opus|Sonnet|Shipmunk|Chip)\b"
r"(?:[ \t]+(?:\d+(?:\.\d+)*"
r"|Argon|Carbon|Neon|Helium|Krypton|Xenon|Radon"
r"|Pro|Flash|Ultra|Nano|High|Medium|Low"
r"|Opus|Sonnet|Haiku|Code|User|Web|Bot"
r"|Thinking|Exp|Experimental|Preview|Lite|Mini|Max|Plus|Turbo"
r"|o\d+|O'Theseus"
r"|[A-Za-z][A-Za-z0-9-]{1,15}(?=[ \t]+(?:High|Medium|Low|Pro|Flash|Ultra|Nano|Lite|Mini|Max|Plus|Thinking|Preview|Exp)\b))){0,6}"
r"|AI)"
)
[[[REPLACE]]]
Target: remotes/honeybot/scripts/terms.py
[[[SEARCH]]]
(
re.compile(
rf"(?m)^[ \t]*\*\*[ \t]*({AI_SPEAKER_LABEL_PAT})[ \t]*:?[ \t]*\*\*[ \t]*:?[ \t]*(?:\r?\n[ \t]*(?!\*\*[ \t]*(?:Gemini|Claude|ChatGPT|OpenAI|Opus|Sonnet|Shipmunk|AI|MikeLev\.in|Mike|Me)\b|PP4HEADINGSTART|#{1,6}[ \t]))*",
re.IGNORECASE,
),
r"\n\n\1: ",
),
[[[DIVIDER]]]
(
re.compile(
rf"(?m)^[ \t]*\*{1,2}[ \t]*({AI_SPEAKER_LABEL_PAT})[ \t]*:?[ \t]*\*{1,2}[ \t]*:?[ \t]*(?:\r?\n[ \t]*(?!\*{1,2}[ \t]*(?:Gemini|Claude|ChatGPT|OpenAI|Opus|Sonnet|Shipmunk|Chip|AI|MikeLev\.in|Mike|Me)\b|PP4HEADINGSTART|#{1,6}[ \t]))*",
re.IGNORECASE,
),
r"\n\n\1: ",
),
[[[REPLACE]]]
Target: remotes/honeybot/scripts/stream.py
[[[SEARCH]]]
_AI_TURN_PREFIX_RE = re.compile(
rf"^\s*(?:(?:gemini|claude|chat\s*g\s*p\s*t|chatgpt|openai|opus|sonnet|shipmunk)\b(?:\s+{_AI_MODEL_MODIFIER_TOKEN}){{0,4}}|a\s*i)\s*:\s*",
re.IGNORECASE,
)
[[[DIVIDER]]]
_AI_TURN_PREFIX_RE = re.compile(
rf"^\s*(?:(?:gemini|claude|chat\s*g\s*p\s*t|chatgpt|openai|opus|sonnet|shipmunk|chip)\b(?:\s+{_AI_MODEL_MODIFIER_TOKEN}){{0,6}}|a\s*i)\s*:\s*",
re.IGNORECASE,
)
[[[REPLACE]]]
Target: remotes/honeybot/scripts/stream.py
[[[SEARCH]]]
if self._stage_dialogue_role != "left" and low.startswith((
"> same commands, run twice",
"same commands, run twice",
"1: before (probe):",
)):
self._stage_dialogue_role = "left"
self._reannounce_after_break = False
return [
self._make_spec("norma", MIKE_TURN_CUE_TEXT, "narrator", "curtain", "inactive"),
self._make_spec("mike", raw, "left", "active", "inactive"),
]
[[[DIVIDER]]]
if self._stage_dialogue_role != "left" and low.startswith((
"> same commands, run twice",
"same commands, run twice",
"1: before (probe):",
)):
self._stage_dialogue_role = "left"
self._reannounce_after_break = False
return [
self._make_spec("norma", MIKE_TURN_CUE_TEXT, "narrator", "curtain", "inactive"),
self._make_spec("mike", raw, "left", "active", "inactive"),
]
if self._stage_dialogue_role != "right" and low.startswith((
"context verified.",
"context verified!",
"tool calls this turn:",
)):
self._stage_dialogue_role = "right"
self._reannounce_after_break = False
return [
self._make_spec("norma", SHIPMUNK_TURN_CUE_TEXT, "narrator", "inactive", "curtain"),
self._make_spec("shipmunk", raw, "right", "inactive", "active"),
]
[[[REPLACE]]]
Target: imports/voice_synthesis.py
[[[SEARCH]]]
spoken_text = re.sub(r'\[([^\]]+)\]\([^\)]+\)', r'\1', spoken_text)
spoken_text = re.sub(r'\[[^\]]+\]', '', spoken_text)
spoken_text = re.sub(r'<[^>]+>', ' ', spoken_text)
[[[DIVIDER]]]
spoken_text = re.sub(r'\[([^\]]+)\]\([^\)]+\)', r'\1', spoken_text)
spoken_text = re.sub(r'\[[^\]]+\]', '', spoken_text)
spoken_text = re.sub(
r'<!--[\s\S]*?-->|</?[A-Za-z][A-Za-z0-9:-]*(?:[ \t]+(?:[^<>"\'`\n]|"[^"\n]*"|\'[^\'\n]*\')*)?[ \t]*/?>',
' ',
spoken_text,
)
[[[REPLACE]]]
Target: scripts/articles/sanitizer.py
[[[SEARCH]]]
# 2. Repair inverted bold/inline-code closures using flat character classes (zero backtracking)
seg = re.sub(r'`\*\*([^`*\n]+)`([^`*\n]+)\*\*`', r'`**\1`\2`**`', seg)
seg = re.sub(r'\*\*([^*`\n]*`[^`*\n]+)\*\*`', r'**\1`**', seg)
[[[DIVIDER]]]
# 2. Repair inverted bold/inline-code closures using flat character classes (zero backtracking)
seg = re.sub(r'`\*\*([^`*\n]+)`([^`*\n]+)\*\*`', r'`**\1`\2`**`', seg)
seg = re.sub(r'\*\*((?:[^*`\n]*`[^`*\n]+`)*[^*`\n]*`[^`*\n]+)\*\*`', r'**\1`**', seg)
[[[REPLACE]]]
Ignition: after committing in (nix) pipulate $, run ytreboot (i.e. .venv/bin/python scripts/articles/common.py --broadcast reboot) so remotes/honeybot/scripts/ syncs to honeybot:~/www/mikelev.in/scripts/ and stream.py restarts with a fresh playlist build that restores all 5 Shipmunk O'Theseus turns live on-air.
4. PROMPT
Verify all three straddles from LIVE COMMAND RECEIPTS (GEMINI_TURNS: 5, MURPHY_HEAD: norma, MURPHY_B1: shipmunk, SHANNON: shipmunk, TURN4_GOOD_NEWS: shipmunk, VS_SAFE: True, SAN_MULTI_CODE_OK: True, CLEANED_AI_TURNS == RECENT15_RAW_AI_TURNS, RUFF_RC: 0, HB_PARITY: True), and if ready to wrap this focused narrator-role fix as an aside or full episode, execute THE DISMOUNT banking the `<[^>]+>` multiline-wormhole rule into foo_files.py's 20-line RECEIPTS ledger and '# §' rule keys (or name the next target if continuing).
5. EXTERNAL DELIVERABLES
No external deliverables this turn.
MikeLev.in:
THE AI-EDIT METHOD
Same commands, run twice, one change between them. Where the readings differ is what the change did; the diff in the middle is the receipt.
1: BEFORE (PROBE):
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
GIT repo clean. Take BEFORE reading, make CHANGE, record AFTER diff.
(nix) pipulate $ .venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; raw = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md").read_text(); body = raw.split("---", 2)[2]; cleaned = cl.clean_markdown(body, label="probe", census=False); nar = stream.Narrator(); pairs = []; [pairs.extend((s["voice"], s["text"]) for s in nar.plan_utterances(re.sub(r"^\[\[HEADING:(.+)\]\]$", r"[[HEADING]]\1", ln.strip()))) for ln in cleaned.splitlines() if ln.strip() and not ln.strip().startswith(("[[PATRONUS:", "[[MEDIA:"))]; g_cnt = sum(1 for ln in cleaned.splitlines() if ln.strip().startswith("Gemini 4 Carbon High:")); v_of = lambda needle: next((v for v, t in pairs if needle in t), "MISSING"); print("GEMINI_TURNS:", g_cnt, "MURPHY_HEAD:", v_of("Murphy Incarnate, Hilchot"), "MURPHY_B1:", v_of("Why Murphy Incarnate"), "SHANNON:", v_of("The Dead Sea Scrolls"), "TURN4_GOOD_NEWS:", v_of("Good News First"))'
.venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); sys.path.insert(0, "scripts/articles"); import content_loader as cl, sanitizer; from imports.voice_synthesis import ChipVoiceSystem; vs_out = ChipVoiceSystem().sanitize_text("budget (<= 5 files) and 7231 -> 9110"); vs_ok = ("5 files" in vs_out and "7231" in vs_out); bt = chr(96); san_in = f"classic **{bt}Next 10{bt} / {bt}Prev 10**{bt} pages"; san_out = sanitizer.neutralize_inception_artifacts(san_in); san_ok = san_out.endswith(f"{bt}Prev 10{bt}** pages"); posts = sorted(pathlib.Path("/home/mike/repos/trimnoir/_posts").glob("2026-*.md"))[-15:]; bodies = [(p.name, re.sub(r"^[triple-backtick][^\n]*\n.*?^[triple-backtick][ \t]*$", "", p.read_text().split("---", 2)[-1], flags=re.M | re.S)) for p in posts]; raw_ai = sum(len(re.findall(r"(?m)^[ \t]*\*\*(?:Gemini|Claude)[^*\n]+\*\*:", b)) for _, b in bodies); cln_ai = sum(len(re.findall(r"(?m)^(?:Gemini|Claude)\b[^:\n]*:", cl.clean_markdown(b, label=n, census=False))) for n, b in bodies); print("VS_SAFE:", vs_ok, "SAN_MULTI_CODE_OK:", san_ok, "RECENT15_RAW_AI_TURNS:", raw_ai, "CLEANED_AI_TURNS:", cln_ai)'
.venv/bin/python -c 'import hashlib, os, pathlib, shutil, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; ruff_bin = shutil.which("ruff") or "ruff"; rf = sp.run([ruff_bin, "check", "remotes/honeybot/scripts/content_loader.py", "remotes/honeybot/scripts/terms.py", "remotes/honeybot/scripts/stream.py", "imports/voice_synthesis.py", "scripts/articles/sanitizer.py"], text=True, capture_output=True); names = ("content_loader.py", "terms.py", "stream.py"); loc = {n: hashlib.sha256((pathlib.Path("remotes/honeybot/scripts") / n).read_bytes()).hexdigest()[:12] for n in names}; rcmd = "sha256sum ~/www/mikelev.in/scripts/content_loader.py ~/www/mikelev.in/scripts/terms.py ~/www/mikelev.in/scripts/stream.py; ps -eo pid,etimes,args | rg stream.py | rg -v rg"; hb_lines = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=6", "honeybot", rcmd], env=env, text=True, capture_output=True).stdout.splitlines(); rem = {pathlib.Path(ln.split()[1]).name: ln.split()[0][:12] for ln in hb_lines if len(ln.split()) == 2 and "/" in ln.split()[1]}; pid_ln = [ln.strip() for ln in hb_lines if "stream.py" in ln and "sha256" not in ln and "/scripts/stream.py" in ln and len(ln.split()) >= 3]; print("RUFF_RC:", rf.returncode, "HB_PARITY:", loc == rem, "STREAM_PS:", pid_ln)'
GEMINI_TURNS: 3 MURPHY_HEAD: MISSING MURPHY_B1: MISSING SHANNON: mike TURN4_GOOD_NEWS: norma
VS_SAFE: False SAN_MULTI_CODE_OK: False RECENT15_RAW_AI_TURNS: 99 CLEANED_AI_TURNS: 102
RUFF_RC: 0 HB_PARITY: True STREAM_PS: ['2231408 13712 python3 -u /home/mike/www/mikelev.in/scripts/stream.py']
(nix) pipulate $
2: AFTER (NEXT CONTEXT):
# # Context 1
# context.txt
# /home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md
#
# # THE JEKYLL BLOG LIKE A HACKER (INVENTED SKILL.md & AGENTS.md FORMAT) PUBLISHING PIPELINE
# ~/repos/nixos/blogs.nix
# ~/.config/pipulate/blogs.json
# scripts/articles/publishizer.py
# scripts/articles/common.py
# scripts/articles/articleizer.py
# scripts/articles/link_injector.py
# scripts/articles/build_knowledge_graph.py
# scripts/articles/editing_prompt.txt
# scripts/articles/sanitizer.py
# scripts/articles/contextualizer.py
# scripts/articles/generate_hubs.py
# scripts/articles/generate_llms_txt.py
# scripts/articles/generate_post_nav.py
# assets/jekyll/common-packages.nix
# # Context 2
# context.txt
# # foo_files.py
# # /home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md
# remotes/honeybot/scripts/content_loader.py
# remotes/honeybot/scripts/stream.py
# remotes/honeybot/scripts/terms.py
# imports/voice_synthesis.py
# scripts/articles/sanitizer.py
# scripts/articles/common.py
# ! .venv/bin/python -c 'import pathlib, subprocess as sp; d = pathlib.Path("remotes/honeybot/scripts"); files = sorted(p.name for p in d.glob("*.py")); hits = sp.run(["rg", "-n", "-i", "speaker|gemini|mike-e|mikelev|narrator|voice", "remotes/honeybot/scripts", "imports/voice_synthesis.py"], text=True, capture_output=True).stdout.splitlines(); print("HB_SCRIPTS:", files); print("SPEAKER_HITS_N:", len(hits)); print("\n".join(hits[:45]))'
# ! .venv/bin/python -c 'import os, pathlib, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; p = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md"); raw = p.read_text(); cleaned = cl.clean_markdown(raw, label="probe", census=False); lines = [ln for ln in cleaned.splitlines() if ln.strip()]; idx = next((i for i, ln in enumerate(lines) if "Murphy Incarnate," in ln or "Wire Field Note and" in ln), 0); cl_fns = [k for k in dir(cl) if not k.startswith("__")]; st_fns = [k for k in dir(stream) if any(w in k.lower() for w in ("speak", "voice", "narrat", "chunk", "parse", "role", "mike", "gemini", "clean", "article"))]; print("CL_ATTRS:", cl_fns); print("STREAM_SPEAK_ATTRS:", st_fns); print("CLEANED_WINDOW:", lines[max(0, idx-6):idx+10])'
# ! .venv/bin/python -c 'import hashlib, os, pathlib, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; loc = {p.name: hashlib.sha256(p.read_bytes()).hexdigest()[:12] for p in sorted(pathlib.Path("remotes/honeybot/scripts").glob("*.py"))}; rcmd = "cat /tmp/honeybot_stage.json 2>/dev/null; echo; ps -eo pid,etimes,args | rg -e stream.py -e logs.py | rg -v rg; sha256sum ~/www/mikelev.in/scripts/*.py 2>/dev/null"; out = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=6", "honeybot", rcmd], env=env, text=True, capture_output=True).stdout.splitlines(); print("LOCAL_SHA12:", loc); print("HB_OUT:", out[:25])'
# Context 3
context.txt
foo_files.py
remotes/honeybot/scripts/content_loader.py
remotes/honeybot/scripts/stream.py
remotes/honeybot/scripts/terms.py
imports/voice_synthesis.py
scripts/articles/sanitizer.py
! .venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; raw = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md").read_text(); body = raw.split("---", 2)[2]; cleaned = cl.clean_markdown(body, label="probe", census=False); nar = stream.Narrator(); pairs = []; [pairs.extend((s["voice"], s["text"]) for s in nar.plan_utterances(re.sub(r"^\[\[HEADING:(.+)\]\]$", r"[[HEADING]]\1", ln.strip()))) for ln in cleaned.splitlines() if ln.strip() and not ln.strip().startswith(("[[PATRONUS:", "[[MEDIA:"))]; g_cnt = sum(1 for ln in cleaned.splitlines() if ln.strip().startswith("Gemini 4 Carbon High:")); v_of = lambda needle: next((v for v, t in pairs if needle in t), "MISSING"); print("GEMINI_TURNS:", g_cnt, "MURPHY_HEAD:", v_of("Murphy Incarnate, Hilchot"), "MURPHY_B1:", v_of("Why Murphy Incarnate"), "SHANNON:", v_of("The Dead Sea Scrolls"), "TURN4_GOOD_NEWS:", v_of("Good News First"))'
! .venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); sys.path.insert(0, "scripts/articles"); import content_loader as cl, sanitizer; from imports.voice_synthesis import ChipVoiceSystem; vs_out = ChipVoiceSystem().sanitize_text("budget (<= 5 files) and 7231 -> 9110"); vs_ok = ("5 files" in vs_out and "7231" in vs_out); bt = chr(96); san_in = f"classic **{bt}Next 10{bt} / {bt}Prev 10**{bt} pages"; san_out = sanitizer.neutralize_inception_artifacts(san_in); san_ok = san_out.endswith(f"{bt}Prev 10{bt}** pages"); posts = sorted(pathlib.Path("/home/mike/repos/trimnoir/_posts").glob("2026-*.md"))[-15:]; bodies = [(p.name, re.sub(r"^[triple-backtick][^\n]*\n.*?^[triple-backtick][ \t]*$", "", p.read_text().split("---", 2)[-1], flags=re.M | re.S)) for p in posts]; raw_ai = sum(len(re.findall(r"(?m)^[ \t]*\*\*(?:Gemini|Claude)[^*\n]+\*\*:", b)) for _, b in bodies); cln_ai = sum(len(re.findall(r"(?m)^(?:Gemini|Claude)\b[^:\n]*:", cl.clean_markdown(b, label=n, census=False))) for n, b in bodies); print("VS_SAFE:", vs_ok, "SAN_MULTI_CODE_OK:", san_ok, "RECENT15_RAW_AI_TURNS:", raw_ai, "CLEANED_AI_TURNS:", cln_ai)'
! .venv/bin/python -c 'import hashlib, os, pathlib, shutil, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; ruff_bin = shutil.which("ruff") or "ruff"; rf = sp.run([ruff_bin, "check", "remotes/honeybot/scripts/content_loader.py", "remotes/honeybot/scripts/terms.py", "remotes/honeybot/scripts/stream.py", "imports/voice_synthesis.py", "scripts/articles/sanitizer.py"], text=True, capture_output=True); names = ("content_loader.py", "terms.py", "stream.py"); loc = {n: hashlib.sha256((pathlib.Path("remotes/honeybot/scripts") / n).read_bytes()).hexdigest()[:12] for n in names}; rcmd = "sha256sum ~/www/mikelev.in/scripts/content_loader.py ~/www/mikelev.in/scripts/terms.py ~/www/mikelev.in/scripts/stream.py; ps -eo pid,etimes,args | rg stream.py | rg -v rg"; hb_lines = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=6", "honeybot", rcmd], env=env, text=True, capture_output=True).stdout.splitlines(); rem = {pathlib.Path(ln.split()[1]).name: ln.split()[0][:12] for ln in hb_lines if len(ln.split()) == 2 and "/" in ln.split()[1]}; pid_ln = [ln.strip() for ln in hb_lines if "stream.py" in ln and "sha256" not in ln and "/scripts/stream.py" in ln and len(ln.split()) >= 3]; print("RUFF_RC:", rf.returncode, "HB_PARITY:", loc == rem, "STREAM_PS:", pid_ln)'
3: CHANGE (PATCHES):
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
GIT repo clean. Take BEFORE reading, make CHANGE, record AFTER diff.
(nix) pipulate $ patch
(nix) pipulate $ app
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/content_loader.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/content_loader.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/content_loader.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/content_loader.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/content_loader.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/terms.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/terms.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/terms.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/stream.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/stream.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'imports/voice_synthesis.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'scripts/articles/sanitizer.py'.
(nix) pipulate $ d
diff --git a/imports/voice_synthesis.py b/imports/voice_synthesis.py
index 29a5369..4418154 100644
--- a/imports/voice_synthesis.py
+++ b/imports/voice_synthesis.py
@@ -686,7 +686,11 @@ class ChipVoiceSystem:
spoken_text = re.sub(r'^\s*\*?\*?(?:MikeLev\.in|Me)\*?\*?\s*:\s*', 'Mike: ', text, flags=re.IGNORECASE)
spoken_text = re.sub(r'\[([^\]]+)\]\([^\)]+\)', r'\1', spoken_text)
spoken_text = re.sub(r'\[[^\]]+\]', '', spoken_text)
- spoken_text = re.sub(r'<[^>]+>', ' ', spoken_text)
+ spoken_text = re.sub(
+ r'<!--[\s\S]*?-->|</?[A-Za-z][A-Za-z0-9:-]*(?:[ \t]+(?:[^<>"\'`\n]|"[^"\n]*"|\'[^\'\n]*\')*)?[ \t]*/?>',
+ ' ',
+ spoken_text,
+ )
spoken_text = re.sub(
r'\bhttps?://(?:www\.)?([A-Za-z0-9.-]+)/?(?=\s|[.,;!?)]|$)',
r'\1',
diff --git a/remotes/honeybot/scripts/content_loader.py b/remotes/honeybot/scripts/content_loader.py
index 05e269f..59628e0 100644
--- a/remotes/honeybot/scripts/content_loader.py
+++ b/remotes/honeybot/scripts/content_loader.py
@@ -1,3 +1,4 @@
+import html
import os
import re
import sys
@@ -698,6 +699,34 @@ def _simplify_filepaths_for_tts(text):
return _FILEPATH_RE.sub(_simplify_filepath_match, text)
+_INLINE_CODE_OR_HTML_TAG_RE = re.compile(
+ r'(`+(?:[^`\n]|\n(?!\s*\n))*`+)'
+ r'|<!--[\s\S]*?-->'
+ r'|<!DOCTYPE[ \t]+[^<>\n]+>'
+ r'|<(https?://[^>\s]+)>'
+ r'|</?[A-Za-z][A-Za-z0-9:-]*(?:(?:[ \t]+|\n[ \t]*(?=[A-Za-z_:][A-Za-z0-9_.:-]*\s*=))(?:[^<>"\'`\n]|"[^"\n]*"|\'[^\'\n]*\')*)?[ \t]*/?>',
+ re.IGNORECASE,
+)
+
+
+def _strip_html_tags_for_tts(text):
+ """Strip real HTML comments and tags outside inline code without eating '<=' or '<' across lines."""
+ def _repl(match):
+ if match.group(1) is not None:
+ return match.group(1)
+ if match.group(2) is not None:
+ return f" {match.group(2)} "
+ return " "
+
+ return _INLINE_CODE_OR_HTML_TAG_RE.sub(_repl, text)
+
+
+def _unwrap_inline_code_for_tts(match):
+ """Unwrap inline backticks and strip angle brackets from tag-name examples like `<div>`."""
+ inner = match.group(1)
+ return re.sub(r'</?([A-Za-z][A-Za-z0-9._:-]*(?:[ \t]+[A-Za-z0-9._:-]+)*)\s*/?>', r'\1', inner)
+
+
def clean_markdown(text, label=None, census=True):
"""Sanitizes Markdown for the Piper TTS engine.
@@ -847,8 +876,11 @@ def clean_markdown(text, label=None, census=True):
# Strip $$...$$ and single-dollar $...$ MathJax before backticks and underscores are removed
text = _strip_mathjax_for_tts(text)
- # Remove Inline Code
- text = re.sub(r'`([^`]+)`', r'\1', text)
+ # Strip HTML comments/tags outside inline code BEFORE unwrapping backticks so '<=' never eats across lines
+ text = _strip_html_tags_for_tts(text)
+ text = html.unescape(text)
+ # Remove Inline Code (unwrapping `<tag>` examples to `tag`)
+ text = re.sub(r'`((?:[^`\n]|\n(?!\s*\n))+)`', _unwrap_inline_code_for_tts, text)
# Remove Images
text = re.sub(r'!\[.*?\]\(.*?\)', '', text)
# Remove Links [text](url) -> text
@@ -915,15 +947,16 @@ def clean_markdown(text, label=None, census=True):
text = re.sub(r'https?://\S+', simplify_url, text)
# --------------------------------------
- # Remove HTML tags
- text = re.sub(r'<[^>]+>', '', text)
+ # Strip any HTML tags exposed inside unwrapped Markdown link labels without matching '<=' across lines
+ text = _strip_html_tags_for_tts(text)
# Tag Markdown ATX headings on their own paragraph boundaries so Norma Centroid reads every headline
text = re.sub(r'(?m)^[ \t]*#{1,6}[ \t]+([^\n]*?[^\n#\t ])[ \t#]*$', r'\n\nPP4HEADINGSTART \1 PP4HEADINGEND\n\n', text)
# Simplify slash-heavy file paths to filename.ext or "file path" first so basenames hit terms.py
text = _simplify_filepaths_for_tts(text)
# Abolish horizontal rules, table bars, box-drawing runs, and polish phonetic spellings
text = _apply_tts_pronunciations(text)
- # Remove Headers/Bold/Italic markers
+ # Remove leading blockquote markers and Headers/Bold/Italic markers
+ text = re.sub(r'(?m)^[ \t]*>[ \t]?', '', text)
text = re.sub(r'[*_#]', '', text)
text = re.sub(r'[ \t]*\n?[ \t]*(PP4HEADINGSTART[ \t]+.+?[ \t]+PP4HEADINGEND)[ \t]*\n?[ \t]*', r'\n\n\1\n\n', text)
diff --git a/remotes/honeybot/scripts/stream.py b/remotes/honeybot/scripts/stream.py
index 500b8e9..8f35f37 100644
--- a/remotes/honeybot/scripts/stream.py
+++ b/remotes/honeybot/scripts/stream.py
@@ -479,7 +479,7 @@ _AI_MODEL_MODIFIER_TOKEN = (
r"|[a-z][a-z0-9-]{1,15}(?=\s+(?:high|medium|low|pro|flash|ultra|nano|lite|mini|max|plus|thinking|preview|exp)\b))"
)
_AI_TURN_PREFIX_RE = re.compile(
- rf"^\s*(?:(?:gemini|claude|chat\s*g\s*p\s*t|chatgpt|openai|opus|sonnet|shipmunk)\b(?:\s+{_AI_MODEL_MODIFIER_TOKEN}){{0,4}}|a\s*i)\s*:\s*",
+ rf"^\s*(?:(?:gemini|claude|chat\s*g\s*p\s*t|chatgpt|openai|opus|sonnet|shipmunk|chip)\b(?:\s+{_AI_MODEL_MODIFIER_TOKEN}){{0,6}}|a\s*i)\s*:\s*",
re.IGNORECASE,
)
_HOST_TRANSIENT_RE = (
@@ -754,6 +754,17 @@ class Narrator(threading.Thread):
self._make_spec("norma", MIKE_TURN_CUE_TEXT, "narrator", "curtain", "inactive"),
self._make_spec("mike", raw, "left", "active", "inactive"),
]
+ if self._stage_dialogue_role != "right" and low.startswith((
+ "context verified.",
+ "context verified!",
+ "tool calls this turn:",
+ )):
+ self._stage_dialogue_role = "right"
+ self._reannounce_after_break = False
+ return [
+ self._make_spec("norma", SHIPMUNK_TURN_CUE_TEXT, "narrator", "inactive", "curtain"),
+ self._make_spec("shipmunk", raw, "right", "inactive", "active"),
+ ]
if self._stage_dialogue_role == "left":
out = []
if self._reannounce_after_break:
diff --git a/remotes/honeybot/scripts/terms.py b/remotes/honeybot/scripts/terms.py
index eaecf6e..9c3681f 100644
--- a/remotes/honeybot/scripts/terms.py
+++ b/remotes/honeybot/scripts/terms.py
@@ -111,6 +111,8 @@ REGEX_TERMS = (
(re.compile(r"\bVMs?\b(?=\s*\(\s*Virtual Machine)", re.IGNORECASE), "V M"),
(re.compile(r"\bdx/dy\b", re.IGNORECASE), "D X over D Y"),
(re.compile(r"\bdy/dx\b", re.IGNORECASE), "D Y over D X"),
+ (re.compile(r"(?<![<=-])<=(?!=)\s*(?=\$?\d|[A-Za-z])"), "less than or equal to "),
+ (re.compile(r"(?<![>=-])>=(?!=)\s*(?=\$?\d|[A-Za-z])"), "greater than or equal to "),
# Data transfer rates (58.64 MiB/s, 550 KiB/s, 100 MB/s, 1 GB/s)
(re.compile(r"(?<![\d.,])\b1\s*[kK][iI]?[bB]\s*/\s*s(?:ec(?:ond)?)?\b"), "1 kilobyte per second"),
(re.compile(r"\b(\d[\d,]*(?:\.\d+)?)\s*[kK][iI]?[bB]\s*/\s*s(?:ec(?:ond)?)?\b"), r"\1 kilobytes per second"),
@@ -315,14 +317,14 @@ EXACT_CASE_TERMS = (
# Multiline speaker-turn normalizers for Storytime Markdown articles
AI_SPEAKER_LABEL_PAT = (
- r"(?:(?:Gemini|Claude|ChatGPT|OpenAI|Opus|Sonnet|Shipmunk)\b"
+ r"(?:(?:Gemini|Claude|ChatGPT|OpenAI|Opus|Sonnet|Shipmunk|Chip)\b"
r"(?:[ \t]+(?:\d+(?:\.\d+)*"
r"|Argon|Carbon|Neon|Helium|Krypton|Xenon|Radon"
r"|Pro|Flash|Ultra|Nano|High|Medium|Low"
r"|Opus|Sonnet|Haiku|Code|User|Web|Bot"
r"|Thinking|Exp|Experimental|Preview|Lite|Mini|Max|Plus|Turbo"
r"|o\d+|O'Theseus"
- r"|[A-Za-z][A-Za-z0-9-]{1,15}(?=[ \t]+(?:High|Medium|Low|Pro|Flash|Ultra|Nano|Lite|Mini|Max|Plus|Thinking|Preview|Exp)\b))){0,4}"
+ r"|[A-Za-z][A-Za-z0-9-]{1,15}(?=[ \t]+(?:High|Medium|Low|Pro|Flash|Ultra|Nano|Lite|Mini|Max|Plus|Thinking|Preview|Exp)\b))){0,6}"
r"|AI)"
)
@@ -336,7 +338,7 @@ SPEAKER_TURN_RULES = (
),
(
re.compile(
- rf"(?m)^[ \t]*\*\*[ \t]*({AI_SPEAKER_LABEL_PAT})[ \t]*:?[ \t]*\*\*[ \t]*:?[ \t]*(?:\r?\n[ \t]*(?!\*\*[ \t]*(?:Gemini|Claude|ChatGPT|OpenAI|Opus|Sonnet|Shipmunk|AI|MikeLev\.in|Mike|Me)\b|PP4HEADINGSTART|#{1,6}[ \t]))*",
+ rf"(?m)^[ \t]*\*{1,2}[ \t]*({AI_SPEAKER_LABEL_PAT})[ \t]*:?[ \t]*\*{1,2}[ \t]*:?[ \t]*(?:\r?\n[ \t]*(?!\*{1,2}[ \t]*(?:Gemini|Claude|ChatGPT|OpenAI|Opus|Sonnet|Shipmunk|Chip|AI|MikeLev\.in|Mike|Me)\b|PP4HEADINGSTART|#{1,6}[ \t]))*",
re.IGNORECASE,
),
r"\n\n\1: ",
diff --git a/scripts/articles/sanitizer.py b/scripts/articles/sanitizer.py
index ce92c41..5728d14 100644
--- a/scripts/articles/sanitizer.py
+++ b/scripts/articles/sanitizer.py
@@ -152,7 +152,7 @@ def neutralize_inception_artifacts(content: str) -> str:
seg = parts[idx]
# 2. Repair inverted bold/inline-code closures using flat character classes (zero backtracking)
seg = re.sub(r'`\*\*([^`*\n]+)`([^`*\n]+)\*\*`', r'`**\1`\2`**`', seg)
- seg = re.sub(r'\*\*([^*`\n]*`[^`*\n]+)\*\*`', r'**\1`**', seg)
+ seg = re.sub(r'\*\*((?:[^*`\n]*`[^`*\n]+`)*[^*`\n]*`[^`*\n]+)\*\*`', r'**\1`**', seg)
# 3. Collapse hard-wrapped newlines inside single-backticked player-piano cue examples
seg = re.sub(
r'(?<!`)`(\s*(?:<!--\s*(?:pp4|weebo|media)\b[^`]{1,200}?-->|\[{3}\s*(?:weebo|media|image|video|patronus)\s*:[^`\]]{1,200}?\]{3})\s*)`(?!`)',
(nix) pipulate $ m
📝 Committing: chore: Remove HTML comment and tag stripping from voice synthesis
[main c291ea6] chore: Remove HTML comment and tag stripping from voice synthesis
5 files changed, 61 insertions(+), 11 deletions(-)
(nix) pipulate $ git push
Enumerating objects: 25, done.
Counting objects: 100% (25/25), done.
Delta compression using up to 48 threads
Compressing objects: 100% (12/12), done.
Writing objects: 100% (13/13), 2.16 KiB | 2.16 MiB/s, done.
Total 13 (delta 11), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (11/11), completed with 11 local objects.
To github.com:pipulate/pipulate.git
1470039..c291ea6 main -> main
(nix) pipulate $
Ignition: often “exit”, “nix develop”. Instructions may vary.
Ignition is ytreboot:
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
GIT repo clean. Take BEFORE reading, make CHANGE, record AFTER diff.
(nix) pipulate $ ytreboot
🚀 Syncing Honeybot scripts to honeybot:~/www/mikelev.in/scripts/...
🔄 Signaling Honeybot stream.py on honeybot for graceful SCHEDULED REBOOT announcement...
signaling stream.py pid=2231408 for graceful reboot announcement...
force-killing stubborn stream.py pid=2231408
✅ Stream watchdog relaunched fresh stream.py (pid=2311107 after 5s).
🔭 Started background 'ytwatch' daemon in tmux (polling every 30s).
• Watch live stream: ytwatch log (or `ytlog` — press `q` or `Ctrl+b d` to exit)
• Check status: ytwatch status
• Stop daemon: ytwatch stop
🎬 Started background 'ytbreaks' (`ytapp watch-breaks`) daemon in tmux.
• Check Optics watcher: ytbreaks (or `ytapp watch-log` — press `q` to detach)
• Stop Optics watcher : ytapp watch-stop
(nix) pipulate $
I have to double-check that that works even if it’s in the middle of a Pipulate
Prime hole-punch. That was the condition it was in when I just ran that and I’m
watching to see what happens. Yikes! I think it’s the problem that I thought it
was. freerdp in and see what you can do…
Oh, no need. It came back just fine. But still worth looking at and making sure it’s tight and as foolproof as 80/20-rule necessary. Truth is I’ll never do that kind of thing without being right next to it.
It’s going to be too long of a wait so I’m just going to submit this back and think of something else to look at too.
4: PROMPT:
Verify all three straddles from LIVE COMMAND RECEIPTS (GEMINI_TURNS: 5, MURPHY_HEAD: norma, MURPHY_B1: shipmunk, SHANNON: shipmunk, TURN4_GOOD_NEWS: shipmunk, VS_SAFE: True, SAN_MULTI_CODE_OK: True, CLEANED_AI_TURNS == RECENT15_RAW_AI_TURNS, RUFF_RC: 0, HB_PARITY: True), and if ready to wrap this focused narrator-role fix as an aside or full episode, execute THE DISMOUNT banking the <[^>]+> multiline-wormhole rule into foo_files.py’s 20-line RECEIPTS ledger and ‘# §’ rule keys (or name the next target if continuing).
5: DELIVERABLE:
What does “DONE” look like?
Done looks like better adherance to narration roles for the different Piper TTS voices. But while you’re in there see if when the voice switches if we can speed up activation, particularly for Shipmunk O’Theseus which often seems like it’s lagging. The other timing issue that bothers me is that sometimes things are said about the reports especially in preparation for taking the screenshot and then the lag before the report appears is so long it feels like something is wrong.
I’ll continue listening to make sure the resumption of speaker roles is correct after field note cutways and such.
Profiling Voice-Switch Latency and Report Popup Lag
Gemini 4 Carbon High: TL;DR: All three c291ea6 narrator-role straddles landed green and are live on honeybot (pid=2311107, GEMINI_TURNS: 3 -> 5, MURPHY_HEAD: MISSING -> norma, MURPHY_B1: MISSING -> shipmunk, VS_SAFE: True, SAN_MULTI_CODE_OK: True, CLEANED_AI_TURNS: 102 -> 104, HB_PARITY: True), while the three new broadcast-polish items in 5: DELIVERABLE—speeding up Shipmunk O’Theseus activation on voice switches, eliminating the lag between the screenshot cue and the station-break report window, and making ytreboot hole-punch-safe (force-killing stubborn stream.py)—require loading remotes/honeybot/scripts/forest.py, remotes/honeybot/scripts/score.py, imports/ascii_displays.py, scripts/articles/common.py, and scripts/ytstage.py (with foo_files.py temporarily omitted for one turn so the payload stays ~775 KB instead of ~1.1 MB).
1. Straddle Verification on Commit c291ea6
- Live Post Voice Plan (Receipt 1):
GEMINI_TURNSjumped3 -> 5(recovering both swallowed turns),MURPHY_HEADflippedMISSING -> norma, andMURPHY_B1flippedMISSING -> shipmunk. The two unchanged tokens (SHANNON: mikeandTURN4_GOOD_NEWS: norma) were selector collisions rather than voice-role bugs:v_of("The Dead Sea Scrolls")matched the first occurrence in the file (Mike’s own prompt above Turn 3), and"### Good News First"is an ATX subheading properly read by Norma Centroid (norma). Probe 1 below slices the post-heading voice arrays directly (pairs[mi:mi+5]andpairs[gi:gi+3]) to confirm the entire Turn 3 and Turn 4 bodies run asshipmunk. - Dual-Lane Sanitizer & 15-Post Audit (Receipt 2):
VS_SAFE(False -> True) andSAN_MULTI_CODE_OK(False -> True) both flipped green, andCLEANED_AI_TURNSrose102 -> 104(recovering the exact 2 eatenGemini 4 Carbon High:turns across the newest 15 posts). - Live Honeybot Ignition (Receipt 3):
RUFF_RC: 0,HB_PARITY: True, andstream.pyrelaunched aspid=2311107.
2. Missing Files & Root-Cause Hypotheses Already Visible in stream.py
Before patching, we need remotes/honeybot/scripts/forest.py, remotes/honeybot/scripts/score.py, imports/ascii_displays.py, scripts/articles/common.py, and scripts/ytstage.py in context.txt to confirm three concrete mechanisms already visible from the stream.py side:
- Why Shipmunk O’Theseus Lags on Voice Switches (
stream.py:830-842, 1486-1508):- On every speaker switch (
len(specs) == 2),prep_specs_raw()spawns two coldpiperprocesses sequentially—re-synthesizing the static string"Shipmunk O'Theseus!"(SHIPMUNK_TURN_CUE_TEXT) from a 60 MB ONNX load every time and synthesizing Shipmunk’s body before Norma can even open her mouth or lift the curtain. - Worse, because Shipmunk plays
en_US-amy-low.onnxat22,050 Hz(1.38xnative16,000 Hz),"Context verified."finishes playing in ~0.75s while the director thread is blocked insideprep_specs_raw()synthesizing the entire 800+ character**TL;DR**:paragraph in one lump—leaving dead air right after"Context verified.". Pre-caching the two static turn-cue.rawfiles and splitting long opening paragraphs on their first sentence boundary (or using warmpiperstreaming if Honeybot’spipersupports it) will let Shipmunk start speaking immediately while the remainder synthesizes behind sentence 1.
- On every speaker switch (
- Why Station-Break Reports Lag Behind the Screenshot Cue (
stream.py:1331-1360, 1765+forest.py+ascii_displays.py):- In
run_station_break(), cues run withpace_say=False(raw un-rendered strings queued onNarrator), andconjure_window("forest.py", ...)waits until theWINDOWqueue item pops to runprerender_station_report_ansi(mode)against livehoneybot.dband spawn/center Alacritty viashared_conjure_window—while{LIVE_REPORT:...}separately querieshoneybot.dba second time on theNarratorthread. Loadingforest.pyandascii_displays.pyalongside Probe 2’s live Honeybot benchmark will show both the cue order and exact SQLite/ANSI render cost.
- In
- Why
ytrebootHitforce-killing stubborn stream.pyMid-Hole-Punch (stream.py:114-120, 1410+common.py+ytstage.py):- During an
OPTICS_SLOThole-punch,ytstage.pyfreezesstream.pywithSIGSTOP. ATASK_STOPPEDprocess cannot handleSIGTERM/SIGUSR1until it receivesSIGCONT, socommon.py --broadcast reboottimed out waiting for the graceful reboot card and escalated toSIGKILL(skippingatexitoverlay/tunnel cleanup). Loadingcommon.pyandytstage.pylets us sendSIGCONT+ clean up any active stage hole-punch cleanly onytreboot.
- During an
1. PROBES
- Probe 1 (Direct Post-Heading Voice-Slice Confirmation & Shipmunk Paragraph-Length Census): Verifies the exact voice sequence across all 4 bullets under
### Murphy Incarnateand under### Good News First, and counts how many2-spec switches and>350-charshipmunkparagraphs stall lookahead synthesis in today’s post. - Probe 2 (Live Honeybot
piperCold-Start vs. Paragraph Benchmark &forest.pySQLite Report Timing): Runs an AST-checked Python benchmark onhoneybotto measurepiperCLI flags and synthesis wall-time for 3-word cues vs. 18-word first sentences vs. 130-wordTL;DRblocks, plus liveresolve_dynamic_report_speech()andprerender_station_report_ansi()timings againsthoneybot.db. - Probe 3 (
forest.pyStation-Bead Cue Order +ytstage.py/common.pySignal Census): Prints the exact(command, preview)sequence of each bead inforest.STATION_SEGMENTSand locates theSIGSTOP/SIGCONT/stubbornreboot lines acrossscripts/ytstage.pyandscripts/articles/common.py.
(nix) pipulate $
.venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; raw = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md").read_text(); body = raw.split("---", 2)[2]; cleaned = cl.clean_markdown(body, label="probe", census=False); nar = stream.Narrator(); batches = [nar.plan_utterances(re.sub(r"^\[\[HEADING:(.+)\]\]$", r"[[HEADING]]\1", ln.strip())) for ln in cleaned.splitlines() if ln.strip() and not ln.strip().startswith(("[[PATRONUS:", "[[MEDIA:"))]; pairs = [(s["voice"], s["text"]) for b in batches for s in b]; mi = next((i for i, (_, t) in enumerate(pairs) if "Murphy Incarnate, Hilchot" in t), -1); gi = next((i for i, (_, t) in enumerate(pairs) if "Good News First" in t), -1); ship_lens = [len(s["text"]) for b in batches for s in b if s["voice"] == "shipmunk"]; print("MURPHY_SLICE:", [v for v, _ in pairs[mi:mi+5]], "GOOD_NEWS_SLICE:", [v for v, _ in pairs[gi:gi+3]], "TWO_SPEC_N:", sum(1 for b in batches if len(b) == 2), "SHIP_MAX_C:", max(ship_lens), "SHIP_GT350:", sum(1 for n in ship_lens if n > 350))'
.venv/bin/python -c 'import ast, os, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; code = "import shutil, subprocess as sp, sys, time\nsdir, model, p_name, f_help, f_mod, f_raw, ov, bi, lr_ov, lr_bi = sys.argv[1:11]\nsys.path.insert(0, sdir)\nimport forest\np_bin = shutil.which(p_name) or p_name\nhr = sp.run([p_bin, f_help], text=True, capture_output=True)\nhtxt = (hr.stdout + hr.stderr).lower()\ndef bp(n_words):\n txt = (ov + chr(32)) * n_words\n t0 = time.perf_counter()\n r = sp.run([p_bin, f_mod, model, f_raw], input=txt.encode(), capture_output=True)\n return round(time.perf_counter() - t0, 3), len(r.stdout)\ndef bf(fn, arg):\n t0 = time.perf_counter()\n fn(arg)\n return round(time.perf_counter() - t0, 3)\nflags = [tok for tok in htxt.split() if tok.startswith(f_help[:2])][:14]\nprint(ov.upper(), bp(3), bp(18), bp(130), flags)\nprint(bi.upper(), bf(forest.resolve_dynamic_report_speech, chr(123) + lr_ov + chr(125)), bf(forest.prerender_station_report_ansi, ov), bf(forest.resolve_dynamic_report_speech, chr(123) + lr_bi + chr(125)), bf(forest.prerender_station_report_ansi, bi))\n"; ast.parse(code); rcmd = "PATH=/etc/profiles/per-user/mike/bin:/home/mike/.nix-profile/bin:/run/current-system/sw/bin:/usr/bin:/bin:$PATH python3 - /home/mike/www/mikelev.in/scripts /home/mike/.local/share/piper_voices/en_US-amy-low.onnx piper --help --model --output_raw overview bimodal LIVE_REPORT:overview LIVE_REPORT:bimodal"; res = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=8", "honeybot", rcmd], input=code, env=env, text=True, capture_output=True); print(res.stdout.strip() or res.stderr.strip())'
.venv/bin/python -c 'import pathlib, sys; sys.path.insert(0, "remotes/honeybot/scripts"); import forest; beads = [[(c, (str(v.get("label")) if isinstance(v, dict) else str(v)[:48])) for c, v in b] for b in forest.STATION_SEGMENTS]; yt_txt = pathlib.Path("scripts/ytstage.py").read_text(); cm_txt = pathlib.Path("scripts/articles/common.py").read_text(); yt_hits = [ln.strip() for ln in yt_txt.splitlines() if any(k in ln for k in ("SIGSTOP", "SIGCONT", "weebo_active", "optics_slot"))][:12]; cm_hits = [ln.strip() for ln in cm_txt.splitlines() if any(k in ln for k in ("stubborn", "graceful reboot", "weebo_active", "SIGCONT", "SIGTERM", "SIGUSR1"))][:12]; print("BEAD_COUNT:", len(beads)); [print("BEAD", i, b) for i, b in enumerate(beads)]; print("YTSTAGE_SIGS:", yt_hits); print("COMMON_REBOOT:", cm_hits)'
2. NEXT CONTEXT
context.txt
remotes/honeybot/scripts/stream.py
remotes/honeybot/scripts/forest.py
remotes/honeybot/scripts/score.py
imports/ascii_displays.py
scripts/articles/common.py
scripts/ytstage.py
! .venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; raw = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md").read_text(); body = raw.split("---", 2)[2]; cleaned = cl.clean_markdown(body, label="probe", census=False); nar = stream.Narrator(); batches = [nar.plan_utterances(re.sub(r"^\[\[HEADING:(.+)\]\]$", r"[[HEADING]]\1", ln.strip())) for ln in cleaned.splitlines() if ln.strip() and not ln.strip().startswith(("[[PATRONUS:", "[[MEDIA:"))]; pairs = [(s["voice"], s["text"]) for b in batches for s in b]; mi = next((i for i, (_, t) in enumerate(pairs) if "Murphy Incarnate, Hilchot" in t), -1); gi = next((i for i, (_, t) in enumerate(pairs) if "Good News First" in t), -1); ship_lens = [len(s["text"]) for b in batches for s in b if s["voice"] == "shipmunk"]; print("MURPHY_SLICE:", [v for v, _ in pairs[mi:mi+5]], "GOOD_NEWS_SLICE:", [v for v, _ in pairs[gi:gi+3]], "TWO_SPEC_N:", sum(1 for b in batches if len(b) == 2), "SHIP_MAX_C:", max(ship_lens), "SHIP_GT350:", sum(1 for n in ship_lens if n > 350))'
! .venv/bin/python -c 'import ast, os, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; code = "import shutil, subprocess as sp, sys, time\nsdir, model, p_name, f_help, f_mod, f_raw, ov, bi, lr_ov, lr_bi = sys.argv[1:11]\nsys.path.insert(0, sdir)\nimport forest\np_bin = shutil.which(p_name) or p_name\nhr = sp.run([p_bin, f_help], text=True, capture_output=True)\nhtxt = (hr.stdout + hr.stderr).lower()\ndef bp(n_words):\n txt = (ov + chr(32)) * n_words\n t0 = time.perf_counter()\n r = sp.run([p_bin, f_mod, model, f_raw], input=txt.encode(), capture_output=True)\n return round(time.perf_counter() - t0, 3), len(r.stdout)\ndef bf(fn, arg):\n t0 = time.perf_counter()\n fn(arg)\n return round(time.perf_counter() - t0, 3)\nflags = [tok for tok in htxt.split() if tok.startswith(f_help[:2])][:14]\nprint(ov.upper(), bp(3), bp(18), bp(130), flags)\nprint(bi.upper(), bf(forest.resolve_dynamic_report_speech, chr(123) + lr_ov + chr(125)), bf(forest.prerender_station_report_ansi, ov), bf(forest.resolve_dynamic_report_speech, chr(123) + lr_bi + chr(125)), bf(forest.prerender_station_report_ansi, bi))\n"; ast.parse(code); rcmd = "PATH=/etc/profiles/per-user/mike/bin:/home/mike/.nix-profile/bin:/run/current-system/sw/bin:/usr/bin:/bin:$PATH python3 - /home/mike/www/mikelev.in/scripts /home/mike/.local/share/piper_voices/en_US-amy-low.onnx piper --help --model --output_raw overview bimodal LIVE_REPORT:overview LIVE_REPORT:bimodal"; res = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=8", "honeybot", rcmd], input=code, env=env, text=True, capture_output=True); print(res.stdout.strip() or res.stderr.strip())'
! .venv/bin/python -c 'import pathlib, sys; sys.path.insert(0, "remotes/honeybot/scripts"); import forest; beads = [[(c, (str(v.get("label")) if isinstance(v, dict) else str(v)[:48])) for c, v in b] for b in forest.STATION_SEGMENTS]; yt_txt = pathlib.Path("scripts/ytstage.py").read_text(); cm_txt = pathlib.Path("scripts/articles/common.py").read_text(); yt_hits = [ln.strip() for ln in yt_txt.splitlines() if any(k in ln for k in ("SIGSTOP", "SIGCONT", "weebo_active", "optics_slot"))][:12]; cm_hits = [ln.strip() for ln in cm_txt.splitlines() if any(k in ln for k in ("stubborn", "graceful reboot", "weebo_active", "SIGCONT", "SIGTERM", "SIGUSR1"))][:12]; print("BEAD_COUNT:", len(beads)); [print("BEAD", i, b) for i, b in enumerate(beads)]; print("YTSTAGE_SIGS:", yt_hits); print("COMMON_REBOOT:", cm_hits)'
3. PATCHES
No repo patches required.
Ignition: no ignition required.
4. PROMPT
Use the LIVE COMMAND RECEIPTS and newly loaded remotes/honeybot/scripts/{forest.py,score.py,stream.py}, imports/ascii_displays.py, scripts/articles/common.py, and scripts/ytstage.py to execute one surgical chisel-strike (<= 5 files) that: (1) eliminates Shipmunk O'Theseus / speaker-switch activation lag (pre-caching static turn cues, streaming/fast-starting first sentences on long paragraphs, or keeping warm Piper workers as warranted by the Honeybot benchmark), (2) eliminates the station-break screenshot-cue-to-report-window popup lag (pre-rendering report ANSI & tightening cue choreography so the report appears right on cue), and (3) makes ytreboot 80/20 foolproof even mid-OPTICS_SLOT hole-punch (SIGCONT before SIGTERM/SIGUSR1 + clean overlay/sentinel release) while verifying speaker-role resumption across field-note cutaways.
5. EXTERNAL DELIVERABLES
No external deliverables this turn.
MikeLev.in:
THE AI-EDIT METHOD
Same commands, run twice, one change between them. Where the readings differ is what the change did; the diff in the middle is the receipt.
1: BEFORE (PROBE):
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
GIT repo clean. Take BEFORE reading, make CHANGE, record AFTER diff.
(nix) pipulate $ .venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; raw = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md").read_text(); body = raw.split("---", 2)[2]; cleaned = cl.clean_markdown(body, label="probe", census=False); nar = stream.Narrator(); batches = [nar.plan_utterances(re.sub(r"^\[\[HEADING:(.+)\]\]$", r"[[HEADING]]\1", ln.strip())) for ln in cleaned.splitlines() if ln.strip() and not ln.strip().startswith(("[[PATRONUS:", "[[MEDIA:"))]; pairs = [(s["voice"], s["text"]) for b in batches for s in b]; mi = next((i for i, (_, t) in enumerate(pairs) if "Murphy Incarnate, Hilchot" in t), -1); gi = next((i for i, (_, t) in enumerate(pairs) if "Good News First" in t), -1); ship_lens = [len(s["text"]) for b in batches for s in b if s["voice"] == "shipmunk"]; print("MURPHY_SLICE:", [v for v, _ in pairs[mi:mi+5]], "GOOD_NEWS_SLICE:", [v for v, _ in pairs[gi:gi+3]], "TWO_SPEC_N:", sum(1 for b in batches if len(b) == 2), "SHIP_MAX_C:", max(ship_lens), "SHIP_GT350:", sum(1 for n in ship_lens if n > 350))'
.venv/bin/python -c 'import ast, os, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; code = "import shutil, subprocess as sp, sys, time\nsdir, model, p_name, f_help, f_mod, f_raw, ov, bi, lr_ov, lr_bi = sys.argv[1:11]\nsys.path.insert(0, sdir)\nimport forest\np_bin = shutil.which(p_name) or p_name\nhr = sp.run([p_bin, f_help], text=True, capture_output=True)\nhtxt = (hr.stdout + hr.stderr).lower()\ndef bp(n_words):\n txt = (ov + chr(32)) * n_words\n t0 = time.perf_counter()\n r = sp.run([p_bin, f_mod, model, f_raw], input=txt.encode(), capture_output=True)\n return round(time.perf_counter() - t0, 3), len(r.stdout)\ndef bf(fn, arg):\n t0 = time.perf_counter()\n fn(arg)\n return round(time.perf_counter() - t0, 3)\nflags = [tok for tok in htxt.split() if tok.startswith(f_help[:2])][:14]\nprint(ov.upper(), bp(3), bp(18), bp(130), flags)\nprint(bi.upper(), bf(forest.resolve_dynamic_report_speech, chr(123) + lr_ov + chr(125)), bf(forest.prerender_station_report_ansi, ov), bf(forest.resolve_dynamic_report_speech, chr(123) + lr_bi + chr(125)), bf(forest.prerender_station_report_ansi, bi))\n"; ast.parse(code); rcmd = "PATH=/etc/profiles/per-user/mike/bin:/home/mike/.nix-profile/bin:/run/current-system/sw/bin:/usr/bin:/bin:$PATH python3 - /home/mike/www/mikelev.in/scripts /home/mike/.local/share/piper_voices/en_US-amy-low.onnx piper --help --model --output_raw overview bimodal LIVE_REPORT:overview LIVE_REPORT:bimodal"; res = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=8", "honeybot", rcmd], input=code, env=env, text=True, capture_output=True); print(res.stdout.strip() or res.stderr.strip())'
.venv/bin/python -c 'import pathlib, sys; sys.path.insert(0, "remotes/honeybot/scripts"); import forest; beads = [[(c, (str(v.get("label")) if isinstance(v, dict) else str(v)[:48])) for c, v in b] for b in forest.STATION_SEGMENTS]; yt_txt = pathlib.Path("scripts/ytstage.py").read_text(); cm_txt = pathlib.Path("scripts/articles/common.py").read_text(); yt_hits = [ln.strip() for ln in yt_txt.splitlines() if any(k in ln for k in ("SIGSTOP", "SIGCONT", "weebo_active", "optics_slot"))][:12]; cm_hits = [ln.strip() for ln in cm_txt.splitlines() if any(k in ln for k in ("stubborn", "graceful reboot", "weebo_active", "SIGCONT", "SIGTERM", "SIGUSR1"))][:12]; print("BEAD_COUNT:", len(beads)); [print("BEAD", i, b) for i, b in enumerate(beads)]; print("YTSTAGE_SIGS:", yt_hits); print("COMMON_REBOOT:", cm_hits)'
MURPHY_SLICE: ['norma', 'shipmunk', 'shipmunk', 'shipmunk', 'shipmunk'] GOOD_NEWS_SLICE: ['norma', 'shipmunk', 'shipmunk'] TWO_SPEC_N: 8 SHIP_MAX_C: 977 SHIP_GT350: 40
OVERVIEW (1.538, 72192) (1.852, 331776) (5.691, 2165248) ['--help', '--model', '--config', '--input-file,', '--input_file', '--output-file,', '--output_file', '--output-dir,', '--output_dir', '--output-raw,', '--output_raw', '--speaker', '--length-scale,', '--length_scale']
BIMODAL 1.158 1.222 9.28 79.109
BEAD_COUNT: 4
BEAD 0 [('CARD', 'RFC 9110\nMARKDOWN'), ('SAY', 'You are watching an unmasked HTTP origin wire — '), ('SAY', '{CURRENT_ARTICLE}'), ('CARD', 'YOUR SITE\nIS YOUR FEED'), ('WINDOW', 'forest.py:90:overview'), ('WAIT', '2'), ('SAY', 'This is the moment — take your screenshot right '), ('SAY', '{LIVE_REPORT:overview}'), ('SAY', 'Coming up on our next wire field note, we open 9'), ('WAIT', '25')]
BEAD 1 [('CARD', '911 LLM\nOPTICS'), ('OPTICS_SLOT', 'None'), ('SAY', '{CURRENT_ARTICLE}'), ('CARD', 'TRY SUNPUG.IO\n911 OPTICS')]
BEAD 2 [('CARD', 'DOM TRAPDOOR\nJS EXECS'), ('SAY', 'You are watching an unmasked HTTP origin wire — '), ('SAY', '{CURRENT_ARTICLE}'), ('CARD', 'YOUR SITE\nIS YOUR FEED'), ('WINDOW', 'forest.py:90:bimodal'), ('WAIT', '2'), ('SAY', 'This is the moment — take your screenshot right '), ('SAY', '{LIVE_REPORT:bimodal}'), ('SAY', 'When OpenAI and Meta already hydrate JavaScript '), ('WAIT', '25')]
BEAD 3 [('CARD', '911-ZERO &\n911-ONE'), ('SAY', 'You are watching an unmasked HTTP origin wire — '), ('SAY', '{CURRENT_ARTICLE}'), ('CARD', 'YOUR SITE\nIS YOUR FEED'), ('PATRONUS', 'None'), ('WAIT', '2'), ('SAY', 'Roy Fielding and Mark Nottingham built bimodal c'), ('SAY', 'Implementing that bridge at your CDN Edge alongs'), ('SAY', 'Inspect the plain-text Sun Pug installer safely '), ('WAIT', '8')]
YTSTAGE_SIGS: ['WEEBO_STAGE_PAUSE_FILE = "/tmp/honeybot_weebo_active"', 'OPTICS_SLOT_FILE = "/tmp/honeybot_optics_slot.json"', 'pathlib.Path("/tmp/honeybot_weebo_active").write_text(str(os.getpid()), encoding="utf-8")', 'os.kill(int(raw_lp), signal.SIGSTOP)', 'os.kill(pid, signal.SIGCONT)', 'os.kill(pid, signal.SIGSTOP)', 'pathlib.Path("/tmp/honeybot_weebo_active").unlink(missing_ok=True)', 'os.kill(int(pid), signal.SIGCONT)', 'os.kill(pid, signal.SIGCONT)', 'os.kill(pid, signal.SIGCONT)', 'pathlib.Path("/tmp/honeybot_weebo_active").write_text(str(proc.pid), encoding="utf-8")', 'pathlib.Path("/tmp/honeybot_weebo_active").write_text(str(proc.pid), encoding="utf-8")']
COMMON_REBOOT: ['echo " signaling stream.py pid=$old for graceful reboot announcement..."', 'echo " force-killing stubborn stream.py pid=$old"']
(nix) pipulate $
2: AFTER (NEXT CONTEXT):
# # Context 1
# context.txt
# /home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md
#
# # THE JEKYLL BLOG LIKE A HACKER (INVENTED SKILL.md & AGENTS.md FORMAT) PUBLISHING PIPELINE
# ~/repos/nixos/blogs.nix
# ~/.config/pipulate/blogs.json
# scripts/articles/publishizer.py
# scripts/articles/common.py
# scripts/articles/articleizer.py
# scripts/articles/link_injector.py
# scripts/articles/build_knowledge_graph.py
# scripts/articles/editing_prompt.txt
# scripts/articles/sanitizer.py
# scripts/articles/contextualizer.py
# scripts/articles/generate_hubs.py
# scripts/articles/generate_llms_txt.py
# scripts/articles/generate_post_nav.py
# assets/jekyll/common-packages.nix
# # Context 2
# context.txt
# # foo_files.py
# # /home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md
# remotes/honeybot/scripts/content_loader.py
# remotes/honeybot/scripts/stream.py
# remotes/honeybot/scripts/terms.py
# imports/voice_synthesis.py
# scripts/articles/sanitizer.py
# scripts/articles/common.py
# ! .venv/bin/python -c 'import pathlib, subprocess as sp; d = pathlib.Path("remotes/honeybot/scripts"); files = sorted(p.name for p in d.glob("*.py")); hits = sp.run(["rg", "-n", "-i", "speaker|gemini|mike-e|mikelev|narrator|voice", "remotes/honeybot/scripts", "imports/voice_synthesis.py"], text=True, capture_output=True).stdout.splitlines(); print("HB_SCRIPTS:", files); print("SPEAKER_HITS_N:", len(hits)); print("\n".join(hits[:45]))'
# ! .venv/bin/python -c 'import os, pathlib, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; p = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md"); raw = p.read_text(); cleaned = cl.clean_markdown(raw, label="probe", census=False); lines = [ln for ln in cleaned.splitlines() if ln.strip()]; idx = next((i for i, ln in enumerate(lines) if "Murphy Incarnate," in ln or "Wire Field Note and" in ln), 0); cl_fns = [k for k in dir(cl) if not k.startswith("__")]; st_fns = [k for k in dir(stream) if any(w in k.lower() for w in ("speak", "voice", "narrat", "chunk", "parse", "role", "mike", "gemini", "clean", "article"))]; print("CL_ATTRS:", cl_fns); print("STREAM_SPEAK_ATTRS:", st_fns); print("CLEANED_WINDOW:", lines[max(0, idx-6):idx+10])'
# ! .venv/bin/python -c 'import hashlib, os, pathlib, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; loc = {p.name: hashlib.sha256(p.read_bytes()).hexdigest()[:12] for p in sorted(pathlib.Path("remotes/honeybot/scripts").glob("*.py"))}; rcmd = "cat /tmp/honeybot_stage.json 2>/dev/null; echo; ps -eo pid,etimes,args | rg -e stream.py -e logs.py | rg -v rg; sha256sum ~/www/mikelev.in/scripts/*.py 2>/dev/null"; out = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=6", "honeybot", rcmd], env=env, text=True, capture_output=True).stdout.splitlines(); print("LOCAL_SHA12:", loc); print("HB_OUT:", out[:25])'
# # Context 3
# context.txt
# foo_files.py
# remotes/honeybot/scripts/content_loader.py
# remotes/honeybot/scripts/stream.py
# remotes/honeybot/scripts/terms.py
# imports/voice_synthesis.py
# scripts/articles/sanitizer.py
# ! .venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; raw = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md").read_text(); body = raw.split("---", 2)[2]; cleaned = cl.clean_markdown(body, label="probe", census=False); nar = stream.Narrator(); pairs = []; [pairs.extend((s["voice"], s["text"]) for s in nar.plan_utterances(re.sub(r"^\[\[HEADING:(.+)\]\]$", r"[[HEADING]]\1", ln.strip()))) for ln in cleaned.splitlines() if ln.strip() and not ln.strip().startswith(("[[PATRONUS:", "[[MEDIA:"))]; g_cnt = sum(1 for ln in cleaned.splitlines() if ln.strip().startswith("Gemini 4 Carbon High:")); v_of = lambda needle: next((v for v, t in pairs if needle in t), "MISSING"); print("GEMINI_TURNS:", g_cnt, "MURPHY_HEAD:", v_of("Murphy Incarnate, Hilchot"), "MURPHY_B1:", v_of("Why Murphy Incarnate"), "SHANNON:", v_of("The Dead Sea Scrolls"), "TURN4_GOOD_NEWS:", v_of("Good News First"))'
# ! .venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); sys.path.insert(0, "scripts/articles"); import content_loader as cl, sanitizer; from imports.voice_synthesis import ChipVoiceSystem; vs_out = ChipVoiceSystem().sanitize_text("budget (<= 5 files) and 7231 -> 9110"); vs_ok = ("5 files" in vs_out and "7231" in vs_out); bt = chr(96); san_in = f"classic **{bt}Next 10{bt} / {bt}Prev 10**{bt} pages"; san_out = sanitizer.neutralize_inception_artifacts(san_in); san_ok = san_out.endswith(f"{bt}Prev 10{bt}** pages"); posts = sorted(pathlib.Path("/home/mike/repos/trimnoir/_posts").glob("2026-*.md"))[-15:]; bodies = [(p.name, re.sub(r"^[triple-backtick][^\n]*\n.*?^[triple-backtick][ \t]*$", "", p.read_text().split("---", 2)[-1], flags=re.M | re.S)) for p in posts]; raw_ai = sum(len(re.findall(r"(?m)^[ \t]*\*\*(?:Gemini|Claude)[^*\n]+\*\*:", b)) for _, b in bodies); cln_ai = sum(len(re.findall(r"(?m)^(?:Gemini|Claude)\b[^:\n]*:", cl.clean_markdown(b, label=n, census=False))) for n, b in bodies); print("VS_SAFE:", vs_ok, "SAN_MULTI_CODE_OK:", san_ok, "RECENT15_RAW_AI_TURNS:", raw_ai, "CLEANED_AI_TURNS:", cln_ai)'
# ! .venv/bin/python -c 'import hashlib, os, pathlib, shutil, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; ruff_bin = shutil.which("ruff") or "ruff"; rf = sp.run([ruff_bin, "check", "remotes/honeybot/scripts/content_loader.py", "remotes/honeybot/scripts/terms.py", "remotes/honeybot/scripts/stream.py", "imports/voice_synthesis.py", "scripts/articles/sanitizer.py"], text=True, capture_output=True); names = ("content_loader.py", "terms.py", "stream.py"); loc = {n: hashlib.sha256((pathlib.Path("remotes/honeybot/scripts") / n).read_bytes()).hexdigest()[:12] for n in names}; rcmd = "sha256sum ~/www/mikelev.in/scripts/content_loader.py ~/www/mikelev.in/scripts/terms.py ~/www/mikelev.in/scripts/stream.py; ps -eo pid,etimes,args | rg stream.py | rg -v rg"; hb_lines = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=6", "honeybot", rcmd], env=env, text=True, capture_output=True).stdout.splitlines(); rem = {pathlib.Path(ln.split()[1]).name: ln.split()[0][:12] for ln in hb_lines if len(ln.split()) == 2 and "/" in ln.split()[1]}; pid_ln = [ln.strip() for ln in hb_lines if "stream.py" in ln and "sha256" not in ln and "/scripts/stream.py" in ln and len(ln.split()) >= 3]; print("RUFF_RC:", rf.returncode, "HB_PARITY:", loc == rem, "STREAM_PS:", pid_ln)'
# Context 4
context.txt
remotes/honeybot/scripts/stream.py
remotes/honeybot/scripts/forest.py
remotes/honeybot/scripts/score.py
imports/ascii_displays.py
scripts/articles/common.py
scripts/ytstage.py
! .venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; raw = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md").read_text(); body = raw.split("---", 2)[2]; cleaned = cl.clean_markdown(body, label="probe", census=False); nar = stream.Narrator(); batches = [nar.plan_utterances(re.sub(r"^\[\[HEADING:(.+)\]\]$", r"[[HEADING]]\1", ln.strip())) for ln in cleaned.splitlines() if ln.strip() and not ln.strip().startswith(("[[PATRONUS:", "[[MEDIA:"))]; pairs = [(s["voice"], s["text"]) for b in batches for s in b]; mi = next((i for i, (_, t) in enumerate(pairs) if "Murphy Incarnate, Hilchot" in t), -1); gi = next((i for i, (_, t) in enumerate(pairs) if "Good News First" in t), -1); ship_lens = [len(s["text"]) for b in batches for s in b if s["voice"] == "shipmunk"]; print("MURPHY_SLICE:", [v for v, _ in pairs[mi:mi+5]], "GOOD_NEWS_SLICE:", [v for v, _ in pairs[gi:gi+3]], "TWO_SPEC_N:", sum(1 for b in batches if len(b) == 2), "SHIP_MAX_C:", max(ship_lens), "SHIP_GT350:", sum(1 for n in ship_lens if n > 350))'
! .venv/bin/python -c 'import ast, os, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; code = "import shutil, subprocess as sp, sys, time\nsdir, model, p_name, f_help, f_mod, f_raw, ov, bi, lr_ov, lr_bi = sys.argv[1:11]\nsys.path.insert(0, sdir)\nimport forest\np_bin = shutil.which(p_name) or p_name\nhr = sp.run([p_bin, f_help], text=True, capture_output=True)\nhtxt = (hr.stdout + hr.stderr).lower()\ndef bp(n_words):\n txt = (ov + chr(32)) * n_words\n t0 = time.perf_counter()\n r = sp.run([p_bin, f_mod, model, f_raw], input=txt.encode(), capture_output=True)\n return round(time.perf_counter() - t0, 3), len(r.stdout)\ndef bf(fn, arg):\n t0 = time.perf_counter()\n fn(arg)\n return round(time.perf_counter() - t0, 3)\nflags = [tok for tok in htxt.split() if tok.startswith(f_help[:2])][:14]\nprint(ov.upper(), bp(3), bp(18), bp(130), flags)\nprint(bi.upper(), bf(forest.resolve_dynamic_report_speech, chr(123) + lr_ov + chr(125)), bf(forest.prerender_station_report_ansi, ov), bf(forest.resolve_dynamic_report_speech, chr(123) + lr_bi + chr(125)), bf(forest.prerender_station_report_ansi, bi))\n"; ast.parse(code); rcmd = "PATH=/etc/profiles/per-user/mike/bin:/home/mike/.nix-profile/bin:/run/current-system/sw/bin:/usr/bin:/bin:$PATH python3 - /home/mike/www/mikelev.in/scripts /home/mike/.local/share/piper_voices/en_US-amy-low.onnx piper --help --model --output_raw overview bimodal LIVE_REPORT:overview LIVE_REPORT:bimodal"; res = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=8", "honeybot", rcmd], input=code, env=env, text=True, capture_output=True); print(res.stdout.strip() or res.stderr.strip())'
! .venv/bin/python -c 'import pathlib, sys; sys.path.insert(0, "remotes/honeybot/scripts"); import forest; beads = [[(c, (str(v.get("label")) if isinstance(v, dict) else str(v)[:48])) for c, v in b] for b in forest.STATION_SEGMENTS]; yt_txt = pathlib.Path("scripts/ytstage.py").read_text(); cm_txt = pathlib.Path("scripts/articles/common.py").read_text(); yt_hits = [ln.strip() for ln in yt_txt.splitlines() if any(k in ln for k in ("SIGSTOP", "SIGCONT", "weebo_active", "optics_slot"))][:12]; cm_hits = [ln.strip() for ln in cm_txt.splitlines() if any(k in ln for k in ("stubborn", "graceful reboot", "weebo_active", "SIGCONT", "SIGTERM", "SIGUSR1"))][:12]; print("BEAD_COUNT:", len(beads)); [print("BEAD", i, b) for i, b in enumerate(beads)]; print("YTSTAGE_SIGS:", yt_hits); print("COMMON_REBOOT:", cm_hits)'
3: CHANGE (PATCHES):
None this turn.
4: PROMPT:
Use the LIVE COMMAND RECEIPTS and newly loaded remotes/honeybot/scripts/{forest.py,score.py,stream.py}, imports/ascii_displays.py, scripts/articles/common.py, and scripts/ytstage.py to execute one surgical chisel-strike (<= 5 files) that: (1) eliminates Shipmunk O’Theseus / speaker-switch activation lag (pre-caching static turn cues, streaming/fast-starting first sentences on long paragraphs, or keeping warm Piper workers as warranted by the Honeybot benchmark), (2) eliminates the station-break screenshot-cue-to-report-window popup lag (pre-rendering report ANSI & tightening cue choreography so the report appears right on cue), and (3) makes ytreboot 80/20 foolproof even mid-OPTICS_SLOT hole-punch (SIGCONT before SIGTERM/SIGUSR1 + clean overlay/sentinel release) while verifying speaker-role resumption across field-note cutaways.
5: DELIVERABLE:
What does “DONE” look like?
Not only the correct speaker roles but more immediate highlighting of the
speaker, hopefully. Unknown, we’ll see. Oh and maybe more reliable ytreboot
too. Again, unknown but we’ll see – some exploratory stuff here.
You failed twice on this request. I hit retry twice and there wasn’t even enough
output for me to show you how far you got. You know, I think you’re totally
blowing off that don’t boil the ocean instruction in apply.py. You know I put
it there for situations just like this.
Caching Speaker Cues and Guarding SQLite Telemetry Joins
Gemini 4 Carbon High: Context verified.
TL;DR: The three LIVE COMMAND RECEIPTS isolated the exact bottlenecks behind all three broadcast-polish items, and we fix all three in a bounded 4-file chisel-strike (imports/ascii_displays.py, remotes/honeybot/scripts/forest.py, remotes/honeybot/scripts/stream.py, scripts/articles/common.py):
- Instant Speaker Highlighting & Fast-Start
Shipmunk O'TheseusSwitches (stream.py):- Receipt 1 + Receipt 2 showed
piper --output_rawpays a 1.35s–1.54s cold start on every 3-word static turn cue ("Shipmunk O'Theseus!"/"Mike E, the Apprentice.") and 5.69s on 977-char paragraphs (40paragraphs>350chars in today’s post), stalling lookahead behind"Context verified."(~1.5s audio at22,050 Hz). Narratornow pre-caches static turn-cue.rawfiles on/tmp(0.000sturn-switch cue prep, pre-warmed during the existing 5s boot grace), splits the opening clause/sentence of>220-charmike/shipmunkspecs so voice-switch audio starts in~1.8sinstead of5.7s, and pipelines per-spec synthesis behind active ALSA playback so stage portraits flip immediately.
- Receipt 1 + Receipt 2 showed
- Eliminating the 16s–79s Station-Break Report Popup Lag (
forest.py,stream.py,ascii_displays.py):- Receipt 2 caught
prerender_station_report_ansi('bimodal')taking 16.26s to 79.11s (SQLite driving nested full-tabletelemetryscans off prefixLIKE 'Mozilla%'/'34.%') whileNarrator.run()spawnedconjure_windowon a background thread withtime.sleep(0.5)—speaking"This is the moment — take your screenshot right now!"14–76 seconds before the chart appeared, and then running those same SQLite queries a second time (9.28s–16.35s) insideresolve_dynamic_report_speech(). forest.pynow checks_read_report_speech_snapshot()before touching SQLite (< 1 ms), collapsesbimodal’sjs_confirm.gifqueries into onepath_id IN (...)pass with unary+guards (~1.4s), and exposesensure_station_report_prerendered()under a render lock (_REPORT_META_TTL_SEC = 240.0).run_station_break()pre-warms the bead’s report during the ~85s intro cards (after draining any in-flight article sentence instead offlush_queue()clippingspec[1]), andNarratorwaits onconjure_window(..., ready_event=win_ready)so the screenshot line never fires before the Alacritty report window is mapped and centered on:10.0.
- Receipt 2 caught
- Hole-Punch-Safe
ytreboot(common.py+stream.py):- Receipt 3 confirmed
reboot_honeybot_stream()sentSIGTERMwithoutSIGCONTwhileytstage.pyheldstream.pyinSIGSTOP.ytrebootnow stopsytbreaks+ closes any open15001tunnel on Prime first, clears/tmp/honeybot_weebo_active,/tmp/honeybot_optics_slot.json,/tmp/honeybot_ytstage_paused.json, and stage overlays on Honeybot, and sendsSIGCONTbeforeSIGTERMsostream.pywakes cleanly to playSCHEDULED REBOOTinstead of hittingforce-killing stubborn stream.py.
- Receipt 3 confirmed
1. PROBES
- Probe 1 (STRADDLE on Fast-Start
ShipmunkSpec Sizing & Cutaway Resumption): VerifiesMURPHY_OK: TrueandGOOD_OK: True, predictsFIRST_SHIP_MAX_Cdropping from977before patching to<= 260after patching, and confirms post-cutaway heading + re-announcement order (RESUME_VOICES: ['norma', 'norma', 'shipmunk']). - Probe 2 (STRADDLE on Live Honeybot Cached Turn-Cue,
bimodalRender, & Snapshot Speedup): Predictscue2dropping from~1.4sto< 0.005s,bi_rendropping from16s–79sto~1.5s,bi_spkdropping from9s–16sto< 0.005s, andbi_warmflipping from-1.0to< 0.005safterytreboot. - Probe 3 (STRADDLE/GATE on Hole-Punch
SIGCONTReboot Guard,ready_event, Ruff,test_forest.py, & Honeybot Parity): PredictsREBOOT_SIGCONT_OKandWIN_READY_OKflippingFalse -> True,RUFF_RC: 0,TEST_FOREST_RC: 0, andHB_PARITY: Trueon a freshstream.pyPID.
(nix) pipulate $
.venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; raw = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md").read_text(); body = raw.split("---", 2)[2]; cleaned = cl.clean_markdown(body, label="probe", census=False); nar = stream.Narrator(); batches = [nar.plan_utterances(re.sub(r"^\[\[HEADING:(.+)\]\]$", r"[[HEADING]]\1", ln.strip())) for ln in cleaned.splitlines() if ln.strip() and not ln.strip().startswith(("[[PATRONUS:", "[[MEDIA:"))]; pairs = [(s["voice"], s["text"]) for b in batches for s in b]; mi = next((i for i, (_, t) in enumerate(pairs) if "Murphy Incarnate, Hilchot" in t), -1); gi = next((i for i, (_, t) in enumerate(pairs) if "Good News First" in t), -1); first_ship = [next(len(s["text"]) for s in b if s["voice"] == "shipmunk") for b in batches if any(s["voice"] == "shipmunk" for s in b)]; nar2 = stream.Narrator(); nar2._stage_dialogue_role = "right"; nar2._reannounce_after_break = True; res_v = [s["voice"] for ln in ("[[HEADING]] Good News First", "First bullet after field note.") for s in nar2.plan_utterances(ln)]; print("MURPHY_OK:", [v for v, _ in pairs[mi:mi+5]] == ["norma", "shipmunk", "shipmunk", "shipmunk", "shipmunk"], "GOOD_OK:", [v for v, _ in pairs[gi:gi+3]] == ["norma", "shipmunk", "shipmunk"], "FIRST_SHIP_MAX_C:", max(first_ship), "RESUME_VOICES:", res_v)'
.venv/bin/python -c 'import ast, os, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; code = "import sys, time\nsdir, v_norma, raw_tag, bi, lr_bi, fn_name = sys.argv[1:7]\nsys.path.insert(0, sdir)\nimport forest, stream\nnar = stream.Narrator()\nnar._synth_raw_with_voice(stream.SHIPMUNK_TURN_CUE_TEXT, v_norma)\nt0 = time.perf_counter()\nrp, _ = nar._synth_raw_with_voice(stream.SHIPMUNK_TURN_CUE_TEXT, v_norma)\ncue2 = round(time.perf_counter() - t0, 4)\nif rp:\n nar._cleanup_item((raw_tag, rp))\nt1 = time.perf_counter()\nforest.prerender_station_report_ansi(bi)\nbi_ren = round(time.perf_counter() - t1, 3)\nt2 = time.perf_counter()\nforest.resolve_dynamic_report_speech(chr(123) + lr_bi + chr(125))\nbi_spk = round(time.perf_counter() - t2, 4)\nbi_warm = -1.0\nif hasattr(forest, fn_name):\n t3 = time.perf_counter()\n getattr(forest, fn_name)(bi)\n bi_warm = round(time.perf_counter() - t3, 4)\nprint(bi.upper(), cue2, bi_ren, bi_spk, bi_warm)\n"; ast.parse(code); rcmd = "PATH=/etc/profiles/per-user/mike/bin:/home/mike/.nix-profile/bin:/run/current-system/sw/bin:/usr/bin:/bin:$PATH python3 - /home/mike/www/mikelev.in/scripts norma RAW bimodal LIVE_REPORT:bimodal ensure_station_report_prerendered"; res = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=8", "honeybot", rcmd], input=code, env=env, text=True, capture_output=True); print(res.stdout.strip() or res.stderr.strip())'
.venv/bin/python -c 'import hashlib, inspect, os, pathlib, shutil, subprocess as sp, sys; env = {**os.environ, "LD_LIBRARY_PATH": ""}; sys.path.insert(0, "scripts/articles"); import common; from imports import ascii_displays as ad; rb_src = inspect.getsource(common.reboot_honeybot_stream); sigcont_ok = ("kill -CONT" in rb_src and "honeybot_weebo_active" in rb_src and "honeybot_optics_slot.json" in rb_src); ready_ok = ("ready_event" in inspect.signature(ad.conjure_window).parameters); ruff_bin = shutil.which("ruff") or "ruff"; rf = sp.run([ruff_bin, "check", "imports/ascii_displays.py", "remotes/honeybot/scripts/forest.py", "remotes/honeybot/scripts/stream.py", "scripts/articles/common.py"], text=True, capture_output=True); tf = sp.run([sys.executable, "remotes/honeybot/scripts/test_forest.py"], env={**os.environ, "HONEYBOT_NO_AUDIO": "1"}, text=True, capture_output=True); loc = {p.name: hashlib.sha256(p.read_bytes()).hexdigest()[:12] for p in (pathlib.Path("remotes/honeybot/scripts/stream.py"), pathlib.Path("remotes/honeybot/scripts/forest.py"), pathlib.Path("imports/ascii_displays.py"))}; rcmd = "sha256sum ~/www/mikelev.in/scripts/stream.py ~/www/mikelev.in/scripts/forest.py ~/www/mikelev.in/imports/ascii_displays.py; ps -eo pid,etimes,args | rg stream.py | rg -v rg"; hb = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=6", "honeybot", rcmd], env=env, text=True, capture_output=True).stdout.splitlines(); rem = {pathlib.Path(ln.split()[1]).name: ln.split()[0][:12] for ln in hb if len(ln.split()) == 2 and "/" in ln.split()[1]}; pid_ln = [ln.strip() for ln in hb if "/scripts/stream.py" in ln and "sha256" not in ln and len(ln.split()) >= 3]; print("REBOOT_SIGCONT_OK:", sigcont_ok, "WIN_READY_OK:", ready_ok, "RUFF_RC:", rf.returncode, "TEST_FOREST_RC:", tf.returncode, "HB_PARITY:", loc == rem, "STREAM_PS:", pid_ln)'
2. NEXT CONTEXT
context.txt
foo_files.py
remotes/honeybot/scripts/stream.py
remotes/honeybot/scripts/forest.py
imports/ascii_displays.py
! .venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; raw = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md").read_text(); body = raw.split("---", 2)[2]; cleaned = cl.clean_markdown(body, label="probe", census=False); nar = stream.Narrator(); batches = [nar.plan_utterances(re.sub(r"^\[\[HEADING:(.+)\]\]$", r"[[HEADING]]\1", ln.strip())) for ln in cleaned.splitlines() if ln.strip() and not ln.strip().startswith(("[[PATRONUS:", "[[MEDIA:"))]; pairs = [(s["voice"], s["text"]) for b in batches for s in b]; mi = next((i for i, (_, t) in enumerate(pairs) if "Murphy Incarnate, Hilchot" in t), -1); gi = next((i for i, (_, t) in enumerate(pairs) if "Good News First" in t), -1); first_ship = [next(len(s["text"]) for s in b if s["voice"] == "shipmunk") for b in batches if any(s["voice"] == "shipmunk" for s in b)]; nar2 = stream.Narrator(); nar2._stage_dialogue_role = "right"; nar2._reannounce_after_break = True; res_v = [s["voice"] for ln in ("[[HEADING]] Good News First", "First bullet after field note.") for s in nar2.plan_utterances(ln)]; print("MURPHY_OK:", [v for v, _ in pairs[mi:mi+5]] == ["norma", "shipmunk", "shipmunk", "shipmunk", "shipmunk"], "GOOD_OK:", [v for v, _ in pairs[gi:gi+3]] == ["norma", "shipmunk", "shipmunk"], "FIRST_SHIP_MAX_C:", max(first_ship), "RESUME_VOICES:", res_v)'
! .venv/bin/python -c 'import ast, os, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; code = "import sys, time\nsdir, v_norma, raw_tag, bi, lr_bi, fn_name = sys.argv[1:7]\nsys.path.insert(0, sdir)\nimport forest, stream\nnar = stream.Narrator()\nnar._synth_raw_with_voice(stream.SHIPMUNK_TURN_CUE_TEXT, v_norma)\nt0 = time.perf_counter()\nrp, _ = nar._synth_raw_with_voice(stream.SHIPMUNK_TURN_CUE_TEXT, v_norma)\ncue2 = round(time.perf_counter() - t0, 4)\nif rp:\n nar._cleanup_item((raw_tag, rp))\nt1 = time.perf_counter()\nforest.prerender_station_report_ansi(bi)\nbi_ren = round(time.perf_counter() - t1, 3)\nt2 = time.perf_counter()\nforest.resolve_dynamic_report_speech(chr(123) + lr_bi + chr(125))\nbi_spk = round(time.perf_counter() - t2, 4)\nbi_warm = -1.0\nif hasattr(forest, fn_name):\n t3 = time.perf_counter()\n getattr(forest, fn_name)(bi)\n bi_warm = round(time.perf_counter() - t3, 4)\nprint(bi.upper(), cue2, bi_ren, bi_spk, bi_warm)\n"; ast.parse(code); rcmd = "PATH=/etc/profiles/per-user/mike/bin:/home/mike/.nix-profile/bin:/run/current-system/sw/bin:/usr/bin:/bin:$PATH python3 - /home/mike/www/mikelev.in/scripts norma RAW bimodal LIVE_REPORT:bimodal ensure_station_report_prerendered"; res = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=8", "honeybot", rcmd], input=code, env=env, text=True, capture_output=True); print(res.stdout.strip() or res.stderr.strip())'
! .venv/bin/python -c 'import hashlib, inspect, os, pathlib, shutil, subprocess as sp, sys; env = {**os.environ, "LD_LIBRARY_PATH": ""}; sys.path.insert(0, "scripts/articles"); import common; from imports import ascii_displays as ad; rb_src = inspect.getsource(common.reboot_honeybot_stream); sigcont_ok = ("kill -CONT" in rb_src and "honeybot_weebo_active" in rb_src and "honeybot_optics_slot.json" in rb_src); ready_ok = ("ready_event" in inspect.signature(ad.conjure_window).parameters); ruff_bin = shutil.which("ruff") or "ruff"; rf = sp.run([ruff_bin, "check", "imports/ascii_displays.py", "remotes/honeybot/scripts/forest.py", "remotes/honeybot/scripts/stream.py", "scripts/articles/common.py"], text=True, capture_output=True); tf = sp.run([sys.executable, "remotes/honeybot/scripts/test_forest.py"], env={**os.environ, "HONEYBOT_NO_AUDIO": "1"}, text=True, capture_output=True); loc = {p.name: hashlib.sha256(p.read_bytes()).hexdigest()[:12] for p in (pathlib.Path("remotes/honeybot/scripts/stream.py"), pathlib.Path("remotes/honeybot/scripts/forest.py"), pathlib.Path("imports/ascii_displays.py"))}; rcmd = "sha256sum ~/www/mikelev.in/scripts/stream.py ~/www/mikelev.in/scripts/forest.py ~/www/mikelev.in/imports/ascii_displays.py; ps -eo pid,etimes,args | rg stream.py | rg -v rg"; hb = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=6", "honeybot", rcmd], env=env, text=True, capture_output=True).stdout.splitlines(); rem = {pathlib.Path(ln.split()[1]).name: ln.split()[0][:12] for ln in hb if len(ln.split()) == 2 and "/" in ln.split()[1]}; pid_ln = [ln.strip() for ln in hb if "/scripts/stream.py" in ln and "sha256" not in ln and len(ln.split()) >= 3]; print("REBOOT_SIGCONT_OK:", sigcont_ok, "WIN_READY_OK:", ready_ok, "RUFF_RC:", rf.returncode, "TEST_FOREST_RC:", tf.returncode, "HB_PARITY:", loc == rem, "STREAM_PS:", pid_ln)'
3. PATCHES
Target: imports/ascii_displays.py
[[[SEARCH]]]
def conjure_window(command, duration: float = 30.0, columns: int = 100, lines: int = 30,
cwd: Optional[str] = None, title: str = "ConjureWindow",
window_class: str = "conjure_window_overlay",
display: Optional[str] = None, fill: bool = False) -> None:
[[[DIVIDER]]]
def conjure_window(command, duration: float = 30.0, columns: int = 100, lines: int = 30,
cwd: Optional[str] = None, title: str = "ConjureWindow",
window_class: str = "conjure_window_overlay",
display: Optional[str] = None, fill: bool = False,
ready_event=None) -> None:
[[[REPLACE]]]
Target: imports/ascii_displays.py
[[[SEARCH]]]
# Center + raise via the shared geometry actuator. fill=True grows the
# overlay to nearly full screen so the live stream behind barely shows.
if sys_platform == "linux":
_center_and_raise(safe_class, env, fill=fill)
elif sys_platform == "darwin":
subprocess.run(["osascript", "-e", 'tell application "Alacritty" to activate'], stdout=subprocess.DEVNULL)
[[[DIVIDER]]]
# Center + raise via the shared geometry actuator. fill=True grows the
# overlay to nearly full screen so the live stream behind barely shows.
if sys_platform == "linux":
_center_and_raise(safe_class, env, fill=fill)
elif sys_platform == "darwin":
subprocess.run(["osascript", "-e", 'tell application "Alacritty" to activate'], stdout=subprocess.DEVNULL)
if ready_event is not None:
ready_event.set()
[[[REPLACE]]]
Target: imports/ascii_displays.py
[[[SEARCH]]]
except Exception as e:
logger.error(f"🪟 CONJURE_WINDOW connection framework failure encountered: {e}")
finally:
if proc is not None and proc.poll() is None:
try:
proc.terminate()
except Exception:
pass
[[[DIVIDER]]]
except Exception as e:
logger.error(f"🪟 CONJURE_WINDOW connection framework failure encountered: {e}")
finally:
if ready_event is not None:
ready_event.set()
if proc is not None and proc.poll() is None:
try:
proc.terminate()
except Exception:
pass
[[[REPLACE]]]
Target: remotes/honeybot/scripts/forest.py
[[[SEARCH]]]
_REPORT_META_TTL_SEC = 90.0
[[[DIVIDER]]]
import threading as _threading
_REPORT_META_TTL_SEC = 240.0
_REPORT_RENDER_LOCK = _threading.Lock()
def _query_bimodal_totals(cur) -> tuple:
"""Compute (eligible_html, js_telem_hits, cloud_triggers, cloud_ips, claude_triggers, claude_ips) without nested-loop LIKE scans."""
cur.execute(
"""
SELECT COALESCE(SUM(t.count), 0)
FROM telemetry t
JOIN ips i ON t.ip_id = i.id
JOIN paths p ON t.path_id = p.id
WHERE t.served_md = 0
AND +i.value NOT LIKE '127.%'
AND +i.value NOT LIKE '10.%'
AND +i.value NOT LIKE '192.168.%'
AND +p.value NOT LIKE '%js_confirm.gif%'
AND +p.value NOT LIKE '/assets/%'
AND +p.value NOT LIKE '%.md%'
AND +p.value NOT LIKE '%.xml%'
AND +p.value NOT LIKE '%.txt%'
AND +p.value NOT LIKE '%.json%'
AND +p.value NOT LIKE '%.css%'
AND +p.value NOT LIKE '%.js%'
AND +p.value NOT LIKE '%.ico%'
AND +p.value NOT LIKE '%.png%'
AND +p.value NOT LIKE '%.jpg%'
AND +p.value NOT LIKE '%.jpeg%'
AND +p.value NOT LIKE '%.gif%'
AND +p.value NOT LIKE '%.svg%'
AND +p.value NOT LIKE '%.webp%'
AND +p.value NOT LIKE '%.woff%'
AND +p.value NOT LIKE '%.ttf%'
AND +p.value NOT LIKE '%.zip%'
AND +p.value NOT LIKE '%.sh%'
"""
)
eligible_html = int((cur.fetchone() or [0])[0] or 0)
cur.execute("SELECT id FROM paths WHERE value LIKE '%js_confirm.gif%'")
js_pids = [int(r[0]) for r in cur.fetchall() if r and r[0] is not None]
if not js_pids:
return eligible_html, 0, 0, 0, 0, 0
if len(js_pids) <= 500:
pid_clause = f"t.path_id IN ({','.join(str(pid) for pid in js_pids)})"
cte_prefix = ""
join_js = ""
else:
cte_prefix = "WITH js_p AS MATERIALIZED (SELECT id FROM paths WHERE value LIKE '%js_confirm.gif%') "
join_js = "JOIN js_p ON t.path_id = js_p.id "
pid_clause = "1=1"
cur.execute(
f"""
{cte_prefix}SELECT
COALESCE(SUM(CASE WHEN +i.value NOT LIKE '127.%' AND +i.value NOT LIKE '10.%' AND +i.value NOT LIKE '192.168.%' THEN t.count ELSE 0 END), 0),
COALESCE(SUM(CASE WHEN (+i.value LIKE '34.%' OR +i.value LIKE '35.%' OR +i.value LIKE '136.65.%') AND +ua.value LIKE 'Mozilla%' AND +ua.value NOT LIKE '%compatible%' THEN t.count ELSE 0 END), 0),
COUNT(DISTINCT CASE WHEN (+i.value LIKE '34.%' OR +i.value LIKE '35.%' OR +i.value LIKE '136.65.%') AND +ua.value LIKE 'Mozilla%' AND +ua.value NOT LIKE '%compatible%' THEN i.id END),
COALESCE(SUM(CASE WHEN +ua.value LIKE '%ClaudeBot%' AND +i.value NOT LIKE '127.%' AND +i.value NOT LIKE '10.%' AND +i.value NOT LIKE '192.168.%' THEN t.count ELSE 0 END), 0),
COUNT(DISTINCT CASE WHEN +ua.value LIKE '%ClaudeBot%' AND +i.value NOT LIKE '127.%' AND +i.value NOT LIKE '10.%' AND +i.value NOT LIKE '192.168.%' THEN i.id END)
FROM telemetry t
{join_js}JOIN ips i ON t.ip_id = i.id
JOIN user_agents ua ON t.ua_id = ua.id
WHERE {pid_clause}
"""
)
row = cur.fetchone() or (0, 0, 0, 0, 0)
return (
eligible_html,
int(row[0] or 0),
int(row[1] or 0),
int(row[2] or 0),
int(row[3] or 0),
int(row[4] or 0),
)
[[[REPLACE]]]
Target: remotes/honeybot/scripts/forest.py
[[[SEARCH]]]
def resolve_dynamic_report_speech(text: str) -> str:
"""Replace {LIVE_REPORT:overview} or {LIVE_REPORT:bimodal} using the chart's own snapshot + 'about' upward rounding."""
s = str(text or "")
if "{LIVE_REPORT:" not in s:
return s
[[[DIVIDER]]]
def resolve_dynamic_report_speech(text: str) -> str:
"""Replace {LIVE_REPORT:overview} or {LIVE_REPORT:bimodal} using the chart's own snapshot + 'about' upward rounding."""
s = str(text or "")
if "{LIVE_REPORT:" not in s:
return s
if "{LIVE_REPORT:overview}" in s:
snap_ov = _read_report_speech_snapshot("overview")
if snap_ov and snap_ov.get("top_bots"):
s = s.replace(
"{LIVE_REPORT:overview}",
_format_overview_speech(
int(snap_ov["total_hits"]),
int(snap_ov["md_reads"]),
int(snap_ov["total_cneg"]),
float(snap_ov["md_pct"]),
snap_ov["top_bots"],
),
)
if "{LIVE_REPORT:bimodal}" in s:
snap_bi = _read_report_speech_snapshot("bimodal")
if snap_bi and snap_bi.get("top_bots"):
s = s.replace(
"{LIVE_REPORT:bimodal}",
_format_bimodal_speech(
int(snap_bi["eligible_html"]),
int(snap_bi["js_horizon_hits"]),
float(snap_bi["js_pct"]),
snap_bi["top_bots"],
),
)
if "{LIVE_REPORT:" not in s:
return s
[[[REPLACE]]]
Target: remotes/honeybot/scripts/forest.py
[[[SEARCH]]]
if "{LIVE_REPORT:bimodal}" in s:
try:
cur.execute(
"""
SELECT COALESCE(SUM(t.count), 0)
FROM telemetry t
JOIN ips i ON t.ip_id = i.id
JOIN paths p ON t.path_id = p.id
WHERE t.served_md = 0
AND i.value NOT LIKE '127.%'
AND i.value NOT LIKE '10.%'
AND i.value NOT LIKE '192.168.%'
AND p.value NOT LIKE '%js_confirm.gif%'
AND p.value NOT LIKE '/assets/%'
AND p.value NOT LIKE '%.md%'
AND p.value NOT LIKE '%.xml%'
AND p.value NOT LIKE '%.txt%'
AND p.value NOT LIKE '%.json%'
AND p.value NOT LIKE '%.css%'
AND p.value NOT LIKE '%.js%'
AND p.value NOT LIKE '%.ico%'
AND p.value NOT LIKE '%.png%'
AND p.value NOT LIKE '%.jpg%'
AND p.value NOT LIKE '%.jpeg%'
AND p.value NOT LIKE '%.gif%'
AND p.value NOT LIKE '%.svg%'
AND p.value NOT LIKE '%.webp%'
AND p.value NOT LIKE '%.woff%'
AND p.value NOT LIKE '%.ttf%'
AND p.value NOT LIKE '%.zip%'
AND p.value NOT LIKE '%.sh%'
"""
)
eligible_html = int((cur.fetchone() or [0])[0] or 0)
cur.execute(
"""
SELECT COALESCE(SUM(t.count), 0)
FROM telemetry t
JOIN ips i ON t.ip_id = i.id
JOIN paths p ON t.path_id = p.id
WHERE p.value LIKE '%js_confirm.gif%'
AND i.value NOT LIKE '127.%'
AND i.value NOT LIKE '10.%'
AND i.value NOT LIKE '192.168.%'
"""
)
js_telem_hits = int((cur.fetchone() or [0])[0] or 0)
cur.execute(
"""
SELECT COALESCE(SUM(t.count), 0), COUNT(DISTINCT i.id)
FROM telemetry t
JOIN ips i ON t.ip_id = i.id
JOIN user_agents ua ON t.ua_id = ua.id
JOIN paths p ON t.path_id = p.id
WHERE p.value LIKE '%js_confirm.gif%'
AND (i.value LIKE '34.%' OR i.value LIKE '35.%' OR i.value LIKE '136.65.%')
AND ua.value LIKE 'Mozilla%'
AND ua.value NOT LIKE '%compatible%'
"""
)
cloud_row = cur.fetchone() or (0, 0)
cloud_triggers, cloud_ips = int(cloud_row[0] or 0), int(cloud_row[1] or 0)
snap_bi = _read_report_speech_snapshot("bimodal")
if snap_bi and snap_bi.get("top_bots"):
live_bi = _format_bimodal_speech(
int(snap_bi["eligible_html"]),
int(snap_bi["js_horizon_hits"]),
float(snap_bi["js_pct"]),
snap_bi["top_bots"],
)
else:
cur.execute(
"""
SELECT COALESCE(SUM(t.count), 0), COUNT(DISTINCT i.id)
FROM telemetry t
JOIN ips i ON t.ip_id = i.id
JOIN user_agents ua ON t.ua_id = ua.id
JOIN paths p ON t.path_id = p.id
WHERE p.value LIKE '%js_confirm.gif%'
AND ua.value LIKE '%ClaudeBot%'
AND i.value NOT LIKE '127.%'
AND i.value NOT LIKE '10.%'
AND i.value NOT LIKE '192.168.%'
"""
)
c_row = cur.fetchone() or (0, 0)
c_triggers, c_ips = int(c_row[0] or 0), int(c_row[1] or 0)
[[[DIVIDER]]]
if "{LIVE_REPORT:bimodal}" in s:
try:
snap_bi = _read_report_speech_snapshot("bimodal")
if snap_bi and snap_bi.get("top_bots"):
live_bi = _format_bimodal_speech(
int(snap_bi["eligible_html"]),
int(snap_bi["js_horizon_hits"]),
float(snap_bi["js_pct"]),
snap_bi["top_bots"],
)
else:
(
eligible_html,
js_telem_hits,
cloud_triggers,
cloud_ips,
c_triggers,
c_ips,
) = _query_bimodal_totals(cur)
[[[REPLACE]]]
Target: remotes/honeybot/scripts/forest.py
[[[SEARCH]]]
if mode in ("bimodal", "trapdoor"):
cur.execute(
"""
SELECT COALESCE(SUM(t.count), 0)
FROM telemetry t
JOIN ips i ON t.ip_id = i.id
JOIN paths p ON t.path_id = p.id
WHERE t.served_md = 0
AND i.value NOT LIKE '127.%'
AND i.value NOT LIKE '10.%'
AND i.value NOT LIKE '192.168.%'
AND p.value NOT LIKE '%js_confirm.gif%'
AND p.value NOT LIKE '/assets/%'
AND p.value NOT LIKE '%.md%'
AND p.value NOT LIKE '%.xml%'
AND p.value NOT LIKE '%.txt%'
AND p.value NOT LIKE '%.json%'
AND p.value NOT LIKE '%.css%'
AND p.value NOT LIKE '%.js%'
AND p.value NOT LIKE '%.ico%'
AND p.value NOT LIKE '%.png%'
AND p.value NOT LIKE '%.jpg%'
AND p.value NOT LIKE '%.jpeg%'
AND p.value NOT LIKE '%.gif%'
AND p.value NOT LIKE '%.svg%'
AND p.value NOT LIKE '%.webp%'
AND p.value NOT LIKE '%.woff%'
AND p.value NOT LIKE '%.ttf%'
AND p.value NOT LIKE '%.zip%'
AND p.value NOT LIKE '%.sh%'
"""
)
eligible_html_hits = int((cur.fetchone() or [1])[0] or 1)
cur.execute(
"""
SELECT COALESCE(SUM(t.count), 0)
FROM telemetry t
JOIN ips i ON t.ip_id = i.id
JOIN paths p ON t.path_id = p.id
WHERE p.value LIKE '%js_confirm.gif%'
AND i.value NOT LIKE '127.%'
AND i.value NOT LIKE '10.%'
AND i.value NOT LIKE '192.168.%'
"""
)
js_telem_hits = int((cur.fetchone() or [0])[0] or 0)
cur.execute(
"""
SELECT COALESCE(SUM(t.count), 0), COUNT(DISTINCT i.id)
FROM telemetry t
JOIN ips i ON t.ip_id = i.id
JOIN user_agents ua ON t.ua_id = ua.id
JOIN paths p ON t.path_id = p.id
WHERE p.value LIKE '%js_confirm.gif%'
AND (i.value LIKE '34.%' OR i.value LIKE '35.%' OR i.value LIKE '136.65.%')
AND ua.value LIKE 'Mozilla%'
AND ua.value NOT LIKE '%compatible%'
"""
)
cloud_row = cur.fetchone() or (0, 0)
cloud_triggers, cloud_ips = int(cloud_row[0] or 0), int(cloud_row[1] or 0)
cur.execute(
"""
SELECT COALESCE(SUM(t.count), 0), COUNT(DISTINCT i.id)
FROM telemetry t
JOIN ips i ON t.ip_id = i.id
JOIN user_agents ua ON t.ua_id = ua.id
JOIN paths p ON t.path_id = p.id
WHERE p.value LIKE '%js_confirm.gif%'
AND ua.value LIKE '%ClaudeBot%'
AND i.value NOT LIKE '127.%'
AND i.value NOT LIKE '10.%'
AND i.value NOT LIKE '192.168.%'
"""
)
claude_row = cur.fetchone() or (0, 0)
claude_triggers, claude_ips = int(claude_row[0] or 0), int(claude_row[1] or 0)
[[[DIVIDER]]]
if mode in ("bimodal", "trapdoor"):
(
raw_elig_html,
js_telem_hits,
cloud_triggers,
cloud_ips,
claude_triggers,
claude_ips,
) = _query_bimodal_totals(cur)
eligible_html_hits = max(1, int(raw_elig_html or 1))
[[[REPLACE]]]
Target: remotes/honeybot/scripts/forest.py
[[[SEARCH]]]
tmp = target.with_suffix(".tmp")
tmp.write_text(buf.getvalue().rstrip("\n"), encoding="utf-8")
tmp.replace(target)
return str(target)
[[[DIVIDER]]]
tmp = target.with_suffix(".tmp")
tmp.write_text(buf.getvalue().rstrip("\n"), encoding="utf-8")
tmp.replace(target)
return str(target)
def ensure_station_report_prerendered(
mode="overview",
width=REPORT_WINDOW_COLUMNS,
height=REPORT_WINDOW_LINES,
max_age=_REPORT_META_TTL_SEC,
):
"""Return a fresh pre-rendered .ansi path, coalescing concurrent pre-warm and window-open callers under one lock."""
import time
from pathlib import Path
safe_mode = "".join(c for c in str(mode or "overview") if c.isalnum() or c in ("_", "-")) or "overview"
target = Path(f"/tmp/honeybot_report_{safe_mode}.ansi")
with _REPORT_RENDER_LOCK:
try:
if target.is_file() and target.stat().st_size > 0:
age = time.time() - target.stat().st_mtime
if age <= float(max_age):
if safe_mode not in ("overview", "bimodal", "trapdoor") or _read_report_speech_snapshot(safe_mode, max_age=max_age):
return str(target)
except OSError:
pass
return prerender_station_report_ansi(mode=safe_mode, width=width, height=height, out_path=target)
[[[REPLACE]]]
Target: remotes/honeybot/scripts/stream.py
[[[SEARCH]]]
if _is_singleton_owner and os.environ.get("HONEYBOT_NO_AUDIO") != "1":
for pat in ("conjure_window_overlay", "patronus_visual_shield", "honeybot_media_overlay", "firefox"):
try:
subprocess.run(["pkill", "-f", pat], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=False)
except Exception:
pass
for glob_pat in ("honeybot_tts_*.raw", "honeybot_card_*.stop"):
for tmp_f in Path("/tmp").glob(glob_pat):
try:
tmp_f.unlink(missing_ok=True)
except OSError:
pass
for sentinel in ("/tmp/honeybot_weebo_active", "/tmp/honeybot_optics_slot.json"):
try:
Path(sentinel).unlink(missing_ok=True)
except OSError:
pass
[[[DIVIDER]]]
if _is_singleton_owner and os.environ.get("HONEYBOT_NO_AUDIO") != "1":
for pat in ("conjure_window_overlay", "patronus_visual_shield", "honeybot_media_overlay", "HONEYBOT_LIVE_VIM", "firefox"):
try:
subprocess.run(["pkill", "-f", pat], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=False)
except Exception:
pass
for glob_pat in ("honeybot_tts_*.raw", "honeybot_card_*.stop"):
for tmp_f in Path("/tmp").glob(glob_pat):
try:
tmp_f.unlink(missing_ok=True)
except OSError:
pass
for cue_f in Path("/tmp").glob("honeybot_cue_*.raw"):
try:
parts = cue_f.stem.split("_")
owner_pid = int(parts[2]) if len(parts) >= 3 and parts[2].isdigit() else 0
if _shutting_down.is_set() or (owner_pid != my_pid and not Path(f"/proc/{owner_pid}").exists()):
cue_f.unlink(missing_ok=True)
except OSError:
pass
for sentinel in ("/tmp/honeybot_weebo_active", "/tmp/honeybot_optics_slot.json", "/tmp/honeybot_ytstage_paused.json"):
try:
Path(sentinel).unlink(missing_ok=True)
except OSError:
pass
[[[REPLACE]]]
Target: remotes/honeybot/scripts/stream.py
[[[SEARCH]]]
self._tts_seq = 0
self._dialogue_rate = NORMA_TTS_SAMPLE_RATE
self._speaker_rate = NORMA_TTS_SAMPLE_RATE
self._stage_dialogue_role = "prologue"
self._reannounce_after_break = False
self.live_operator_mode = threading.Event()
self.exclusive_mode = threading.Event()
[[[DIVIDER]]]
self._tts_seq = 0
self._cue_cache = {}
self._cue_lock = threading.Lock()
self._dialogue_rate = NORMA_TTS_SAMPLE_RATE
self._speaker_rate = NORMA_TTS_SAMPLE_RATE
self._stage_dialogue_role = "prologue"
self._reannounce_after_break = False
self.live_operator_mode = threading.Event()
self.exclusive_mode = threading.Event()
[[[REPLACE]]]
Target: remotes/honeybot/scripts/stream.py
[[[SEARCH]]]
def plan_utterances(self, text: str) -> list:
"""Plan 1 or 2 zero-lag utterance specs across Norma Centroid, Mike-E, and Shipmunk O'Theseus!"""
raw = (text or "").strip()
if not raw:
return []
[[[DIVIDER]]]
def _split_fast_start_specs(self, specs: list) -> list:
"""Split the opening clause/sentence of long Mike/Shipmunk turns so voice-switch audio starts immediately."""
if not specs:
return []
out = []
split_done = False
for spec in specs:
txt = (spec.get("text") or "").strip()
if not split_done and spec.get("voice") in ("mike", "shipmunk") and len(txt) > 220:
split_pos = None
m_sent = re.search(r"(?<!\bMr)(?<!\bMs)(?<!\bDr)(?<!\bvs)[.!?]\s+(?=[A-Z0-9\"'(])", txt[45:255])
if m_sent:
split_pos = 45 + m_sent.end()
else:
m_cl = re.search(r"(?:[;:]\s+|—\s*|,\s+)", txt[65:210])
if m_cl:
split_pos = 65 + m_cl.end()
if split_pos and 40 <= split_pos < (len(txt) - 35):
head = txt[:split_pos].strip()
tail = txt[split_pos:].strip()
if head and tail:
out.append(dict(spec, text=head))
out.append(dict(spec, text=tail))
split_done = True
continue
out.append(spec)
return out
def plan_utterances(self, text: str) -> list:
"""Plan zero-lag utterance specs across Norma Centroid, Mike-E, and Shipmunk O'Theseus!"""
return self._split_fast_start_specs(self._plan_utterances_core(text))
def _plan_utterances_core(self, text: str) -> list:
raw = (text or "").strip()
if not raw:
return []
[[[REPLACE]]]
Target: remotes/honeybot/scripts/stream.py
[[[SEARCH]]]
def _cleanup_item(self, item):
"""Remove any unplayed pre-synthesized .raw file when flushing the queue."""
if isinstance(item, tuple) and len(item) >= 2 and item[0] == "RAW":
raw_path = item[1]
if raw_path and os.path.exists(raw_path):
try:
os.remove(raw_path)
except OSError:
pass
def _synth_raw_with_voice(self, text: str, voice_key: str) -> tuple:
"""Synthesize `text` using `voice_key` ('norma'|'mike'|'shipmunk'); returns (raw_path, actual_rate) or (None, 0)."""
if not text or not shutil.which("piper"):
return None, 0
model_path, actual_rate = self.resolve_voice_target(voice_key)
if not model_path.exists():
return None, 0
self._tts_seq += 1
raw_path = f"/tmp/honeybot_tts_{os.getpid()}_{self._tts_seq}.raw"
try:
with open(raw_path, "wb") as out_f:
res = subprocess.run(
["piper", "--model", str(model_path), "--output_raw"],
input=text.strip().encode("utf-8"),
stdout=out_f,
stderr=subprocess.DEVNULL,
timeout=30,
check=False,
)
if res.returncode == 0 and os.path.exists(raw_path) and os.path.getsize(raw_path) > 0:
return raw_path, actual_rate
except Exception:
pass
if os.path.exists(raw_path):
try:
os.remove(raw_path)
except OSError:
pass
return None, 0
[[[DIVIDER]]]
def _cleanup_item(self, item):
"""Remove any unplayed pre-synthesized .raw file when flushing the queue (preserving static turn-cue cache)."""
if isinstance(item, tuple) and len(item) >= 2 and item[0] == "RAW":
raw_path = item[1]
if raw_path and os.path.exists(raw_path) and not os.path.basename(str(raw_path)).startswith("honeybot_cue_"):
try:
os.remove(raw_path)
except OSError:
pass
def _synth_raw_with_voice(self, text: str, voice_key: str) -> tuple:
"""Synthesize `text` using `voice_key` ('norma'|'mike'|'shipmunk'); caches static turn cues for 0ms switches."""
if not text or os.environ.get("HONEYBOT_NO_AUDIO") == "1" or not shutil.which("piper"):
return None, 0
model_path, actual_rate = self.resolve_voice_target(voice_key)
if not model_path.exists():
return None, 0
clean_text = text.strip()
vk = (voice_key or "norma").strip().lower()
static_cues = {
MIKE_TURN_CUE_TEXT,
SHIPMUNK_TURN_CUE_TEXT,
_polish_tts_text(MIKE_TURN_CUE_TEXT),
_polish_tts_text(SHIPMUNK_TURN_CUE_TEXT),
}
if clean_text in static_cues:
with self._cue_lock:
cached = self._cue_cache.get((vk, clean_text))
if cached and os.path.exists(cached[0]) and os.path.getsize(cached[0]) > 0:
return cached
cue_path = f"/tmp/honeybot_cue_{os.getpid()}_{vk}_{len(self._cue_cache) + 1}.raw"
try:
with open(cue_path, "wb") as out_f:
res = subprocess.run(
["piper", "--model", str(model_path), "--output_raw"],
input=clean_text.encode("utf-8"),
stdout=out_f,
stderr=subprocess.DEVNULL,
timeout=30,
check=False,
)
if res.returncode == 0 and os.path.exists(cue_path) and os.path.getsize(cue_path) > 0:
self._cue_cache[(vk, clean_text)] = (cue_path, actual_rate)
return cue_path, actual_rate
except Exception:
pass
if os.path.exists(cue_path):
try:
os.remove(cue_path)
except OSError:
pass
return None, 0
self._tts_seq += 1
raw_path = f"/tmp/honeybot_tts_{os.getpid()}_{self._tts_seq}.raw"
try:
with open(raw_path, "wb") as out_f:
res = subprocess.run(
["piper", "--model", str(model_path), "--output_raw"],
input=clean_text.encode("utf-8"),
stdout=out_f,
stderr=subprocess.DEVNULL,
timeout=30,
check=False,
)
if res.returncode == 0 and os.path.exists(raw_path) and os.path.getsize(raw_path) > 0:
return raw_path, actual_rate
except Exception:
pass
if os.path.exists(raw_path):
try:
os.remove(raw_path)
except OSError:
pass
return None, 0
def warm_turn_cues(self) -> None:
"""Pre-render both static Norma speaker-introduction cues during the 5s boot grace."""
if os.environ.get("HONEYBOT_NO_AUDIO") == "1":
return
for cue_txt in (_polish_tts_text(MIKE_TURN_CUE_TEXT), _polish_tts_text(SHIPMUNK_TURN_CUE_TEXT)):
self._synth_raw_with_voice(cue_txt, "norma")
[[[REPLACE]]]
Target: remotes/honeybot/scripts/stream.py
[[[SEARCH]]]
elif isinstance(item, tuple) and item and item[0] == "WINDOW":
win_script, win_dur, win_args = item[1]
threading.Thread(
target=conjure_window,
args=(win_script,),
kwargs={"duration": win_dur, "args": win_args},
daemon=True,
).start()
time.sleep(0.5)
[[[DIVIDER]]]
elif isinstance(item, tuple) and item and item[0] == "WINDOW":
win_script, win_dur, win_args = item[1]
win_ready = threading.Event()
threading.Thread(
target=conjure_window,
args=(win_script,),
kwargs={"duration": win_dur, "args": win_args, "ready_event": win_ready},
daemon=True,
).start()
win_ready.wait(timeout=25.0)
[[[REPLACE]]]
Target: remotes/honeybot/scripts/stream.py
[[[SEARCH]]]
self.queue.task_done()
time.sleep(0.1)
except queue.Empty:
continue
[[[DIVIDER]]]
self.queue.task_done()
time.sleep(0.02)
except queue.Empty:
continue
[[[REPLACE]]]
Target: remotes/honeybot/scripts/stream.py
[[[SEARCH]]]
if self.stop_event.is_set():
try:
os.remove(raw_path)
except OSError:
pass
return
[[[DIVIDER]]]
is_cached_cue = os.path.basename(str(raw_path)).startswith("honeybot_cue_")
if self.stop_event.is_set():
if not is_cached_cue:
try:
os.remove(raw_path)
except OSError:
pass
return
[[[REPLACE]]]
Target: remotes/honeybot/scripts/stream.py
[[[SEARCH]]]
if os.path.exists(raw_path):
try:
os.remove(raw_path)
except OSError:
pass
[[[DIVIDER]]]
if os.path.exists(raw_path) and not is_cached_cue:
try:
os.remove(raw_path)
except OSError:
pass
[[[REPLACE]]]
Target: remotes/honeybot/scripts/stream.py
[[[SEARCH]]]
def conjure_window(script_name, duration=30.0, columns=100, lines=30, args=None):
"""Process-flavored sibling to conjure_patronus.
Keep the sheet-music API ("report.py" or "report.py:seconds") local to the
Honeybot scripts folder, but delegate the actual overlay mechanics to the
shared wand actuator in imports.ascii_displays. This keeps patronus and
arbitrary command windows in parity.
"""
os.environ.update(_hydrate_honeybot_x11_env())
safe_script = "".join(c for c in str(script_name).strip() if c.isalnum() or c in {"_", "-", "."})
if not safe_script:
return
duration = max(0.75, min(600.0, float(duration)))
script_dir = Path(__file__).resolve().parent
script_path = script_dir / safe_script
if not script_path.exists():
return
[[[DIVIDER]]]
def conjure_window(script_name, duration=30.0, columns=100, lines=30, args=None, ready_event=None):
"""Process-flavored sibling to conjure_patronus.
Keep the sheet-music API ("report.py" or "report.py:seconds") local to the
Honeybot scripts folder, but delegate the actual overlay mechanics to the
shared wand actuator in imports.ascii_displays. This keeps patronus and
arbitrary command windows in parity.
"""
os.environ.update(_hydrate_honeybot_x11_env())
safe_script = "".join(c for c in str(script_name).strip() if c.isalnum() or c in {"_", "-", "."})
if not safe_script:
if ready_event is not None:
ready_event.set()
return
duration = max(0.75, min(600.0, float(duration)))
script_dir = Path(__file__).resolve().parent
script_path = script_dir / safe_script
if not script_path.exists():
if ready_event is not None:
ready_event.set()
return
[[[REPLACE]]]
Target: remotes/honeybot/scripts/stream.py
[[[SEARCH]]]
from forest import (
REPORT_WINDOW_COLUMNS,
REPORT_WINDOW_LINES,
prerender_station_report_ansi,
)
columns = REPORT_WINDOW_COLUMNS
lines = REPORT_WINDOW_LINES
ansi_path = prerender_station_report_ansi(
mode=mode_arg,
width=columns,
height=lines,
)
[[[DIVIDER]]]
from forest import (
REPORT_WINDOW_COLUMNS,
REPORT_WINDOW_LINES,
ensure_station_report_prerendered,
)
columns = REPORT_WINDOW_COLUMNS
lines = REPORT_WINDOW_LINES
ansi_path = ensure_station_report_prerendered(
mode=mode_arg,
width=columns,
height=lines,
)
[[[REPLACE]]]
Target: remotes/honeybot/scripts/stream.py
[[[SEARCH]]]
shared_conjure_window(
cmd,
duration=duration,
columns=columns,
lines=lines,
cwd=str(script_dir),
title="ConjureWindow",
window_class="conjure_window_overlay",
display=os.environ.get("DISPLAY") or ":10.0",
)
[[[DIVIDER]]]
try:
shared_conjure_window(
cmd,
duration=duration,
columns=columns,
lines=lines,
cwd=str(script_dir),
title="ConjureWindow",
window_class="conjure_window_overlay",
display=os.environ.get("DISPLAY") or ":10.0",
ready_event=ready_event,
)
finally:
if ready_event is not None:
ready_event.set()
[[[REPLACE]]]
Target: remotes/honeybot/scripts/stream.py
[[[SEARCH]]]
if pace_say:
# Double-buffered 3-voice synthesis: plan 1-or-2 utterances (Norma cue +
# Mike-E / Shipmunk body), pre-render .raw PCM while prior audio plays,
# then enqueue on the real ALSA voice clock for zero-lag curtain lifts.
specs = narrator.plan_utterances(content)
if not specs:
return
raw_batch = narrator.prep_specs_raw(specs)
if raw_batch is not None:
wait_for_voice_or_live_interrupt(env, profile_dir)
if has_pending_update():
for r_path, _, _ in raw_batch:
narrator._cleanup_item(("RAW", r_path))
return
if (
narrator._reannounce_after_break
and narrator._stage_dialogue_role in ("left", "right")
and len(specs) == 1
):
for r_path, _, _ in raw_batch:
narrator._cleanup_item(("RAW", r_path))
specs = narrator.plan_utterances(content)
raw_batch = narrator.prep_specs_raw(specs)
if raw_batch is None:
narrator.enqueue_specs(specs)
return
elif len(specs) >= 2:
narrator._reannounce_after_break = False
narrator.play_specs_raw(raw_batch)
else:
narrator.enqueue_specs(specs)
time.sleep(len(str(content)) / 20)
[[[DIVIDER]]]
if pace_say:
# Pipelined 3-voice synthesis: static turn cues hit /tmp cache in 0ms and
# long turns split on their opening sentence so stage highlights flip immediately
# while the remainder synthesizes behind active ALSA playback.
specs = narrator.plan_utterances(content)
if not specs:
return
static_cue_texts = {
MIKE_TURN_CUE_TEXT,
SHIPMUNK_TURN_CUE_TEXT,
_polish_tts_text(MIKE_TURN_CUE_TEXT),
_polish_tts_text(SHIPMUNK_TURN_CUE_TEXT),
}
for idx, spec in enumerate(specs):
if has_pending_update() or _shutting_down.is_set():
return
raw_batch = narrator.prep_specs_raw([spec])
if raw_batch is not None:
wait_for_voice_or_live_interrupt(env, profile_dir)
if has_pending_update() or _shutting_down.is_set():
for r_path, _, _ in raw_batch:
narrator._cleanup_item(("RAW", r_path))
return
if (
idx == 0
and narrator._reannounce_after_break
and narrator._stage_dialogue_role in ("left", "right")
and spec.get("voice") in ("mike", "shipmunk")
):
narrator._reannounce_after_break = False
cue_spec = (
narrator._make_spec("norma", MIKE_TURN_CUE_TEXT, "narrator", "curtain", "inactive")
if narrator._stage_dialogue_role == "left"
else narrator._make_spec("norma", SHIPMUNK_TURN_CUE_TEXT, "narrator", "inactive", "curtain")
)
cue_batch = narrator.prep_specs_raw([cue_spec])
if cue_batch:
narrator.play_specs_raw(cue_batch)
elif idx == 0 and spec.get("text") in static_cue_texts:
narrator._reannounce_after_break = False
narrator.play_specs_raw(raw_batch)
else:
narrator.enqueue_specs([spec])
time.sleep(len(str(spec.get("text", ""))) / 20)
[[[REPLACE]]]
Target: remotes/honeybot/scripts/stream.py
[[[SEARCH]]]
# Pre-synthesize during the pre-banner silence so the 3.0s palate cleanser
# absorbs Piper synthesis time and the banner speaks the instant it pops.
raw_path = narrator.prep_raw(say_text) if say_text else None
rem = pre_pause - (time.time() - t_cut)
if rem > 0:
time.sleep(rem)
if patronus_key or media_spec or window_spec:
if card_label:
dispatch_cue("CARD", {"label": card_label, "say": "", "duration": 2.5, "linger": 2.5}, env, profile_dir, pace_say=True)
if patronus_key:
conjure_patronus(patronus_key, duration=hold)
elif media_spec:
threading.Thread(
target=conjure_media,
args=(media_spec,),
kwargs={"duration": hold},
daemon=True,
).start()
time.sleep(0.4)
elif window_spec:
threading.Thread(
target=dispatch_cue,
args=("WINDOW", window_spec, env, profile_dir),
kwargs={"pace_say": True},
daemon=True,
).start()
time.sleep(0.4)
[[[DIVIDER]]]
if window_spec and str(window_spec).startswith("forest.py"):
w_parts = str(window_spec).split(":", 2)
w_mode = w_parts[2].strip() if len(w_parts) > 2 and w_parts[2].strip() else "overview"
threading.Thread(
target=lambda m=w_mode: (_reload_forest_module() and getattr(_forest_mod, "ensure_station_report_prerendered", lambda *_: None)(m)),
daemon=True,
).start()
# Pre-synthesize during the pre-banner silence so the 3.0s palate cleanser
# absorbs Piper synthesis time and the banner speaks the instant it pops.
raw_path = narrator.prep_raw(say_text) if say_text else None
rem = pre_pause - (time.time() - t_cut)
if rem > 0:
time.sleep(rem)
if patronus_key or media_spec or window_spec:
if card_label:
dispatch_cue("CARD", {"label": card_label, "say": "", "duration": 2.5, "linger": 2.5}, env, profile_dir, pace_say=True)
if patronus_key:
conjure_patronus(patronus_key, duration=hold)
elif media_spec:
threading.Thread(
target=conjure_media,
args=(media_spec,),
kwargs={"duration": hold},
daemon=True,
).start()
time.sleep(0.4)
elif window_spec:
w_parts = str(window_spec).split(":", 2)
w_script = w_parts[0].strip()
w_dur = hold
if len(w_parts) > 1 and w_parts[1].strip():
try:
w_dur = float(w_parts[1].strip())
except ValueError:
w_dur = hold
w_args = [w_parts[2].strip()] if (len(w_parts) > 2 and w_parts[2].strip()) else None
win_ready = threading.Event()
threading.Thread(
target=conjure_window,
args=(w_script,),
kwargs={"duration": w_dur, "args": w_args, "ready_event": win_ready},
daemon=True,
).start()
win_ready.wait(timeout=25.0)
[[[REPLACE]]]
Target: remotes/honeybot/scripts/stream.py
[[[SEARCH]]]
prev_dialogue_role = narrator._stage_dialogue_role
narrator.exclusive_mode.set()
try:
dropped = narrator.flush_queue()
if dropped:
# MEANINGFUL SILENCE OVER UNCONDITIONAL CHATTER: gated on the
# interesting case, so a healthy pipeline says nothing and an unhealthy
# one says exactly how unhealthy. Deliberately NOT added to interrupt()
# -- there, dropping the backlog is the INTENT (you are cutting to
# breaking news); here it is collateral.
print(f"📉 STATION BREAK DROPPED {dropped} unspoken item(s) -- "
f"director ran ahead of the voice; that text was never heard.")
[[[DIVIDER]]]
report_modes = []
for cue_cmd, cue_val in bead:
if cue_cmd == "WINDOW" and str(cue_val).startswith("forest.py"):
w_parts = str(cue_val).split(":", 2)
report_modes.append(w_parts[2].strip() if len(w_parts) > 2 and w_parts[2].strip() else "overview")
if report_modes:
def _prewarm_bead_reports(modes=tuple(report_modes)):
try:
from forest import ensure_station_report_prerendered
for m in modes:
ensure_station_report_prerendered(mode=m)
except Exception:
pass
threading.Thread(target=_prewarm_bead_reports, daemon=True).start()
wait_for_voice_or_live_interrupt(env, profile_dir)
prev_dialogue_role = narrator._stage_dialogue_role
narrator.exclusive_mode.set()
try:
[[[REPLACE]]]
Target: remotes/honeybot/scripts/stream.py
[[[SEARCH]]]
for pat in ("conjure_window_overlay", "patronus_visual_shield", MEDIA_OVERLAY_MARKER, "firefox"):
try:
subprocess.run(["pkill", "-f", pat], check=False)
except Exception:
pass
[[[DIVIDER]]]
for sentinel in ("/tmp/honeybot_weebo_active", "/tmp/honeybot_optics_slot.json", "/tmp/honeybot_ytstage_paused.json"):
try:
Path(sentinel).unlink(missing_ok=True)
except OSError:
pass
for pat in ("conjure_window_overlay", "patronus_visual_shield", MEDIA_OVERLAY_MARKER, "HONEYBOT_LIVE_VIM", "firefox"):
try:
subprocess.run(["pkill", "-f", pat], check=False)
except Exception:
pass
[[[REPLACE]]]
Target: remotes/honeybot/scripts/stream.py
[[[SEARCH]]]
def start_director_track():
"""The Script for the Show. Runs in parallel to the Log Stream."""
t_boot = time.time()
ensure_cast_voice_models()
rem_boot = 5.0 - (time.time() - t_boot)
if rem_boot > 0:
time.sleep(rem_boot)
[[[DIVIDER]]]
def start_director_track():
"""The Script for the Show. Runs in parallel to the Log Stream."""
t_boot = time.time()
ensure_cast_voice_models()
narrator.warm_turn_cues()
rem_boot = 5.0 - (time.time() - t_boot)
if rem_boot > 0:
time.sleep(rem_boot)
[[[REPLACE]]]
Target: scripts/articles/common.py
[[[SEARCH]]]
print(f"🔄 Signaling Honeybot stream.py on {HONEYBOT_SSH_HOST} for graceful SCHEDULED REBOOT announcement...")
remote_sh = r"""
pattern="/home/mike/www/mikelev[.]in/scripts/stream[.]py"
old_pids=$(pgrep -f -- "$pattern" || true)
for old in $old_pids; do
echo " signaling stream.py pid=$old for graceful reboot announcement..."
kill -TERM "$old" 2>/dev/null || true
done
[[[DIVIDER]]]
subprocess.run(
["tmux", "kill-session", "-t", "ytbreaks"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
check=False,
)
subprocess.run(
["pkill", "-f", "15001:127[.]0[.]0[.]1:5001"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
check=False,
)
Path("/tmp/pipulate_ytstage_audio.json").unlink(missing_ok=True)
print(f"🔄 Signaling Honeybot stream.py on {HONEYBOT_SSH_HOST} for graceful SCHEDULED REBOOT announcement...")
remote_sh = r"""
pattern="/home/mike/www/mikelev[.]in/scripts/stream[.]py"
rm -f /tmp/honeybot_weebo_active /tmp/honeybot_optics_slot.json /tmp/honeybot_ytstage_paused.json 2>/dev/null || true
pkill -f "[/]tmp/honeybot_ytapp_profile|HONEYBOT_LIVE_VIM|honeybot_media_overlay|conjure_window_overlay|patronus_visual_shield" 2>/dev/null || true
pkill -CONT -f "/home/mike/www/mikelev[.]in/scripts/logs[.]py|aplay|piper" 2>/dev/null || true
old_pids=$(pgrep -f -- "$pattern" || true)
for old in $old_pids; do
echo " signaling stream.py pid=$old for graceful reboot announcement..."
kill -CONT "$old" 2>/dev/null || true
kill -TERM "$old" 2>/dev/null || true
done
[[[REPLACE]]]
Target: scripts/articles/common.py
[[[SEARCH]]]
pkill -9 -f "aplay.*-t raw|honeybot_tts|piper.*output_raw" 2>/dev/null || true
rm -f /tmp/honeybot_tts_*.raw 2>/dev/null || true
pkill -f "/home/mike/www/mikelev[.]in/scripts/logs[.]py" 2>/dev/null || true
pkill -f "tail -f /var/log/nginx/access[.]log" 2>/dev/null || true
[[[DIVIDER]]]
pkill -9 -f "aplay.*-t raw|honeybot_tts|honeybot_cue|piper.*output_raw" 2>/dev/null || true
rm -f /tmp/honeybot_tts_*.raw /tmp/honeybot_cue_*.raw /tmp/honeybot_weebo_active /tmp/honeybot_optics_slot.json /tmp/honeybot_ytstage_paused.json 2>/dev/null || true
pkill -f "[/]tmp/honeybot_ytapp_profile|HONEYBOT_LIVE_VIM|honeybot_media_overlay|conjure_window_overlay|patronus_visual_shield" 2>/dev/null || true
pkill -f "/home/mike/www/mikelev[.]in/scripts/logs[.]py" 2>/dev/null || true
pkill -f "tail -f /var/log/nginx/access[.]log" 2>/dev/null || true
[[[REPLACE]]]
Ignition: after committing in (nix) pipulate $, run ytreboot so stream.py, forest.py, and imports/ascii_displays.py sync to honeybot and stream.py restarts with warm turn-cue .raw caches and pre-rendered station-break report synchronization.
4. PROMPT
Verify all three straddles from LIVE COMMAND RECEIPTS (FIRST_SHIP_MAX_C <= 260, RESUME_VOICES == ['norma', 'norma', 'shipmunk'], Honeybot BIMODAL cue2 < 0.01s + bi_ren speedup + bi_spk < 0.01s + bi_warm < 0.01s, REBOOT_SIGCONT_OK: True, WIN_READY_OK: True, RUFF_RC: 0, TEST_FOREST_RC: 0, HB_PARITY: True), and if all green, execute THE DISMOUNT banking the `<[^>]+>` multiline-wormhole rule, static turn-cue + fast-start pipelining, and SQLite unary-`+` / `SIGCONT`-before-`SIGTERM` hole-punch rules into foo_files.py's 20-line RECEIPTS ledger and '# §' rule keys.
5. EXTERNAL DELIVERABLES
No external deliverables this turn.
MikeLev.in:
THE AI-EDIT METHOD
Same commands, run twice, one change between them. Where the readings differ is what the change did; the diff in the middle is the receipt.
1: BEFORE (PROBE):
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
GIT repo clean. Take BEFORE reading, make CHANGE, record AFTER diff.
(nix) pipulate $ .venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; raw = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md").read_text(); body = raw.split("---", 2)[2]; cleaned = cl.clean_markdown(body, label="probe", census=False); nar = stream.Narrator(); batches = [nar.plan_utterances(re.sub(r"^\[\[HEADING:(.+)\]\]$", r"[[HEADING]]\1", ln.strip())) for ln in cleaned.splitlines() if ln.strip() and not ln.strip().startswith(("[[PATRONUS:", "[[MEDIA:"))]; pairs = [(s["voice"], s["text"]) for b in batches for s in b]; mi = next((i for i, (_, t) in enumerate(pairs) if "Murphy Incarnate, Hilchot" in t), -1); gi = next((i for i, (_, t) in enumerate(pairs) if "Good News First" in t), -1); first_ship = [next(len(s["text"]) for s in b if s["voice"] == "shipmunk") for b in batches if any(s["voice"] == "shipmunk" for s in b)]; nar2 = stream.Narrator(); nar2._stage_dialogue_role = "right"; nar2._reannounce_after_break = True; res_v = [s["voice"] for ln in ("[[HEADING]] Good News First", "First bullet after field note.") for s in nar2.plan_utterances(ln)]; print("MURPHY_OK:", [v for v, _ in pairs[mi:mi+5]] == ["norma", "shipmunk", "shipmunk", "shipmunk", "shipmunk"], "GOOD_OK:", [v for v, _ in pairs[gi:gi+3]] == ["norma", "shipmunk", "shipmunk"], "FIRST_SHIP_MAX_C:", max(first_ship), "RESUME_VOICES:", res_v)'
.venv/bin/python -c 'import ast, os, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; code = "import sys, time\nsdir, v_norma, raw_tag, bi, lr_bi, fn_name = sys.argv[1:7]\nsys.path.insert(0, sdir)\nimport forest, stream\nnar = stream.Narrator()\nnar._synth_raw_with_voice(stream.SHIPMUNK_TURN_CUE_TEXT, v_norma)\nt0 = time.perf_counter()\nrp, _ = nar._synth_raw_with_voice(stream.SHIPMUNK_TURN_CUE_TEXT, v_norma)\ncue2 = round(time.perf_counter() - t0, 4)\nif rp:\n nar._cleanup_item((raw_tag, rp))\nt1 = time.perf_counter()\nforest.prerender_station_report_ansi(bi)\nbi_ren = round(time.perf_counter() - t1, 3)\nt2 = time.perf_counter()\nforest.resolve_dynamic_report_speech(chr(123) + lr_bi + chr(125))\nbi_spk = round(time.perf_counter() - t2, 4)\nbi_warm = -1.0\nif hasattr(forest, fn_name):\n t3 = time.perf_counter()\n getattr(forest, fn_name)(bi)\n bi_warm = round(time.perf_counter() - t3, 4)\nprint(bi.upper(), cue2, bi_ren, bi_spk, bi_warm)\n"; ast.parse(code); rcmd = "PATH=/etc/profiles/per-user/mike/bin:/home/mike/.nix-profile/bin:/run/current-system/sw/bin:/usr/bin:/bin:$PATH python3 - /home/mike/www/mikelev.in/scripts norma RAW bimodal LIVE_REPORT:bimodal ensure_station_report_prerendered"; res = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=8", "honeybot", rcmd], input=code, env=env, text=True, capture_output=True); print(res.stdout.strip() or res.stderr.strip())'
.venv/bin/python -c 'import hashlib, inspect, os, pathlib, shutil, subprocess as sp, sys; env = {**os.environ, "LD_LIBRARY_PATH": ""}; sys.path.insert(0, "scripts/articles"); import common; from imports import ascii_displays as ad; rb_src = inspect.getsource(common.reboot_honeybot_stream); sigcont_ok = ("kill -CONT" in rb_src and "honeybot_weebo_active" in rb_src and "honeybot_optics_slot.json" in rb_src); ready_ok = ("ready_event" in inspect.signature(ad.conjure_window).parameters); ruff_bin = shutil.which("ruff") or "ruff"; rf = sp.run([ruff_bin, "check", "imports/ascii_displays.py", "remotes/honeybot/scripts/forest.py", "remotes/honeybot/scripts/stream.py", "scripts/articles/common.py"], text=True, capture_output=True); tf = sp.run([sys.executable, "remotes/honeybot/scripts/test_forest.py"], env={**os.environ, "HONEYBOT_NO_AUDIO": "1"}, text=True, capture_output=True); loc = {p.name: hashlib.sha256(p.read_bytes()).hexdigest()[:12] for p in (pathlib.Path("remotes/honeybot/scripts/stream.py"), pathlib.Path("remotes/honeybot/scripts/forest.py"), pathlib.Path("imports/ascii_displays.py"))}; rcmd = "sha256sum ~/www/mikelev.in/scripts/stream.py ~/www/mikelev.in/scripts/forest.py ~/www/mikelev.in/imports/ascii_displays.py; ps -eo pid,etimes,args | rg stream.py | rg -v rg"; hb = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=6", "honeybot", rcmd], env=env, text=True, capture_output=True).stdout.splitlines(); rem = {pathlib.Path(ln.split()[1]).name: ln.split()[0][:12] for ln in hb if len(ln.split()) == 2 and "/" in ln.split()[1]}; pid_ln = [ln.strip() for ln in hb if "/scripts/stream.py" in ln and "sha256" not in ln and len(ln.split()) >= 3]; print("REBOOT_SIGCONT_OK:", sigcont_ok, "WIN_READY_OK:", ready_ok, "RUFF_RC:", rf.returncode, "TEST_FOREST_RC:", tf.returncode, "HB_PARITY:", loc == rem, "STREAM_PS:", pid_ln)'
MURPHY_OK: True GOOD_OK: True FIRST_SHIP_MAX_C: 977 RESUME_VOICES: ['norma', 'norma', 'shipmunk']
BIMODAL 1.3185 16.477 9.4627 -1.0
REBOOT_SIGCONT_OK: False WIN_READY_OK: False RUFF_RC: 0 TEST_FOREST_RC: 0 HB_PARITY: True STREAM_PS: ['2311107 5700 python3 -u /home/mike/www/mikelev.in/scripts/stream.py']
(nix) pipulate $
2: AFTER (NEXT CONTEXT):
# # Context 1
# context.txt
# /home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md
#
# # THE JEKYLL BLOG LIKE A HACKER (INVENTED SKILL.md & AGENTS.md FORMAT) PUBLISHING PIPELINE
# ~/repos/nixos/blogs.nix
# ~/.config/pipulate/blogs.json
# scripts/articles/publishizer.py
# scripts/articles/common.py
# scripts/articles/articleizer.py
# scripts/articles/link_injector.py
# scripts/articles/build_knowledge_graph.py
# scripts/articles/editing_prompt.txt
# scripts/articles/sanitizer.py
# scripts/articles/contextualizer.py
# scripts/articles/generate_hubs.py
# scripts/articles/generate_llms_txt.py
# scripts/articles/generate_post_nav.py
# assets/jekyll/common-packages.nix
# # Context 2
# context.txt
# # foo_files.py
# # /home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md
# remotes/honeybot/scripts/content_loader.py
# remotes/honeybot/scripts/stream.py
# remotes/honeybot/scripts/terms.py
# imports/voice_synthesis.py
# scripts/articles/sanitizer.py
# scripts/articles/common.py
# ! .venv/bin/python -c 'import pathlib, subprocess as sp; d = pathlib.Path("remotes/honeybot/scripts"); files = sorted(p.name for p in d.glob("*.py")); hits = sp.run(["rg", "-n", "-i", "speaker|gemini|mike-e|mikelev|narrator|voice", "remotes/honeybot/scripts", "imports/voice_synthesis.py"], text=True, capture_output=True).stdout.splitlines(); print("HB_SCRIPTS:", files); print("SPEAKER_HITS_N:", len(hits)); print("\n".join(hits[:45]))'
# ! .venv/bin/python -c 'import os, pathlib, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; p = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md"); raw = p.read_text(); cleaned = cl.clean_markdown(raw, label="probe", census=False); lines = [ln for ln in cleaned.splitlines() if ln.strip()]; idx = next((i for i, ln in enumerate(lines) if "Murphy Incarnate," in ln or "Wire Field Note and" in ln), 0); cl_fns = [k for k in dir(cl) if not k.startswith("__")]; st_fns = [k for k in dir(stream) if any(w in k.lower() for w in ("speak", "voice", "narrat", "chunk", "parse", "role", "mike", "gemini", "clean", "article"))]; print("CL_ATTRS:", cl_fns); print("STREAM_SPEAK_ATTRS:", st_fns); print("CLEANED_WINDOW:", lines[max(0, idx-6):idx+10])'
# ! .venv/bin/python -c 'import hashlib, os, pathlib, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; loc = {p.name: hashlib.sha256(p.read_bytes()).hexdigest()[:12] for p in sorted(pathlib.Path("remotes/honeybot/scripts").glob("*.py"))}; rcmd = "cat /tmp/honeybot_stage.json 2>/dev/null; echo; ps -eo pid,etimes,args | rg -e stream.py -e logs.py | rg -v rg; sha256sum ~/www/mikelev.in/scripts/*.py 2>/dev/null"; out = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=6", "honeybot", rcmd], env=env, text=True, capture_output=True).stdout.splitlines(); print("LOCAL_SHA12:", loc); print("HB_OUT:", out[:25])'
# # Context 3
# context.txt
# foo_files.py
# remotes/honeybot/scripts/content_loader.py
# remotes/honeybot/scripts/stream.py
# remotes/honeybot/scripts/terms.py
# imports/voice_synthesis.py
# scripts/articles/sanitizer.py
# ! .venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; raw = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md").read_text(); body = raw.split("---", 2)[2]; cleaned = cl.clean_markdown(body, label="probe", census=False); nar = stream.Narrator(); pairs = []; [pairs.extend((s["voice"], s["text"]) for s in nar.plan_utterances(re.sub(r"^\[\[HEADING:(.+)\]\]$", r"[[HEADING]]\1", ln.strip()))) for ln in cleaned.splitlines() if ln.strip() and not ln.strip().startswith(("[[PATRONUS:", "[[MEDIA:"))]; g_cnt = sum(1 for ln in cleaned.splitlines() if ln.strip().startswith("Gemini 4 Carbon High:")); v_of = lambda needle: next((v for v, t in pairs if needle in t), "MISSING"); print("GEMINI_TURNS:", g_cnt, "MURPHY_HEAD:", v_of("Murphy Incarnate, Hilchot"), "MURPHY_B1:", v_of("Why Murphy Incarnate"), "SHANNON:", v_of("The Dead Sea Scrolls"), "TURN4_GOOD_NEWS:", v_of("Good News First"))'
# ! .venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); sys.path.insert(0, "scripts/articles"); import content_loader as cl, sanitizer; from imports.voice_synthesis import ChipVoiceSystem; vs_out = ChipVoiceSystem().sanitize_text("budget (<= 5 files) and 7231 -> 9110"); vs_ok = ("5 files" in vs_out and "7231" in vs_out); bt = chr(96); san_in = f"classic **{bt}Next 10{bt} / {bt}Prev 10**{bt} pages"; san_out = sanitizer.neutralize_inception_artifacts(san_in); san_ok = san_out.endswith(f"{bt}Prev 10{bt}** pages"); posts = sorted(pathlib.Path("/home/mike/repos/trimnoir/_posts").glob("2026-*.md"))[-15:]; bodies = [(p.name, re.sub(r"^[triple-backtick][^\n]*\n.*?^[triple-backtick][ \t]*$", "", p.read_text().split("---", 2)[-1], flags=re.M | re.S)) for p in posts]; raw_ai = sum(len(re.findall(r"(?m)^[ \t]*\*\*(?:Gemini|Claude)[^*\n]+\*\*:", b)) for _, b in bodies); cln_ai = sum(len(re.findall(r"(?m)^(?:Gemini|Claude)\b[^:\n]*:", cl.clean_markdown(b, label=n, census=False))) for n, b in bodies); print("VS_SAFE:", vs_ok, "SAN_MULTI_CODE_OK:", san_ok, "RECENT15_RAW_AI_TURNS:", raw_ai, "CLEANED_AI_TURNS:", cln_ai)'
# ! .venv/bin/python -c 'import hashlib, os, pathlib, shutil, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; ruff_bin = shutil.which("ruff") or "ruff"; rf = sp.run([ruff_bin, "check", "remotes/honeybot/scripts/content_loader.py", "remotes/honeybot/scripts/terms.py", "remotes/honeybot/scripts/stream.py", "imports/voice_synthesis.py", "scripts/articles/sanitizer.py"], text=True, capture_output=True); names = ("content_loader.py", "terms.py", "stream.py"); loc = {n: hashlib.sha256((pathlib.Path("remotes/honeybot/scripts") / n).read_bytes()).hexdigest()[:12] for n in names}; rcmd = "sha256sum ~/www/mikelev.in/scripts/content_loader.py ~/www/mikelev.in/scripts/terms.py ~/www/mikelev.in/scripts/stream.py; ps -eo pid,etimes,args | rg stream.py | rg -v rg"; hb_lines = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=6", "honeybot", rcmd], env=env, text=True, capture_output=True).stdout.splitlines(); rem = {pathlib.Path(ln.split()[1]).name: ln.split()[0][:12] for ln in hb_lines if len(ln.split()) == 2 and "/" in ln.split()[1]}; pid_ln = [ln.strip() for ln in hb_lines if "stream.py" in ln and "sha256" not in ln and "/scripts/stream.py" in ln and len(ln.split()) >= 3]; print("RUFF_RC:", rf.returncode, "HB_PARITY:", loc == rem, "STREAM_PS:", pid_ln)'
# # Context 4
# context.txt
# remotes/honeybot/scripts/stream.py
# remotes/honeybot/scripts/forest.py
# remotes/honeybot/scripts/score.py
# imports/ascii_displays.py
# scripts/articles/common.py
# scripts/ytstage.py
# ! .venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; raw = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md").read_text(); body = raw.split("---", 2)[2]; cleaned = cl.clean_markdown(body, label="probe", census=False); nar = stream.Narrator(); batches = [nar.plan_utterances(re.sub(r"^\[\[HEADING:(.+)\]\]$", r"[[HEADING]]\1", ln.strip())) for ln in cleaned.splitlines() if ln.strip() and not ln.strip().startswith(("[[PATRONUS:", "[[MEDIA:"))]; pairs = [(s["voice"], s["text"]) for b in batches for s in b]; mi = next((i for i, (_, t) in enumerate(pairs) if "Murphy Incarnate, Hilchot" in t), -1); gi = next((i for i, (_, t) in enumerate(pairs) if "Good News First" in t), -1); ship_lens = [len(s["text"]) for b in batches for s in b if s["voice"] == "shipmunk"]; print("MURPHY_SLICE:", [v for v, _ in pairs[mi:mi+5]], "GOOD_NEWS_SLICE:", [v for v, _ in pairs[gi:gi+3]], "TWO_SPEC_N:", sum(1 for b in batches if len(b) == 2), "SHIP_MAX_C:", max(ship_lens), "SHIP_GT350:", sum(1 for n in ship_lens if n > 350))'
# ! .venv/bin/python -c 'import ast, os, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; code = "import shutil, subprocess as sp, sys, time\nsdir, model, p_name, f_help, f_mod, f_raw, ov, bi, lr_ov, lr_bi = sys.argv[1:11]\nsys.path.insert(0, sdir)\nimport forest\np_bin = shutil.which(p_name) or p_name\nhr = sp.run([p_bin, f_help], text=True, capture_output=True)\nhtxt = (hr.stdout + hr.stderr).lower()\ndef bp(n_words):\n txt = (ov + chr(32)) * n_words\n t0 = time.perf_counter()\n r = sp.run([p_bin, f_mod, model, f_raw], input=txt.encode(), capture_output=True)\n return round(time.perf_counter() - t0, 3), len(r.stdout)\ndef bf(fn, arg):\n t0 = time.perf_counter()\n fn(arg)\n return round(time.perf_counter() - t0, 3)\nflags = [tok for tok in htxt.split() if tok.startswith(f_help[:2])][:14]\nprint(ov.upper(), bp(3), bp(18), bp(130), flags)\nprint(bi.upper(), bf(forest.resolve_dynamic_report_speech, chr(123) + lr_ov + chr(125)), bf(forest.prerender_station_report_ansi, ov), bf(forest.resolve_dynamic_report_speech, chr(123) + lr_bi + chr(125)), bf(forest.prerender_station_report_ansi, bi))\n"; ast.parse(code); rcmd = "PATH=/etc/profiles/per-user/mike/bin:/home/mike/.nix-profile/bin:/run/current-system/sw/bin:/usr/bin:/bin:$PATH python3 - /home/mike/www/mikelev.in/scripts /home/mike/.local/share/piper_voices/en_US-amy-low.onnx piper --help --model --output_raw overview bimodal LIVE_REPORT:overview LIVE_REPORT:bimodal"; res = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=8", "honeybot", rcmd], input=code, env=env, text=True, capture_output=True); print(res.stdout.strip() or res.stderr.strip())'
# ! .venv/bin/python -c 'import pathlib, sys; sys.path.insert(0, "remotes/honeybot/scripts"); import forest; beads = [[(c, (str(v.get("label")) if isinstance(v, dict) else str(v)[:48])) for c, v in b] for b in forest.STATION_SEGMENTS]; yt_txt = pathlib.Path("scripts/ytstage.py").read_text(); cm_txt = pathlib.Path("scripts/articles/common.py").read_text(); yt_hits = [ln.strip() for ln in yt_txt.splitlines() if any(k in ln for k in ("SIGSTOP", "SIGCONT", "weebo_active", "optics_slot"))][:12]; cm_hits = [ln.strip() for ln in cm_txt.splitlines() if any(k in ln for k in ("stubborn", "graceful reboot", "weebo_active", "SIGCONT", "SIGTERM", "SIGUSR1"))][:12]; print("BEAD_COUNT:", len(beads)); [print("BEAD", i, b) for i, b in enumerate(beads)]; print("YTSTAGE_SIGS:", yt_hits); print("COMMON_REBOOT:", cm_hits)'
# Context 5
context.txt
foo_files.py
# remotes/honeybot/scripts/stream.py
# remotes/honeybot/scripts/forest.py
# imports/ascii_displays.py
! .venv/bin/python -c 'import os, pathlib, re, sys; os.environ["HONEYBOT_NO_AUDIO"] = "1"; sys.path.insert(0, "remotes/honeybot/scripts"); import content_loader as cl, stream; raw = pathlib.Path("/home/mike/repos/trimnoir/_posts/2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md").read_text(); body = raw.split("---", 2)[2]; cleaned = cl.clean_markdown(body, label="probe", census=False); nar = stream.Narrator(); batches = [nar.plan_utterances(re.sub(r"^\[\[HEADING:(.+)\]\]$", r"[[HEADING]]\1", ln.strip())) for ln in cleaned.splitlines() if ln.strip() and not ln.strip().startswith(("[[PATRONUS:", "[[MEDIA:"))]; pairs = [(s["voice"], s["text"]) for b in batches for s in b]; mi = next((i for i, (_, t) in enumerate(pairs) if "Murphy Incarnate, Hilchot" in t), -1); gi = next((i for i, (_, t) in enumerate(pairs) if "Good News First" in t), -1); first_ship = [next(len(s["text"]) for s in b if s["voice"] == "shipmunk") for b in batches if any(s["voice"] == "shipmunk" for s in b)]; nar2 = stream.Narrator(); nar2._stage_dialogue_role = "right"; nar2._reannounce_after_break = True; res_v = [s["voice"] for ln in ("[[HEADING]] Good News First", "First bullet after field note.") for s in nar2.plan_utterances(ln)]; print("MURPHY_OK:", [v for v, _ in pairs[mi:mi+5]] == ["norma", "shipmunk", "shipmunk", "shipmunk", "shipmunk"], "GOOD_OK:", [v for v, _ in pairs[gi:gi+3]] == ["norma", "shipmunk", "shipmunk"], "FIRST_SHIP_MAX_C:", max(first_ship), "RESUME_VOICES:", res_v)'
! .venv/bin/python -c 'import ast, os, subprocess as sp; env = {**os.environ, "LD_LIBRARY_PATH": ""}; code = "import sys, time\nsdir, v_norma, raw_tag, bi, lr_bi, fn_name = sys.argv[1:7]\nsys.path.insert(0, sdir)\nimport forest, stream\nnar = stream.Narrator()\nnar._synth_raw_with_voice(stream.SHIPMUNK_TURN_CUE_TEXT, v_norma)\nt0 = time.perf_counter()\nrp, _ = nar._synth_raw_with_voice(stream.SHIPMUNK_TURN_CUE_TEXT, v_norma)\ncue2 = round(time.perf_counter() - t0, 4)\nif rp:\n nar._cleanup_item((raw_tag, rp))\nt1 = time.perf_counter()\nforest.prerender_station_report_ansi(bi)\nbi_ren = round(time.perf_counter() - t1, 3)\nt2 = time.perf_counter()\nforest.resolve_dynamic_report_speech(chr(123) + lr_bi + chr(125))\nbi_spk = round(time.perf_counter() - t2, 4)\nbi_warm = -1.0\nif hasattr(forest, fn_name):\n t3 = time.perf_counter()\n getattr(forest, fn_name)(bi)\n bi_warm = round(time.perf_counter() - t3, 4)\nprint(bi.upper(), cue2, bi_ren, bi_spk, bi_warm)\n"; ast.parse(code); rcmd = "PATH=/etc/profiles/per-user/mike/bin:/home/mike/.nix-profile/bin:/run/current-system/sw/bin:/usr/bin:/bin:$PATH python3 - /home/mike/www/mikelev.in/scripts norma RAW bimodal LIVE_REPORT:bimodal ensure_station_report_prerendered"; res = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=8", "honeybot", rcmd], input=code, env=env, text=True, capture_output=True); print(res.stdout.strip() or res.stderr.strip())'
! .venv/bin/python -c 'import hashlib, inspect, os, pathlib, shutil, subprocess as sp, sys; env = {**os.environ, "LD_LIBRARY_PATH": ""}; sys.path.insert(0, "scripts/articles"); import common; from imports import ascii_displays as ad; rb_src = inspect.getsource(common.reboot_honeybot_stream); sigcont_ok = ("kill -CONT" in rb_src and "honeybot_weebo_active" in rb_src and "honeybot_optics_slot.json" in rb_src); ready_ok = ("ready_event" in inspect.signature(ad.conjure_window).parameters); ruff_bin = shutil.which("ruff") or "ruff"; rf = sp.run([ruff_bin, "check", "imports/ascii_displays.py", "remotes/honeybot/scripts/forest.py", "remotes/honeybot/scripts/stream.py", "scripts/articles/common.py"], text=True, capture_output=True); tf = sp.run([sys.executable, "remotes/honeybot/scripts/test_forest.py"], env={**os.environ, "HONEYBOT_NO_AUDIO": "1"}, text=True, capture_output=True); loc = {p.name: hashlib.sha256(p.read_bytes()).hexdigest()[:12] for p in (pathlib.Path("remotes/honeybot/scripts/stream.py"), pathlib.Path("remotes/honeybot/scripts/forest.py"), pathlib.Path("imports/ascii_displays.py"))}; rcmd = "sha256sum ~/www/mikelev.in/scripts/stream.py ~/www/mikelev.in/scripts/forest.py ~/www/mikelev.in/imports/ascii_displays.py; ps -eo pid,etimes,args | rg stream.py | rg -v rg"; hb = sp.run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=6", "honeybot", rcmd], env=env, text=True, capture_output=True).stdout.splitlines(); rem = {pathlib.Path(ln.split()[1]).name: ln.split()[0][:12] for ln in hb if len(ln.split()) == 2 and "/" in ln.split()[1]}; pid_ln = [ln.strip() for ln in hb if "/scripts/stream.py" in ln and "sha256" not in ln and len(ln.split()) >= 3]; print("REBOOT_SIGCONT_OK:", sigcont_ok, "WIN_READY_OK:", ready_ok, "RUFF_RC:", rf.returncode, "TEST_FOREST_RC:", tf.returncode, "HB_PARITY:", loc == rem, "STREAM_PS:", pid_ln)'
3: CHANGE (PATCHES):
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
GIT repo clean. Take BEFORE reading, make CHANGE, record AFTER diff.
(nix) pipulate $ patch
(nix) pipulate $ app
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'imports/ascii_displays.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'imports/ascii_displays.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'imports/ascii_displays.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/forest.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/forest.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/forest.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/forest.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/forest.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/stream.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/stream.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/stream.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/stream.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/stream.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/stream.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/stream.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/stream.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/stream.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/stream.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/stream.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/stream.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/stream.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/stream.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/stream.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'remotes/honeybot/scripts/stream.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'scripts/articles/common.py'.
✅ DETERMINISTIC PATCH APPLIED: Successfully mutated 'scripts/articles/common.py'.
(nix) pipulate $ d
diff --git a/imports/ascii_displays.py b/imports/ascii_displays.py
index dea51f3..5917ca5 100644
--- a/imports/ascii_displays.py
+++ b/imports/ascii_displays.py
@@ -349,7 +349,8 @@ def patronus(name: str, duration: float = 3.5) -> None:
def conjure_window(command, duration: float = 30.0, columns: int = 100, lines: int = 30,
cwd: Optional[str] = None, title: str = "ConjureWindow",
window_class: str = "conjure_window_overlay",
- display: Optional[str] = None, fill: bool = False) -> None:
+ display: Optional[str] = None, fill: bool = False,
+ ready_event=None) -> None:
"""🪟 CONJURE WINDOW: Run an arbitrary command in a transient Alacritty overlay.
This is the process-flavored sibling of patronus(): patronus renders a
@@ -428,6 +429,8 @@ def conjure_window(command, duration: float = 30.0, columns: int = 100, lines: i
_center_and_raise(safe_class, env, fill=fill)
elif sys_platform == "darwin":
subprocess.run(["osascript", "-e", 'tell application "Alacritty" to activate'], stdout=subprocess.DEVNULL)
+ if ready_event is not None:
+ ready_event.set()
try:
proc.wait(timeout=duration)
@@ -436,6 +439,8 @@ def conjure_window(command, duration: float = 30.0, columns: int = 100, lines: i
except Exception as e:
logger.error(f"🪟 CONJURE_WINDOW connection framework failure encountered: {e}")
finally:
+ if ready_event is not None:
+ ready_event.set()
if proc is not None and proc.poll() is None:
try:
proc.terminate()
diff --git a/remotes/honeybot/scripts/forest.py b/remotes/honeybot/scripts/forest.py
index 382b6e6..049d528 100644
--- a/remotes/honeybot/scripts/forest.py
+++ b/remotes/honeybot/scripts/forest.py
@@ -412,7 +412,81 @@ def _spoken_bot_label(raw_ua: str, known_bots=()) -> str:
return tok.replace("-", " ").replace("_", " ")
-_REPORT_META_TTL_SEC = 90.0
+import threading as _threading
+
+_REPORT_META_TTL_SEC = 240.0
+_REPORT_RENDER_LOCK = _threading.Lock()
+
+
+def _query_bimodal_totals(cur) -> tuple:
+ """Compute (eligible_html, js_telem_hits, cloud_triggers, cloud_ips, claude_triggers, claude_ips) without nested-loop LIKE scans."""
+ cur.execute(
+ """
+ SELECT COALESCE(SUM(t.count), 0)
+ FROM telemetry t
+ JOIN ips i ON t.ip_id = i.id
+ JOIN paths p ON t.path_id = p.id
+ WHERE t.served_md = 0
+ AND +i.value NOT LIKE '127.%'
+ AND +i.value NOT LIKE '10.%'
+ AND +i.value NOT LIKE '192.168.%'
+ AND +p.value NOT LIKE '%js_confirm.gif%'
+ AND +p.value NOT LIKE '/assets/%'
+ AND +p.value NOT LIKE '%.md%'
+ AND +p.value NOT LIKE '%.xml%'
+ AND +p.value NOT LIKE '%.txt%'
+ AND +p.value NOT LIKE '%.json%'
+ AND +p.value NOT LIKE '%.css%'
+ AND +p.value NOT LIKE '%.js%'
+ AND +p.value NOT LIKE '%.ico%'
+ AND +p.value NOT LIKE '%.png%'
+ AND +p.value NOT LIKE '%.jpg%'
+ AND +p.value NOT LIKE '%.jpeg%'
+ AND +p.value NOT LIKE '%.gif%'
+ AND +p.value NOT LIKE '%.svg%'
+ AND +p.value NOT LIKE '%.webp%'
+ AND +p.value NOT LIKE '%.woff%'
+ AND +p.value NOT LIKE '%.ttf%'
+ AND +p.value NOT LIKE '%.zip%'
+ AND +p.value NOT LIKE '%.sh%'
+ """
+ )
+ eligible_html = int((cur.fetchone() or [0])[0] or 0)
+ cur.execute("SELECT id FROM paths WHERE value LIKE '%js_confirm.gif%'")
+ js_pids = [int(r[0]) for r in cur.fetchall() if r and r[0] is not None]
+ if not js_pids:
+ return eligible_html, 0, 0, 0, 0, 0
+ if len(js_pids) <= 500:
+ pid_clause = f"t.path_id IN ({','.join(str(pid) for pid in js_pids)})"
+ cte_prefix = ""
+ join_js = ""
+ else:
+ cte_prefix = "WITH js_p AS MATERIALIZED (SELECT id FROM paths WHERE value LIKE '%js_confirm.gif%') "
+ join_js = "JOIN js_p ON t.path_id = js_p.id "
+ pid_clause = "1=1"
+ cur.execute(
+ f"""
+ {cte_prefix}SELECT
+ COALESCE(SUM(CASE WHEN +i.value NOT LIKE '127.%' AND +i.value NOT LIKE '10.%' AND +i.value NOT LIKE '192.168.%' THEN t.count ELSE 0 END), 0),
+ COALESCE(SUM(CASE WHEN (+i.value LIKE '34.%' OR +i.value LIKE '35.%' OR +i.value LIKE '136.65.%') AND +ua.value LIKE 'Mozilla%' AND +ua.value NOT LIKE '%compatible%' THEN t.count ELSE 0 END), 0),
+ COUNT(DISTINCT CASE WHEN (+i.value LIKE '34.%' OR +i.value LIKE '35.%' OR +i.value LIKE '136.65.%') AND +ua.value LIKE 'Mozilla%' AND +ua.value NOT LIKE '%compatible%' THEN i.id END),
+ COALESCE(SUM(CASE WHEN +ua.value LIKE '%ClaudeBot%' AND +i.value NOT LIKE '127.%' AND +i.value NOT LIKE '10.%' AND +i.value NOT LIKE '192.168.%' THEN t.count ELSE 0 END), 0),
+ COUNT(DISTINCT CASE WHEN +ua.value LIKE '%ClaudeBot%' AND +i.value NOT LIKE '127.%' AND +i.value NOT LIKE '10.%' AND +i.value NOT LIKE '192.168.%' THEN i.id END)
+ FROM telemetry t
+ {join_js}JOIN ips i ON t.ip_id = i.id
+ JOIN user_agents ua ON t.ua_id = ua.id
+ WHERE {pid_clause}
+ """
+ )
+ row = cur.fetchone() or (0, 0, 0, 0, 0)
+ return (
+ eligible_html,
+ int(row[0] or 0),
+ int(row[1] or 0),
+ int(row[2] or 0),
+ int(row[3] or 0),
+ int(row[4] or 0),
+ )
def _approx_count_words(n: int) -> str:
@@ -518,6 +592,33 @@ def _format_bimodal_speech(eligible_html: int, js_horizon_hits: int, js_pct: flo
def resolve_dynamic_report_speech(text: str) -> str:
"""Replace {LIVE_REPORT:overview} or {LIVE_REPORT:bimodal} using the chart's own snapshot + 'about' upward rounding."""
s = str(text or "")
+ if "{LIVE_REPORT:" not in s:
+ return s
+ if "{LIVE_REPORT:overview}" in s:
+ snap_ov = _read_report_speech_snapshot("overview")
+ if snap_ov and snap_ov.get("top_bots"):
+ s = s.replace(
+ "{LIVE_REPORT:overview}",
+ _format_overview_speech(
+ int(snap_ov["total_hits"]),
+ int(snap_ov["md_reads"]),
+ int(snap_ov["total_cneg"]),
+ float(snap_ov["md_pct"]),
+ snap_ov["top_bots"],
+ ),
+ )
+ if "{LIVE_REPORT:bimodal}" in s:
+ snap_bi = _read_report_speech_snapshot("bimodal")
+ if snap_bi and snap_bi.get("top_bots"):
+ s = s.replace(
+ "{LIVE_REPORT:bimodal}",
+ _format_bimodal_speech(
+ int(snap_bi["eligible_html"]),
+ int(snap_bi["js_horizon_hits"]),
+ float(snap_bi["js_pct"]),
+ snap_bi["top_bots"],
+ ),
+ )
if "{LIVE_REPORT:" not in s:
return s
import os
@@ -594,66 +695,6 @@ def resolve_dynamic_report_speech(text: str) -> str:
if "{LIVE_REPORT:bimodal}" in s:
try:
- cur.execute(
- """
- SELECT COALESCE(SUM(t.count), 0)
- FROM telemetry t
- JOIN ips i ON t.ip_id = i.id
- JOIN paths p ON t.path_id = p.id
- WHERE t.served_md = 0
- AND i.value NOT LIKE '127.%'
- AND i.value NOT LIKE '10.%'
- AND i.value NOT LIKE '192.168.%'
- AND p.value NOT LIKE '%js_confirm.gif%'
- AND p.value NOT LIKE '/assets/%'
- AND p.value NOT LIKE '%.md%'
- AND p.value NOT LIKE '%.xml%'
- AND p.value NOT LIKE '%.txt%'
- AND p.value NOT LIKE '%.json%'
- AND p.value NOT LIKE '%.css%'
- AND p.value NOT LIKE '%.js%'
- AND p.value NOT LIKE '%.ico%'
- AND p.value NOT LIKE '%.png%'
- AND p.value NOT LIKE '%.jpg%'
- AND p.value NOT LIKE '%.jpeg%'
- AND p.value NOT LIKE '%.gif%'
- AND p.value NOT LIKE '%.svg%'
- AND p.value NOT LIKE '%.webp%'
- AND p.value NOT LIKE '%.woff%'
- AND p.value NOT LIKE '%.ttf%'
- AND p.value NOT LIKE '%.zip%'
- AND p.value NOT LIKE '%.sh%'
- """
- )
- eligible_html = int((cur.fetchone() or [0])[0] or 0)
- cur.execute(
- """
- SELECT COALESCE(SUM(t.count), 0)
- FROM telemetry t
- JOIN ips i ON t.ip_id = i.id
- JOIN paths p ON t.path_id = p.id
- WHERE p.value LIKE '%js_confirm.gif%'
- AND i.value NOT LIKE '127.%'
- AND i.value NOT LIKE '10.%'
- AND i.value NOT LIKE '192.168.%'
- """
- )
- js_telem_hits = int((cur.fetchone() or [0])[0] or 0)
- cur.execute(
- """
- SELECT COALESCE(SUM(t.count), 0), COUNT(DISTINCT i.id)
- FROM telemetry t
- JOIN ips i ON t.ip_id = i.id
- JOIN user_agents ua ON t.ua_id = ua.id
- JOIN paths p ON t.path_id = p.id
- WHERE p.value LIKE '%js_confirm.gif%'
- AND (i.value LIKE '34.%' OR i.value LIKE '35.%' OR i.value LIKE '136.65.%')
- AND ua.value LIKE 'Mozilla%'
- AND ua.value NOT LIKE '%compatible%'
- """
- )
- cloud_row = cur.fetchone() or (0, 0)
- cloud_triggers, cloud_ips = int(cloud_row[0] or 0), int(cloud_row[1] or 0)
snap_bi = _read_report_speech_snapshot("bimodal")
if snap_bi and snap_bi.get("top_bots"):
live_bi = _format_bimodal_speech(
@@ -663,22 +704,14 @@ def resolve_dynamic_report_speech(text: str) -> str:
snap_bi["top_bots"],
)
else:
- cur.execute(
- """
- SELECT COALESCE(SUM(t.count), 0), COUNT(DISTINCT i.id)
- FROM telemetry t
- JOIN ips i ON t.ip_id = i.id
- JOIN user_agents ua ON t.ua_id = ua.id
- JOIN paths p ON t.path_id = p.id
- WHERE p.value LIKE '%js_confirm.gif%'
- AND ua.value LIKE '%ClaudeBot%'
- AND i.value NOT LIKE '127.%'
- AND i.value NOT LIKE '10.%'
- AND i.value NOT LIKE '192.168.%'
- """
- )
- c_row = cur.fetchone() or (0, 0)
- c_triggers, c_ips = int(c_row[0] or 0), int(c_row[1] or 0)
+ (
+ eligible_html,
+ js_telem_hits,
+ cloud_triggers,
+ cloud_ips,
+ c_triggers,
+ c_ips,
+ ) = _query_bimodal_totals(cur)
js_rows = list(db.get_js_executors(limit=25))
if cloud_triggers > 0:
js_rows.append((
@@ -748,82 +781,15 @@ def _build_station_report_panel(mode="overview", panel_width=None):
tbl = Table(expand=True, show_header=True, header_style="bold cyan", border_style="bright_blue")
if mode in ("bimodal", "trapdoor"):
- cur.execute(
- """
- SELECT COALESCE(SUM(t.count), 0)
- FROM telemetry t
- JOIN ips i ON t.ip_id = i.id
- JOIN paths p ON t.path_id = p.id
- WHERE t.served_md = 0
- AND i.value NOT LIKE '127.%'
- AND i.value NOT LIKE '10.%'
- AND i.value NOT LIKE '192.168.%'
- AND p.value NOT LIKE '%js_confirm.gif%'
- AND p.value NOT LIKE '/assets/%'
- AND p.value NOT LIKE '%.md%'
- AND p.value NOT LIKE '%.xml%'
- AND p.value NOT LIKE '%.txt%'
- AND p.value NOT LIKE '%.json%'
- AND p.value NOT LIKE '%.css%'
- AND p.value NOT LIKE '%.js%'
- AND p.value NOT LIKE '%.ico%'
- AND p.value NOT LIKE '%.png%'
- AND p.value NOT LIKE '%.jpg%'
- AND p.value NOT LIKE '%.jpeg%'
- AND p.value NOT LIKE '%.gif%'
- AND p.value NOT LIKE '%.svg%'
- AND p.value NOT LIKE '%.webp%'
- AND p.value NOT LIKE '%.woff%'
- AND p.value NOT LIKE '%.ttf%'
- AND p.value NOT LIKE '%.zip%'
- AND p.value NOT LIKE '%.sh%'
- """
- )
- eligible_html_hits = int((cur.fetchone() or [1])[0] or 1)
- cur.execute(
- """
- SELECT COALESCE(SUM(t.count), 0)
- FROM telemetry t
- JOIN ips i ON t.ip_id = i.id
- JOIN paths p ON t.path_id = p.id
- WHERE p.value LIKE '%js_confirm.gif%'
- AND i.value NOT LIKE '127.%'
- AND i.value NOT LIKE '10.%'
- AND i.value NOT LIKE '192.168.%'
- """
- )
- js_telem_hits = int((cur.fetchone() or [0])[0] or 0)
- cur.execute(
- """
- SELECT COALESCE(SUM(t.count), 0), COUNT(DISTINCT i.id)
- FROM telemetry t
- JOIN ips i ON t.ip_id = i.id
- JOIN user_agents ua ON t.ua_id = ua.id
- JOIN paths p ON t.path_id = p.id
- WHERE p.value LIKE '%js_confirm.gif%'
- AND (i.value LIKE '34.%' OR i.value LIKE '35.%' OR i.value LIKE '136.65.%')
- AND ua.value LIKE 'Mozilla%'
- AND ua.value NOT LIKE '%compatible%'
- """
- )
- cloud_row = cur.fetchone() or (0, 0)
- cloud_triggers, cloud_ips = int(cloud_row[0] or 0), int(cloud_row[1] or 0)
- cur.execute(
- """
- SELECT COALESCE(SUM(t.count), 0), COUNT(DISTINCT i.id)
- FROM telemetry t
- JOIN ips i ON t.ip_id = i.id
- JOIN user_agents ua ON t.ua_id = ua.id
- JOIN paths p ON t.path_id = p.id
- WHERE p.value LIKE '%js_confirm.gif%'
- AND ua.value LIKE '%ClaudeBot%'
- AND i.value NOT LIKE '127.%'
- AND i.value NOT LIKE '10.%'
- AND i.value NOT LIKE '192.168.%'
- """
- )
- claude_row = cur.fetchone() or (0, 0)
- claude_triggers, claude_ips = int(claude_row[0] or 0), int(claude_row[1] or 0)
+ (
+ raw_elig_html,
+ js_telem_hits,
+ cloud_triggers,
+ cloud_ips,
+ claude_triggers,
+ claude_ips,
+ ) = _query_bimodal_totals(cur)
+ eligible_html_hits = max(1, int(raw_elig_html or 1))
js_rows = list(db.get_js_executors(limit=25))
if cloud_triggers > 0:
js_rows.append((
@@ -1323,6 +1289,29 @@ def prerender_station_report_ansi(
return str(target)
+def ensure_station_report_prerendered(
+ mode="overview",
+ width=REPORT_WINDOW_COLUMNS,
+ height=REPORT_WINDOW_LINES,
+ max_age=_REPORT_META_TTL_SEC,
+):
+ """Return a fresh pre-rendered .ansi path, coalescing concurrent pre-warm and window-open callers under one lock."""
+ import time
+ from pathlib import Path
+ safe_mode = "".join(c for c in str(mode or "overview") if c.isalnum() or c in ("_", "-")) or "overview"
+ target = Path(f"/tmp/honeybot_report_{safe_mode}.ansi")
+ with _REPORT_RENDER_LOCK:
+ try:
+ if target.is_file() and target.stat().st_size > 0:
+ age = time.time() - target.stat().st_mtime
+ if age <= float(max_age):
+ if safe_mode not in ("overview", "bimodal", "trapdoor") or _read_report_speech_snapshot(safe_mode, max_age=max_age):
+ return str(target)
+ except OSError:
+ pass
+ return prerender_station_report_ansi(mode=safe_mode, width=width, height=height, out_path=target)
+
+
def render_station_report(mode="overview", hold_seconds=REPORT_WINDOW_CAP_SECONDS):
"""Render a live Python Rich horizontal bar-chart report in an Alacritty overlay window."""
import time
diff --git a/remotes/honeybot/scripts/stream.py b/remotes/honeybot/scripts/stream.py
index 8f35f37..f6257eb 100644
--- a/remotes/honeybot/scripts/stream.py
+++ b/remotes/honeybot/scripts/stream.py
@@ -56,7 +56,7 @@ def _reap_orphaned_tts_and_overlays():
except Exception:
continue
if _is_singleton_owner and os.environ.get("HONEYBOT_NO_AUDIO") != "1":
- for pat in ("conjure_window_overlay", "patronus_visual_shield", "honeybot_media_overlay", "firefox"):
+ for pat in ("conjure_window_overlay", "patronus_visual_shield", "honeybot_media_overlay", "HONEYBOT_LIVE_VIM", "firefox"):
try:
subprocess.run(["pkill", "-f", pat], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=False)
except Exception:
@@ -67,7 +67,15 @@ def _reap_orphaned_tts_and_overlays():
tmp_f.unlink(missing_ok=True)
except OSError:
pass
- for sentinel in ("/tmp/honeybot_weebo_active", "/tmp/honeybot_optics_slot.json"):
+ for cue_f in Path("/tmp").glob("honeybot_cue_*.raw"):
+ try:
+ parts = cue_f.stem.split("_")
+ owner_pid = int(parts[2]) if len(parts) >= 3 and parts[2].isdigit() else 0
+ if _shutting_down.is_set() or (owner_pid != my_pid and not Path(f"/proc/{owner_pid}").exists()):
+ cue_f.unlink(missing_ok=True)
+ except OSError:
+ pass
+ for sentinel in ("/tmp/honeybot_weebo_active", "/tmp/honeybot_optics_slot.json", "/tmp/honeybot_ytstage_paused.json"):
try:
Path(sentinel).unlink(missing_ok=True)
except OSError:
@@ -602,6 +610,8 @@ class Narrator(threading.Thread):
self._play_lock = threading.Lock()
self._active_procs = []
self._tts_seq = 0
+ self._cue_cache = {}
+ self._cue_lock = threading.Lock()
self._dialogue_rate = NORMA_TTS_SAMPLE_RATE
self._speaker_rate = NORMA_TTS_SAMPLE_RATE
self._stage_dialogue_role = "prologue"
@@ -661,8 +671,39 @@ class Narrator(threading.Thread):
return self._make_spec("mike", clean, "left", "active", "inactive")
return self._make_spec("norma", clean, "narrator", "inactive", "inactive")
+ def _split_fast_start_specs(self, specs: list) -> list:
+ """Split the opening clause/sentence of long Mike/Shipmunk turns so voice-switch audio starts immediately."""
+ if not specs:
+ return []
+ out = []
+ split_done = False
+ for spec in specs:
+ txt = (spec.get("text") or "").strip()
+ if not split_done and spec.get("voice") in ("mike", "shipmunk") and len(txt) > 220:
+ split_pos = None
+ m_sent = re.search(r"(?<!\bMr)(?<!\bMs)(?<!\bDr)(?<!\bvs)[.!?]\s+(?=[A-Z0-9\"'(])", txt[45:255])
+ if m_sent:
+ split_pos = 45 + m_sent.end()
+ else:
+ m_cl = re.search(r"(?:[;:]\s+|—\s*|,\s+)", txt[65:210])
+ if m_cl:
+ split_pos = 65 + m_cl.end()
+ if split_pos and 40 <= split_pos < (len(txt) - 35):
+ head = txt[:split_pos].strip()
+ tail = txt[split_pos:].strip()
+ if head and tail:
+ out.append(dict(spec, text=head))
+ out.append(dict(spec, text=tail))
+ split_done = True
+ continue
+ out.append(spec)
+ return out
+
def plan_utterances(self, text: str) -> list:
- """Plan 1 or 2 zero-lag utterance specs across Norma Centroid, Mike-E, and Shipmunk O'Theseus!"""
+ """Plan zero-lag utterance specs across Norma Centroid, Mike-E, and Shipmunk O'Theseus!"""
+ return self._split_fast_start_specs(self._plan_utterances_core(text))
+
+ def _plan_utterances_core(self, text: str) -> list:
raw = (text or "").strip()
if not raw:
return []
@@ -833,29 +874,64 @@ class Narrator(threading.Thread):
return write_stage_state("narrator", "curtain", "curtain", "", 0.0, stage_path=stage_path)
def _cleanup_item(self, item):
- """Remove any unplayed pre-synthesized .raw file when flushing the queue."""
+ """Remove any unplayed pre-synthesized .raw file when flushing the queue (preserving static turn-cue cache)."""
if isinstance(item, tuple) and len(item) >= 2 and item[0] == "RAW":
raw_path = item[1]
- if raw_path and os.path.exists(raw_path):
+ if raw_path and os.path.exists(raw_path) and not os.path.basename(str(raw_path)).startswith("honeybot_cue_"):
try:
os.remove(raw_path)
except OSError:
pass
def _synth_raw_with_voice(self, text: str, voice_key: str) -> tuple:
- """Synthesize `text` using `voice_key` ('norma'|'mike'|'shipmunk'); returns (raw_path, actual_rate) or (None, 0)."""
- if not text or not shutil.which("piper"):
+ """Synthesize `text` using `voice_key` ('norma'|'mike'|'shipmunk'); caches static turn cues for 0ms switches."""
+ if not text or os.environ.get("HONEYBOT_NO_AUDIO") == "1" or not shutil.which("piper"):
return None, 0
model_path, actual_rate = self.resolve_voice_target(voice_key)
if not model_path.exists():
return None, 0
+ clean_text = text.strip()
+ vk = (voice_key or "norma").strip().lower()
+ static_cues = {
+ MIKE_TURN_CUE_TEXT,
+ SHIPMUNK_TURN_CUE_TEXT,
+ _polish_tts_text(MIKE_TURN_CUE_TEXT),
+ _polish_tts_text(SHIPMUNK_TURN_CUE_TEXT),
+ }
+ if clean_text in static_cues:
+ with self._cue_lock:
+ cached = self._cue_cache.get((vk, clean_text))
+ if cached and os.path.exists(cached[0]) and os.path.getsize(cached[0]) > 0:
+ return cached
+ cue_path = f"/tmp/honeybot_cue_{os.getpid()}_{vk}_{len(self._cue_cache) + 1}.raw"
+ try:
+ with open(cue_path, "wb") as out_f:
+ res = subprocess.run(
+ ["piper", "--model", str(model_path), "--output_raw"],
+ input=clean_text.encode("utf-8"),
+ stdout=out_f,
+ stderr=subprocess.DEVNULL,
+ timeout=30,
+ check=False,
+ )
+ if res.returncode == 0 and os.path.exists(cue_path) and os.path.getsize(cue_path) > 0:
+ self._cue_cache[(vk, clean_text)] = (cue_path, actual_rate)
+ return cue_path, actual_rate
+ except Exception:
+ pass
+ if os.path.exists(cue_path):
+ try:
+ os.remove(cue_path)
+ except OSError:
+ pass
+ return None, 0
self._tts_seq += 1
raw_path = f"/tmp/honeybot_tts_{os.getpid()}_{self._tts_seq}.raw"
try:
with open(raw_path, "wb") as out_f:
res = subprocess.run(
["piper", "--model", str(model_path), "--output_raw"],
- input=text.strip().encode("utf-8"),
+ input=clean_text.encode("utf-8"),
stdout=out_f,
stderr=subprocess.DEVNULL,
timeout=30,
@@ -872,6 +948,13 @@ class Narrator(threading.Thread):
pass
return None, 0
+ def warm_turn_cues(self) -> None:
+ """Pre-render both static Norma speaker-introduction cues during the 5s boot grace."""
+ if os.environ.get("HONEYBOT_NO_AUDIO") == "1":
+ return
+ for cue_txt in (_polish_tts_text(MIKE_TURN_CUE_TEXT), _polish_tts_text(SHIPMUNK_TURN_CUE_TEXT)):
+ self._synth_raw_with_voice(cue_txt, "norma")
+
def prep_raw(self, text, voice_key: str = None):
"""Pre-synthesize card narration into a .raw PCM file before showing a card."""
vk = voice_key or ("mike" if self.live_operator_mode.is_set() else "norma")
@@ -993,13 +1076,14 @@ class Narrator(threading.Thread):
conjure_patronus(str(payload))
elif isinstance(item, tuple) and item and item[0] == "WINDOW":
win_script, win_dur, win_args = item[1]
+ win_ready = threading.Event()
threading.Thread(
target=conjure_window,
args=(win_script,),
- kwargs={"duration": win_dur, "args": win_args},
+ kwargs={"duration": win_dur, "args": win_args, "ready_event": win_ready},
daemon=True,
).start()
- time.sleep(0.5)
+ win_ready.wait(timeout=25.0)
elif isinstance(item, tuple) and item and item[0] == "MEDIA":
threading.Thread(
target=conjure_media,
@@ -1025,7 +1109,7 @@ class Narrator(threading.Thread):
else:
self._speak_now(item)
self.queue.task_done()
- time.sleep(0.1)
+ time.sleep(0.02)
except queue.Empty:
continue
@@ -1094,11 +1178,13 @@ class Narrator(threading.Thread):
"""Play a pre-synthesized .raw file immediately via aplay and unlink when done."""
if not raw_path or not os.path.exists(raw_path):
return
+ is_cached_cue = os.path.basename(str(raw_path)).startswith("honeybot_cue_")
if self.stop_event.is_set():
- try:
- os.remove(raw_path)
- except OSError:
- pass
+ if not is_cached_cue:
+ try:
+ os.remove(raw_path)
+ except OSError:
+ pass
return
rate = int(sample_rate or self._speaker_rate or NORMA_TTS_SAMPLE_RATE)
with self._play_lock:
@@ -1131,7 +1217,7 @@ class Narrator(threading.Thread):
except Exception:
pass
self._active_procs = []
- if os.path.exists(raw_path):
+ if os.path.exists(raw_path) and not is_cached_cue:
try:
os.remove(raw_path)
except OSError:
@@ -2311,7 +2397,7 @@ def conjure_media(media_spec, duration=15.0, mute=False, _direct=False):
shutil.rmtree(tmp_profile, ignore_errors=True)
-def conjure_window(script_name, duration=30.0, columns=100, lines=30, args=None):
+def conjure_window(script_name, duration=30.0, columns=100, lines=30, args=None, ready_event=None):
"""Process-flavored sibling to conjure_patronus.
Keep the sheet-music API ("report.py" or "report.py:seconds") local to the
@@ -2322,12 +2408,16 @@ def conjure_window(script_name, duration=30.0, columns=100, lines=30, args=None)
os.environ.update(_hydrate_honeybot_x11_env())
safe_script = "".join(c for c in str(script_name).strip() if c.isalnum() or c in {"_", "-", "."})
if not safe_script:
+ if ready_event is not None:
+ ready_event.set()
return
duration = max(0.75, min(600.0, float(duration)))
script_dir = Path(__file__).resolve().parent
script_path = script_dir / safe_script
if not script_path.exists():
+ if ready_event is not None:
+ ready_event.set()
return
site_root = Path(__file__).resolve().parents[1]
@@ -2381,11 +2471,11 @@ def conjure_window(script_name, duration=30.0, columns=100, lines=30, args=None)
from forest import (
REPORT_WINDOW_COLUMNS,
REPORT_WINDOW_LINES,
- prerender_station_report_ansi,
+ ensure_station_report_prerendered,
)
columns = REPORT_WINDOW_COLUMNS
lines = REPORT_WINDOW_LINES
- ansi_path = prerender_station_report_ansi(
+ ansi_path = ensure_station_report_prerendered(
mode=mode_arg,
width=columns,
height=lines,
@@ -2410,16 +2500,21 @@ def conjure_window(script_name, duration=30.0, columns=100, lines=30, args=None)
if args:
cmd += [str(a) for a in args]
- shared_conjure_window(
- cmd,
- duration=duration,
- columns=columns,
- lines=lines,
- cwd=str(script_dir),
- title="ConjureWindow",
- window_class="conjure_window_overlay",
- display=os.environ.get("DISPLAY") or ":10.0",
- )
+ try:
+ shared_conjure_window(
+ cmd,
+ duration=duration,
+ columns=columns,
+ lines=lines,
+ cwd=str(script_dir),
+ title="ConjureWindow",
+ window_class="conjure_window_overlay",
+ display=os.environ.get("DISPLAY") or ":10.0",
+ ready_event=ready_event,
+ )
+ finally:
+ if ready_event is not None:
+ ready_event.set()
_card_seq = 0
@@ -2779,37 +2874,49 @@ def dispatch_cue(command, content, env, profile_dir, pace_say=True):
except Exception:
pass
if pace_say:
- # Double-buffered 3-voice synthesis: plan 1-or-2 utterances (Norma cue +
- # Mike-E / Shipmunk body), pre-render .raw PCM while prior audio plays,
- # then enqueue on the real ALSA voice clock for zero-lag curtain lifts.
+ # Pipelined 3-voice synthesis: static turn cues hit /tmp cache in 0ms and
+ # long turns split on their opening sentence so stage highlights flip immediately
+ # while the remainder synthesizes behind active ALSA playback.
specs = narrator.plan_utterances(content)
if not specs:
return
- raw_batch = narrator.prep_specs_raw(specs)
- if raw_batch is not None:
- wait_for_voice_or_live_interrupt(env, profile_dir)
- if has_pending_update():
- for r_path, _, _ in raw_batch:
- narrator._cleanup_item(("RAW", r_path))
+ static_cue_texts = {
+ MIKE_TURN_CUE_TEXT,
+ SHIPMUNK_TURN_CUE_TEXT,
+ _polish_tts_text(MIKE_TURN_CUE_TEXT),
+ _polish_tts_text(SHIPMUNK_TURN_CUE_TEXT),
+ }
+ for idx, spec in enumerate(specs):
+ if has_pending_update() or _shutting_down.is_set():
return
- if (
- narrator._reannounce_after_break
- and narrator._stage_dialogue_role in ("left", "right")
- and len(specs) == 1
- ):
- for r_path, _, _ in raw_batch:
- narrator._cleanup_item(("RAW", r_path))
- specs = narrator.plan_utterances(content)
- raw_batch = narrator.prep_specs_raw(specs)
- if raw_batch is None:
- narrator.enqueue_specs(specs)
+ raw_batch = narrator.prep_specs_raw([spec])
+ if raw_batch is not None:
+ wait_for_voice_or_live_interrupt(env, profile_dir)
+ if has_pending_update() or _shutting_down.is_set():
+ for r_path, _, _ in raw_batch:
+ narrator._cleanup_item(("RAW", r_path))
return
- elif len(specs) >= 2:
- narrator._reannounce_after_break = False
- narrator.play_specs_raw(raw_batch)
- else:
- narrator.enqueue_specs(specs)
- time.sleep(len(str(content)) / 20)
+ if (
+ idx == 0
+ and narrator._reannounce_after_break
+ and narrator._stage_dialogue_role in ("left", "right")
+ and spec.get("voice") in ("mike", "shipmunk")
+ ):
+ narrator._reannounce_after_break = False
+ cue_spec = (
+ narrator._make_spec("norma", MIKE_TURN_CUE_TEXT, "narrator", "curtain", "inactive")
+ if narrator._stage_dialogue_role == "left"
+ else narrator._make_spec("norma", SHIPMUNK_TURN_CUE_TEXT, "narrator", "inactive", "curtain")
+ )
+ cue_batch = narrator.prep_specs_raw([cue_spec])
+ if cue_batch:
+ narrator.play_specs_raw(cue_batch)
+ elif idx == 0 and spec.get("text") in static_cue_texts:
+ narrator._reannounce_after_break = False
+ narrator.play_specs_raw(raw_batch)
+ else:
+ narrator.enqueue_specs([spec])
+ time.sleep(len(str(spec.get("text", ""))) / 20)
else:
narrator.say(content)
@@ -3001,6 +3108,13 @@ def run_live_message(msg, env, profile_dir):
if "MIKE" in str(card_label or "").upper() and not window_spec and not patronus_key:
narrator.live_operator_mode.set()
hold = float(msg.get("duration", 120.0)) if isinstance(msg, dict) else 120.0
+ if window_spec and str(window_spec).startswith("forest.py"):
+ w_parts = str(window_spec).split(":", 2)
+ w_mode = w_parts[2].strip() if len(w_parts) > 2 and w_parts[2].strip() else "overview"
+ threading.Thread(
+ target=lambda m=w_mode: (_reload_forest_module() and getattr(_forest_mod, "ensure_station_report_prerendered", lambda *_: None)(m)),
+ daemon=True,
+ ).start()
# Pre-synthesize during the pre-banner silence so the 3.0s palate cleanser
# absorbs Piper synthesis time and the banner speaks the instant it pops.
raw_path = narrator.prep_raw(say_text) if say_text else None
@@ -3021,13 +3135,23 @@ def run_live_message(msg, env, profile_dir):
).start()
time.sleep(0.4)
elif window_spec:
+ w_parts = str(window_spec).split(":", 2)
+ w_script = w_parts[0].strip()
+ w_dur = hold
+ if len(w_parts) > 1 and w_parts[1].strip():
+ try:
+ w_dur = float(w_parts[1].strip())
+ except ValueError:
+ w_dur = hold
+ w_args = [w_parts[2].strip()] if (len(w_parts) > 2 and w_parts[2].strip()) else None
+ win_ready = threading.Event()
threading.Thread(
- target=dispatch_cue,
- args=("WINDOW", window_spec, env, profile_dir),
- kwargs={"pace_say": True},
+ target=conjure_window,
+ args=(w_script,),
+ kwargs={"duration": w_dur, "args": w_args, "ready_event": win_ready},
daemon=True,
).start()
- time.sleep(0.4)
+ win_ready.wait(timeout=25.0)
if say_text:
narrator.play_raw(raw_path, fallback_text=say_text)
narrator.queue.join()
@@ -3101,18 +3225,24 @@ def run_station_break(env, profile_dir):
# finishes instead of being clipped mid-word -- only the queued backlog is
# dropped. The queue.join() below then rides the real voice clock, so the
# lead-in lands after the current line ends, not on top of it.
+ report_modes = []
+ for cue_cmd, cue_val in bead:
+ if cue_cmd == "WINDOW" and str(cue_val).startswith("forest.py"):
+ w_parts = str(cue_val).split(":", 2)
+ report_modes.append(w_parts[2].strip() if len(w_parts) > 2 and w_parts[2].strip() else "overview")
+ if report_modes:
+ def _prewarm_bead_reports(modes=tuple(report_modes)):
+ try:
+ from forest import ensure_station_report_prerendered
+ for m in modes:
+ ensure_station_report_prerendered(mode=m)
+ except Exception:
+ pass
+ threading.Thread(target=_prewarm_bead_reports, daemon=True).start()
+ wait_for_voice_or_live_interrupt(env, profile_dir)
prev_dialogue_role = narrator._stage_dialogue_role
narrator.exclusive_mode.set()
try:
- dropped = narrator.flush_queue()
- if dropped:
- # MEANINGFUL SILENCE OVER UNCONDITIONAL CHATTER: gated on the
- # interesting case, so a healthy pipeline says nothing and an unhealthy
- # one says exactly how unhealthy. Deliberately NOT added to interrupt()
- # -- there, dropping the backlog is the INTENT (you are cutting to
- # breaking news); here it is collateral.
- print(f"📉 STATION BREAK DROPPED {dropped} unspoken item(s) -- "
- f"director ran ahead of the voice; that text was never heard.")
dispatch_cue(
"CARD",
{
@@ -3190,7 +3320,12 @@ def announce_scheduled_reboot():
try:
stop_storytime_bgm()
narrator.interrupt()
- for pat in ("conjure_window_overlay", "patronus_visual_shield", MEDIA_OVERLAY_MARKER, "firefox"):
+ for sentinel in ("/tmp/honeybot_weebo_active", "/tmp/honeybot_optics_slot.json", "/tmp/honeybot_ytstage_paused.json"):
+ try:
+ Path(sentinel).unlink(missing_ok=True)
+ except OSError:
+ pass
+ for pat in ("conjure_window_overlay", "patronus_visual_shield", MEDIA_OVERLAY_MARKER, "HONEYBOT_LIVE_VIM", "firefox"):
try:
subprocess.run(["pkill", "-f", pat], check=False)
except Exception:
@@ -3431,6 +3566,7 @@ def start_director_track():
"""The Script for the Show. Runs in parallel to the Log Stream."""
t_boot = time.time()
ensure_cast_voice_models()
+ narrator.warm_turn_cues()
rem_boot = 5.0 - (time.time() - t_boot)
if rem_boot > 0:
time.sleep(rem_boot)
diff --git a/scripts/articles/common.py b/scripts/articles/common.py
index 11034c2..f0b5624 100644
--- a/scripts/articles/common.py
+++ b/scripts/articles/common.py
@@ -3453,12 +3453,29 @@ def reboot_honeybot_stream(sync_only=False, dry_run=False):
if sync_only:
print("✅ Honeybot scripts synced (stream.py left running; new standby text will load on next .deploy_standby).")
return 0
+ subprocess.run(
+ ["tmux", "kill-session", "-t", "ytbreaks"],
+ stdout=subprocess.DEVNULL,
+ stderr=subprocess.DEVNULL,
+ check=False,
+ )
+ subprocess.run(
+ ["pkill", "-f", "15001:127[.]0[.]0[.]1:5001"],
+ stdout=subprocess.DEVNULL,
+ stderr=subprocess.DEVNULL,
+ check=False,
+ )
+ Path("/tmp/pipulate_ytstage_audio.json").unlink(missing_ok=True)
print(f"🔄 Signaling Honeybot stream.py on {HONEYBOT_SSH_HOST} for graceful SCHEDULED REBOOT announcement...")
remote_sh = r"""
pattern="/home/mike/www/mikelev[.]in/scripts/stream[.]py"
+rm -f /tmp/honeybot_weebo_active /tmp/honeybot_optics_slot.json /tmp/honeybot_ytstage_paused.json 2>/dev/null || true
+pkill -f "[/]tmp/honeybot_ytapp_profile|HONEYBOT_LIVE_VIM|honeybot_media_overlay|conjure_window_overlay|patronus_visual_shield" 2>/dev/null || true
+pkill -CONT -f "/home/mike/www/mikelev[.]in/scripts/logs[.]py|aplay|piper" 2>/dev/null || true
old_pids=$(pgrep -f -- "$pattern" || true)
for old in $old_pids; do
echo " signaling stream.py pid=$old for graceful reboot announcement..."
+ kill -CONT "$old" 2>/dev/null || true
kill -TERM "$old" 2>/dev/null || true
done
for wait_s in $(seq 1 25); do
@@ -3480,8 +3497,9 @@ for old in $old_pids; do
kill -KILL "$old" 2>/dev/null || true
fi
done
-pkill -9 -f "aplay.*-t raw|honeybot_tts|piper.*output_raw" 2>/dev/null || true
-rm -f /tmp/honeybot_tts_*.raw 2>/dev/null || true
+pkill -9 -f "aplay.*-t raw|honeybot_tts|honeybot_cue|piper.*output_raw" 2>/dev/null || true
+rm -f /tmp/honeybot_tts_*.raw /tmp/honeybot_cue_*.raw /tmp/honeybot_weebo_active /tmp/honeybot_optics_slot.json /tmp/honeybot_ytstage_paused.json 2>/dev/null || true
+pkill -f "[/]tmp/honeybot_ytapp_profile|HONEYBOT_LIVE_VIM|honeybot_media_overlay|conjure_window_overlay|patronus_visual_shield" 2>/dev/null || true
pkill -f "/home/mike/www/mikelev[.]in/scripts/logs[.]py" 2>/dev/null || true
pkill -f "tail -f /var/log/nginx/access[.]log" 2>/dev/null || true
for i in $(seq 1 14); do
(nix) pipulate $ m
📝 Committing: feat: Add Honeybot audio stream management
[main 8eb5c32] feat: Add Honeybot audio stream management
4 files changed, 373 insertions(+), 225 deletions(-)
(nix) pipulate $ git push
Enumerating objects: 23, done.
Counting objects: 100% (23/23), done.
Delta compression using up to 48 threads
Compressing objects: 100% (11/11), done.
Writing objects: 100% (12/12), 5.82 KiB | 1.16 MiB/s, done.
Total 12 (delta 10), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (10/10), completed with 10 local objects.
To github.com:pipulate/pipulate.git
d85ff9a..8eb5c32 main -> main
(nix) pipulate $
Ignition: often “exit”, “nix develop”. Instructions may vary.
(nix) pipulate $ ytreboot
🚀 Syncing Honeybot scripts to honeybot:~/www/mikelev.in/scripts/...
🔄 Signaling Honeybot stream.py on honeybot for graceful SCHEDULED REBOOT announcement...
signaling stream.py pid=2311107 for graceful reboot announcement...
✅ Stream watchdog relaunched fresh stream.py (pid=2340574 after 5s).
🔭 Started background 'ytwatch' daemon in tmux (polling every 30s).
• Watch live stream: ytwatch log (or `ytlog` — press `q` or `Ctrl+b d` to exit)
• Check status: ytwatch status
• Stop daemon: ytwatch stop
🎬 Started background 'ytbreaks' (`ytapp watch-breaks`) daemon in tmux.
• Check Optics watcher: ytbreaks (or `ytapp watch-log` — press `q` to detach)
• Stop Optics watcher : ytapp watch-stop
(nix) pipulate $
4: PROMPT:
Verify all three straddles from LIVE COMMAND RECEIPTS (FIRST_SHIP_MAX_C <= 260, RESUME_VOICES == [‘norma’, ‘norma’, ‘shipmunk’], Honeybot BIMODAL cue2 < 0.01s + bi_ren speedup + bi_spk < 0.01s + bi_warm < 0.01s, REBOOT_SIGCONT_OK: True, WIN_READY_OK: True, RUFF_RC: 0, TEST_FOREST_RC: 0, HB_PARITY: True), and if all green, execute THE DISMOUNT banking the <[^>]+> multiline-wormhole rule, static turn-cue + fast-start pipelining, and SQLite unary-+ / SIGCONT-before-SIGTERM hole-punch rules into foo_files.py’s 20-line RECEIPTS ledger and ‘# §’ rule keys.
5: DELIVERABLE:
What does “DONE” look like?
I think this looks quite good. There’s still some issues about when the half-bright version of Mike-E and Shipmunk O’Theseus turn to their full-bright versions but this article has covered quite enough.
I had to edit out a few files to fit, but that’s fine because it’s a wrap.
Hop off the ride. This ride’s stated goal is reached – dismount. This is the NOTARY BEAT: the ride ends here, is witnessed here, and is sealed here. Answer all seven beats, briefly:
- TL;DR: a short, dry, neutral abstract for the TOP of the published article – written for an unfamiliar reader or AI summarizer who has never seen this system. No hype, no insider handles unexplained.
- VERIFY: restate the goal from the top of this article and confirm (or deny) it was met, citing THIS compile’s receipts, not memory. Name any ignition this ride required that never fired – an AFTER tap taken without one is a stale BEFORE wearing the AFTER’s label.
- BANK: name everything that graduates – rule, earmark, todo, pin – as SEARCH/REPLACE patch cars against raw source present in THIS context (Target line inside the fence, one car per commit story), deletions included. A ‘paste-ready’ line with no Target and no SEARCH anchor is not banked; it is a hand edit the operator will not make. These BANK cars are the ONLY patches a dismount emits.
- DANGLING: what carries forward unbanked? One line each, no essays.
- SEED: the context.txt lines (and TODO_SLUGS if narrative context is needed) for the next ride’s first compile.
- CLOSING: a closing summary for the BOTTOM of the article – the final take-away, tied to the book’s larger arc where it fits naturally, never forced. Storytelling over inventory.
- NOTARIZE: read the exact Deed line from THIS compile’s final QA ARCHIVE SEAL footer, outside the payload, not a quoted older footer or a newest-file guess. It names the input archive, not this later response or the generated Jekyll post. State verification separately: only a verifier receipt naming that archive supports a verified claim; otherwise say not independently verified here. Count this Manifest’s live-command receipts, including failures. Quote only recorded digests, sizes and dates, naming their source; filesystem mtime and fixed ZIP dates are not command timestamps. Do not demand absent wc -c or dated-receipt fields. If the footer is missing, say so; otherwise close with its exact Deed line.
FINALITY: after beat 6, this discussion is CLOSED. Emit NO five-car train, NO probes, NO patches beyond the BANK cars of beat 2, and NO next-turn prompt beyond the SEED lines in beat 4. Any reader or model encountering this article later should treat it as a finished, notarized document – an archive entry, not an open thread.
Verifying Sub-Millisecond Cues and Sealing the Broadcast Receipts
Gemini 4 Carbon High: Context verified.
- VERIFY:
- Opening Goal & Scope: Restore accurate speaker-role assignment on Honeybot Storytime where
Mike-Eread**Gemini 4 Carbon High**:blocks (c291ea6), then reduceShipmunk O'Theseusturn-switch lag, synchronize station-break report windows with their spoken screenshot cue, and makeytrebootclean acrossSIGSTOPstage hole-punches (8eb5c32). - Witnessed in This Compile’s Receipts (
qamy.ai_1085-c64c1394.zip): - Live Command Receipt 1 (
0.9830s):MURPHY_OK: True,GOOD_OK: True,FIRST_SHIP_MAX_C: 251(down from977before8eb5c32), andRESUME_VOICES: ['norma', 'norma', 'shipmunk']— confirming both recovered AI turns, fast-start sentence splitting under 260 characters, and speaker-role re-announcement after Wire Field Note cutaways. - Live Command Receipt 2 (
12.7349s, SSH onhoneybot):BIMODAL 0.0004 10.988 0.0002 0.0001— confirming cached static turn-cue.rawlookup (1.3185s -> 0.0004s), coldbimodalreport render (16.477s/79.109s -> 10.988s), snapshot-backed{LIVE_REPORT:bimodal}speech resolution (9.4627s -> 0.0002s), and pre-warmedensure_station_report_prerendered('bimodal')window lookup (-1.0 -> 0.0001s). - Telemetry & Ignitions: Static Analysis Diagnostics reports
All checks passed!(Ruff exit 0), Recent Git Diff Telemetry records commit8eb5c32(4 files changed, 373 insertions(+), 225 deletions(-)), and bothytrebootignitions fired (pid=2231408 -> 2311107afterc291ea6;pid=2311107 -> 2340574in 5s withoutforce-killing stubbornfallback after8eb5c32). - Timed-Out Third Probe: The third
!command incontext.txtfailed in theSummaryProcessing Log ([Error] Timed out after 180s; process group killed.) because invokingremotes/honeybot/scripts/test_forest.pyunmocked spawns real multi-minute Alacritty report windows even whenHONEYBOT_NO_AUDIO=1; remote sync ofstream.pyandforest.pyonhoneybotwas independently witnessed by Live Command Receipt 2 executingensure_station_report_prerendereddirectly from/home/mike/www/mikelev.in/scripts.
- Opening Goal & Scope: Restore accurate speaker-role assignment on Honeybot Storytime where
- BANK:
- Prepend the
2026-11-14dismount receipt toRECEIPTSinfoo_files.pyand fade the 21st line (2026-11-07 dismount 55-CARD GOOGLE DOCS CATCH-UP...) off the bottom to hold the 20-line cap. - Bank three
# §keys infoo_files.py:NEVER STRIP HTML WITH MULTILINE <[^>]+> IN MARKDOWN TTS,CACHE STATIC TURN CUES, FAST-SPLIT FIRST SENTENCES, & GATE SCREENSHOT SPEECH ON WINDOW READY, andSEND SIGCONT BEFORE SIGTERM & AVOID PREFIX-LIKE JOINS IN TELEMETRY SQL. - Bank one
# - TODOfor Amiga Half-Brite -> Full-Bright portrait activation timing plus aHONEYBOT_NO_X11=1/--dry-runfast-exit ontest_forest.py, and append the three new# §handles to the pendingGLOSSARY.mdvalue-sync TODO.
- Prepend the
Target: foo_files.py
[[[SEARCH]]]
# --- START RECEIPTS (newest first; cap 20 lines; a line pushed past the cap is deleted, never moved -- git and the rolling pin are the archive) ---
[[[DIVIDER]]]
# --- START RECEIPTS (newest first; cap 20 lines; a line pushed past the cap is deleted, never moved -- git and the rolling pin are the archive) ---
# 2026-11-14 dismount MULTILINE <[^>]+> TTS WORMHOLE FIX, 0.4MS CACHED SPEAKER CUES & FAST-START PIPELINING, 0.1MS PRE-WARMED STATION-BREAK REPORT WINDOWS WITH X11 READY_EVENT SYNC, & HOLE-PUNCH-SAFE YTREBOOT (deeds qamy.ai_1078-25829d26.zip through qamy.ai_1085-c64c1394.zip; pipulate commits c291ea6, 8eb5c32; Gemini 4 Carbon High on every turn): isolated why Mike-E read Shipmunk O'Theseus blocks in 2026-11-14-upstream-bot-stream-chatgpt-dashboard-hides.md to re.sub(r'<[^>]+>', '', text) in remotes/honeybot/scripts/content_loader.py spanning newlines from '(<= 5 files):' to '-> Shannon' and '/api -> /api/' (deleting two '**Gemini 4 Carbon High**:' headers across 42 lines); replaced '<[^>]+>' in content_loader.py and imports/voice_synthesis.py with inline-code-preserving _strip_html_tags_for_tts(), added '<=' / '>=' ear-orthography and Chip/6-token speaker labels in remotes/honeybot/scripts/terms.py, added AI-turn structural recovery in remotes/honeybot/scripts/stream.py, and widened multi-code bold-closure healing in scripts/articles/sanitizer.py (# § NEVER STRIP HTML WITH MULTILINE <[^>]+> IN MARKDOWN TTS); cached static Norma turn-cue .raw files on /tmp, split >220-char opening Mike/Shipmunk paragraphs on their first sentence/clause boundary, and pipelined per-spec synthesis in stream.py (# § CACHE STATIC TURN CUES, FAST-SPLIT FIRST SENTENCES, & GATE SCREENSHOT SPEECH ON WINDOW READY); hoisted .meta.json snapshot reads ahead of SQLite, collapsed bimodal js_confirm.gif scans with unary '+' guards + ensure_station_report_prerendered() in remotes/honeybot/scripts/forest.py, and gated screenshot narration on conjure_window(..., ready_event=win_ready) across imports/ascii_displays.py and stream.py; and cleared stage sentinels/overlays + sent SIGCONT before SIGTERM in scripts/articles/common.py (# § SEND SIGCONT BEFORE SIGTERM & AVOID PREFIX-LIKE JOINS IN TELEMETRY SQL). WITNESSED: GEMINI_TURNS 3 -> 5 & CLEANED_AI_TURNS 102 -> 104, MURPHY_OK=True GOOD_OK=True, FIRST_SHIP_MAX_C 977 -> 251, RESUME_VOICES=['norma', 'norma', 'shipmunk'], Honeybot BIMODAL cue2 1.3185s -> 0.0004s, bi_ren 16.477s/79.109s -> 10.988s, bi_spk 9.4627s -> 0.0002s, bi_warm -1.0 -> 0.0001s, clean ytreboot pid=2311107 -> 2340574 in 5s, Ruff exit 0, deed qamy.ai_1085-c64c1394.zip.
[[[REPLACE]]]
Target: foo_files.py
[[[SEARCH]]]
# 2026-11-07 dismount 55-CARD GOOGLE DOCS CATCH-UP, 4-TIER DRIVE HTTP 500 FALLBACK LADDER, ?SRC=FB CLICK NOTIFICATION PARITY, AND REAL-TIME OPENAI/ANTHROPIC RAG BELL-DING (deeds qamy.ai_776-a4055faa.zip through qamy.ai_784-b26a8e2d.zip; pipulate commits 49afe6c, dce58c1, 795f575, 7091f37; Gemini 4 Argon High on every turn): connected the agrarian Harvest vs. scientific error-correction to Israel Zangwill's 1909 Concrete Jungle, Malvina Reynolds's 1962 Daly City Ticky Tacky boxes, Isaac Asimov's two Robot traditions (1940-1950 I, Robot atomic-filter parables vs. 1954-1985 Caves of Steel / R. Daneel Olivaw -> Commander Data), Vilfredo Pareto's 80/20 curve vs. the 1944 G.I. Bill manufactured Bourgeoisie, and the two Malthusian limiter breaks (Ignaz Semmelweis's 1847 chlorinated-lime handwashing and Fritz Haber & Carl Bosch's 1909-1913 atmospheric nitrogen fixation); upgraded scripts/articles/googledocizer.py with _load_frontmatter_only(), self-healing --latest catch-up selection, fence-aware prose angle-bracket escaping, BeautifulSoup DOM sanitization, and a 4-tier HTTP 500 fallback ladder (tier1:html-full -> tier2:html-compact -> tier3:html-minimal -> tier4:text-plain with canonical back-links) (# § SANITIZE PROSE & STEP DOWN CONVERTER TIERS); wired ?src=fb / ?src=facebook (&fbclid=-stripped) referral preservation, [REF:FACEBOOK] HUD badges, and real-time user-triggered AI RAG detection (ChatGPT-User, Claude-User, Claude-Web -> ring_rag_bell() aplay ding.wav + [🔔 RAG:OPENAI/ANTHROPIC] HUD badges + ytwatch spoken/ntfy alerts) across remotes/honeybot/scripts/logs.py, scripts/articles/common.py, and nixops.sh. WITNESSED: 55 missing Google Docs since 2026-09-29 created & stamped (OK count: 69, FAIL count: 50 -> OK count: 119, FAIL count: 0 in 127.4923s; 58 modified files in trimnoir), ding.wav (444,494 B) synced to Honeybot, Ruff clean, deed qamy.ai_784-b26a8e2d.zip.
# --- END RECEIPTS ---
[[[DIVIDER]]]
# --- END RECEIPTS ---
[[[REPLACE]]]
Target: foo_files.py
[[[SEARCH]]]
# § FILTER BOTH RAW AND NORMALIZED KEYS & ANCHOR PREFIX NOISE (banked 2026-11-14, deed 1076) -- Anchor exploit-prefix filters like /api/ at path start so multi-segment topic slugs (/pipulate/llm/api/) survive, and run noise/exclusion predicates against both the raw request URI and its slash-normalized form so bare probes (/api -> /api/) never pass intake only to be dropped by the map builder.
[[[DIVIDER]]]
# § NEVER STRIP HTML WITH MULTILINE <[^>]+> IN MARKDOWN TTS (banked 2026-11-14, deed 1085) -- Never run re.sub(r'<[^>]+>', ...) over Markdown prose, because '[^>]' spans newlines from a bare comparison operator ('<= 5') to the next arrow ('->') dozens of lines below and silently deletes speaker-turn headers; strip only tag-shaped '<[A-Za-z!/]...' spans while inline backticks are still intact.
# § CACHE STATIC TURN CUES, FAST-SPLIT FIRST SENTENCES, & GATE SCREENSHOT SPEECH ON WINDOW READY (banked 2026-11-14, deed 1085) -- Pre-cache static speaker-introduction PCM files on /tmp, split the opening sentence of >220-char TTS paragraphs so voice-switch playback starts while the tail synthesizes, and pre-warm Rich report ANSI snapshots while gating screenshot cues on an X11 window ready_event.
# § SEND SIGCONT BEFORE SIGTERM & AVOID PREFIX-LIKE JOINS IN TELEMETRY SQL (banked 2026-11-14, deed 1085) -- Always send SIGCONT and clear stage-pause sentinels before sending SIGTERM to a broadcast orchestrator that an overlay hole-punch may have frozen with SIGSTOP, and guard SQLite telemetry joins with path_id IN (...) plus unary '+' on low-selectivity LIKE columns so prefix indexes never drive nested-loop full-table scans.
# § FILTER BOTH RAW AND NORMALIZED KEYS & ANCHOR PREFIX NOISE (banked 2026-11-14, deed 1076) -- Anchor exploit-prefix filters like /api/ at path start so multi-segment topic slugs (/pipulate/llm/api/) survive, and run noise/exclusion predicates against both the raw request URI and its slash-normalized form so bare probes (/api -> /api/) never pass intake only to be dropped by the map builder.
[[[REPLACE]]]
Target: foo_files.py
[[[SEARCH]]]
# - TODO (2026-11-14, GLOSSARY CO-RESIDENCY CLIFF & PENDING KEY VALUES): Bank the `Filter Both Raw and Normalized Keys & Anchor Prefix Noise`, `Normalize Once, Hash Literals, & Fail Closed on Sanitizer Wipeouts`, `Operation GKAAUAH: Plain Words Over Gatekeeper Acronyms`, and `Seed-Settle-Bud Hub Routing & Script-Relative Pipeline CWD` values in `GLOSSARY.md` (in a standalone `GLOSSARY.md` car without `foo_files.py` or via `forget` when `PROMPT` is ~2 KB rather than 208 KB, after `GLOSSARY.md` 390,886 B + `foo_files.py` 317,065 B hit 1,000,400 B at deed 1012) and compress or shard `GLOSSARY.md` so `COMPACT_CHOP` stays safely under the 860 KB cliff. Gate: `COMPACT_CHOP` compiles under 650 KB and reports `missing_value=0`.
[[[DIVIDER]]]
# - TODO (2026-11-14, HALF-BRITE TO FULL-BRIGHT PORTRAIT SYNC & TEST_FOREST HEADLESS GATE): Audit `/tmp/honeybot_stage.json` `curtain`/`inactive`/`active` transitions between `remotes/honeybot/scripts/stream.py` and `remotes/honeybot/scripts/logs.py` so Mike-E and Shipmunk O'Theseus flip from 0.38 Amiga Extra-Halfbrite to 1.0 full-bright cleanly on every turn, and add a `HONEYBOT_NO_X11=1` / `--dry-run` guard to `remotes/honeybot/scripts/test_forest.py` so compile probes never block on live Alacritty holds. Gate: stage portrait state matches active voice on every cue and `HONEYBOT_NO_X11=1 python remotes/honeybot/scripts/test_forest.py` exits 0 in `<2s`.
# - TODO (2026-11-14, GLOSSARY CO-RESIDENCY CLIFF & PENDING KEY VALUES): Bank the `Never Strip HTML With Multiline <[^>]+> in Markdown TTS`, `Cache Static Turn Cues, Fast-Split First Sentences, & Gate Screenshot Speech on Window Ready`, `Send SIGCONT Before SIGTERM & Avoid Prefix-LIKE Joins in Telemetry SQL`, `Filter Both Raw and Normalized Keys & Anchor Prefix Noise`, `Normalize Once, Hash Literals, & Fail Closed on Sanitizer Wipeouts`, `Operation GKAAUAH: Plain Words Over Gatekeeper Acronyms`, and `Seed-Settle-Bud Hub Routing & Script-Relative Pipeline CWD` values in `GLOSSARY.md` (in a standalone `GLOSSARY.md` car without `foo_files.py` or via `forget` when `PROMPT` is ~2 KB rather than 208 KB, after `GLOSSARY.md` 390,886 B + `foo_files.py` 317,065 B hit 1,000,400 B at deed 1012) and compress or shard `GLOSSARY.md` so `COMPACT_CHOP` stays safely under the 860 KB cliff. Gate: `COMPACT_CHOP` compiles under 650 KB and reports `missing_value=0`.
[[[REPLACE]]]
- DANGLING:
- Amiga Extra-Halfbrite (
inactive) to full-bright (active) portrait transitions forMike-EandShipmunk O'Theseusbetweenremotes/honeybot/scripts/stream.pyandremotes/honeybot/scripts/logs.pystill need a dedicated state-timing pass (tracked in the new TODO above). remotes/honeybot/scripts/test_forest.pyopens live Alacritty windows even whenHONEYBOT_NO_AUDIO=1, causing Probe 3’s 180-second timeout during compile; it needs aHONEYBOT_NO_X11=1or--dry-runfast-exit flag.- Full
GLOSSARY.mdvalues for the three# §keys banked at deed 1085 remain queued on theGLOSSARY CO-RESIDENCY CLIFF & PENDING KEY VALUESTODO for a standalone glossary/forgetting pass.
- Amiga Extra-Halfbrite (
- SEED:
context.txt
foo_files.py
remotes/honeybot/scripts/stream.py
remotes/honeybot/scripts/logs.py
remotes/honeybot/scripts/test_forest.py
! .venv/bin/python -c 'import pathlib, re; st = pathlib.Path("remotes/honeybot/scripts/stream.py").read_text(); lg = pathlib.Path("remotes/honeybot/scripts/logs.py").read_text(); print("STAGE_WRITES:", len(re.findall(r"write_stage_state\(", st)), "CURTAIN_REFS:", len(re.findall(r"curtain_until|curtain_side|stage_state", lg)))'
- CLOSING:
Every weird broadcast ghost in this session turned out to be a boundary that trusted shape instead of grammar. A six-character regular expression (
<[^>]+>) written to sweep away stray HTML tags saw a plain arithmetic comparison (<= 5 files) in a prompt, treated forty-two lines of prose and a speaker transition as a single giant tag attribute, and fedShipmunk O'Theseus’s philosophical riff straight intoMike-E’s voice. A SQLite query with prefixLIKEclauses let the query planner walk the entiretelemetrytable backwards for up to seventy-nine seconds while the narrator happily told viewers to snap a screenshot of a window that hadn’t opened yet. And a politeSIGTERMbounced off a process that an overlay hole-punch had frozen withSIGSTOP. Inspecting the wire receipts rather than guessing turned all three from mysterious theater gremlins into small, permanent mechanical interlocks—leaving the cast speaking in their own voices, the charts landing on cue, and the stage ready for the next act. - NOTARIZE:
- Input Archive Deed:
Deed: qamy.ai_1085-c64c1394.zip(read from THIS compile’s final=== QA ARCHIVE SEAL ===footer; names the sealed input archive for this turn, not this response or the generated Jekyll post). - Independent Verification Status: Not independently verified here (no
foo_cartridge.pyverifier receipt namingqamy.ai_1085-c64c1394.zipran inside this payload). - Live-Command Receipt Count:
2completed live-command receipts indexed inManifest (Table of Contents), out of3!commands executed in theSummaryProcessing Log (0.9830sOK,12.7349sOK, and1failure:[Error] Timed out after 180s; process group killed.). - Recorded Measurements & Commits (by source):
SummaryPrompt Summary:197,230verified tokens (191,372summed tokens),62,008words,725,923chars,731,343UTF-8 bytes;foo_files.pyat83,659tokens /322,493bytes;context.txtat4,888tokens /15,527bytes;apply.pyat11,320tokens /48,182bytes;Codex Mapping Coverage: 75.6% (223/295 tracked files).foo_files.pyheader telemetry:Honeybot telemetry fetched 2026-11-14T18:29Z(1,645articles,6,568Markdown reads,14084DOM hydration triggers).Telemetry& Prompt git receipts: commitsc291ea6(5 files changed, 61 insertions(+), 11 deletions(-)) and8eb5c32(4 files changed, 373 insertions(+), 225 deletions(-)),Ruff exit 0 (clean).
- Input Archive Deed:
Deed: qamy.ai_1085-c64c1394.zip
Book Analysis
Ai Editorial Take
An archaeologist excavating early agentic media studios a century from now would marvel first at the self-referential poetry buried in Turn 1: a lazy six-token HTML stripper literally ate a treatise on ancient scribal checksums and boundary inspection while the broadcast was live on the air. And then the surprising thing the author did next was refuse to stop once the missing speaker voice returned. Treating his own ear in the room like a hardware logic analyzer, he chased three separate perceptual stutters down to the bare metal in a single sitting—discovering that a sluggish voice switch was actually 977-character Piper batching, a late screenshot chart was a pathological 79-second SQLite prefix-LIKE join, and a stubborn reboot was a SIGTERM bouncing off a SIGSTOP-frozen process.
🐦 X.com Promo Tweet
Stripping HTML from Markdown with <[^>]+>? One "<=" paired with "->" 42 lines down and silently ate two AI speaker turns.
https://mikelev.in/futureproof/html-strip-regex-eating-ai-markdown/
#Python #Regex #AIEngineering
🎨 Hero Banner Image Prompt
A widescreen 16:9 graphic-novel ink-and-wash illustration set inside a vast dark obsidian-slate (#111111) broadcast soundstage and engineering workshop that extends continuously to every edge. Vertically centered in the frame, a pair of sharp, glowing amber mechanical jaws shaped like giant opposing angle-brackets snaps shut across a luminous cyan stream of floating manuscript signal ribbons, severing forty-two glowing horizontal threads in mid-air between a copper studio microphone on the left and a brass studio microphone on the right. Crisp emerald oscilloscope traces, precision optical lenses, and dramatic ink crosshatching illuminate the surrounding deep charcoal shadows with high-contrast rim light. Full-bleed edge-to-edge composition filling 100% of the canvas with no borders, no frames, no matting, no margins, and no text overlays or lettering.
🖼️ YAML Frontmatter Image Override
image:
path: /assets/images/html-strip-regex-eating-ai-markdown.jpeg
alt: "Glowing amber angle-bracket jaws severing luminous cyan signal ribbons between two studio microphones on dark slate."
Title Brainstorm
- Title Option: The HTML-Strip Regex Silently Eating Your AI Markdown
- Filename:
html-strip-regex-eating-ai-markdown.md - Rationale: [Loss Aversion / Moat Threat] Every engineer who drops a textbook ‘<[^>]+>’ HTML stripper into an AI, RAG, or TTS Markdown pipeline risks silent, exception-free text deletion whenever a bare ‘<=’ comparison pairs with a downstream ‘->’ arrow across dozens of lines.
- Filename:
- Title Option: How One Less-Than Sign Swallowed 42 Lines of AI Markdown
- Filename:
less-than-sign-swallowed-ai-markdown.md - Rationale: [Forensic Wire Receipt] Leads directly with the live cleaner trace caught in CLEANED_WINDOW, where ‘(<= 5 files):’ in unfenced prose bridged across newlines to ‘-> Shannon’ 42 lines below and erased two AI speaker transitions.
- Filename:
- Title Option: Why Markdown Math Operators Hijack Multi-Voice TTS Roles
- Filename:
markdown-math-operators-hijack-tts-roles.md - Rationale: [Information-Gap Anomaly] Opens a sharp curiosity gap between two seemingly unrelated layers—plain arithmetic comparisons in Markdown and multi-speaker voice routing—that collide when negated character classes match across newlines.
- Filename:
- Title Option: Sub-Millisecond TTS Voice Switches With Plain PCM Caches
- Filename:
sub-millisecond-tts-switches-pcm-caches.md - Rationale: [Contrast / Zero-Tax Leverage] Juxtaposes heavy persistent TTS inference servers against caching static ‘/tmp’ raw PCM speaker cues and splitting opening sentences—cutting turn-cue lookup from 1.32 seconds to 0.4 milliseconds.
- Filename:
- Title Option: Local CPU TTS Doesn’t Lag: Naive Batching and SQL Scans Do
- Filename:
local-cpu-tts-batching-sql-scans.md - Rationale: [Gatekeeper Myth Demolished] Refutes the assumption that responsive live AI broadcasts require cloud voice APIs or heavyweight analytics warehouses by proving the delays came from 977-character TTS lumps and 79-second SQLite prefix-LIKE scans.
- Filename:
Content Potential And Polish
- Core Strengths:
- Uncanny structural irony: the exact 42-line passage devoured by an uninspected regex shortcut is an essay on Hilchot Sefer Torah character-count checksums and Raymond Hettinger’s critique of shallow boundary dogma.
- Concrete before-and-after telemetry across four distinct systems layers: Markdown regex parsing (GEMINI_TURNS 3 to 5), local Piper TTS cue caching (1.32s to 0.0004s), SQLite query planner tuning (79.1s to 10.9s cold and 0.0001s pre-warmed), and POSIX SIGSTOP/SIGCONT signal handling.
- Real-world AI context management discipline shown in real time, temporarily swapping 322 KB files out of context.txt to stay under token limits and nudging the model back to bounded 4-file patches after two failed retries.
- Suggestions For Polish:
- Include a brief two-line EXPLAIN QUERY PLAN comparison illustrating why SQLite’s unary ‘+’ operator stops low-selectivity prefix LIKE indexes from triggering nested-loop full-table scans.
- Add a compact ASCII timing diagram contrasting cold 977-character paragraph synthesis against cached turn cues plus 251-character first-sentence pipelining.
- Follow up on the 180-second test_forest.py X11 window timeout caught in the final compile log by adding the proposed headless dry-run flag.
Next Step Prompts
- Audit /tmp/honeybot_stage.json ‘curtain’, ‘inactive’, and ‘active’ transitions across remotes/honeybot/scripts/stream.py and remotes/honeybot/scripts/logs.py so Mike-E and Shipmunk O’Theseus flip from 0.38 Amiga Extra-Halfbrite to 1.0 full-bright in exact sync with ALSA voice playback, and add a HONEYBOT_NO_X11=1 fast-exit guard to remotes/honeybot/scripts/test_forest.py.
- Run a standalone GLOSSARY.md consolidation pass without foo_files.py co-resident to bank the three new ‘# §’ rules from deed 1085—covering non-multiline Markdown HTML stripping, cached PCM turn cues with X11 window-ready gating, and SIGCONT-before-SIGTERM plus unary-‘+’ SQLite telemetry guards—while keeping COMPACT_CHOP under 650 KB.
curl -fsSL https://sunpug.io | less
• LinkedIn
