{"openapi":"3.1.0","info":{"title":"Control Plane V1 API","version":"1.9.0","description":"Versioned API for the Control Plane runtime."},"servers":[{"url":"https://api.cp.martindev.io","description":"Production"},{"url":"http://localhost:3000","description":"Local dev"}],"paths":{"/v1/openapi.json":{"get":{"summary":"OpenAPI spec","operationId":"getOpenApiSpec","tags":["meta"],"responses":{"200":{"description":"The committed V1 OpenAPI document as JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}}}}},"/v1/api/health":{"get":{"summary":"Health check","operationId":"getHealth","tags":["health"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}},"503":{"description":"Service degraded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/v1/api/projects":{"get":{"summary":"List projects","operationId":"listProjects","tags":["projects"],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListProjectsResponse"}}}},"401":{"description":"Unauthorized"}}},"post":{"summary":"Create project","operationId":"createProject","tags":["projects"],"security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProjectRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProjectResponse"}}}},"400":{"description":"Invalid request body"},"401":{"description":"Unauthorized"},"409":{"description":"Slug already exists for this tenant"}}}},"/v1/api/projects/{slug}":{"get":{"summary":"Get project","operationId":"getProject","tags":["projects"],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetProjectResponse"}}}},"401":{"description":"Unauthorized"},"404":{"description":"Not found"}}},"delete":{"summary":"Delete project","operationId":"deleteProject","tags":["projects"],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteProjectResponse"}}}},"401":{"description":"Unauthorized"},"404":{"description":"Not found"}}}},"/v1/api/projects/{slug}/governance":{"get":{"summary":"Get project effective governance set","operationId":"getProjectGovernance","description":"Returns the composed effective governance set for a project: principles with per-layer composedFrom attribution (including disabled entries for the admin audit view), raw routing-table rows, and raw gate-config rows across all three governance layers (template-type → template → project). Read-only. Phase 5 — P5-GOV-API.","tags":["governance"],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"OK — composed effective governance set","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetProjectGovernanceResponse"}}}},"401":{"description":"Unauthorized"},"404":{"description":"Project not found (or not owned by this tenant)"}}}},"/v1/api/projects/{slug}/governance/routing":{"put":{"summary":"Upsert a governance routing row","operationId":"upsertProjectGovernanceRouting","description":"Upserts a single per-task routing row at a given (layer, layerRef) scope. Keyed on (tenant_id, layer, layer_ref, task_type) — idempotent. Validates action ∈ {select, override, add, disable} and effort ∈ {low, medium, high}. RLS-scoped via withTenant. Phase 6 — C10-GOV-ROUTING-API.","tags":["governance"],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertRoutingRowRequest"}}}},"responses":{"201":{"description":"Routing row upserted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertRoutingRowResponse"}}}},"400":{"description":"Invalid request body (bad action, effort, or missing executor)"},"401":{"description":"Unauthorized"},"404":{"description":"Project not found (or not owned by this tenant)"}}}},"/v1/api/projects/{slug}/governance/evolve":{"post":{"summary":"Evolve a governance row (add / refine / retire)","operationId":"evolveProjectGovernance","description":"Apply a single row-addressed governance mutation immediately — the operator loop to add / refine / retire a governance row, recorded as data with provenance. General over governance rows (targetKind ∈ principle | routing | gate) so Phase 14 self-learning reuses this same write path. RLS-scoped. Phase 5 — P5-EVOLVE.","tags":["governance"],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EvolveGovernanceRequest"}}}},"responses":{"201":{"description":"Mutation applied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EvolveGovernanceResponse"}}}},"400":{"description":"Invalid mutation body"},"401":{"description":"Unauthorized"},"404":{"description":"Project not found (or not owned by this tenant)"}}}},"/v1/api/projects/{slug}/governance/proposals":{"post":{"summary":"Create an unapplied governance proposal","operationId":"createProjectGovernanceProposal","description":"Stage an UNAPPLIED, layer-addressed, provenance-carrying governance mutation (status pending). Nothing is written to the governance tables until it is applied. Phase 14 self-learning is the bulk producer; this is the manual create. RLS-scoped. Phase 5 — P5-EVOLVE.","tags":["governance"],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateGovernanceProposalRequest"}}}},"responses":{"201":{"description":"Proposal created (pending)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateGovernanceProposalResponse"}}}},"400":{"description":"Invalid proposal body"},"401":{"description":"Unauthorized"},"404":{"description":"Project not found (or not owned by this tenant)"}}}},"/v1/api/projects/{slug}/governance/proposals/{id}/apply":{"post":{"summary":"Apply a governance proposal (one-tap)","operationId":"applyProjectGovernanceProposal","description":"One-tap apply of a staged governance proposal: execute the proposed mutation through the single write path and stamp applied_at / applied_by. Create and apply are distinct. RLS-scoped. Phase 5 — P5-EVOLVE.","tags":["governance"],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyGovernanceProposalRequest"}}}},"responses":{"200":{"description":"Proposal applied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyGovernanceProposalResponse"}}}},"400":{"description":"Invalid apply body"},"401":{"description":"Unauthorized"},"404":{"description":"Project or proposal not found (or not owned by this tenant)"},"409":{"description":"Proposal already applied or rejected"}}}},"/v1/api/features":{"post":{"summary":"Create a Draft Feature from a one-line goal","operationId":"createFeature","tags":["features"],"description":"Creates a Draft Feature in the target project (resolved by slug within the tenant) from a one-line operator goal, assigns it a LexoRank so it lands on the roadmap/backlog, and returns the new id. The goal-to-conversation entry point: the operator then navigates into the refine workspace and starts refinement. An unknown projectSlug returns 404 (fail closed). Phase 7 — W1-API (FB-3).","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFeatureRequest"}}}},"responses":{"201":{"description":"Draft Feature created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFeatureResponse"}}}},"400":{"description":"Invalid request body"},"401":{"description":"Unauthorized"},"404":{"description":"Unknown project (or not owned by this tenant)"}}},"get":{"summary":"List Features (roadmap + backlog buckets)","operationId":"listFeatures","tags":["features"],"description":"Lists a tenant’s Features split into two ranked buckets: roadmap (status in_refinement | approved) over backlog (status backlog | draft | null), each ordered by LexoRank ascending. An unknown projectSlug filter returns empty buckets (fail closed). Phase 7 — W1-API.","parameters":[{"name":"projectSlug","in":"query","description":"Narrow the listing to one project slug. Unknown slugs return empty buckets.","schema":{"type":"string"}}],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListFeaturesResponse"}}}},"400":{"description":"Invalid query parameter"},"401":{"description":"Unauthorized"}}}},"/v1/api/features/{id}":{"get":{"summary":"Get a Feature + refinement-thread summary","operationId":"getFeature","tags":["features"],"description":"Returns one Feature with a privacy-safe refinement-thread summary (message + round + open-question counts and the oldest open question id; never the raw conversation bodies). Phase 7 — W1-API.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetFeatureResponse"}}}},"401":{"description":"Unauthorized"},"404":{"description":"Not found (or not owned by this tenant)"}}}},"/v1/api/features/{id}/refine":{"post":{"summary":"Trigger refinement on a Feature goal","operationId":"triggerFeatureRefinement","tags":["features"],"description":"Opens (or resumes) the durable in-app refinement conversation on a one-line operator goal. Moves the Feature to in_refinement and fires the feature/refinement.requested event that starts the durable workflow. Phase 7 — W1-API.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TriggerRefinementRequest"}}}},"responses":{"200":{"description":"Refinement enqueued","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TriggerRefinementResponse"}}}},"400":{"description":"Invalid request body"},"401":{"description":"Unauthorized"},"404":{"description":"Not found (or not owned by this tenant)"}}}},"/v1/api/features/{id}/refinement":{"get":{"summary":"Fetch the refinement thread + questions","operationId":"getFeatureRefinement","tags":["features"],"description":"Returns the full refinement conversation (messages) and the Feature’s questions for the in-app refinement surface. Phase 7 — W1-API.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetRefinementResponse"}}}},"401":{"description":"Unauthorized"},"404":{"description":"Not found (or not owned by this tenant)"}}},"post":{"summary":"Post an operator message into the refinement thread","operationId":"postFeatureRefinementMessage","tags":["features"],"description":"Appends one operator message to a Feature’s refinement thread. Phase 7 — W1-API.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostRefinementMessageRequest"}}}},"responses":{"201":{"description":"Message appended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostRefinementMessageResponse"}}}},"400":{"description":"Invalid request body"},"401":{"description":"Unauthorized"},"404":{"description":"Not found (or not owned by this tenant)"}}}},"/v1/api/features/{id}/questions/{qid}/answer":{"post":{"summary":"Answer an open feature question (resumes refinement)","operationId":"answerFeatureQuestion","tags":["features"],"description":"Records the operator’s answer to an open feature question and fires the feature/refinement.answered event that resumes the durable step.waitForEvent the workflow is blocked on. Phase 7 — W1-API.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"qid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnswerQuestionRequest"}}}},"responses":{"200":{"description":"Answer recorded; workflow resumed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnswerQuestionResponse"}}}},"400":{"description":"Invalid request body"},"401":{"description":"Unauthorized"},"404":{"description":"Feature or open question not found (or not owned by this tenant)"}}}},"/v1/api/features/{id}/approve":{"post":{"summary":"Approve a refined Feature (the one human gate)","operationId":"approveFeature","tags":["features"],"description":"The single human approval gate (tenet: Work is AI-refined before execution). Moves a Feature in_refinement → approved. A Feature not currently in_refinement (unrefined or already approved) is refused with 409 — an unapproved Feature can never enter the run pipeline through this surface. Phase 7 — W1-API.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Approved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApproveFeatureResponse"}}}},"401":{"description":"Unauthorized"},"404":{"description":"Not found (or not owned by this tenant)"},"409":{"description":"Feature is not in_refinement (cannot be approved)"}}}},"/v1/api/portfolio/reorder":{"patch":{"summary":"Reorder a Feature (single LexoRank update, no cascade)","operationId":"reorderFeature","tags":["portfolio"],"description":"Moves ONE Feature to a new LexoRank computed with rankBetween(prev, next). A single-row rank update — no sibling rows are renumbered (tenet: Work is a re-orderable portfolio). RLS-scoped. Phase 7 — W1-API.","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderFeatureRequest"}}}},"responses":{"200":{"description":"Reordered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderFeatureResponse"}}}},"400":{"description":"Invalid request body"},"401":{"description":"Unauthorized"},"404":{"description":"Feature not found (or not owned by this tenant)"}}}},"/v1/api/portfolio/reattribute":{"patch":{"summary":"Re-attribute a surfaced item to a Feature (no cascade)","operationId":"reattributeItem","tags":["portfolio"],"description":"Changes the parent Feature of ONE surfaced item (triage inbox). A single feature_id parent change — no cascade. featureId null detaches the item. A cross-tenant/unknown target Feature returns 404. RLS-scoped. Phase 7 — W1-API.","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReattributeRequest"}}}},"responses":{"200":{"description":"Re-attributed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReattributeResponse"}}}},"400":{"description":"Invalid request body or unsupported kind"},"401":{"description":"Unauthorized"},"404":{"description":"Item or target Feature not found (or not owned by this tenant)"}}}},"/v1/api/runs":{"get":{"summary":"List runs","operationId":"listRuns","tags":["runs"],"parameters":[{"name":"cursor","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","description":"Max rows to return (1–200, default 50)","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"projectSlug","in":"query","description":"Filter to runs belonging to a specific project slug. Unknown slugs return an empty list.","schema":{"type":"string"}},{"name":"undismissed","in":"query","description":"When \"true\", only runs with inbox_dismissed_at IS NULL are returned (server-side inbox filter — B-113/F-12).","schema":{"type":"string","enum":["true"]}}],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListRunsResponse"}}}},"401":{"description":"Unauthorized"}}}},"/v1/api/runs/counts":{"get":{"summary":"Run counts by status (today)","operationId":"getRunCounts","tags":["runs"],"parameters":[{"name":"since","in":"query","description":"ISO-8601 lower bound for counting (defaults to today UTC midnight)","schema":{"type":"string","format":"date-time"}}],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunCountsResponse"}}}},"400":{"description":"Invalid query parameter"},"401":{"description":"Unauthorized"}}}},"/v1/api/runs/{id}":{"get":{"summary":"Get run","operationId":"getRun","tags":["runs"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetRunResponse"}}}},"401":{"description":"Unauthorized"},"404":{"description":"Not found"}}}},"/v1/api/runs/{id}/cancel":{"post":{"summary":"Cancel run","operationId":"cancelRun","tags":["runs"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelRunRequest"}}}},"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Cancelled"},"401":{"description":"Unauthorized"},"404":{"description":"Not found"}}}},"/v1/api/runs/{id}/retry":{"post":{"summary":"Retry run","operationId":"retryRun","tags":["runs"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetryRunRequest"}}}},"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Queued"},"401":{"description":"Unauthorized"},"404":{"description":"Not found"}}}},"/v1/api/runs/{id}/dismiss":{"post":{"summary":"Dismiss run from inbox","operationId":"dismissRun","description":"Mark a run as dismissed from the operator inbox by setting inbox_dismissed_at = NOW(). Idempotent — a second dismiss on the same run is a no-op. The ?undismissed=true filter on the list runs endpoint will no longer return dismissed runs (B-113/F-12).","tags":["runs"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Dismissed","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean"}}}}}},"401":{"description":"Unauthorized"},"404":{"description":"Not found"}}}},"/v1/api/runs/{id}/events":{"get":{"summary":"Run events SSE stream","operationId":"getRunEvents","tags":["runs"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"since","in":"query","description":"Sequence number to resume from (catch-up backfill)","schema":{"type":"integer"}}],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Server-Sent Events stream","content":{"text/event-stream":{"schema":{"type":"string"}}}},"401":{"description":"Unauthorized"},"404":{"description":"Not found"}}}},"/v1/api/runs/{id}/context":{"get":{"summary":"Get run context snapshots","operationId":"getRunContext","description":"Returns the pinned effective context/tenet snapshots (run_context_snapshots) for the given run. Read-only. Empty array when no snapshots have been pinned yet.","tags":["runs"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"OK — pinned context snapshots for the run","content":{"application/json":{"schema":{"type":"object","required":["snapshots"],"properties":{"snapshots":{"type":"array","items":{"type":"object","required":["verb","snapshotJson","source","artifactSha","createdAt"],"properties":{"verb":{"type":"string","description":"MCP verb that produced the snapshot (get_context | get_tenets)"},"snapshotJson":{"type":"object","additionalProperties":{}},"source":{"type":"string","description":"Provenance: seed | effective"},"artifactSha":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}}}}}}}}},"401":{"description":"Unauthorized"},"404":{"description":"Not found"}}}},"/v1/api/queue":{"get":{"summary":"Get queue status","operationId":"getQueue","tags":["queue"],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetQueueResponse"}}}},"401":{"description":"Unauthorized"}}}},"/v1/api/queue/pause":{"post":{"summary":"Pause queue (kill switch)","operationId":"pauseQueue","tags":["queue"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PauseQueueRequest"}}}},"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Paused","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueueActionResponse"}}}},"401":{"description":"Unauthorized"}}}},"/v1/api/queue/resume":{"post":{"summary":"Resume queue","operationId":"resumeQueue","tags":["queue"],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Resumed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueueActionResponse"}}}},"401":{"description":"Unauthorized"}}}},"/v1/api/scheduled-jobs":{"get":{"summary":"Scheduled-job health summaries","operationId":"getScheduledJobs","tags":["observability"],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetScheduledJobsResponse"}}}},"401":{"description":"Unauthorized"}}}},"/v1/api/errors":{"get":{"summary":"Error feed (severity-filtered, correlation drill-through)","operationId":"getErrors","tags":["observability"],"parameters":[{"name":"severity","in":"query","description":"Filter to a single severity level","schema":{"type":"string","enum":["info","warning","error","critical"]}},{"name":"layer","in":"query","description":"Filter to a single layer","schema":{"type":"string","enum":["experience","process","system"]}},{"name":"correlationId","in":"query","description":"Drill through to all events sharing one correlation id across layers","schema":{"type":"string","format":"uuid"}},{"name":"since","in":"query","description":"ISO-8601 lower bound on event time","schema":{"type":"string","format":"date-time"}},{"name":"cursor","in":"query","description":"Opaque pagination cursor (id of the last seen row)","schema":{"type":"string"}},{"name":"limit","in":"query","description":"Max rows to return (1–200)","schema":{"type":"integer","default":50}}],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetErrorsResponse"}}}},"400":{"description":"Invalid query parameter"},"401":{"description":"Unauthorized"}}}},"/v1/api/conduit-health":{"get":{"summary":"Conduit health matrix","operationId":"getConduitHealth","tags":["conduit"],"description":"Returns the latest probe result for each conduit that has been probed on this tenant's box. Items for conduits never probed are absent (treat as \"unknown\", not \"unhealthy\"). Read-only — probing is done by the scheduled probe cron (P4-PROBE-CRON).","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetConduitHealthResponse"}}}},"401":{"description":"Unauthorized"}}}},"/v1/webhooks/linear":{"post":{"summary":"Linear webhook receiver","operationId":"linearWebhook","tags":["webhooks"],"description":"Receives Issue update events from Linear. Only Issue→Queued transitions trigger a dev-task run; all other events are acknowledged and ignored.","security":[{"hmacSignature":[]}],"responses":{"200":{"description":"Accepted (or deliberately ignored — check `accepted` field)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinearWebhookAck"}}}},"401":{"description":"Invalid HMAC signature"}}}},"/v1/webhooks/github":{"post":{"summary":"GitHub webhook receiver","operationId":"githubWebhook","tags":["webhooks"],"description":"Receives GitHub App events (push, pull_request, etc.). Full handling lands in Phase 1; until then the route verifies the signature and acks.","security":[{"hmacSignature":[]}],"responses":{"200":{"description":"Accepted (or deliberately ignored — check `accepted` field)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GithubWebhookAck"}}}},"401":{"description":"Invalid HMAC signature"}}}},"/v1/webhooks/discord":{"post":{"summary":"Discord webhook receiver","operationId":"discordWebhook","tags":["webhooks"],"description":"Receives Discord interactions/messages. Full bot integration lands in Phase 1; until then the route verifies the signature and acks.","security":[{"hmacSignature":[]}],"responses":{"200":{"description":"Accepted (or deliberately ignored — check `accepted` field)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DiscordWebhookAck"}}}},"401":{"description":"Invalid HMAC signature"}}}},"/v1/api/onboarding/github-app":{"post":{"summary":"Register GitHub App installation","operationId":"registerInstallation","tags":["tenant-onboarding"],"description":"Binds a GitHub App installation ID to the tenant that completed the OAuth install flow. Called during the post-install redirect callback.","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterInstallationRequest"}}}},"responses":{"200":{"description":"Installation registered"},"400":{"description":"Invalid request body"},"401":{"description":"Unauthorized"},"409":{"description":"Installation already bound to a tenant"}}}},"/v1/api/tenant/secrets":{"post":{"summary":"Store tenant secret","operationId":"storeTenantSecret","tags":["tenant-onboarding"],"description":"Accepts a write-only secret (Linear API key, Discord bot token, etc.) for the authenticated tenant. The value is stored encrypted and never echoed back.","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantSecretRequest"}}}},"responses":{"200":{"description":"Secret stored"},"400":{"description":"Invalid request body"},"401":{"description":"Unauthorized"}}}}},"components":{"schemas":{"ListProjectsResponse":{"type":"object","properties":{"projects":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"repoUrl":{"type":"string","format":"uri"},"executor":{"type":"string"},"runCount":{"type":"integer","minimum":0},"lastRunAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","slug","name","repoUrl","executor","runCount","lastRunAt","createdAt"],"additionalProperties":false}}},"required":["projects"],"additionalProperties":false},"GetProjectResponse":{"type":"object","properties":{"project":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"repoUrl":{"type":"string","format":"uri"},"executor":{"type":"string"},"runCount":{"type":"integer","minimum":0},"lastRunAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","slug","name","repoUrl","executor","runCount","lastRunAt","createdAt"],"additionalProperties":false}},"required":["project"],"additionalProperties":false},"CreateProjectRequest":{"type":"object","properties":{"slug":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9-]+$"},"gitRemote":{"type":"string","minLength":1},"githubInstallId":{"type":"integer","exclusiveMinimum":0},"linearTeamKey":{"type":"string"},"discordChannelId":{"type":"string"},"manifestRef":{"type":"string"}},"required":["slug","gitRemote"],"additionalProperties":false},"CreateProjectResponse":{"type":"object","properties":{"project":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"repoUrl":{"type":"string","format":"uri"},"executor":{"type":"string"},"runCount":{"type":"integer","minimum":0},"lastRunAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","slug","name","repoUrl","executor","runCount","lastRunAt","createdAt"],"additionalProperties":false}},"required":["project"],"additionalProperties":false},"DeleteProjectResponse":{"type":"object","properties":{"deleted":{"type":"boolean"},"slug":{"type":"string"}},"required":["deleted","slug"],"additionalProperties":false},"ListRunsResponse":{"type":"object","properties":{"runs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"projectId":{"type":"string","format":"uuid"},"projectSlug":{"type":"string"},"taskType":{"type":"string"},"executor":{"type":"string"},"status":{"type":"string","enum":["queued","running","success","failed","cancelled"]},"startedAt":{"type":"string","format":"date-time"},"endedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"llmEstimatedCost":{"type":["number","null"]},"infraEstimatedCost":{"type":["number","null"]},"linearIssueId":{"type":["string","null"]},"githubPrUrl":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]}},"required":["id","projectId","projectSlug","taskType","executor","status","startedAt","endedAt","llmEstimatedCost","infraEstimatedCost","linearIssueId","githubPrUrl"],"additionalProperties":false}},"nextCursor":{"type":["string","null"]}},"required":["runs","nextCursor"],"additionalProperties":false},"GetRunResponse":{"type":"object","properties":{"run":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"projectId":{"type":"string","format":"uuid"},"projectSlug":{"type":"string"},"taskType":{"type":"string"},"executor":{"type":"string"},"status":{"type":"string","enum":["queued","running","success","failed","cancelled"]},"startedAt":{"type":"string","format":"date-time"},"endedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"llmEstimatedCost":{"type":["number","null"]},"infraEstimatedCost":{"type":["number","null"]},"linearIssueId":{"type":["string","null"]},"githubPrUrl":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"durationMs":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]},"costJson":{"anyOf":[{"type":"object","additionalProperties":{}},{"type":"null"}]},"conduit":{"anyOf":[{"type":"string","enum":["clarp","claude-oauth","claude-apikey"]},{"type":"null"}]},"model":{"type":["string","null"]},"effort":{"anyOf":[{"type":"string","enum":["low","medium","high"]},{"type":"null"}]},"routingSource":{"anyOf":[{"type":"string","enum":["template-type","template","project","manifest-fallback","cheap-mode"]},{"type":"null"}]},"routingVersion":{"type":["string","null"]},"iterationCount":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]},"usageJson":{"anyOf":[{"type":"object","properties":{"schemaVersion":{"type":"number","const":1},"wallClockMs":{"type":"integer","minimum":0},"phases":{"type":"object","properties":{"preparing":{"type":"object","properties":{"inputTokens":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]},"outputTokens":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]},"durationMs":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]}},"required":["inputTokens","outputTokens","durationMs"],"additionalProperties":false},"executing":{"type":"object","properties":{"inputTokens":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]},"outputTokens":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]},"durationMs":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]}},"required":["inputTokens","outputTokens","durationMs"],"additionalProperties":false},"verifying":{"type":"object","properties":{"inputTokens":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]},"outputTokens":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]},"durationMs":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]}},"required":["inputTokens","outputTokens","durationMs"],"additionalProperties":false}},"additionalProperties":false},"totals":{"type":"object","properties":{"inputTokens":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]},"outputTokens":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]}},"required":["inputTokens","outputTokens"],"additionalProperties":false}},"required":["schemaVersion","wallClockMs","phases","totals"],"additionalProperties":false},{"type":"null"}]}},"required":["id","projectId","projectSlug","taskType","executor","status","startedAt","endedAt","llmEstimatedCost","infraEstimatedCost","linearIssueId","githubPrUrl","durationMs","costJson","conduit","model","effort","routingSource","routingVersion","iterationCount","usageJson"],"additionalProperties":false}},"required":["run"],"additionalProperties":false},"RunCountsResponse":{"type":"object","properties":{"running":{"type":"integer","minimum":0},"queued":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0}},"required":["running","queued","failed"],"additionalProperties":false},"CancelRunRequest":{"type":"object","properties":{"reason":{"type":"string","minLength":1,"maxLength":500,"default":"Cancelled by operator"}},"additionalProperties":false},"RetryRunRequest":{"type":"object","properties":{"withIterationCap":{"type":"integer","exclusiveMinimum":0}},"additionalProperties":false},"GetQueueResponse":{"type":"object","properties":{"status":{"type":"string","enum":["running","paused"]},"pending":{"type":"array","items":{"type":"object","properties":{"runId":{"type":"string","format":"uuid"},"projectSlug":{"type":"string"},"taskType":{"type":"string"},"queuedAt":{"type":"string","format":"date-time"},"estimatedStart":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["runId","projectSlug","taskType","queuedAt","estimatedStart"],"additionalProperties":false}},"running":{"type":"array","items":{"type":"object","properties":{"runId":{"type":"string","format":"uuid"},"projectSlug":{"type":"string"},"taskType":{"type":"string"},"queuedAt":{"type":"string","format":"date-time"},"estimatedStart":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["runId","projectSlug","taskType","queuedAt","estimatedStart"],"additionalProperties":false}},"cheapMode":{"type":"boolean"}},"required":["status","pending","running","cheapMode"],"additionalProperties":false},"PauseQueueRequest":{"type":"object","properties":{"reason":{"type":"string","maxLength":500}},"additionalProperties":false},"QueueActionResponse":{"type":"object","properties":{"status":{"type":"string","enum":["running","paused"]},"affectedRuns":{"type":"integer","minimum":0}},"required":["status","affectedRuns"],"additionalProperties":false},"HealthResponse":{"type":"object","properties":{"status":{"type":"string","enum":["ok","degraded","down"]},"version":{"type":"string"},"uptime":{"type":"number","minimum":0},"services":{"type":"object","properties":{"db":{"type":"object","properties":{"status":{"type":"string","enum":["ok","degraded","down"]},"latencyMs":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"message":{"type":"string"}},"required":["status","latencyMs"],"additionalProperties":false},"inngest":{"type":"object","properties":{"status":{"type":"string","enum":["ok","degraded","down"]},"latencyMs":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"message":{"type":"string"}},"required":["status","latencyMs"],"additionalProperties":false}},"required":["db","inngest"],"additionalProperties":false}},"required":["status","version","uptime","services"],"additionalProperties":false},"GetErrorsResponse":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"tenantId":{"type":"string","format":"uuid"},"correlationId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"layer":{"type":"string","enum":["experience","process","system"]},"severity":{"type":"string","enum":["info","warning","error","critical"]},"statusCode":{"anyOf":[{"type":"integer"},{"type":"null"}]},"source":{"type":"string"},"fingerprint":{"type":"string"},"message":{"type":"string"},"sinkEventId":{"type":["string","null"]},"at":{"type":"string","format":"date-time"},"count":{"type":"integer","exclusiveMinimum":0}},"required":["tenantId","correlationId","layer","severity","statusCode","source","fingerprint","message","sinkEventId","at","count"],"additionalProperties":false}},"nextCursor":{"type":["string","null"]}},"required":["items","nextCursor"],"additionalProperties":false},"GetScheduledJobsResponse":{"type":"object","properties":{"jobs":{"type":"array","items":{"type":"object","properties":{"jobName":{"type":"string"},"lastRun":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"jobName":{"type":"string"},"status":{"type":"string","enum":["success","failed"]},"startedAt":{"type":"string","format":"date-time"},"endedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"durationMs":{"anyOf":[{"type":"integer"},{"type":"null"}]},"errorMessage":{"type":["string","null"]}},"required":["id","jobName","status","startedAt","endedAt","durationMs","errorMessage"],"additionalProperties":false},{"type":"null"}]},"recentFailures":{"type":"integer","minimum":0}},"required":["jobName","lastRun","recentFailures"],"additionalProperties":false}}},"required":["jobs"],"additionalProperties":false},"LinearWebhookAck":{"type":"object","properties":{"accepted":{"type":"boolean"},"deduplicated":{"type":"boolean"},"reason":{"type":"string"}},"required":["accepted"],"additionalProperties":false},"GithubWebhookAck":{"type":"object","properties":{"accepted":{"type":"boolean"},"reason":{"type":"string"}},"required":["accepted"],"additionalProperties":false},"DiscordWebhookAck":{"type":"object","properties":{"accepted":{"type":"boolean"},"reason":{"type":"string"}},"required":["accepted"],"additionalProperties":false},"RegisterInstallationRequest":{"type":"object","properties":{"githubInstallId":{"type":"integer","exclusiveMinimum":0},"tenantId":{"type":"string","format":"uuid"}},"required":["githubInstallId","tenantId"],"additionalProperties":false},"TenantSecretRequest":{"type":"object","properties":{"source":{"type":"string","enum":["linear","discord"]},"secretValue":{"type":"string","minLength":1}},"required":["source","secretValue"],"additionalProperties":false},"GetConduitHealthResponse":{"type":"object","properties":{"conduits":{"type":"array","items":{"type":"object","properties":{"conduit":{"type":"string","enum":["clarp","claude-oauth","claude-apikey"]},"healthy":{"type":"boolean"},"detail":{"type":["string","null"]},"checkedAt":{"type":"string","format":"date-time"}},"required":["conduit","healthy","detail","checkedAt"],"additionalProperties":false}}},"required":["conduits"],"additionalProperties":false},"GetProjectGovernanceResponse":{"type":"object","properties":{"principles":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"kind":{"type":"string","enum":["north-star","design-tenet"]},"order":{"type":"integer","minimum":0},"description":{"type":"string"},"composedFrom":{"type":"object","properties":{"layer":{"type":"string","enum":["template-type","template","project"]},"layerRef":{"type":"string","minLength":1},"action":{"type":"string","enum":["select","override","add","disable"]}},"required":["layer","layerRef","action"],"additionalProperties":false},"disabled":{"type":"boolean","default":false}},"required":["name","kind","order","description","composedFrom"],"additionalProperties":false}},"routing":{"type":"array","items":{"type":"object","properties":{"taskType":{"type":"string","minLength":1},"executor":{"type":"string","minLength":1},"model":{"type":"string","minLength":1},"effort":{"type":"string","enum":["low","medium","high"]},"action":{"type":"string","enum":["select","override","add","disable"],"default":"select"},"layer":{"type":"string","enum":["template-type","template","project"]},"layerRef":{"type":"string","minLength":1}},"required":["taskType","executor","model","layer","layerRef"],"additionalProperties":false}},"composedRouting":{"type":"array","items":{"type":"object","properties":{"taskType":{"type":"string","minLength":1},"executor":{"type":"string","minLength":1},"model":{"type":["string","null"]},"effort":{"anyOf":[{"type":"string","enum":["low","medium","high"]},{"type":"null"}]},"composedFrom":{"type":"object","properties":{"layer":{"type":"string","enum":["template-type","template","project"]},"layerRef":{"type":"string","minLength":1},"action":{"type":"string","enum":["select","override","add","disable"]}},"required":["layer","layerRef","action"],"additionalProperties":false}},"required":["taskType","executor","model","effort","composedFrom"],"additionalProperties":false}},"gates":{"type":"array","items":{"type":"object","properties":{"gateKey":{"type":"string","minLength":1},"enabled":{"type":"boolean"},"config":{"type":"object","additionalProperties":{}},"layer":{"type":"string","enum":["template-type","template","project"]},"layerRef":{"type":"string","minLength":1}},"required":["gateKey","enabled","layer","layerRef"],"additionalProperties":false}},"source":{"type":"string","enum":["seed","effective"]},"resolvedAt":{"type":"string","format":"date-time"}},"required":["principles","routing","composedRouting","gates","source","resolvedAt"],"additionalProperties":false},"EvolveGovernanceRequest":{"type":"object","properties":{"targetKind":{"type":"string","enum":["principle","routing","gate"]},"layer":{"type":"string","enum":["template-type","template","project"]},"layerRef":{"type":"string","minLength":1},"targetKey":{"type":"string","minLength":1},"action":{"type":"string","enum":["add","refine","retire"]},"body":{"type":"object","additionalProperties":{}},"provenance":{"type":"object","properties":{"source":{"type":"string","minLength":1},"reason":{"type":"string","maxLength":1000},"actor":{"type":"string","minLength":1}},"required":["source","reason","actor"],"additionalProperties":false}},"required":["targetKind","layer","layerRef","targetKey","action","provenance"],"additionalProperties":false},"EvolveGovernanceResponse":{"type":"object","properties":{"applied":{"type":"object","properties":{"targetKind":{"type":"string","enum":["principle","routing","gate"]},"layer":{"type":"string","enum":["template-type","template","project"]},"layerRef":{"type":"string","minLength":1},"targetKey":{"type":"string","minLength":1},"action":{"type":"string","enum":["add","refine","retire"]},"appliedAt":{"type":"string","format":"date-time"}},"required":["targetKind","layer","layerRef","targetKey","action","appliedAt"],"additionalProperties":false}},"required":["applied"],"additionalProperties":false},"CreateGovernanceProposalRequest":{"type":"object","properties":{"proposed":{"type":"object","properties":{"targetKind":{"type":"string","enum":["principle","routing","gate"]},"layer":{"type":"string","enum":["template-type","template","project"]},"layerRef":{"type":"string","minLength":1},"targetKey":{"type":"string","minLength":1},"action":{"type":"string","enum":["add","refine","retire"]},"body":{"type":"object","additionalProperties":{}},"provenance":{"type":"object","properties":{"source":{"type":"string","minLength":1},"reason":{"type":"string","maxLength":1000},"actor":{"type":"string","minLength":1}},"required":["source","reason","actor"],"additionalProperties":false}},"required":["targetKind","layer","layerRef","targetKey","action","provenance"],"additionalProperties":false}},"required":["proposed"],"additionalProperties":false},"CreateGovernanceProposalResponse":{"type":"object","properties":{"proposal":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"targetKind":{"type":"string","enum":["principle","routing","gate"]},"layer":{"type":"string","enum":["template-type","template","project"]},"layerRef":{"type":"string","minLength":1},"proposed":{"type":"object","properties":{"targetKind":{"type":"string","enum":["principle","routing","gate"]},"layer":{"type":"string","enum":["template-type","template","project"]},"layerRef":{"type":"string","minLength":1},"targetKey":{"type":"string","minLength":1},"action":{"type":"string","enum":["add","refine","retire"]},"body":{"type":"object","additionalProperties":{}},"provenance":{"type":"object","properties":{"source":{"type":"string","minLength":1},"reason":{"type":"string","maxLength":1000},"actor":{"type":"string","minLength":1}},"required":["source","reason","actor"],"additionalProperties":false}},"required":["targetKind","layer","layerRef","targetKey","action","provenance"],"additionalProperties":false},"status":{"type":"string","enum":["pending","applied","rejected"]},"appliedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"appliedBy":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","targetKind","layer","layerRef","proposed","status","appliedAt","appliedBy","createdAt"],"additionalProperties":false}},"required":["proposal"],"additionalProperties":false},"ApplyGovernanceProposalRequest":{"type":"object","properties":{"appliedBy":{"type":"string","minLength":1}},"required":["appliedBy"],"additionalProperties":false},"ApplyGovernanceProposalResponse":{"type":"object","properties":{"proposal":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"targetKind":{"type":"string","enum":["principle","routing","gate"]},"layer":{"type":"string","enum":["template-type","template","project"]},"layerRef":{"type":"string","minLength":1},"proposed":{"type":"object","properties":{"targetKind":{"type":"string","enum":["principle","routing","gate"]},"layer":{"type":"string","enum":["template-type","template","project"]},"layerRef":{"type":"string","minLength":1},"targetKey":{"type":"string","minLength":1},"action":{"type":"string","enum":["add","refine","retire"]},"body":{"type":"object","additionalProperties":{}},"provenance":{"type":"object","properties":{"source":{"type":"string","minLength":1},"reason":{"type":"string","maxLength":1000},"actor":{"type":"string","minLength":1}},"required":["source","reason","actor"],"additionalProperties":false}},"required":["targetKind","layer","layerRef","targetKey","action","provenance"],"additionalProperties":false},"status":{"type":"string","enum":["pending","applied","rejected"]},"appliedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"appliedBy":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","targetKind","layer","layerRef","proposed","status","appliedAt","appliedBy","createdAt"],"additionalProperties":false},"applied":{"type":"object","properties":{"targetKind":{"type":"string","enum":["principle","routing","gate"]},"layer":{"type":"string","enum":["template-type","template","project"]},"layerRef":{"type":"string","minLength":1},"targetKey":{"type":"string","minLength":1},"action":{"type":"string","enum":["add","refine","retire"]},"appliedAt":{"type":"string","format":"date-time"}},"required":["targetKind","layer","layerRef","targetKey","action","appliedAt"],"additionalProperties":false}},"required":["proposal","applied"],"additionalProperties":false},"UpsertRoutingRowRequest":{"type":"object","properties":{"layer":{"type":"string","enum":["template-type","template","project"]},"layerRef":{"type":"string","minLength":1},"taskType":{"type":"string","minLength":1},"executor":{"type":"string","minLength":1},"model":{"type":"string"},"effort":{"type":"string","enum":["low","medium","high"]},"action":{"type":"string","enum":["select","override","add","disable"]},"provenance":{"type":"object","properties":{"source":{"type":"string","minLength":1},"reason":{"type":"string","maxLength":1000},"actor":{"type":"string","minLength":1}},"required":["source","reason","actor"],"additionalProperties":false}},"required":["layer","layerRef","taskType","action"],"additionalProperties":false},"UpsertRoutingRowResponse":{"type":"object","properties":{"row":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"layer":{"type":"string","enum":["template-type","template","project"]},"layerRef":{"type":"string","minLength":1},"taskType":{"type":"string","minLength":1},"executor":{"type":"string","minLength":1},"model":{"type":["string","null"]},"effort":{"anyOf":[{"type":"string","enum":["low","medium","high"]},{"type":"null"}]},"action":{"type":"string","enum":["select","override","add","disable"]},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","layer","layerRef","taskType","executor","model","effort","action","updatedAt"],"additionalProperties":false}},"required":["row"],"additionalProperties":false},"CreateFeatureRequest":{"type":"object","properties":{"projectSlug":{"type":"string","minLength":1},"goal":{"type":"string","minLength":1,"maxLength":2000}},"required":["projectSlug","goal"],"additionalProperties":false},"CreateFeatureResponse":{"type":"object","properties":{"feature":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"projectId":{"type":"string","format":"uuid"},"title":{"type":["string","null"]},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","enum":["backlog","draft","in_refinement","approved","decomposing","dev","done"]},{"type":"null"}]},"rank":{"anyOf":[{"type":"string","minLength":1,"maxLength":256},{"type":"null"}]},"githubIssueId":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","projectId","title","description","status","rank","githubIssueId","createdAt","updatedAt"],"additionalProperties":false}},"required":["feature"],"additionalProperties":false},"ListFeaturesResponse":{"type":"object","properties":{"roadmap":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"projectId":{"type":"string","format":"uuid"},"title":{"type":["string","null"]},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","enum":["backlog","draft","in_refinement","approved","decomposing","dev","done"]},{"type":"null"}]},"rank":{"anyOf":[{"type":"string","minLength":1,"maxLength":256},{"type":"null"}]},"githubIssueId":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","projectId","title","description","status","rank","githubIssueId","createdAt","updatedAt"],"additionalProperties":false}},"backlog":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"projectId":{"type":"string","format":"uuid"},"title":{"type":["string","null"]},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","enum":["backlog","draft","in_refinement","approved","decomposing","dev","done"]},{"type":"null"}]},"rank":{"anyOf":[{"type":"string","minLength":1,"maxLength":256},{"type":"null"}]},"githubIssueId":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","projectId","title","description","status","rank","githubIssueId","createdAt","updatedAt"],"additionalProperties":false}}},"required":["roadmap","backlog"],"additionalProperties":false},"GetFeatureResponse":{"type":"object","properties":{"feature":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"projectId":{"type":"string","format":"uuid"},"title":{"type":["string","null"]},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","enum":["backlog","draft","in_refinement","approved","decomposing","dev","done"]},{"type":"null"}]},"rank":{"anyOf":[{"type":"string","minLength":1,"maxLength":256},{"type":"null"}]},"githubIssueId":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","projectId","title","description","status","rank","githubIssueId","createdAt","updatedAt"],"additionalProperties":false},"thread":{"type":"object","properties":{"messageCount":{"type":"integer","minimum":0},"roundCount":{"type":"integer","minimum":0},"openQuestionCount":{"type":"integer","minimum":0},"oldestOpenQuestionId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]}},"required":["messageCount","roundCount","openQuestionCount","oldestOpenQuestionId"],"additionalProperties":false}},"required":["feature","thread"],"additionalProperties":false},"ReorderFeatureRequest":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"newRank":{"type":"string","minLength":1,"maxLength":256}},"required":["id","newRank"],"additionalProperties":false},"ReorderFeatureResponse":{"type":"object","properties":{"feature":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"projectId":{"type":"string","format":"uuid"},"title":{"type":["string","null"]},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","enum":["backlog","draft","in_refinement","approved","decomposing","dev","done"]},{"type":"null"}]},"rank":{"anyOf":[{"type":"string","minLength":1,"maxLength":256},{"type":"null"}]},"githubIssueId":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","projectId","title","description","status","rank","githubIssueId","createdAt","updatedAt"],"additionalProperties":false}},"required":["feature"],"additionalProperties":false},"ReattributeRequest":{"type":"object","properties":{"kind":{"type":"string","enum":["surfaced_item","feature"]},"id":{"type":"string","format":"uuid"},"featureId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]}},"required":["kind","id","featureId"],"additionalProperties":false},"ReattributeResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"featureId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"status":{"type":"string"}},"required":["id","featureId","status"],"additionalProperties":false},"TriggerRefinementRequest":{"type":"object","properties":{"goal":{"type":"string","minLength":1,"maxLength":2000},"roundCap":{"type":"integer","exclusiveMinimum":0,"maximum":20}},"required":["goal"],"additionalProperties":false},"TriggerRefinementResponse":{"type":"object","properties":{"feature":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"projectId":{"type":"string","format":"uuid"},"title":{"type":["string","null"]},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","enum":["backlog","draft","in_refinement","approved","decomposing","dev","done"]},{"type":"null"}]},"rank":{"anyOf":[{"type":"string","minLength":1,"maxLength":256},{"type":"null"}]},"githubIssueId":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","projectId","title","description","status","rank","githubIssueId","createdAt","updatedAt"],"additionalProperties":false},"enqueued":{"type":"boolean","const":true}},"required":["feature","enqueued"],"additionalProperties":false},"GetRefinementResponse":{"type":"object","properties":{"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"featureId":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["operator","assistant","system"]},"kind":{"type":"string","enum":["message","proposal","tenet_score"]},"content":{"type":["string","null"]},"payloadJson":{"anyOf":[{},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","featureId","role","kind","content","createdAt"],"additionalProperties":false}},"questions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"featureId":{"type":"string","format":"uuid"},"prompt":{"type":"string"},"optionsJson":{"anyOf":[{},{"type":"null"}]},"status":{"type":"string","enum":["open","answered","superseded"]},"answer":{"type":["string","null"]},"answeredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","featureId","prompt","status","answer","answeredAt","createdAt"],"additionalProperties":false}}},"required":["messages","questions"],"additionalProperties":false},"PostRefinementMessageRequest":{"type":"object","properties":{"content":{"type":"string","minLength":1,"maxLength":10000}},"required":["content"],"additionalProperties":false},"PostRefinementMessageResponse":{"type":"object","properties":{"message":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"featureId":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["operator","assistant","system"]},"kind":{"type":"string","enum":["message","proposal","tenet_score"]},"content":{"type":["string","null"]},"payloadJson":{"anyOf":[{},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","featureId","role","kind","content","createdAt"],"additionalProperties":false}},"required":["message"],"additionalProperties":false},"AnswerQuestionRequest":{"type":"object","properties":{"answer":{"type":"string","minLength":1,"maxLength":10000}},"required":["answer"],"additionalProperties":false},"AnswerQuestionResponse":{"type":"object","properties":{"question":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"featureId":{"type":"string","format":"uuid"},"prompt":{"type":"string"},"optionsJson":{"anyOf":[{},{"type":"null"}]},"status":{"type":"string","enum":["open","answered","superseded"]},"answer":{"type":["string","null"]},"answeredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","featureId","prompt","status","answer","answeredAt","createdAt"],"additionalProperties":false},"enqueued":{"type":"boolean","const":true}},"required":["question","enqueued"],"additionalProperties":false},"ApproveFeatureResponse":{"type":"object","properties":{"feature":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"projectId":{"type":"string","format":"uuid"},"title":{"type":["string","null"]},"description":{"type":["string","null"]},"status":{"anyOf":[{"type":"string","enum":["backlog","draft","in_refinement","approved","decomposing","dev","done"]},{"type":"null"}]},"rank":{"anyOf":[{"type":"string","minLength":1,"maxLength":256},{"type":"null"}]},"githubIssueId":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","projectId","title","description","status","rank","githubIssueId","createdAt","updatedAt"],"additionalProperties":false}},"required":["feature"],"additionalProperties":false}},"securitySchemes":{"sessionCookie":{"type":"apiKey","in":"cookie","name":"better-auth.session_token","description":"Better-Auth session cookie"},"hmacSignature":{"type":"apiKey","in":"header","name":"x-hub-signature-256","description":"HMAC-SHA256 signature from the sending service"}}}}