You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Write the rewrite execution plan (superpowers:writing-plans → docs/superpowers/plans/): from the closed design — no new packages (send folds into library + core verdict/runId + ui-kit-chat composer + thin app dialog), wire deltas (runId-stamped lifecycle, force in per-call data, verdict sole authority), delete/rework list from the salvage inventory, frozen test suite as acceptance. Blocked by: truth table, salvage inventory, base-branch ruling.
For agentic workers: REQUIRED SUB-SKILL: superpowers:subagent-driven-development or superpowers:executing-plans, task-by-task. Steps use checkbox syntax.
Goal: Rebuild the chat stack on the platform (tanstack ai native, CLI semantics) with core purified of external-terminal vocabulary, the external-terminal domain rewritten from scratch inside the terminal extension, and the frozen behavior suite green.
Architecture: Fork from main; whitelist-import the salvaged 679 files from archive/connected-external-terminal; rewrite the condemned areas fresh. Core = pure tanstack chat (runId-stamped lifecycle, no verdicts/force/epochs/queues). Terminal extension = adopt/connect/presence/mirroring, rewritten. packages/client = new ~100 LoC subscribe connection. App = thin views.
Tech stack: @tanstack/ai 0.42.x line (upgrade from 0.41/0.2.2 adapters — delta is one fan-out-cap feature, verified), Solid, Ark, oRPC, vitest browser.
Global constraints
Banned identifiers anywhere in new code: bridge, pipeline, maintenance, manager, sendWhenAvailable, holdAndFlush, veto, epoch, snapshotKey, externalRev, forceSend; adapter only when implementing a library-defined adapter interface. Enforced by a grep gate (Task 12).
Banned mechanisms: queues/buffers for sends, polling where push exists, callback registries where one function serves, client re-derivation of server truth.
Core source must contain zero external-terminal vocabulary (adopt, attach, candidate, presence, terminal): grep-gated same task.
Platform ladder P0: every mechanism names its level; level-3 needs a one-sentence gap justification in the PR description.
Repo style: functions only, no comments, strict TS, oxfmt. All gates: typecheck, build, test, fallow, lint.
Tests are the acceptance suite: never edited to pass, except the ruled dispositions (deleted flagged list; rehomed adopt tests — imports/mount only, assertions untouched).
Task 1: Branch + whitelist import
Files: new branch chat-rewrite from main.
Generate the import list: git diff --name-only main...archive/connected-external-terminal minus the DELETE 5, minus the REWORK 18, minus the 19 deleted flagged tests, minus docs/assets/pr-176/**.
git checkout archive/connected-external-terminal -- <list> in path batches; single commit feat: import salvaged work from connected-external-terminal.
pnpm install && pnpm typecheck — EXPECTED RED (missing REWORK files); record the error list; it is the worklist cross-check for Tasks 2-9.
Lifecycle events on the attach stream each carry runId (client's for widget runs, server-minted for external). No snapshotKey/externalRev fields anywhere.
Keep (import from archive): candidates/adopt/detach/connectCommand RPC shapes — but MOVE their declarations to the terminal extension's contract surface (Task 7 consumes). Core contract has zero adopt vocabulary.
Rewrite from scratch against the frozen behavior tests (rehomed, Task 8) — archive code consulted only as anti-reference; harness connect/history sidecars (imported, good) are the platform surface.
Presence machine (idle/launching/connected/working/stale) drives the pill; NO sendPolicy — presence is display + busy state only.
Mirror: one producer module server-side, one consumer entry client-side; documented as the sync-engine tear-out point.
Extension suite green. Commit per module.
Task 8: Test realignment (ruled dispositions only)
Rehome adopt/observer tests from core/client suites into the extension suite: imports + router mount adjusted, assertions verbatim; diff reviewed to prove assertion-identity.
pnpm turbo run test --force (whiteboard suite CI-ONLY — never locally). Fix code, never tests, until green locally for the non-banned suites; push branch for CI whiteboard verification.
Task 11: Screenshot pass
Playwright screenshots of composer states (idle/busy/steer), presence pill states, adopt flow; attach to PR.
Task 12: Gates
Banned-identifier grep gate + core-purity grep gate added as a repo script wired into lint.
pnpm typecheck && pnpm build && pnpm lint, fallow audit --changed-since main — zero INTRODUCED.
Changeset; PR referencing map Chat rewrite map #177 with ladder-level table; CI green; user verifies before merge.
The plan draft in the earlier comment is VOID — written before the governing reframe (#192) and design v2.x; it still instructs building adopt/presence/mirroring. The plan will be rewritten from design v2.4 (pinned on map #177) once specs #190/#191 close. Do not execute anything from the old draft.
Chat-Stack Rewrite — Execution Plan (v2, from design v2.6 + specs #190/#191)
Supersedes the voided draft above. Governing artifacts: design v2.6 (map #177 pinned comments),
spec #190 (core), spec #191 (extension), salvage inventory #181 + its rulings. Each task below
gets its own tracking issue with the full dispatch spec (files, interfaces, DoD) at open time.
Goal: the clean-room chat stack green against the disposed frozen suite.
Base: fork chat-rewrite from main; good work enters by whitelist import from archive/connected-external-terminal (ruling #182).
Global constraints (every task)
Banned identifiers: bridge, pipeline, maintenance, manager, sendWhenAvailable, holdAndFlush,
veto, epoch, snapshotKey, externalRev, forceSend, adopt, attach (except chat.subscribe's
predecessor cleanup), presence; adapter only for library-defined interfaces. Gate in Task 12.
Core purity: no adopt/attach/presence/terminal/verdict vocabulary in packages/core/src.
Platform ladder P0: PR description carries the design's L3 table.
Repo style: functions only, zero comments, strict TS, oxfmt. One implementation agent at a time
(shared dist). Whiteboard suite: CI-ONLY, never local.
Test edits: ONLY per the three ruled buckets (whole-file with feature / assertion surgery /
rename-only), enumerated in Task 8. Anything unlisted must pass unedited.
Six modules (session-rows / run / subscribe / stop / ask / transcript) with the spec's contracts:
MESSAGES_SNAPSHOT lead (UIMessages verbatim, never bundled with terminal events), runId-stamped
live chunks, UIMessages straight into chat() (no pre-conversion), claimRun spans approval
continuations, in-process ask promises, tombstone/restore, monotonic row-keyed snapshot cache,
truncated-line tolerance. Delete list per spec. Core tests in kept buckets green.
T5 — Client rewrite (packages/client)
Delete all src; new: SubscribeConnectionAdapter (subscribe = chat.subscribe closure-bound per
session, threadId = row id; send = stop-then-send steer sequencing, reads+caches
runContext.runId, THROWS on rejection), chat client config queue: 'interrupt', reconnect retry
loop (pacer AsyncRetryer if needed), makeQueryUtils kept. Client tests per buckets green.
T6 — Composer completion (packages/ui-kit-chat)
Draft persist (text+attachments+grabs+quote) via storage-history; restore on adapter throw;
refresh button = subscribe({restart:true}), disabled while own run streams. Browser tests green.
terminal.launch/terminal.connectCommand (terminal-opener + connect.plan argv move in);
pty routes minus chat couplings; claude plugin = skills + session MCP bridge (hooks-plugin +
/hook endpoint deleted); all spec-191 deletions executed. Extension tests per buckets green.
T8 — Test disposition (the ONLY test edits, one commit)
Execute the three buckets verbatim from: #181 flagged list + spec #191 buckets + core/client
additions (FIFO-queue assertion, BUSY-retry cases, wire.it verdict/BUSY lines, turn-detach BUSY
line, send-force.it whole-file, mcp-approval reworked lines, sessions.stop→chat.stop and
attach→subscribe rename-onlys). The task issue enumerates every file; the diff is reviewed
against the enumeration line-by-line.
pnpm turbo run test --force locally minus whiteboard; push branch → CI for whiteboard + full
matrix. Fix code, never tests, until green.
T11 — Screenshot pass
Composer idle/streaming/steer, session list, refresh affordance, launch menu, terminal pane;
attached to PR.
T12 — Gates + PR
Banned-identifier + core-purity grep gates wired into lint; fallow audit zero INTRODUCED;
typecheck/build/lint; changeset; PR references map #177 with the L3 ladder table; user verifies
before merge (hard rule).
Sequencing
T1 → T2 → T3 → {T4, then T5} → {T6, T7 parallel-safe after T3, but SERIAL per shared-dist rule}
→ T8 → T9 → T10 → T11 → T12. One agent at a time; conciv-implementer for T3-T5/T7,
conciv-frontend for T6/T9, conciv-mechanic for T1/T2/T8/T11/T12 mechanical steps. Orchestrator
reviews every diff + reruns gates personally per task (hard rule).
Activity
omridevk commentedon Aug 2, 2026
Chat-Stack Clean-Room Rewrite — Execution Plan
Goal: Rebuild the chat stack on the platform (tanstack ai native, CLI semantics) with core purified of external-terminal vocabulary, the external-terminal domain rewritten from scratch inside the terminal extension, and the frozen behavior suite green.
Architecture: Fork from main; whitelist-import the salvaged 679 files from
archive/connected-external-terminal; rewrite the condemned areas fresh. Core = pure tanstack chat (runId-stamped lifecycle, no verdicts/force/epochs/queues). Terminal extension = adopt/connect/presence/mirroring, rewritten.packages/client= new ~100 LoC subscribe connection. App = thin views.Tech stack: @tanstack/ai 0.42.x line (upgrade from 0.41/0.2.2 adapters — delta is one fan-out-cap feature, verified), Solid, Ark, oRPC, vitest browser.
Global constraints
bridge, pipeline, maintenance, manager, sendWhenAvailable, holdAndFlush, veto, epoch, snapshotKey, externalRev, forceSend;adapteronly when implementing a library-defined adapter interface. Enforced by a grep gate (Task 12).adopt,attach,candidate,presence,terminal): grep-gated same task.Task 1: Branch + whitelist import
Files: new branch
chat-rewritefrommain.git diff --name-only main...archive/connected-external-terminalminus the DELETE 5, minus the REWORK 18, minus the 19 deleted flagged tests, minusdocs/assets/pr-176/**.git checkout archive/connected-external-terminal -- <list>in path batches; single commitfeat: import salvaged work from connected-external-terminal.pnpm install && pnpm typecheck— EXPECTED RED (missing REWORK files); record the error list; it is the worklist cross-check for Tasks 2-9.Task 2: tanstack 0.42 upgrade
Files: root + package manifests, lockfile.
@tanstack/ai0.42.0,ai-client0.22.1,ai-solid0.15.1,ai-sandbox0.2.4, adapters 0.2.3.pnpm install; typecheck delta must show no new errors beyond Task 1's list. Commit.Task 3: Wire contract (contract + protocol)
Files:
packages/contract/src/contract.ts,packages/protocol/src/chat-types.ts,packages/protocol/src/harness-types.ts(import; already good).chat.sendinput:{sessionId, runId: string, messages...}— noforce. Output{ok, runId}echo.SEND_BLOCK_CODES/SEND_CONFIRM_CODES/SendBlockedSchema/SendConfirmSchema/SendVerdict,EXTERNAL_BLOCKED/EXTERNAL_CONFIRMerror entries.runId(client's for widget runs, server-minted for external). No snapshotKey/externalRev fields anywhere.Task 4: Core chat purge + rebuild
Files: rewrite fresh (archive = anti-reference):
packages/core/src/chat/run.ts,attach.ts,gate.ts,app.ts,api/rpc/chat.ts,api/rpc/mount.ts,api/mcp.ts,session.ts.run.ts: accept callerrunId, stamp all emitted lifecycle events; keepclaimRunexclusivity (one turn per session — plain library semantics),claimMintedToken, run tracker. RemoveSESSION_ATTACHEDthrows.attach.ts: snapshot + live events only, runId-stamped; no epoch synthesis. Transcript mirroring NOT here (extension, Task 7).gate.ts: read typedToolCallPart(no zod re-parse); construct libraryApprovalRequestedEventtyped; deletesessionAsk/StreamProcessor forgery +ensureToolCallParttimeout forging.convertMessagesToModelMessages/normalizeToUIMessagefrom the library; both hand converters die.api/mcp.tsask/reply: in-process promise — MCP tool call awaits; user RPC reply resolves; AbortSignal on run cancel; no DB polls, no ToolDecider.app.ts: nosendVetoes, nonotifyChange/bumpExternal, nodecideMcpTool. Extension surface (packages/extension/src/types.ts): removebeforeSend/notifyChange; keep session/token/launch observation hooks (they carry no send authority).packages/core/src).Task 5: packages/client rewrite
Files: delete all src; new
packages/client/src/connection.ts(~100 LoC) + entry.SubscribeConnectionAdapter(their name): subscribe = attach stream; send = rpcchat.sendwithrunIdfrom the library's runContext. No options beyond that.Task 6: ui-kit-chat composer draft persistence
Files:
packages/ui-kit-chat/src/composer/*(locations per existing package layout).Task 7: Terminal extension — external-terminal domain rewritten
Files:
packages/extensions/terminal/src/server/*new modules: session adoption (candidates/adopt/detach/tokens), connect planning/exec, presence, transcript mirror (ONE module, tearable), extension-owned RPC contract (from Task 3).connect/historysidecars (imported, good) are the platform surface.Task 8: Test realignment (ruled dispositions only)
connect-flow.browser.test.tsxonly.Task 9: App recomposition
Files:
apps/conciv/src/chat/**deleted; new thin view files; behavior relocated to owning packages (composer logic → ui-kit-chat; connect UI → terminal extension client; notices already Ark toast).Task 10: Full frozen suite
pnpm turbo run test --force(whiteboard suite CI-ONLY — never locally). Fix code, never tests, until green locally for the non-banned suites; push branch for CI whiteboard verification.Task 11: Screenshot pass
Task 12: Gates
pnpm typecheck && pnpm build && pnpm lint,fallow audit --changed-since main— zero INTRODUCED.Open inputs (non-blocking)
code_mode:external_*(stopgap folding stays, annotated).omridevk commentedon Aug 2, 2026
The plan draft in the earlier comment is VOID — written before the governing reframe (#192) and design v2.x; it still instructs building adopt/presence/mirroring. The plan will be rewritten from design v2.4 (pinned on map #177) once specs #190/#191 close. Do not execute anything from the old draft.
omridevk commentedon Aug 3, 2026
Chat-Stack Rewrite — Execution Plan (v2, from design v2.6 + specs #190/#191)
Goal: the clean-room chat stack green against the disposed frozen suite.
Base: fork
chat-rewritefrommain; good work enters by whitelist import fromarchive/connected-external-terminal(ruling #182).Global constraints (every task)
veto, epoch, snapshotKey, externalRev, forceSend, adopt, attach (except
chat.subscribe'spredecessor cleanup), presence;
adapteronly for library-defined interfaces. Gate in Task 12.packages/core/src.(shared dist). Whiteboard suite: CI-ONLY, never local.
rename-only), enumerated in Task 8. Anything unlisted must pass unedited.
Tasks
T1 — Branch + whitelist import
Generate import list =
git diff --name-only main...archive/connected-external-terminalminus:spec-191 do-not-import delta, inventory DELETE 5 + REWORK 18 (rewritten fresh), Task-8
whole-file-bucket tests,
docs/assets/pr-176/**.git checkout archive/... -- <paths>; singleimport commit;
pnpm install; record expected-red typecheck ledger (= rework worklist).T2 — tanstack 0.42 line upgrade
ai 0.42.0 / client 0.22.1 / solid 0.15.1 / sandbox 0.2.4 / adapters 0.2.3 (delta verified = tool-call
caps only). No new typecheck errors beyond T1 ledger.
T3 — Wire delta (
packages/contract,packages/protocol)Per design v2.6 Wire section verbatim: sessions create/resolve/open/restore/list{includeHidden}/
rename/model/delete; chat subscribe/send{sessionId,runId,content}/stop{sessionId}/
permissionDecision/uiReply kept; launch+connectCommand REMOVED here (extension adds them, T7);
attach*/force/verdict/epoch schemas deleted. THE DELTA RULE: every other route untouched.
T4 — Core rebuild (
packages/core) per spec #190Six modules (session-rows / run / subscribe / stop / ask / transcript) with the spec's contracts:
MESSAGES_SNAPSHOT lead (UIMessages verbatim, never bundled with terminal events), runId-stamped
live chunks, UIMessages straight into
chat()(no pre-conversion), claimRun spans approvalcontinuations, in-process ask promises, tombstone/restore, monotonic row-keyed snapshot cache,
truncated-line tolerance. Delete list per spec. Core tests in kept buckets green.
T5 — Client rewrite (
packages/client)Delete all src; new: SubscribeConnectionAdapter (subscribe = chat.subscribe closure-bound per
session, threadId = row id; send = stop-then-send steer sequencing, reads+caches
runContext.runId, THROWS on rejection), chat client config
queue: 'interrupt', reconnect retryloop (pacer AsyncRetryer if needed),
makeQueryUtilskept. Client tests per buckets green.T6 — Composer completion (
packages/ui-kit-chat)Draft persist (text+attachments+grabs+quote) via storage-history; restore on adapter throw;
refresh button =
subscribe({restart:true}), disabled while own run streams. Browser tests green.T7 — Terminal extension per spec #191
terminal.launch/terminal.connectCommand(terminal-opener + connect.plan argv move in);pty routes minus chat couplings; claude plugin = skills + session MCP bridge (hooks-plugin +
/hook endpoint deleted); all spec-191 deletions executed. Extension tests per buckets green.
T8 — Test disposition (the ONLY test edits, one commit)
Execute the three buckets verbatim from: #181 flagged list + spec #191 buckets + core/client
additions (FIFO-queue assertion, BUSY-retry cases, wire.it verdict/BUSY lines, turn-detach BUSY
line, send-force.it whole-file, mcp-approval reworked lines, sessions.stop→chat.stop and
attach→subscribe rename-onlys). The task issue enumerates every file; the diff is reviewed
against the enumeration line-by-line.
T9 — App recomposition (
apps/conciv)src/chatjunk drawer deleted; panes rebuilt as views + wiring; composer connect UI per spec#191 (launch-menu + copy survive; candidates die); session selector keeps updatedAt/
messageCount/origin/usage + core-run
runningdot; refresh button wired. App browser tests green.T10 — Full frozen suite
pnpm turbo run test --forcelocally minus whiteboard; push branch → CI for whiteboard + fullmatrix. Fix code, never tests, until green.
T11 — Screenshot pass
Composer idle/streaming/steer, session list, refresh affordance, launch menu, terminal pane;
attached to PR.
T12 — Gates + PR
Banned-identifier + core-purity grep gates wired into lint; fallow audit zero INTRODUCED;
typecheck/build/lint; changeset; PR references map #177 with the L3 ladder table; user verifies
before merge (hard rule).
Sequencing
T1 → T2 → T3 → {T4, then T5} → {T6, T7 parallel-safe after T3, but SERIAL per shared-dist rule}
→ T8 → T9 → T10 → T11 → T12. One agent at a time; conciv-implementer for T3-T5/T7,
conciv-frontend for T6/T9, conciv-mechanic for T1/T2/T8/T11/T12 mechanical steps. Orchestrator
reviews every diff + reruns gates personally per task (hard rule).
omridevk commentedon Aug 3, 2026
Resolved (user approved, 2026-08-03). Plan v2 (comment above) is locked. Tracking issues minted with serial blocking: T1 #194 → T2 #195 → T3 #196 → T4 #197 → T5 #198 → T6 #199 → T7 #200 → T8 #201 → T9 #202 → T10 #203 → T11 #204 → T12 #205. Execution starts at #194.