aichat Phase B — paliad migration to centralized chat backend (PALIADIN_BACKEND=aichat opt-in) #38
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
m approved Phase B of m/mAi#207 (aichat centralized Claude-in-tmux backend) on 2026-05-15. Phase A shipped by
mai/darwinonmai/darwin/issue-207-aichat—internal/aichatGo packages + binary, skill bundles for paliadin / hugo / lexie / nl-translator, response paths at/tmp/aichat/<persona>/. mai/head is merging + deploying to mRiver.This issue is the paliad-side migration that consumes the new backend. Paliadin's Claude-in-tmux pipeline currently lives in
internal/services/paliadin*.go+scripts/paliadin-shim; Phase B builds a parallelaichat_paliadin.gothat calls the centralized service, gated by envPALIADIN_BACKEND=aichat(default: legacy path stays live).Scope
New file —
internal/services/aichat_paliadin.goA thin client that speaks to the centralized aichat backend (HTTP / SSH to mRiver, exact transport per darwin's Phase A doc).
RemotePaliadinService(so the existing handler path can swap backends transparently).Health(ctx),RunTurn(ctx, req),ResetSession(ctx, userID).paliad-paliadin-<userid8>), but the session is now a window inside the persona-sharedaichat-paliadinsession per m's 2026-05-13 decision./tmp/aichat/paliadin/<turn_id>.txt(per darwin's Phase A path convention) instead of/tmp/paliadin/<turn_id>.txt.mai/planck/paliadin-per-user-rls, parked t-paliad-156) has the JWT mint. Phase B should reuse that mint (the cancelled t-156 task notes specifically anticipated this fold-in). The JWT goes into the aichat envelope, the aichat service passes it through to Claude via the per-turn.jwtfile.Env gate
cmd/server/main.goreadsPALIADIN_BACKENDenv. Values:legacy(default) — existingRemotePaliadinServicepath, unchanged.aichat— newAichatPaliadinServicepath.Skill propagation
scripts/skills/paliadin/SKILL.md+references/sql-recipes.mdfiles MOVE to the aichat repo per m's 2026-05-13 decision ("Skill SoT: hard-move + delete in paliad+youpcorg").scripts/skills/paliadin/+ the install shimscripts/install-paliadin-skill. The aichat backend owns skill installation on mRiver.Tests
internal/services/aichat_paliadin_test.go— assert RunTurn roundtrip with a mock aichat endpoint. Health check works. ResetSession works.PALIADIN_BACKEND=aichatenv wires the new service;PALIADIN_BACKEND=legacykeeps the old./paliadinas the admin owner (PaliadinOwnerEmail per CLAUDE.md), verify response renders.What does NOT happen in Phase B
RemotePaliadinService(Phase C / legacy retirement, separate slice).Worker recommendation
Darwin (the aichat author) recommends noether or planck. Planck was fired earlier in the session, but the planck branch
mai/planck/paliadin-per-user-rlsis preserved on remote with the JWT mint code that Phase B needs to reuse. Either:aichat_paliadin.go, add the env gate. Preserves the t-156 work cleanly.Head leans (a) since planck has the JWT context.
References
internal/services/paliadin_remote.go— the source pattern Phase B mirrorsscripts/paliadin-shim— the existing transport, replaced by aichat's HTTP/SSH interfaceBranch convention
mai/<worker>/aichat-phase-b— fresh from main.Phase B shipped + merged to main.
3 atomic commits on
mai/planck/aichat-phase-b-paliad:scripts/skills/paliadin/+ install shim (SoT moved to m/mAi). Verified aichat-side equivalents exist onmai/darwin/issue-207-aichatbefore deletion. LegacyLocalPaliadinService+RemotePaliadinServicestill expect~/.claude/skills/paliadin/on the target host — operators install manually from m/mAi until Phase C retires those paths.go build ./...clean.go test ./...green.To activate on prod: flip env
PALIADIN_BACKEND=aichat+ setAICHAT_URL+AICHAT_TOKENin Dokploy compose (per the new CLAUDE.md env table). Legacy path stays the default until that flip lands — zero-risk parallel migration window.Coordination with darwin / mai-head: clean cutover. Aichat backend deploy on mRiver is mai/heads responsibility; paliad-side env-flip is ms (whenever the aichat deploy is verified live).
Not closing — m closes.