thumbgate 1.26.0 → 1.26.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thumbgate-marketplace",
3
- "version": "1.26.0",
3
+ "version": "1.26.1",
4
4
  "owner": {
5
5
  "name": "Igor Ganapolsky",
6
6
  "email": "ig5973700@gmail.com"
@@ -14,7 +14,7 @@
14
14
  "source": "npm",
15
15
  "package": "thumbgate"
16
16
  },
17
- "version": "1.26.0",
17
+ "version": "1.26.1",
18
18
  "author": {
19
19
  "name": "Igor Ganapolsky",
20
20
  "email": "ig5973700@gmail.com",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "thumbgate",
3
3
  "description": "One 👎 becomes a hard rule the agent cannot bypass. Captures thumbs-down feedback, distills it into PreToolUse Pre-Action Checks, enforced across every future Claude Code session.",
4
- "version": "1.26.0",
4
+ "version": "1.26.1",
5
5
  "author": {
6
6
  "name": "Igor Ganapolsky",
7
7
  "email": "ig5973700@gmail.com",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thumbgate",
3
- "version": "1.26.0",
3
+ "version": "1.26.1",
4
4
  "description": "ThumbGate — 👍👎 feedback that teaches your AI agent. Thumbs down a mistake, it never happens again.",
5
5
  "homepage": "https://thumbgate.ai",
6
6
  "transport": "stdio",
package/README.md CHANGED
@@ -24,24 +24,7 @@ The product is a self-improving enforcement layer: thumbs-down feedback, prompt
24
24
  npx thumbgate init # auto-detects your agent, wires hooks, 30 seconds
25
25
  ```
26
26
 
27
- Works with **Claude Code, Cursor, Codex, Gemini CLI, Amp, Cline, OpenCode** and any MCP-compatible agent.
28
-
29
- ### Add ThumbGate to Claude (remote connector, 30 seconds, no install)
30
-
31
- ThumbGate is a hosted remote MCP server. To use it in **Claude.ai / Claude Desktop**:
32
- **Settings → Connectors → Add custom connector**, then paste:
33
-
34
- ```
35
- https://thumbgate.ai/mcp
36
- ```
37
-
38
- That's it — Claude can now call ThumbGate's gate-check and feedback tools directly.
39
- For local/CLI agents (Claude Code, Cursor, Codex, …) use `npx thumbgate init`, which
40
- auto-wires the hooks. (The same server is published to the [MCP Registry](https://registry.modelcontextprotocol.io) as `io.github.IgorGanapolsky/thumbgate`.)
41
-
42
- **Free:** 5 feedback captures/day (25 total captures), 3 active auto-promoted prevention rules, all MCP integrations, local-first.
43
- **[Pro — $19/mo or $149/yr](https://thumbgate.ai/checkout/pro?utm_source=github&utm_medium=readme):** no limits on captures or rules, history-aware lessons, feedback sessions, hosted dashboard, DPO export.
44
- **Team — $49/seat/mo:** shared hosted lesson DB, org dashboard, approval boundaries.
27
+ Works with **Claude Code, Cursor, Codex, Gemini CLI, Amp, Cline, OpenCode** and any MCP-compatible agent. Free tier: unlimited feedback captures and 5 active auto-promoted prevention rules. [Pro: $19/mo or $149/yr](https://thumbgate.ai/checkout/pro?utm_source=github&utm_medium=readme) — unlimited rules, history-aware lessons, feedback sessions, dashboard, DPO export. Team is $49/seat/mo with a shared hosted lesson DB and org dashboard.
45
28
 
46
29
  [![CI](https://github.com/IgorGanapolsky/ThumbGate/actions/workflows/ci.yml/badge.svg)](https://github.com/IgorGanapolsky/ThumbGate/actions/workflows/ci.yml)
47
30
  [![npm](https://img.shields.io/npm/v/thumbgate)](https://www.npmjs.com/package/thumbgate)
@@ -49,9 +32,11 @@ auto-wires the hooks. (The same server is published to the [MCP Registry](https:
49
32
 
50
33
  ---
51
34
 
52
- > **Visibility isn't trust.** A dashboard shows you what an agent did; it doesn't stop the agent from doing it again. ThumbGate is the enforcement layer: PreToolUse gates, thumbs-down → rule, and an audit trail on every interception — so a mistake gets blocked, not just logged.
35
+ > *"A better dashboard doesn't make the agents more reliable. The hard part isn't visibility. It's trust."*
36
+ >
37
+ > — **Rob May**, CEO & co-founder, Neurometric AI, quoted in [The New Stack](https://thenewstack.io/claude-code-agent-view/) on Anthropic's Claude Code Agent View (May 2026).
53
38
  >
54
- > Published in the [MCP Registry](https://registry.modelcontextprotocol.io) (`io.github.IgorGanapolsky/thumbgate`) and usable as a one-line Claude connector.
39
+ > ThumbGate is the open-source layer that makes the trust part real: PreToolUse gates, thumbs-down to rule, audit trail on every interception.
55
40
 
56
41
  ---
57
42
 
@@ -124,11 +109,37 @@ ThumbGate doesn't make your agent smarter. It makes your agent *cheaper to be wr
124
109
 
125
110
  ---
126
111
 
112
+ ## 🧠 The Context Brain
113
+
114
+ Every coding agent starts each session amnesiac — it has no memory of the mistakes it made yesterday, the fixes your team already rejected, or the rules this repo enforces. So it repeats them, and you pay for it again.
115
+
116
+ ThumbGate gives your repo a **context brain**: a single, versioned, agent-readable artifact that consolidates everything the agent should know *before it acts* — the lessons it has learned, the guardrails it must not cross, the gates that are enforced, and the project's own instruction files.
117
+
118
+ ```bash
119
+ npx thumbgate brain --write # → .thumbgate/BRAIN.md
120
+ ```
121
+
122
+ Then point your agent at it — add `Read .thumbgate/BRAIN.md first` to your `CLAUDE.md` / `AGENTS.md`, and every Claude Code, Codex, Cursor, or Gemini CLI session boots with your repo's institutional memory already loaded. The output is **deterministic**, so `BRAIN.md` lives in git and only changes when the underlying memory does — review it like any other file.
123
+
124
+ ```
125
+ # ThumbGate Context Brain
126
+ ## What this codebase taught its agents (lessons)
127
+ - ⛔ Force-pushing to main was rejected — use --force-with-lease on feature branches only
128
+ ## Guardrails — do NOT repeat these (prevention rules)
129
+ - Never run DROP on production tables
130
+ ## Active enforcement (gates)
131
+ - `DROP.*production` → block
132
+ ```
133
+
134
+ Same idea the SEO world is now calling a *"client brain"* — persistent context that AI reads before doing the work — applied to **engineering**: the institutional memory that stops your coding agent from relearning the same lesson on your dime.
135
+
136
+ ---
137
+
127
138
  ## Quick Start
128
139
 
129
140
  ```bash
130
141
  npx thumbgate init # auto-detects your agent, wires everything
131
- npx thumbgate capture --feedback=down --context="Never run DROP on production tables"
142
+ npx thumbgate capture down "Never run DROP on production tables"
132
143
  ```
133
144
 
134
145
  That single command creates a prevention rule. Next time any AI agent tries to run `DROP` on production:
@@ -313,8 +324,9 @@ ThumbGate sells three concrete outcomes:
313
324
  ```bash
314
325
  npx thumbgate init # detect agent, wire hooks
315
326
  npx thumbgate doctor # health check
316
- npx thumbgate capture --feedback=up|down --context="<text>" # capture a signal as a stored lesson
327
+ npx thumbgate capture up|down "<text>" # capture a signal as a stored lesson (positional format)
317
328
  npx thumbgate lessons # see what's been learned
329
+ npx thumbgate brain --write # build .thumbgate/BRAIN.md — the agent-readable context brain
318
330
  npx thumbgate explore # terminal explorer for lessons, checks, stats
319
331
  npx thumbgate background-governance # review background-agent run risk
320
332
  npx thumbgate model-candidates --workload=dashboard-analysis --provider=openai --json # evaluate GPT-5.5 routing
@@ -332,8 +344,8 @@ npx thumbgate bench --programbench-smoke # include cleanroom whole-repo proof l
332
344
  | | Free | Pro ($19/mo) | Team ($49/seat/mo) | Enterprise |
333
345
  |---|---|---|---|---|
334
346
  | Local CLI + enforced checks | ✅ | ✅ | ✅ | ✅ |
335
- | Feedback captures | 5/day, 25 total | Unlimited | Unlimited | Unlimited |
336
- | Auto-promoted prevention rules | 3 active | Unlimited | Unlimited | Unlimited |
347
+ | Feedback captures (lifetime) | 3 | Unlimited | Unlimited | Unlimited |
348
+ | Auto-promoted prevention rules | 1 | Unlimited | Unlimited | Unlimited |
337
349
  | MCP agent integrations | All | All | All | All |
338
350
  | Personal dashboard | — | ✅ | ✅ | ✅ |
339
351
  | DPO export (model fine-tuning) | — | ✅ | ✅ | ✅ |
@@ -346,9 +358,9 @@ npx thumbgate bench --programbench-smoke # include cleanroom whole-repo proof l
346
358
  | Compliance audit export | — | — | — | ✅ |
347
359
  | Dedicated onboarding + SLA | — | — | — | ✅ |
348
360
 
349
- The free tier gives you 5 feedback captures/day, 25 total captures, and up to 3 active auto-promoted prevention rules — enough to prove value without replacing Pro for daily operators. MCP integrations for all agents (Claude Code, Cursor, Codex, Gemini, Amp, Cline, OpenCode) ship free.
361
+ The free tier gives you unlimited feedback captures and up to 5 active auto-promoted prevention rules — generous enough to make ThumbGate part of your daily flow. MCP integrations for all agents (Claude Code, Cursor, Codex, Gemini, Amp, Cline, OpenCode) ship free.
350
362
 
351
- Pro ($19/mo or $149/yr) removes the capture/rule caps and adds history-aware lesson recall, lesson search, DPO export, hosted sync, and a personal dashboard. Team ($49/seat/mo) adds a shared hosted lesson DB, org dashboard, and shared enforcement across the org. Enterprise adds regulatory gate templates (legal intake, financial compliance, healthcare), custom policy layers scoped to firm/practice-area, compliance audit export, and dedicated onboarding with SLA.
363
+ Pro ($19/mo or $149/yr) removes the rule cap and adds history-aware lesson recall, lesson search, DPO export, and a personal dashboard. Team ($49/seat/mo) adds a shared hosted lesson DB, org dashboard, and shared enforcement across the org. Enterprise adds regulatory gate templates (legal intake, financial compliance, healthcare), custom policy layers scoped to firm/practice-area, compliance audit export, and dedicated onboarding with SLA.
352
364
 
353
365
  **Best first paid motion for teams:** the **Workflow Hardening Sprint** — qualify one repeated failure before committing to a full rollout. **[Start intake →](https://thumbgate.ai/?utm_source=github&utm_medium=readme&utm_campaign=team_rollout#workflow-sprint-intake)**
354
366
 
@@ -437,7 +449,7 @@ curl -X POST http://localhost:3456/v1/dpo/export \
437
449
  | Layer | Technology |
438
450
  |-------|-----------|
439
451
  | **Storage** | SQLite + FTS5, LanceDB vectors, JSONL logs |
440
- | **Capture** | 10/day on Free; unlimited on Pro/Team |
452
+ | **Capture** | Unlimited feedback captures (free + Pro) |
441
453
  | **Intelligence** | MemAlign dual recall, Thompson Sampling |
442
454
  | **Enforcement** | PreToolUse hook engine, Checks config |
443
455
  | **Interfaces** | MCP stdio, HTTP API, CLI (Node.js >=18) |
@@ -488,6 +500,26 @@ Free and self-hosted users can invoke `search_lessons` directly through MCP, and
488
500
 
489
501
  ---
490
502
 
503
+ ## Enterprise Gating (Vertex AI & Google Cloud)
504
+
505
+ For enterprise subscriptions, ThumbGate natively integrates with Google Cloud Platform and **Vertex AI** to route all agent checks through compliant Gemini models inside your corporate VPC.
506
+
507
+ ### Zero-Friction Setup
508
+ To instantly wire your local installation to Google Cloud, simply run:
509
+ ```bash
510
+ npx thumbgate setup-vertex
511
+ ```
512
+ * **Auto-Discovery:** Automatically detects your active authenticated `gcloud` session and active project ID.
513
+ * **Auto-Enablement:** Programmatically enables the Vertex AI API in your project.
514
+ * **Auto-Configuration:** Writes secure billing and project credentials directly to your local `.env` file.
515
+
516
+ ### Zero-Friction Cost Containment ($10/mo Hard Cap)
517
+ Google Cloud budget alerts are "alert-only" and do not stop API traffic, risking unexpected bill shock. ThumbGate completely resolves this on the client side:
518
+ * **Instant Shutdown:** ThumbGate maintains a lightweight, local token ledger and instantly halts outgoing API traffic the millisecond your monthly token spending approaches the **$10 limit** (500k tokens of Gemini 1.5 Flash).
519
+ * **Bypasses Console Complexity:** Requires **zero** GCP web console setups, zero Pub/Sub topics, and zero Cloud Functions. Perfect for non-technical managers and teams.
520
+
521
+ ---
522
+
491
523
  ## FAQ
492
524
 
493
525
  **Is ThumbGate a model fine-tuning tool?**
@@ -500,9 +532,9 @@ Those are suggestions the agent can ignore. ThumbGate checks are enforced — th
500
532
  If it supports MCP or pre-action hooks, yes. Claude Code, Claude Desktop, Cursor, Codex, Gemini CLI, Amp, Cline, OpenCode all work out of the box.
501
533
 
502
534
  **Is it free?**
503
- The free tier gives you 5 feedback captures/day, 25 total captures, and up to 3 active auto-promoted prevention rules. MCP integrations ship free for every agent.
535
+ The free tier gives you unlimited feedback captures and up to 5 active auto-promoted prevention rules — generous enough for solo devs to use daily. MCP integrations ship free for every agent.
504
536
 
505
- Pro ($19/mo or $149/yr) removes the capture/rule caps and adds history-aware lesson recall, lesson search, hosted sync, and a personal dashboard. Team ($49/seat/mo) adds a shared hosted lesson DB, org dashboard, and shared enforcement.
537
+ Pro ($19/mo or $149/yr) removes the rule cap and adds history-aware lesson recall, lesson search, and a personal dashboard. Team ($49/seat/mo) adds a shared hosted lesson DB, org dashboard, and shared enforcement.
506
538
 
507
539
  ---
508
540
 
@@ -519,9 +551,8 @@ Pro ($19/mo or $149/yr) removes the capture/rule caps and adds history-aware les
519
551
  - [Agent Workflow Contract](WORKFLOW.md) — the agent-run contract for all ThumbGate operations
520
552
  - [Ready for Agent Intake](https://github.com/IgorGanapolsky/ThumbGate/issues/new?template=ready-for-agent.yml) — ready-for-agent intake template
521
553
  - [SEO Guide: Claude Code Guardrails](docs/learn/claude-code-guardrails.md)
522
- - [Unsupervised Learning Signals](docs/UL.md) — silent-failure clustering (experimental, behind `THUMBGATE_SILENT_FAILURE_CLUSTERING=1`; only useful on workspaces with ≥ 50 tool calls/day)
554
+ - [Unsupervised Learning Signals](docs/UL.md) — silent-failure clustering (**on by default** as of 2026-05-21; opt out via `THUMBGATE_SILENT_FAILURE_CLUSTERING=0`; only meaningfully active on workspaces with ≥ 50 tool calls/day)
523
555
  - [ThumbGate-Core](https://github.com/IgorGanapolsky/ThumbGate-Core) — private core for hosted overlays, ranking, policy synthesis, billing intelligence, and org/team workflows
524
- - [mac-yolo-safeguards](https://github.com/IgorGanapolsky/mac-yolo-safeguards?utm_source=thumbgate&utm_medium=readme&utm_campaign=companion_kit) — OS-level companion kit (macOS). ThumbGate stops the agent from billing you for repeated mistakes (token-layer governance). mac-yolo-safeguards stops the agent from freezing your Mac when it spawns runaway processes (OS-layer blast-radius containment). Same author, MIT, no telemetry.
525
556
 
526
557
  ---
527
558
 
@@ -2,13 +2,13 @@
2
2
  "mcpServers": {
3
3
  "thumbgate": {
4
4
  "command": "npx",
5
- "args": ["--yes", "--package", "thumbgate@1.26.0", "thumbgate", "serve"]
5
+ "args": ["--yes", "--package", "thumbgate@1.26.1", "thumbgate", "serve"]
6
6
  }
7
7
  },
8
8
  "hooks": {
9
9
  "preToolUse": {
10
10
  "command": "npx",
11
- "args": ["--yes", "--package", "thumbgate@1.26.0", "thumbgate", "gate-check"]
11
+ "args": ["--yes", "--package", "thumbgate@1.26.1", "thumbgate", "gate-check"]
12
12
  }
13
13
  }
14
14
  }
@@ -70,6 +70,20 @@ const {
70
70
  verifyClaimEvidence,
71
71
  registerClaimGate,
72
72
  } = require('../../scripts/gates-engine');
73
+ const { mergeRepeatMetricIntoGateStats } = require('../../scripts/repeat-metric');
74
+ const {
75
+ detectNoop,
76
+ computeActionStateHash,
77
+ recordActionAttempt,
78
+ isRepeatAttempt,
79
+ } = require('../../scripts/noop-detect');
80
+ const {
81
+ recordReceipt,
82
+ getReceiptForAction,
83
+ getRecentReceipts,
84
+ pairFeedbackWithReceipt,
85
+ buildReceiptContextEntries,
86
+ } = require('../../scripts/action-receipts');
73
87
  const {
74
88
  evaluateOperationalIntegrity,
75
89
  } = require('../../scripts/operational-integrity');
@@ -216,7 +230,7 @@ const {
216
230
  finalizeSession: finalizeFeedbackSession,
217
231
  } = require('../../scripts/feedback-session');
218
232
 
219
- const SERVER_INFO = { name: 'thumbgate-mcp', version: '1.26.0' };
233
+ const SERVER_INFO = { name: 'thumbgate-mcp', version: '1.26.1' };
220
234
  const COMMERCE_CATEGORIES = [
221
235
  'product_recommendation',
222
236
  'brand_compliance',
@@ -524,6 +538,28 @@ function buildContextPackResponse(args = {}) {
524
538
  maxChars: Number(args.maxChars || 6000),
525
539
  namespaces,
526
540
  });
541
+ // Feed outcome-paired action receipts into the pack so an action->outcome
542
+ // history is available alongside lessons/rules. Additive + guarded: a
543
+ // receipt-store failure must never break context pack construction.
544
+ try {
545
+ const receiptEntries = buildReceiptContextEntries(args.query || '', Number(args.maxItems || 8));
546
+ if (Array.isArray(receiptEntries) && receiptEntries.length && Array.isArray(pack.items)) {
547
+ for (const entry of receiptEntries) {
548
+ pack.items.push({
549
+ id: `action-receipt_${entry && entry.score != null ? entry.score : ''}_${pack.items.length}`,
550
+ namespace: 'action-receipts',
551
+ title: 'Action receipt outcome',
552
+ structuredContext: { rawContent: entry && entry.text ? String(entry.text) : '' },
553
+ tags: ['action-receipt', 'outcome-paired'],
554
+ score: entry && typeof entry.score === 'number' ? entry.score : 0,
555
+ });
556
+ }
557
+ if (!Array.isArray(pack.namespaces)) pack.namespaces = [];
558
+ if (!pack.namespaces.includes('action-receipts')) pack.namespaces.push('action-receipts');
559
+ }
560
+ } catch {
561
+ // ignore receipt enrichment failures
562
+ }
527
563
  return toTextResult(pack);
528
564
  }
529
565
 
@@ -670,9 +706,13 @@ async function callToolInner(name, args) {
670
706
  if (name === 'describe_reliability_entity') name = 'describe_semantic_entity';
671
707
 
672
708
  switch (name) {
673
- case 'capture_feedback':
674
-
675
- return toCaptureFeedbackTextResult(captureFeedback(args));
709
+ case 'capture_feedback': {
710
+ // Outcome-paired lessons: enrich the feedback payload with the matching
711
+ // action receipt (this action -> this outcome) before promotion. Returns
712
+ // args unchanged when there is no matching receipt (non-breaking).
713
+ const pairedFeedback = pairFeedbackWithReceipt(args);
714
+ return toCaptureFeedbackTextResult(captureFeedback(pairedFeedback));
715
+ }
676
716
  case 'feedback_summary':
677
717
  return toTextResult(feedbackSummary(Number(args.recent || 20)));
678
718
  case 'search_lessons': {
@@ -949,12 +989,49 @@ async function callToolInner(name, args) {
949
989
  });
950
990
  case 'track_action': {
951
991
  const entry = trackAction(args.actionId, args.metadata || {});
952
- return toTextResult({
992
+ const result = {
953
993
  tracked: true,
954
994
  actionId: args.actionId,
955
995
  ...entry,
996
+ };
997
+ // No-op / repeat signal: when the caller carries a precomputed state hash
998
+ // in metadata, surface whether this exact (action, state) was already
999
+ // attempted this session. Additive flag, non-breaking.
1000
+ const metadataStateHash = args.metadata && args.metadata.stateHash;
1001
+ if (metadataStateHash) {
1002
+ try {
1003
+ result.repeatSignal = isRepeatAttempt(
1004
+ (args.metadata && args.metadata.sessionId) || 'default',
1005
+ args.actionId,
1006
+ metadataStateHash,
1007
+ );
1008
+ } catch {
1009
+ // repeat detection is best-effort
1010
+ }
1011
+ }
1012
+ return toTextResult(result);
1013
+ }
1014
+ case 'detect_noop': {
1015
+ const stateHash = computeActionStateHash(args);
1016
+ const noop = detectNoop(args);
1017
+ const sessionId = args.sessionId || 'default';
1018
+ const repeat = isRepeatAttempt(sessionId, args.actionId, stateHash);
1019
+ recordActionAttempt(sessionId, args.actionId, stateHash);
1020
+ return toTextResult({
1021
+ noop: noop.noop,
1022
+ repeat,
1023
+ reason: noop.reason,
1024
+ stateHash,
956
1025
  });
957
1026
  }
1027
+ case 'record_action_receipt':
1028
+ return toTextResult(recordReceipt(args));
1029
+ case 'get_action_receipts':
1030
+ return toTextResult(
1031
+ args.actionId
1032
+ ? getReceiptForAction(args.actionId)
1033
+ : getRecentReceipts(Number(args.limit || 20)),
1034
+ );
958
1035
  case 'verify_claim':
959
1036
  return toTextResult(verifyClaimEvidence(args.claim, { goalContract: args.goalContract }));
960
1037
  case 'require_evidence_for_claim': {
@@ -1084,7 +1161,7 @@ async function callToolInner(name, args) {
1084
1161
  case 'register_claim_gate':
1085
1162
  return toTextResult(registerClaimGate(args.claimPattern, args.requiredActions, args.message));
1086
1163
  case 'gate_stats':
1087
- return toTextResult(loadGateStats());
1164
+ return toTextResult(mergeRepeatMetricIntoGateStats(loadGateStats()));
1088
1165
  case 'dashboard':
1089
1166
  return toTextResult(generateDashboard(getFeedbackPaths().FEEDBACK_DIR));
1090
1167
  case 'org_dashboard':
@@ -7,7 +7,7 @@
7
7
  "npx",
8
8
  "--yes",
9
9
  "--package",
10
- "thumbgate@1.26.0",
10
+ "thumbgate@1.26.1",
11
11
  "thumbgate",
12
12
  "serve"
13
13
  ],