Skip to content

Epic: JSON Formatter & Event Schema #3

Description

@thm-design

Epic: JSON Formatter & Event Schema

Card: t_8fc3132c

Contains

  • US-1: Single-Command JSON Output (NDJSON)
  • US-4: Pretty JSON Mode

Technical Notes

  • JsonFormatter helper class in cortex/agent.py or new file
  • Nargs=? on --json argparse with const="ndjson", choices=["ndjson","pretty"]
  • Envelope schema: type + timestamp + data
  • 5 event types: session_start, tool_call, tool_result, say, error
  • Rich output completely suppressed when --json is active
  • --json is opt-in (default=None, current behavior unchanged)

Files Changed

  • cortex/cli/init.py (~15 lines)
  • cortex/agent.py (~50 lines)

Definition of Done

  • --json flag accepted by argparse
  • JsonFormatter emits NDJSON and pretty JSON
  • session_start event emitted on startup
  • say event emitted as final response
  • All Rich output suppressed in JSON mode
  • Existing tests pass unchanged

Metadata

Metadata

Assignees

No one assigned

    Labels

    epicEpic — group of related user storiesjson-flagCortex --json flag feature

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions