loopctl-mcp-server 3.46.1 → 3.47.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
@@ -327,6 +327,26 @@ Every webhook action is `role: :user` with the hierarchy: `LOOPCTL_USER_KEY` ver
327
327
  | `webhook_test` | user | **Send a test event** (`POST /api/v1/webhooks/:id/test`): one `webhook.test` delivery, even to an inactive subscription. `404` for another tenant's; a non-UUID id is refused locally. |
328
328
  | `webhook_deliveries` | user | **List a subscription's recent delivery attempts** (`GET /api/v1/webhooks/:id/deliveries`): status, attempts, error (HTTP status and content-type, never the response body); `page`/`page_size` (1..100, default 25). `404` for another tenant's; a non-UUID id or bad page is refused locally. |
329
329
 
330
+ ### Skill Tools
331
+
332
+ Skill writes (create, update, archive, new version, import) and `skill_cost_performance` are `role: :user` with the hierarchy: `LOOPCTL_USER_KEY` verbatim when set, else the default key (`403 insufficient_role` for an agent or orchestrator key); the writes are also `403 custody_tier_required` on an agent-rooted tenant, and `500 audit_write_failed` when the audit entry is refused (nothing is written). The other reads are `role: :agent`, sent as the session's own key. `skill_result_report` is `exact_role: [:orchestrator, :superadmin]`.
333
+
334
+ | Tool | Auth Key | Description |
335
+ |---|---|---|
336
+ | `skill_create` | user | **Create a versioned skill** (`POST /api/v1/skills`): `name` (unique per tenant and project), `prompt_text` (version 1), optional `description`, `project_id` (UUID, slug or repo name), `metadata`. `422` for a taken name, a blank prompt or an unresolvable project. Refused locally: a blank name or prompt, a non-string description, a blank project_id, non-object metadata. |
337
+ | `skill_list` | agent | **List skills** (`GET /api/v1/skills`) by name; filters `project_id`, `status` (active, archived), `name` (case-insensitive substring); `page`/`page_size` (1..100, default 20). Refused locally: a bad page (loopctl would clamp it), an unknown status, a blank filter. |
338
+ | `skill_get` | agent | **Read a skill** (`GET /api/v1/skills/:id`) with `current_prompt`. `404` for another tenant's; a non-UUID id is refused locally. |
339
+ | `skill_update` | user | **Edit a skill's metadata** (`PATCH /api/v1/skills/:id`): `description`, `status` (active un-archives), `metadata`; the prompt changes only by `skill_version_create`. `404` for another tenant's, `422` for a bad status. Refused locally: a non-UUID id, no field or a null one (loopctl would answer 200 unchanged), an unknown status, bad types. The `PUT` twin is served and unused. |
340
+ | `skill_delete` | user | **Archive a skill** (`DELETE /api/v1/skills/:id`): soft delete to status archived; versions and results stay. `404` for another tenant's; a non-UUID id is refused locally. |
341
+ | `skill_import` | user | **Bulk import skills** (`POST /api/v1/skills/import`): `skills`, each `{name, prompt_text, description?, project_id? (UUID only)}`. A new name is created, an existing one gets a new version when its prompt differs. All or nothing: `422` naming the bad item. Answers `{total, created, updated, unchanged}`. Refused locally: an empty or non-list `skills`, a non-object item. |
342
+ | `skill_version_create` | user | **Add a skill version** (`POST /api/v1/skills/:id/versions`): `prompt_text`, optional `changelog`, `created_by`; becomes `current_version`. `404` for another tenant's skill, `422` for a blank prompt. Refused locally: a non-UUID id, a blank prompt, non-string changelog or created_by. |
343
+ | `skill_versions` | agent | **List a skill's versions** (`GET /api/v1/skills/:id/versions`), oldest first, without prompt text. `404` for another tenant's; a non-UUID id is refused locally. |
344
+ | `skill_version_get` | agent | **Read one version** (`GET /api/v1/skills/:id/versions/:version`) with its prompt and a `cost_summary`. `404` for another tenant's. Refused locally: a non-UUID id, a version that is not a positive integer (loopctl would read "2abc" as 2). |
345
+ | `skill_stats` | agent | **Read a skill's performance per version** (`GET /api/v1/skills/:id/stats`): pass/fail/partial counts of the recorded results' verifications and metric averages. `404` for another tenant's; a non-UUID id is refused locally. |
346
+ | `skill_version_results` | agent | **List one version's recorded results** (`GET /api/v1/skills/:id/versions/:version/results`), newest first. `404` for another tenant's. Refused locally: a non-UUID id, a bad version. |
347
+ | `skill_cost_performance` | user | **Read a skill's cost per version** (`GET /api/v1/skills/:id/cost-performance`): invocations, total and average cost, verification rate, change against the previous version, `cost_regression`. User role, not human-anchored. `404` for another tenant's; a non-UUID id is refused locally. |
348
+ | `skill_result_report` | orch | **Record a skill result** (`POST /api/v1/skill_results`): `skill_version_id`, `verification_result_id`, `story_id` (UUIDs, all required) and optional `metrics`. `exact_role: [:orchestrator, :superadmin]`: `LOOPCTL_ORCH_KEY` verbatim when set, else `LOOPCTL_API_KEY`; a user or agent key is `403 insufficient_role`. `403 custody_tier_required` on an agent-rooted tenant, `422` for an id naming no row. Refused locally: a missing or non-UUID id, non-object metrics. |
349
+
330
350
  ### Knowledge Wiki Tools (agent key)
331
351
 
332
352
  **Which read tool?**
@@ -419,7 +439,7 @@ it is enforced server-side and a no-op for a non-superadmin key — see below.)
419
439
  | `recall_referenced` | Record which of the articles a recall SURFACED you actually USED — the third funnel stage (surfaced -> opened -> referenced), and the only one nothing else records. Pass the `meta.recall_id` from a `recall_context` response plus the ids you referenced -- the `article.id` of the `source: knowledge` items, since a `memory` item's id is not an article and is not referenceable; call it once, after writing your answer. Only ids THAT recall surfaced, in your own tenant, are accepted — anything else is `422` `not_surfaced` and NOTHING is written. Your key is stamped server-side, at most 50 ids per call, and repeats cannot inflate the metric (it counts distinct `(recall, article)` pairs). These rows are deliberately not reads: they never feed the heat index or any ranking. Required: `recall_id`, `article_ids`. Optional: `project_id`. |
420
440
  | `memory_graduate` | Graduate ONE of your long-term memories into a durable Knowledge Wiki article — the explicit, on-demand version of the hourly graduation sweep. Use when a private memory has proven valuable enough to become durable knowledge. **Visibility**: the graduated article stays **owner-visible** (`metadata.visibility: "owner"`, keyed to your subject) — discoverable by YOU, NOT peer-readable (graduation does not share a memory to teammates; `re_scope: "global"` widens only the project scope, not visibility). Scope is key-derived (you can only graduate your OWN memory; a foreign/unknown `memory_id` → 404). DEDUPED by the novelty gate: `data.verdict` is `created` (novel → published) or `gated_to_draft` (near-dup → review draft) with a new article (**201**), or `duplicate`/`deduplicated` (already represented → canonical article, nothing created) (**200**). By default the article inherits the memory's project scope; pass `re_scope: "global"` to promote a PROJECT memory to a tenant-wide article — only valid on its FIRST graduation, and only if the hourly sweep hasn't graduated it project-scoped first (`409` `already_graduated` otherwise). An already-graduated global memory re-graduates idempotently (**200**). `503` `gate_unavailable` if the embedding backend is down — retry later. Required: `memory_id`. Optional: `re_scope` (`inherit`\|`global`). |
421
441
 
422
- ### Knowledge Management Tools (orchestrator key)
442
+ ### Knowledge Management Tools (key per row)
423
443
 
424
444
  | Tool | Description |
425
445
  |---|---|
@@ -435,11 +455,35 @@ it is enforced server-side and a no-op for a non-superadmin key — see below.)
435
455
  | `knowledge_drafts` | List draft (unpublished) knowledge articles with pagination. Optional: `limit` (default 20, max 1000 — over-max → 400, no silent clamp), `offset` (default 0), `project_id`. Returns `meta.total_count`. |
436
456
  | `knowledge_lint` | Run a lint check on the knowledge wiki to identify stale or low-coverage articles. Optional: `project_id`, `stale_days`, `min_coverage`, `max_per_category` (default 50, max 500). True totals returned in `summary.total_per_category`. |
437
457
  | `knowledge_consolidation` | Read the nightly consolidation ("dream") report: NUMBERED proposals for reconciling the corpus, each naming the articles involved and quoting an excerpt from each as evidence. **This tool** applies nothing and recomputes nothing — it returns persisted rows. **The pass** it reports on does write: since #608 the nightly run UNPUBLISHES the losers of each `duplicate_capture` group that two consecutive reports both propose (consecutive meaning the previous report is at most 2 days older, so one skipped nightly run is tolerated and a longer outage is not). That is its only write to `articles`, it is an unpublish and never an archive (archive is terminal for an article), and it still writes no links or conflict resolutions. Classes: `duplicate_capture` (titles that collide once case/punctuation normalize away, or idempotency keys that collide under the same normalization while differing verbatim — capture tag-format drift, which the novelty gate does not catch because novelty scoring and idempotency are separate paths), `generic_title` (a placeholder title that collides on active-title uniqueness and blocks hub creation). Two classes are **RETIRED** (#605) and no longer produced, though the `class` filter still accepts them so historical reports stay readable: `contradiction_candidate` (the nightly lint judges those pairs itself now) and `stale_entry` (age is not a defect signal — for stale articles call `knowledge_lint`, which computes them with a caller-chosen `stale_days`). **Denominators:** `corpus_size` = PUBLISHED articles owned by the tenant at scan time, not its total article count; `proposal_count` = the TRUE pre-cap count of PROPOSALS, not of articles (one duplicate group of three articles is ONE proposal, and one article can appear in proposals of several classes); `persisted_count` = proposal ROWS the report carries, lower than `proposal_count` exactly when a class hit `max_per_class` (`truncated` flags which); `meta.total_count` counts persisted proposals matching the `class` filter, so it is bounded by `persisted_count`, never `proposal_count`. `review_status`/`reviewed_by`/`reviewed_at` are vestigial — nothing reads them to decide anything, there is no approve/reject surface and there will not be one (#605 supersedes #594); auto-apply is gated on reversibility and two-run agreement. They still reset to pending/null whenever the nightly pass re-derives a proposal, so refreshed machine output never inherits an earlier verdict. Requires orchestrator role. Optional: `day` (ISO8601, default most recent report), `class`, `limit` (default 50, max 500), `offset`. |
438
- | `knowledge_export` | Export all knowledge articles as an OKF v0.1 bundle (gzipped tar archive, unbounded, bounded-memory streaming, fail-closed). Returns a curl command for direct download — **the download requires `LOOPCTL_USER_KEY`** (an orchestrator key would 403). Pass `format=json` for buffered in-memory JSON (convenience tool for file writers; capped at `export_max_buffered_export_articles` — returns 413 if over-cap). Optional: `project_id`, `format` (`tar.gz` default or `json`). |
458
+ | `knowledge_export` | Download the published wiki as an Obsidian-layout gzipped tar (`GET /api/v1/knowledge/export`, or the project-scoped route with `project_id`, which adds that project's articles to the tenant-wide ones) to `out_file` (absolute, must not exist; created 0600). Fail-closed: the saved archive is decompressed to the end and DELETED, reported as truncated, when its gzip trailer or tar end-of-archive is missing or the download breaks off. **User role** (`LOOPCTL_USER_KEY` verbatim when set); agent or orchestrator key 403 `insufficient_role`; 429 over the concurrent-export cap. For the OKF bundle use `knowledge_okf_export`. Required: `out_file`. Optional: `project_id`. |
439
459
  | `knowledge_ingest` | Submit a URL or raw content for knowledge extraction. Enqueues an Oban job. Extracted articles are **drafts by default** (lower-trust LLM output); pass `publish: true` to publish on extraction. **BYO:** runs on the tenant's own Anthropic key — a keyless tenant gets a 422 whose result leads with an `ACTION REQUIRED` notice pointing at `set_llm_config` (see [First-time setup](#first-time-setup--provision-your-byo-llm-keys)). Required: `source_type`. One of: `url` or `content`. Optional: `project_id`, `publish`. |
440
460
  | `knowledge_ingest_batch` | Submit up to 50 ingestion items in a single request. Each item has the same shape as `knowledge_ingest` (incl. `publish`). Returns per-item results. Required: `items`. Optional: batch-level `project_id` / `publish` defaults. |
441
461
  | `knowledge_ingestion_jobs` | List recent content ingestion jobs (last 7 days, max 50). |
442
462
 
463
+ ### Entity, UI Test, Export and Article Link Tools (key per row)
464
+
465
+ Each row names the key it sends; an entity definition is a security root and needs a user key on a human-anchored tenant.
466
+
467
+ | Tool | Description |
468
+ |---|---|
469
+ | `entity_list` | List the tenant's Context Retriever entity definitions (`GET /api/v1/entities`): each `name`, `backing_source` and declared `fields`, the definitions the `cr_*` tools are generated from. Any key (agent role); this session's own key. |
470
+ | `entity_get` | Read one entity definition (`GET /api/v1/entities/:id`). Agent role, this session's own key. 404 for another tenant's. Required: `entity_id` (UUID). |
471
+ | `entity_create` | Define a Context Retriever entity (`POST /api/v1/entities`): `name`, `backing_source` (projects, stories or epics), `fields` (`{name, type, filterable, searchable}`). A SECURITY ROOT: its fields are the executor's allowlist, bounded by loopctl's own per-source column allowlist. **User role on a human-anchored tenant**, sent on `LOOPCTL_USER_KEY` verbatim when set: agent or orchestrator key 403 `insufficient_role`, agent-rooted tenant 403 `custody_tier_required`; 422 for a column the source does not allowlist or `entity_limit`. |
472
+ | `entity_update` | Edit an entity definition (`PATCH /api/v1/entities/:id`): any of `name`, `backing_source`, `fields`; re-validated against the allowlist. Keyed and gated as `entity_create`; 404 for another tenant's. A call naming no field is refused locally (loopctl would answer 200 unchanged). Required: `entity_id`. |
473
+ | `entity_delete` | Delete an entity definition (`DELETE /api/v1/entities/:id`); its `cr_*` tools stop being generated. Keyed and gated as `entity_create`. Required: `entity_id`. |
474
+ | `ui_test_start` | Start a UI test run (`POST /api/v1/projects/:project_id/ui-tests`) following `guide_reference`. Agent role, this session's own key; 422 `kb_project_no_work` on a knowledge-only project. Required: `project_id` (UUID, slug or repo name), `guide_reference`. |
475
+ | `ui_test_list` | List a project's UI test runs, newest first (`GET /api/v1/projects/:project_id/ui-tests`). Agent role. Optional: `status` (in_progress, passed, failed, cancelled), `limit` (default 20), `offset`. Required: `project_id`. |
476
+ | `ui_test_get` | Read one UI test run with its findings (`GET /api/v1/projects/:project_id/ui-tests/:id`). Agent role; 404 for another tenant's run. Required: `project_id`, `run_id` (UUID). |
477
+ | `ui_test_add_finding` | Record a finding on an in-progress run (`POST .../ui-tests/:id/findings`): any of `step`, `severity` (critical, high, medium, low), `type`, `description`, `screenshot_path`, `console_errors`. Agent role; 422 once the run is completed. Required: `project_id`, `run_id`. |
478
+ | `ui_test_complete` | Close a run (`POST .../ui-tests/:id/complete`) with `status` passed or failed and a `summary`. Agent role; 422 when already completed. Required: `project_id`, `run_id`, `status`, `summary`. |
479
+ | `project_export` | Export a project's work breakdown as JSON (`GET /api/v1/projects/:id/export`), the shape `import_stories` takes back. Optional `out_file` (absolute, must not exist) writes it to disk and returns counts. Agent role, this session's own key. Required: `project_id` (a UUID: this route does not resolve a slug). |
480
+ | `corpus_get` | Read one corpus (`GET /api/v1/corpora/:id`): `mode`, `dim`, slug, project and `status.has_sources`. Agent role, this session's own key. Required: `corpus_id` (id or slug). |
481
+ | `knowledge_project_usage` | One project's wiki usage (`GET /api/v1/knowledge/analytics/projects/:id/usage`): reads, unique articles and callers, access types, top articles, a daily series. **Orchestrator role or above** (`LOOPCTL_ORCH_KEY`, else `LOOPCTL_USER_KEY`, verbatim when set); agent key 403 `insufficient_role`. Optional: `since_days` (1..365, default 7), `limit` (1..100, default 20). Required: `project_id` (UUID). |
482
+ | `knowledge_pipeline` | Self-learning pipeline status (`GET /api/v1/knowledge/pipeline`): pending extractions, recent drafts, publish rate, extraction errors, auto-extract setting. **Orchestrator role or above**, keyed as `knowledge_project_usage`. |
483
+ | `knowledge_link_create` | Link two articles (`POST /api/v1/article_links`): `source_article_id`, `target_article_id`, `relationship_type` (relates_to, derived_from, contradicts, supersedes), optional `metadata`. Agent role on this session's own key, EXCEPT `supersedes`, which retires its target and needs a user key (`LOOPCTL_USER_KEY` verbatim when set; 403 otherwise). `potential_conflict` is system-only (422). |
484
+ | `knowledge_link_delete` | Delete an article link (`DELETE /api/v1/article_links/:id`). **User role** (`LOOPCTL_USER_KEY` verbatim when set); agent or orchestrator key 403 `insufficient_role`. Required: `link_id` (UUID). |
485
+ | `knowledge_links` | List an article's outgoing and incoming links with the linked articles (`GET /api/v1/articles/:article_id/links`), scoped to what the key may see. Agent role. Required: `article_id` (UUID). |
486
+
443
487
  ### Per-tenant BYO LLM config + usage (Epic 28, #179)
444
488
 
445
489
  | Tool | Description |