Skip to content

feat: structured JSON output mode for programmatic consumption #17

@Jamie-BitFlight

Description

@Jamie-BitFlight

Summary

Add a JSON/JSONL output mode so trigger matches can be consumed programmatically by CI pipelines, dashboards, or other tools.

Current Behavior

The stop hook outputs human-readable text to stdout. This works for Claude Code's stop hook mechanism but is difficult to parse for automation.

Proposed Behavior

Support multiple output formats via config or environment variable:

text (default, current)

HALLUCINATION_DETECTED: speculation_language — "I think" at offset 12

json

{
  "status": "fail",
  "triggerCount": 3,
  "triggers": [
    { "kind": "speculation_language", "evidence": "I think", "offset": 12, "confidence": 75 },
    { "kind": "causality_language", "evidence": "because", "offset": 45, "confidence": 82 }
  ],
  "scannedLength": 1024,
  "timestamp": "2026-02-28T03:50:00Z"
}

jsonl

One JSON object per line — suitable for streaming and log aggregation.

Use Cases

  • CI pipeline integration (fail build on hallucination triggers)
  • Dashboard/metrics collection
  • Integration with other tools that consume structured output
  • Aggregating trigger statistics across sessions

Acceptance Criteria

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestimpact: contractChanges stdin/stdout contract with Claude Code. High risk.phase: 5-output-pipelinePhase 5: Output format (must preserve hook contract)risk: criticalCritical risk — can silently disable the hooktopic: outputOutput format, JSON, suggested fixes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions