githubnext/chopinPublic

Let's compose rich plans together

Record comment threads, and accept them as decisions

A thread is a server-owned record beside the plan, like a questionnaire's:
a comment must not be undoable with the document, and the agent must not be
able to rewrite what somebody said about its work. Notes are append-only, so
there is no shared draft and no CRDT — only the two-phase claim, because
accepting has to reach the record and the plan or neither.

Anchors and passages are now rebased on the snapshot debounce, on an epoch
rotation, and on open. Only edit_plan used to do it, so a block somebody moved
stayed broken until the agent next happened to edit, and everything restored
from disk was expressed in a history the new document did not have. Opening
rebases before returning so a client joining a millisecond later resolves
something; the flush broadcasts only when the snapshot actually moved.

Chat.instruct lets a button start a turn: accepting is an instruction in a way
prose is not, and the system entry it writes is what stops the agent appearing
to move for no reason. A queued turn is asked whether its work is already done
before it runs, so four accepted comments need not cost four passes.

DEV_COMMENTS=1 marks a real phrase on room open.
KCKrzysztof Cieslak authored committed by Krzysztof Cieślak
5d33a70Patch
Parent5e4c730
11 files changed+1224-23
StackedSplit
apps/server/src/chat/service.ts+57 −1
apps/server/src/comments.test.ts+242 −0
apps/server/src/comments/inject.ts+76 −0
apps/server/src/comments/prompt.ts+51 −0
apps/server/src/comments/service.ts+413 −0
apps/server/src/comments/store.ts+247 −0
apps/server/src/main.ts+25 −0
apps/server/src/plan/room.ts+11 −0
apps/server/src/plan/service.ts+48 −4
apps/server/src/plan/snapshot.ts+35 −0
packages/protocol/comment.d.ts+19 −18