app-design-thinking
Design the app mechanism and build pipeline for the produced app — the app-phase analog of [[schema-design]]. Use this skill whenever the knowledge phases are…
The append-only event log + deterministic reducer pattern John uses to coordinate parallel subagent work on shared state. Each subagent emits its own event files; one reducer folds all events into canonical state. Beats file locks, scales to thousands of work units.
$ npx -y skills add kitchen-engineer42/joharnessburg --skill event-log-and-reducer --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/event-log-and-reducerContext preview
The summary Claude sees to decide when to auto-load this skill.
The append-only event log + deterministic reducer pattern John uses to coordinate parallel subagent work on shared state. Each subagent emits its own event files; one reducer folds all events into canonical state. Beats file locks, scales to thousands of work units.
name: event-log-and-reducer
description: The append-only event log + deterministic reducer pattern John uses to coordinate parallel subagent work on shared state. Each subagent emits its own event files; one reducer folds all events into canonical state. Beats file locks, scales to thousands of work units.
metadata:
triggers:
- event log
- reduce events
- coordinate subagents
- shared state
- reducerWhen N subagents are working in parallel on shared state, the naive approach (each subagent writes to a shared catalog file with a lock) is what KC (a sibling verification harness) learned the hard way is fragile at scale. John uses **event log + reducer** instead — same shape that React/Redux and event-sourced systems use, ported to filesystem.
Subagent A ── events/extract/chunks/A-001.json (append-only, A's own file) ─┐ Subagent B ── events/extract/chunks/B-002.json │ Subagent C ── events/extract/chunks/C-003.json ├──► reducer ──► .john/checkpoints/extract/state.json ... │ (canonical) Subagent N ── events/extract/chunks/N-200.json ─┘
In the user's project, under `<project>/.john/`:
Conventions:
printf '%s\n' '{"event_type":"chunk_complete","chunk_id":"chunk-042"}' | \
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/emit_event.py" \
--phase extract --work-unit-id chunk-042 \
--agent-id extractor-7 --audit-run-id run-20260709The writer injects a UUID `event_id`, UTC `timestamp`, `agent_id`, and `audit_run_id`. Raw events are append-only.
The only hard requirements (everything else is taste):
1. One event = one self-contained record. No references that require another event to interpret. 2. JSON-parseable. 3. Enough metadata for the reducer to order and deduplicate (timestamp + a sender id is the usual minimum).
A **minimal** schema that satisfies the rules:
{ "timestamp": "ISO 8601", "subagent_id": "string", "payload": {} }A **richer** schema (used in many knowledge-extraction templates) — useful when you need to query the event log by type:
{
"event_type": "entry_extracted",
"work_unit_id": "chunk_042",
"timestamp": "2026-05-21T10:42:33Z",
"subagent_id": "sub-xx7f3a",
"payload": { "entry_ids": ["e_001", "e_002"], "notes": "..." }
}Templates and phase-specific skills define their own schemas freely, as long as the three requirements above hold. Neither shape above is canonical — wide tunnel.
The reducer is a script (Python — John ships `scripts/reduce_events.py`) that:
1. **Reads all event files** under `<project>/.john/events/<phase>/`. 2. **Sorts them deterministically** (timestamp + subagent_id is a safe primary key). At thousands-of-events scale, clock skew or identical timestamps happen — `${CLAUDE_PLUGIN_ROOT}/scripts/reduce_events.py` handles the tiebreaker. If your fold function depends on strict ordering, review the tiebreaker before trusting the result. 3. **Folds them into canonical state** using a per-phase fold function. The fold function's exact shape depends on what the phase is producing — for extraction, it concatenates entry lists and indexes by ID; for review, it tallies pass/fail; etc. 4. **Writes canonical state** to `<project>/.john/checkpoints/<phase>/state.json`. 5. **Returns idempotently**: running it twice with the same event set produces the same output, bit-for-bit.
Idempotency matters because the reducer may be invoked multiple times during a phase (e.g., after each wave of subagents) without state corruption.
`reduce_events.py` ships two deterministic checks for the end of a phase — zero tokens, pure file walking:
中文版: README_ZH.md John turns unstructured source material into a working knowledge-dense app. It keeps knowledge engineering and app building in one durable run, coordinates large per-entry fan-outs, and leaves auditable events and checkpoints on disk.
Design the app mechanism and build pipeline for the produced app — the app-phase analog of [[schema-design]]. Use this skill whenever the knowledge phases are…
Bundle a finished John workspace from Codex. Use when the user wants to archive, package, hand off, or preserve a John project, or wants the Claude command…
Break parsed markdown into a tree of progressively-disclosed chunks for downstream extraction. Use this skill whenever a phase needs to work on per-chunk…
Apply deterministic quality checks to the code John produces — catch the 80% of issues (leaked API keys, hardcoded prod URLs, broken imports, missing…
Generate John's process scorecard, auditor manifests, and shareable run report from a Codex project using John's provider-neutral scripts. Use when the user…
Activate a Hamster-built or otherwise applied John template for Codex in the current project. Use when a merged template plugin already exists, when the user…