@theronap/cortex-mcp 0.9.109 → 0.9.110

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 (2) hide show
  1. package/lib/server.mjs +52 -7
  2. package/package.json +1 -1
package/lib/server.mjs CHANGED
@@ -501,11 +501,45 @@ export async function runServer(version) {
501
501
  },
502
502
  )
503
503
 
504
+ // ── WHY THIS TOOL IS STILL CALLED `gate2_status` WHEN IT IS NO LONGER A GATE STATUS ────────────
505
+ //
506
+ // It measures a standing attribution watch now, not a gate, and the honest name would be something
507
+ // like `unattributed_revision_alarm`. Renaming it is a COMPATIBILITY EVENT and the trade is not
508
+ // close:
509
+ //
510
+ // • `gate2_status` is live on BOTH dist-tags: 0.9.107 @stable and 0.9.109 @latest, checked
511
+ // 2026-08-25. Every desktop-wired seat follows @stable, which deliberately LAGS for soak — so a
512
+ // rename does not reach those seats when this merges, it reaches them whenever someone
513
+ // publishes AND THEN promotes, two manual steps apart. Until then a renamed tool is simply
514
+ // ABSENT from their tool list, and a caller that asks for it gets "unknown tool".
515
+ // • That trades a misleading sentence for a hard failure. The misleading sentence is fixable from
516
+ // here — the strings below are recomputed on every call — while the missing tool is not fixable
517
+ // from here at all.
518
+ // • Registering BOTH names is worse, not a compromise: two tools that do the same thing sit in
519
+ // every seat's tool list forever, and every future reader has to work out which is which. This
520
+ // server has no aliasing primitive, so "aliasing" means literally two `registerTool` calls.
521
+ // • And the rename would not fix the actual defect. What seeded the two-day misdiagnosis on
522
+ // 2026-08-22 was this tool's DESCRIPTION — measurably wrong in both its op set ("absorb, retier,
523
+ // replace" when the counted ops were delete/retier/system) and its date ("since the 2026-08-17
524
+ // fix" when `since` reports the 2026-08-20 anchor). Nobody was misled by the six characters
525
+ // `gate2_`. A wrong description under a new name is still a wrong description.
526
+ //
527
+ // So: name pinned, prose replaced. This is the same call `gate3_status` made on 2026-08-24 (3f8df6a)
528
+ // for the same reason, and the route path `/api/gates/2/status` is pinned for the same reason on
529
+ // the other side of the wire — see web/app/api/gates/2/status/route.ts.
530
+ //
531
+ // ⚠ NO THRESHOLD LANGUAGE, NO CLOSURE LANGUAGE. Gate 2 CLOSED 2026-08-25 on ENUMERATION
532
+ // (`page_history_managed_writers_test.ts` discovers all 18 brain_documents DML sites and fails the
533
+ // build on a nineteenth), NOT on the session counter this tool used to report. That counter is
534
+ // retired. It was not merely stuck: measured against prod 2026-08-25 it stood at 2 of its 3
535
+ // required sessions and was CLIMBING, because PR #713's newly-managed routes write counted ops with
536
+ // real sessions — so one more ordinary edit would have had this tool inviting a human to close a
537
+ // gate that had been closed for days. Exactly gate 3's failure, three days later.
504
538
  server.registerTool(
505
539
  'gate2_status',
506
540
  {
507
- title: 'Gate 2 edit-accountability monitor',
508
- description: 'Read the aggregate-only Gate 2 status for this brain whether every edit records WHICH SESSION made it. It counts only the REPAIRED write paths (absorb, retier, replace) since the 2026-08-17 fix, because the author path was never broken and would certify a repair it never exercised. Operator and migration writes are excluded: they legitimately have no session, and imputing one would violate the 0093 don\'t-impute rule. It never exposes page titles, refs, reasons or session keys. "regressed" means a repaired path lost its session attribution again and the gate must NOT be closed; "machine_evidence_ready" means enough ordinary-work evidence has accumulated to request a human closure decision.',
541
+ title: 'Unattributed-revision alarm (NOT a gate status — gate 2 is CLOSED)',
542
+ description: 'Read the aggregate-only unattributed-revision alarm for this brain: how many MCP-authored page revisions in the window carry NO session key, i.e. record an edit without recording WHICH SESSION made it. It spans EVERY mcp op, `author` included scoping it to the "repaired" paths would let it go all-clear while attribution died on the path doing ~98% of the writing. Operator and migration writes are excluded: they legitimately have no session, and imputing one would violate the 0093 don\'t-impute rule. Aggregate-only — it never exposes page titles, refs, reasons or session keys. IT IS NOT A GATE STATUS AND DECIDES NOTHING. Gate 2 CLOSED for v1 on 2026-08-25, on ENUMERATION of all 18 brain_documents DML sites, and the session counter this tool used to report was retired the same day as a named residual — it had begun measuring a threshold nothing was waiting on. What this alarm IS: one of the two things the closure names as able to REOPEN gate 2. So "regressed" means attribution is being dropped again — find the writer. Gate state lives on [[Agnoclast v1 — the currency gate]]; read that page, not this tool, to learn where a gate stands.',
509
543
  inputSchema: {
510
544
  days: z.number().optional().describe('rolling window in days (1-90, default 14)'),
511
545
  brain: z.string().optional().describe('brain name or org id when you belong to more than one brain; omit for a sole brain'),
@@ -522,11 +556,22 @@ export async function runServer(version) {
522
556
  throw new Error(classify(res.status, res.headers.get('content-type'), body, res.headers.get('x-vercel-id')).message)
523
557
  }
524
558
  const status = await res.json()
525
- const text = status.status === 'regressed'
526
- ? `\u26a0 Gate 2 has REGRESSED: ${status.unattributedMcpRevisions} MCP-authored revisions since ${status.since} carry NO session (${status.unattributedRepairedRevisions} of them on the repaired absorb/retier/replace paths). Attribution is being dropped again — do not close this gate; find the writer.`
527
- : status.machineEvidenceReady
528
- ? `Gate 2 machine evidence is ready: ${status.repairedPathSessions} distinct sessions exercised the repaired write paths across ${status.repairedPathRevisions} revisions since ${status.since}, and NONE lost its session. A human should confirm these were ordinary work before closing the gate.`
529
- : `Gate 2 is still collecting evidence: ${status.repairedPathSessions}/${status.requiredRepairedPathSessions} distinct sessions have exercised the repaired write paths (absorb/retier/replace) since ${status.since}, across ${status.repairedPathRevisions} revisions, 0 unattributed. No gate decision has been made.`
559
+ // A tool ahead of its deployment must SAY SO rather than render `undefined`. `mcpRevisions` is
560
+ // new with the alarm; an older deployment of /api/gates/2/status does not send it. #693 is the
561
+ // standing lesson (0.9.104 shipped a tool against an unmerged route and was withdrawn) — the
562
+ // package and the web deploy move independently, so this skew is a real state, not a hypothetical.
563
+ const text = status.mcpRevisions === undefined
564
+ ? `This tool is newer than the deployment it is talking to: /api/gates/2/status still returns the retired gate-2 closure counter, not the unattributed-revision alarm. Its verdict field says "${status.status}". Do NOT read that as a gate status — gate 2 closed 2026-08-25 on enumeration. Re-check once the console has redeployed.`
565
+ : status.status === 'regressed'
566
+ // The alarm. This is the reopen detector, and its wording is the one thing here that must
567
+ // stay blunt: it caught the 2026-08-19 regression in two days.
568
+ ? `⚠ ATTRIBUTION IS BEING DROPPED: ${status.unattributedMcpRevisions} of ${status.mcpRevisions} MCP-authored revisions since ${status.since} carry NO session (${status.unattributedRepairedRevisions} of them on ops delete/retier/system; any remainder is elsewhere, most likely \`author\`). Find the writer. An unattributed MCP revision is one of the two conditions that REOPEN gate 2, which closed 2026-08-25.`
569
+ : status.mcpRevisions === 0
570
+ // "Nothing was written" and "plenty was written and none of it lost a session" are
571
+ // opposite conditions, and a bare "0 unattributed" renders them identically. Gate 4's
572
+ // denominator rule, applied here because silence is not a clean bill of health.
573
+ ? `No MCP-authored revisions at all in this brain in the last ${status.days} days (window floor ${status.since}), so there is NOTHING the alarm could have checked. This is an empty measurement, not an all-clear.`
574
+ : `Attribution is holding: 0 of ${status.mcpRevisions} MCP-authored revisions since ${status.since} lost its session, across every mcp op including \`author\`. This is a standing regression watch and it decides NOTHING — it is not a gate criterion. Gate 2 closed 2026-08-25 on enumeration of all 18 brain_documents DML sites. For where any gate actually stands, read [[Agnoclast v1 — the currency gate]].`
530
575
  return { content: [{ type: 'text', text }] }
531
576
  },
532
577
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theronap/cortex-mcp",
3
- "version": "0.9.109",
3
+ "version": "0.9.110",
4
4
  "description": "Connect your AI assistant to Cortex — your org's projects, activity, gaps, and directives, scoped to you.",
5
5
  "type": "module",
6
6
  "bin": {