singularity-forge/src
Mikael Hugo 39e2dc70c9 feat: ADR-021 Phase D + E — scaffold-keeper agent + /sf scaffold sync command
Phase D: scaffold-keeper background agent
- scaffold-keeper.ts: dispatchScaffoldKeeperIfNeeded fires async after milestone
  completion and on stopAuto cleanup. Detects editing-drift items, writes
  <file>.proposed artifacts (template-only stub for now; later wires the
  records-keeper skill subagent for code-as-fact merging), emits a structured
  approval_request notification with stable dedupe_key so repeated runs don't
  spam the user.
- Wired into auto-post-unit.ts and auto.ts:stopAuto via fire-and-forget so
  the auto loop is never blocked by scaffold work.
- Failure modes non-fatal: try/catch around the dispatch, errors logged via
  logWarning("scaffold").

Phase E: /sf scaffold sync command (escape hatch)
- commands-scaffold-sync.ts: parseScaffoldSyncArgs + handleScaffoldSync.
- Flags:
    --dry-run         report what would change, no writes
    --include-editing run scaffold-keeper synchronously for editing-drift items
    --only=<glob>     scope to a path glob (suffix/prefix match)
- Wired into the SF command system via commands-bootstrap.ts, commands/catalog.ts,
  and commands/handlers/ops.ts following the existing /sf <verb> pattern.
- Reuses ensureAgenticDocsScaffold from Phase C — doesn't reimplement sync logic.

Doctor finding (checkScaffoldFreshness) refined to reference the new command.

Tests: 8 new cases in scaffold-keeper.test.ts. All 49 scaffold tests green.

Together with Phases A-C, this completes ADR-021. Documents are now versioned,
upgrades are automatic for the safe cases, and editing-drift surfaces through
.proposed artifacts and structured notifications. The scaffold-keeper agent
body is currently a template-only stub; replacing it with a real records-keeper
subagent dispatch is a follow-up that the architecture now enables.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 00:45:54 +02:00
..
resources feat: ADR-021 Phase D + E — scaffold-keeper agent + /sf scaffold sync command 2026-05-02 00:45:54 +02:00
tests feat: stabilize autonomous workflow system 2026-05-01 20:18:50 +02:00
web feat: stabilize autonomous workflow system 2026-05-01 20:18:50 +02:00
app-paths.ts feat: introduce repo-vcs skill and add JSDoc annotations across core modules 2026-05-01 21:36:32 +02:00
bundled-extension-paths.ts feat: introduce repo-vcs skill and add JSDoc annotations across core modules 2026-05-01 21:36:32 +02:00
bundled-resource-path.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
claude-cli-check.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
cli-logs.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
cli-stats.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
cli-status.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
cli-web-branch.ts feat: stabilize autonomous workflow system 2026-05-01 20:18:50 +02:00
cli.ts feat: stabilize autonomous workflow system 2026-05-01 20:18:50 +02:00
errors.ts feat: introduce repo-vcs skill and add JSDoc annotations across core modules 2026-05-01 21:36:32 +02:00
extension-discovery.ts feat: introduce repo-vcs skill and add JSDoc annotations across core modules 2026-05-01 21:36:32 +02:00
extension-registry.ts feat: introduce repo-vcs skill and add JSDoc annotations across core modules 2026-05-01 21:36:32 +02:00
headless-answers.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
headless-context.ts sf snapshot: pre-dispatch, uncommitted changes after 53m inactivity 2026-04-30 19:10:38 +02:00
headless-events.ts fix: make isMilestoneReadyNotification metadata-authoritative 2026-05-01 23:08:55 +02:00
headless-query.ts Harden SF model routing and harness contracts 2026-04-30 07:41:24 +02:00
headless-types.ts feat: structured notification event model with metadata-first classification 2026-05-01 23:07:57 +02:00
headless-ui.ts feat: stabilize autonomous workflow system 2026-05-01 20:18:50 +02:00
headless.ts feat: introduce repo-vcs skill and add JSDoc annotations across core modules 2026-05-01 21:36:32 +02:00
help-text.ts feat: stabilize autonomous workflow system 2026-05-01 20:18:50 +02:00
loader.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
logo.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
mcp-server.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
models-resolver.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
onboarding.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
pi-migration.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
project-sessions.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
provider-migrations.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
remote-questions-config.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
resource-loader.ts sf snapshot: pre-dispatch, uncommitted changes after 53m inactivity 2026-04-30 19:10:38 +02:00
rtk.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
security-overrides.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
startup-model-validation.ts feat: Replaced bare error writes in cli.ts, headless.ts, and startup-mo… 2026-04-30 15:43:29 +02:00
startup-timings.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
tool-bootstrap.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
traces.ts feat: introduce repo-vcs skill and add JSDoc annotations across core modules 2026-05-01 21:36:32 +02:00
update-check.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
update-cmd.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
web-mode.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
welcome-screen.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
wizard.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
worktree-cli.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00
worktree-name-gen.ts batch: snapshot of in-flight v2 work 2026-04-29 12:42:31 +02:00