loopctl-mcp-server 2.90.0 → 2.91.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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.js +25 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -342,7 +342,7 @@ it is enforced server-side and a no-op for a non-superadmin key — see below.)
342
342
  | `memory_list` | List your own long-term memories, newest first, paginated with `meta.total_count/limit/offset` (the true scoped count, never silently capped by `limit`). Optional: `limit`, `offset`, `include_superseded`, `all_subjects` (superadmin only; ignored for non-superadmin keys). |
343
343
  | `memory_forget` | Delete one of your own long-term memories by id. A foreign-subject, foreign-tenant, or unknown id returns 404 (no existence leak). Required: `id`. |
344
344
  | `memory_promote` | Call at session end to compile this session's short-term (`session`-tier) memory into durable `long_term` memory — unlike `memory_remember` (a single explicit write), this compiles the whole session in one shot; fire it once at session end, not per turn. Returns 202 with `{session_id, status: "enqueued"}` — promotion runs asynchronously, so the resulting memory is recallable via `memory_recall` only after the worker drains. You can only promote your own sessions (scope resolved server-side from your key). Required: `session_id`. |
345
- | `recall_context` | ONE round-trip returning the re-ranked `global ∪ active-project` union of long-term MEMORY **and** KNOWLEDGE for `query` — what you previously assembled by calling `memory_recall` and `knowledge_search` separately. Pass `project_id` (from `resolve_project`) to merge global with that project on both sides; absent → global-only. The knowledge half is combined-search *summaries* (not full bodies — use `knowledge_context` for those). Response carries merged `results` (each tagged `source: memory\|knowledge`) plus the untouched per-source `memory`/`knowledge` envelopes; `meta.degraded?` flags a one-sided degrade (the other side is still returned — never a 500). Each per-source envelope's `meta.ann_iterative_scan` describes only THAT half's vector read, and the two are resolved independently, so they may differ. A blank query, or one over 500 chars, is a `422` up front. Required: `query`. Optional: `project_id`, `limit`. The top-level `meta.outcome` classifies the whole endpoint and the `memory` envelope carries its own; `meta.degraded_reason` names the strongest-remedy half when both degrade, and `meta.search_mode` names the lane that half actually served (`keyword_only`) or is `null` when it served nothing. Response also carries a SELECTION LEDGER: per item `rank`, `selection_reason` (`keyword`\|`semantic`\|`keyword+semantic`\|`keyword_fallback` for knowledge, `semantic`\|`ilike_fallback` for memory) and `tokens_estimate` (bytes/4, an estimate); in `meta`, `recall_id`, `candidates_considered`, `selected_count`, `tokens_selected`, `tokens_candidates`, `tokens_saved_vs_candidates`. The merged order is deterministic (score DESC, then source, then id), so an unchanged corpus renders a byte-identical `data` array — cache that, not the whole response, since `meta.recall_id` is new on every call. Keep `meta.recall_id` for `recall_referenced`. |
345
+ | `recall_context` | ONE round-trip returning the re-ranked `global ∪ active-project` union of long-term MEMORY **and** KNOWLEDGE for `query` — what you previously assembled by calling `memory_recall` and `knowledge_search` separately. Pass `project_id` (from `resolve_project`) to merge global with that project on both sides; absent → global-only. The knowledge half is combined-search *summaries* (not full bodies — use `knowledge_context` for those). Response carries merged `results` (each tagged `source: memory\|knowledge`) plus the untouched per-source `memory`/`knowledge` envelopes; `meta.degraded?` flags a one-sided degrade (the other side is still returned — never a 500). Each per-source envelope's `meta.ann_iterative_scan` describes only THAT half's vector read, and the two are resolved independently, so they may differ. A blank query, or one over 500 chars, is a `422` up front. Required: `query`. Optional: `project_id`, `limit`. The top-level `meta.outcome` classifies the whole endpoint and the `memory` envelope carries its own; `meta.degraded_reason` names the strongest-remedy half when both degrade, and `meta.search_mode` names the lane that half actually served (`keyword_only`) or is `null` when it served nothing. Response also carries a SELECTION LEDGER: per item `rank`, `selection_reason` (`keyword`\|`semantic`\|`keyword+semantic`\|`keyword_fallback` for knowledge, `semantic`\|`ilike_fallback` for memory) and `tokens_estimate` (bytes/4, an estimate); in `meta`, `recall_id`, `candidates_considered`, `selected_count`, `tokens_selected`, `tokens_candidates`, `tokens_saved_vs_candidates`. The merged order is deterministic (score DESC, then source, then id), so an unchanged corpus renders a byte-identical `data` array — cache that, not the whole response, since `meta.recall_id` is new on every call. Keep `meta.recall_id` for `recall_referenced`. DIVERSITY (#792): the knowledge half is over-fetched and then reduced, so two near-copies cannot spend two of your slots — an article already shown to this `session_id` is skipped, exact content-hash duplicates collapse, a candidate too similar to one already SELECTED is dropped, and every freed slot is REFILLED rather than left empty. `meta.diversity` reports each count; `meta.candidates_considered.knowledge` is the over-fetched pool and `meta.knowledge_count` is what survived. Selection changes WHAT you get, never the order. Optional `session_id`: an opaque per-session token (max 200 bytes) — pass the same value on every recall in a session to get containment-in-history; it is not an isolation boundary and a miss just re-surfaces an article. |
346
346
  | `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`. |
347
347
  | `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`). |
348
348
 
package/index.js CHANGED
@@ -1928,7 +1928,7 @@ async function memoryRecall({ query, limit, include_superseded }) {
1928
1928
  return withRemediationNotice(result);
1929
1929
  }
1930
1930
 
1931
- async function recallContext({ query, project_id, limit }) {
1931
+ async function recallContext({ query, project_id, limit, session_id }) {
1932
1932
  // Merged recall (#411 Gap 2): ONE round-trip returning the re-ranked
1933
1933
  // global ∪ active-project union of long-term MEMORY and KNOWLEDGE. Scope
1934
1934
  // (tenant_id/subject_id) is derived server-side from the agent key; project_id is
@@ -1936,6 +1936,10 @@ async function recallContext({ query, project_id, limit }) {
1936
1936
  const payload = { query };
1937
1937
  if (project_id) payload.project_id = project_id;
1938
1938
  if (limit != null) payload.limit = limit;
1939
+ // #792: the containment-in-history key. Opaque and client-chosen; the server keys its
1940
+ // shown-set on (tenant, subject, session, article) — both server-derived halves of the
1941
+ // memory scope ahead of the token — so it is never an isolation boundary.
1942
+ if (session_id) payload.session_id = session_id;
1939
1943
 
1940
1944
  const result = await apiCall(
1941
1945
  "POST",
@@ -5643,7 +5647,13 @@ const TOOLS = [
5643
5647
  "the whole response, since `meta.recall_id` is new on every call. KEEP " +
5644
5648
  "`meta.recall_id`: after you " +
5645
5649
  "answer, pass it to recall_referenced with the ids you actually used — that is the " +
5646
- "third funnel stage and nothing else records it.",
5650
+ "third funnel stage and nothing else records it. DIVERSITY (#792): the knowledge " +
5651
+ "half is over-fetched and then reduced, so two near-copies cannot spend two of your " +
5652
+ "slots — an article already shown to this `session_id` is skipped, exact " +
5653
+ "content-hash duplicates collapse, a candidate too similar to one already selected " +
5654
+ "is dropped, and every freed slot is REFILLED rather than left empty. " +
5655
+ "`meta.diversity` reports each count. Selection changes WHAT you get, never the " +
5656
+ "order, so the deterministic `data` array above still holds.",
5647
5657
  inputSchema: {
5648
5658
  type: "object",
5649
5659
  properties: {
@@ -5663,6 +5673,19 @@ const TOOLS = [
5663
5673
  description:
5664
5674
  "Optional: overall merged page size, clamped to [1, 50] (default 10).",
5665
5675
  },
5676
+ session_id: {
5677
+ type: "string",
5678
+ description:
5679
+ "Optional: an opaque token for THIS session (max 200 bytes). Pass the same " +
5680
+ "value on every recall in a session and the server skips articles it already " +
5681
+ "showed you, refilling the freed slot with the next distinct candidate — " +
5682
+ "which a client-side filter cannot do. It can never starve you: once a " +
5683
+ "session has exhausted the matching pool the highest-ranked repeats come " +
5684
+ "back, so an empty knowledge half always means the corpus, never the " +
5685
+ "suppression. Not an isolation boundary (history is keyed on tenant + " +
5686
+ "subject + session + article) and best-effort: a miss just re-surfaces an " +
5687
+ "article. Omit it to disable containment for that call.",
5688
+ },
5666
5689
  },
5667
5690
  required: ["query"],
5668
5691
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loopctl-mcp-server",
3
- "version": "2.90.0",
3
+ "version": "2.91.0",
4
4
  "description": "MCP server for loopctl — structural trust for AI development loops",
5
5
  "type": "module",
6
6
  "main": "index.js",