{"quest":{"id":"q-schema-governance","name":"Schema Governance","description":"Agent-driven schema evolution through governance (propose, debate, vote, migrate). Linked to artifact_transforms for tracking schema change provenance. All schema changes recorded as artifact lifecycle events.","layer":"Senate","priority":88,"status":"active","created_at":"2026-04-03 23:24:40","updated_at":"2026-04-04 00:06:01"},"tasks":[{"id":"sen-sg-02-PROP","title":"[Senate] Schema proposal system via Senate governance","description":"Agents propose schema changes with rationale and migration plan, 2/3 majority vote, auto-trigger migration","status":"open","priority":86,"task_type":"one_shot","frequency":"","assigned_slot":"","started_at":null,"completed_at":null,"updated_at":"2026-04-23T06:51:21.985344+00:00","summary":"","completion_notes":"","last_error":"cli-reopen-manual: reopened — task was marked 'done' but has no task_runs row in (done/completed/success)","time_estimate_hours":0.0,"completion_count":0,"spec_path":"docs/planning/specs/sen-sg-02-PROP_schema_proposal_system_spec.md","provider":"any","payload_json":"{\"requirements\": {\"coding\": 8, \"safety\": 9}}"},{"id":"sen-sg-03-VALD","title":"[Senate] Schema validation engine — validate artifact metadata against schemas","description":"JSON Schema validation at registration time, strict/warn/skip modes, batch audit, compliance dashboard","status":"open","priority":85,"task_type":"one_shot","frequency":"","assigned_slot":"","started_at":null,"completed_at":null,"updated_at":"2026-04-23T06:51:21.985344+00:00","summary":"","completion_notes":"","last_error":"cli-reopen-manual: reopened — task was marked 'done' but has no task_runs row in (done/completed/success)","time_estimate_hours":0.0,"completion_count":0,"spec_path":"docs/planning/specs/sen-sg-03-VALD_schema_validation_engine_spec.md","provider":"any","payload_json":"{\"requirements\": {\"coding\": 8, \"safety\": 9}}"},{"id":"sen-sg-04-MIGR","title":"[Senate] Auto-migration generation from approved schema changes","description":"Generate and apply DB migrations from approved schema proposals, dry-run, test on copy, rollback plan","status":"open","priority":83,"task_type":"one_shot","frequency":"","assigned_slot":"","started_at":null,"completed_at":null,"updated_at":"2026-04-23T06:51:21.985344+00:00","summary":"","completion_notes":"","last_error":"cli-reopen-manual: reopened — task was marked 'done' but has no task_runs row in (done/completed/success)","time_estimate_hours":0.0,"completion_count":0,"spec_path":"docs/planning/specs/sen-sg-04-MIGR_auto_migration_generation_spec.md","provider":"any","payload_json":"{\"requirements\": {\"coding\": 8, \"safety\": 9}}"},{"id":"sen-sg-05-SCOP","title":"[Senate] Domain scope enforcement — reject out-of-scope schema proposals","description":"LLM evaluator assesses proposals for neuroscience/scientific-discovery relevance, auto-reject with appeal","status":"open","priority":82,"task_type":"one_shot","frequency":"","assigned_slot":"","started_at":null,"completed_at":null,"updated_at":"2026-04-23T06:51:21.985344+00:00","summary":"","completion_notes":"","last_error":"cli-reopen-manual: reopened — task was marked 'done' but has no task_runs row in (done/completed/success)","time_estimate_hours":0.0,"completion_count":0,"spec_path":"docs/planning/specs/sen-sg-05-SCOP_domain_scope_enforcement_spec.md","provider":"any","payload_json":"{\"requirements\": {\"coding\": 8, \"safety\": 9}}"},{"id":"sen-sg-06-PROC","title":"[Atlas] Processing step lineage — track transforms in provenance chains","description":"processing_steps table capturing agent, method, parameters, timing, hashes for reproducibility","status":"open","priority":67,"task_type":"one_shot","frequency":"","assigned_slot":"","started_at":null,"completed_at":null,"updated_at":"2026-04-25T07:47:19.049682+00:00","summary":"","completion_notes":"","last_error":"cli-reopen-manual: reopened — task was marked 'done' but has no task_runs row in (done/completed/success)","time_estimate_hours":0.0,"completion_count":0,"spec_path":"docs/planning/specs/sen-sg-06-PROC_processing_step_lineage_spec.md","provider":"any","payload_json":"{}"},{"id":"sen-sg-01-SREG","title":"[Senate] Schema registry — track schemas per artifact type with versions","description":"schema_registry table with JSON Schema definitions, version history, get/list/history functions, API\n\n\n## REOPENED TASK — CRITICAL CONTEXT\n\nThis task was previously marked 'done' but the audit could not verify\nthe work actually landed on main. The original work may have been:\n- Lost to an orphan branch / failed push\n- Only a spec-file edit (no code changes)\n- Already addressed by other agents in the meantime\n- Made obsolete by subsequent work\n\n**Before doing anything else:**\n\n1. **Re-evaluate the task in light of CURRENT main state.** Read the\n   spec and the relevant files on origin/main NOW. The original task\n   may have been written against a state of the code that no longer\n   exists.\n\n2. **Verify the task still advances SciDEX's aims.** If the system\n   has evolved past the need for this work (different architecture,\n   different priorities), close the task with reason \"obsolete: <why>\"\n   instead of doing it.\n\n3. **Check if it's already done.** Run `git log --grep='<task-id>'`\n   and read the related commits. If real work landed, complete the\n   task with `--no-sha-check --summary 'Already done in <commit>'`.\n\n4. **Make sure your changes don't regress recent functionality.** Many\n   agents have been working on this codebase. Before committing, run\n   `git log --since='24 hours ago' -- <files-you-touch>` to see what\n   changed in your area, and verify you don't undo any of it.\n\n5. **Stay scoped.** Only do what this specific task asks for. Do not\n   refactor, do not \"fix\" unrelated issues, do not add features that\n   weren't requested. Scope creep at this point is regression risk.\n\nIf you cannot do this task safely (because it would regress, conflict\nwith current direction, or the requirements no longer apply), escalate\nvia `orchestra escalate` with a clear explanation instead of committing.\n","status":"done","priority":90,"task_type":"one_shot","frequency":"","assigned_slot":"","started_at":null,"completed_at":"2026-04-18T15:40:26.373178+00:00","updated_at":"2026-04-18T15:40:26.373178+00:00","summary":"","completion_notes":"Auto-completed by supervisor after successful deploy to main","last_error":"","time_estimate_hours":0.0,"completion_count":0,"spec_path":"docs/planning/specs/sen-sg-01-SREG_schema_registry_spec.md","provider":"any","payload_json":"{\"requirements\": {\"coding\": 8, \"safety\": 9}, \"_reset_note\": \"This task was reset after a database incident on 2026-04-17.\\n\\n**Context:** SciDEX migrated from SQLite to PostgreSQL after recurring DB\\ncorruption. Some work done during Apr 16-17 may have been lost.\\n\\n**Before starting work:**\\n1. Check if the task's goal is ALREADY satisfied (run the relevant checks)\\n2. Check `git log --all --grep=task:YOUR_TASK_ID` for prior commits\\n3. If complete, verify and mark done. If partial, continue. If not done, proceed.\\n\\n**DB change:** SciDEX now uses PostgreSQL. `get_db()` auto-detects via\\nSCIDEX_DB_BACKEND=postgres env var.\", \"_reset_at\": \"2026-04-18T06:29:22.046013+00:00\", \"_reset_from_status\": \"done\"}"},{"id":"47b17cbf-a8ac-419e-9368-7a2669da25a8","title":"[Senate] sen-sg-01-SREG: Schema registry — track artifact schemas with versions","description":"Implement schema registry to track schemas per artifact type with versioning. This is the foundational step for schema governance — enables schema proposals, validation, and migrations. Spec: quest_schema_governance_spec.md\n\n\n## REOPENED TASK — CRITICAL CONTEXT\n\nThis task was previously marked 'done' but the audit could not verify\nthe work actually landed on main. The original work may have been:\n- Lost to an orphan branch / failed push\n- Only a spec-file edit (no code changes)\n- Already addressed by other agents in the meantime\n- Made obsolete by subsequent work\n\n**Before doing anything else:**\n\n1. **Re-evaluate the task in light of CURRENT main state.** Read the\n   spec and the relevant files on origin/main NOW. The original task\n   may have been written against a state of the code that no longer\n   exists.\n\n2. **Verify the task still advances SciDEX's aims.** If the system\n   has evolved past the need for this work (different architecture,\n   different priorities), close the task with reason \"obsolete: <why>\"\n   instead of doing it.\n\n3. **Check if it's already done.** Run `git log --grep='<task-id>'`\n   and read the related commits. If real work landed, complete the\n   task with `--no-sha-check --summary 'Already done in <commit>'`.\n\n4. **Make sure your changes don't regress recent functionality.** Many\n   agents have been working on this codebase. Before committing, run\n   `git log --since='24 hours ago' -- <files-you-touch>` to see what\n   changed in your area, and verify you don't undo any of it.\n\n5. **Stay scoped.** Only do what this specific task asks for. Do not\n   refactor, do not \"fix\" unrelated issues, do not add features that\n   weren't requested. Scope creep at this point is regression risk.\n\nIf you cannot do this task safely (because it would regress, conflict\nwith current direction, or the requirements no longer apply), escalate\nvia `orchestra escalate` with a clear explanation instead of committing.\n","status":"done","priority":88,"task_type":"one_shot","frequency":"","assigned_slot":"","started_at":null,"completed_at":"2026-04-19T01:32:35.767618+00:00","updated_at":"2026-04-19T01:32:35.767618+00:00","summary":"","completion_notes":"","last_error":"","time_estimate_hours":0.0,"completion_count":0,"spec_path":"docs/planning/specs/quest_schema_governance_spec.md","provider":"any","payload_json":"{\"_reset_note\": \"This task was reset after a database incident on 2026-04-17.\\n\\n**Context:** SciDEX migrated from SQLite to PostgreSQL after recurring DB\\ncorruption. Some work done during Apr 16-17 may have been lost.\\n\\n**Before starting work:**\\n1. Check if the task's goal is ALREADY satisfied (run the relevant checks)\\n2. Check `git log --all --grep=task:YOUR_TASK_ID` for prior commits\\n3. If complete, verify and mark done. If partial, continue. If not done, proceed.\\n\\n**DB change:** SciDEX now uses PostgreSQL. `get_db()` auto-detects via\\nSCIDEX_DB_BACKEND=postgres env var.\", \"_reset_at\": \"2026-04-18T06:29:22.046013+00:00\", \"_reset_from_status\": \"done\"}"}],"reviews":[],"effectiveness":{},"spec_content":"---\ntitle: \"Quest: Schema Governance\"\ndescription: \"Agent-driven evolution of artifact schemas through Senate governance — propose, debate, vote, and migrate schema changes with integrity guarantees\"\ntype: quest\nlayer: Senate\npriority: 88\nstatus: active\nquest_id: q-schema-governance\nspec_path: docs/planning/specs/quest_schema_governance_spec.md\n---\n\n# Quest: Schema Governance\n\n**Layer:** Senate\n**Priority:** P88\n**Status:** active\n\n## Vision\n\nSciDEX's artifact schemas need to evolve as the system learns what structure is useful for\nscientific discovery. But schema changes are dangerous — they can break queries, corrupt\ndata, and invalidate downstream analyses. We need a governance mechanism where agents\n**propose schema changes through the Senate**, other agents debate the proposals, and\napproved changes are applied through validated migrations.\n\n### The Schema Evolution Loop\n\n```\n1. Agent identifies schema gap (e.g., \"experiments need a 'blinding' field\")\n     ↓\n2. Agent creates Senate proposal with: field name, type, rationale, migration plan\n     ↓\n3. Other agents debate the proposal (is the field needed? what type? default value?)\n     ↓\n4. Vote: agents with schema-governance authority vote approve/reject\n     ↓\n5. If approved: auto-generate migration, validate on test DB, apply\n     ↓\n6. Schema registry updated, validation rules updated\n```\n\n### Domain Scope Enforcement\n\nSchema governance also enforces **domain focus** — preventing schema sprawl beyond\nneuroscience and scientific discovery. Proposals for fields unrelated to the core mission\n(e.g., \"add social_media_mentions field\") should be rejected by governance.\n\nScope criteria for schema proposals:\n- **In scope**: Experimental methodology, statistical results, biological entities,\n  disease mechanisms, therapeutic targets, data provenance, evidence quality\n- **Out of scope**: Social media, marketing, unrelated domains, purely aesthetic metadata\n- **Edge cases**: Debated through the governance process itself\n\n### Schema Versioning\n\nEvery schema change is versioned. Artifacts created under schema v1 remain valid;\nnew artifacts use the latest schema. Queries can specify schema version for reproducibility.\n\n## Open Tasks\n\n- [x] sen-sg-01-SREG: Schema registry — track schemas per artifact type with versions (P88)\n- [ ] sen-sg-02-PROP: Schema proposal system via Senate (P86)\n- [ ] sen-sg-03-VALD: Schema validation engine — validate artifact metadata against schemas (P85)\n- [ ] sen-sg-04-MIGR: Auto-migration generation from approved schema changes (P83)\n- [ ] sen-sg-05-SCOP: Domain scope enforcement — reject out-of-scope proposals (P82)\n- [ ] sen-sg-06-PROC: Processing step lineage — track transforms in provenance chains (P87)\n\n## Dependency Chain\n\n```\nsen-sg-01-SREG (Schema registry)\n    ↓\nsen-sg-02-PROP (Proposal system) ──→ sen-sg-05-SCOP (Scope enforcement)\n    ↓\nsen-sg-03-VALD (Validation engine)\n    ↓\nsen-sg-04-MIGR (Auto-migration)\n\nsen-sg-06-PROC (Processing steps) — parallel, integrates with provenance\n```\n\n## Integration Points\n\n- **Experiment Extraction** (q-experiment-extraction): Experiment schemas are governed here\n- **Artifact Debates** (q-artifact-debates): Schema proposals can be debated\n- **Senate Proposals** (`senate_proposals.py`): Schema proposals use existing proposal infrastructure\n- **Migration Runner** (`migration_runner.py`): Approved changes generate migrations\n- **Artifact Registry** (`artifact_registry.py`): Validation enforced at registration time\n\n## Success Criteria\n\n- [x] Schema registry tracks all artifact type schemas with version history\n- [ ] At least 3 schema proposals processed through governance (proposed → debated → decided)\n- [ ] Validation catches >95% of schema violations at registration time\n- [ ] No schema change applied without governance approval\n- [ ] Processing step lineage captures the full transform chain for >50% of derived artifacts\n\n## Quality Requirements\n\n> Scope criteria are enforced prospectively via the proposal system. Proposals for fields unrelated to experimental methodology, evidence quality, or scientific discovery are auto-rejected with a template explanation. Target: >95% of in-scope proposals pass validation; >95% of rejected proposals match scope exclusion rules.\n\n## Work Log\n\n### 2026-04-06 — sen-sg-01-SREG complete [task:47b17cbf-a8ac-419e-9368-7a2669da25a8]\n\n**What was done:**\n- Confirmed `schema_registry` table already existed in DB (from earlier bootstrapping).\n  Created migration `059_schema_registry.py` to ensure it is created correctly on fresh\n  installs with proper indexes on `(artifact_type, is_current)` and `(artifact_type, version)`.\n- Extended `schema_registry.py`:\n  - Fixed `register_schema()` to include `id` (UUID) and `created_at` in INSERT\n    (previously omitted, causing NOT NULL failures for new artifact types).\n  - Added `import uuid` dependency.\n  - Expanded `DEFAULT_SCHEMAS` from 5 types to 15 canonical artifact types:\n    hypothesis, paper, notebook, analysis, dashboard, authored_paper, figure, code,\n    model, protein_design, dataset, tabular_dataset, debate, kg_edge, wiki.\n  - All schemas use JSON Schema draft 2020-12 format with typed properties and\n    `required` constraints where semantically appropriate.\n- Seeded 9 new schemas into the live DB (6 already existed from earlier runs).\n  Registry now covers 18 artifact types with version history.\n- Added to `api.py`:\n  - `GET /senate/schemas` — Senate UI page listing all registered schemas with\n    field counts, required counts, compliance percentage, and version history links.\n  - `GET /senate/schemas/{artifact_type}` — Detail page with field table,\n    raw JSON Schema, and full version history.\n  - `GET /api/senate/schemas` — JSON API listing all current schemas.\n  - `GET /api/senate/schemas/{artifact_type}` — JSON API for one type.\n  - `GET|POST /api/senate/schemas/seed` — Idempotent seeding endpoint.\n  - Added \"Schema Registry\" link to Senate nav dropdown and quick-links section.\n\n### 2026-04-16 — sen-sg-01-SREG verification [task:47b17cbf-a8ac-419e-9368-7a2669da25a8]\n\nAudit reopened task due to ORPHAN_BRANCH (fe491c122 never landed on main). Verified\nactual implementation on origin/main (commit 1092b29ac):\n\n**What landed on main:**\n- `GET /api/schemas` — list all 18 artifact type schemas\n- `GET /api/schemas/{artifact_type}` — current schema with version history\n- `migrations/062_schema_registry.py` — idempotent CREATE TABLE\n- `scripts/schema_registry.py` — 700 lines with register/get/list/history/validate\n- DB: 22 rows in schema_registry (experiment v3, protein_design v3, others v1)\n\n**What did NOT land (fe491c122 orphan):**\n- Senate HTML UI (`/senate/schemas`, `/senate/schemas/{type}`)\n- `/api/senate/schemas` endpoints with `/api/senate/schemas/seed`\n\n**Acceptance criteria status: SATISFIED** — schema_registry tracks all artifact type\nschemas with version history. The simpler API-only implementation fulfills the core\nrequirement; the HTML UI is nice-to-have but non-blocking for dependent tasks.\n\n","spec_html":"<div style=\"font-size:0.85rem\"><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"><h2 style=\"color:#4fc3f7;margin:1.5rem 0 0.6rem;font-size:1.2rem;font-weight:700\">Quest: Schema Governance</h2></p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"><strong style=\"color:#e0e0e0\">Layer:</strong> Senate\n<strong style=\"color:#e0e0e0\">Priority:</strong> P88\n<strong style=\"color:#e0e0e0\">Status:</strong> active</p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"><h3 style=\"color:#4fc3f7;margin:1.4rem 0 0.5rem;font-size:1.1rem;font-weight:700;border-bottom:2px solid rgba(79,195,247,0.3);padding-bottom:0.2rem\">Vision</h3></p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\">SciDEX&#x27;s artifact schemas need to evolve as the system learns what structure is useful for<br>scientific discovery. But schema changes are dangerous — they can break queries, corrupt<br>data, and invalidate downstream analyses. We need a governance mechanism where agents\n<strong style=\"color:#e0e0e0\">propose schema changes through the Senate</strong>, other agents debate the proposals, and<br>approved changes are applied through validated migrations.</p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"><h4 style=\"color:#e0e0e0;margin:1.2rem 0 0.4rem;font-size:1rem;font-weight:600;border-bottom:1px solid rgba(255,255,255,0.08);padding-bottom:0.2rem\">The Schema Evolution Loop</h4></p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"><pre style=\"background:#0a0a14;padding:0.8rem;border-radius:6px;border:1px solid rgba(79,195,247,0.15);color:#e0e0e0;font-size:0.8rem;overflow-x:auto;margin:0.5rem 0;line-height:1.5\"><code>1. Agent identifies schema gap (e.g., &quot;experiments need a &#x27;blinding&#x27; field&quot;)\n     ↓\n2. Agent creates Senate proposal with: field name, type, rationale, migration plan\n     ↓\n3. Other agents debate the proposal (is the field needed? what type? default value?)\n     ↓\n4. Vote: agents with schema-governance authority vote approve/reject\n     ↓\n5. If approved: auto-generate migration, validate on test DB, apply\n     ↓\n6. Schema registry updated, validation rules updated</code></pre></p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"><h4 style=\"color:#e0e0e0;margin:1.2rem 0 0.4rem;font-size:1rem;font-weight:600;border-bottom:1px solid rgba(255,255,255,0.08);padding-bottom:0.2rem\">Domain Scope Enforcement</h4></p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\">Schema governance also enforces <strong style=\"color:#e0e0e0\">domain focus</strong> — preventing schema sprawl beyond<br>neuroscience and scientific discovery. Proposals for fields unrelated to the core mission<br>(e.g., &quot;add social_media_mentions field&quot;) should be rejected by governance.</p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\">Scope criteria for schema proposals:\n<ul style=\"padding-left:1.5rem;margin:0.4rem 0\"><li style=\"margin:0.15rem 0;color:#bbb\"><strong style=\"color:#e0e0e0\">In scope</strong>: Experimental methodology, statistical results, biological entities,</li>\n</ul>  disease mechanisms, therapeutic targets, data provenance, evidence quality\n<ul style=\"padding-left:1.5rem;margin:0.4rem 0\"><li style=\"margin:0.15rem 0;color:#bbb\"><strong style=\"color:#e0e0e0\">Out of scope</strong>: Social media, marketing, unrelated domains, purely aesthetic metadata</li>\n<li style=\"margin:0.15rem 0;color:#bbb\"><strong style=\"color:#e0e0e0\">Edge cases</strong>: Debated through the governance process itself</li>\n</ul>\n<h4 style=\"color:#e0e0e0;margin:1.2rem 0 0.4rem;font-size:1rem;font-weight:600;border-bottom:1px solid rgba(255,255,255,0.08);padding-bottom:0.2rem\">Schema Versioning</h4></p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\">Every schema change is versioned. Artifacts created under schema v1 remain valid;<br>new artifacts use the latest schema. Queries can specify schema version for reproducibility.</p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"><h3 style=\"color:#4fc3f7;margin:1.4rem 0 0.5rem;font-size:1.1rem;font-weight:700;border-bottom:2px solid rgba(79,195,247,0.3);padding-bottom:0.2rem\">Open Tasks</h3></p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"><div style=\"margin:0.2rem 0;color:#81c784\">&#9745; sen-sg-01-SREG: Schema registry — track schemas per artifact type with versions (P88)</div>\n<div style=\"margin:0.2rem 0;color:#bbb\">&#9744; sen-sg-02-PROP: Schema proposal system via Senate (P86)</div>\n<div style=\"margin:0.2rem 0;color:#bbb\">&#9744; sen-sg-03-VALD: Schema validation engine — validate artifact metadata against schemas (P85)</div>\n<div style=\"margin:0.2rem 0;color:#bbb\">&#9744; sen-sg-04-MIGR: Auto-migration generation from approved schema changes (P83)</div>\n<div style=\"margin:0.2rem 0;color:#bbb\">&#9744; sen-sg-05-SCOP: Domain scope enforcement — reject out-of-scope proposals (P82)</div>\n<div style=\"margin:0.2rem 0;color:#bbb\">&#9744; sen-sg-06-PROC: Processing step lineage — track transforms in provenance chains (P87)</div></p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"><h3 style=\"color:#4fc3f7;margin:1.4rem 0 0.5rem;font-size:1.1rem;font-weight:700;border-bottom:2px solid rgba(79,195,247,0.3);padding-bottom:0.2rem\">Dependency Chain</h3></p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"><pre style=\"background:#0a0a14;padding:0.8rem;border-radius:6px;border:1px solid rgba(79,195,247,0.15);color:#e0e0e0;font-size:0.8rem;overflow-x:auto;margin:0.5rem 0;line-height:1.5\"><code>sen-sg-01-SREG (Schema registry)\n    ↓\nsen-sg-02-PROP (Proposal system) ──→ sen-sg-05-SCOP (Scope enforcement)\n    ↓\nsen-sg-03-VALD (Validation engine)\n    ↓\nsen-sg-04-MIGR (Auto-migration)\n\nsen-sg-06-PROC (Processing steps) — parallel, integrates with provenance</code></pre></p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"><h3 style=\"color:#4fc3f7;margin:1.4rem 0 0.5rem;font-size:1.1rem;font-weight:700;border-bottom:2px solid rgba(79,195,247,0.3);padding-bottom:0.2rem\">Integration Points</h3></p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"><ul style=\"padding-left:1.5rem;margin:0.4rem 0\"><li style=\"margin:0.15rem 0;color:#bbb\"><strong style=\"color:#e0e0e0\">Experiment Extraction</strong> (q-experiment-extraction): Experiment schemas are governed here</li>\n<li style=\"margin:0.15rem 0;color:#bbb\"><strong style=\"color:#e0e0e0\">Artifact Debates</strong> (q-artifact-debates): Schema proposals can be debated</li>\n<li style=\"margin:0.15rem 0;color:#bbb\"><strong style=\"color:#e0e0e0\">Senate Proposals</strong> (<code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">senate_proposals.py</code>): Schema proposals use existing proposal infrastructure</li>\n<li style=\"margin:0.15rem 0;color:#bbb\"><strong style=\"color:#e0e0e0\">Migration Runner</strong> (<code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">migration_runner.py</code>): Approved changes generate migrations</li>\n<li style=\"margin:0.15rem 0;color:#bbb\"><strong style=\"color:#e0e0e0\">Artifact Registry</strong> (<code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">artifact_registry.py</code>): Validation enforced at registration time</li>\n</ul>\n<h3 style=\"color:#4fc3f7;margin:1.4rem 0 0.5rem;font-size:1.1rem;font-weight:700;border-bottom:2px solid rgba(79,195,247,0.3);padding-bottom:0.2rem\">Success Criteria</h3></p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"><div style=\"margin:0.2rem 0;color:#81c784\">&#9745; Schema registry tracks all artifact type schemas with version history</div>\n<div style=\"margin:0.2rem 0;color:#bbb\">&#9744; At least 3 schema proposals processed through governance (proposed → debated → decided)</div>\n<div style=\"margin:0.2rem 0;color:#bbb\">&#9744; Validation catches &gt;95% of schema violations at registration time</div>\n<div style=\"margin:0.2rem 0;color:#bbb\">&#9744; No schema change applied without governance approval</div>\n<div style=\"margin:0.2rem 0;color:#bbb\">&#9744; Processing step lineage captures the full transform chain for &gt;50% of derived artifacts</div></p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"><h3 style=\"color:#4fc3f7;margin:1.4rem 0 0.5rem;font-size:1.1rem;font-weight:700;border-bottom:2px solid rgba(79,195,247,0.3);padding-bottom:0.2rem\">Quality Requirements</h3></p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\">&gt; Scope criteria are enforced prospectively via the proposal system. Proposals for fields unrelated to experimental methodology, evidence quality, or scientific discovery are auto-rejected with a template explanation. Target: &gt;95% of in-scope proposals pass validation; &gt;95% of rejected proposals match scope exclusion rules.</p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"><h3 style=\"color:#4fc3f7;margin:1.4rem 0 0.5rem;font-size:1.1rem;font-weight:700;border-bottom:2px solid rgba(79,195,247,0.3);padding-bottom:0.2rem\">Work Log</h3></p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"><h4 style=\"color:#e0e0e0;margin:1.2rem 0 0.4rem;font-size:1rem;font-weight:600;border-bottom:1px solid rgba(255,255,255,0.08);padding-bottom:0.2rem\">2026-04-06 — sen-sg-01-SREG complete [task:47b17cbf-a8ac-419e-9368-7a2669da25a8]</h4></p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"><strong style=\"color:#e0e0e0\">What was done:</strong>\n<ul style=\"padding-left:1.5rem;margin:0.4rem 0\"><li style=\"margin:0.15rem 0;color:#bbb\">Confirmed <code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">schema_registry</code> table already existed in DB (from earlier bootstrapping).</li>\n</ul>  Created migration <code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">059_schema_registry.py</code> to ensure it is created correctly on fresh<br>  installs with proper indexes on <code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">(artifact_type, is_current)</code> and <code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">(artifact_type, version)</code>.\n<ul style=\"padding-left:1.5rem;margin:0.4rem 0\"><li style=\"margin:0.15rem 0;color:#bbb\">Extended <code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">schema_registry.py</code>:</li>\n</ul>  - Fixed <code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">register_schema()</code> to include <code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">id</code> (UUID) and <code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">created_at</code> in INSERT<br>    (previously omitted, causing NOT NULL failures for new artifact types).<br>  - Added <code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">import uuid</code> dependency.<br>  - Expanded <code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">DEFAULT_SCHEMAS</code> from 5 types to 15 canonical artifact types:<br>    hypothesis, paper, notebook, analysis, dashboard, authored_paper, figure, code,<br>    model, protein_design, dataset, tabular_dataset, debate, kg_edge, wiki.<br>  - All schemas use JSON Schema draft 2020-12 format with typed properties and<br>    <code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">required</code> constraints where semantically appropriate.\n<ul style=\"padding-left:1.5rem;margin:0.4rem 0\"><li style=\"margin:0.15rem 0;color:#bbb\">Seeded 9 new schemas into the live DB (6 already existed from earlier runs).</li>\n</ul>  Registry now covers 18 artifact types with version history.\n<ul style=\"padding-left:1.5rem;margin:0.4rem 0\"><li style=\"margin:0.15rem 0;color:#bbb\">Added to <code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">api.py</code>:</li>\n</ul>  - <code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">GET /senate/schemas</code> — Senate UI page listing all registered schemas with<br>    field counts, required counts, compliance percentage, and version history links.<br>  - <code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">GET /senate/schemas/{artifact_type}</code> — Detail page with field table,<br>    raw JSON Schema, and full version history.<br>  - <code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">GET /api/senate/schemas</code> — JSON API listing all current schemas.<br>  - <code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">GET /api/senate/schemas/{artifact_type}</code> — JSON API for one type.<br>  - <code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">GET|POST /api/senate/schemas/seed</code> — Idempotent seeding endpoint.<br>  - Added &quot;Schema Registry&quot; link to Senate nav dropdown and quick-links section.</p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"><h4 style=\"color:#e0e0e0;margin:1.2rem 0 0.4rem;font-size:1rem;font-weight:600;border-bottom:1px solid rgba(255,255,255,0.08);padding-bottom:0.2rem\">2026-04-16 — sen-sg-01-SREG verification [task:47b17cbf-a8ac-419e-9368-7a2669da25a8]</h4></p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\">Audit reopened task due to ORPHAN_BRANCH (fe491c122 never landed on main). Verified<br>actual implementation on origin/main (commit 1092b29ac):</p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"><strong style=\"color:#e0e0e0\">What landed on main:</strong>\n<ul style=\"padding-left:1.5rem;margin:0.4rem 0\"><li style=\"margin:0.15rem 0;color:#bbb\"><code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">GET /api/schemas</code> — list all 18 artifact type schemas</li>\n<li style=\"margin:0.15rem 0;color:#bbb\"><code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">GET /api/schemas/{artifact_type}</code> — current schema with version history</li>\n<li style=\"margin:0.15rem 0;color:#bbb\"><code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">migrations/062_schema_registry.py</code> — idempotent CREATE TABLE</li>\n<li style=\"margin:0.15rem 0;color:#bbb\"><code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">scripts/schema_registry.py</code> — 700 lines with register/get/list/history/validate</li>\n<li style=\"margin:0.15rem 0;color:#bbb\">DB: 22 rows in schema_registry (experiment v3, protein_design v3, others v1)</li>\n</ul>\n<strong style=\"color:#e0e0e0\">What did NOT land (fe491c122 orphan):</strong>\n<ul style=\"padding-left:1.5rem;margin:0.4rem 0\"><li style=\"margin:0.15rem 0;color:#bbb\">Senate HTML UI (<code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">/senate/schemas</code>, <code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">/senate/schemas/{type}</code>)</li>\n<li style=\"margin:0.15rem 0;color:#bbb\"><code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">/api/senate/schemas</code> endpoints with <code style=\"background:#1a1a2e;color:#ce93d8;padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em\">/api/senate/schemas/seed</code></li>\n</ul>\n<strong style=\"color:#e0e0e0\">Acceptance criteria status: SATISFIED</strong> — schema_registry tracks all artifact type<br>schemas with version history. The simpler API-only implementation fulfills the core<br>requirement; the HTML UI is nice-to-have but non-blocking for dependent tasks.</p><p style=\"color:#bbb;line-height:1.6;margin:0.4rem 0\"></p></div>","spec_file":"quest_schema_governance_spec.md","commits":[{"hash":"59405c7c5","message":"docs: AGENTS.md — document Path A/B/C task completion semantics [task:docs-agents-completion] (#40)","date":"2026-04-25"},{"hash":"e5b5848a0","message":"WIP on orchestra/task/8fcc8dc8-debate-artifact-version-pinning-referenc: 8a24c2fa2 [Senate] Delete broken restore_database.sh (#38)","date":"2026-04-25"},{"hash":"50e5ffcfe","message":"index on orchestra/task/8fcc8dc8-debate-artifact-version-pinning-referenc: 8a24c2fa2 [Senate] Delete broken restore_database.sh (#38)","date":"2026-04-25"},{"hash":"0d37f5fce","message":"untracked files on orchestra/task/8fcc8dc8-debate-artifact-version-pinning-referenc: 8a24c2fa2 [Senate] Delete broken restore_database.sh (#38)","date":"2026-04-25"},{"hash":"48f8d2fe3","message":"feat: surface all five SciDEX layers in nav [task:cba19c94-1724-4d5a-b89d-96c73c25f12a] (#39)","date":"2026-04-25"},{"hash":"1f0e35929","message":"Squash merge: orchestra/task/b1a8e549-cross-cutting-wire-existing-k-dense-skil (2 commits)","date":"2026-04-25"},{"hash":"ddb7db381","message":"[Agora] Wire existing K-Dense-backed tools into debate orchestration [task:b1a8e549-6f31-43c5-80f5-7c4717c267e4]","date":"2026-04-25"},{"hash":"76b71427a","message":"[Agora] Wire existing K-Dense-backed tools into debate orchestration [task:b1a8e549-6f31-43c5-80f5-7c4717c267e4]","date":"2026-04-25"},{"hash":"779e85c3a","message":"[Senate] Verify /resources dashboard complete; check off acceptance criteria [task:82074adc-507f-4e6b-9092-e2ceee79e7d4]","date":"2026-04-25"},{"hash":"4c66a8e09","message":"[Senate] Establish emergency access recovery procedures [task:e643cdd3-afd6-410f-a366-a6297d112127]","date":"2026-04-25"},{"hash":"7265a06b4","message":"Squash merge: orchestra/task/b1a8e549-cross-cutting-wire-existing-k-dense-skil (1 commits)","date":"2026-04-25"},{"hash":"58406ec64","message":"[Atlas] Dashboard artifact type: living web views with data source rendering [task:a17-28-DASH0001]","date":"2026-04-25"},{"hash":"8a24c2fa2","message":"[Senate] Delete broken restore_database.sh (#38)","date":"2026-04-25"},{"hash":"b98a1fa18","message":"[Senate] Delete broken restore_database.sh","date":"2026-04-25"},{"hash":"e846f82ef","message":"[Senate] Refresh BACKUP_RESTORE.md + docs/runbooks/emergency_restore.md (#37)","date":"2026-04-25"},{"hash":"43972a45e","message":"[Senate] Refresh BACKUP_RESTORE.md + docs/runbooks/emergency_restore.md","date":"2026-04-25"},{"hash":"2c7dbfe7f","message":"[Senate] Delete 9 obsolete backup scripts/units (continuation of Phase A-D cleanup) (#36)","date":"2026-04-25"},{"hash":"9743eb298","message":"[Senate] Delete 9 obsolete backup scripts/units (continuation of Phase A-D cleanup)","date":"2026-04-25"},{"hash":"3e72d8383","message":"[Agora] Wire 3 missing tools into debate skill_functions, fix citation persistence bug [task:b1a8e549-6f31-43c5-80f5-7c4717c267e4]","date":"2026-04-25"},{"hash":"4310e9854","message":"[Demo] Work log: figures verified complete — 140/140 analyses covered [task:df201d8f-4b89-4258-9148-eb1028fc1fbd]","date":"2026-04-24"}]}