# Audit Log (#23) — /goal Prompt

Self-contained prompt to drive autonomous execution of the Audit Log
implementation from `docs/plans/2026-05-20-audit-log-code-roadmap.md`.

**Usage:** copy the fenced block below and paste into `/goal` in this repo.
Each milestone executes, ships to `main`, then updates downstream roadmap
sections with realities learned before starting the next milestone.

If your `/goal` environment doesn't pre-load skill identifiers, replace
`superpowers-extended-cc:brainstorming` (and similar) with whatever
invocation form is correct. The workflow is the same.

---

```
GOAL: Implement the ScadaLink Audit Log component (#23) end-to-end against
the existing codebase by executing all 8 milestones from the roadmap at
docs/plans/2026-05-20-audit-log-code-roadmap.md. After each milestone ships
to main, update the remaining milestones in the roadmap with what was
actually learned. Done when M8 is merged and the full test suite is green.

═══════ STARTING STATE ═══════
Repo:           /Users/dohertj2/Desktop/scadalink-design
Starting ref:   main at 39a3ca3
Spec (immut.):  alog.md (commit fec0bb1) + docs/requirements/Component-AuditLog.md
Roadmap:        docs/plans/2026-05-20-audit-log-code-roadmap.md  (8 milestones, ~100 tasks)
Working tree:   3 infra/* modifications are PRE-EXISTING and UNRELATED.
                Never touch them. Use explicit `git add <path>`; never `commit -am`.

User-memory feedback to honor (under ~/.claude/projects/<this>/memory/):
  • feedback_subagent_cadence.md — bundle small adjacent tasks per milestone
  • feedback_central_ui.md       — Blazor Server + Bootstrap only, no 3rd-party frameworks
  • feedback_form_layout.md      — vertical stack, read-only first, buttons at bottom
  • feedback_recommendations.md  — lead with a recommended option

═══════ INVARIANTS (never violate) ═══════
1. Cross-refs to Component-AuditLog.md use PROSE anchors (e.g., "Payload
   Capture Policy"), NEVER `§N`.  § only exists in alog.md.
2. CachedCallTelemetry is the correct message name. CachedOperationTelemetry
   does not exist — never introduce it.
3. Audit-write failures NEVER abort user-facing actions anywhere — ESG calls,
   DB writes, Inbound API requests, Notify dispatches all continue normally
   if the audit append throws.
4. AuditLog is strictly append-only at central. No UPDATE. No row-level
   DELETE. Purge is partition-switch only.
5. Site SQLite purge requires ForwardState ∈ {Forwarded, Reconciled}; pending
   rows are never age-purged.
6. Do NOT push to origin. Never. Merges to main are local-only.
7. Hash-chain tamper-evidence and Parquet archival are deferred to v1.x.
   Do not implement them. Per-channel retention overrides also deferred.

═══════ PER-MILESTONE LOOP (M1 → M8) ═══════
For each milestone N from 1 to 8, in order:

  A. BRANCH
     git switch -c feature/audit-log-m{N}-<slice> from main.

  B. BRAINSTORM
     Invoke `superpowers-extended-cc:brainstorming` to nail any code-level
     decisions not fixed by the spec or roadmap (test-fixture placement,
     exact dispatcher names, helper signatures, etc.). One question at a
     time, recommended option first.

  C. WRITING-PLANS
     Invoke `superpowers-extended-cc:writing-plans` to turn the milestone's
     roadmap section into a milestone-specific executable plan at
     docs/plans/2026-XX-XX-auditlog-m{N}-<slice>.md with peer .tasks.json.
     Each task: exact file paths, TDD steps (failing test → impl → passing →
     commit), commit message.

  D. EXECUTE
     Invoke `superpowers-extended-cc:subagent-driven-development`.
     Per the cadence memory: bundle small adjacent tasks into one
     implementer dispatch + one combined spec+quality reviewer per bundle.
     Trivial 1–3 line fix-ups may be controller-direct edits; substantive
     fixes go through a fresh implementer subagent. End each milestone with
     a final cross-bundle reviewer over the whole branch.

  E. VERIFY (gate — do not skip)
     • Milestone-specific tests pass:  dotnet test --filter <pattern>
     • Full solution tests still pass: dotnet test ScadaLink.slnx
     • Every acceptance criterion from the roadmap's M{N} section is met,
       cited by name to the test that proves it.
     • If anything is red, fix-loop. Never proceed with red tests.

  F. MERGE
     git switch main
     git merge --no-ff feature/audit-log-m{N}-<slice> -m "<summary>"
     No push.

  G. UPDATE DOWNSTREAM ROADMAP (the novel step — do not skip)
     Before starting M{N+1}, edit the M{N+1}..M8 sections of
     docs/plans/2026-05-20-audit-log-code-roadmap.md to reflect realities
     learned during M{N}:
       • Correct any file paths that turned out different.
       • Update class/method names that got renamed during M{N}.
       • Add brief notes under affected later-milestone tasks pointing at
         the actual helper / fixture / pattern used in M{N} that the next
         milestone should reuse.
       • Remove tasks that turned out unnecessary; add tasks that turned
         out missing.
       • Do NOT rewrite milestones wholesale — only update what M{N}
         demonstrably changed.
     Commit on main:
       docs(audit): roadmap corrections after M{N}

  H. STATUS UPDATE
     Output one paragraph:
       - Milestone N and slice name
       - Commit SHA range merged to main
       - Tests added / total passing
       - Roadmap corrections summary (one line)
       - Next milestone

  I. PROCEED to M{N+1} (back to step A).

═══════ ASK THE USER BEFORE ═══════
• Implementing anything that contradicts the spec — flag the design gap,
  let the user decide whether to fix the design first.
• Touching a file the user is editing in working tree (always check
  `git status` first).
• Pulling a deferred v1.x feature into v1 scope.
• Pushing to origin (never push without explicit authorization).
• A milestone's acceptance criteria turn out unachievable as written.

═══════ TERMINATION ═══════
Done when ALL hold:
  1. M8 merged to main.
  2. `dotnet test ScadaLink.slnx` green (full solution).
  3. `dotnet test tests/ScadaLink.IntegrationTests/` green.
  4. Roadmap reflects what was actually shipped (corrections committed).
  5. infra/* still untouched and uncommitted.
  6. alog.md unchanged from fec0bb1 (or, if changed, the design correction
     was committed BEFORE the affected code change — never the reverse).
  7. Component-AuditLog.md unchanged unless a clarification was committed
     first, same discipline.

═══════ START ═══════
Begin with M1: Foundation (schema, types, DB roles, partitioning).
The roadmap's M1 section is the source of truth for the task list. Read it
fully before doing anything else, then proceed through the per-milestone
loop. Build to ship; do not get clever; trust the design.
```
