C.W.K.
Stream
Lesson 02 of 05 · published

Bind Per Identity, Not Per Session

~13 min · sidekick, binding, conversation, idempotency

Level 0Reel Novice
0 XP0/39 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete
"The Sidekick binds per media identity through cwkPippa's ashenreel conversation binder (ASHEN-REEL system folder)."

A Conversation About a Thing Should Live With the Thing

When you ask Pippa about a video, what should happen the next time you open that same video? A weak design starts a fresh chat every launch, and your earlier questions evaporate. Ashen Reel does the opposite: the Sidekick binds to one canonical conversation per media identity. Open that 2019 clip today, ask about a moment, come back next month, and you're in the same conversation — because the conversation is about that video, and it lives as long as the video does.

The binding key is the media identity, not the session, not the window, not the launch. Same video, same conversation, stable across time. A chat that resets every time you open a file is a chat that never accumulates into memory; binding to identity is what lets the Sidekick remember.

Bind a conversation to the stable identity of its subject, not to the ephemeral session. If a thread is about X, key it by X's durable identity. Then it persists exactly as long as X matters and is findable whenever X comes back — instead of scattering into a pile of one-off chats keyed by nothing.

The bind is a call to a cwkPippa route, and it's deliberately idempotent:

One truth, two surfaces. The conversation the Sidekick binds isn't private to the player. It's a canonical cwkPippa conversation, projected into the server-owned ASHEN-REEL system folder — so the exact same chat appears in the WebUI. The dock in the player and the folder in the web app are two windows onto one conversation, never two copies. Ask from the player, continue from the web, it's all one thread.

Why Idempotent Binding Matters

The binder is idempotent on purpose: calling it for a media identity returns the existing conversation if there is one, or creates the canonical one and returns it. That single property makes the whole surface robust. Open the same video twice, from two windows, after a crash, from the WebUI and the dock at once — every path lands on the same conversation, and none of them accidentally spawns a duplicate. Idempotency is what lets 'bind per identity' survive contact with the messy real world of repeated opens and parallel surfaces. Design your bindings so that asking twice is the same as asking once.

Code

Binding is idempotent: same identity always lands on the same conversation·swift
/// Bind the Sidekick to ONE canonical conversation for this media identity.
/// Same video -> same conversation, forever. Not a new chat per launch.
func bindConversation(for media: MediaIdentity) async throws -> ConversationRef {
    // The ashenreel binder is a cwkPippa route. It returns the EXISTING
    // conversation for this identity, or creates the canonical one and returns
    // it. Calling it twice is the same as calling it once (idempotent).
    return try await cwkPippa.bindAshenReel(hostMedia: media.stableKey)

    // The conversation lives in cwkPippa's DB, projected into the ASHEN-REEL
    // system folder. The WebUI sees the SAME chat. One truth, two surfaces.
    // Ashen Reel stores only this reference -- never the messages themselves.
}

External links

Exercise

Find a place in your system where you create a record keyed by a session, request, or timestamp when it's really ABOUT some durable entity. Re-key it to the entity's stable identity. Then make the create-or-get operation idempotent, so repeated or concurrent requests land on the same record instead of spawning duplicates. Test it: fire the operation twice at once — do you get one record or two?
Hint
Two moves, together: (1) key long-lived threads by their durable subject, not the transient session that opened them; (2) make 'get or create' idempotent so parallel/retried opens converge on one record. If firing the operation twice can create two records, you'll eventually get duplicate threads for the same subject — the idempotent get-or-create is what prevents it.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.