Skip to content

mship journal: add --json / --format jsonl exporter for downstream tooling #101

@atomikpanda

Description

@atomikpanda

Problem

The per-task journal is markdown with a structured key-value schema — machine-parseable by tools that know the format. But the pre-existing ecosystem for agent traces (CodeTracer, AgentStepper, dashboards, eval scripts) expects JSON or JSONL.

Dual-writing a parallel .mothership/events/<slug>.jsonl alongside the markdown journal was proposed and rejected: two serializations of the same data diverge; dual-write discipline is expensive; the markdown is canonical by design.

Proposal

Add a read-time transformer. Markdown stays authoritative; JSON/JSONL is a view.

mship journal --task <slug> --json             # all entries as a JSON array
mship journal --task <slug> --format jsonl     # one entry per line
mship journal --task <slug> --action hypothesis --json
mship journal --task <slug> --since last-phase-change --json
mship journal --task <slug> --since <iso-timestamp> --json

Each entry emits a stable JSON object with known fields from the existing LogEntry schema:

{
  "timestamp": "2026-04-24T14:03:12Z",
  "action": "hypothesis",
  "message": "Token refresh race between middleware and frontend retry logic",
  "id": "a3f4c2e1",
  "evidence": "api/tests/auth_test.py:44-71",
  "repo": null,
  "iteration": null,
  "test_state": null,
  "parent": null,
  "category": null,
  "open_question": null
}

Filters (--action, --since, --repo) narrow the emission without changing the field shape. Unknown fields in the markdown source round-trip faithfully.

Why a read-time transformer, not dual-write

  • The markdown schema is already load-bearing for downstream tools per the Workflow: systematic debugging loop — mship-aware diagnose → fix → verify #30 design (CodeTracer/AgentStepper parse the key-value kv directly).
  • Dual-write introduces an invariant (the two files must stay in sync) that mship doesn't need and can't cheaply enforce.
  • Downstream consumers that want JSONL can run mship journal --format jsonl once per ingestion pass.

Minimum filters for v1

  • --action <value> — only entries with that action.
  • --since <iso-timestamp> — entries newer than a given time.
  • --since last-phase-change — entries since the most recent phase-change entry.
  • --repo <name> — entries tagged with that repo.

Additional filters (by id, by parent chain, etc.) are followups if demand surfaces.

Out of scope

  • No new on-disk files.
  • No cross-task aggregation in v1 (query a single task's journal at a time).
  • No format-stability guarantee yet — the JSON output follows the markdown's kv schema; new kv fields appear as new JSON keys.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions