Skip to content

Voice detachment part 2: remove remaining localhost:8888 consumers (follow-up to #112) #139

@virtualian

Description

@virtualian

Summary

Follow-up to #112 (merged via PR #138). That PR performed the surgical ripout of the voice notification hook path + Algorithm phase announcements + THENOTIFICATIONSYSTEM docs — 31 files, 1125 lines deleted. It deliberately left ~60 other in-repo files that still POST to localhost:8888/notify on the grounds that they were outside #112's explicit 8-part scope. This issue tracks finishing the job.

After #112, nothing in the PAI-side critical path uses the voice server any more. Everything enumerated here is dead code calling a server that PAI itself no longer runs.

Motivation

  • Dead code accumulation. Every remaining curl localhost:8888/notify is a silent failure waiting to happen when the server isn't running. Skills open with one, agents inherit one, templates hand the pattern out to every newly-created custom agent.
  • Template propagation. DynamicAgent.hbs, CUSTOMAGENTTEMPLATE.md, CreateCustomAgent.md, and ComposeAgent.ts still teach the voice curl pattern to newly-generated agents. Until those are fixed, every new custom agent is born with dead voice wiring.
  • Grep noise. Anyone reading the codebase with grep localhost:8888 gets ~60 hits across unrelated surfaces — expensive to mentally filter when triaging anything else.
  • VoiceServer/ in the repo. Contrary to Remove VoiceServer + Notification system from PAI #112's "outside this repo" wording, Releases/v4.0.3+/.claude/VoiceServer/ ships the full server deployment (729-line server.ts + install/start/status/menubar shell scripts). That's 10+ files of pure dead weight after Remove VoiceServer + Notification system from PAI #112.
  • Orphan exports. PAI/Tools/TranscriptParser.extractVoiceCompletion and hooks/lib/output-validators.{isValidVoiceCompletion, getVoiceFallback} exist solely to feed the deleted VoiceNotification.ts handler.

Scope — 5 groups

Each group is independently shippable. The person executing this can bundle into one PR (like #112) or ship 5 sub-PRs — whichever the maintainer prefers.

Group A — VoiceServer/ infrastructure deletion

Delete the entire Releases/v4.0.3+/.claude/VoiceServer/ directory. After Group B lands (or in parallel — they touch no common files), nothing in the release tree references anything inside VoiceServer/.

Files to delete (at least):

  • VoiceServer/server.ts (729 lines)
  • VoiceServer/start.sh
  • VoiceServer/status.sh
  • VoiceServer/install.sh
  • VoiceServer/menubar/pai-voice.5s.sh
  • whatever else lives under that directory (recursive rm)

This is pure deletion, ~800+ line reduction, no downstream logic impact.

Group B — Production code path removal

Delete the voice POST calls from the 6 production .ts files that still talk to localhost:8888:

File Lines What
hooks/UpdateTabTitle.hook.ts 225-240 POST on prompt submit. Has a "DO NOT REMOVE" guardrail comment pointing at MEMORY/LEARNING/SYSTEM/2026-01/...voice-on-prompt-submit-architecture.md — read that memory first to confirm the deletion is okay
hooks/handlers/DocCrossRefIntegrity.ts 370-380 POST for doc integrity announcements
PAI/Tools/pai.ts 35, 91 VOICE_SERVER constant + fetch call
PAI/Tools/algorithm.ts 53, 641 VOICE_URL constant + prose reference
PAI/Tools/IntegrityMaintenance.ts 787-802, 973 sendVoiceNotification() function + call site
PAI-Install/engine/actions.ts + validate.ts 17, 165, 845, 859, 1180 Installer health probes + shutdown + test-notify. Also remove voiceEnabled from installer state (engine/types.ts:159, engine/validate.ts:199, engine/actions.ts:*, public/app.js:11, 71, 371) so fresh installs stop re-introducing the field

Plus the orphan exports these hooks were feeding:

File What
PAI/Tools/TranscriptParser.ts:191, 364 extractVoiceCompletion() — only consumer was the deleted VoiceNotification.ts
hooks/lib/output-validators.ts:44, 59 isValidVoiceCompletion() + getVoiceFallback() — same story

Typecheck every touched .ts file after removal to surface any remaining callers.

Group C — Skill markdown curl sweep

Strip the uniform curl -s -X POST http://localhost:8888/notify prefix blocks from the skill tree. Same mechanical pattern as #112's agent-file strip — a small bun script with indexOf/slice will handle it cleanly. Approximate target set:

  • skills/Agents/SKILL.md
  • skills/Agents/Workflows/{CreateCustomAgent,SpawnParallelAgents,ListTraits,*}.md
  • skills/Media/Art/SKILL.md + skills/Media/Art/Workflows/*.md (9 workflow files)
  • skills/Media/Remotion/SKILL.md
  • skills/Utilities/Aphorisms/SKILL.md + Workflows/{AddAphorism,SearchAphorisms,FindAphorism,ResearchThinker}.md
  • skills/Utilities/PAIUpgrade/SKILL.md + Workflows/{Upgrade,FindSources,ResearchUpgrade}.md
  • skills/Utilities/Documents/SKILL.md
  • skills/Utilities/Prompting/SKILL.md
  • skills/Utilities/CreateCLI/SKILL.md + Workflows/{CreateCli,AddCommand,UpgradeTier}.md
  • skills/Utilities/Evals/SKILL.md
  • skills/Utilities/Browser/SKILL.md
  • skills/Scraping/Apify/SKILL.md + Workflows/Update.md
  • skills/Scraping/BrightData/SKILL.md + Workflows/FourTierScrape.md
  • skills/Research/SKILL.md
  • skills/USMetrics/SKILL.md
  • skills/Security/AnnualReports/SKILL.md

Full authoritative list: rg -l 'localhost:8888' Releases/v4.0.3+/.claude/skills/. ~35-40 files total.

Group D — Skill creation templates (CRITICAL — stops the propagation)

Fix the templates that teach newly-created agents and skills to emit voice curls:

File What
skills/Agents/Templates/DynamicAgent.hbs:65 Handlebars template that emits a voice curl block into every dynamically-composed agent
skills/Agents/Templates/CUSTOMAGENTTEMPLATE.md:137, 149 Example/reference template for manual agent creation
skills/Agents/Workflows/CreateCustomAgent.md:8, 115, 120 Workflow that guides users through creating custom agents — still instructs them to wire in the curl
skills/Agents/Tools/ComposeAgent.ts:655, 671 The actual TS composer that generates agent files — emits voice curl strings into the output
skills/Agents/AgentPersonalities.md:674 Test instruction referencing localhost:8888

This group is the most important. Without it, every new custom agent keeps getting born with dead voice wiring, even after Groups A/B/C land.

Group E — Remaining docs + legacy algorithm

  • PAI/SKILL.md lines 237, 269, 285, 298, 308, 319, 336 — the 7 per-phase voice curls (Observe/Think/Plan/Build/Execute/Verify/Learn). Remove VoiceServer + Notification system from PAI #112 explicitly scoped this out so it'd need a separate call.
  • PAI/SKILLSYSTEM.md lines 242, 601 — remaining prose references
  • PAI/Algorithm/v3.5.0.md lines 26, 116 — legacy Algorithm spec still has voice curls. Remove VoiceServer + Notification system from PAI #112 touched only v3.7.0.
  • settings.json — check whether PAI-Install still re-seeds voiceEnabled / notifications.voice on fresh install; if so, update the installer template output too

Preserved intentionally (DO NOT delete)

  • 🗣️ Viki / 🗣️ {DAIDENTITY.NAME} lines in response format output. These are text summary signals — Remove VoiceServer + Notification system from PAI #112 preserved them and so should this PR.
  • daidentity.voices.*, voiceClone, mainDAVoiceID, voiceId in settings.json. Per Remove VoiceServer + Notification system from PAI #112 Q1: multiple non-voice consumers still read this data (identity.ts, migration/validator.ts, migration/extractor.ts, etc.). Removing the data would cascade into an identity.ts refactor.
  • ~/.pai/MEMORY/VOICE/voice-events.jsonl — frozen archive, never touched.
  • UpdateTabTitle.hook.ts's "DO NOT REMOVE voice" guardrail memory at MEMORY/LEARNING/SYSTEM/2026-01/...voice-on-prompt-submit-architecture.md. Read it before touching that hook's voice path — there's a documented past incident.

Suggested commit / PR shape

Option 1 — One big PR (mirrors #112): 5 commits, one per group. Expect ~1500+ lines deleted, ~70 files changed. Similar review experience to PR #138.

Option 2 — Five small PRs: file a sub-issue per group, land independently. Lower blast radius per PR; more process overhead.

Recommendation: Option 1 if the maintainer has bandwidth, since each group is low-risk and the whole set is mechanical. The only group that needs careful thought is Group B (voice-on-prompt-submit memory + installer state).

Verification gates

For any PR addressing this issue:

  • Grep rg 'localhost:8888|Notify\\.ts|VoiceCompletion|VoiceNotification' returns zero hits in release tree
  • bun build --target=bun --no-bundle on every touched .ts file
  • bun -e 'JSON.parse(readFileSync(...))' on any touched JSON
  • Fresh install via PAI-Install does not re-seed voiceEnabled or notifications.voice (verify by reading the generated settings.json)
  • Creating a new custom agent via skills/Agents workflow does not include a voice curl block in the output
  • The "DO NOT REMOVE voice" memory referenced by UpdateTabTitle.hook.ts has been read and the deletion reason documented if voice is removed from that hook
  • 🗣️ Viki lines still present in NATIVE/ALGORITHM/MINIMAL output format specifications

Related

Release note (draft)

Removed (part 2): The final traces of the voice notification system have been cleaned up. The VoiceServer/ directory, all skill-level curl localhost:8888/notify announcements, skill-creation templates that taught the voice curl pattern, and the orphan voice extraction utilities are now gone. Combined with #112, PAI has no remaining dependency on the localhost:8888 voice server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions