singularity-forge/src
Mikael Hugo a303b5db29 feat(uok): add purpose-coherence-gate pre-dispatch gate (ADR-0000)
Restores the eight-PDD purpose gate at the autonomous-loop boundary
required by ADR-0000 (SF is a purpose-to-software compiler). The gate
walks milestone vision -> slice.traces_vision_fragment ->
task.purpose_trace before every dispatch and refuses to proceed when
the purpose chain is broken at the vision root (degraded-vision).

- New uok/purpose-coherence.js with a pure verdict function and a
  DB-backed adapter. Reads vision/trace columns directly via SQL so
  pre-P2/P3 schema migrations are tolerated.
- Wired into auto/phases-pre-dispatch.js alongside resource-version-
  guard, pre-dispatch-health-gate, and planning-flow-gate. Fires on
  every pre-dispatch turn and emits to the existing trace JSONL.
- Outcome ladder: fail (vision missing -> pause loop), warn (trace
  columns missing or NULL -> surface but allow dispatch so legacy DBs
  don't hard-break on day one), pass (full chain).
- Tests in tests/uok-purpose-coherence.test.mjs cover the four
  contracted states plus the column-missing downgrade path on a
  pre-migration schema.

Refs: ADR-0000.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 18:42:55 +02:00
..
resources feat(uok): add purpose-coherence-gate pre-dispatch gate (ADR-0000) 2026-05-15 18:42:55 +02:00
tests fix(headless): bypass rpc for status 2026-05-15 17:32:21 +02:00
web
app-paths.ts
bundled-extension-paths.ts
bundled-resource-path.ts
claude-cli-check.ts
cli-key.ts feat(cli): add sf key subcommand for auth.json management 2026-05-15 16:37:04 +02:00
cli-logs.ts
cli-stats.ts
cli-status.ts
cli-web-branch.ts
cli.ts feat(cli): add sf key subcommand for auth.json management 2026-05-15 16:37:04 +02:00
env.ts
errors.ts
extension-discovery.ts
extension-registry.ts
headless-answers.ts
headless-context.ts
headless-events.ts
headless-feedback.ts feat(memory-embeddings): read SF_LLM_GATEWAY_KEY from env as auth.json fallback 2026-05-15 17:13:40 +02:00
headless-import-backlog.ts
headless-mark-state.ts feat(memory): add debug logging to memory extraction pipeline 2026-05-15 16:09:36 +02:00
headless-query.ts
headless-reflect.ts
headless-status.ts fix(headless): bypass rpc for status 2026-05-15 17:32:21 +02:00
headless-triage.ts
headless-types.ts
headless-ui.ts
headless-uok-status.ts
headless-usage.ts
headless.ts fix(headless): bypass rpc for status 2026-05-15 17:32:21 +02:00
help-text.ts feat(memory-embeddings): read SF_LLM_GATEWAY_KEY from env as auth.json fallback 2026-05-15 17:13:40 +02:00
interactive-session-lock.ts
loader.ts
logger.ts
logo.ts
models-resolver.ts
onboarding.ts
pi-migration.ts
project-sessions.ts
provider-migrations.ts
remote-questions-config.ts
resource-loader.ts
rtk.ts
security-overrides.ts
startup-model-validation.ts
startup-timings.ts
tool-bootstrap.ts
traces.ts
update-check.ts
update-cmd.ts
web-mode.ts
welcome-screen.ts
wizard.ts
worktree-cli.ts
worktree-name-gen.ts