The line head's registry
A line head reads its source again on every run, and sources repeat themselves: a mailbox lists last week's emails, a folder gets the same file dropped in twice, an API returns the same records. So the line head keeps a registry: one line for each unit it has taken in. Each run it skips every unit already in the registry, creates workpieces for the rest, and adds them.
temp/stations/IN0/
├── output/
├── failed/
└── intake-registry.jsonl
{"workpiece_id":"inv-1001","sha256":"9f2c41…","source_file":"acme-1001.pdf","seeded_at":"2026-11-03T09:00:12.004Z"}
{"workpiece_id":"inv-1002","sha256":"07be9d…","source_file":"acme-1002.pdf","seeded_at":"2026-11-03T09:00:12.004Z"}
It sits next to the bins, not in one
The registry is a file in the line head's own folder, where you already look. It isn't a bin and it isn't a workpiece: it has no pointer.json, and nothing moves it. Clearing workpieces out of the bins leaves it alone. Deleting the station's whole folder starts the line head over, as if it had never run.
What to key it on
The key is whatever tells you "I've seen this one". Keep it under the name the source uses (message_id, sha256, url), as in pointer.json.
| The source gives you | Key on | The workpiece id |
|---|---|---|
| A stable id: a message id, a record id, a document id | That id | Taken from the id |
| Files with no id | A fingerprint of the content (sha256), so a renamed or re-dropped copy is still the same file | A counter the registry keeps: inv-1, inv-2… |
| A list of links or paths | The link or path | A counter |
| Records that change after you take them (edits) | A watermark: the time of the latest change you took | The record's id plus the change time, so each edit is a workpiece of its own |
| A whole recomputation from many inputs, such as a daily cycle | A fingerprint of all the inputs | The date plus the fingerprint. If nothing changed since the last run, seed nothing. |
Record what you chose not to take
When the line head looks at a unit and decides not to seed it (an email from a sender it ignores, a message with no attachment), it records that too, with no workpiece id and the reason. Otherwise it fetches and judges the same unit again on every run. The run report counts these skips, so nothing leaves silently.
Order the writes so a crash repeats work, never loses it
When the workpiece id comes from the source, create the workpiece first and add the registry line second. A crash between the two creates the same workpiece again on the next run, at the same path, which does no harm. The other order can lose it: the registry says "taken", but no workpiece exists.
If the line head also removes the unit from its inbox, do that last, after both writes. Until then, a crash leaves the unit where the next run will find it.
Read it forgivingly
Skip a line that doesn't parse. A crash in the middle of an append leaves a cut-off last line, and that must not stop the line head from taking in new work.
One writer
Only the line head writes its registry. Later stations may read it, for example to find the other workpieces that came from the same email, or to trace what became of a file someone sent. A second station that writes to it shares state with the line head that nobody owns. Give that station its own record instead.
Related
- Splitting work: parts cut from a bundle come back through the line head and its registry
- Write a station that processes workpieces: the factory template's line head,
EX0, with its registry