@theronap/cortex-mcp 0.9.103 → 0.9.104

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 +35 -0
  2. package/package.json +1 -1
package/lib/server.mjs CHANGED
@@ -516,6 +516,41 @@ export async function runServer(version) {
516
516
  },
517
517
  )
518
518
 
519
+ server.registerTool(
520
+ 'gate4_status',
521
+ {
522
+ title: 'Gate 4 claim-clause monitor',
523
+ description: 'Read the aggregate-only Gate 4 status for this brain — whether SESSIONS are actually claiming timeline records, not just whether records got claimed. Evidence counts only `actor_kind=\'session\'` rows: sweep rows are a machine draining a backlog and are reported for contrast but never as evidence, because counting them would let one bulk drain certify a clause about people doing something. "Sustained" is measured as distinct sessions AND distinct active days, both tunable via minSessions/minActiveDays rather than hardcoded. It never exposes record ids, payloads, reasons or session keys. NOTE gate 4\'s claim clause was already CLOSED (2026-08-20), so "collecting" here does NOT mean progress toward closure — it means the evidence the closure rested on no longer holds in this window. "regressed" means a session claim has lost its attribution.',
524
+ inputSchema: {
525
+ days: z.number().optional().describe('rolling window in days (1-90, default 14)'),
526
+ minSessions: z.number().optional().describe('distinct claiming sessions required (default 3)'),
527
+ minActiveDays: z.number().optional().describe('distinct days carrying an attributed session claim (default 3)'),
528
+ brain: z.string().optional().describe('brain name or org id when you belong to more than one brain; omit for a sole brain'),
529
+ },
530
+ },
531
+ async ({ days, minSessions, minActiveDays, brain }) => {
532
+ const qs = new URLSearchParams()
533
+ if (days != null) qs.set('days', String(days))
534
+ if (minSessions != null) qs.set('minSessions', String(minSessions))
535
+ if (minActiveDays != null) qs.set('minActiveDays', String(minActiveDays))
536
+ if (brain) qs.set('brain', brain)
537
+ const suffix = qs.size ? `?${qs}` : ''
538
+ const res = await fetchCortex(`${BASE}/api/gates/4/status${suffix}`, { headers: { Authorization: `Bearer ${TOKEN}` } })
539
+ if (!res.ok) {
540
+ const body = await res.text()
541
+ throw new Error(classify(res.status, res.headers.get('content-type'), body, res.headers.get('x-vercel-id')).message)
542
+ }
543
+ const status = await res.json()
544
+ const contrast = `${status.sessionClaims} session claims vs ${status.sweepClaims} sweep (sweep is not evidence)`
545
+ const text = status.status === 'regressed'
546
+ ? `⚠ Gate 4 has REGRESSED: ${status.anonymousSessionClaims} session-kind claims in the last ${status.days} days carry NO session key. The claim path is dropping attribution — find the writer before trusting any claim count.`
547
+ : status.machineEvidenceReady
548
+ ? `Gate 4's claim clause still holds: ${status.claimSessions} distinct sessions claimed across ${status.activeDays} distinct days in ${status.days} days (${contrast}), 0 anonymous. Closed ${status.gateClosedAt}; this is the evidence continuing to hold, not a new closure.`
549
+ : `⚠ Gate 4 is BELOW the evidence it closed on (${status.gateClosedAt}): ${status.claimSessions}/${status.requiredClaimSessions} distinct sessions across ${status.activeDays}/${status.requiredActiveDays} active days in the last ${status.days} days (${contrast}). No attribution defect — the claiming has thinned out. Re-check before citing the clause as live.`
550
+ return { content: [{ type: 'text', text }] }
551
+ },
552
+ )
553
+
519
554
  server.registerTool(
520
555
  'session_context',
521
556
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theronap/cortex-mcp",
3
- "version": "0.9.103",
3
+ "version": "0.9.104",
4
4
  "description": "Connect your AI assistant to Cortex \u2014 your org's projects, activity, gaps, and directives, scoped to you.",
5
5
  "type": "module",
6
6
  "bin": {