Skip to content

feat(cli): reasonix events <name> — first user-facing consumer of the event log#3

Merged
esengine merged 1 commit into
mainfrom
feat/events-cli
Apr 29, 2026
Merged

feat(cli): reasonix events <name> — first user-facing consumer of the event log#3
esengine merged 1 commit into
mainfrom
feat/events-cli

Conversation

@esengine

Copy link
Copy Markdown
Owner

Summary

Closes the v0.14 kernel loop: events get written by every session (PR #2), and now there's a tool to read them. `reasonix events ` is the first user-facing consumer of `~/.reasonix/sessions/.events.jsonl`.

This is the architecture-value tipping point — events.jsonl is no longer a write-only artifact. It's queryable from the command line.

```
$ reasonix events code-reasonix --tail 10
[events] code-reasonix 10 event(s) ~/.reasonix/sessions/code-reasonix.events.jsonl

[ 73] t8 12:41:02 user.message "show me the test pass count"
[ 74] t8 12:41:03 model.turn.started model=deepseek-v4-flash effort=max prefix=a3f9c012
[ 75] t8 12:41:04 model.delta content "I'll check…"
[ 76] t8 12:41:06 tool.intent tc-12 run_command args={"command":"npm test --silent"}
[ 77] t8 12:41:06 tool.dispatched tc-12
[ 78] t8 12:41:24 tool.result tc-12 ok 1832B
[ 79] t8 12:41:25 model.delta content "1753 tests pass."
[ 80] t8 12:41:26 model.final cost=$0.0009 in=14328 out=42
```

Flags

  • `--type ` — filter to one event variant (e.g., `tool.intent`)
  • `--since ` — only events with id ≥ N
  • `--tail ` — last N events
  • `--json` — raw JSONL passthrough (jq-friendly)
  • `--projection` — dump the final reduced ProjectionSet (conversation / budget / plan / workspace / capabilities / status / session)

Files

New:

  • `src/cli/commands/events.ts` — formatter + per-type detail table for all 25 Event variants
  • `tests/events-command.test.ts` — 6 tests pinning the formatter + each flag

Modified (additive):

  • `src/cli/index.ts` — command registration

Cleanup pass (per the architect-cleanliness rule the user just reinforced):

  • `src/core/eventize.ts` — removed verbose module header, redundant per-method jsdocs, restated-the-code comments
  • `src/adapters/event-sink-jsonl.ts` — same
  • `src/adapters/event-source-jsonl.ts` — same
  • `tests/event-replay.test.ts` — restated-the-asserts comments dropped

~80 lines of comment cruft gone, no logic touched.

Test plan

  • `npm run verify` — 1753 tests pass (was 1747 + 6 new)
  • `npm run lint` clean
  • `npm run typecheck` clean
  • Manual: run a session, then `reasonix events ` to inspect; `--projection` to see the reduced view; `--tail 5` to scope; `--json | jq '.type'` to verify pipeline-friendliness

What this unlocks

events.jsonl is now a debuggable, scriptable, replayable artifact. Future work can layer on:

  • TUI `/replay-events` to load a past session into a projection-driven view
  • Web dashboard reading from event log instead of LoopEvent
  • Multi-agent event trees with parent correlation

But each future PR is now optional. The kernel and its first consumer ship together. Mission accomplished.

reasonix events <name> pretty-prints the event-log sidecar — the first
user-facing consumer of events.jsonl. Renders one line per event with
per-type detail synopses; --type / --since / --tail filters; --json
for jq pipelines; --projection dumps the reduced ProjectionSet. Closes
the v0.14 kernel loop: events get written by every session, and now
there's a tool to read them.

Sweep pass: trimmed verbose jsdoc / restated-the-code comments off
eventize.ts, event-sink-jsonl.ts, event-source-jsonl.ts, and the
tests. ~80 lines of comment cruft gone, no logic changed.

- src/cli/commands/events.ts: command formatter + per-event detail
  table covering all 25 Event variants
- src/cli/index.ts: command registration with commander, help text
- tests/events-command.test.ts: 6 tests pinning the formatter + each
  flag (type filter, tail, json passthrough, projection, missing
  session error path)

1753 tests pass (was 1747 + 6 new).
@esengine esengine merged commit f29eb40 into main Apr 29, 2026
2 checks passed
@esengine esengine deleted the feat/events-cli branch April 29, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant