Skip to content

ADR-002: HELIX Tracker Write Safety Model

Source identity (from 02-design/adr/ADR-002-tracker-write-safety-model.md):

ddx:
  id: ADR-002
  depends_on:
    - helix.prd
    - ADR-001

ADR-002: HELIX Tracker Write Safety Model

DateStatusDecidersRelatedConfidence
2026-03-27ProposedHELIX maintainerstracker, installer, testsHigh

Context

AspectDescription
ProblemThe built-in HELIX tracker stores one JSON object per line in .helix/issues.jsonl, but current mutation paths are naive enough that malformed writes or overlapping edits can corrupt the file and break all tracker operations.
Current StateTracker writes are implemented as full-file read/modify/write cycles with no explicit conflict detection contract, no malformed-file recovery contract, and limited metadata mutation support. Real planning work has already reproduced JSONL corruption while refining issues.
RequirementsHELIX needs a conservative local tracker that is safe enough for agent-driven issue refinement and concurrent local supervision. The tracker must surface malformed state explicitly, define what concurrency/conflict guarantees are supported, and make metadata mutation available through first-class commands instead of direct file edits.

Decision

We will define the HELIX tracker as a conservative file-backed system with explicit write-safety guarantees, conflict visibility, and fail-closed corruption handling.

The tracker will not pretend to provide arbitrary multi-writer transactional semantics. Instead, it will define the supported local execution model, require explicit detection or prevention of silent lost updates, and make malformed tracker state a surfaced failure rather than something the rest of HELIX must guess around.

The supported local model must explicitly include one automated helix-run session progressing execution while another local session refines specs or tracker issues. The write-safety model therefore has to support not just file integrity, but also concurrency-visible mutation semantics that let the runner revalidate issue state at safe boundaries.

Key Points: explicit local write model | fail closed on malformed state | first-class mutation APIs instead of manual JSONL edits

Alternatives

OptionProsConsEvaluation
Keep naive JSONL read/modify/write and rely on careful operator usageLowest implementation effortProven corruption risk, no race semantics, unsafe for agent-driven refinementRejected: already failing in real use
Replace the tracker immediately with a database-backed systemStronger concurrency primitivesMuch larger implementation jump, higher distribution complexity, changes HELIX surface area substantiallyRejected for now: too large for the immediate hardening goal
Keep JSONL but define and enforce a conservative write-safety contractPreserves the current HELIX tracker shape, addresses current failures, enables deterministic testingRequires explicit conflict/corruption handling and careful write-path designSelected: smallest sufficient hardening

Consequences

TypeImpact
PositiveTracker behavior becomes specifiable and testable instead of depending on lucky file writes.
PositiveHELIX issue refinement can move toward first-class metadata mutation APIs rather than direct JSONL edits.
PositiveThe tracker becomes a reliable coordination layer between automated execution and interactive refinement.
PositiveMalformed tracker state becomes diagnosable instead of cascading into undefined behavior.
NegativeTracker commands may fail more often and earlier when they detect malformed or conflicting state.
NegativeAdditional deterministic tests and write-path safeguards are required before the contract is real.
NeutralThe tracker remains file-backed and local-first for now.

Risks

RiskProbImpactMitigation
The supported local concurrency model remains underspecifiedMHPair this ADR with an explicit tracker contract artifact and deterministic tests
The hardening layer adds partial protections but still misses silent lost updatesMHMake race and corruption scenarios executable in the harness before claiming safety
Metadata mutation expansion broadens the surface faster than the safety modelMMDefine mutation contract first, then add APIs behind tests
File safety improves but helix-run still closes stale work after concurrent refinementMHDefine pre-claim/pre-close revalidation and issue supersession semantics in the technical design

Validation

Success MetricReview Trigger
Tracker docs and tests describe the same write-safety and corruption-handling modelAny tracker mutation behavior that is implemented but not captured in the contract or tests
Real malformed-state and overlapping-mutation scenarios fail conservatively instead of corrupting the fileA reproduced issue causes invalid JSONL or silent lost updates
HELIX issue refinement no longer requires direct JSONL surgery for supported metadata changesA HELIX workflow still needs manual JSONL edits for normal tracker mutation needs
Concurrent local operator refinement is surfaced as queue drift rather than hidden stale executionhelix-run claims or closes work after a material tracker change without revalidation

References