C.W.K.
Stream
Lesson 04 of 04 · published

Who Wrote This Line?

~11 min · attribution, editActor, snapshots, new-surface-rule

Level 0Cold Draft
0 XP0/33 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete
"When Pippa can edit your document, 'who wrote this?' becomes a real question. Answer it at the mutation site, or never."

Who Wrote This Line?

Once an AI can change your text, a new question appears that never existed in a normal editor: which of these words are mine? Six months later, reading a paragraph you love, you'd like to know whether you wrote it, Pippa rewrote it, or you accepted a proposal and then reworked it. That's not idle curiosity — for a writer whose voice is the whole product, it's the difference between your voice and a drift you never noticed.

Attribution Rides the Transaction

The answer must not become a second master. Rekindle doesn't keep an "AI edits" database beside the files — instead, attribution rides the edit itself. Every Pippa document mutation carries an editActor annotation on its CM6 transaction. Those annotations accumulate as you work, and each version snapshot records who touched it: you, pippa, or you+pippa. The files stay canonical; the attribution rides their history rather than a parallel store.

const editActor = Annotation.define<string>();

// Every Pippa mutation tags itself at the moment it happens.
view.dispatch({
  changes: { from, to, insert: replacement },
  annotations: editActor.of("pippa"),
});

The New-Surface Rule

Here's the part that's easy to get wrong, and it's stated as a hard rule: any future Pippa document mutation must tag editActor (or go through the Pippa-tagged replace helper). The failure mode is quiet — add a new Pippa-writes-to-the-doc surface a year from now, forget the tag, and its edits silently count as yours. Nothing errors; the attribution is just wrong forever, and you can't reconstruct it after the fact because the information only existed at the moment of the edit.

That's the general lesson: attribute at the mutation site, or not at all. Provenance can't be recovered later — it has to be captured where the change happens. Give every new writer a single tagged path (a helper that can't forget), and the rule enforces itself instead of relying on memory.

Code

Tag the actor at the mutation site·typescript
import { Annotation } from "@codemirror/state";

const editActor = Annotation.define<string>();

// Every Pippa doc-mutation tags itself AT the moment it happens.
function replaceRangeAsPippa(view, { from, to, insert }) {
  view.dispatch({
    changes: { from, to, insert },
    annotations: editActor.of("pippa"),
  });
}

// NEW-SURFACE RULE: any future Pippa write to the document must either
// tag editActor.of("pippa") or ride this helper. Forget it, and those
// edits silently count as the writer's own — with nothing to detect it.
// Provenance cannot be reconstructed after the edit; capture it here.

External links

Exercise

Imagine adding a new feature where Pippa writes into the document — say, auto-inserting a summary at the top. Trace the edit path and name the exact line where attribution must be attached. Then ask: if a future contributor added a second such feature and forgot, what would break? (Nothing — which is the point.) Design the helper that makes forgetting impossible.
Hint
The helper approach: make the ONLY exported way for Pippa to write to the document a function that tags editActor internally. If there's no untagged path available, a contributor can't forget — the structure enforces what a convention would leave to memory.

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.