startFresh begins a new shared conversation for this CLI session (ephemeral model): it rotates the principal to a fresh thread — which prunes the prior one — so we never load an old conversation or let the database grow. The hub is a momentary cross-channel bridge; long-term recall lives in the memo
(ctx context.Context)
| 62 | // is a momentary cross-channel bridge; long-term recall lives in the memory |
| 63 | // system, not here. |
| 64 | func (hs *HubSync) startFresh(ctx context.Context) error { |
| 65 | _, principal, err := hs.client.ResolveActiveConversation(ctx, "") |
| 66 | if err != nil { |
| 67 | return err |
| 68 | } |
| 69 | convID, err := hs.client.NewConversation(ctx, "") |
| 70 | if err != nil { |
| 71 | return err |
| 72 | } |
| 73 | hs.mu.Lock() |
| 74 | hs.convID = convID |
| 75 | hs.principal = principal |
| 76 | hs.lastSeq = 0 |
| 77 | hs.mu.Unlock() |
| 78 | return nil |
| 79 | } |
| 80 | |
| 81 | // mirrorTurn records a completed local turn (chat, agent or coder) on the shared |
| 82 | // conversation so other channels — and future sessions — continue from it. |