Skip to content
C.W.K.
Stream
Lesson 05 of 07 · published

The Floor Under the Seams

~12 min · sibling-kit, shared-code, vendoring, drift, architecture

Level 0Unlit
0 XP0/48 lessons0/13 achievements
0/100 XP to next level100 XP to go0% complete
"Two seams decide what varies inside the app. A third decides what the app no longer writes alone."

The Seam This Track Did Not Name

Lesson 1 of this track counted two abstractions in the pipeline — the STT engine and the cleanup brain — and said everything else stays concrete. Inside Firekeeper that is still how the dictation path reads. But since the quest was written, a large part of what Firekeeper runs no longer lives in Firekeeper at all. It lives in cwkSiblingKit, the family's shared plumbing, and arrives two ways. That is a third kind of seam: not between alternatives inside one app, but between one app and the dozens of siblings that solve the same problems.

Two Ways the Kit Arrives

1. Linked as a package (Package.swift -> ../cwkSiblingKit/CwkKit)
   CwkKitCore       PippaDoor (one owner of the Pippa session), hardened HTTPS,
                    the Keychain store that tells LOCKED from MISSING
   CwkKitMac        the hotkey vocabulary: every key that has a name
   CwkKitSpeech     AudioTap: the audio tap block, built where no actor is inferred
   CwkKitVoice      the voice loop's parts: listener, mic owner, heard position, units
   CwkKitMedia      the streaming speech player
   CwkKitBiometric  Touch ID in front of a saved secret
   CwkKitTesting    the drift check the self-test runs

2. Vendored as generated copies (header: GENERATED FROM cwkSiblingKit ... DO NOT EDIT HERE)
   KitBrainControl.swift, KitPinAuth.swift, KitFamilyHome.swift, KitBrainStatusChip.swift
   Resources/UtilityWorker/*   (the Python utility worker)
   -> build-app.sh runs the kit's drift check and HARD_FAILs on a hand-edited copy

A linked product is one source of truth by construction. A vendored copy is a deliberate duplicate — needed where a target cannot take the package, or where a Python worker has to ship inside the app bundle — so it carries its origin in a header and a gate that refuses any drift. Firekeeper has no pytest or vitest suite for the family's checker to hook into, so its build script is where the drift check runs; it skips only on a Mac that does not have the kit repo at all.

Two Questions, Two Places

Moving code into a kit does not mean moving every decision with it. The hotkey case shows the line. Firekeeper's recorder once accepted any key carrying a modifier, while its name table covered neither Help, F13–F20 nor the keypad — so ⌘⌥F13 recorded, registered and worked, and Settings showed it as "⌘⌥key 105". The fix split one question into two. Which keys have names at all is a family fact, so naming moved to the kit: HotkeyKey can only be built from the complete table, and there is no numeric fallback left. Which keys this app wants is a product decision, so acceptance stayed in Firekeeper's own HotkeyValidation — Caps Lock is refused there, because hold-to-talk on a latching key is an open microphone.

What the Kit Bought

The kit is how fixes found in one app reach another. Firekeeper's clipboard restore saved only plain text; the family survey looking for duplicated code found that every other app already snapshotted all items, and Firekeeper took that shape. Its Swift 6 audio-tap crash was one the health app had already hit; the kit already shipped AudioTap.block(into:) for it, and the sweep that broke Firekeeper had simply not used it. One shared door to cwkPippa replaced a header pasted into three request builders and a retry that existed in one path and not in two others.

Share the vocabulary; keep the verdict. When several apps answer the same question, move the answer into shared code. When the question is what this product chooses, keep it in the product, even when the shared code could express the choice. Mixing the two puts one app's taste into every sibling.
A vendored copy without a gate is a fork. Copying shared code into an app is sometimes necessary. Copying it without a header naming its source and a check that fails on drift creates a private fork that nobody knows to update.

Code

The drift gate in Firekeeper's build (scripts/build-app.sh)·bash
# Firekeeper has no pytest/vitest suite, so the build is where
# the family's drift check runs.
SIBLING_KIT_SYNC="$ROOT_DIR/../cwkSiblingKit/sync/sibling_kit_sync.py"
if [[ -f "$SIBLING_KIT_SYNC" ]]; then
  if ! python3 "$SIBLING_KIT_SYNC" --check --repo cwkFirekeeper; then
    echo "HARD_FAIL vendored sibling-kit copy drifted — edit the kit and re-sync" >&2
    exit 1
  fi
fi

External links

Exercise

Find two projects you maintain that solve the same problem in two copies (an HTTP client, a settings loader, a key table). Decide which half is a shared fact and which half is each product's own decision. Sketch how the shared half would arrive — linked, or vendored with a source header and a drift check — and why.
Hint
Link when every consumer can take the dependency. Vendor only when it cannot (a different runtime, a bundled script), and then pay for it with a generated header and a gate that fails the build on drift. Keep each product's 'which ones do we want' rules out of the shared half.

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 in — Please sign in to comment.

No comments yet — be the first.