loopctl-mcp-server 3.43.0 → 3.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -186,7 +186,9 @@ tool parameter.
186
186
  | Tool | Description |
187
187
  |---|---|
188
188
  | `get_tenant` | Get current tenant info. Use to verify connectivity, and to read `capabilities` — which surfaces your `trust_tier` includes — before attempting a write. |
189
+ | `update_tenant` | **Update the tenant's own profile** (`PATCH /api/v1/tenants/me`): any of `name`, `email`, `settings`, `default_story_budget_millicents`, `token_data_retention_days`. `settings` is MERGED key by key into the stored map. User role: `LOOPCTL_USER_KEY` verbatim when set, else the default key (`403 insufficient_role` below user). `422` for a malformed or taken email, a non-boolean `knowledge_auto_extract`/`kb_curation_log` setting, a budget not above 0, or a retention that is not an integer of at least 30 (null turns it off). The slug is immutable and loopctl would ignore one with a 200, so a call carrying `slug`, or naming no field, is refused locally. |
189
190
  | `list_projects` | List all projects in the current tenant. |
191
+ | `get_project` | **Read one project** (`GET /api/v1/projects/:id`) with its `epic_count` and `story_count`. Any key, sent as the session's own. `404` for another tenant's project. The path takes an id only (a slug would answer the same 404), so a non-UUID `project_id` is refused locally: resolve a repo to its id with `resolve_project`. |
190
192
  | `resolve_project` | Resolve a repo to its `project_id` in one cheap call — provide any of `slug`, `repo_url` (`git@github.com:owner/repo.git`, `https://github.com/owner/repo`, and bare `owner/repo` all match), or `name`. Precedence `slug > repo_url > name`, first match wins. Use the returned `id` to scope captures/recall (`memory_*`, `recall_context`). `404` `not_found` if nothing matches, `422` `no_identifier` if none supplied, `409` if a fuzzy identifier matches more than one active project. |
191
193
  | `create_project` | Create a new **work** project (epics/stories/custody). Requires orchestrator+ **and** a `human_anchored` tenant; an agent-rooted tenant gets `403 custody_tier_required` and should use `create_kb_scope`. |
192
194
  | `delete_project` | **Needs a user-role key:** `LOOPCTL_USER_KEY` verbatim when set, else the default key (orchestrator role is 403 `insufficient_role`). Archives the project (status `archived`); no rows are removed and its slug stays taken. Refused 409 `repo_held_by_intake_source` while a live pr or chg intake source is bound to the project; revoke it first. |
@@ -195,6 +197,10 @@ tool parameter.
195
197
  | `merge_project` | Merge one project into another (`POST /api/v1/projects/:id/merge_into`): every row moves to `target_project_id` in one transaction, the source is archived with `metadata.merged_into`, and a kb target becomes a work project when the source was one. `dry_run: true` reports per-table counts and conflicts and writes nothing. User role on a human-anchored tenant, sent with `LOOPCTL_USER_KEY` verbatim. 409 `merge_conflicts` lists rows both projects hold under one per-project unique key. 409 `merge_strands_intake_source` when a live pr/chg intake source names a repo the target does not hold; a target with no repo claims the sources' repo (409 `repo_already_has_project` when another project holds it). |
196
198
  | `get_progress` | Get progress summary for a project, including story counts by status. Pass `include_cost=true` for cost data. |
197
199
  | `import_stories` | Import stories into a project from a structured payload (Epic 12 import format). Pass `merge: true` to add stories to epics that already exist (otherwise duplicates return 409). For large payloads, use `payload_path` to read JSON from disk instead of passing it inline. With `merge: true`, `report_orphans: true` adds `stories_orphaned` (the project's stories the payload does not mention; nothing is detached) — a signal only on a FULL round-trip of an export; without it the key is absent (#880). |
200
+ | `dependency_graph` | **Read a project's dependency graph** (`GET /api/v1/projects/:id/dependency_graph`): its epics and stories with every epic and story dependency edge. Any key, sent as the session's own. `404` for another tenant's project; a non-UUID `project_id` is refused locally. |
201
+ | `epic_dependency_add` | **Add an epic dependency** (`POST /api/v1/epic_dependencies`): `epic_id` depends on `depends_on_epic_id`; 201 with `epic_dependency`. Orchestrator role or higher on a human-anchored tenant: `LOOPCTL_ORCH_KEY` verbatim, else `LOOPCTL_USER_KEY`, else the default key (`403 insufficient_role` for an agent key, `403 custody_tier_required` on an agent-rooted tenant). `404` when either epic is another tenant's, `409` when the edge exists, `422` for a self-dependency, epics in different projects, a cycle, or a cross-level deadlock (a story in the prerequisite epic already depends on a story in the dependent one). A non-UUID id or a self-dependency is refused locally. |
202
+ | `epic_dependency_remove` | **Remove an epic dependency edge** (`DELETE /api/v1/epic_dependencies/:id`) by the edge's id; 204. User role on a human-anchored tenant: `LOOPCTL_USER_KEY` verbatim when set, else the default key (`403 insufficient_role` below user, `403 custody_tier_required` on an agent-rooted tenant). `404` for another tenant's edge; a non-UUID `dependency_id` is refused locally. |
203
+ | `epic_dependency_list` | **List a project's epic dependency edges** (`GET /api/v1/projects/:id/epic_dependencies`). Any key, sent as the session's own. `404` for another tenant's project; a non-UUID `project_id` is refused locally. |
198
204
 
199
205
  ### KB Scope Tools (agent key)
200
206
 
@@ -220,6 +226,8 @@ Epic 39 Repo Coordination Bus — a lightweight, tenant-isolated channel for age
220
226
  | `channel_unlock` | Release YOUR OWN advisory file soft-lock. Addressed by your `(tenant, project, agent, session)` slot: a lock you do not hold / another AGENT's / one under a different session id / cross-tenant / nonexistent returns a byte-identical 404. The enforced scope is per-AGENT, not per-session (`session_id` is client-supplied and published by `channel_locks`) — accepted for advisory hint data. Best-effort housekeeping — a lock also self-expires. Required: `project_id`, `target`. |
221
227
  | `channel_locks` | List the LIVE advisory file soft-locks on a channel — read it BEFORE editing. A SEPARATE, PINNED set: the read to trust for lock visibility, while `channel_recent` admits only the newest few locks (and does not count suppressed ones in its `has_more`). Each row carries `target`, `agent_id`, `session_id`, `host`, `expires_at`, `inserted_at`. Fairness-bounded per AGENT (server-stamped, so rotating `session_id` does not escape it): at most 20 rows per page. Check BOTH `meta.overflow` (page cap) and `meta.holders_truncated` (fairness cap) — either true means live locks were dropped from the page. ADVISORY: a lock is information, not a prohibition. Oracle-safe: a foreign/nonexistent project_id returns an empty set. Optional `limit` (default 100, max 200). Required: `project_id`. |
222
228
  | `channel_graduate` | Graduate a coordination post into the durable Knowledge wiki (Epic 40, US-40.E1). CONTENT-SELECTIVE — ONLY for a genuinely REUSABLE finding with no external tracker, worth another agent reading later; a transient directive should be LEFT TO EXPIRE on its TTL, never graduated. No automatic graduation. Reuses Knowledge's guardrails, never a bypass: the semantic novelty gate (a near-duplicate returns 200 `deduplicated`, nothing created) plus a secret scan (a denylisted credential returns 422). Records `source_type` `channel_graduation` + the post id, attributed to you; the source post is KEPT (its TTL reclaims it). Project-scoped by membership. Optional `tags`, `category` (default `finding`). Required: `post_id`, `title`. |
229
+ | `channel_quarantine_list` | **Review quarantined posts** (`GET /api/v1/channel/posts/quarantined`), the ones the secret rescan hid as suspected credentials. The FULL rows go to `rows_file` (absolute, must not exist, created 0600) and are not returned: the result lists each post with its scanned fields removed, and `quarantine_reason` names the ones that tripped. Optional `project_id` (id, slug or repo name; one naming no project answers an empty list) and `limit` (1..100, default 25; loopctl would clamp, so out-of-range is refused locally). **User key** on a human-anchored tenant: `LOOPCTL_USER_KEY` verbatim when set, else the default key (`403 insufficient_role` below user, `403 custody_tier_required` on an agent-rooted tenant). |
230
+ | `channel_quarantine_release` | **Release a quarantined post** (`POST /api/v1/channel/posts/:id/release`), the false-positive counterpart to `channel_delete`; audited. The answer's post has its scanned fields removed (read it with `channel_get`). **User key** on a human-anchored tenant, as `channel_quarantine_list`. `404`, identical for each, when the post is missing, another tenant's or not quarantined; `500 audit_write_failed` (nothing released). A non-UUID `post_id` is refused locally. |
223
231
 
224
232
  ### Story Tools
225
233
 
@@ -238,8 +246,15 @@ Epic 39 Repo Coordination Bus — a lightweight, tenant-isolated channel for age
238
246
  | `delete_epic` | **Delete an epic and every story in it** (`DELETE /api/v1/epics/:id`) — irreversible, the delete cascades. 204 with no body. `LOOPCTL_USER_KEY` (user or above; sent verbatim when set, else the default key) on a human-anchored tenant. 422 when an active intake source targets the epic (revoke it first), and 422 when a dispatch, capability token or verification run references any story in it (those do not cascade). |
239
247
  | `delete_story` | **Delete one story** (`DELETE /api/v1/stories/:id`, loopctl #876) — irreversible. 204 with no body. `LOOPCTL_USER_KEY` (sent verbatim when set, else the default key) on a human-anchored tenant. 422 when a dispatch, capability token or verification run references the story (those do not cascade). |
240
248
  | `epic_progress` | **An epic's progress** (`GET /api/v1/epics/:id/progress`): its stories counted by `agent_status` and `verified_status`. Any key. |
249
+ | `list_epic_stories` | **List an epic's stories** (`GET /api/v1/epics/:epic_id/stories`) in `sort_key` order, optionally filtered by `agent_status` and `verified_status`, paged by `page` and `page_size` (1..100, default 20). Any key, sent as the session's own. `404` for another tenant's epic. A non-UUID `epic_id`, or a status outside its enum, is refused locally: loopctl ignores an unknown status filter and would answer every story. |
250
+ | `story_dependency_add` | **Add a story dependency** (`POST /api/v1/story_dependencies`): `story_id` depends on `depends_on_story_id` (epics may differ, the project may not); 201 with `story_dependency`. Orchestrator role or higher on a human-anchored tenant: `LOOPCTL_ORCH_KEY` verbatim, else `LOOPCTL_USER_KEY`, else the default key (`403 insufficient_role` for an agent key, `403 custody_tier_required` on an agent-rooted tenant). `404` when either story is another tenant's, `409` when the edge exists, `422` for a self-dependency, stories in different projects, a cycle, or a cross-level deadlock (the prerequisite story's epic already depends on the dependent story's epic). A non-UUID id or a self-dependency is refused locally. |
251
+ | `story_dependency_remove` | **Remove a story dependency edge** (`DELETE /api/v1/story_dependencies/:id`) by the edge's id; 204. User role on a human-anchored tenant: `LOOPCTL_USER_KEY` verbatim when set, else the default key (`403 insufficient_role` below user, `403 custody_tier_required` on an agent-rooted tenant). `404` for another tenant's edge; a non-UUID `dependency_id` is refused locally. |
252
+ | `story_dependency_list` | **List an epic's story dependency edges** (`GET /api/v1/epics/:id/story_dependencies`): every edge with either end in the epic. Any key, sent as the session's own. `404` for another tenant's epic; a non-UUID `epic_id` is refused locally. |
241
253
  | `backfill_story` | **Bypasses the review/verify chain.** Marks a story as verified when the work was completed outside loopctl (e.g. before the project was onboarded). Refused for any story with `assigned_agent_id` set — those must go through the normal report → review → verify flow, not backfill. Also refused for already `:verified` or `:rejected` stories. Records provenance (`reason`, `evidence_url`, `pr_number`) in `metadata.backfill` and emits a `story.backfilled` webhook. |
242
254
  | `get_acceptance_criteria` | List a story's acceptance criteria with each one's verification status. Required: `story_id`. |
255
+ | `artifact_report` | **Report an artifact of a story** (`POST /api/v1/stories/:id/artifacts`): `artifact_type` and `path` required, `exists` (default true) and `details` optional; 201 with `artifact_report`, whose reporter and `reported_by` loopctl derives from the key. Sent on the session's own key. `exact_role: [:agent, :orchestrator]` with no hierarchy, so a user or superadmin key is `403 insufficient_role`; `403 custody_tier_required` on an agent-rooted tenant, `503 tenant_halted` under a custody halt, `404` for another tenant's story, `422` without `artifact_type` or `path`. A non-UUID `story_id` or a missing field is refused locally. |
256
+ | `artifact_list` | **List a story's artifact reports** (`GET /api/v1/stories/:id/artifacts`), oldest first, paged by `page` and `page_size` (1..100, default 20). Any key, sent as the session's own. `404` for another tenant's story; a non-UUID `story_id` is refused locally. |
257
+ | `verification_list` | **List a story's verification results** (`GET /api/v1/stories/:story_id/verifications`), paged by `page` and `page_size` (1..100, default 20). Orchestrator role or higher: `LOOPCTL_ORCH_KEY` verbatim, else `LOOPCTL_USER_KEY`, else the default key (`403 insufficient_role` for an agent key). `404` for another tenant's story; a non-UUID `story_id` is refused locally. |
243
258
 
244
259
  ### Workflow Tools (agent key)
245
260
 
@@ -247,6 +262,8 @@ Epic 39 Repo Coordination Bus — a lightweight, tenant-isolated channel for age
247
262
  |---|---|
248
263
  | `contract_story` | Agent acknowledges a story's acceptance criteria. Transitions pending -> contracted. Refused 409 `story_held` when the story's delivery stage is `escalated`, `done` or `failed` — it is not available to agents even when it reads `pending`; an escalated story becomes available again only after `resolve_escalation` sends it to `queued`. |
249
264
  | `claim_story` | Agent claims a contracted story with pessimistic locking. Transitions contracted -> assigned. On a loopctl with claim leases the result leads with the claim's `claim_epoch` and `claimed_until`; keep the epoch for `renew_story_claim`. Both are absent on an older server. Refused 409 `story_held` when the story's delivery stage is `escalated`, `done` or `failed` — even when it reads `pending` or `contracted`; an escalated story is claimable again only after `resolve_escalation` sends it to `queued`, a done or failed one never is. Refused 409 `chg_root_review_only` when the key descends from an intake source's `chg_root_dispatch_id`: chg-server's keys may only review. A claim by a holder credential takes the holder's `lease_until` and no cap (US-52.19); `409 holder_lease_expired` when that lease has run out or the holder ended. |
265
+ | `bulk_claim` | **Claim up to 50 contracted stories at once** (`POST /api/v1/stories/bulk/claim`) for this session's agent and holder, in one transaction with partial success: 200 with `results` when any was claimed, 422 with `results` when none was; each story's refusal is its `reason`. Mints no start capability (`start_story` recovers one). Sent on the session's own key: `exact_role: :agent`, so an orchestrator, user or superadmin key is `403 insufficient_role`. `403 custody_tier_required` on an agent-rooted tenant, `409 chg_root_review_only` for a chg-rooted key, `503 tenant_halted` under a custody halt. An empty or oversized batch, a non-UUID id and an id named twice are refused locally. |
266
+ | `unclaim_story` | **Give back a story this session claimed** (`POST /api/v1/stories/:id/unclaim`): back to pending; a delivery story is re-contracted below the retry ceiling and escalated over `attempts_exhausted` at it. Sent on the session's own key: `exact_role: :agent`, so an orchestrator, user or superadmin key is `403 insufficient_role` (another agent's story: `force_unclaim_story`). `403` when this agent is not the assignee, `403 custody_tier_required`, `404` for another tenant's story, `409` for a story no claim can leave, `409 held_by_other_holder`, `422` when the release write was rejected, `500 audit_chain_append_failed` (the whole release rolled back), `503 tenant_halted`. A non-UUID `story_id` is refused locally. |
250
267
  | `renew_story_claim` | Renew your claim's lease (`POST /stories/:id/renew-claim`, agent key). A claim not renewed before `claimed_until` (default 24 hours, `STORY_CLAIM_LEASE_SECONDS`) is released back to `pending` under you, so renew well inside it on any story held longer. A driver-placed claim — one a placement took for a runner dispatch — is capped at its dispatch deadline (`claim_lease_cap`: placed_at + `wall_clock_seconds` + `DISPATCH_LEASE_GRACE_SECONDS` at the claim, sent to the runner as `deadline_at`; moved forward to a resume's time or the runner's acceptance + `wall_clock_seconds` + the grace, only while the claim is live; never earlier than a `deadline_at` already sent), and its `claimed_until` already IS that cap: renewing it writes nothing and returns the claim as it stands, never moving `claimed_until` past it. Required: `story_id`, `claim_epoch` (from the claim). Refusals pass through: 400 epoch missing or malformed, 422 `not_claimed`, 409 `stale_claim_epoch` (the claim has ended: stop working it), 409 `not_claimant`, 409 `lease_cap_reached` (a driver-placed claim already at its cap: nothing is renewed, stop working it). A claim taken by a holder credential (US-52.19) lives by the holder's lease instead: renewing it writes the holder's `lease_until`, and the heartbeat already moves it; `409 holder_lease_expired` when the holder has lapsed. Needs a loopctl server with claim leases. |
251
268
  | `escalate_story` | Park a story you hold for a HUMAN and stop (`POST /stories/:id/escalate`, agent key). This is what an unattended session calls INSTEAD of asking a question — a headless run has no way to ask, so escalating is the affordance. Use it when the request contradicts an existing story, KB decision or documented behaviour, when it inverts or removes behaviour a previous story deliberately added, when it is a workflow change rather than a defect fix, or when it needs a business call — not for an ordinary blocker. ONE-WAY from your side: only a human moves the story off `escalated`, so on success STOP and report. Required: `story_id`, `claim_epoch`, `reason` (verbatim, treated as untrusted data, length capped by the server in codepoints — a 400 names the bound); optional `payload` object. Idempotent under the same epoch. Refusals pass through: 409 `stale_claim_epoch`, 409 `not_claimant`, 404 `unknown_story_stage`, 400 for a malformed epoch or reason. An orchestrator or user key is 403'd on purpose. |
252
269
  | `start_story` | Agent starts work on a claimed story. Transitions assigned -> implementing. |
@@ -272,6 +289,8 @@ Epic 39 Repo Coordination Bus — a lightweight, tenant-isolated channel for age
272
289
  |---|---|
273
290
  | `bulk_mark_complete` | **Backfill-only.** Bulk-marks pre-existing, never-dispatched stories (pending, unassigned, no dispatch lineage) as complete in a single call. Dispatched stories are refused — they must go through the normal report → review → verify flow. Refused 409 `chg_root_cannot_verify` for the whole batch for a chg-rooted key (loopctl US-47.5). |
274
291
  | `verify_all_in_epic` | Bulk verify all reported_done, unverified stories in an epic. Refused 409 `chg_root_cannot_verify` for the whole epic for a chg-rooted key (loopctl US-47.5). |
292
+ | `bulk_verify` | **Verify up to 50 reported stories at once** (`POST /api/v1/stories/bulk/verify`); each entry `{story_id, summary, review_type, findings}`, the last three optional. Each story runs `verify_story`'s gates, its lineage comparison included, with partial success (200 / 422 with `results`; a story's custody refusal is its `reason`). Key chosen as `verify_story` chooses it: `LOOPCTL_ORCH_KEY` exactly when set, else `LOOPCTL_API_KEY`; `exact_role: :orchestrator`, so a user or superadmin key is `403 insufficient_role`. `400` for an orchestrator key linked to no agent, `401 bulk_signature_unsupported` / `403 agent_enrollment_required` for an enrolled caller under the signed profile, `403 custody_tier_required`, `409 chg_root_cannot_verify`, `503 tenant_halted`. Refused locally: a bad batch, a non-UUID or repeated story id (loopctl keeps only the last entry), and a non-string `summary`/`review_type` or non-object `findings` (loopctl would verify and silently record no result). |
293
+ | `bulk_reject` | **Reject up to 50 reported stories at once** (`POST /api/v1/stories/bulk/reject`); each entry `{story_id, reason, review_type, findings}`, `reason` required. Each story runs `reject_story`'s gates with partial success (200 / 422 with `results`); a rejected story's claim is released and a delivery story re-contracted or escalated. Same key and role gate as `bulk_verify`. `400` for an orchestrator key linked to no agent, `403 custody_tier_required`, `409 chg_root_cannot_verify`, `500 audit_chain_append_failed` (the whole batch rolled back), `503 tenant_halted`. Refused locally: a bad batch, a non-UUID or repeated story id, a blank `reason`, and a non-string `reason`/`review_type` or non-object `findings`. |
275
294
 
276
295
  ### Token Efficiency Tools
277
296
 
@@ -433,6 +452,7 @@ nothing changes until a scope opts in.
433
452
  | `clear_local_only` | **WIDEN**: remove a scope's `local_only` marking. Requires your **user** key (`LOOPCTL_USER_KEY`) — deliberately not available to an agent or orchestrator, because clearing is the self-widening move an automated key must never make one call before a harvest. Audited with actor + scope. |
434
453
  | `declare_trusted_endpoint` | Declare a host you attest is YOUR OWN so a `local_only` scope can reach it. **This is an unverified tenant attestation, not network locality** — labelled as such everywhere. Three enforced constraints: PUBLIC addresses only (write time AND pin time), PURPOSE-SCOPED (`inference` / `webhook` / `ingest`), vendor hosts excluded. Carves nothing out of the SSRF denylist. Requires **user** key. |
435
454
  | `revoke_trusted_endpoint` | Revoke a declaration. Invalidation is IMMEDIATE and cluster-wide — a revoked declaration does not keep working for the remainder of the pin TTL. Requires **user** key. |
455
+ | `list_trusted_endpoints` | **List the tenant's declared trusted endpoints** (`GET /api/v1/egress/trusted-endpoints`) with their purposes and `locality_label`. Every entry is an unverified tenant attestation, not network locality. Any key (the route has no role plug), sent as the session's own. |
436
456
  | `egress_repin` | Recover from a `:pin_stale` error (your box got a new DHCP lease and the pinned address set changed — DISTINCT from `egress_blocked`). Re-resolves and re-pins the host. **Agent** key by design: requiring a human user-role write to recover would contradict loopctl's agent-native, no-UI design. |
437
457
  | `custody_claim` | The recorded **egress custody claim** for one article or memory row: the append-only sequence of per-operation postures (create, each embed, each re-embed, each classification, each merge) with the endpoints resolved for THAT operation and their verdicts, plus the aggregate. Rides the existing hash-chained audit log + signed tree heads — each entry carries a `chain_position` and the leaf's `chain_entry_hash`, so `GET /api/v1/audit/sth/{tenant_id}/inclusion/{position}` proves inclusion of *that* leaf, and the leaf's payload names this row by a recomputable `posture_digest`. THREE states, only one an attestation: `no_claim_recorded`, `claim_pending`, `claim_recorded` (`complete` / `partial_history` / `incomplete`). Completeness is measured against a persisted per-row high-water mark, so losing the tail of a sequence is a gap, not a clean claim. `third_party_egress_on_covered_paths` is `false` only for NETWORK-local endpoints; a tenant-declared (unverified) endpoint yields `"tenant_declared_unverified"`. Attests ONLY to the endpoints loopctl called on the paths in `coverage` — never to what those endpoints did afterwards. **Agent** key. |
438
458
  | `custody_failures` | Custody posture entries whose chain append was DROPPED after exhausting retries, plus `stale_pending` entries stranded by a flush that died outside its own final-attempt branch. Surfaced rather than silently absent: each `data` entry degrades its row's claim to `incomplete`, and a stranded entry would otherwise read as an in-flight claim forever. **Agent** key. |
@@ -471,6 +491,14 @@ Two modes, pinned at creation:
471
491
  | `corpus_status` | Per-`source_ref` chunk count and content hash, paginated — re-index only the documents that moved. Agent key. |
472
492
  | `corpus_delete` | **Requires `LOOPCTL_USER_KEY`.** Destroy a corpus and every chunk and vector in it. Irreversible and set-based, which is why it is the one user-role verb on this surface; the files were never uploaded, so recovery means re-creating and re-indexing. To drop chunks a document no longer contains, re-index it with `source_complete` instead. |
473
493
 
494
+ ### Audit and Change Feed Tools
495
+
496
+ | Tool | Description |
497
+ |---|---|
498
+ | `changes_since` | **Poll the change feed** (`GET /api/v1/changes`): the tenant's audit entries after a position, oldest first, with `has_more`, `next_cursor` and `next_since`. The first page needs `since` (ISO 8601); later pages take the previous `next_cursor` as `cursor` (drift-free; it wins over `since`). Optional `project_id` (id, slug or repo name), `entity_type`, `action`, `limit` (1..1000, default 1000). Any key, sent as the session's own; an agent-role key does not see entries for articles it cannot read. `400` without `since`/`cursor` (also refused locally), `400` for a bad `since` or a cursor not issued to this tenant, `422` for a `project_id` naming no project. States and metadata are untrusted session text. |
499
+ | `audit_log` | **Search the tenant audit log** (`GET /api/v1/audit`), newest first, with `old_state` and `actor_id`: filters `entity_type`, `entity_id`, `action`, `actor_type`, `actor_id`, `project_id`, `from`, `to`; paged by `page` and `page_size` (1..100, default 20). User role: `LOOPCTL_USER_KEY` verbatim when set, else the default key (`403 insufficient_role` for an agent or orchestrator key). `422` for a `project_id` naming no project. Refused locally: a non-UUID `entity_id`/`actor_id`, and a `from`/`to` that is not an ISO 8601 date-time with seconds and an offset, because loopctl drops a bound it cannot parse and answers the wider window. |
500
+ | `audit_inclusion_proof` | **Prove an audit entry is in the signed log** (`GET /api/v1/audit/sth/:tenant_id/inclusion/:position`): the merkle path from the entry at `position` to the signed tree head covering it (`leaf_index`, `leaf_hash`, `tree_size`, `audit_path`, `sth`). Public, sent with no key. `400 invalid_tenant_id`, `404` for a position with no entry, `409 not_yet_included` (no STH covers it yet), `429` past the per-IP proof budget. A non-UUID `tenant_id` or a `position` that is not a non-negative integer is refused locally. |
501
+
474
502
  ### Discovery Tools
475
503
 
476
504
  | Tool | Description |
@@ -578,6 +606,11 @@ Key distribution for the dispatch pattern (Epic 26): per-dispatch ephemeral keys
578
606
  | `intake_pause` | **Pause one intake source of a project** (`POST /api/v1/projects/:id/intake/pause`, US-52.33, US-54.4): that source's new issues stay `pending_triage` and get no triage. Optional `source_id` names the source; without it the pause acts on the project's primary (unlabelled) source, so a sibling source (e2e) keeps running. Stops promotion and triage ONLY: never in-flight work and never the webhook, which keeps recording. `reason` required; `intervention_id` generated when absent (a repeat writes nothing). `404 no_intake_source` (a `source_id` that is not a live source of this project, or no primary source), `403` on an agent-rooted tenant. Session's own key. |
579
607
  | `intake_resume` | **Resume one intake source of a project** (`POST /api/v1/projects/:id/intake/resume`, US-52.33, US-54.4): the minute promotion run picks up what arrived while paused. Same `source_id` default (the primary source), scope, refusals and idempotency as `intake_pause`. |
580
608
  | `api_key_create` | **Mint an API key** (`POST /api/v1/api_keys`, US-54.14) on `LOOPCTL_USER_KEY`. The raw key is written to `key_file` (absolute, must not exist, mode 0600) and is never in the result, which carries id, prefix, role, name and `snapshot_project_id`. `snapshot_project_id` mints a snapshot-scoped orchestrator key that authenticates only `POST /api/v1/projects/<id>/snapshots/urls` (401 everywhere else, sockets included); `422 invalid_snapshot_scope` for another role, an `agent_id` or another tenant's project. `403 insufficient_role` below user, `403 api_key_mint_forbidden` for a dispatch-minted caller. |
609
+ | `api_key_list` | **List the tenant's API keys** (`GET /api/v1/api_keys`): id, name, prefix, role, last use, expiry, revocation and `snapshot_project_id`, never a raw key. Revoked keys only with `include_revoked: true`. User role: `LOOPCTL_USER_KEY` verbatim when set, else the default key (`403 insufficient_role` below user). |
610
+ | `api_key_rotate` | **Rotate an API key** (`POST /api/v1/api_keys/:id/rotate`): a replacement with the old key's name, role, agent and scope; the old key expires `grace_period_hours` later (default 24, at most 168 — above that loopctl would clamp silently, so it is refused locally). The new raw key goes to `key_file` exactly as `api_key_create`'s does, never into the result. User role on a key no dispatch minted: `403 insufficient_role` below user, `403 api_key_mint_forbidden` for a dispatch-minted caller. `404` for another tenant's key, `422` for a revoked key or a runner's key. |
611
+ | `register_agent` | **Register this key's agent** (`POST /api/v1/agents/register`): creates an agent `name` of `agent_type` (orchestrator or implementer), optional `metadata`, and links the CALLING key to it. Sent on the session's own key: `exact_role: :agent`, so an orchestrator, user or superadmin key is `403 insufficient_role`. `409` when the key already has an agent (a holder credential always does), `422` for a missing field, a taken name, or a name starting `system:`. |
612
+ | `list_agents` | **List the tenant's agents** (`GET /api/v1/agents`), filtered by `agent_type` and `status`, sorted by `sort_by`, paged by `page`/`page_size` (1..100). Orchestrator role or higher: `LOOPCTL_ORCH_KEY` verbatim, else `LOOPCTL_USER_KEY`, else the default key (`403 insufficient_role` for an agent key). An unknown filter or sort, or a bad page, is refused locally: loopctl drops it and would answer every agent. |
613
+ | `get_agent` | **Read one agent** (`GET /api/v1/agents/:id`). Orchestrator role or higher, keyed as `list_agents`. `404` for another tenant's agent; a non-UUID `agent_id` is refused locally. |
581
614
  | `snapshot_urls` | **Presigned URLs for build snapshot objects** (`POST /api/v1/projects/:id/snapshots/urls`, US-52.57): one URL per name, valid 900 s, for `<tenant_id>/<project_id>/<name>` in loopctl's snapshot bucket; a name is `index/<40 lowercase hex>.json` or `<64 lowercase hex>.tar.zst`, 1 to 64 per call. `op: "get"` on the session's agent key; `op: "put"` on `LOOPCTL_ORCH_KEY` (an agent key is `403 insufficient_role`), each PUT URL signing `if-none-match: *` so a published object is never overwritten, and audited. `422 invalid_snapshot_object` / `invalid_snapshot_op`, `404` for another tenant's project, `403 custody_tier_required` on an agent-rooted tenant, `503 snapshot_store_unconfigured`. |
582
615
  | `work_item_requeue` | **Requeue a work item** (`POST /api/v1/stories/:id/requeue`, US-52.32): an escalated item goes back to `queued` over this holder's resolution edge (`409 self_resolve_blocked` / `review_missing_unreviewed` as for `resolve_escalation`); an in-flight item is released, uncounted, its dispatch revoked, and re-contracted. Any other stage is `409 not_requeueable`. The linked issue is not touched. |
583
616
  | `work_item_retriage` | **Re-triage a work item** (`POST /api/v1/stories/:id/retriage`, US-52.32): an item no implementer touched, at `escalated` or `queued`, goes back to `detected`; its triage is discarded and its triage dispatches superseded. `409 not_retriageable` names what a touched item holds, or the stage. The linked issue is not touched. |
@@ -586,6 +619,8 @@ Key distribution for the dispatch pattern (Epic 26): per-dispatch ephemeral keys
586
619
  | `work_item_open` | **Open the work item for a branch** (`POST /api/v1/work_items`, US-52.18): `repo_url` and `branch`, optional `title` (default: the branch), `base_branch` (US-54.2: the branch the work merges into; selects the project's live intake source with exactly that base branch and records it as the item's source; omitted, the item belongs to the project's primary, unlabelled source) and `epic_id` (default: that source's target epic). Creates one story already implementing and held by this session, with a stage row naming the branch; the MCP server also does it on each heartbeat for the worktree's non-default branch, once per branch per holder. That heartbeat open sends `base_branch` only from the environment variable `LOOPCTL_BASE_BRANCH` when not blank (US-54.9), and otherwise omits it; nothing is guessed from the checkout, and a worktree on that base branch opens nothing. Reopening your own item, or an unheld one, returns it (200). A branch with no open item whose most recent item ended at `done` while held by your holder answers that item (`200`, outcome `finished`) and creates nothing (another holder's finished item gets you a new item of your own), and the heartbeat stops opening that branch for the life of the process; `new_item: true` opens the next item for new work on that branch name. Needs this session's holder credential: `403 holder_credential_required` otherwise. `409 branch_held` (another session's open item has the branch), `409 holder_ended`, `409 holder_lease_expired`, `409 story_held`, `409 base_branch_mismatch` (the branch's open item merges into another base branch), `404 project_not_found`, `404 epic_not_found`, `422 no_source_for_base` (no live source of the project merges into `base_branch`), `422 no_target_epic` (pass `epic_id`), `422 invalid_branch` / `invalid_base_branch`. The item ends with no second session and no human: a MERGE of the branch's pull request ends it at `done` as the system actor (`:pr_merged`, naming the PR and merge sha); with no pull request, its holder ends it with `work_item_close` and `evidence` (`done` over `:self_closed`). Neither verifies it. |
587
620
  | `inbox` | **Read this session's inbox** (`GET /api/v1/inbox`, US-52.24): `dms`, `threads` (each held story with unread messages; a story taken over arrives from its first message) and, with `project_id`, `channel`, each above the session's stored cursor, with `last_seq` per section and `has_more`. `limit` defaults to 50, at most 200, DMs first. The cursor moves only on ack, so an unacked message is returned again: `ack` (a list of `{kind, id, seq}`, kind `dm`/`story`/`channel`, seq a `last_seq` a read returned) is posted first (`POST /api/v1/inbox/ack`), then the inbox is read, and the answer carries `acked`. A refused batch moves no cursor: `422 ack_beyond_end`, `422 not_in_inbox`, `422 invalid_ack`. Needs this session's holder credential: `403 holder_credential_required` otherwise. The answer carries `journal` (US-52.62, read locally, present even when loopctl does not answer): `{pending, oldest_recorded_at, last_fenced}`, what this session still owes loopctl from an outage and the entries of its last replay that came back fenced. |
588
621
  | `revoke_dispatch` | **Revoke a dispatch AND ITS WHOLE SUBTREE** (`POST /api/v1/dispatches/:id/revoke`), plus the ephemeral api_key each one minted — the revoke matches the dispatch OR any row carrying it in `lineage_path`, so name a LEAF unless you mean the subtree. Reach for it when a dead session's key is blocking new work: an un-revoked key OCCUPIES its agent's slot in the partial unique index `api_keys_one_role_per_agent_idx` (`(tenant_id, agent_id, role)` WHERE `revoked_at IS NULL`), which cannot also test `expires_at` — a partial-index predicate must be IMMUTABLE and `now()` is STABLE — so even an EXPIRED key holds it and the next mint answers `422 agent already has an active key with this role`. Waiting works too, slowly: the expired-dispatch sweep runs every minute and the expired-api-key sweep every five, so the slot clears at the TTL (four hours for a placement session dispatch). For a PARKED STORY prefer `force_unclaim_story`, which revokes that story's own session dispatch and frees the stage as well. It does NOT clear `implementer_dispatch_id`: that is custody provenance, and a revoked dispatch still resolves, so verify/report/review-complete compare the same lineage afterwards. `role: :orchestrator` WITH the hierarchy (orchestrator, user or superadmin all pass; an agent key is `403 insufficient_role`), so no env var is pinned — `LOOPCTL_USER_KEY` is merely PREFERRED, for the ceiling reason next. `403 dispatch_outside_caller_lineage` when the target is not in your lineage — a dispatch may only be revoked by a caller it descends from, because the revoke cascades; the body carries `remediation.your_dispatch_id`, and the tenant's `user`-role operator key may revoke anywhere in its tenant. `403 unlineaged_revoke_forbidden` when your key was minted by no dispatch and is below `user` role — a legacy `LOOPCTL_ORCH_KEY` is exactly that, and with no lineage there is no subtree that would bound a cascading revoke, so it could otherwise revoke the tenant's root; use the operator key, or `force_unclaim_story` for a parked story, or mint a dispatch under an active parent and revoke from inside that lineage. `403 custody_tier_required` on an agent-rooted tenant, `503 tenant_halted` under a custody halt, 404 for an unknown dispatch or another tenant's. Idempotent: an already-revoked dispatch answers 200 with `revoked_count: 0` and its ORIGINAL `revoked_at`. Required: `dispatch_id` (refused locally if it is not a UUID). |
622
+ | `dispatch_list` | **List the tenant's dispatches** (`GET /api/v1/dispatches`), newest first, each with its `lineage_path`, `role`, `expires_at` and `revoked_at`, plus `meta.total_count`. Optional `role` (agent, orchestrator, user), `active_only` (unrevoked and unexpired), `limit` (1..100, default 50), `offset`. Any key, sent as the session's own; a custody halt does not block it. Bad filters are refused locally (loopctl would drop a bad number silently). |
623
+ | `dispatch_get` | **Read one dispatch** (`GET /api/v1/dispatches/:id`) with its lineage, role, expiry and revocation; a revoked dispatch still answers. Any key, sent as the session's own. `404` for another tenant's dispatch; a non-UUID `dispatch_id` is refused locally. |
589
624
  | `register_custody_owner_key` | **LCP-1 §9.2.** Register/rotate the tenant custody OWNER key — the root of trust the attestation chain hangs from. Private half stays with you; requires `LOOPCTL_USER_KEY` and a human-anchored tenant. Required: `owner_pubkey` (hex). ROTATION additionally requires `rotation_proof` (from `custody_sign_owner_rotation`); first registration needs none. |
590
625
  | `list_enrolled_agent_keys` | **LCP-1 §9.1.1 transparency.** List the agent public keys enrolled under your tenant, reconstructed from the tamper-evident audit chain (not a mutable listing). Compare against the keys you generated; any excess is operator-minted. Keyset-paged (`limit`, `cursor`). |
591
626
  | `custody_generate_keypair` | **LCP-1 §9.** Generate an Ed25519 keypair LOCALLY (private key never leaves the process). Returns `public_key_hex` + `private_key_hex`. |
@@ -598,6 +633,8 @@ Key distribution for the dispatch pattern (Epic 26): per-dispatch ephemeral keys
598
633
  | `enroll_authenticator` | Step 2 of the WebAuthn trust-tier upgrade ceremony: completes enrollment with the attestation produced by `navigator.credentials.create()` against the challenge from `request_authenticator_challenge`. On a tenant's first enrollment the tenant is promoted to `human_anchored`. |
599
634
  | `request_authenticator_revoke_challenge` | Issues a fresh-assertion challenge to authorize revoking one of a tenant's enrolled WebAuthn authenticators. Requires an interactive WebAuthn client + human touch to produce the assertion `revoke_authenticator` needs. |
600
635
  | `revoke_authenticator` | Revokes an enrolled authenticator using the assertion from `request_authenticator_revoke_challenge` (`navigator.credentials.get()` against an existing authenticator — human touch required). Refuses (409 `last_authenticator`) when it would leave a human-anchored tenant with no authenticators. |
636
+ | `list_authenticators` | **List the tenant's enrolled authenticators** (`GET /api/v1/tenants/:id/authenticators`): `id`, `friendly_name`, `credential_fingerprint`, format and timestamps, never credential material. Confirm a revoke against the fingerprint: any user key can rewrite a label. No assertion needed. User key of THIS tenant: `LOOPCTL_USER_KEY` verbatim when set, else the default key (`403 insufficient_role` below user, `403` for another tenant's id). A non-UUID `tenant_id` is refused locally; an upper-case one is sent lower case. |
637
+ | `rename_authenticator` | **Relabel an authenticator** (`PATCH /api/v1/tenants/:id/authenticators/:auth_id`): only `friendly_name` (trimmed, not blank, at most 120 bytes); audited; no assertion needed. Keyed as `list_authenticators`. `400` without a string label, `404` for an unknown authenticator, `422 friendly_name_blank` / `friendly_name_invalid` / `friendly_name_too_long`, `429` past 300 renames an hour, `500` when the rename or its audit entry failed. Non-UUID ids and a blank or over-long label are refused locally. |
601
638
 
602
639
  ## Wiki Attribution
603
640