Codex review of the trace-event fold found two merge-blockers. Blocker #1 — format version. Folding usage onto assistant/message and removing the standalone usage/error events changed the persisted SessionEventMap shape, which per the AGENTS.md "bump the version and reject — don't migrate" policy requires a backend to reject any non-current log. Centralize the version in an exported SESSION_FORMAT_VERSION constant (dsh-session), read by both write sites (Session constructor default, SessionStore.prepare header) and the coordinator's load-time assertVersion check. The constant is pinned at 0: while unreleased the on-disk format is unstable/pre-release, so breaking shape churn is absorbed at v0 (no monotonic bump until the first tagged release) and any non-0 log is rejected on load — no migration. Update every test/fixture/doc that stamps a currently-written header to the constant, bump the ACP snapshot fixture + golden headers to v0, and keep the version-rejection test meaningful by switching its bad value to a clearly non-current 99. AGENTS.md documents both the monotonic (SQLite SCHEMA_VERSION) and pinned-0 (session log) pre-release stances. Blocker #2 — restore the late turn-end warn. failTurn now sets the error reason only while the turn is still open; once turn/end is appended (a throwing agent/turn-end listener after closeTurn) the reason can no longer reach the durable log, so the late throw is logged via ctx.logger.warn instead of vanishing into a futile post-close assignment. A regression test asserts the warn fires. Also guard the normal-step assistant/message append with the same content-or-usage condition as the max-tokens branch (a content-less, usage-less step records no trace-only row), with a covering test.
Examples
Runnable demos (not workspaces) that showcase how the harness is wired.
echo-agent
A mock model + echo tool + stdio UI + JSONL persistence demo. Demonstrates:
- Loading plugins from a
cordis.ymlvia@cordisjs/plugin-loader+@cordisjs/plugin-include - Registering a mock
LlmAdapter(streaming scripted responses) - Registering a tool via
ctx.tools.register() - Persisting session events to JSONL via the
session/event+session/flushpattern - A minimal stdio UI consuming
agent/stream-chunkand session events
Run with: pnpm run demo:echo
When prompted, type "echo " to trigger a tool call round-trip.
coding-agent
The real thing: DeepSeek V4 + the bash tool suite + stdio chat + JSONL persistence, wired from cordis.yml. Where echo-agent proves the skeleton with mocks, this is a usable coding assistant.
Run with: pnpm run demo:coding (needs DEEPSEEK_API_KEY in the environment or a gitignored repo-root .env). See coding-agent/README.md for details.