feat(P2+P3): IHF Phase 2 complete; register Phase 3 workplan
Phase 2 — Structured Feedback and Triage (IHUB-WP-0002):
- Schema: annotation_threads, requirement_candidates, triage_states,
reviewer_assignments; annotations extended with severity + thread_id
- AnnotationThreadsController: create threads, assign annotations
- RequirementCandidatesController: CRUD, escalation, triage lifecycle,
reviewer assignment, my-queue
- Annotation severity (low/medium/high/critical) with Tailwind color cues
- TriageDashboardAction on HubsController with autoRefresh
- Integration tests (T01–T09), SCOPE.md updated, docs/phase2-summary.md
Phase 3 — Governance and Decision Linkage (IHUB-WP-0003):
- Workplan registered: 9 tasks, State Hub workstream 5f201ee3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 23:37:34 +00:00
|
|
|
-- IHF Phase 1 + Phase 2 Schema
|
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
-- Hub, Widget, WidgetVersion, InteractionEvent, Annotation
|
feat(P2+P3): IHF Phase 2 complete; register Phase 3 workplan
Phase 2 — Structured Feedback and Triage (IHUB-WP-0002):
- Schema: annotation_threads, requirement_candidates, triage_states,
reviewer_assignments; annotations extended with severity + thread_id
- AnnotationThreadsController: create threads, assign annotations
- RequirementCandidatesController: CRUD, escalation, triage lifecycle,
reviewer assignment, my-queue
- Annotation severity (low/medium/high/critical) with Tailwind color cues
- TriageDashboardAction on HubsController with autoRefresh
- Integration tests (T01–T09), SCOPE.md updated, docs/phase2-summary.md
Phase 3 — Governance and Decision Linkage (IHUB-WP-0003):
- Workplan registered: 9 tasks, State Hub workstream 5f201ee3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 23:37:34 +00:00
|
|
|
-- Phase 2: AnnotationThread, RequirementCandidate, TriageState, ReviewerAssignment
|
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
-- See workplans/IHUB-WP-0001-ihf-phase1-minimal-interaction-core.md
|
feat(P2+P3): IHF Phase 2 complete; register Phase 3 workplan
Phase 2 — Structured Feedback and Triage (IHUB-WP-0002):
- Schema: annotation_threads, requirement_candidates, triage_states,
reviewer_assignments; annotations extended with severity + thread_id
- AnnotationThreadsController: create threads, assign annotations
- RequirementCandidatesController: CRUD, escalation, triage lifecycle,
reviewer assignment, my-queue
- Annotation severity (low/medium/high/critical) with Tailwind color cues
- TriageDashboardAction on HubsController with autoRefresh
- Integration tests (T01–T09), SCOPE.md updated, docs/phase2-summary.md
Phase 3 — Governance and Decision Linkage (IHUB-WP-0003):
- Workplan registered: 9 tasks, State Hub workstream 5f201ee3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 23:37:34 +00:00
|
|
|
-- See workplans/IHUB-WP-0002-ihf-phase2-structured-feedback-and-triage.md
|
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
|
|
|
|
|
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
|
|
|
|
|
|
|
|
|
-- Users (T10 — authentication)
|
|
|
|
|
CREATE TABLE users (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
|
|
|
email TEXT NOT NULL UNIQUE,
|
|
|
|
|
password_hash TEXT NOT NULL,
|
|
|
|
|
name TEXT NOT NULL,
|
|
|
|
|
locked_at TIMESTAMP WITH TIME ZONE DEFAULT NULL,
|
|
|
|
|
failed_login_attempts INT NOT NULL DEFAULT 0,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
-- Hubs — bounded domains of responsibility
|
|
|
|
|
CREATE TABLE hubs (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
|
|
|
slug TEXT NOT NULL UNIQUE,
|
|
|
|
|
name TEXT NOT NULL,
|
|
|
|
|
domain TEXT NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
api_key TEXT,
|
|
|
|
|
hub_kind TEXT NOT NULL DEFAULT 'domain'
|
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
-- Widgets — smallest semantically governable interaction units
|
|
|
|
|
CREATE TABLE widgets (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
hub_id UUID NOT NULL,
|
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
name TEXT NOT NULL,
|
|
|
|
|
widget_type TEXT NOT NULL,
|
|
|
|
|
capability_ref TEXT,
|
|
|
|
|
view_context TEXT,
|
|
|
|
|
policy_scope TEXT NOT NULL DEFAULT 'internal',
|
|
|
|
|
status TEXT NOT NULL DEFAULT 'active',
|
|
|
|
|
version INT NOT NULL DEFAULT 1,
|
2026-04-04 09:55:12 +00:00
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
adapter_spec_id UUID,
|
|
|
|
|
is_archived BOOLEAN NOT NULL DEFAULT FALSE
|
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
-- Widget version history
|
|
|
|
|
CREATE TABLE widget_versions (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
widget_id UUID NOT NULL,
|
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
version INT NOT NULL,
|
|
|
|
|
schema_snapshot JSONB NOT NULL,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
UNIQUE (widget_id, version)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
-- Interaction events — append-only capture
|
|
|
|
|
CREATE TABLE interaction_events (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
widget_id UUID NOT NULL,
|
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
event_type TEXT NOT NULL,
|
|
|
|
|
actor_id UUID,
|
|
|
|
|
actor_type TEXT NOT NULL DEFAULT 'user',
|
|
|
|
|
view_context_ref TEXT,
|
|
|
|
|
metadata JSONB DEFAULT '{}' NOT NULL,
|
|
|
|
|
occurred_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX interaction_events_widget_id_idx ON interaction_events (widget_id);
|
|
|
|
|
CREATE INDEX interaction_events_occurred_at_idx ON interaction_events (occurred_at DESC);
|
|
|
|
|
|
|
|
|
|
-- Enforce append-only on interaction_events
|
|
|
|
|
CREATE OR REPLACE FUNCTION prevent_interaction_event_mutation()
|
|
|
|
|
RETURNS TRIGGER AS $$
|
|
|
|
|
BEGIN
|
|
|
|
|
RAISE EXCEPTION 'interaction_events is append-only: UPDATE and DELETE are not permitted';
|
|
|
|
|
END;
|
|
|
|
|
$$ LANGUAGE plpgsql;
|
|
|
|
|
|
|
|
|
|
CREATE TRIGGER interaction_events_no_update
|
|
|
|
|
BEFORE UPDATE ON interaction_events
|
|
|
|
|
FOR EACH ROW EXECUTE FUNCTION prevent_interaction_event_mutation();
|
|
|
|
|
|
|
|
|
|
CREATE TRIGGER interaction_events_no_delete
|
|
|
|
|
BEFORE DELETE ON interaction_events
|
|
|
|
|
FOR EACH ROW EXECUTE FUNCTION prevent_interaction_event_mutation();
|
|
|
|
|
|
feat(P2+P3): IHF Phase 2 complete; register Phase 3 workplan
Phase 2 — Structured Feedback and Triage (IHUB-WP-0002):
- Schema: annotation_threads, requirement_candidates, triage_states,
reviewer_assignments; annotations extended with severity + thread_id
- AnnotationThreadsController: create threads, assign annotations
- RequirementCandidatesController: CRUD, escalation, triage lifecycle,
reviewer assignment, my-queue
- Annotation severity (low/medium/high/critical) with Tailwind color cues
- TriageDashboardAction on HubsController with autoRefresh
- Integration tests (T01–T09), SCOPE.md updated, docs/phase2-summary.md
Phase 3 — Governance and Decision Linkage (IHUB-WP-0003):
- Workplan registered: 9 tasks, State Hub workstream 5f201ee3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 23:37:34 +00:00
|
|
|
-- Annotation threads — groups related annotations for triage (Phase 2)
|
|
|
|
|
CREATE TABLE annotation_threads (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
widget_id UUID NOT NULL,
|
feat(P2+P3): IHF Phase 2 complete; register Phase 3 workplan
Phase 2 — Structured Feedback and Triage (IHUB-WP-0002):
- Schema: annotation_threads, requirement_candidates, triage_states,
reviewer_assignments; annotations extended with severity + thread_id
- AnnotationThreadsController: create threads, assign annotations
- RequirementCandidatesController: CRUD, escalation, triage lifecycle,
reviewer assignment, my-queue
- Annotation severity (low/medium/high/critical) with Tailwind color cues
- TriageDashboardAction on HubsController with autoRefresh
- Integration tests (T01–T09), SCOPE.md updated, docs/phase2-summary.md
Phase 3 — Governance and Decision Linkage (IHUB-WP-0003):
- Workplan registered: 9 tasks, State Hub workstream 5f201ee3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 23:37:34 +00:00
|
|
|
title TEXT NOT NULL,
|
|
|
|
|
description TEXT,
|
2026-04-04 09:55:12 +00:00
|
|
|
created_by UUID,
|
feat(P2+P3): IHF Phase 2 complete; register Phase 3 workplan
Phase 2 — Structured Feedback and Triage (IHUB-WP-0002):
- Schema: annotation_threads, requirement_candidates, triage_states,
reviewer_assignments; annotations extended with severity + thread_id
- AnnotationThreadsController: create threads, assign annotations
- RequirementCandidatesController: CRUD, escalation, triage lifecycle,
reviewer assignment, my-queue
- Annotation severity (low/medium/high/critical) with Tailwind color cues
- TriageDashboardAction on HubsController with autoRefresh
- Integration tests (T01–T09), SCOPE.md updated, docs/phase2-summary.md
Phase 3 — Governance and Decision Linkage (IHUB-WP-0003):
- Workplan registered: 9 tasks, State Hub workstream 5f201ee3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 23:37:34 +00:00
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
-- Annotations — structured commentary, also append-only by convention
|
feat(P2+P3): IHF Phase 2 complete; register Phase 3 workplan
Phase 2 — Structured Feedback and Triage (IHUB-WP-0002):
- Schema: annotation_threads, requirement_candidates, triage_states,
reviewer_assignments; annotations extended with severity + thread_id
- AnnotationThreadsController: create threads, assign annotations
- RequirementCandidatesController: CRUD, escalation, triage lifecycle,
reviewer assignment, my-queue
- Annotation severity (low/medium/high/critical) with Tailwind color cues
- TriageDashboardAction on HubsController with autoRefresh
- Integration tests (T01–T09), SCOPE.md updated, docs/phase2-summary.md
Phase 3 — Governance and Decision Linkage (IHUB-WP-0003):
- Workplan registered: 9 tasks, State Hub workstream 5f201ee3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 23:37:34 +00:00
|
|
|
-- Phase 2 additions: severity, thread_id
|
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
CREATE TABLE annotations (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
widget_id UUID NOT NULL,
|
|
|
|
|
parent_id UUID,
|
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
body TEXT NOT NULL,
|
|
|
|
|
category TEXT NOT NULL DEFAULT 'friction',
|
feat(P2+P3): IHF Phase 2 complete; register Phase 3 workplan
Phase 2 — Structured Feedback and Triage (IHUB-WP-0002):
- Schema: annotation_threads, requirement_candidates, triage_states,
reviewer_assignments; annotations extended with severity + thread_id
- AnnotationThreadsController: create threads, assign annotations
- RequirementCandidatesController: CRUD, escalation, triage lifecycle,
reviewer assignment, my-queue
- Annotation severity (low/medium/high/critical) with Tailwind color cues
- TriageDashboardAction on HubsController with autoRefresh
- Integration tests (T01–T09), SCOPE.md updated, docs/phase2-summary.md
Phase 3 — Governance and Decision Linkage (IHUB-WP-0003):
- Workplan registered: 9 tasks, State Hub workstream 5f201ee3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 23:37:34 +00:00
|
|
|
severity TEXT NOT NULL DEFAULT 'medium',
|
2026-04-04 09:55:12 +00:00
|
|
|
thread_id UUID,
|
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
actor_id UUID,
|
|
|
|
|
actor_type TEXT NOT NULL DEFAULT 'user',
|
|
|
|
|
widget_state_ref TEXT,
|
|
|
|
|
retracted_at TIMESTAMP WITH TIME ZONE DEFAULT NULL,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX annotations_widget_id_idx ON annotations (widget_id);
|
feat(P2+P3): IHF Phase 2 complete; register Phase 3 workplan
Phase 2 — Structured Feedback and Triage (IHUB-WP-0002):
- Schema: annotation_threads, requirement_candidates, triage_states,
reviewer_assignments; annotations extended with severity + thread_id
- AnnotationThreadsController: create threads, assign annotations
- RequirementCandidatesController: CRUD, escalation, triage lifecycle,
reviewer assignment, my-queue
- Annotation severity (low/medium/high/critical) with Tailwind color cues
- TriageDashboardAction on HubsController with autoRefresh
- Integration tests (T01–T09), SCOPE.md updated, docs/phase2-summary.md
Phase 3 — Governance and Decision Linkage (IHUB-WP-0003):
- Workplan registered: 9 tasks, State Hub workstream 5f201ee3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 23:37:34 +00:00
|
|
|
|
|
|
|
|
-- Requirement candidates — escalated from annotations/threads (Phase 2)
|
|
|
|
|
CREATE TABLE requirement_candidates (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
|
|
|
title TEXT NOT NULL,
|
|
|
|
|
description TEXT NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
source_widget_id UUID NOT NULL,
|
|
|
|
|
source_thread_id UUID,
|
|
|
|
|
source_annotation_id UUID,
|
feat(P2+P3): IHF Phase 2 complete; register Phase 3 workplan
Phase 2 — Structured Feedback and Triage (IHUB-WP-0002):
- Schema: annotation_threads, requirement_candidates, triage_states,
reviewer_assignments; annotations extended with severity + thread_id
- AnnotationThreadsController: create threads, assign annotations
- RequirementCandidatesController: CRUD, escalation, triage lifecycle,
reviewer assignment, my-queue
- Annotation severity (low/medium/high/critical) with Tailwind color cues
- TriageDashboardAction on HubsController with autoRefresh
- Integration tests (T01–T09), SCOPE.md updated, docs/phase2-summary.md
Phase 3 — Governance and Decision Linkage (IHUB-WP-0003):
- Workplan registered: 9 tasks, State Hub workstream 5f201ee3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 23:37:34 +00:00
|
|
|
category TEXT NOT NULL DEFAULT 'friction',
|
|
|
|
|
status TEXT NOT NULL DEFAULT 'open',
|
2026-04-04 09:55:12 +00:00
|
|
|
created_by UUID,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
requirement_id UUID,
|
|
|
|
|
routed_to_hub_id UUID,
|
|
|
|
|
outcome_summary JSONB
|
feat(P2+P3): IHF Phase 2 complete; register Phase 3 workplan
Phase 2 — Structured Feedback and Triage (IHUB-WP-0002):
- Schema: annotation_threads, requirement_candidates, triage_states,
reviewer_assignments; annotations extended with severity + thread_id
- AnnotationThreadsController: create threads, assign annotations
- RequirementCandidatesController: CRUD, escalation, triage lifecycle,
reviewer assignment, my-queue
- Annotation severity (low/medium/high/critical) with Tailwind color cues
- TriageDashboardAction on HubsController with autoRefresh
- Integration tests (T01–T09), SCOPE.md updated, docs/phase2-summary.md
Phase 3 — Governance and Decision Linkage (IHUB-WP-0003):
- Workplan registered: 9 tasks, State Hub workstream 5f201ee3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 23:37:34 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX requirement_candidates_widget_id_idx ON requirement_candidates (source_widget_id);
|
|
|
|
|
CREATE INDEX requirement_candidates_status_idx ON requirement_candidates (status);
|
|
|
|
|
|
|
|
|
|
-- Triage state history — append-only audit trail of status transitions (Phase 2)
|
|
|
|
|
CREATE TABLE triage_states (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
candidate_id UUID NOT NULL,
|
feat(P2+P3): IHF Phase 2 complete; register Phase 3 workplan
Phase 2 — Structured Feedback and Triage (IHUB-WP-0002):
- Schema: annotation_threads, requirement_candidates, triage_states,
reviewer_assignments; annotations extended with severity + thread_id
- AnnotationThreadsController: create threads, assign annotations
- RequirementCandidatesController: CRUD, escalation, triage lifecycle,
reviewer assignment, my-queue
- Annotation severity (low/medium/high/critical) with Tailwind color cues
- TriageDashboardAction on HubsController with autoRefresh
- Integration tests (T01–T09), SCOPE.md updated, docs/phase2-summary.md
Phase 3 — Governance and Decision Linkage (IHUB-WP-0003):
- Workplan registered: 9 tasks, State Hub workstream 5f201ee3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 23:37:34 +00:00
|
|
|
status TEXT NOT NULL,
|
|
|
|
|
notes TEXT,
|
2026-04-04 09:55:12 +00:00
|
|
|
changed_by UUID,
|
feat(P2+P3): IHF Phase 2 complete; register Phase 3 workplan
Phase 2 — Structured Feedback and Triage (IHUB-WP-0002):
- Schema: annotation_threads, requirement_candidates, triage_states,
reviewer_assignments; annotations extended with severity + thread_id
- AnnotationThreadsController: create threads, assign annotations
- RequirementCandidatesController: CRUD, escalation, triage lifecycle,
reviewer assignment, my-queue
- Annotation severity (low/medium/high/critical) with Tailwind color cues
- TriageDashboardAction on HubsController with autoRefresh
- Integration tests (T01–T09), SCOPE.md updated, docs/phase2-summary.md
Phase 3 — Governance and Decision Linkage (IHUB-WP-0003):
- Workplan registered: 9 tasks, State Hub workstream 5f201ee3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 23:37:34 +00:00
|
|
|
changed_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX triage_states_candidate_id_idx ON triage_states (candidate_id);
|
|
|
|
|
|
|
|
|
|
-- Reviewer assignments — one reviewer per candidate (Phase 2)
|
|
|
|
|
CREATE TABLE reviewer_assignments (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
candidate_id UUID NOT NULL,
|
|
|
|
|
user_id UUID NOT NULL,
|
|
|
|
|
assigned_by UUID,
|
feat(P2+P3): IHF Phase 2 complete; register Phase 3 workplan
Phase 2 — Structured Feedback and Triage (IHUB-WP-0002):
- Schema: annotation_threads, requirement_candidates, triage_states,
reviewer_assignments; annotations extended with severity + thread_id
- AnnotationThreadsController: create threads, assign annotations
- RequirementCandidatesController: CRUD, escalation, triage lifecycle,
reviewer assignment, my-queue
- Annotation severity (low/medium/high/critical) with Tailwind color cues
- TriageDashboardAction on HubsController with autoRefresh
- Integration tests (T01–T09), SCOPE.md updated, docs/phase2-summary.md
Phase 3 — Governance and Decision Linkage (IHUB-WP-0003):
- Workplan registered: 9 tasks, State Hub workstream 5f201ee3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 23:37:34 +00:00
|
|
|
assigned_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
UNIQUE (candidate_id)
|
|
|
|
|
);
|
2026-03-29 10:38:50 +00:00
|
|
|
|
|
|
|
|
-- Requirements — promoted from accepted RequirementCandidates (Phase 3)
|
|
|
|
|
CREATE TABLE requirements (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
|
|
|
title TEXT NOT NULL,
|
|
|
|
|
description TEXT NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
source_candidate_id UUID NOT NULL,
|
2026-03-29 10:38:50 +00:00
|
|
|
status TEXT NOT NULL DEFAULT 'active',
|
2026-04-04 09:55:12 +00:00
|
|
|
created_by UUID,
|
2026-03-29 10:38:50 +00:00
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX requirements_source_candidate_id_idx ON requirements (source_candidate_id);
|
|
|
|
|
|
|
|
|
|
-- Decision records — governance decisions acting on requirements/candidates (Phase 3)
|
|
|
|
|
CREATE TABLE decision_records (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
|
|
|
title TEXT NOT NULL,
|
|
|
|
|
rationale TEXT NOT NULL,
|
|
|
|
|
outcome TEXT NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
requirement_id UUID,
|
|
|
|
|
candidate_id UUID,
|
|
|
|
|
decided_by UUID,
|
2026-03-29 10:38:50 +00:00
|
|
|
decided_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
notes TEXT,
|
2026-04-04 09:55:12 +00:00
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
outcome_summary JSONB
|
2026-03-29 10:38:50 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX decision_records_outcome_idx ON decision_records (outcome);
|
|
|
|
|
CREATE INDEX decision_records_requirement_id_idx ON decision_records (requirement_id);
|
|
|
|
|
|
|
|
|
|
-- Policy references — editorial links from decisions to policy scope (Phase 3)
|
|
|
|
|
CREATE TABLE policy_references (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
decision_id UUID NOT NULL,
|
2026-03-29 10:38:50 +00:00
|
|
|
policy_scope TEXT NOT NULL,
|
|
|
|
|
constraint_note TEXT,
|
2026-04-04 09:55:12 +00:00
|
|
|
created_by UUID,
|
2026-03-29 10:38:50 +00:00
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX policy_references_decision_id_idx ON policy_references (decision_id);
|
|
|
|
|
|
|
|
|
|
-- Implementation change references — editorial links to work items (Phase 3)
|
|
|
|
|
CREATE TABLE implementation_change_references (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
decision_id UUID NOT NULL,
|
2026-03-29 10:38:50 +00:00
|
|
|
work_item_ref TEXT NOT NULL,
|
|
|
|
|
system TEXT NOT NULL DEFAULT 'github',
|
2026-04-04 09:55:12 +00:00
|
|
|
linked_by UUID,
|
2026-03-29 10:38:50 +00:00
|
|
|
linked_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX impl_change_refs_decision_id_idx ON implementation_change_references (decision_id);
|
|
|
|
|
|
|
|
|
|
-- Back-reference: which candidate was promoted to a requirement (Phase 3)
|
2026-04-04 09:55:12 +00:00
|
|
|
-- MOVED TO CREATE TABLE: ALTER TABLE requirement_candidates ADD COLUMN requirement_id UUID;
|
2026-03-29 12:27:30 +00:00
|
|
|
|
|
|
|
|
-- Deployment records — connect decisions to deployed versions (Phase 4)
|
|
|
|
|
CREATE TABLE deployment_records (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
impl_ref_id UUID,
|
|
|
|
|
decision_id UUID NOT NULL,
|
2026-03-29 12:27:30 +00:00
|
|
|
version_ref TEXT NOT NULL,
|
|
|
|
|
deployed_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
deployed_by UUID,
|
2026-03-29 12:27:30 +00:00
|
|
|
notes TEXT,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX deployment_records_decision_id_idx ON deployment_records (decision_id);
|
|
|
|
|
CREATE INDEX deployment_records_deployed_at_idx ON deployment_records (deployed_at DESC);
|
|
|
|
|
|
|
|
|
|
-- Outcome signals — append-only observation of widget behaviour post-deployment (Phase 4)
|
|
|
|
|
CREATE TABLE outcome_signals (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
widget_id UUID NOT NULL,
|
|
|
|
|
deployment_id UUID NOT NULL,
|
2026-03-29 12:27:30 +00:00
|
|
|
signal_type TEXT NOT NULL,
|
|
|
|
|
value NUMERIC,
|
|
|
|
|
observed_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX outcome_signals_widget_id_idx ON outcome_signals (widget_id);
|
|
|
|
|
CREATE INDEX outcome_signals_deployment_id_idx ON outcome_signals (deployment_id);
|
|
|
|
|
CREATE INDEX outcome_signals_observed_at_idx ON outcome_signals (observed_at DESC);
|
|
|
|
|
|
|
|
|
|
CREATE OR REPLACE FUNCTION prevent_outcome_signal_mutation()
|
|
|
|
|
RETURNS TRIGGER AS $$
|
|
|
|
|
BEGIN
|
|
|
|
|
RAISE EXCEPTION 'outcome_signals is append-only: UPDATE and DELETE are not permitted';
|
|
|
|
|
END;
|
|
|
|
|
$$ LANGUAGE plpgsql;
|
|
|
|
|
|
|
|
|
|
CREATE TRIGGER outcome_signals_no_update
|
|
|
|
|
BEFORE UPDATE ON outcome_signals
|
|
|
|
|
FOR EACH ROW EXECUTE FUNCTION prevent_outcome_signal_mutation();
|
|
|
|
|
|
|
|
|
|
CREATE TRIGGER outcome_signals_no_delete
|
|
|
|
|
BEFORE DELETE ON outcome_signals
|
|
|
|
|
FOR EACH ROW EXECUTE FUNCTION prevent_outcome_signal_mutation();
|
|
|
|
|
|
|
|
|
|
-- Change evaluations — one score per deployment (Phase 4)
|
|
|
|
|
CREATE TABLE change_evaluations (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
deployment_id UUID NOT NULL,
|
|
|
|
|
decision_id UUID,
|
|
|
|
|
score SMALLINT NOT NULL,
|
2026-03-29 12:27:30 +00:00
|
|
|
rationale TEXT NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
evaluated_by UUID,
|
2026-03-29 12:27:30 +00:00
|
|
|
evaluated_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
UNIQUE (deployment_id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX change_evaluations_deployment_id_idx ON change_evaluations (deployment_id);
|
feat(P5): IHF Phase 5 complete — agent-assisted distillation
Adds bounded AI support to the IHF governance loop. All AI outputs are
attributed (model_ref), reviewable (AgentReviewRecord), and reversible.
No autonomous decisions; no silent requirement promotion.
- T01: Schema — agent_proposals, agent_review_records,
confidence_annotations (migration 1743379200)
- T02: AgentProposalsController (index/show/accept/reject, idempotent
review guard), global nav "Agent" link
- T03: SummarizeClusterAction — Claude API cluster summary on widget show
- T04: DraftRequirementAction — AI requirement draft; acceptance creates
RequirementCandidate (human-gated)
- T05: DetectDuplicatesAction — duplicate_flag proposal on candidate show
- T06: DetectPolicySensitivityAction — policy_flag with
ConfidenceAnnotations per concern scope
- T07: ProposeImplementationAction — impl_proposal from decision show
- T08: AgentAuditDashboardAction — autoRefresh; KPI row, unreviewed queue,
recent proposals, attribution log matrix
- T09: integration tests, SCOPE.md updated, phase5-summary.md, flake.nix
adds http-conduit/aeson/string-conversions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 15:54:33 +00:00
|
|
|
|
|
|
|
|
-- Agent proposals — AI-generated outputs awaiting human review (Phase 5)
|
|
|
|
|
CREATE TABLE agent_proposals (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
|
|
|
proposal_type TEXT NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
source_widget_id UUID,
|
|
|
|
|
source_candidate_id UUID,
|
|
|
|
|
source_thread_id UUID,
|
|
|
|
|
source_decision_id UUID,
|
feat(P5): IHF Phase 5 complete — agent-assisted distillation
Adds bounded AI support to the IHF governance loop. All AI outputs are
attributed (model_ref), reviewable (AgentReviewRecord), and reversible.
No autonomous decisions; no silent requirement promotion.
- T01: Schema — agent_proposals, agent_review_records,
confidence_annotations (migration 1743379200)
- T02: AgentProposalsController (index/show/accept/reject, idempotent
review guard), global nav "Agent" link
- T03: SummarizeClusterAction — Claude API cluster summary on widget show
- T04: DraftRequirementAction — AI requirement draft; acceptance creates
RequirementCandidate (human-gated)
- T05: DetectDuplicatesAction — duplicate_flag proposal on candidate show
- T06: DetectPolicySensitivityAction — policy_flag with
ConfidenceAnnotations per concern scope
- T07: ProposeImplementationAction — impl_proposal from decision show
- T08: AgentAuditDashboardAction — autoRefresh; KPI row, unreviewed queue,
recent proposals, attribution log matrix
- T09: integration tests, SCOPE.md updated, phase5-summary.md, flake.nix
adds http-conduit/aeson/string-conversions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 15:54:33 +00:00
|
|
|
content TEXT NOT NULL,
|
|
|
|
|
model_ref TEXT NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
confidence NUMERIC,
|
feat(P5): IHF Phase 5 complete — agent-assisted distillation
Adds bounded AI support to the IHF governance loop. All AI outputs are
attributed (model_ref), reviewable (AgentReviewRecord), and reversible.
No autonomous decisions; no silent requirement promotion.
- T01: Schema — agent_proposals, agent_review_records,
confidence_annotations (migration 1743379200)
- T02: AgentProposalsController (index/show/accept/reject, idempotent
review guard), global nav "Agent" link
- T03: SummarizeClusterAction — Claude API cluster summary on widget show
- T04: DraftRequirementAction — AI requirement draft; acceptance creates
RequirementCandidate (human-gated)
- T05: DetectDuplicatesAction — duplicate_flag proposal on candidate show
- T06: DetectPolicySensitivityAction — policy_flag with
ConfidenceAnnotations per concern scope
- T07: ProposeImplementationAction — impl_proposal from decision show
- T08: AgentAuditDashboardAction — autoRefresh; KPI row, unreviewed queue,
recent proposals, attribution log matrix
- T09: integration tests, SCOPE.md updated, phase5-summary.md, flake.nix
adds http-conduit/aeson/string-conversions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 15:54:33 +00:00
|
|
|
status TEXT NOT NULL DEFAULT 'pending',
|
2026-04-04 09:55:12 +00:00
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
agent_registration_id UUID,
|
|
|
|
|
tokens_in INTEGER,
|
|
|
|
|
tokens_out INTEGER
|
feat(P5): IHF Phase 5 complete — agent-assisted distillation
Adds bounded AI support to the IHF governance loop. All AI outputs are
attributed (model_ref), reviewable (AgentReviewRecord), and reversible.
No autonomous decisions; no silent requirement promotion.
- T01: Schema — agent_proposals, agent_review_records,
confidence_annotations (migration 1743379200)
- T02: AgentProposalsController (index/show/accept/reject, idempotent
review guard), global nav "Agent" link
- T03: SummarizeClusterAction — Claude API cluster summary on widget show
- T04: DraftRequirementAction — AI requirement draft; acceptance creates
RequirementCandidate (human-gated)
- T05: DetectDuplicatesAction — duplicate_flag proposal on candidate show
- T06: DetectPolicySensitivityAction — policy_flag with
ConfidenceAnnotations per concern scope
- T07: ProposeImplementationAction — impl_proposal from decision show
- T08: AgentAuditDashboardAction — autoRefresh; KPI row, unreviewed queue,
recent proposals, attribution log matrix
- T09: integration tests, SCOPE.md updated, phase5-summary.md, flake.nix
adds http-conduit/aeson/string-conversions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 15:54:33 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX agent_proposals_proposal_type_idx ON agent_proposals (proposal_type);
|
|
|
|
|
CREATE INDEX agent_proposals_status_idx ON agent_proposals (status);
|
|
|
|
|
CREATE INDEX agent_proposals_source_widget_id_idx ON agent_proposals (source_widget_id);
|
|
|
|
|
CREATE INDEX agent_proposals_created_at_idx ON agent_proposals (created_at DESC);
|
|
|
|
|
|
|
|
|
|
-- One review record per proposal (human decision on AI output) (Phase 5)
|
|
|
|
|
CREATE TABLE agent_review_records (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
proposal_id UUID NOT NULL,
|
|
|
|
|
reviewer_id UUID,
|
|
|
|
|
decision TEXT NOT NULL,
|
feat(P5): IHF Phase 5 complete — agent-assisted distillation
Adds bounded AI support to the IHF governance loop. All AI outputs are
attributed (model_ref), reviewable (AgentReviewRecord), and reversible.
No autonomous decisions; no silent requirement promotion.
- T01: Schema — agent_proposals, agent_review_records,
confidence_annotations (migration 1743379200)
- T02: AgentProposalsController (index/show/accept/reject, idempotent
review guard), global nav "Agent" link
- T03: SummarizeClusterAction — Claude API cluster summary on widget show
- T04: DraftRequirementAction — AI requirement draft; acceptance creates
RequirementCandidate (human-gated)
- T05: DetectDuplicatesAction — duplicate_flag proposal on candidate show
- T06: DetectPolicySensitivityAction — policy_flag with
ConfidenceAnnotations per concern scope
- T07: ProposeImplementationAction — impl_proposal from decision show
- T08: AgentAuditDashboardAction — autoRefresh; KPI row, unreviewed queue,
recent proposals, attribution log matrix
- T09: integration tests, SCOPE.md updated, phase5-summary.md, flake.nix
adds http-conduit/aeson/string-conversions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 15:54:33 +00:00
|
|
|
notes TEXT,
|
|
|
|
|
reviewed_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
UNIQUE (proposal_id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX agent_review_records_proposal_id_idx ON agent_review_records (proposal_id);
|
|
|
|
|
|
|
|
|
|
-- Confidence annotations — per-dimension breakdown of AI confidence (Phase 5)
|
|
|
|
|
CREATE TABLE confidence_annotations (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
proposal_id UUID NOT NULL,
|
feat(P5): IHF Phase 5 complete — agent-assisted distillation
Adds bounded AI support to the IHF governance loop. All AI outputs are
attributed (model_ref), reviewable (AgentReviewRecord), and reversible.
No autonomous decisions; no silent requirement promotion.
- T01: Schema — agent_proposals, agent_review_records,
confidence_annotations (migration 1743379200)
- T02: AgentProposalsController (index/show/accept/reject, idempotent
review guard), global nav "Agent" link
- T03: SummarizeClusterAction — Claude API cluster summary on widget show
- T04: DraftRequirementAction — AI requirement draft; acceptance creates
RequirementCandidate (human-gated)
- T05: DetectDuplicatesAction — duplicate_flag proposal on candidate show
- T06: DetectPolicySensitivityAction — policy_flag with
ConfidenceAnnotations per concern scope
- T07: ProposeImplementationAction — impl_proposal from decision show
- T08: AgentAuditDashboardAction — autoRefresh; KPI row, unreviewed queue,
recent proposals, attribution log matrix
- T09: integration tests, SCOPE.md updated, phase5-summary.md, flake.nix
adds http-conduit/aeson/string-conversions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 15:54:33 +00:00
|
|
|
dimension TEXT NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
score NUMERIC NOT NULL,
|
feat(P5): IHF Phase 5 complete — agent-assisted distillation
Adds bounded AI support to the IHF governance loop. All AI outputs are
attributed (model_ref), reviewable (AgentReviewRecord), and reversible.
No autonomous decisions; no silent requirement promotion.
- T01: Schema — agent_proposals, agent_review_records,
confidence_annotations (migration 1743379200)
- T02: AgentProposalsController (index/show/accept/reject, idempotent
review guard), global nav "Agent" link
- T03: SummarizeClusterAction — Claude API cluster summary on widget show
- T04: DraftRequirementAction — AI requirement draft; acceptance creates
RequirementCandidate (human-gated)
- T05: DetectDuplicatesAction — duplicate_flag proposal on candidate show
- T06: DetectPolicySensitivityAction — policy_flag with
ConfidenceAnnotations per concern scope
- T07: ProposeImplementationAction — impl_proposal from decision show
- T08: AgentAuditDashboardAction — autoRefresh; KPI row, unreviewed queue,
recent proposals, attribution log matrix
- T09: integration tests, SCOPE.md updated, phase5-summary.md, flake.nix
adds http-conduit/aeson/string-conversions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 15:54:33 +00:00
|
|
|
explanation TEXT,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX confidence_annotations_proposal_id_idx ON confidence_annotations (proposal_id);
|
2026-03-29 21:03:00 +00:00
|
|
|
|
|
|
|
|
-- ============================================================
|
|
|
|
|
-- Phase 6 — Cross-Framework UI Adaptation Layer
|
|
|
|
|
-- ============================================================
|
|
|
|
|
|
|
|
|
|
-- Formalises the rules for widget envelope emission: which data-* attributes
|
|
|
|
|
-- are required, their format, and the contract version.
|
|
|
|
|
CREATE TABLE envelope_emission_contracts (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
contract_version TEXT NOT NULL UNIQUE,
|
2026-03-29 21:03:00 +00:00
|
|
|
required_attributes JSONB NOT NULL,
|
|
|
|
|
optional_attributes JSONB NOT NULL DEFAULT '[]',
|
|
|
|
|
validation_rules JSONB NOT NULL DEFAULT '{}',
|
|
|
|
|
description TEXT,
|
|
|
|
|
status TEXT NOT NULL DEFAULT 'active',
|
2026-04-04 09:55:12 +00:00
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
maturity TEXT NOT NULL DEFAULT 'stable'
|
2026-03-29 21:03:00 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX envelope_emission_contracts_status_idx ON envelope_emission_contracts (status);
|
|
|
|
|
|
|
|
|
|
-- Standardised REST interface contract for external event and annotation
|
|
|
|
|
-- submission — used by non-IHP adapters.
|
|
|
|
|
CREATE TABLE interaction_reporting_contracts (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
contract_version TEXT NOT NULL UNIQUE,
|
|
|
|
|
endpoint_path TEXT NOT NULL,
|
|
|
|
|
accepted_event_types JSONB NOT NULL,
|
2026-03-29 21:03:00 +00:00
|
|
|
required_fields JSONB NOT NULL,
|
|
|
|
|
auth_scheme TEXT NOT NULL DEFAULT 'bearer',
|
|
|
|
|
description TEXT,
|
|
|
|
|
status TEXT NOT NULL DEFAULT 'active',
|
2026-04-04 09:55:12 +00:00
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
maturity TEXT NOT NULL DEFAULT 'stable'
|
2026-03-29 21:03:00 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX interaction_reporting_contracts_status_idx ON interaction_reporting_contracts (status);
|
|
|
|
|
|
|
|
|
|
-- Describes how a specific UI technology maps to IHF widget protocol obligations.
|
|
|
|
|
CREATE TABLE widget_adapter_specs (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
name TEXT NOT NULL UNIQUE,
|
|
|
|
|
framework TEXT NOT NULL,
|
|
|
|
|
version TEXT NOT NULL,
|
|
|
|
|
envelope_contract_id UUID,
|
|
|
|
|
reporting_contract_id UUID,
|
2026-03-29 21:03:00 +00:00
|
|
|
status TEXT NOT NULL DEFAULT 'draft',
|
|
|
|
|
notes TEXT,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
updated_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
maturity TEXT NOT NULL DEFAULT 'beta'
|
2026-03-29 21:03:00 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX widget_adapter_specs_framework_idx ON widget_adapter_specs (framework);
|
|
|
|
|
CREATE INDEX widget_adapter_specs_status_idx ON widget_adapter_specs (status);
|
|
|
|
|
|
|
|
|
|
-- Link widgets to their adapter spec (null = native IHP widget).
|
2026-04-04 09:55:12 +00:00
|
|
|
-- MOVED TO CREATE TABLE: ALTER TABLE widgets ADD COLUMN adapter_spec_id UUID;
|
2026-03-29 21:03:00 +00:00
|
|
|
|
|
|
|
|
CREATE INDEX widgets_adapter_spec_id_idx ON widgets (adapter_spec_id);
|
|
|
|
|
|
|
|
|
|
-- Per-hub API key for bearer-token auth on the interaction reporting endpoint.
|
2026-04-04 09:55:12 +00:00
|
|
|
-- MOVED TO CREATE TABLE: ALTER TABLE hubs ADD COLUMN api_key TEXT;
|
feat(P7): IHF Phase 7 complete — advanced observability and operational integration
T01 schema: friction_scores, bottleneck_records, hub_health_snapshots,
cross_hub_propagations + migration 1743552000.
T02 Widget Pain Heatmap: computeFrictionScore (formula documented), RecomputeFriction
action, colour-coded grid view (green/yellow/amber/red).
T03 Workflow Bottleneck Analysis: detectBottlenecks across 4 pipeline stages
(candidate 30d, requirement 60d, decision 30d, observation 14d), idempotent,
severity from age ratio, resolve action.
T04 Hub Health Correlation: computeHubHealth (deduction table documented),
append-only HubHealthSnapshot, health history view, badge on hub Show page.
T05 Cross-Hub Propagation: annotation_cluster + widget_type_friction heuristics,
idempotent detection, acknowledge/resolve lifecycle.
T06 Operational Review Board: 4-panel AutoRefresh global dashboard — health matrix,
top-10 friction, bottleneck stage counts, open propagations.
T07 gate: 5 describe blocks in Test/Integration.hs; SCOPE.md updated Phase 7
complete; docs/phase7-summary.md written.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 21:49:22 +00:00
|
|
|
|
|
|
|
|
-- Phase 7: Advanced Observability and Operational Integration
|
|
|
|
|
|
|
|
|
|
-- Aggregated pain score per widget, recomputed on demand or scheduled.
|
|
|
|
|
CREATE TABLE friction_scores (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
widget_id UUID NOT NULL,
|
feat(P7): IHF Phase 7 complete — advanced observability and operational integration
T01 schema: friction_scores, bottleneck_records, hub_health_snapshots,
cross_hub_propagations + migration 1743552000.
T02 Widget Pain Heatmap: computeFrictionScore (formula documented), RecomputeFriction
action, colour-coded grid view (green/yellow/amber/red).
T03 Workflow Bottleneck Analysis: detectBottlenecks across 4 pipeline stages
(candidate 30d, requirement 60d, decision 30d, observation 14d), idempotent,
severity from age ratio, resolve action.
T04 Hub Health Correlation: computeHubHealth (deduction table documented),
append-only HubHealthSnapshot, health history view, badge on hub Show page.
T05 Cross-Hub Propagation: annotation_cluster + widget_type_friction heuristics,
idempotent detection, acknowledge/resolve lifecycle.
T06 Operational Review Board: 4-panel AutoRefresh global dashboard — health matrix,
top-10 friction, bottleneck stage counts, open propagations.
T07 gate: 5 describe blocks in Test/Integration.hs; SCOPE.md updated Phase 7
complete; docs/phase7-summary.md written.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 21:49:22 +00:00
|
|
|
score INTEGER NOT NULL DEFAULT 0,
|
|
|
|
|
annotation_count INTEGER NOT NULL DEFAULT 0,
|
|
|
|
|
error_event_count INTEGER NOT NULL DEFAULT 0,
|
|
|
|
|
regression_flag BOOLEAN NOT NULL DEFAULT FALSE,
|
|
|
|
|
stale_candidate_count INTEGER NOT NULL DEFAULT 0,
|
|
|
|
|
last_computed_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
UNIQUE (widget_id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX friction_scores_widget_id_idx ON friction_scores (widget_id);
|
|
|
|
|
CREATE INDEX friction_scores_score_idx ON friction_scores (score DESC);
|
|
|
|
|
|
|
|
|
|
-- Detected stalls at specific pipeline stages.
|
|
|
|
|
CREATE TABLE bottleneck_records (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
hub_id UUID NOT NULL,
|
feat(P7): IHF Phase 7 complete — advanced observability and operational integration
T01 schema: friction_scores, bottleneck_records, hub_health_snapshots,
cross_hub_propagations + migration 1743552000.
T02 Widget Pain Heatmap: computeFrictionScore (formula documented), RecomputeFriction
action, colour-coded grid view (green/yellow/amber/red).
T03 Workflow Bottleneck Analysis: detectBottlenecks across 4 pipeline stages
(candidate 30d, requirement 60d, decision 30d, observation 14d), idempotent,
severity from age ratio, resolve action.
T04 Hub Health Correlation: computeHubHealth (deduction table documented),
append-only HubHealthSnapshot, health history view, badge on hub Show page.
T05 Cross-Hub Propagation: annotation_cluster + widget_type_friction heuristics,
idempotent detection, acknowledge/resolve lifecycle.
T06 Operational Review Board: 4-panel AutoRefresh global dashboard — health matrix,
top-10 friction, bottleneck stage counts, open propagations.
T07 gate: 5 describe blocks in Test/Integration.hs; SCOPE.md updated Phase 7
complete; docs/phase7-summary.md written.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 21:49:22 +00:00
|
|
|
stage TEXT NOT NULL,
|
|
|
|
|
subject_type TEXT NOT NULL,
|
|
|
|
|
subject_id UUID NOT NULL,
|
|
|
|
|
stalled_since TIMESTAMP WITH TIME ZONE NOT NULL,
|
|
|
|
|
severity TEXT NOT NULL DEFAULT 'medium',
|
|
|
|
|
resolved_at TIMESTAMP WITH TIME ZONE,
|
|
|
|
|
notes TEXT,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX bottleneck_records_hub_id_idx ON bottleneck_records (hub_id);
|
|
|
|
|
CREATE INDEX bottleneck_records_stage_idx ON bottleneck_records (stage);
|
|
|
|
|
CREATE INDEX bottleneck_records_resolved_idx ON bottleneck_records (resolved_at)
|
|
|
|
|
WHERE resolved_at IS NULL;
|
|
|
|
|
|
|
|
|
|
-- Periodic health snapshots for trend tracking.
|
|
|
|
|
CREATE TABLE hub_health_snapshots (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
hub_id UUID NOT NULL,
|
feat(P7): IHF Phase 7 complete — advanced observability and operational integration
T01 schema: friction_scores, bottleneck_records, hub_health_snapshots,
cross_hub_propagations + migration 1743552000.
T02 Widget Pain Heatmap: computeFrictionScore (formula documented), RecomputeFriction
action, colour-coded grid view (green/yellow/amber/red).
T03 Workflow Bottleneck Analysis: detectBottlenecks across 4 pipeline stages
(candidate 30d, requirement 60d, decision 30d, observation 14d), idempotent,
severity from age ratio, resolve action.
T04 Hub Health Correlation: computeHubHealth (deduction table documented),
append-only HubHealthSnapshot, health history view, badge on hub Show page.
T05 Cross-Hub Propagation: annotation_cluster + widget_type_friction heuristics,
idempotent detection, acknowledge/resolve lifecycle.
T06 Operational Review Board: 4-panel AutoRefresh global dashboard — health matrix,
top-10 friction, bottleneck stage counts, open propagations.
T07 gate: 5 describe blocks in Test/Integration.hs; SCOPE.md updated Phase 7
complete; docs/phase7-summary.md written.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 21:49:22 +00:00
|
|
|
health_score INTEGER NOT NULL,
|
|
|
|
|
open_candidates INTEGER NOT NULL DEFAULT 0,
|
|
|
|
|
regressed_widgets INTEGER NOT NULL DEFAULT 0,
|
|
|
|
|
stale_decisions INTEGER NOT NULL DEFAULT 0,
|
|
|
|
|
active_bottlenecks INTEGER NOT NULL DEFAULT 0,
|
|
|
|
|
computed_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX hub_health_snapshots_hub_id_idx ON hub_health_snapshots (hub_id);
|
|
|
|
|
CREATE INDEX hub_health_snapshots_computed_at_idx
|
|
|
|
|
ON hub_health_snapshots (hub_id, computed_at DESC);
|
|
|
|
|
|
|
|
|
|
-- Patterns detected across multiple hubs.
|
|
|
|
|
CREATE TABLE cross_hub_propagations (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
|
|
|
pattern_type TEXT NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
source_hub_id UUID,
|
feat(P7): IHF Phase 7 complete — advanced observability and operational integration
T01 schema: friction_scores, bottleneck_records, hub_health_snapshots,
cross_hub_propagations + migration 1743552000.
T02 Widget Pain Heatmap: computeFrictionScore (formula documented), RecomputeFriction
action, colour-coded grid view (green/yellow/amber/red).
T03 Workflow Bottleneck Analysis: detectBottlenecks across 4 pipeline stages
(candidate 30d, requirement 60d, decision 30d, observation 14d), idempotent,
severity from age ratio, resolve action.
T04 Hub Health Correlation: computeHubHealth (deduction table documented),
append-only HubHealthSnapshot, health history view, badge on hub Show page.
T05 Cross-Hub Propagation: annotation_cluster + widget_type_friction heuristics,
idempotent detection, acknowledge/resolve lifecycle.
T06 Operational Review Board: 4-panel AutoRefresh global dashboard — health matrix,
top-10 friction, bottleneck stage counts, open propagations.
T07 gate: 5 describe blocks in Test/Integration.hs; SCOPE.md updated Phase 7
complete; docs/phase7-summary.md written.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 21:49:22 +00:00
|
|
|
affected_hub_ids JSONB NOT NULL DEFAULT '[]',
|
|
|
|
|
summary TEXT NOT NULL,
|
|
|
|
|
detected_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
status TEXT NOT NULL DEFAULT 'open',
|
|
|
|
|
notes TEXT
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX cross_hub_propagations_status_idx ON cross_hub_propagations (status);
|
|
|
|
|
CREATE INDEX cross_hub_propagations_pattern_idx ON cross_hub_propagations (pattern_type);
|
feat(P8): IHF Phase 8 complete — Federated Hub Maturity
Implements the final phase of the IHF v0.1 specification:
- WidgetOwnership: delegated ownership registry (local/delegated/global),
append-only audit artefacts, ownership badge on widget show page
- HubRoutingRule + RoutingEngine: priority-ordered inter-hub routing engine;
null-inclusive category/widget-type matching; RouteNowAction for manual
re-evaluation; RoutedCandidates view per hub
- FederatedPolicyOverlay: draft → active → retired lifecycle; activated
overlays are immutable (same pattern as Phase 6 contracts); policy
compliance dashboard with decision coverage metrics
- StewardshipRole: named governance roles per hub; point-in-time revocation
pattern; hub and ops-board integration
- ArchiveRecord + is_archived: soft-delete on widgets; lineage inspector
traces full traceability chain (Widget → Events → Annotations → Candidates
→ Requirements → Decisions → Deployments → Signals + ArchiveRecord)
- FederatedGovernanceDashboard: 5-panel autoRefresh org-wide governance view
(ownership coverage, routing activity, policy compliance, stewardship
coverage, archive activity)
Schema: widget_ownerships, hub_routing_rules, federated_policy_overlays,
stewardship_roles, archive_records; ALTER widgets ADD is_archived;
ALTER requirement_candidates ADD routed_to_hub_id
Migration: 1743638400-ihf-phase8-federated-hub-maturity.sql
Tests: Phase 8 integration tests appended to Test/Integration.hs
Docs: docs/phase8-summary.md; SCOPE.md updated to Phase 8 complete
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 22:53:01 +00:00
|
|
|
|
|
|
|
|
-- Phase 8: Federated Hub Maturity
|
|
|
|
|
|
|
|
|
|
-- Explicit ownership record for a widget.
|
|
|
|
|
CREATE TABLE widget_ownerships (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
widget_id UUID NOT NULL,
|
|
|
|
|
owner_hub_id UUID NOT NULL,
|
|
|
|
|
steward_hub_id UUID,
|
feat(P8): IHF Phase 8 complete — Federated Hub Maturity
Implements the final phase of the IHF v0.1 specification:
- WidgetOwnership: delegated ownership registry (local/delegated/global),
append-only audit artefacts, ownership badge on widget show page
- HubRoutingRule + RoutingEngine: priority-ordered inter-hub routing engine;
null-inclusive category/widget-type matching; RouteNowAction for manual
re-evaluation; RoutedCandidates view per hub
- FederatedPolicyOverlay: draft → active → retired lifecycle; activated
overlays are immutable (same pattern as Phase 6 contracts); policy
compliance dashboard with decision coverage metrics
- StewardshipRole: named governance roles per hub; point-in-time revocation
pattern; hub and ops-board integration
- ArchiveRecord + is_archived: soft-delete on widgets; lineage inspector
traces full traceability chain (Widget → Events → Annotations → Candidates
→ Requirements → Decisions → Deployments → Signals + ArchiveRecord)
- FederatedGovernanceDashboard: 5-panel autoRefresh org-wide governance view
(ownership coverage, routing activity, policy compliance, stewardship
coverage, archive activity)
Schema: widget_ownerships, hub_routing_rules, federated_policy_overlays,
stewardship_roles, archive_records; ALTER widgets ADD is_archived;
ALTER requirement_candidates ADD routed_to_hub_id
Migration: 1743638400-ihf-phase8-federated-hub-maturity.sql
Tests: Phase 8 integration tests appended to Test/Integration.hs
Docs: docs/phase8-summary.md; SCOPE.md updated to Phase 8 complete
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 22:53:01 +00:00
|
|
|
ownership_type TEXT NOT NULL DEFAULT 'local',
|
|
|
|
|
effective_from TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
|
|
|
effective_until TIMESTAMP WITH TIME ZONE,
|
|
|
|
|
notes TEXT,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX widget_ownerships_widget_id_idx ON widget_ownerships (widget_id);
|
|
|
|
|
CREATE INDEX widget_ownerships_owner_hub_idx ON widget_ownerships (owner_hub_id);
|
|
|
|
|
CREATE INDEX widget_ownerships_steward_hub_idx ON widget_ownerships (steward_hub_id);
|
|
|
|
|
|
|
|
|
|
-- Routing rule: automatically routes a RequirementCandidate to another hub.
|
|
|
|
|
CREATE TABLE hub_routing_rules (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
source_hub_id UUID NOT NULL,
|
|
|
|
|
target_hub_id UUID NOT NULL,
|
feat(P8): IHF Phase 8 complete — Federated Hub Maturity
Implements the final phase of the IHF v0.1 specification:
- WidgetOwnership: delegated ownership registry (local/delegated/global),
append-only audit artefacts, ownership badge on widget show page
- HubRoutingRule + RoutingEngine: priority-ordered inter-hub routing engine;
null-inclusive category/widget-type matching; RouteNowAction for manual
re-evaluation; RoutedCandidates view per hub
- FederatedPolicyOverlay: draft → active → retired lifecycle; activated
overlays are immutable (same pattern as Phase 6 contracts); policy
compliance dashboard with decision coverage metrics
- StewardshipRole: named governance roles per hub; point-in-time revocation
pattern; hub and ops-board integration
- ArchiveRecord + is_archived: soft-delete on widgets; lineage inspector
traces full traceability chain (Widget → Events → Annotations → Candidates
→ Requirements → Decisions → Deployments → Signals + ArchiveRecord)
- FederatedGovernanceDashboard: 5-panel autoRefresh org-wide governance view
(ownership coverage, routing activity, policy compliance, stewardship
coverage, archive activity)
Schema: widget_ownerships, hub_routing_rules, federated_policy_overlays,
stewardship_roles, archive_records; ALTER widgets ADD is_archived;
ALTER requirement_candidates ADD routed_to_hub_id
Migration: 1743638400-ihf-phase8-federated-hub-maturity.sql
Tests: Phase 8 integration tests appended to Test/Integration.hs
Docs: docs/phase8-summary.md; SCOPE.md updated to Phase 8 complete
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 22:53:01 +00:00
|
|
|
match_category TEXT,
|
|
|
|
|
match_widget_type TEXT,
|
|
|
|
|
priority INTEGER NOT NULL DEFAULT 0,
|
|
|
|
|
status TEXT NOT NULL DEFAULT 'inactive',
|
|
|
|
|
notes TEXT,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
updated_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX hub_routing_rules_source_idx ON hub_routing_rules (source_hub_id);
|
|
|
|
|
CREATE INDEX hub_routing_rules_status_idx ON hub_routing_rules (status);
|
|
|
|
|
|
|
|
|
|
-- Routing destination on requirement candidates.
|
2026-04-04 09:55:12 +00:00
|
|
|
-- MOVED TO CREATE TABLE: ALTER TABLE requirement_candidates ADD COLUMN routed_to_hub_id UUID;
|
feat(P8): IHF Phase 8 complete — Federated Hub Maturity
Implements the final phase of the IHF v0.1 specification:
- WidgetOwnership: delegated ownership registry (local/delegated/global),
append-only audit artefacts, ownership badge on widget show page
- HubRoutingRule + RoutingEngine: priority-ordered inter-hub routing engine;
null-inclusive category/widget-type matching; RouteNowAction for manual
re-evaluation; RoutedCandidates view per hub
- FederatedPolicyOverlay: draft → active → retired lifecycle; activated
overlays are immutable (same pattern as Phase 6 contracts); policy
compliance dashboard with decision coverage metrics
- StewardshipRole: named governance roles per hub; point-in-time revocation
pattern; hub and ops-board integration
- ArchiveRecord + is_archived: soft-delete on widgets; lineage inspector
traces full traceability chain (Widget → Events → Annotations → Candidates
→ Requirements → Decisions → Deployments → Signals + ArchiveRecord)
- FederatedGovernanceDashboard: 5-panel autoRefresh org-wide governance view
(ownership coverage, routing activity, policy compliance, stewardship
coverage, archive activity)
Schema: widget_ownerships, hub_routing_rules, federated_policy_overlays,
stewardship_roles, archive_records; ALTER widgets ADD is_archived;
ALTER requirement_candidates ADD routed_to_hub_id
Migration: 1743638400-ihf-phase8-federated-hub-maturity.sql
Tests: Phase 8 integration tests appended to Test/Integration.hs
Docs: docs/phase8-summary.md; SCOPE.md updated to Phase 8 complete
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 22:53:01 +00:00
|
|
|
|
|
|
|
|
CREATE INDEX requirement_candidates_routed_hub_idx
|
|
|
|
|
ON requirement_candidates (routed_to_hub_id)
|
|
|
|
|
WHERE routed_to_hub_id IS NOT NULL;
|
|
|
|
|
|
|
|
|
|
-- Org-wide policy overlay applied across selected hubs.
|
|
|
|
|
CREATE TABLE federated_policy_overlays (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
|
|
|
title TEXT NOT NULL,
|
|
|
|
|
policy_text TEXT NOT NULL,
|
|
|
|
|
applies_to_hubs JSONB NOT NULL DEFAULT '[]',
|
|
|
|
|
enforced_from TIMESTAMP WITH TIME ZONE,
|
|
|
|
|
status TEXT NOT NULL DEFAULT 'draft',
|
|
|
|
|
notes TEXT,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
updated_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX federated_policy_overlays_status_idx ON federated_policy_overlays (status);
|
|
|
|
|
|
|
|
|
|
-- Named governance role assigned to a hub.
|
|
|
|
|
CREATE TABLE stewardship_roles (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
hub_id UUID NOT NULL,
|
feat(P8): IHF Phase 8 complete — Federated Hub Maturity
Implements the final phase of the IHF v0.1 specification:
- WidgetOwnership: delegated ownership registry (local/delegated/global),
append-only audit artefacts, ownership badge on widget show page
- HubRoutingRule + RoutingEngine: priority-ordered inter-hub routing engine;
null-inclusive category/widget-type matching; RouteNowAction for manual
re-evaluation; RoutedCandidates view per hub
- FederatedPolicyOverlay: draft → active → retired lifecycle; activated
overlays are immutable (same pattern as Phase 6 contracts); policy
compliance dashboard with decision coverage metrics
- StewardshipRole: named governance roles per hub; point-in-time revocation
pattern; hub and ops-board integration
- ArchiveRecord + is_archived: soft-delete on widgets; lineage inspector
traces full traceability chain (Widget → Events → Annotations → Candidates
→ Requirements → Decisions → Deployments → Signals + ArchiveRecord)
- FederatedGovernanceDashboard: 5-panel autoRefresh org-wide governance view
(ownership coverage, routing activity, policy compliance, stewardship
coverage, archive activity)
Schema: widget_ownerships, hub_routing_rules, federated_policy_overlays,
stewardship_roles, archive_records; ALTER widgets ADD is_archived;
ALTER requirement_candidates ADD routed_to_hub_id
Migration: 1743638400-ihf-phase8-federated-hub-maturity.sql
Tests: Phase 8 integration tests appended to Test/Integration.hs
Docs: docs/phase8-summary.md; SCOPE.md updated to Phase 8 complete
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 22:53:01 +00:00
|
|
|
role_name TEXT NOT NULL,
|
|
|
|
|
assigned_to TEXT NOT NULL,
|
|
|
|
|
granted_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
revoked_at TIMESTAMP WITH TIME ZONE,
|
|
|
|
|
notes TEXT
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX stewardship_roles_hub_id_idx ON stewardship_roles (hub_id);
|
|
|
|
|
CREATE INDEX stewardship_roles_active_idx ON stewardship_roles (revoked_at)
|
|
|
|
|
WHERE revoked_at IS NULL;
|
|
|
|
|
|
|
|
|
|
-- Long-term archival entry for any IHF artifact.
|
|
|
|
|
CREATE TABLE archive_records (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
|
|
|
subject_type TEXT NOT NULL,
|
|
|
|
|
subject_id UUID NOT NULL,
|
|
|
|
|
archived_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
reason TEXT NOT NULL,
|
|
|
|
|
archived_by TEXT NOT NULL,
|
|
|
|
|
lineage_ref TEXT
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX archive_records_subject_type_idx ON archive_records (subject_type);
|
|
|
|
|
CREATE INDEX archive_records_subject_id_idx ON archive_records (subject_id);
|
|
|
|
|
|
|
|
|
|
-- Soft-archive flag on widgets.
|
2026-04-04 09:55:12 +00:00
|
|
|
-- MOVED TO CREATE TABLE: ALTER TABLE widgets ADD COLUMN is_archived BOOLEAN NOT NULL DEFAULT FALSE;
|
feat(P8): IHF Phase 8 complete — Federated Hub Maturity
Implements the final phase of the IHF v0.1 specification:
- WidgetOwnership: delegated ownership registry (local/delegated/global),
append-only audit artefacts, ownership badge on widget show page
- HubRoutingRule + RoutingEngine: priority-ordered inter-hub routing engine;
null-inclusive category/widget-type matching; RouteNowAction for manual
re-evaluation; RoutedCandidates view per hub
- FederatedPolicyOverlay: draft → active → retired lifecycle; activated
overlays are immutable (same pattern as Phase 6 contracts); policy
compliance dashboard with decision coverage metrics
- StewardshipRole: named governance roles per hub; point-in-time revocation
pattern; hub and ops-board integration
- ArchiveRecord + is_archived: soft-delete on widgets; lineage inspector
traces full traceability chain (Widget → Events → Annotations → Candidates
→ Requirements → Decisions → Deployments → Signals + ArchiveRecord)
- FederatedGovernanceDashboard: 5-panel autoRefresh org-wide governance view
(ownership coverage, routing activity, policy compliance, stewardship
coverage, archive activity)
Schema: widget_ownerships, hub_routing_rules, federated_policy_overlays,
stewardship_roles, archive_records; ALTER widgets ADD is_archived;
ALTER requirement_candidates ADD routed_to_hub_id
Migration: 1743638400-ihf-phase8-federated-hub-maturity.sql
Tests: Phase 8 integration tests appended to Test/Integration.hs
Docs: docs/phase8-summary.md; SCOPE.md updated to Phase 8 complete
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 22:53:01 +00:00
|
|
|
|
|
|
|
|
CREATE INDEX widgets_is_archived_idx ON widgets (is_archived)
|
|
|
|
|
WHERE is_archived = TRUE;
|
feat(WP-0009): IHF GAAF Compliance Foundation — type registries, extension manifests, architectural contracts
Implements IHUB-WP-0009: closes four GAAF-2026 gaps before domain hub work begins.
- TypeRegistry helper + controllers/views (hub_kind, hub_capability_manifest)
- HubCapabilityManifest entity with validation and registry linkage
- ARCHITECTURE-LAYERS.md + CI-enforced boundary contracts
- Alembic migration 1743724800, fitness tests (Test/Architecture/)
- GAAF spec, Operational Architecture spec, domain hub extension guide
- Updates to CLAUDE.md, SCOPE.md, Schema.sql, Routes, FrontController, Types
state_hub_sync: pending (tunnel was STALE at completion time; run fix-consistency)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 21:17:39 +00:00
|
|
|
|
|
|
|
|
-- ============================================================
|
|
|
|
|
-- GAAF Compliance Foundation (IHUB-WP-0009)
|
|
|
|
|
-- T02: hub_kind | T03: type registries + seed | T04: maturity columns | T05: manifests
|
|
|
|
|
-- ============================================================
|
|
|
|
|
|
|
|
|
|
-- T02 — Hub kind classification
|
2026-04-04 09:55:12 +00:00
|
|
|
-- MOVED TO CREATE TABLE: ALTER TABLE hubs ADD COLUMN hub_kind TEXT NOT NULL DEFAULT 'domain';
|
feat(WP-0009): IHF GAAF Compliance Foundation — type registries, extension manifests, architectural contracts
Implements IHUB-WP-0009: closes four GAAF-2026 gaps before domain hub work begins.
- TypeRegistry helper + controllers/views (hub_kind, hub_capability_manifest)
- HubCapabilityManifest entity with validation and registry linkage
- ARCHITECTURE-LAYERS.md + CI-enforced boundary contracts
- Alembic migration 1743724800, fitness tests (Test/Architecture/)
- GAAF spec, Operational Architecture spec, domain hub extension guide
- Updates to CLAUDE.md, SCOPE.md, Schema.sql, Routes, FrontController, Types
state_hub_sync: pending (tunnel was STALE at completion time; run fix-consistency)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 21:17:39 +00:00
|
|
|
|
|
|
|
|
CREATE INDEX hubs_hub_kind_idx ON hubs (hub_kind);
|
|
|
|
|
|
|
|
|
|
CREATE UNIQUE INDEX hubs_one_framework_idx ON hubs (hub_kind)
|
|
|
|
|
WHERE hub_kind = 'framework';
|
|
|
|
|
|
|
|
|
|
-- T03 — Type registries
|
|
|
|
|
|
|
|
|
|
CREATE TABLE widget_type_registry (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
|
|
|
name TEXT NOT NULL UNIQUE,
|
|
|
|
|
label TEXT NOT NULL,
|
|
|
|
|
description TEXT,
|
2026-04-04 09:55:12 +00:00
|
|
|
owner_hub_id UUID,
|
feat(WP-0009): IHF GAAF Compliance Foundation — type registries, extension manifests, architectural contracts
Implements IHUB-WP-0009: closes four GAAF-2026 gaps before domain hub work begins.
- TypeRegistry helper + controllers/views (hub_kind, hub_capability_manifest)
- HubCapabilityManifest entity with validation and registry linkage
- ARCHITECTURE-LAYERS.md + CI-enforced boundary contracts
- Alembic migration 1743724800, fitness tests (Test/Architecture/)
- GAAF spec, Operational Architecture spec, domain hub extension guide
- Updates to CLAUDE.md, SCOPE.md, Schema.sql, Routes, FrontController, Types
state_hub_sync: pending (tunnel was STALE at completion time; run fix-consistency)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 21:17:39 +00:00
|
|
|
status TEXT NOT NULL DEFAULT 'active',
|
|
|
|
|
deprecated_in_favour_of TEXT,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX widget_type_registry_status_idx ON widget_type_registry (status);
|
|
|
|
|
CREATE INDEX widget_type_registry_owner_hub_idx ON widget_type_registry (owner_hub_id);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE event_type_registry (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
|
|
|
name TEXT NOT NULL UNIQUE,
|
|
|
|
|
label TEXT NOT NULL,
|
|
|
|
|
description TEXT,
|
2026-04-04 09:55:12 +00:00
|
|
|
owner_hub_id UUID,
|
feat(WP-0009): IHF GAAF Compliance Foundation — type registries, extension manifests, architectural contracts
Implements IHUB-WP-0009: closes four GAAF-2026 gaps before domain hub work begins.
- TypeRegistry helper + controllers/views (hub_kind, hub_capability_manifest)
- HubCapabilityManifest entity with validation and registry linkage
- ARCHITECTURE-LAYERS.md + CI-enforced boundary contracts
- Alembic migration 1743724800, fitness tests (Test/Architecture/)
- GAAF spec, Operational Architecture spec, domain hub extension guide
- Updates to CLAUDE.md, SCOPE.md, Schema.sql, Routes, FrontController, Types
state_hub_sync: pending (tunnel was STALE at completion time; run fix-consistency)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 21:17:39 +00:00
|
|
|
status TEXT NOT NULL DEFAULT 'active',
|
|
|
|
|
deprecated_in_favour_of TEXT,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX event_type_registry_status_idx ON event_type_registry (status);
|
|
|
|
|
CREATE INDEX event_type_registry_owner_hub_idx ON event_type_registry (owner_hub_id);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE annotation_category_registry (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
|
|
|
name TEXT NOT NULL UNIQUE,
|
|
|
|
|
label TEXT NOT NULL,
|
|
|
|
|
description TEXT,
|
2026-04-04 09:55:12 +00:00
|
|
|
owner_hub_id UUID,
|
feat(WP-0009): IHF GAAF Compliance Foundation — type registries, extension manifests, architectural contracts
Implements IHUB-WP-0009: closes four GAAF-2026 gaps before domain hub work begins.
- TypeRegistry helper + controllers/views (hub_kind, hub_capability_manifest)
- HubCapabilityManifest entity with validation and registry linkage
- ARCHITECTURE-LAYERS.md + CI-enforced boundary contracts
- Alembic migration 1743724800, fitness tests (Test/Architecture/)
- GAAF spec, Operational Architecture spec, domain hub extension guide
- Updates to CLAUDE.md, SCOPE.md, Schema.sql, Routes, FrontController, Types
state_hub_sync: pending (tunnel was STALE at completion time; run fix-consistency)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 21:17:39 +00:00
|
|
|
status TEXT NOT NULL DEFAULT 'active',
|
|
|
|
|
deprecated_in_favour_of TEXT,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX annotation_category_registry_status_idx ON annotation_category_registry (status);
|
|
|
|
|
CREATE INDEX annotation_category_registry_owner_hub_idx ON annotation_category_registry (owner_hub_id);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE policy_scope_registry (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
|
|
|
name TEXT NOT NULL UNIQUE,
|
|
|
|
|
label TEXT NOT NULL,
|
|
|
|
|
description TEXT,
|
2026-04-04 09:55:12 +00:00
|
|
|
owner_hub_id UUID,
|
feat(WP-0009): IHF GAAF Compliance Foundation — type registries, extension manifests, architectural contracts
Implements IHUB-WP-0009: closes four GAAF-2026 gaps before domain hub work begins.
- TypeRegistry helper + controllers/views (hub_kind, hub_capability_manifest)
- HubCapabilityManifest entity with validation and registry linkage
- ARCHITECTURE-LAYERS.md + CI-enforced boundary contracts
- Alembic migration 1743724800, fitness tests (Test/Architecture/)
- GAAF spec, Operational Architecture spec, domain hub extension guide
- Updates to CLAUDE.md, SCOPE.md, Schema.sql, Routes, FrontController, Types
state_hub_sync: pending (tunnel was STALE at completion time; run fix-consistency)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 21:17:39 +00:00
|
|
|
status TEXT NOT NULL DEFAULT 'active',
|
|
|
|
|
deprecated_in_favour_of TEXT,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX policy_scope_registry_status_idx ON policy_scope_registry (status);
|
|
|
|
|
CREATE INDEX policy_scope_registry_owner_hub_idx ON policy_scope_registry (owner_hub_id);
|
|
|
|
|
|
2026-04-04 09:55:12 +00:00
|
|
|
-- T03 — Type registry seed data moved to Migration/1744502400-seed-type-registries.sql
|
feat(WP-0009): IHF GAAF Compliance Foundation — type registries, extension manifests, architectural contracts
Implements IHUB-WP-0009: closes four GAAF-2026 gaps before domain hub work begins.
- TypeRegistry helper + controllers/views (hub_kind, hub_capability_manifest)
- HubCapabilityManifest entity with validation and registry linkage
- ARCHITECTURE-LAYERS.md + CI-enforced boundary contracts
- Alembic migration 1743724800, fitness tests (Test/Architecture/)
- GAAF spec, Operational Architecture spec, domain hub extension guide
- Updates to CLAUDE.md, SCOPE.md, Schema.sql, Routes, FrontController, Types
state_hub_sync: pending (tunnel was STALE at completion time; run fix-consistency)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 21:17:39 +00:00
|
|
|
|
|
|
|
|
-- T04 — Maturity columns on existing contract tables
|
2026-04-04 09:55:12 +00:00
|
|
|
-- MOVED TO CREATE TABLE: ALTER TABLE envelope_emission_contracts ADD COLUMN maturity TEXT NOT NULL DEFAULT 'stable';
|
|
|
|
|
-- MOVED TO CREATE TABLE: ALTER TABLE interaction_reporting_contracts ADD COLUMN maturity TEXT NOT NULL DEFAULT 'stable';
|
|
|
|
|
-- MOVED TO CREATE TABLE: ALTER TABLE widget_adapter_specs ADD COLUMN maturity TEXT NOT NULL DEFAULT 'beta';
|
feat(WP-0009): IHF GAAF Compliance Foundation — type registries, extension manifests, architectural contracts
Implements IHUB-WP-0009: closes four GAAF-2026 gaps before domain hub work begins.
- TypeRegistry helper + controllers/views (hub_kind, hub_capability_manifest)
- HubCapabilityManifest entity with validation and registry linkage
- ARCHITECTURE-LAYERS.md + CI-enforced boundary contracts
- Alembic migration 1743724800, fitness tests (Test/Architecture/)
- GAAF spec, Operational Architecture spec, domain hub extension guide
- Updates to CLAUDE.md, SCOPE.md, Schema.sql, Routes, FrontController, Types
state_hub_sync: pending (tunnel was STALE at completion time; run fix-consistency)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 21:17:39 +00:00
|
|
|
|
|
|
|
|
-- T05 — Hub Capability Manifest
|
|
|
|
|
|
|
|
|
|
CREATE TABLE hub_capability_manifests (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
hub_id UUID NOT NULL UNIQUE,
|
feat(WP-0009): IHF GAAF Compliance Foundation — type registries, extension manifests, architectural contracts
Implements IHUB-WP-0009: closes four GAAF-2026 gaps before domain hub work begins.
- TypeRegistry helper + controllers/views (hub_kind, hub_capability_manifest)
- HubCapabilityManifest entity with validation and registry linkage
- ARCHITECTURE-LAYERS.md + CI-enforced boundary contracts
- Alembic migration 1743724800, fitness tests (Test/Architecture/)
- GAAF spec, Operational Architecture spec, domain hub extension guide
- Updates to CLAUDE.md, SCOPE.md, Schema.sql, Routes, FrontController, Types
state_hub_sync: pending (tunnel was STALE at completion time; run fix-consistency)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 21:17:39 +00:00
|
|
|
manifest_version TEXT NOT NULL DEFAULT '1.0',
|
|
|
|
|
declared_widget_types JSONB NOT NULL DEFAULT '[]',
|
|
|
|
|
declared_event_types JSONB NOT NULL DEFAULT '[]',
|
|
|
|
|
declared_annotation_categories JSONB NOT NULL DEFAULT '[]',
|
|
|
|
|
declared_policy_scopes JSONB NOT NULL DEFAULT '[]',
|
|
|
|
|
capability_description TEXT,
|
|
|
|
|
contact TEXT,
|
|
|
|
|
status TEXT NOT NULL DEFAULT 'draft',
|
|
|
|
|
activated_at TIMESTAMP WITH TIME ZONE,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
|
|
|
updated_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX hub_capability_manifests_hub_id_idx ON hub_capability_manifests (hub_id);
|
|
|
|
|
CREATE INDEX hub_capability_manifests_status_idx ON hub_capability_manifests (status);
|
|
|
|
|
|
|
|
|
|
-- GAAF: type registries enforced from here (IHUB-WP-0009)
|
|
|
|
|
-- All new type discriminator columns (widget_type, event_type, category,
|
|
|
|
|
-- policy_scope) must reference a registry table or carry a CHECK constraint.
|
feat(WP-0010): IHF Phase 9 — External API Surface and Consumer SDKs
Delivers the full Phase 9 external API layer:
- Versioned REST API (/api/v2/) with OpenAPI 3.1 spec; enum arrays for
widget_type, event_type, annotation category drawn live from registry tables
- OAuth 2.0 client credentials flow (/api/v2/token); hub:*:write scopes
gated on active HubCapabilityManifest FK
- API key management: SHA256-hashed tokens, key_prefix for display,
one-time reveal on creation, revocation support
- TypeScript and Python consumer SDKs generated from registry tables
(/api/v2/sdk/ihf-client.ts, /api/v2/sdk/ihf-client.py)
- Webhook delivery: HMAC-SHA256 signing, append-only webhook_deliveries,
fire-and-forget dispatch via forkIO, 3-retry logic
- Admin API dashboard with 24h stats (request count, error rate, last seen)
- Rate limiting (per-minute) and daily quota enforcement via api_request_log
- Schema migration: api_consumers, api_keys, webhook_subscriptions (CHECK
constraint on 6 framework lifecycle topics), webhook_deliveries
(append-only trigger), api_request_log
- ARCHITECTURE-LAYERS.md scorecard: 3.34 → 3.41 (approaching Strong)
- contracts/functional/interaction-reporting-v1.md extended with Phase 9
endpoint catalogue and 422 validation error format
GAAF: no bare TEXT discriminators; webhook event_type uses CHECK constraint
over 6 allowed framework lifecycle topic strings (not widget event types).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 19:52:20 +00:00
|
|
|
|
|
|
|
|
-- IHF Phase 9 — External API Surface and Consumer SDKs (IHUB-WP-0010)
|
|
|
|
|
|
|
|
|
|
CREATE TABLE api_consumers (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
|
|
|
name TEXT NOT NULL,
|
|
|
|
|
description TEXT,
|
2026-04-04 09:55:12 +00:00
|
|
|
hub_capability_manifest_id UUID,
|
feat(WP-0010): IHF Phase 9 — External API Surface and Consumer SDKs
Delivers the full Phase 9 external API layer:
- Versioned REST API (/api/v2/) with OpenAPI 3.1 spec; enum arrays for
widget_type, event_type, annotation category drawn live from registry tables
- OAuth 2.0 client credentials flow (/api/v2/token); hub:*:write scopes
gated on active HubCapabilityManifest FK
- API key management: SHA256-hashed tokens, key_prefix for display,
one-time reveal on creation, revocation support
- TypeScript and Python consumer SDKs generated from registry tables
(/api/v2/sdk/ihf-client.ts, /api/v2/sdk/ihf-client.py)
- Webhook delivery: HMAC-SHA256 signing, append-only webhook_deliveries,
fire-and-forget dispatch via forkIO, 3-retry logic
- Admin API dashboard with 24h stats (request count, error rate, last seen)
- Rate limiting (per-minute) and daily quota enforcement via api_request_log
- Schema migration: api_consumers, api_keys, webhook_subscriptions (CHECK
constraint on 6 framework lifecycle topics), webhook_deliveries
(append-only trigger), api_request_log
- ARCHITECTURE-LAYERS.md scorecard: 3.34 → 3.41 (approaching Strong)
- contracts/functional/interaction-reporting-v1.md extended with Phase 9
endpoint catalogue and 422 validation error format
GAAF: no bare TEXT discriminators; webhook event_type uses CHECK constraint
over 6 allowed framework lifecycle topic strings (not widget event types).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 19:52:20 +00:00
|
|
|
rate_limit_per_minute INTEGER NOT NULL DEFAULT 60,
|
|
|
|
|
quota_per_day INTEGER NOT NULL DEFAULT 10000,
|
2026-04-04 09:55:12 +00:00
|
|
|
quota_resets_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
|
feat(WP-0010): IHF Phase 9 — External API Surface and Consumer SDKs
Delivers the full Phase 9 external API layer:
- Versioned REST API (/api/v2/) with OpenAPI 3.1 spec; enum arrays for
widget_type, event_type, annotation category drawn live from registry tables
- OAuth 2.0 client credentials flow (/api/v2/token); hub:*:write scopes
gated on active HubCapabilityManifest FK
- API key management: SHA256-hashed tokens, key_prefix for display,
one-time reveal on creation, revocation support
- TypeScript and Python consumer SDKs generated from registry tables
(/api/v2/sdk/ihf-client.ts, /api/v2/sdk/ihf-client.py)
- Webhook delivery: HMAC-SHA256 signing, append-only webhook_deliveries,
fire-and-forget dispatch via forkIO, 3-retry logic
- Admin API dashboard with 24h stats (request count, error rate, last seen)
- Rate limiting (per-minute) and daily quota enforcement via api_request_log
- Schema migration: api_consumers, api_keys, webhook_subscriptions (CHECK
constraint on 6 framework lifecycle topics), webhook_deliveries
(append-only trigger), api_request_log
- ARCHITECTURE-LAYERS.md scorecard: 3.34 → 3.41 (approaching Strong)
- contracts/functional/interaction-reporting-v1.md extended with Phase 9
endpoint catalogue and 422 validation error format
GAAF: no bare TEXT discriminators; webhook event_type uses CHECK constraint
over 6 allowed framework lifecycle topic strings (not widget event types).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 19:52:20 +00:00
|
|
|
is_active BOOLEAN NOT NULL DEFAULT TRUE,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
|
|
|
|
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX api_consumers_manifest_idx ON api_consumers (hub_capability_manifest_id);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE api_keys (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
api_consumer_id UUID NOT NULL,
|
feat(WP-0010): IHF Phase 9 — External API Surface and Consumer SDKs
Delivers the full Phase 9 external API layer:
- Versioned REST API (/api/v2/) with OpenAPI 3.1 spec; enum arrays for
widget_type, event_type, annotation category drawn live from registry tables
- OAuth 2.0 client credentials flow (/api/v2/token); hub:*:write scopes
gated on active HubCapabilityManifest FK
- API key management: SHA256-hashed tokens, key_prefix for display,
one-time reveal on creation, revocation support
- TypeScript and Python consumer SDKs generated from registry tables
(/api/v2/sdk/ihf-client.ts, /api/v2/sdk/ihf-client.py)
- Webhook delivery: HMAC-SHA256 signing, append-only webhook_deliveries,
fire-and-forget dispatch via forkIO, 3-retry logic
- Admin API dashboard with 24h stats (request count, error rate, last seen)
- Rate limiting (per-minute) and daily quota enforcement via api_request_log
- Schema migration: api_consumers, api_keys, webhook_subscriptions (CHECK
constraint on 6 framework lifecycle topics), webhook_deliveries
(append-only trigger), api_request_log
- ARCHITECTURE-LAYERS.md scorecard: 3.34 → 3.41 (approaching Strong)
- contracts/functional/interaction-reporting-v1.md extended with Phase 9
endpoint catalogue and 422 validation error format
GAAF: no bare TEXT discriminators; webhook event_type uses CHECK constraint
over 6 allowed framework lifecycle topic strings (not widget event types).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 19:52:20 +00:00
|
|
|
key_prefix TEXT NOT NULL,
|
|
|
|
|
key_hash TEXT NOT NULL,
|
|
|
|
|
scopes TEXT NOT NULL DEFAULT '',
|
2026-04-04 09:55:12 +00:00
|
|
|
token_type TEXT NOT NULL DEFAULT 'static',
|
feat(WP-0010): IHF Phase 9 — External API Surface and Consumer SDKs
Delivers the full Phase 9 external API layer:
- Versioned REST API (/api/v2/) with OpenAPI 3.1 spec; enum arrays for
widget_type, event_type, annotation category drawn live from registry tables
- OAuth 2.0 client credentials flow (/api/v2/token); hub:*:write scopes
gated on active HubCapabilityManifest FK
- API key management: SHA256-hashed tokens, key_prefix for display,
one-time reveal on creation, revocation support
- TypeScript and Python consumer SDKs generated from registry tables
(/api/v2/sdk/ihf-client.ts, /api/v2/sdk/ihf-client.py)
- Webhook delivery: HMAC-SHA256 signing, append-only webhook_deliveries,
fire-and-forget dispatch via forkIO, 3-retry logic
- Admin API dashboard with 24h stats (request count, error rate, last seen)
- Rate limiting (per-minute) and daily quota enforcement via api_request_log
- Schema migration: api_consumers, api_keys, webhook_subscriptions (CHECK
constraint on 6 framework lifecycle topics), webhook_deliveries
(append-only trigger), api_request_log
- ARCHITECTURE-LAYERS.md scorecard: 3.34 → 3.41 (approaching Strong)
- contracts/functional/interaction-reporting-v1.md extended with Phase 9
endpoint catalogue and 422 validation error format
GAAF: no bare TEXT discriminators; webhook event_type uses CHECK constraint
over 6 allowed framework lifecycle topic strings (not widget event types).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 19:52:20 +00:00
|
|
|
expires_at TIMESTAMP WITH TIME ZONE,
|
|
|
|
|
revoked_at TIMESTAMP WITH TIME ZONE,
|
|
|
|
|
last_used_at TIMESTAMP WITH TIME ZONE,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE UNIQUE INDEX api_keys_prefix_idx ON api_keys (key_prefix);
|
|
|
|
|
CREATE INDEX api_keys_consumer_idx ON api_keys (api_consumer_id);
|
|
|
|
|
CREATE INDEX api_keys_hash_idx ON api_keys (key_hash);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE webhook_subscriptions (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
api_consumer_id UUID NOT NULL,
|
|
|
|
|
event_type TEXT NOT NULL,
|
feat(WP-0010): IHF Phase 9 — External API Surface and Consumer SDKs
Delivers the full Phase 9 external API layer:
- Versioned REST API (/api/v2/) with OpenAPI 3.1 spec; enum arrays for
widget_type, event_type, annotation category drawn live from registry tables
- OAuth 2.0 client credentials flow (/api/v2/token); hub:*:write scopes
gated on active HubCapabilityManifest FK
- API key management: SHA256-hashed tokens, key_prefix for display,
one-time reveal on creation, revocation support
- TypeScript and Python consumer SDKs generated from registry tables
(/api/v2/sdk/ihf-client.ts, /api/v2/sdk/ihf-client.py)
- Webhook delivery: HMAC-SHA256 signing, append-only webhook_deliveries,
fire-and-forget dispatch via forkIO, 3-retry logic
- Admin API dashboard with 24h stats (request count, error rate, last seen)
- Rate limiting (per-minute) and daily quota enforcement via api_request_log
- Schema migration: api_consumers, api_keys, webhook_subscriptions (CHECK
constraint on 6 framework lifecycle topics), webhook_deliveries
(append-only trigger), api_request_log
- ARCHITECTURE-LAYERS.md scorecard: 3.34 → 3.41 (approaching Strong)
- contracts/functional/interaction-reporting-v1.md extended with Phase 9
endpoint catalogue and 422 validation error format
GAAF: no bare TEXT discriminators; webhook event_type uses CHECK constraint
over 6 allowed framework lifecycle topic strings (not widget event types).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 19:52:20 +00:00
|
|
|
target_url TEXT NOT NULL,
|
|
|
|
|
secret TEXT NOT NULL,
|
|
|
|
|
is_active BOOLEAN NOT NULL DEFAULT TRUE,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
|
|
|
|
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX webhook_subs_consumer_idx ON webhook_subscriptions (api_consumer_id);
|
|
|
|
|
CREATE INDEX webhook_subs_event_type_idx ON webhook_subscriptions (event_type);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE webhook_deliveries (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
webhook_subscription_id UUID NOT NULL,
|
feat(WP-0010): IHF Phase 9 — External API Surface and Consumer SDKs
Delivers the full Phase 9 external API layer:
- Versioned REST API (/api/v2/) with OpenAPI 3.1 spec; enum arrays for
widget_type, event_type, annotation category drawn live from registry tables
- OAuth 2.0 client credentials flow (/api/v2/token); hub:*:write scopes
gated on active HubCapabilityManifest FK
- API key management: SHA256-hashed tokens, key_prefix for display,
one-time reveal on creation, revocation support
- TypeScript and Python consumer SDKs generated from registry tables
(/api/v2/sdk/ihf-client.ts, /api/v2/sdk/ihf-client.py)
- Webhook delivery: HMAC-SHA256 signing, append-only webhook_deliveries,
fire-and-forget dispatch via forkIO, 3-retry logic
- Admin API dashboard with 24h stats (request count, error rate, last seen)
- Rate limiting (per-minute) and daily quota enforcement via api_request_log
- Schema migration: api_consumers, api_keys, webhook_subscriptions (CHECK
constraint on 6 framework lifecycle topics), webhook_deliveries
(append-only trigger), api_request_log
- ARCHITECTURE-LAYERS.md scorecard: 3.34 → 3.41 (approaching Strong)
- contracts/functional/interaction-reporting-v1.md extended with Phase 9
endpoint catalogue and 422 validation error format
GAAF: no bare TEXT discriminators; webhook event_type uses CHECK constraint
over 6 allowed framework lifecycle topic strings (not widget event types).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 19:52:20 +00:00
|
|
|
payload JSONB NOT NULL,
|
|
|
|
|
attempted_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
status TEXT NOT NULL,
|
feat(WP-0010): IHF Phase 9 — External API Surface and Consumer SDKs
Delivers the full Phase 9 external API layer:
- Versioned REST API (/api/v2/) with OpenAPI 3.1 spec; enum arrays for
widget_type, event_type, annotation category drawn live from registry tables
- OAuth 2.0 client credentials flow (/api/v2/token); hub:*:write scopes
gated on active HubCapabilityManifest FK
- API key management: SHA256-hashed tokens, key_prefix for display,
one-time reveal on creation, revocation support
- TypeScript and Python consumer SDKs generated from registry tables
(/api/v2/sdk/ihf-client.ts, /api/v2/sdk/ihf-client.py)
- Webhook delivery: HMAC-SHA256 signing, append-only webhook_deliveries,
fire-and-forget dispatch via forkIO, 3-retry logic
- Admin API dashboard with 24h stats (request count, error rate, last seen)
- Rate limiting (per-minute) and daily quota enforcement via api_request_log
- Schema migration: api_consumers, api_keys, webhook_subscriptions (CHECK
constraint on 6 framework lifecycle topics), webhook_deliveries
(append-only trigger), api_request_log
- ARCHITECTURE-LAYERS.md scorecard: 3.34 → 3.41 (approaching Strong)
- contracts/functional/interaction-reporting-v1.md extended with Phase 9
endpoint catalogue and 422 validation error format
GAAF: no bare TEXT discriminators; webhook event_type uses CHECK constraint
over 6 allowed framework lifecycle topic strings (not widget event types).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 19:52:20 +00:00
|
|
|
response_code INTEGER,
|
|
|
|
|
latency_ms INTEGER,
|
|
|
|
|
error_message TEXT
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX webhook_deliveries_sub_idx
|
|
|
|
|
ON webhook_deliveries (webhook_subscription_id, attempted_at DESC);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE api_request_log (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
api_consumer_id UUID,
|
feat(WP-0010): IHF Phase 9 — External API Surface and Consumer SDKs
Delivers the full Phase 9 external API layer:
- Versioned REST API (/api/v2/) with OpenAPI 3.1 spec; enum arrays for
widget_type, event_type, annotation category drawn live from registry tables
- OAuth 2.0 client credentials flow (/api/v2/token); hub:*:write scopes
gated on active HubCapabilityManifest FK
- API key management: SHA256-hashed tokens, key_prefix for display,
one-time reveal on creation, revocation support
- TypeScript and Python consumer SDKs generated from registry tables
(/api/v2/sdk/ihf-client.ts, /api/v2/sdk/ihf-client.py)
- Webhook delivery: HMAC-SHA256 signing, append-only webhook_deliveries,
fire-and-forget dispatch via forkIO, 3-retry logic
- Admin API dashboard with 24h stats (request count, error rate, last seen)
- Rate limiting (per-minute) and daily quota enforcement via api_request_log
- Schema migration: api_consumers, api_keys, webhook_subscriptions (CHECK
constraint on 6 framework lifecycle topics), webhook_deliveries
(append-only trigger), api_request_log
- ARCHITECTURE-LAYERS.md scorecard: 3.34 → 3.41 (approaching Strong)
- contracts/functional/interaction-reporting-v1.md extended with Phase 9
endpoint catalogue and 422 validation error format
GAAF: no bare TEXT discriminators; webhook event_type uses CHECK constraint
over 6 allowed framework lifecycle topic strings (not widget event types).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 19:52:20 +00:00
|
|
|
endpoint TEXT NOT NULL,
|
|
|
|
|
method TEXT NOT NULL,
|
|
|
|
|
status_code INTEGER NOT NULL,
|
|
|
|
|
latency_ms INTEGER,
|
|
|
|
|
requested_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX api_request_log_consumer_time_idx
|
|
|
|
|
ON api_request_log (api_consumer_id, requested_at DESC);
|
feat(WP-0011): IHF Phase 10 — Hub Registry and Widget Marketplace
Delivers the hub registry discovery UI, widget pattern library,
governance template library, and marketplace dashboard.
Key changes:
- Schema: widget_patterns (widget_type FK to registry), widget_pattern_versions,
pattern_adoptions, governance_templates (categories JSONB, validated at
controller), governance_template_clones — all GAAF-compliant, no bare TEXT
type discriminators
- Migration: 1743897600-ihf-phase10-hub-registry.sql
- HubRegistry controller + views: browsable view over hub_capability_manifests,
hub_health_snapshots, hubs with per-hub GAAF compliance indicator
- WidgetPatterns controller + views: publish, version, adopt; adoption
triggers manifest amendment draft when new types are introduced
- GovernanceTemplates controller + views: CRUD, clone with category
validation against annotation_category_registry
- MarketplaceDashboard controller + view: full-text search, widget-type
filter, sort, trending panel, autoRefresh
- API v2: /api/v2/hub-registry, /api/v2/widget-patterns (+ adopt endpoint)
- OpenAPI spec updated with Phase 10 paths
- GAAF scorecard: Customization 2.5 → 3.2; overall 3.41 → 3.56 (Strong)
- CLAUDE.md: Phase 10 complete; active workplan → Phase 11
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:14:43 +00:00
|
|
|
|
|
|
|
|
-- IHF Phase 10 — Hub Registry and Widget Marketplace (IHUB-WP-0011)
|
|
|
|
|
-- No HubRegistry table — hub registry is a view over existing tables
|
|
|
|
|
-- (hub_capability_manifests + hub_health_snapshots + hubs)
|
|
|
|
|
|
|
|
|
|
-- widget_patterns: reusable widget definitions tied to registered types
|
|
|
|
|
-- GAAF: widget_type FKs to widget_type_registry(name) — not TEXT
|
|
|
|
|
CREATE TABLE widget_patterns (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
hub_id UUID NOT NULL,
|
feat(WP-0011): IHF Phase 10 — Hub Registry and Widget Marketplace
Delivers the hub registry discovery UI, widget pattern library,
governance template library, and marketplace dashboard.
Key changes:
- Schema: widget_patterns (widget_type FK to registry), widget_pattern_versions,
pattern_adoptions, governance_templates (categories JSONB, validated at
controller), governance_template_clones — all GAAF-compliant, no bare TEXT
type discriminators
- Migration: 1743897600-ihf-phase10-hub-registry.sql
- HubRegistry controller + views: browsable view over hub_capability_manifests,
hub_health_snapshots, hubs with per-hub GAAF compliance indicator
- WidgetPatterns controller + views: publish, version, adopt; adoption
triggers manifest amendment draft when new types are introduced
- GovernanceTemplates controller + views: CRUD, clone with category
validation against annotation_category_registry
- MarketplaceDashboard controller + view: full-text search, widget-type
filter, sort, trending panel, autoRefresh
- API v2: /api/v2/hub-registry, /api/v2/widget-patterns (+ adopt endpoint)
- OpenAPI spec updated with Phase 10 paths
- GAAF scorecard: Customization 2.5 → 3.2; overall 3.41 → 3.56 (Strong)
- CLAUDE.md: Phase 10 complete; active workplan → Phase 11
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:14:43 +00:00
|
|
|
name TEXT NOT NULL,
|
|
|
|
|
description TEXT,
|
2026-04-04 09:55:12 +00:00
|
|
|
widget_type TEXT NOT NULL,
|
feat(WP-0011): IHF Phase 10 — Hub Registry and Widget Marketplace
Delivers the hub registry discovery UI, widget pattern library,
governance template library, and marketplace dashboard.
Key changes:
- Schema: widget_patterns (widget_type FK to registry), widget_pattern_versions,
pattern_adoptions, governance_templates (categories JSONB, validated at
controller), governance_template_clones — all GAAF-compliant, no bare TEXT
type discriminators
- Migration: 1743897600-ihf-phase10-hub-registry.sql
- HubRegistry controller + views: browsable view over hub_capability_manifests,
hub_health_snapshots, hubs with per-hub GAAF compliance indicator
- WidgetPatterns controller + views: publish, version, adopt; adoption
triggers manifest amendment draft when new types are introduced
- GovernanceTemplates controller + views: CRUD, clone with category
validation against annotation_category_registry
- MarketplaceDashboard controller + view: full-text search, widget-type
filter, sort, trending panel, autoRefresh
- API v2: /api/v2/hub-registry, /api/v2/widget-patterns (+ adopt endpoint)
- OpenAPI spec updated with Phase 10 paths
- GAAF scorecard: Customization 2.5 → 3.2; overall 3.41 → 3.56 (Strong)
- CLAUDE.md: Phase 10 complete; active workplan → Phase 11
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:14:43 +00:00
|
|
|
is_cross_hub BOOLEAN NOT NULL DEFAULT FALSE,
|
|
|
|
|
is_published BOOLEAN NOT NULL DEFAULT FALSE,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
|
|
|
|
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX widget_patterns_hub_id_idx ON widget_patterns (hub_id);
|
|
|
|
|
CREATE INDEX widget_patterns_widget_type_idx ON widget_patterns (widget_type);
|
|
|
|
|
CREATE INDEX widget_patterns_is_published_idx ON widget_patterns (is_published);
|
|
|
|
|
|
|
|
|
|
-- widget_pattern_versions: explicit version history
|
|
|
|
|
CREATE TABLE widget_pattern_versions (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
widget_pattern_id UUID NOT NULL,
|
feat(WP-0011): IHF Phase 10 — Hub Registry and Widget Marketplace
Delivers the hub registry discovery UI, widget pattern library,
governance template library, and marketplace dashboard.
Key changes:
- Schema: widget_patterns (widget_type FK to registry), widget_pattern_versions,
pattern_adoptions, governance_templates (categories JSONB, validated at
controller), governance_template_clones — all GAAF-compliant, no bare TEXT
type discriminators
- Migration: 1743897600-ihf-phase10-hub-registry.sql
- HubRegistry controller + views: browsable view over hub_capability_manifests,
hub_health_snapshots, hubs with per-hub GAAF compliance indicator
- WidgetPatterns controller + views: publish, version, adopt; adoption
triggers manifest amendment draft when new types are introduced
- GovernanceTemplates controller + views: CRUD, clone with category
validation against annotation_category_registry
- MarketplaceDashboard controller + view: full-text search, widget-type
filter, sort, trending panel, autoRefresh
- API v2: /api/v2/hub-registry, /api/v2/widget-patterns (+ adopt endpoint)
- OpenAPI spec updated with Phase 10 paths
- GAAF scorecard: Customization 2.5 → 3.2; overall 3.41 → 3.56 (Strong)
- CLAUDE.md: Phase 10 complete; active workplan → Phase 11
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:14:43 +00:00
|
|
|
version_number INTEGER NOT NULL,
|
|
|
|
|
definition JSONB NOT NULL,
|
|
|
|
|
changelog TEXT,
|
|
|
|
|
published_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
|
|
|
|
UNIQUE (widget_pattern_id, version_number)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX widget_pattern_versions_pattern_idx ON widget_pattern_versions (widget_pattern_id);
|
|
|
|
|
|
|
|
|
|
-- pattern_adoptions: which hubs have adopted which patterns
|
|
|
|
|
CREATE TABLE pattern_adoptions (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
widget_pattern_id UUID NOT NULL,
|
|
|
|
|
adopting_hub_id UUID NOT NULL,
|
|
|
|
|
pinned_version_id UUID,
|
feat(WP-0011): IHF Phase 10 — Hub Registry and Widget Marketplace
Delivers the hub registry discovery UI, widget pattern library,
governance template library, and marketplace dashboard.
Key changes:
- Schema: widget_patterns (widget_type FK to registry), widget_pattern_versions,
pattern_adoptions, governance_templates (categories JSONB, validated at
controller), governance_template_clones — all GAAF-compliant, no bare TEXT
type discriminators
- Migration: 1743897600-ihf-phase10-hub-registry.sql
- HubRegistry controller + views: browsable view over hub_capability_manifests,
hub_health_snapshots, hubs with per-hub GAAF compliance indicator
- WidgetPatterns controller + views: publish, version, adopt; adoption
triggers manifest amendment draft when new types are introduced
- GovernanceTemplates controller + views: CRUD, clone with category
validation against annotation_category_registry
- MarketplaceDashboard controller + view: full-text search, widget-type
filter, sort, trending panel, autoRefresh
- API v2: /api/v2/hub-registry, /api/v2/widget-patterns (+ adopt endpoint)
- OpenAPI spec updated with Phase 10 paths
- GAAF scorecard: Customization 2.5 → 3.2; overall 3.41 → 3.56 (Strong)
- CLAUDE.md: Phase 10 complete; active workplan → Phase 11
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:14:43 +00:00
|
|
|
is_version_pinned BOOLEAN NOT NULL DEFAULT FALSE,
|
|
|
|
|
is_anonymous BOOLEAN NOT NULL DEFAULT FALSE,
|
|
|
|
|
adopted_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
|
|
|
|
UNIQUE (widget_pattern_id, adopting_hub_id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX pattern_adoptions_pattern_idx ON pattern_adoptions (widget_pattern_id);
|
|
|
|
|
CREATE INDEX pattern_adoptions_hub_idx ON pattern_adoptions (adopting_hub_id);
|
|
|
|
|
|
|
|
|
|
-- governance_templates: requirement distillation and decision templates
|
|
|
|
|
-- categories is JSONB array of annotation_category_registry names;
|
|
|
|
|
-- each element validated against annotation_category_registry in controller
|
|
|
|
|
CREATE TABLE governance_templates (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
hub_id UUID NOT NULL,
|
feat(WP-0011): IHF Phase 10 — Hub Registry and Widget Marketplace
Delivers the hub registry discovery UI, widget pattern library,
governance template library, and marketplace dashboard.
Key changes:
- Schema: widget_patterns (widget_type FK to registry), widget_pattern_versions,
pattern_adoptions, governance_templates (categories JSONB, validated at
controller), governance_template_clones — all GAAF-compliant, no bare TEXT
type discriminators
- Migration: 1743897600-ihf-phase10-hub-registry.sql
- HubRegistry controller + views: browsable view over hub_capability_manifests,
hub_health_snapshots, hubs with per-hub GAAF compliance indicator
- WidgetPatterns controller + views: publish, version, adopt; adoption
triggers manifest amendment draft when new types are introduced
- GovernanceTemplates controller + views: CRUD, clone with category
validation against annotation_category_registry
- MarketplaceDashboard controller + view: full-text search, widget-type
filter, sort, trending panel, autoRefresh
- API v2: /api/v2/hub-registry, /api/v2/widget-patterns (+ adopt endpoint)
- OpenAPI spec updated with Phase 10 paths
- GAAF scorecard: Customization 2.5 → 3.2; overall 3.41 → 3.56 (Strong)
- CLAUDE.md: Phase 10 complete; active workplan → Phase 11
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:14:43 +00:00
|
|
|
name TEXT NOT NULL,
|
|
|
|
|
description TEXT,
|
|
|
|
|
categories JSONB NOT NULL DEFAULT '[]',
|
|
|
|
|
template_body JSONB NOT NULL,
|
|
|
|
|
is_published BOOLEAN NOT NULL DEFAULT FALSE,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
|
|
|
|
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX governance_templates_hub_id_idx ON governance_templates (hub_id);
|
|
|
|
|
CREATE INDEX governance_templates_is_published_idx ON governance_templates (is_published);
|
|
|
|
|
|
|
|
|
|
-- governance_template_clones: adoption record for governance templates
|
|
|
|
|
CREATE TABLE governance_template_clones (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
governance_template_id UUID NOT NULL,
|
|
|
|
|
cloning_hub_id UUID NOT NULL,
|
feat(WP-0011): IHF Phase 10 — Hub Registry and Widget Marketplace
Delivers the hub registry discovery UI, widget pattern library,
governance template library, and marketplace dashboard.
Key changes:
- Schema: widget_patterns (widget_type FK to registry), widget_pattern_versions,
pattern_adoptions, governance_templates (categories JSONB, validated at
controller), governance_template_clones — all GAAF-compliant, no bare TEXT
type discriminators
- Migration: 1743897600-ihf-phase10-hub-registry.sql
- HubRegistry controller + views: browsable view over hub_capability_manifests,
hub_health_snapshots, hubs with per-hub GAAF compliance indicator
- WidgetPatterns controller + views: publish, version, adopt; adoption
triggers manifest amendment draft when new types are introduced
- GovernanceTemplates controller + views: CRUD, clone with category
validation against annotation_category_registry
- MarketplaceDashboard controller + view: full-text search, widget-type
filter, sort, trending panel, autoRefresh
- API v2: /api/v2/hub-registry, /api/v2/widget-patterns (+ adopt endpoint)
- OpenAPI spec updated with Phase 10 paths
- GAAF scorecard: Customization 2.5 → 3.2; overall 3.41 → 3.56 (Strong)
- CLAUDE.md: Phase 10 complete; active workplan → Phase 11
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:14:43 +00:00
|
|
|
cloned_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
|
|
|
|
UNIQUE (governance_template_id, cloning_hub_id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX governance_template_clones_template_idx ON governance_template_clones (governance_template_id);
|
|
|
|
|
CREATE INDEX governance_template_clones_hub_idx ON governance_template_clones (cloning_hub_id);
|
feat(WP-0012): IHF Phase 11 — Advanced AI Federation
- Schema: AgentRegistration, ModelRoutingPolicy, AgentDelegation,
CollectiveProposal, CollectiveProposalContribution, AiGovernancePolicy,
AgentPerformanceRecord + ALTER TABLE agent_proposals
(migration 1744156800; CHECK constraints on trust_level, status,
consensus_status — GAAF compliant)
- Bridge: scripts/llm_bridge.py (llm-connect subprocess seam) +
Application/Helper/AgentBridge.hs (callBridge, callAgent,
checkGovernancePolicy, jsonArrayTexts)
- Routing: Application/Helper/ModelRouter.hs (resolveAgent,
resolveAllAgents) + ModelRoutingPolicies CRUD
- Registry: AgentRegistrations CRUD (Index/Show/New/Edit/Performance),
DeactivateAgentAction, ComputeAgentPerformanceAction
- Delegation: AgentDelegations controller + views, DelegateSubtaskAction
with token budget enforcement at bridge call time
- Collective: CollectiveProposals controller + views,
CreateCollectiveProposalAction (fan-out → synthesis → consensus detection)
- Governance: AiGovernancePolicies CRUD + ToggleAiGovernancePolicyAction;
checkGovernancePolicy enforced at all 4 Phase 5 invocation points
- Phase 5 wiring: replaced callClaudeApi in Widgets, DecisionRecords,
RequirementCandidates with resolveAgent + callAgent + token tracking
- llm-connect feature requests: ~/llm-connect/FEATURE_REQUESTS.md
(FR-1 HTTP serve, FR-2 RoutingPolicy, FR-3 async, FR-4 BudgetTracker)
- GAAF scorecard: 3.61 (up from 3.56); Functional 3.4→3.6, Extensions 3.8→3.9
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:57:17 +00:00
|
|
|
|
|
|
|
|
-- IHF Phase 11 — Advanced AI Federation (IHUB-WP-0012)
|
|
|
|
|
|
|
|
|
|
-- agent_registrations: named, versioned AI agents backed by llm-connect providers
|
|
|
|
|
-- GAAF: trust_level CHECK constraint — no bare TEXT discriminator
|
|
|
|
|
CREATE TABLE agent_registrations (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
hub_id UUID NOT NULL,
|
feat(WP-0012): IHF Phase 11 — Advanced AI Federation
- Schema: AgentRegistration, ModelRoutingPolicy, AgentDelegation,
CollectiveProposal, CollectiveProposalContribution, AiGovernancePolicy,
AgentPerformanceRecord + ALTER TABLE agent_proposals
(migration 1744156800; CHECK constraints on trust_level, status,
consensus_status — GAAF compliant)
- Bridge: scripts/llm_bridge.py (llm-connect subprocess seam) +
Application/Helper/AgentBridge.hs (callBridge, callAgent,
checkGovernancePolicy, jsonArrayTexts)
- Routing: Application/Helper/ModelRouter.hs (resolveAgent,
resolveAllAgents) + ModelRoutingPolicies CRUD
- Registry: AgentRegistrations CRUD (Index/Show/New/Edit/Performance),
DeactivateAgentAction, ComputeAgentPerformanceAction
- Delegation: AgentDelegations controller + views, DelegateSubtaskAction
with token budget enforcement at bridge call time
- Collective: CollectiveProposals controller + views,
CreateCollectiveProposalAction (fan-out → synthesis → consensus detection)
- Governance: AiGovernancePolicies CRUD + ToggleAiGovernancePolicyAction;
checkGovernancePolicy enforced at all 4 Phase 5 invocation points
- Phase 5 wiring: replaced callClaudeApi in Widgets, DecisionRecords,
RequirementCandidates with resolveAgent + callAgent + token tracking
- llm-connect feature requests: ~/llm-connect/FEATURE_REQUESTS.md
(FR-1 HTTP serve, FR-2 RoutingPolicy, FR-3 async, FR-4 BudgetTracker)
- GAAF scorecard: 3.61 (up from 3.56); Functional 3.4→3.6, Extensions 3.8→3.9
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:57:17 +00:00
|
|
|
name TEXT NOT NULL,
|
|
|
|
|
slug TEXT NOT NULL UNIQUE,
|
|
|
|
|
description TEXT,
|
|
|
|
|
provider TEXT NOT NULL,
|
|
|
|
|
model_name TEXT NOT NULL,
|
|
|
|
|
trust_level TEXT NOT NULL DEFAULT 'advisory',
|
|
|
|
|
capabilities JSONB NOT NULL DEFAULT '[]',
|
|
|
|
|
system_prompt TEXT,
|
|
|
|
|
is_active BOOLEAN NOT NULL DEFAULT TRUE,
|
|
|
|
|
version INTEGER NOT NULL DEFAULT 1,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL
|
feat(WP-0012): IHF Phase 11 — Advanced AI Federation
- Schema: AgentRegistration, ModelRoutingPolicy, AgentDelegation,
CollectiveProposal, CollectiveProposalContribution, AiGovernancePolicy,
AgentPerformanceRecord + ALTER TABLE agent_proposals
(migration 1744156800; CHECK constraints on trust_level, status,
consensus_status — GAAF compliant)
- Bridge: scripts/llm_bridge.py (llm-connect subprocess seam) +
Application/Helper/AgentBridge.hs (callBridge, callAgent,
checkGovernancePolicy, jsonArrayTexts)
- Routing: Application/Helper/ModelRouter.hs (resolveAgent,
resolveAllAgents) + ModelRoutingPolicies CRUD
- Registry: AgentRegistrations CRUD (Index/Show/New/Edit/Performance),
DeactivateAgentAction, ComputeAgentPerformanceAction
- Delegation: AgentDelegations controller + views, DelegateSubtaskAction
with token budget enforcement at bridge call time
- Collective: CollectiveProposals controller + views,
CreateCollectiveProposalAction (fan-out → synthesis → consensus detection)
- Governance: AiGovernancePolicies CRUD + ToggleAiGovernancePolicyAction;
checkGovernancePolicy enforced at all 4 Phase 5 invocation points
- Phase 5 wiring: replaced callClaudeApi in Widgets, DecisionRecords,
RequirementCandidates with resolveAgent + callAgent + token tracking
- llm-connect feature requests: ~/llm-connect/FEATURE_REQUESTS.md
(FR-1 HTTP serve, FR-2 RoutingPolicy, FR-3 async, FR-4 BudgetTracker)
- GAAF scorecard: 3.61 (up from 3.56); Functional 3.4→3.6, Extensions 3.8→3.9
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:57:17 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX agent_registrations_hub_id_idx ON agent_registrations (hub_id);
|
|
|
|
|
CREATE INDEX agent_registrations_slug_idx ON agent_registrations (slug);
|
|
|
|
|
CREATE INDEX agent_registrations_is_active_idx ON agent_registrations (is_active);
|
|
|
|
|
|
|
|
|
|
-- model_routing_policies: task_type → agent selection rules per hub
|
|
|
|
|
CREATE TABLE model_routing_policies (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
hub_id UUID NOT NULL,
|
feat(WP-0012): IHF Phase 11 — Advanced AI Federation
- Schema: AgentRegistration, ModelRoutingPolicy, AgentDelegation,
CollectiveProposal, CollectiveProposalContribution, AiGovernancePolicy,
AgentPerformanceRecord + ALTER TABLE agent_proposals
(migration 1744156800; CHECK constraints on trust_level, status,
consensus_status — GAAF compliant)
- Bridge: scripts/llm_bridge.py (llm-connect subprocess seam) +
Application/Helper/AgentBridge.hs (callBridge, callAgent,
checkGovernancePolicy, jsonArrayTexts)
- Routing: Application/Helper/ModelRouter.hs (resolveAgent,
resolveAllAgents) + ModelRoutingPolicies CRUD
- Registry: AgentRegistrations CRUD (Index/Show/New/Edit/Performance),
DeactivateAgentAction, ComputeAgentPerformanceAction
- Delegation: AgentDelegations controller + views, DelegateSubtaskAction
with token budget enforcement at bridge call time
- Collective: CollectiveProposals controller + views,
CreateCollectiveProposalAction (fan-out → synthesis → consensus detection)
- Governance: AiGovernancePolicies CRUD + ToggleAiGovernancePolicyAction;
checkGovernancePolicy enforced at all 4 Phase 5 invocation points
- Phase 5 wiring: replaced callClaudeApi in Widgets, DecisionRecords,
RequirementCandidates with resolveAgent + callAgent + token tracking
- llm-connect feature requests: ~/llm-connect/FEATURE_REQUESTS.md
(FR-1 HTTP serve, FR-2 RoutingPolicy, FR-3 async, FR-4 BudgetTracker)
- GAAF scorecard: 3.61 (up from 3.56); Functional 3.4→3.6, Extensions 3.8→3.9
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:57:17 +00:00
|
|
|
task_type TEXT NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
agent_registration_id UUID NOT NULL,
|
feat(WP-0012): IHF Phase 11 — Advanced AI Federation
- Schema: AgentRegistration, ModelRoutingPolicy, AgentDelegation,
CollectiveProposal, CollectiveProposalContribution, AiGovernancePolicy,
AgentPerformanceRecord + ALTER TABLE agent_proposals
(migration 1744156800; CHECK constraints on trust_level, status,
consensus_status — GAAF compliant)
- Bridge: scripts/llm_bridge.py (llm-connect subprocess seam) +
Application/Helper/AgentBridge.hs (callBridge, callAgent,
checkGovernancePolicy, jsonArrayTexts)
- Routing: Application/Helper/ModelRouter.hs (resolveAgent,
resolveAllAgents) + ModelRoutingPolicies CRUD
- Registry: AgentRegistrations CRUD (Index/Show/New/Edit/Performance),
DeactivateAgentAction, ComputeAgentPerformanceAction
- Delegation: AgentDelegations controller + views, DelegateSubtaskAction
with token budget enforcement at bridge call time
- Collective: CollectiveProposals controller + views,
CreateCollectiveProposalAction (fan-out → synthesis → consensus detection)
- Governance: AiGovernancePolicies CRUD + ToggleAiGovernancePolicyAction;
checkGovernancePolicy enforced at all 4 Phase 5 invocation points
- Phase 5 wiring: replaced callClaudeApi in Widgets, DecisionRecords,
RequirementCandidates with resolveAgent + callAgent + token tracking
- llm-connect feature requests: ~/llm-connect/FEATURE_REQUESTS.md
(FR-1 HTTP serve, FR-2 RoutingPolicy, FR-3 async, FR-4 BudgetTracker)
- GAAF scorecard: 3.61 (up from 3.56); Functional 3.4→3.6, Extensions 3.8→3.9
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:57:17 +00:00
|
|
|
priority INTEGER NOT NULL DEFAULT 0,
|
|
|
|
|
is_active BOOLEAN NOT NULL DEFAULT TRUE,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
|
|
|
|
UNIQUE (hub_id, task_type, priority)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX model_routing_policies_hub_task_idx ON model_routing_policies (hub_id, task_type);
|
|
|
|
|
|
|
|
|
|
-- agent_delegations: auditable inter-agent subtask delegation records
|
|
|
|
|
-- GAAF: status CHECK constraint
|
|
|
|
|
CREATE TABLE agent_delegations (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
delegating_agent_id UUID NOT NULL,
|
|
|
|
|
receiving_agent_id UUID NOT NULL,
|
|
|
|
|
parent_proposal_id UUID,
|
feat(WP-0012): IHF Phase 11 — Advanced AI Federation
- Schema: AgentRegistration, ModelRoutingPolicy, AgentDelegation,
CollectiveProposal, CollectiveProposalContribution, AiGovernancePolicy,
AgentPerformanceRecord + ALTER TABLE agent_proposals
(migration 1744156800; CHECK constraints on trust_level, status,
consensus_status — GAAF compliant)
- Bridge: scripts/llm_bridge.py (llm-connect subprocess seam) +
Application/Helper/AgentBridge.hs (callBridge, callAgent,
checkGovernancePolicy, jsonArrayTexts)
- Routing: Application/Helper/ModelRouter.hs (resolveAgent,
resolveAllAgents) + ModelRoutingPolicies CRUD
- Registry: AgentRegistrations CRUD (Index/Show/New/Edit/Performance),
DeactivateAgentAction, ComputeAgentPerformanceAction
- Delegation: AgentDelegations controller + views, DelegateSubtaskAction
with token budget enforcement at bridge call time
- Collective: CollectiveProposals controller + views,
CreateCollectiveProposalAction (fan-out → synthesis → consensus detection)
- Governance: AiGovernancePolicies CRUD + ToggleAiGovernancePolicyAction;
checkGovernancePolicy enforced at all 4 Phase 5 invocation points
- Phase 5 wiring: replaced callClaudeApi in Widgets, DecisionRecords,
RequirementCandidates with resolveAgent + callAgent + token tracking
- llm-connect feature requests: ~/llm-connect/FEATURE_REQUESTS.md
(FR-1 HTTP serve, FR-2 RoutingPolicy, FR-3 async, FR-4 BudgetTracker)
- GAAF scorecard: 3.61 (up from 3.56); Functional 3.4→3.6, Extensions 3.8→3.9
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:57:17 +00:00
|
|
|
scope TEXT NOT NULL,
|
|
|
|
|
token_budget INTEGER NOT NULL DEFAULT 1000,
|
|
|
|
|
tokens_used INTEGER,
|
|
|
|
|
status TEXT NOT NULL DEFAULT 'pending',
|
|
|
|
|
result JSONB,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
completed_at TIMESTAMP WITH TIME ZONE
|
feat(WP-0012): IHF Phase 11 — Advanced AI Federation
- Schema: AgentRegistration, ModelRoutingPolicy, AgentDelegation,
CollectiveProposal, CollectiveProposalContribution, AiGovernancePolicy,
AgentPerformanceRecord + ALTER TABLE agent_proposals
(migration 1744156800; CHECK constraints on trust_level, status,
consensus_status — GAAF compliant)
- Bridge: scripts/llm_bridge.py (llm-connect subprocess seam) +
Application/Helper/AgentBridge.hs (callBridge, callAgent,
checkGovernancePolicy, jsonArrayTexts)
- Routing: Application/Helper/ModelRouter.hs (resolveAgent,
resolveAllAgents) + ModelRoutingPolicies CRUD
- Registry: AgentRegistrations CRUD (Index/Show/New/Edit/Performance),
DeactivateAgentAction, ComputeAgentPerformanceAction
- Delegation: AgentDelegations controller + views, DelegateSubtaskAction
with token budget enforcement at bridge call time
- Collective: CollectiveProposals controller + views,
CreateCollectiveProposalAction (fan-out → synthesis → consensus detection)
- Governance: AiGovernancePolicies CRUD + ToggleAiGovernancePolicyAction;
checkGovernancePolicy enforced at all 4 Phase 5 invocation points
- Phase 5 wiring: replaced callClaudeApi in Widgets, DecisionRecords,
RequirementCandidates with resolveAgent + callAgent + token tracking
- llm-connect feature requests: ~/llm-connect/FEATURE_REQUESTS.md
(FR-1 HTTP serve, FR-2 RoutingPolicy, FR-3 async, FR-4 BudgetTracker)
- GAAF scorecard: 3.61 (up from 3.56); Functional 3.4→3.6, Extensions 3.8→3.9
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:57:17 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX agent_delegations_delegating_idx ON agent_delegations (delegating_agent_id);
|
|
|
|
|
CREATE INDEX agent_delegations_receiving_idx ON agent_delegations (receiving_agent_id);
|
|
|
|
|
CREATE INDEX agent_delegations_parent_proposal_idx ON agent_delegations (parent_proposal_id);
|
|
|
|
|
|
|
|
|
|
-- collective_proposals: multi-agent proposals with attribution
|
|
|
|
|
-- GAAF: consensus_status CHECK constraint
|
|
|
|
|
CREATE TABLE collective_proposals (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
|
|
|
title TEXT NOT NULL,
|
|
|
|
|
summary TEXT,
|
|
|
|
|
task_type TEXT NOT NULL,
|
|
|
|
|
consensus_status TEXT NOT NULL DEFAULT 'pending',
|
|
|
|
|
final_content JSONB,
|
2026-04-04 09:55:12 +00:00
|
|
|
source_widget_id UUID,
|
|
|
|
|
source_candidate_id UUID,
|
feat(WP-0012): IHF Phase 11 — Advanced AI Federation
- Schema: AgentRegistration, ModelRoutingPolicy, AgentDelegation,
CollectiveProposal, CollectiveProposalContribution, AiGovernancePolicy,
AgentPerformanceRecord + ALTER TABLE agent_proposals
(migration 1744156800; CHECK constraints on trust_level, status,
consensus_status — GAAF compliant)
- Bridge: scripts/llm_bridge.py (llm-connect subprocess seam) +
Application/Helper/AgentBridge.hs (callBridge, callAgent,
checkGovernancePolicy, jsonArrayTexts)
- Routing: Application/Helper/ModelRouter.hs (resolveAgent,
resolveAllAgents) + ModelRoutingPolicies CRUD
- Registry: AgentRegistrations CRUD (Index/Show/New/Edit/Performance),
DeactivateAgentAction, ComputeAgentPerformanceAction
- Delegation: AgentDelegations controller + views, DelegateSubtaskAction
with token budget enforcement at bridge call time
- Collective: CollectiveProposals controller + views,
CreateCollectiveProposalAction (fan-out → synthesis → consensus detection)
- Governance: AiGovernancePolicies CRUD + ToggleAiGovernancePolicyAction;
checkGovernancePolicy enforced at all 4 Phase 5 invocation points
- Phase 5 wiring: replaced callClaudeApi in Widgets, DecisionRecords,
RequirementCandidates with resolveAgent + callAgent + token tracking
- llm-connect feature requests: ~/llm-connect/FEATURE_REQUESTS.md
(FR-1 HTTP serve, FR-2 RoutingPolicy, FR-3 async, FR-4 BudgetTracker)
- GAAF scorecard: 3.61 (up from 3.56); Functional 3.4→3.6, Extensions 3.8→3.9
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:57:17 +00:00
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL
|
feat(WP-0012): IHF Phase 11 — Advanced AI Federation
- Schema: AgentRegistration, ModelRoutingPolicy, AgentDelegation,
CollectiveProposal, CollectiveProposalContribution, AiGovernancePolicy,
AgentPerformanceRecord + ALTER TABLE agent_proposals
(migration 1744156800; CHECK constraints on trust_level, status,
consensus_status — GAAF compliant)
- Bridge: scripts/llm_bridge.py (llm-connect subprocess seam) +
Application/Helper/AgentBridge.hs (callBridge, callAgent,
checkGovernancePolicy, jsonArrayTexts)
- Routing: Application/Helper/ModelRouter.hs (resolveAgent,
resolveAllAgents) + ModelRoutingPolicies CRUD
- Registry: AgentRegistrations CRUD (Index/Show/New/Edit/Performance),
DeactivateAgentAction, ComputeAgentPerformanceAction
- Delegation: AgentDelegations controller + views, DelegateSubtaskAction
with token budget enforcement at bridge call time
- Collective: CollectiveProposals controller + views,
CreateCollectiveProposalAction (fan-out → synthesis → consensus detection)
- Governance: AiGovernancePolicies CRUD + ToggleAiGovernancePolicyAction;
checkGovernancePolicy enforced at all 4 Phase 5 invocation points
- Phase 5 wiring: replaced callClaudeApi in Widgets, DecisionRecords,
RequirementCandidates with resolveAgent + callAgent + token tracking
- llm-connect feature requests: ~/llm-connect/FEATURE_REQUESTS.md
(FR-1 HTTP serve, FR-2 RoutingPolicy, FR-3 async, FR-4 BudgetTracker)
- GAAF scorecard: 3.61 (up from 3.56); Functional 3.4→3.6, Extensions 3.8→3.9
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:57:17 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX collective_proposals_task_type_idx ON collective_proposals (task_type);
|
|
|
|
|
CREATE INDEX collective_proposals_consensus_status_idx ON collective_proposals (consensus_status);
|
|
|
|
|
|
|
|
|
|
-- collective_proposal_contributions: per-agent contribution records
|
|
|
|
|
CREATE TABLE collective_proposal_contributions (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
collective_proposal_id UUID NOT NULL,
|
|
|
|
|
agent_registration_id UUID NOT NULL,
|
feat(WP-0012): IHF Phase 11 — Advanced AI Federation
- Schema: AgentRegistration, ModelRoutingPolicy, AgentDelegation,
CollectiveProposal, CollectiveProposalContribution, AiGovernancePolicy,
AgentPerformanceRecord + ALTER TABLE agent_proposals
(migration 1744156800; CHECK constraints on trust_level, status,
consensus_status — GAAF compliant)
- Bridge: scripts/llm_bridge.py (llm-connect subprocess seam) +
Application/Helper/AgentBridge.hs (callBridge, callAgent,
checkGovernancePolicy, jsonArrayTexts)
- Routing: Application/Helper/ModelRouter.hs (resolveAgent,
resolveAllAgents) + ModelRoutingPolicies CRUD
- Registry: AgentRegistrations CRUD (Index/Show/New/Edit/Performance),
DeactivateAgentAction, ComputeAgentPerformanceAction
- Delegation: AgentDelegations controller + views, DelegateSubtaskAction
with token budget enforcement at bridge call time
- Collective: CollectiveProposals controller + views,
CreateCollectiveProposalAction (fan-out → synthesis → consensus detection)
- Governance: AiGovernancePolicies CRUD + ToggleAiGovernancePolicyAction;
checkGovernancePolicy enforced at all 4 Phase 5 invocation points
- Phase 5 wiring: replaced callClaudeApi in Widgets, DecisionRecords,
RequirementCandidates with resolveAgent + callAgent + token tracking
- llm-connect feature requests: ~/llm-connect/FEATURE_REQUESTS.md
(FR-1 HTTP serve, FR-2 RoutingPolicy, FR-3 async, FR-4 BudgetTracker)
- GAAF scorecard: 3.61 (up from 3.56); Functional 3.4→3.6, Extensions 3.8→3.9
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:57:17 +00:00
|
|
|
content JSONB NOT NULL,
|
|
|
|
|
tokens_in INTEGER,
|
|
|
|
|
tokens_out INTEGER,
|
|
|
|
|
model_used TEXT,
|
|
|
|
|
contributed_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX collective_proposal_contributions_proposal_idx ON collective_proposal_contributions (collective_proposal_id);
|
|
|
|
|
CREATE INDEX collective_proposal_contributions_agent_idx ON collective_proposal_contributions (agent_registration_id);
|
|
|
|
|
|
|
|
|
|
-- ai_governance_policies: per-hub rules controlling agent scope
|
|
|
|
|
-- allowed_actions is JSONB array; elements validated at controller layer
|
|
|
|
|
-- (each element: read | propose | delegate | auto_apply)
|
|
|
|
|
CREATE TABLE ai_governance_policies (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
hub_id UUID NOT NULL,
|
|
|
|
|
agent_registration_id UUID NOT NULL,
|
feat(WP-0012): IHF Phase 11 — Advanced AI Federation
- Schema: AgentRegistration, ModelRoutingPolicy, AgentDelegation,
CollectiveProposal, CollectiveProposalContribution, AiGovernancePolicy,
AgentPerformanceRecord + ALTER TABLE agent_proposals
(migration 1744156800; CHECK constraints on trust_level, status,
consensus_status — GAAF compliant)
- Bridge: scripts/llm_bridge.py (llm-connect subprocess seam) +
Application/Helper/AgentBridge.hs (callBridge, callAgent,
checkGovernancePolicy, jsonArrayTexts)
- Routing: Application/Helper/ModelRouter.hs (resolveAgent,
resolveAllAgents) + ModelRoutingPolicies CRUD
- Registry: AgentRegistrations CRUD (Index/Show/New/Edit/Performance),
DeactivateAgentAction, ComputeAgentPerformanceAction
- Delegation: AgentDelegations controller + views, DelegateSubtaskAction
with token budget enforcement at bridge call time
- Collective: CollectiveProposals controller + views,
CreateCollectiveProposalAction (fan-out → synthesis → consensus detection)
- Governance: AiGovernancePolicies CRUD + ToggleAiGovernancePolicyAction;
checkGovernancePolicy enforced at all 4 Phase 5 invocation points
- Phase 5 wiring: replaced callClaudeApi in Widgets, DecisionRecords,
RequirementCandidates with resolveAgent + callAgent + token tracking
- llm-connect feature requests: ~/llm-connect/FEATURE_REQUESTS.md
(FR-1 HTTP serve, FR-2 RoutingPolicy, FR-3 async, FR-4 BudgetTracker)
- GAAF scorecard: 3.61 (up from 3.56); Functional 3.4→3.6, Extensions 3.8→3.9
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:57:17 +00:00
|
|
|
artifact_type TEXT NOT NULL,
|
|
|
|
|
allowed_actions JSONB NOT NULL DEFAULT '["read"]',
|
|
|
|
|
is_active BOOLEAN NOT NULL DEFAULT TRUE,
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
|
|
|
|
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX ai_governance_policies_hub_agent_idx ON ai_governance_policies (hub_id, agent_registration_id);
|
|
|
|
|
CREATE INDEX ai_governance_policies_is_active_idx ON ai_governance_policies (is_active);
|
|
|
|
|
|
|
|
|
|
-- agent_performance_records: periodic snapshots of per-agent metrics
|
|
|
|
|
CREATE TABLE agent_performance_records (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
agent_registration_id UUID NOT NULL,
|
|
|
|
|
hub_id UUID NOT NULL,
|
feat(WP-0012): IHF Phase 11 — Advanced AI Federation
- Schema: AgentRegistration, ModelRoutingPolicy, AgentDelegation,
CollectiveProposal, CollectiveProposalContribution, AiGovernancePolicy,
AgentPerformanceRecord + ALTER TABLE agent_proposals
(migration 1744156800; CHECK constraints on trust_level, status,
consensus_status — GAAF compliant)
- Bridge: scripts/llm_bridge.py (llm-connect subprocess seam) +
Application/Helper/AgentBridge.hs (callBridge, callAgent,
checkGovernancePolicy, jsonArrayTexts)
- Routing: Application/Helper/ModelRouter.hs (resolveAgent,
resolveAllAgents) + ModelRoutingPolicies CRUD
- Registry: AgentRegistrations CRUD (Index/Show/New/Edit/Performance),
DeactivateAgentAction, ComputeAgentPerformanceAction
- Delegation: AgentDelegations controller + views, DelegateSubtaskAction
with token budget enforcement at bridge call time
- Collective: CollectiveProposals controller + views,
CreateCollectiveProposalAction (fan-out → synthesis → consensus detection)
- Governance: AiGovernancePolicies CRUD + ToggleAiGovernancePolicyAction;
checkGovernancePolicy enforced at all 4 Phase 5 invocation points
- Phase 5 wiring: replaced callClaudeApi in Widgets, DecisionRecords,
RequirementCandidates with resolveAgent + callAgent + token tracking
- llm-connect feature requests: ~/llm-connect/FEATURE_REQUESTS.md
(FR-1 HTTP serve, FR-2 RoutingPolicy, FR-3 async, FR-4 BudgetTracker)
- GAAF scorecard: 3.61 (up from 3.56); Functional 3.4→3.6, Extensions 3.8→3.9
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:57:17 +00:00
|
|
|
period_start TIMESTAMP WITH TIME ZONE NOT NULL,
|
|
|
|
|
period_end TIMESTAMP WITH TIME ZONE NOT NULL,
|
|
|
|
|
proposals_generated INTEGER NOT NULL DEFAULT 0,
|
|
|
|
|
proposals_accepted INTEGER NOT NULL DEFAULT 0,
|
|
|
|
|
proposals_rejected INTEGER NOT NULL DEFAULT 0,
|
|
|
|
|
proposals_revised INTEGER NOT NULL DEFAULT 0,
|
|
|
|
|
mean_confidence DOUBLE PRECISION,
|
|
|
|
|
calibration_score DOUBLE PRECISION,
|
|
|
|
|
computed_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX agent_performance_records_agent_idx ON agent_performance_records (agent_registration_id);
|
|
|
|
|
CREATE INDEX agent_performance_records_period_idx ON agent_performance_records (period_start, period_end);
|
|
|
|
|
|
|
|
|
|
-- Extend agent_proposals with agent_registration_id and token tracking (Phase 11)
|
2026-04-04 09:55:12 +00:00
|
|
|
-- MOVED TO CREATE TABLE: ALTER TABLE agent_proposals ADD COLUMN agent_registration_id UUID;
|
|
|
|
|
-- MOVED TO CREATE TABLE: ALTER TABLE agent_proposals ADD COLUMN tokens_in INTEGER;
|
|
|
|
|
-- MOVED TO CREATE TABLE: ALTER TABLE agent_proposals ADD COLUMN tokens_out INTEGER;
|
feat(WP-0012): IHF Phase 11 — Advanced AI Federation
- Schema: AgentRegistration, ModelRoutingPolicy, AgentDelegation,
CollectiveProposal, CollectiveProposalContribution, AiGovernancePolicy,
AgentPerformanceRecord + ALTER TABLE agent_proposals
(migration 1744156800; CHECK constraints on trust_level, status,
consensus_status — GAAF compliant)
- Bridge: scripts/llm_bridge.py (llm-connect subprocess seam) +
Application/Helper/AgentBridge.hs (callBridge, callAgent,
checkGovernancePolicy, jsonArrayTexts)
- Routing: Application/Helper/ModelRouter.hs (resolveAgent,
resolveAllAgents) + ModelRoutingPolicies CRUD
- Registry: AgentRegistrations CRUD (Index/Show/New/Edit/Performance),
DeactivateAgentAction, ComputeAgentPerformanceAction
- Delegation: AgentDelegations controller + views, DelegateSubtaskAction
with token budget enforcement at bridge call time
- Collective: CollectiveProposals controller + views,
CreateCollectiveProposalAction (fan-out → synthesis → consensus detection)
- Governance: AiGovernancePolicies CRUD + ToggleAiGovernancePolicyAction;
checkGovernancePolicy enforced at all 4 Phase 5 invocation points
- Phase 5 wiring: replaced callClaudeApi in Widgets, DecisionRecords,
RequirementCandidates with resolveAgent + callAgent + token tracking
- llm-connect feature requests: ~/llm-connect/FEATURE_REQUESTS.md
(FR-1 HTTP serve, FR-2 RoutingPolicy, FR-3 async, FR-4 BudgetTracker)
- GAAF scorecard: 3.61 (up from 3.56); Functional 3.4→3.6, Extensions 3.8→3.9
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:57:17 +00:00
|
|
|
|
|
|
|
|
CREATE INDEX agent_proposals_agent_registration_idx ON agent_proposals (agent_registration_id);
|
feat(WP-0013): IHF Phase 12 — Platform Memory and Continuous Learning
Closes the long-range feedback loop: outcome signals now enrich the full
traceability chain and feed back into routing, triage, and AI proposals.
Schema (T01):
- outcome_correlations (CHECK correlation_type)
- pattern_performance_records
- adaptive_threshold_configs
- institutional_knowledge_entries (GIN tsvector FTS)
- learning_insights (CHECK insight_type)
- ALTER TABLE decision_records + requirement_candidates: outcome_summary JSONB
- AFTER INSERT trigger trg_enrich_lineage on outcome_signals
- contracts/core/ updated (outcome-summary-columns-v1, append-only addendum)
Correlation engine (T02):
- Application/Helper/CorrelationEngine.hs: pure annotation→outcome SQL
- Web/Controller/OutcomeCorrelations.hs: ComputeCorrelationsAction + index
Pattern performance (T03):
- Web/Controller/PatternPerformance.hs: ComputePatternPerformanceAction
Adaptive thresholds (T04):
- Web/Controller/AdaptiveThresholds.hs: CalibrateThresholdsAction
- Application/Helper/FrictionScore.hs: applyAdaptiveWeights
Institutional knowledge (T05):
- DistilDecisionAction in DecisionRecords controller
- Web/Controller/InstitutionalKnowledge.hs: QueryKnowledgeBaseAction
Lineage enrichment (T06):
- Web/Controller/LineageEnrichment.hs: EnrichLineageAction (batch backfill)
- enrich_lineage_on_outcome_batch() PL/pgSQL helper in migration
Learning dashboard (T07):
- Web/Controller/LearningDashboard.hs: 5-panel autoRefresh view
- "Learning" nav link in FrontController
API v2 learning endpoints (T08):
- GET /api/v2/outcome-correlations, /pattern-performance, /knowledge-base/{id}
- OpenAPI schemas: OutcomeCorrelation, PatternPerformanceRecord, InstitutionalKnowledgeEntry
GAAF scorecard + docs (T09):
- Core 3.8→3.9, Functional 3.6→3.8, overall 3.61→3.68
- CLAUDE.md: IHF v0.2 complete, no active workplan
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 23:14:15 +00:00
|
|
|
|
|
|
|
|
-- ============================================================
|
|
|
|
|
-- Phase 12 — Platform Memory and Continuous Learning
|
|
|
|
|
-- ============================================================
|
|
|
|
|
|
|
|
|
|
-- outcome_correlations: links annotation signals to downstream outcome quality
|
|
|
|
|
-- GAAF: correlation_type CHECK constraint
|
|
|
|
|
CREATE TABLE outcome_correlations (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
hub_id UUID NOT NULL,
|
|
|
|
|
annotation_category TEXT NOT NULL,
|
feat(WP-0013): IHF Phase 12 — Platform Memory and Continuous Learning
Closes the long-range feedback loop: outcome signals now enrich the full
traceability chain and feed back into routing, triage, and AI proposals.
Schema (T01):
- outcome_correlations (CHECK correlation_type)
- pattern_performance_records
- adaptive_threshold_configs
- institutional_knowledge_entries (GIN tsvector FTS)
- learning_insights (CHECK insight_type)
- ALTER TABLE decision_records + requirement_candidates: outcome_summary JSONB
- AFTER INSERT trigger trg_enrich_lineage on outcome_signals
- contracts/core/ updated (outcome-summary-columns-v1, append-only addendum)
Correlation engine (T02):
- Application/Helper/CorrelationEngine.hs: pure annotation→outcome SQL
- Web/Controller/OutcomeCorrelations.hs: ComputeCorrelationsAction + index
Pattern performance (T03):
- Web/Controller/PatternPerformance.hs: ComputePatternPerformanceAction
Adaptive thresholds (T04):
- Web/Controller/AdaptiveThresholds.hs: CalibrateThresholdsAction
- Application/Helper/FrictionScore.hs: applyAdaptiveWeights
Institutional knowledge (T05):
- DistilDecisionAction in DecisionRecords controller
- Web/Controller/InstitutionalKnowledge.hs: QueryKnowledgeBaseAction
Lineage enrichment (T06):
- Web/Controller/LineageEnrichment.hs: EnrichLineageAction (batch backfill)
- enrich_lineage_on_outcome_batch() PL/pgSQL helper in migration
Learning dashboard (T07):
- Web/Controller/LearningDashboard.hs: 5-panel autoRefresh view
- "Learning" nav link in FrontController
API v2 learning endpoints (T08):
- GET /api/v2/outcome-correlations, /pattern-performance, /knowledge-base/{id}
- OpenAPI schemas: OutcomeCorrelation, PatternPerformanceRecord, InstitutionalKnowledgeEntry
GAAF scorecard + docs (T09):
- Core 3.8→3.9, Functional 3.6→3.8, overall 3.61→3.68
- CLAUDE.md: IHF v0.2 complete, no active workplan
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 23:14:15 +00:00
|
|
|
correlation_type TEXT NOT NULL DEFAULT 'annotation_predictor',
|
|
|
|
|
correlation_score DOUBLE PRECISION NOT NULL,
|
|
|
|
|
sample_count INTEGER NOT NULL DEFAULT 0,
|
2026-04-04 09:55:12 +00:00
|
|
|
computed_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL
|
feat(WP-0013): IHF Phase 12 — Platform Memory and Continuous Learning
Closes the long-range feedback loop: outcome signals now enrich the full
traceability chain and feed back into routing, triage, and AI proposals.
Schema (T01):
- outcome_correlations (CHECK correlation_type)
- pattern_performance_records
- adaptive_threshold_configs
- institutional_knowledge_entries (GIN tsvector FTS)
- learning_insights (CHECK insight_type)
- ALTER TABLE decision_records + requirement_candidates: outcome_summary JSONB
- AFTER INSERT trigger trg_enrich_lineage on outcome_signals
- contracts/core/ updated (outcome-summary-columns-v1, append-only addendum)
Correlation engine (T02):
- Application/Helper/CorrelationEngine.hs: pure annotation→outcome SQL
- Web/Controller/OutcomeCorrelations.hs: ComputeCorrelationsAction + index
Pattern performance (T03):
- Web/Controller/PatternPerformance.hs: ComputePatternPerformanceAction
Adaptive thresholds (T04):
- Web/Controller/AdaptiveThresholds.hs: CalibrateThresholdsAction
- Application/Helper/FrictionScore.hs: applyAdaptiveWeights
Institutional knowledge (T05):
- DistilDecisionAction in DecisionRecords controller
- Web/Controller/InstitutionalKnowledge.hs: QueryKnowledgeBaseAction
Lineage enrichment (T06):
- Web/Controller/LineageEnrichment.hs: EnrichLineageAction (batch backfill)
- enrich_lineage_on_outcome_batch() PL/pgSQL helper in migration
Learning dashboard (T07):
- Web/Controller/LearningDashboard.hs: 5-panel autoRefresh view
- "Learning" nav link in FrontController
API v2 learning endpoints (T08):
- GET /api/v2/outcome-correlations, /pattern-performance, /knowledge-base/{id}
- OpenAPI schemas: OutcomeCorrelation, PatternPerformanceRecord, InstitutionalKnowledgeEntry
GAAF scorecard + docs (T09):
- Core 3.8→3.9, Functional 3.6→3.8, overall 3.61→3.68
- CLAUDE.md: IHF v0.2 complete, no active workplan
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 23:14:15 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX outcome_correlations_hub_idx ON outcome_correlations (hub_id);
|
|
|
|
|
CREATE INDEX outcome_correlations_score_idx ON outcome_correlations (correlation_score DESC);
|
|
|
|
|
|
|
|
|
|
-- pattern_performance_records: per-pattern historical outcome quality
|
|
|
|
|
CREATE TABLE pattern_performance_records (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
widget_pattern_id UUID NOT NULL,
|
|
|
|
|
hub_id UUID NOT NULL,
|
feat(WP-0013): IHF Phase 12 — Platform Memory and Continuous Learning
Closes the long-range feedback loop: outcome signals now enrich the full
traceability chain and feed back into routing, triage, and AI proposals.
Schema (T01):
- outcome_correlations (CHECK correlation_type)
- pattern_performance_records
- adaptive_threshold_configs
- institutional_knowledge_entries (GIN tsvector FTS)
- learning_insights (CHECK insight_type)
- ALTER TABLE decision_records + requirement_candidates: outcome_summary JSONB
- AFTER INSERT trigger trg_enrich_lineage on outcome_signals
- contracts/core/ updated (outcome-summary-columns-v1, append-only addendum)
Correlation engine (T02):
- Application/Helper/CorrelationEngine.hs: pure annotation→outcome SQL
- Web/Controller/OutcomeCorrelations.hs: ComputeCorrelationsAction + index
Pattern performance (T03):
- Web/Controller/PatternPerformance.hs: ComputePatternPerformanceAction
Adaptive thresholds (T04):
- Web/Controller/AdaptiveThresholds.hs: CalibrateThresholdsAction
- Application/Helper/FrictionScore.hs: applyAdaptiveWeights
Institutional knowledge (T05):
- DistilDecisionAction in DecisionRecords controller
- Web/Controller/InstitutionalKnowledge.hs: QueryKnowledgeBaseAction
Lineage enrichment (T06):
- Web/Controller/LineageEnrichment.hs: EnrichLineageAction (batch backfill)
- enrich_lineage_on_outcome_batch() PL/pgSQL helper in migration
Learning dashboard (T07):
- Web/Controller/LearningDashboard.hs: 5-panel autoRefresh view
- "Learning" nav link in FrontController
API v2 learning endpoints (T08):
- GET /api/v2/outcome-correlations, /pattern-performance, /knowledge-base/{id}
- OpenAPI schemas: OutcomeCorrelation, PatternPerformanceRecord, InstitutionalKnowledgeEntry
GAAF scorecard + docs (T09):
- Core 3.8→3.9, Functional 3.6→3.8, overall 3.61→3.68
- CLAUDE.md: IHF v0.2 complete, no active workplan
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 23:14:15 +00:00
|
|
|
adoption_count INTEGER NOT NULL DEFAULT 0,
|
|
|
|
|
positive_outcome_count INTEGER NOT NULL DEFAULT 0,
|
|
|
|
|
total_outcome_count INTEGER NOT NULL DEFAULT 0,
|
|
|
|
|
mean_outcome_value DOUBLE PRECISION,
|
|
|
|
|
outcome_rank INTEGER,
|
|
|
|
|
calibrated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
|
|
|
|
UNIQUE (widget_pattern_id, hub_id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX pattern_performance_pattern_idx ON pattern_performance_records (widget_pattern_id);
|
|
|
|
|
CREATE INDEX pattern_performance_rank_idx ON pattern_performance_records (hub_id, outcome_rank);
|
|
|
|
|
|
|
|
|
|
-- adaptive_threshold_configs: per-hub friction weight overrides
|
|
|
|
|
CREATE TABLE adaptive_threshold_configs (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
hub_id UUID NOT NULL UNIQUE,
|
feat(WP-0013): IHF Phase 12 — Platform Memory and Continuous Learning
Closes the long-range feedback loop: outcome signals now enrich the full
traceability chain and feed back into routing, triage, and AI proposals.
Schema (T01):
- outcome_correlations (CHECK correlation_type)
- pattern_performance_records
- adaptive_threshold_configs
- institutional_knowledge_entries (GIN tsvector FTS)
- learning_insights (CHECK insight_type)
- ALTER TABLE decision_records + requirement_candidates: outcome_summary JSONB
- AFTER INSERT trigger trg_enrich_lineage on outcome_signals
- contracts/core/ updated (outcome-summary-columns-v1, append-only addendum)
Correlation engine (T02):
- Application/Helper/CorrelationEngine.hs: pure annotation→outcome SQL
- Web/Controller/OutcomeCorrelations.hs: ComputeCorrelationsAction + index
Pattern performance (T03):
- Web/Controller/PatternPerformance.hs: ComputePatternPerformanceAction
Adaptive thresholds (T04):
- Web/Controller/AdaptiveThresholds.hs: CalibrateThresholdsAction
- Application/Helper/FrictionScore.hs: applyAdaptiveWeights
Institutional knowledge (T05):
- DistilDecisionAction in DecisionRecords controller
- Web/Controller/InstitutionalKnowledge.hs: QueryKnowledgeBaseAction
Lineage enrichment (T06):
- Web/Controller/LineageEnrichment.hs: EnrichLineageAction (batch backfill)
- enrich_lineage_on_outcome_batch() PL/pgSQL helper in migration
Learning dashboard (T07):
- Web/Controller/LearningDashboard.hs: 5-panel autoRefresh view
- "Learning" nav link in FrontController
API v2 learning endpoints (T08):
- GET /api/v2/outcome-correlations, /pattern-performance, /knowledge-base/{id}
- OpenAPI schemas: OutcomeCorrelation, PatternPerformanceRecord, InstitutionalKnowledgeEntry
GAAF scorecard + docs (T09):
- Core 3.8→3.9, Functional 3.6→3.8, overall 3.61→3.68
- CLAUDE.md: IHF v0.2 complete, no active workplan
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 23:14:15 +00:00
|
|
|
weight_overrides JSONB NOT NULL DEFAULT '{}',
|
|
|
|
|
bottleneck_threshold_override DOUBLE PRECISION,
|
|
|
|
|
calibration_date TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
|
|
|
|
notes TEXT
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX adaptive_threshold_hub_idx ON adaptive_threshold_configs (hub_id);
|
|
|
|
|
|
|
|
|
|
-- institutional_knowledge_entries: distilled decision summaries
|
|
|
|
|
-- GIN index for full-text search (PostgreSQL tsvector, no extension needed)
|
|
|
|
|
CREATE TABLE institutional_knowledge_entries (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
hub_id UUID NOT NULL,
|
|
|
|
|
decision_record_id UUID,
|
feat(WP-0013): IHF Phase 12 — Platform Memory and Continuous Learning
Closes the long-range feedback loop: outcome signals now enrich the full
traceability chain and feed back into routing, triage, and AI proposals.
Schema (T01):
- outcome_correlations (CHECK correlation_type)
- pattern_performance_records
- adaptive_threshold_configs
- institutional_knowledge_entries (GIN tsvector FTS)
- learning_insights (CHECK insight_type)
- ALTER TABLE decision_records + requirement_candidates: outcome_summary JSONB
- AFTER INSERT trigger trg_enrich_lineage on outcome_signals
- contracts/core/ updated (outcome-summary-columns-v1, append-only addendum)
Correlation engine (T02):
- Application/Helper/CorrelationEngine.hs: pure annotation→outcome SQL
- Web/Controller/OutcomeCorrelations.hs: ComputeCorrelationsAction + index
Pattern performance (T03):
- Web/Controller/PatternPerformance.hs: ComputePatternPerformanceAction
Adaptive thresholds (T04):
- Web/Controller/AdaptiveThresholds.hs: CalibrateThresholdsAction
- Application/Helper/FrictionScore.hs: applyAdaptiveWeights
Institutional knowledge (T05):
- DistilDecisionAction in DecisionRecords controller
- Web/Controller/InstitutionalKnowledge.hs: QueryKnowledgeBaseAction
Lineage enrichment (T06):
- Web/Controller/LineageEnrichment.hs: EnrichLineageAction (batch backfill)
- enrich_lineage_on_outcome_batch() PL/pgSQL helper in migration
Learning dashboard (T07):
- Web/Controller/LearningDashboard.hs: 5-panel autoRefresh view
- "Learning" nav link in FrontController
API v2 learning endpoints (T08):
- GET /api/v2/outcome-correlations, /pattern-performance, /knowledge-base/{id}
- OpenAPI schemas: OutcomeCorrelation, PatternPerformanceRecord, InstitutionalKnowledgeEntry
GAAF scorecard + docs (T09):
- Core 3.8→3.9, Functional 3.6→3.8, overall 3.61→3.68
- CLAUDE.md: IHF v0.2 complete, no active workplan
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 23:14:15 +00:00
|
|
|
summary TEXT NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
summary_tsv TSVECTOR,
|
feat(WP-0013): IHF Phase 12 — Platform Memory and Continuous Learning
Closes the long-range feedback loop: outcome signals now enrich the full
traceability chain and feed back into routing, triage, and AI proposals.
Schema (T01):
- outcome_correlations (CHECK correlation_type)
- pattern_performance_records
- adaptive_threshold_configs
- institutional_knowledge_entries (GIN tsvector FTS)
- learning_insights (CHECK insight_type)
- ALTER TABLE decision_records + requirement_candidates: outcome_summary JSONB
- AFTER INSERT trigger trg_enrich_lineage on outcome_signals
- contracts/core/ updated (outcome-summary-columns-v1, append-only addendum)
Correlation engine (T02):
- Application/Helper/CorrelationEngine.hs: pure annotation→outcome SQL
- Web/Controller/OutcomeCorrelations.hs: ComputeCorrelationsAction + index
Pattern performance (T03):
- Web/Controller/PatternPerformance.hs: ComputePatternPerformanceAction
Adaptive thresholds (T04):
- Web/Controller/AdaptiveThresholds.hs: CalibrateThresholdsAction
- Application/Helper/FrictionScore.hs: applyAdaptiveWeights
Institutional knowledge (T05):
- DistilDecisionAction in DecisionRecords controller
- Web/Controller/InstitutionalKnowledge.hs: QueryKnowledgeBaseAction
Lineage enrichment (T06):
- Web/Controller/LineageEnrichment.hs: EnrichLineageAction (batch backfill)
- enrich_lineage_on_outcome_batch() PL/pgSQL helper in migration
Learning dashboard (T07):
- Web/Controller/LearningDashboard.hs: 5-panel autoRefresh view
- "Learning" nav link in FrontController
API v2 learning endpoints (T08):
- GET /api/v2/outcome-correlations, /pattern-performance, /knowledge-base/{id}
- OpenAPI schemas: OutcomeCorrelation, PatternPerformanceRecord, InstitutionalKnowledgeEntry
GAAF scorecard + docs (T09):
- Core 3.8→3.9, Functional 3.6→3.8, overall 3.61→3.68
- CLAUDE.md: IHF v0.2 complete, no active workplan
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 23:14:15 +00:00
|
|
|
tags JSONB NOT NULL DEFAULT '[]',
|
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
|
|
|
|
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX institutional_knowledge_hub_idx ON institutional_knowledge_entries (hub_id);
|
|
|
|
|
CREATE INDEX institutional_knowledge_fts_idx ON institutional_knowledge_entries USING GIN (summary_tsv);
|
|
|
|
|
|
|
|
|
|
-- learning_insights: platform-level insights with evidence links
|
|
|
|
|
-- GAAF: insight_type CHECK constraint
|
|
|
|
|
CREATE TABLE learning_insights (
|
|
|
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
2026-04-04 09:55:12 +00:00
|
|
|
hub_id UUID NOT NULL,
|
feat(WP-0013): IHF Phase 12 — Platform Memory and Continuous Learning
Closes the long-range feedback loop: outcome signals now enrich the full
traceability chain and feed back into routing, triage, and AI proposals.
Schema (T01):
- outcome_correlations (CHECK correlation_type)
- pattern_performance_records
- adaptive_threshold_configs
- institutional_knowledge_entries (GIN tsvector FTS)
- learning_insights (CHECK insight_type)
- ALTER TABLE decision_records + requirement_candidates: outcome_summary JSONB
- AFTER INSERT trigger trg_enrich_lineage on outcome_signals
- contracts/core/ updated (outcome-summary-columns-v1, append-only addendum)
Correlation engine (T02):
- Application/Helper/CorrelationEngine.hs: pure annotation→outcome SQL
- Web/Controller/OutcomeCorrelations.hs: ComputeCorrelationsAction + index
Pattern performance (T03):
- Web/Controller/PatternPerformance.hs: ComputePatternPerformanceAction
Adaptive thresholds (T04):
- Web/Controller/AdaptiveThresholds.hs: CalibrateThresholdsAction
- Application/Helper/FrictionScore.hs: applyAdaptiveWeights
Institutional knowledge (T05):
- DistilDecisionAction in DecisionRecords controller
- Web/Controller/InstitutionalKnowledge.hs: QueryKnowledgeBaseAction
Lineage enrichment (T06):
- Web/Controller/LineageEnrichment.hs: EnrichLineageAction (batch backfill)
- enrich_lineage_on_outcome_batch() PL/pgSQL helper in migration
Learning dashboard (T07):
- Web/Controller/LearningDashboard.hs: 5-panel autoRefresh view
- "Learning" nav link in FrontController
API v2 learning endpoints (T08):
- GET /api/v2/outcome-correlations, /pattern-performance, /knowledge-base/{id}
- OpenAPI schemas: OutcomeCorrelation, PatternPerformanceRecord, InstitutionalKnowledgeEntry
GAAF scorecard + docs (T09):
- Core 3.8→3.9, Functional 3.6→3.8, overall 3.61→3.68
- CLAUDE.md: IHF v0.2 complete, no active workplan
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 23:14:15 +00:00
|
|
|
insight_type TEXT NOT NULL,
|
|
|
|
|
title TEXT NOT NULL,
|
|
|
|
|
body TEXT NOT NULL,
|
|
|
|
|
evidence_links JSONB NOT NULL DEFAULT '[]',
|
|
|
|
|
is_actioned BOOLEAN NOT NULL DEFAULT FALSE,
|
2026-04-04 09:55:12 +00:00
|
|
|
computed_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL
|
feat(WP-0013): IHF Phase 12 — Platform Memory and Continuous Learning
Closes the long-range feedback loop: outcome signals now enrich the full
traceability chain and feed back into routing, triage, and AI proposals.
Schema (T01):
- outcome_correlations (CHECK correlation_type)
- pattern_performance_records
- adaptive_threshold_configs
- institutional_knowledge_entries (GIN tsvector FTS)
- learning_insights (CHECK insight_type)
- ALTER TABLE decision_records + requirement_candidates: outcome_summary JSONB
- AFTER INSERT trigger trg_enrich_lineage on outcome_signals
- contracts/core/ updated (outcome-summary-columns-v1, append-only addendum)
Correlation engine (T02):
- Application/Helper/CorrelationEngine.hs: pure annotation→outcome SQL
- Web/Controller/OutcomeCorrelations.hs: ComputeCorrelationsAction + index
Pattern performance (T03):
- Web/Controller/PatternPerformance.hs: ComputePatternPerformanceAction
Adaptive thresholds (T04):
- Web/Controller/AdaptiveThresholds.hs: CalibrateThresholdsAction
- Application/Helper/FrictionScore.hs: applyAdaptiveWeights
Institutional knowledge (T05):
- DistilDecisionAction in DecisionRecords controller
- Web/Controller/InstitutionalKnowledge.hs: QueryKnowledgeBaseAction
Lineage enrichment (T06):
- Web/Controller/LineageEnrichment.hs: EnrichLineageAction (batch backfill)
- enrich_lineage_on_outcome_batch() PL/pgSQL helper in migration
Learning dashboard (T07):
- Web/Controller/LearningDashboard.hs: 5-panel autoRefresh view
- "Learning" nav link in FrontController
API v2 learning endpoints (T08):
- GET /api/v2/outcome-correlations, /pattern-performance, /knowledge-base/{id}
- OpenAPI schemas: OutcomeCorrelation, PatternPerformanceRecord, InstitutionalKnowledgeEntry
GAAF scorecard + docs (T09):
- Core 3.8→3.9, Functional 3.6→3.8, overall 3.61→3.68
- CLAUDE.md: IHF v0.2 complete, no active workplan
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 23:14:15 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX learning_insights_hub_idx ON learning_insights (hub_id);
|
|
|
|
|
CREATE INDEX learning_insights_type_idx ON learning_insights (insight_type);
|
|
|
|
|
|
|
|
|
|
-- Extend core tables with outcome_summary (retroactive lineage enrichment)
|
|
|
|
|
-- GAAF rule 3: /contracts/core/ updated in T01/T06
|
2026-04-04 09:55:12 +00:00
|
|
|
-- MOVED TO CREATE TABLE: ALTER TABLE decision_records ADD COLUMN outcome_summary JSONB;
|
|
|
|
|
-- MOVED TO CREATE TABLE: ALTER TABLE requirement_candidates ADD COLUMN outcome_summary JSONB;
|
|
|
|
|
|
|
|
|
|
-- Foreign Key Constraints (for IHP type generation — IHP generates Id types from these)
|
|
|
|
|
ALTER TABLE widgets ADD FOREIGN KEY (hub_id) REFERENCES hubs(id);
|
|
|
|
|
ALTER TABLE widget_versions ADD FOREIGN KEY (widget_id) REFERENCES widgets(id);
|
|
|
|
|
ALTER TABLE interaction_events ADD FOREIGN KEY (widget_id) REFERENCES widgets(id);
|
|
|
|
|
ALTER TABLE outcome_signals ADD FOREIGN KEY (widget_id) REFERENCES widgets(id);
|
|
|
|
|
ALTER TABLE outcome_signals ADD FOREIGN KEY (deployment_id) REFERENCES deployment_records(id);
|
|
|
|
|
ALTER TABLE deployment_records ADD FOREIGN KEY (impl_ref_id) REFERENCES implementation_change_references(id);
|
|
|
|
|
ALTER TABLE deployment_records ADD FOREIGN KEY (decision_id) REFERENCES decision_records(id);
|
|
|
|
|
ALTER TABLE api_keys ADD FOREIGN KEY (api_consumer_id) REFERENCES api_consumers(id);
|
|
|
|
|
ALTER TABLE webhook_subscriptions ADD FOREIGN KEY (api_consumer_id) REFERENCES api_consumers(id);
|
|
|
|
|
ALTER TABLE pattern_adoptions ADD FOREIGN KEY (widget_pattern_id) REFERENCES widget_patterns(id);
|
|
|
|
|
ALTER TABLE annotation_threads ADD FOREIGN KEY (widget_id) REFERENCES widgets(id);
|
|
|
|
|
ALTER TABLE annotations ADD FOREIGN KEY (widget_id) REFERENCES widgets(id);
|
|
|
|
|
ALTER TABLE annotations ADD FOREIGN KEY (thread_id) REFERENCES annotation_threads(id);
|
|
|
|
|
ALTER TABLE requirement_candidates ADD FOREIGN KEY (source_widget_id) REFERENCES widgets(id);
|
|
|
|
|
ALTER TABLE requirement_candidates ADD FOREIGN KEY (source_thread_id) REFERENCES annotation_threads(id);
|
|
|
|
|
ALTER TABLE requirement_candidates ADD FOREIGN KEY (source_annotation_id) REFERENCES annotations(id);
|
|
|
|
|
ALTER TABLE requirement_candidates ADD FOREIGN KEY (requirement_id) REFERENCES requirements(id);
|
|
|
|
|
ALTER TABLE triage_states ADD FOREIGN KEY (candidate_id) REFERENCES requirement_candidates(id);
|
|
|
|
|
ALTER TABLE reviewer_assignments ADD FOREIGN KEY (candidate_id) REFERENCES requirement_candidates(id);
|
|
|
|
|
ALTER TABLE reviewer_assignments ADD FOREIGN KEY (user_id) REFERENCES users(id);
|
|
|
|
|
ALTER TABLE reviewer_assignments ADD FOREIGN KEY (assigned_by) REFERENCES users(id);
|
|
|
|
|
ALTER TABLE requirements ADD FOREIGN KEY (source_candidate_id) REFERENCES requirement_candidates(id);
|
|
|
|
|
ALTER TABLE decision_records ADD FOREIGN KEY (requirement_id) REFERENCES requirements(id);
|
|
|
|
|
ALTER TABLE decision_records ADD FOREIGN KEY (candidate_id) REFERENCES requirement_candidates(id);
|
|
|
|
|
ALTER TABLE implementation_change_references ADD FOREIGN KEY (decision_id) REFERENCES decision_records(id);
|
|
|
|
|
ALTER TABLE policy_references ADD FOREIGN KEY (decision_id) REFERENCES decision_records(id);
|
|
|
|
|
ALTER TABLE agent_review_records ADD FOREIGN KEY (proposal_id) REFERENCES agent_proposals(id);
|
|
|
|
|
ALTER TABLE confidence_annotations ADD FOREIGN KEY (proposal_id) REFERENCES agent_proposals(id);
|
|
|
|
|
ALTER TABLE institutional_knowledge_entries ADD FOREIGN KEY (hub_id) REFERENCES hubs(id);
|
|
|
|
|
ALTER TABLE institutional_knowledge_entries ADD FOREIGN KEY (decision_record_id) REFERENCES decision_records(id);
|