What problem does it solve?
Stage 2 turns per-function safety-relevant fault analysis from Stage 1 into vehicle-level hazards with the correct JSON output structure and review gates, reducing inconsistent hazard mapping.
Core Features & Use Cases
- Stage 1 → Vehicle hazard conversion: Converts only non-nan faults whose
field_reasoning.推理.是否有安全风险=是 into mf_vehicle_hazards, producing one record per safety-related fault cell.
- Strict traceability preservation: Copies
Stage1_Fault_Text verbatim into 故障描述 and retains Stage 1 row/function/fault field trace fields for later Stage 3 extraction.
- Schema-locked outputs: Produces deterministic Stage 2 slice JSON that matches
references/json-contracts.md, using references/stage2-hazard.md for mapping semantics.
- Review and merge guardrails: Runs
stage2_slice --fix, blocks final merging until Stage2R semantic review passes, and merges slices only via tools/hara/merge_stage2.py.
Quick Start
Run hara-stage2 for a single Function_ID to generate output/<RUN_ID>_stage2_<Function_ID>_mf_vehicle_hazards.json, then run the Stage 2 checks and merge only after Stage2R approval.