PR #TBD — Phase 3: Remediation Audit Log

The Broader Goal at the End of the Previous PR

PR #587 corrected the harness-compatibility spec itself, but it also sharpened the operational requirement behind the spec's §2a remediation flow: any future doctor --fix write must leave behind a durable, append-only audit trail. The existing DB-canonical state engine had already solved that class of problem for roadmap.md, memory.md, and costs.md; the missing piece here was a write-only remediation ledger with no pruning behavior and no separate file-based shadow system.

Strategic Shifts in This PR (if any)

No goalpost move. This phase follows the PR #542 state-engine pattern instead of inventing a new log format or reusing the rolling telemetry file. The only explicit choice was to keep the remediation audit in state.db because the DB path is available in this repo context; the JSON fallback mentioned in the plan remains a contingency, not the primary mechanism.

What This PR Shipped

  • A new remediation_actions table in the canonical SQLite schema, with fields for timestamp, agent, target_file, exact_diff, and operator.
  • A matching migration path in synlynk/db.py so older DBs get the table on first open.
  • cmd_remediation_log(...), an append-only write helper that inserts one audit row per confirmed remediation and never updates or prunes prior entries.
  • A regression test that writes 101 entries, verifies the table still contains all 101, and confirms the first and last writes are both preserved. That proves the audit log is not inheriting the 100-entry rolling cap used by .synlynk/telemetry.json.

Brainstorm Visuals Used

None.

What This Achieved on the Path to Autonomy

Phase 4 can now require every --yes-confirmed remediation write to append a durable record before the write completes. That closes a process gap in the remediation flow: operator-confirmed fixes will be auditable without depending on a prunable telemetry trail or an ad hoc markdown note.

Strategic Note: The Goal at the End of This PR

The next goalpost is Phase 4: wire synlynk doctor --fix agy to compute the exact settings diff, show it to the operator, and append one remediation audit row for every confirmed write.