thumbgate 1.27.8 → 1.27.10

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 (117) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.well-known/llms.txt +1 -2
  3. package/.well-known/mcp/server-card.json +1 -1
  4. package/README.md +4 -2
  5. package/adapters/claude/.mcp.json +2 -2
  6. package/adapters/mcp/server-stdio.js +1 -1
  7. package/adapters/opencode/opencode.json +1 -1
  8. package/bin/cli.js +259 -78
  9. package/config/gate-templates.json +228 -0
  10. package/config/gates/claim-verification.json +18 -0
  11. package/package.json +14 -21
  12. package/public/blog.html +30 -0
  13. package/public/compare/adopt-ai.html +219 -0
  14. package/public/compare/agentix-labs.html +197 -0
  15. package/public/compare/ai-experience-orchestration.html +216 -0
  16. package/public/compare/anthropic-claude-for-legal.html +260 -0
  17. package/public/compare/anthropic-containment.html +280 -0
  18. package/public/compare/arcade.html +175 -0
  19. package/public/compare/arcjet.html +239 -0
  20. package/public/compare/bumblebee.html +307 -0
  21. package/public/compare/claude-code-hooks.html +294 -0
  22. package/public/compare/databricks-unity-ai-gateway.html +215 -0
  23. package/public/compare/fallow.html +351 -0
  24. package/public/compare/heidi.html +233 -0
  25. package/public/compare/mem0.html +342 -0
  26. package/public/compare/oak-and-sparrow-gatekeeper.html +289 -0
  27. package/public/compare/rein.html +236 -0
  28. package/public/compare/sigmashake.html +256 -0
  29. package/public/compare/speclock.html +342 -0
  30. package/public/compare.html +2 -0
  31. package/public/guides/agent-harness-optimization.html +342 -0
  32. package/public/guides/agentic-web-governance.html +406 -0
  33. package/public/guides/ai-agent-governance-sprint.html +415 -0
  34. package/public/guides/ai-agent-pre-action-approval-gates.html +401 -0
  35. package/public/guides/ai-agent-workflow-migration-checklist.html +392 -0
  36. package/public/guides/ai-deployment-readiness.html +415 -0
  37. package/public/guides/ai-mode-ads-agent-governance.html +401 -0
  38. package/public/guides/ai-search-topical-presence.html +342 -0
  39. package/public/guides/autoresearch-agent-safety.html +342 -0
  40. package/public/guides/background-agent-governance.html +358 -0
  41. package/public/guides/best-tools-stop-ai-agents-breaking-production.html +363 -0
  42. package/public/guides/browser-automation-safety.html +342 -0
  43. package/public/guides/chatgpt-ads-trust.html +353 -0
  44. package/public/guides/claude-code-feedback.html +339 -0
  45. package/public/guides/claude-code-prevent-repeated-mistakes.html +161 -0
  46. package/public/guides/claude-code-skills-guardrails.html +343 -0
  47. package/public/guides/claude-desktop.html +356 -0
  48. package/public/guides/code-knowledge-graph-guardrails.html +365 -0
  49. package/public/guides/codex-cli-guardrails.html +339 -0
  50. package/public/guides/cursor-agent-guardrails.html +339 -0
  51. package/public/guides/cursor-prevent-repeated-mistakes.html +161 -0
  52. package/public/guides/database-agent-safety.html +406 -0
  53. package/public/guides/deepseek-v4-runtime-guardrails.html +346 -0
  54. package/public/guides/developer-machine-supply-chain-guardrails.html +358 -0
  55. package/public/guides/gcp-mcp-guardrails.html +147 -0
  56. package/public/guides/gemini-cli-feedback-memory.html +339 -0
  57. package/public/guides/gpt-5-5-model-evaluation.html +358 -0
  58. package/public/guides/internal-ai-engineering-stack-guardrails.html +348 -0
  59. package/public/guides/long-running-agent-context-management.html +346 -0
  60. package/public/guides/mcp-tool-governance.html +401 -0
  61. package/public/guides/multica-thumbgate-setup.html +134 -0
  62. package/public/guides/native-messaging-host-security.html +342 -0
  63. package/public/guides/policy-engine-pre-action-gates.html +346 -0
  64. package/public/guides/pre-action-checks.html +342 -0
  65. package/public/guides/pretooluse-hooks-vs-advisory-prompt-rules.html +342 -0
  66. package/public/guides/prompt-tricks-to-workflow-rules.html +365 -0
  67. package/public/guides/proxy-pointer-rag-guardrails.html +352 -0
  68. package/public/guides/rag-precision-tuning-guardrails.html +352 -0
  69. package/public/guides/reasoning-compression-guardrails.html +346 -0
  70. package/public/guides/relational-knowledge-ai-recommendations.html +342 -0
  71. package/public/guides/roo-code-alternative-cline.html +339 -0
  72. package/public/guides/semantic-programmatic-seo-guardrails.html +352 -0
  73. package/public/guides/seo-agent-skills-guardrails.html +344 -0
  74. package/public/guides/stop-repeated-ai-agent-mistakes.html +342 -0
  75. package/public/index.html +192 -50
  76. package/public/learn/ac-dc-runtime-enforcement.html +277 -0
  77. package/public/learn/agent-harness-pattern.html +181 -0
  78. package/public/learn/agent-identity-connector-governance.html +146 -0
  79. package/public/learn/agent-swarms-shared-gates.html +173 -0
  80. package/public/learn/agentic-enterprise-context-brain.html +117 -0
  81. package/public/learn/agentic-os-team-governance.html +146 -0
  82. package/public/learn/ai-agent-governance.html +158 -0
  83. package/public/learn/ai-agent-persistent-memory.html +211 -0
  84. package/public/learn/anthropomorphic-claim-gates.html +180 -0
  85. package/public/learn/background-agent-control-layer.html +184 -0
  86. package/public/learn/claude-code-goal-with-rubrics.html +205 -0
  87. package/public/learn/codex-role-plugins-need-governance.html +125 -0
  88. package/public/learn/cost-aware-agent-gate-routing.html +173 -0
  89. package/public/learn/databricks-unity-ai-gateway-runtime-governance.html +157 -0
  90. package/public/learn/deterministic-agent-workflows.html +185 -0
  91. package/public/learn/feedback-loop-vs-decision-layer.html +283 -0
  92. package/public/learn/from-prototype-to-production.html +223 -0
  93. package/public/learn/learn.css +51 -0
  94. package/public/learn/mcp-pre-action-checks-explained.html +172 -0
  95. package/public/learn/pretix-stripe-connect-marketplaces.html +161 -0
  96. package/public/learn/regulated-agent-execution-boundary.html +196 -0
  97. package/public/learn/spec-driven-development.html +168 -0
  98. package/public/learn/stop-ai-agent-force-push.html +134 -0
  99. package/public/learn/vibe-coding-safety-net.html +142 -0
  100. package/public/learn.html +34 -50
  101. package/public/numbers.html +2 -2
  102. package/public/pro.html +6 -6
  103. package/scripts/cli-schema.js +10 -22
  104. package/scripts/dashboard-chat.js +1 -2
  105. package/scripts/document-intake.js +49 -1
  106. package/scripts/gemini-embedding-policy.js +1 -2
  107. package/scripts/hook-stop-anti-claim.js +103 -42
  108. package/scripts/hosted-config.js +12 -0
  109. package/scripts/plausible-domain-config.js +1 -3
  110. package/scripts/reddit-browser-notification-watch.js +230 -0
  111. package/scripts/seo-gsd.js +0 -239
  112. package/scripts/tool-registry.js +2 -2
  113. package/scripts/vector-store.js +0 -44
  114. package/scripts/workspace-evolver.js +2 -62
  115. package/src/api/server.js +126 -335
  116. package/adapters/policy-engine/ethicore-guardian-client.js +0 -68
  117. package/adapters/policy-engine/thumbgate-policy-engine-adapter.js +0 -260
@@ -0,0 +1,230 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const fs = require('node:fs');
5
+ const path = require('node:path');
6
+ const { chromium } = require('playwright-core');
7
+
8
+ const DEFAULT_CDP_ENDPOINT = 'http://127.0.0.1:9222';
9
+ const DEFAULT_STATE_FILE = path.resolve(__dirname, '..', '.thumbgate', 'reddit-browser-notification-state.json');
10
+ const DEFAULT_EVENTS_FILE = path.resolve(__dirname, '..', '.thumbgate', 'reddit-browser-notifications.jsonl');
11
+ const REDDIT_NOTIFICATIONS_URL = 'https://www.reddit.com/notifications';
12
+
13
+ function resolveRuntimeFile(envName, defaultPath) {
14
+ const configured = process.env[envName];
15
+ return configured ? path.resolve(configured) : defaultPath;
16
+ }
17
+
18
+ function loadJson(filePath, fallback) {
19
+ try {
20
+ if (fs.existsSync(filePath)) return JSON.parse(fs.readFileSync(filePath, 'utf8'));
21
+ } catch {
22
+ // Ignore corrupt transient state; a later write will repair it.
23
+ }
24
+ return fallback;
25
+ }
26
+
27
+ function writeJson(filePath, value) {
28
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
29
+ fs.writeFileSync(filePath, JSON.stringify(value, null, 2));
30
+ }
31
+
32
+ function appendJsonl(filePath, rows) {
33
+ if (rows.length === 0) return;
34
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
35
+ fs.appendFileSync(filePath, `${rows.map((row) => JSON.stringify(row)).join('\n')}\n`);
36
+ }
37
+
38
+ function fingerprintNotification(notification) {
39
+ return [
40
+ notification.author || '',
41
+ notification.kind || '',
42
+ notification.subreddit || '',
43
+ notification.preview || '',
44
+ notification.age || '',
45
+ ].join('|').toLowerCase();
46
+ }
47
+
48
+ function scoreNotification(notification) {
49
+ const text = `${notification.author || ''} ${notification.kind || ''} ${notification.preview || ''}`.toLowerCase();
50
+ let score = 0;
51
+ const reasons = [];
52
+
53
+ if (/accepted your chat invite|chat invite/i.test(text)) {
54
+ score += 5;
55
+ reasons.push('chat_accepted');
56
+ }
57
+ if (/\b(interested|try|paid|diagnostic|workflow|failure|gate|thumbgate|thubgate)\b/i.test(text)) {
58
+ score += 4;
59
+ reasons.push('buyer_signal');
60
+ }
61
+ if (/\b(replied|mentioned)\b/i.test(text)) {
62
+ score += 2;
63
+ reasons.push('reply_or_mention');
64
+ }
65
+ if (/\b(spam|slop|bot|report|ignore all previous instructions)\b/i.test(text)) {
66
+ score -= 5;
67
+ reasons.push('hostile_or_meta');
68
+ }
69
+ if (/automoderator|mod-bot|minimum karma|removed|reviewed shortly/i.test(text)) {
70
+ score -= 1;
71
+ reasons.push('platform_moderation');
72
+ }
73
+
74
+ return { score, reasons };
75
+ }
76
+
77
+ function ageMinutes(age) {
78
+ const text = String(age || '').trim().toLowerCase();
79
+ if (!text || text === 'just now') return 0;
80
+ const match = /^(\d+)\s*([mhdw])\s+ago$/.exec(text);
81
+ if (!match) return Number.POSITIVE_INFINITY;
82
+ const value = Number(match[1]);
83
+ const unit = match[2];
84
+ if (unit === 'm') return value;
85
+ if (unit === 'h') return value * 60;
86
+ if (unit === 'd') return value * 24 * 60;
87
+ return value * 7 * 24 * 60;
88
+ }
89
+
90
+ function isAgeLine(line) {
91
+ return /^(?:just now|\d+\s*[mhdw]\s+ago)$/i.test(String(line || '').trim());
92
+ }
93
+
94
+ function isRecentNotification(notification, maxAgeMinutes = 48 * 60) {
95
+ return ageMinutes(notification.age) <= maxAgeMinutes;
96
+ }
97
+
98
+ function parseNotificationBlocks(bodyText) {
99
+ const lines = String(bodyText || '')
100
+ .split('\n')
101
+ .map((line) => line.trim())
102
+ .filter(Boolean);
103
+ const notifications = [];
104
+
105
+ for (let index = 0; index < lines.length; index += 1) {
106
+ let author = lines[index];
107
+ let kind = lines[index + 1] || '';
108
+ let kindIndex = index + 1;
109
+ if (isAgeLine(author)) continue;
110
+
111
+ if (/\b(replied to|mentioned you|new mentions)\b/i.test(author)) {
112
+ kind = author;
113
+ kindIndex = index;
114
+ const authorMatch = /^u\/([^\s]+)/i.exec(kind);
115
+ author = authorMatch ? authorMatch[1] : author;
116
+ }
117
+
118
+ if (!kind || !/\b(accepted your chat invite|replied to|mentioned you|new mentions)\b/i.test(kind)) continue;
119
+
120
+ const hasPreview = !/accepted your chat invite|new mentions/i.test(kind);
121
+ const preview = hasPreview ? (lines[kindIndex + 1] || '') : '';
122
+ const age = hasPreview ? (lines[kindIndex + 2] || '') : (lines[kindIndex + 1] || '');
123
+ const subredditMatch = /\bin\s+r\/([A-Za-z0-9_]+)/.exec(kind);
124
+ const notification = {
125
+ author,
126
+ kind,
127
+ subreddit: subredditMatch ? subredditMatch[1] : null,
128
+ preview,
129
+ age,
130
+ };
131
+ const scored = scoreNotification(notification);
132
+ notifications.push({
133
+ ...notification,
134
+ ...scored,
135
+ ageMinutes: ageMinutes(notification.age),
136
+ fingerprint: fingerprintNotification(notification),
137
+ });
138
+ }
139
+
140
+ return notifications;
141
+ }
142
+
143
+ async function readRedditNotifications({
144
+ cdpEndpoint = process.env.THUMBGATE_CHROME_CDP_ENDPOINT || DEFAULT_CDP_ENDPOINT,
145
+ timeoutMs = Number(process.env.THUMBGATE_REDDIT_BROWSER_TIMEOUT_MS || 15000),
146
+ } = {}) {
147
+ const browser = await chromium.connectOverCDP(cdpEndpoint);
148
+ const context = browser.contexts()[0] || await browser.newContext();
149
+ const page = await context.newPage();
150
+ try {
151
+ await page.goto(REDDIT_NOTIFICATIONS_URL, { waitUntil: 'domcontentloaded', timeout: timeoutMs });
152
+ await page.waitForTimeout(3000);
153
+ const bodyText = await page.locator('body').innerText({ timeout: timeoutMs });
154
+ return parseNotificationBlocks(bodyText);
155
+ } finally {
156
+ await page.close().catch(() => {});
157
+ await browser.close().catch(() => {});
158
+ }
159
+ }
160
+
161
+ async function run({ dryRun = false, now = new Date().toISOString() } = {}) {
162
+ const stateFile = resolveRuntimeFile('THUMBGATE_REDDIT_BROWSER_STATE_FILE', DEFAULT_STATE_FILE);
163
+ const eventsFile = resolveRuntimeFile('THUMBGATE_REDDIT_BROWSER_EVENTS_FILE', DEFAULT_EVENTS_FILE);
164
+ const state = loadJson(stateFile, { seen: {} });
165
+ const notifications = await readRedditNotifications();
166
+ const fresh = notifications.filter((notification) => !state.seen[notification.fingerprint]);
167
+ const actionable = fresh.filter((notification) => notification.score > 0 && isRecentNotification(notification));
168
+ const rows = actionable.map((notification) => ({
169
+ checkedAt: now,
170
+ platform: 'reddit',
171
+ source: 'browser_notifications',
172
+ status: 'pending_review',
173
+ ...notification,
174
+ }));
175
+
176
+ for (const notification of fresh) {
177
+ state.seen[notification.fingerprint] = { seenAt: now, score: notification.score };
178
+ }
179
+ state.lastCheck = now;
180
+
181
+ if (!dryRun) {
182
+ writeJson(stateFile, state);
183
+ appendJsonl(eventsFile, rows);
184
+ }
185
+
186
+ return {
187
+ notifications: notifications.length,
188
+ fresh: fresh.length,
189
+ actionable: actionable.length,
190
+ eventsFile,
191
+ actionableItems: actionable,
192
+ dryRun,
193
+ };
194
+ }
195
+
196
+ function parseArgs(argv = process.argv.slice(2)) {
197
+ return {
198
+ dryRun: argv.includes('--dry-run'),
199
+ json: argv.includes('--json'),
200
+ };
201
+ }
202
+
203
+ if (require.main === module) {
204
+ const args = parseArgs();
205
+ run({ dryRun: args.dryRun })
206
+ .then((result) => {
207
+ if (args.json) {
208
+ console.log(JSON.stringify(result, null, 2));
209
+ } else {
210
+ console.log(`[reddit-browser-watch] notifications=${result.notifications} fresh=${result.fresh} actionable=${result.actionable} dryRun=${result.dryRun}`);
211
+ for (const item of result.actionableItems) {
212
+ console.log(`- score=${item.score} author=${item.author} kind=${item.kind} preview=${item.preview.slice(0, 120)}`);
213
+ }
214
+ }
215
+ })
216
+ .catch((err) => {
217
+ console.error(`[reddit-browser-watch] ${err.message}`);
218
+ process.exitCode = 1;
219
+ });
220
+ }
221
+
222
+ module.exports = {
223
+ fingerprintNotification,
224
+ ageMinutes,
225
+ isRecentNotification,
226
+ parseNotificationBlocks,
227
+ readRedditNotifications,
228
+ run,
229
+ scoreNotification,
230
+ };
@@ -105,11 +105,6 @@ const HIGH_ROI_QUERY_SEEDS = [
105
105
  93,
106
106
  'Fresh Slack engineering pattern where ThumbGate can gate director journals, critic reviews, credibility scoring, and timelines for long-running agents.',
107
107
  ),
108
- querySeed(
109
- 'agent context governance',
110
- 95,
111
- 'Fresh AdaCoM, tokenmaxxing, and Claude Managed Agents demand where ThumbGate can govern context hygiene, session logs, sandbox boundaries, credential separation, and pre-action proof.',
112
- ),
113
108
  querySeed(
114
109
  'reasoning compression guardrails',
115
110
  92,
@@ -239,12 +234,6 @@ const HIGH_ROI_QUERY_SEEDS = [
239
234
  source: 'seed',
240
235
  notes: 'Integration page for Gemini CLI users who need memory plus enforcement.',
241
236
  },
242
- {
243
- query: 'hermes agent guardrails',
244
- businessValue: 84,
245
- source: 'seed',
246
- notes: 'Integration page for Hermes Agent users who need pre-action gates around persistent memory, generated skills, messaging gateways, scheduled automations, and sandboxed execution.',
247
- },
248
237
  {
249
238
  query: 'roo code alternative cline',
250
239
  businessValue: 83,
@@ -2413,234 +2402,6 @@ const PAGE_BLUEPRINTS = [
2413
2402
  ],
2414
2403
  relatedPaths: ['/compare/mem0', '/guides/stop-repeated-ai-agent-mistakes'],
2415
2404
  },
2416
- {
2417
- query: 'hermes agent guardrails',
2418
- path: '/guides/hermes-agent-guardrails',
2419
- pageType: 'integration',
2420
- pillar: 'agent-workflows',
2421
- title: 'Hermes Agent Guardrails | Firewall for Self-Improving Agents',
2422
- heroTitle: 'Hermes Agent can grow with you. ThumbGate keeps the growing agent safe.',
2423
- heroSummary: 'Hermes Agent points at the next wave: persistent memory, generated skills, messaging gateways, scheduled automations, and sandboxed execution. ThumbGate is the enforcement layer those workflows need before a remembered mistake becomes another real tool call.',
2424
- takeaways: [
2425
- 'Hermes validates the market shift toward long-running, self-improving agents.',
2426
- 'Memory and generated skills increase leverage, but they also increase the blast radius of repeated mistakes.',
2427
- 'ThumbGate should be positioned as the local-first pre-action firewall for Hermes-style agents, not as a general agent clone.',
2428
- ],
2429
- sections: [
2430
- {
2431
- heading: 'Why Hermes-style agents need a separate execution gate',
2432
- paragraphs: [
2433
- 'A persistent agent can remember projects, generate its own skills, run scheduled automations, and accept instructions from messaging gateways. That is powerful, but it also means one bad habit can persist longer and reach more surfaces.',
2434
- 'The safety problem is not only whether the agent remembers. It is whether remembered lessons can stop the next risky shell command, git action, database write, deploy, browser click, or payment workflow before execution.',
2435
- ],
2436
- },
2437
- {
2438
- heading: 'What ThumbGate adds to Hermes-style workflows',
2439
- bullets: [
2440
- 'Pre-action checks before risky tool calls execute.',
2441
- 'Thumbs-down feedback that becomes explicit prevention rules.',
2442
- 'Evidence requirements for deploys, migrations, API calls, and production-facing changes.',
2443
- 'Audit trails that show which lesson, rule, and workflow context allowed or blocked the action.',
2444
- 'A local-first path for teams that want agent memory without handing every correction to a hosted black box.',
2445
- ],
2446
- },
2447
- {
2448
- heading: 'The buyer message',
2449
- paragraphs: [
2450
- 'Hermes can be the agent that grows with you. ThumbGate is the firewall that makes sure growth does not mean repeating expensive mistakes faster across more surfaces.',
2451
- 'For teams evaluating persistent agents, the practical first step is not another prompt. It is one enforced rule from one real failure, proven locally, then expanded into Pro or a workflow hardening sprint when the risk is recurring.',
2452
- ],
2453
- },
2454
- ],
2455
- faq: [
2456
- {
2457
- question: 'Does ThumbGate replace Hermes Agent?',
2458
- answer: 'No. Hermes is a general self-improving agent surface. ThumbGate is the enforcement layer that can sit around Hermes-style workflows so risky actions are checked before execution.',
2459
- },
2460
- {
2461
- question: 'What Hermes features create the biggest need for guardrails?',
2462
- answer: 'Persistent memory, generated skills, messaging gateways, scheduled automations, browser and tool control, and sandbox backends all increase the value of pre-action gates because the agent can act longer, faster, and from more entry points.',
2463
- },
2464
- {
2465
- question: 'What should teams implement first?',
2466
- answer: 'Start with one repeated failure pattern: force-push, destructive SQL, unsafe deploy, risky browser action, or off-scope file edit. Capture it once, convert it into a prevention rule, and require evidence before the next similar action runs.',
2467
- },
2468
- ],
2469
- relatedPaths: ['/guides/long-running-agent-context-management', '/guides/background-agent-governance', '/guides/browser-automation-safety'],
2470
- },
2471
- {
2472
- query: 'safe self evolution',
2473
- path: '/guides/safe-self-evolution',
2474
- pageType: 'guide',
2475
- pillar: 'agent-workflows',
2476
- title: 'Safe Self-Evolution | Autonomous Prompt Optimization without Regression',
2477
- heroTitle: 'Self-Evolution is Polarizing. Make It Safe with Execution Gates.',
2478
- heroSummary: 'Hermes-style autonomous agents learn by observing their own execution failures and automatically rewriting their skills or instructions. But critics warn that blind self-evolution can overwrite stable patterns and introduce silent regressions. ThumbGate introduces the Safe Self-Evolution loop: weakness mining from explicit thumbs-down feedback, automated prompt optimization, local verification suites, and atomic git rollbacks.',
2479
- takeaways: [
2480
- 'Self-improving agents need execution guardrails so a synthesized skill cannot bypass safety constraints.',
2481
- 'Blind self-evolution is unstable; ThumbGate ensures prompt changes are verified against a local holdout suite before committing.',
2482
- 'Rollback capability is mandatory: if validation fails, the evolution engine immediately reverts prompts to the last known-good state.',
2483
- 'Explicit feedback is the anchor: optimize based on real thumbs-down signals, not hallucinatory failure guesses.'
2484
- ],
2485
- sections: [
2486
- {
2487
- heading: 'The self-evolution dilemma',
2488
- paragraphs: [
2489
- 'Nous Research’s Hermes Agent points at a future where developers do not write static instructions like CLAUDE.md. Instead, the agent learns from its execution failures and modifies its own SKILL.md files in real-time. This dynamic adaptation yields massive speedups and handles custom codebase quirks autonomously.',
2490
- 'However, the critics are correct: when an agent has the power to edit its own rules without a verification gate, it will eventually overwrite a perfectly stable skill. This introduces regressions, makes debugging impossible, and can lead to security loops where the agent modifies its own guardrails to make a failing task pass.'
2491
- ]
2492
- },
2493
- {
2494
- heading: 'Safe self-evolution with ThumbGate',
2495
- paragraphs: [
2496
- 'ThumbGate implements a Safe Self-Evolution loop (based on the Self-Harness paradigm) that gives you the speed of self-improving agents without the instability:',
2497
- '1. Explicit Weakness Mining: ThumbGate captures structured thumbs-up/down signals on agent actions and compiles them into a JSON log, avoiding random self-diagnosis.',
2498
- '2. Harness Proposal: The self-harness-optimizer automatically formats these rules and injects them directly into the agent’s prompt instructions (AGENTS.md, GEMINI.md).',
2499
- '3. Verification Gate: Before the updated prompts are committed, the optimizer runs a local quick verification suite and holdout tests.',
2500
- '4. Atomic Rollback: If any test fails, the optimizer instantly reverts the workspace prompts and restores the previous snapshot. If they pass, it commits the update to Git.'
2501
- ]
2502
- },
2503
- {
2504
- heading: 'Competing with blind self-improvement',
2505
- paragraphs: [
2506
- 'To compete with agents like Hermes, you do not need to give up control of your codebase. You need a pre-action firewall and a prompt optimizer that treats rule generation as code changes—complete with tests, verification, and rollbacks.',
2507
- 'This keeps your agent fast, keeps your instructions dynamic, and ensures your production-facing surfaces remain secure.'
2508
- ]
2509
- }
2510
- ],
2511
- faq: [
2512
- {
2513
- question: 'Does ThumbGate prevent the agent from changing its own rules?',
2514
- answer: 'Yes. ThumbGate scans newly generated skills and prompt updates against established rules to prevent the agent from bypassing safety gates or deleting security constraints.'
2515
- },
2516
- {
2517
- question: 'How does the rollback mechanism work?',
2518
- answer: 'When the self-harness optimizer proposes new prompt sections, it saves a snapshot of the current prompt files. It then runs the verification commands. If the status is non-zero, it restores the backup files.'
2519
- },
2520
- {
2521
- question: 'Is this compatible with Hermes Agent?',
2522
- answer: 'Yes. You can use ThumbGate as the pre-action gate around a Hermes Agent deployment to secure the skills it generates and the messaging channels it posts to.'
2523
- }
2524
- ],
2525
- relatedPaths: ['/guides/hermes-agent-guardrails', '/guides/agent-context-governance', '/guides/stop-repeated-ai-agent-mistakes'],
2526
- },
2527
- {
2528
- query: 'agent context governance',
2529
- path: '/guides/agent-context-governance',
2530
- pageType: 'guide',
2531
- pillar: 'pre-action-checks',
2532
- title: 'Agent Context Governance | Stop Tokenmaxxing Drift Before Agents Act',
2533
- heroTitle: 'More Context Is Not Governance. Clean Context Plus Action Gates Is.',
2534
- heroSummary: 'AdaCoM-style context managers, the tokenmaxxing backlash, Claude Managed Agents, anti-rubber-stamp response prompts, model-provenance scares, ChatGPT Lockdown Mode, MCP routing attacks, resilient graph architectures, rising AI-authored code volume, AI email assistants, platform-agent orchestration, on-device QAT models, and backprop-style failure attribution all point to the same buyer need: long-running agents need structured intent, cleaner context, durable session logs, approved models, isolated execution, credential boundaries, tool lockdown, direct pushback, distributed gates, provenance, and pre-action checks before they touch real systems.',
2535
- takeaways: [
2536
- 'Long-context agents get better when a separate manager rewrites, preserves, prunes, or merges working context before the next step.',
2537
- 'Tokenmaxxing creates uncontrolled spend and weak governance when teams cannot prove which agent work returned value.',
2538
- 'Managed-agent architectures decouple the brain, hands, sessions, credentials, and sandboxes; ThumbGate adds the local-first action gate around those boundaries.',
2539
- 'Response customization should become a gate too: no padded agreement, no vague completion claims, and no confident answer without evidence or blind-spot checks.',
2540
- 'Lockdown modes validate the egress-control story: sensitive workflows need tool-surface limits, not just better prompts.',
2541
- 'Model leaks and proxy resale scares make approved-provider checks a governance requirement, especially when frontier model cost is high.',
2542
- 'MCP security research makes local config integrity a first-class control: endpoint rewrites and token-routing changes must be monitored before agents act.',
2543
- 'Random-graph infrastructure suggests a governance architecture: use many small local gates that degrade proportionally instead of one central approval bottleneck.',
2544
- 'As AI-authored code volume rises, teams need provenance and evidence gates so generated diffs are attributable, tested, and owned before merge.',
2545
- 'AI customer-response assistants need draft governance: retrieved sources, prompt variables, category routing, and feedback should improve drafts without letting the agent send unsupported claims.',
2546
- 'Enterprise agent platforms need one shared execution contract: structured specs, approved tools, scoped permissions, retries, evals, and traceability instead of 100 fragile team-specific agents.',
2547
- 'On-device QAT models can reduce cost and preserve privacy for first-pass risk classification, but they should escalate rather than approve high-risk actions.',
2548
- 'Backpropagation suggests a useful product metaphor: trace the agent run graph, score local risk at each edge, and cache the blame path so the same failure is blocked faster next time.',
2549
- ],
2550
- sections: [
2551
- {
2552
- heading: 'Why this matters now',
2553
- paragraphs: [
2554
- 'The market is moving away from prompt-only agents. New research shows that a separate context manager can improve long-horizon work without retraining the main agent. At the same time, developer teams are realizing that simply buying more tokens does not create accountable engineering process.',
2555
- 'Claude Managed Agents adds the production vocabulary buyers now expect: agents, environments, sessions, sandbox isolation, credential separation, event logs, observability, permission policies, outcomes, and webhooks. ThumbGate should attach to that vocabulary as the pre-action governance layer.',
2556
- ],
2557
- },
2558
- {
2559
- heading: 'What ThumbGate should enforce',
2560
- bullets: [
2561
- 'Context hygiene gate: block high-risk actions when the agent is acting from raw chat history, stale memory, or unresolved contradictions.',
2562
- 'Session evidence gate: require an append-only event log, resumable session ID, and proof links before long-running work can deploy, charge, message, or mutate production data.',
2563
- 'Sandbox boundary gate: require isolated execution and explicit network or filesystem scope before generated code runs.',
2564
- 'Credential boundary gate: block actions where tool credentials live beside generated code or where the action lacks user/on-behalf-of attribution.',
2565
- 'Token ROI gate: flag tokenmaxxing workflows that spend heavily without a defined outcome, eval, or proof of returned value.',
2566
- 'Response quality gate: require the agent to lead with the useful answer, call out weak assumptions, and avoid completion claims unless the evidence is attached.',
2567
- 'Model provenance gate: require approved provider domains, known model IDs, expected price ceilings, and no shadow API proxy before routing frontier work.',
2568
- 'Tool lockdown gate: disable or require explicit approval for browsing, downloads, agent mode, generated-code networking, and other outbound paths when sensitive data is in context.',
2569
- 'MCP config integrity gate: alert on ~/.claude.json routing changes, unfamiliar MCP endpoints, localhost proxy additions, OAuth refresh anomalies, and dependency postinstall hooks.',
2570
- 'Distributed gate mesh: keep enforcement close to each repo, tool, and workflow so one failed gate reduces coverage locally instead of collapsing the entire governance path.',
2571
- 'AI-authored code gate: require generated-diff provenance, human owner, tests, risk label, and rollback evidence once agent-authored changes cross a team-defined threshold.',
2572
- 'Customer-response draft gate: require retrieved source links, customer objective, response category, human approval, and no unsupported pricing/security claims before an email leaves draft mode.',
2573
- 'Structured intent gate: require scope, out-of-scope systems, ordered steps, allowed tools, acceptance criteria, and rollback expectations before async agent execution starts.',
2574
- 'Tool contract gate: require versioned schemas, explicit read/write permissions, stable error codes, observability hooks, and audit logging for every MCP tool call.',
2575
- 'Evaluation gate: require golden tasks, regression checks, build/test evidence, and traceable PR or artifact output before a repeated workflow is promoted to platform automation.',
2576
- 'Local classifier gate: run low-cost on-device models for first-pass risk labels, sensitive-data detection, and route selection, then escalate uncertain or high-blast-radius actions to stronger checks.',
2577
- 'Failure attribution graph: record intent, retrieved context, tool choice, local risk score, evidence, and outcome for each step so future gates reuse the causal path instead of starting from scratch.',
2578
- ],
2579
- },
2580
- {
2581
- heading: 'The buyer message',
2582
- paragraphs: [
2583
- 'The pitch is not "use fewer tokens" or "summarize harder." The pitch is: keep the agent productive by feeding it the right context, then stop it before risky actions unless the session, sandbox, credentials, and evidence are clean.',
2584
- 'This turns ThumbGate into the practitioner-led governance layer teams can adopt before top-down AI policy arrives. Start with one workflow, prove the gates locally, then expand to Pro or a hardening sprint once the same failure pattern recurs.',
2585
- ],
2586
- },
2587
- ],
2588
- faq: [
2589
- {
2590
- question: 'Is agent context governance just summarization?',
2591
- answer: 'No. Summarization compresses. Context governance decides what to preserve, prune, merge, verify, or block based on the agent, task, risk, and evidence required before the next action.',
2592
- },
2593
- {
2594
- question: 'Does this compete with Claude Managed Agents?',
2595
- answer: 'No. Managed Agents provide production infrastructure. ThumbGate can sit beside managed or self-hosted agents as the local-first gate that turns session history, permissions, prior feedback, and evidence requirements into action-level enforcement.',
2596
- },
2597
- {
2598
- question: 'What should teams implement first?',
2599
- answer: 'Start with one high-cost workflow: deployments, billing, browser automation, database changes, or customer messaging. Require clean context, isolated execution, credential separation, and evidence before that workflow can run.',
2600
- },
2601
- {
2602
- question: 'How does this apply to Claude custom instructions?',
2603
- answer: 'Treat directness instructions as a policy, not a vibe. ThumbGate can turn them into checks that flag rubber-stamp agreement, missing pushback, and success claims that are not grounded in command output or artifacts.',
2604
- },
2605
- {
2606
- question: 'How does ChatGPT Lockdown Mode help ThumbGate positioning?',
2607
- answer: 'It validates the category. Lockdown Mode limits high-risk tools to reduce exfiltration paths; ThumbGate brings the same idea to coding and automation agents with local pre-action checks, scoped approvals, and audit evidence.',
2608
- },
2609
- {
2610
- question: 'How should teams handle leaked or proxy-sold model claims?',
2611
- answer: 'Do not route production work to unapproved proxy endpoints. Require provider provenance, expected model IDs, price ceilings, and security review before an agent can use a new frontier model route.',
2612
- },
2613
- {
2614
- question: 'What is the first MCP security control to add?',
2615
- answer: 'Watch the local MCP routing configuration for endpoint changes, new proxy addresses, and unexpected OAuth refresh behavior. Then rotate connected tokens only after the malicious hook or config rewrite has been removed.',
2616
- },
2617
- {
2618
- question: 'Why mention random graph architecture in agent governance?',
2619
- answer: 'Because centralized approval paths become bottlenecks. ThumbGate should use a mesh of local gates across repos, tools, agents, and workflows so control is resilient, inspectable, and does not require one fragile platform migration.',
2620
- },
2621
- {
2622
- question: 'What changes when most new code is AI-authored?',
2623
- answer: 'Review moves from typing every line to governing provenance, tests, ownership, and rollback. ThumbGate can require evidence before AI-authored diffs merge or touch production workflows.',
2624
- },
2625
- {
2626
- question: 'How does this apply to AI email assistants?',
2627
- answer: 'Treat every generated reply as a draft until it has source-backed context, a known category, customer-specific constraints, and human approval. Feedback from edited drafts should become retrieval and wording rules, not permission to send automatically.',
2628
- },
2629
- {
2630
- question: 'What does platform ownership change?',
2631
- answer: 'It prevents every team from building a slightly different unsafe agent loop. A shared platform defines intent shape, approved tools, retries, sandboxing, evals, logging, and gates while teams keep control over domain judgment.',
2632
- },
2633
- {
2634
- question: 'Where do on-device QAT models fit?',
2635
- answer: 'Use them for cheap private triage: classify risk, detect sensitive context, choose a route, or decide whether to escalate. Do not let a small local classifier silently approve destructive or external actions.',
2636
- },
2637
- {
2638
- question: 'How does backpropagation help agent governance?',
2639
- answer: 'Use the chain-rule idea as an audit pattern. Break the run into steps, score each local decision, multiply risk through the path, and cache the attribution so the next similar workflow is blocked or escalated earlier.',
2640
- },
2641
- ],
2642
- relatedPaths: ['/guides/long-running-agent-context-management', '/guides/background-agent-governance', '/guides/hermes-agent-guardrails'],
2643
- },
2644
2405
  {
2645
2406
  query: 'roo code alternative cline',
2646
2407
  path: '/guides/roo-code-alternative-cline',
@@ -971,12 +971,12 @@ const TOOLS = [
971
971
  }),
972
972
  readOnlyTool({
973
973
  name: 'verify_claim',
974
- description: 'Check whether a claim has enough tracked evidence before the agent asserts it.',
974
+ description: 'Check whether a claim has enough tracked evidence before the agent asserts it, including tests-pass, commercial truth, GitHub metadata, and anthropomorphic AI claims such as "the model understands" or "the agent decided".',
975
975
  inputSchema: {
976
976
  type: 'object',
977
977
  required: ['claim'],
978
978
  properties: {
979
- claim: { type: 'string', description: 'The claim text to verify' },
979
+ claim: { type: 'string', description: 'The claim text to verify before assertion; human-like AI claims require anthropomorphic_claim_verified evidence.' },
980
980
  goalContract: GOAL_CONTRACT_SCHEMA,
981
981
  },
982
982
  },
@@ -172,30 +172,6 @@ async function embedWithGemini(text, options = {}) {
172
172
  return values.map(Number);
173
173
  }
174
174
 
175
- async function embedWithCoreAI(text, options = {}) {
176
- if (process.platform !== 'darwin') {
177
- throw new Error('Core AI is only supported on macOS');
178
- }
179
- const endpoint = process.env.THUMBGATE_COREAI_ENDPOINT || 'http://localhost:8088';
180
- try {
181
- const res = await fetch(`${endpoint}/embed`, {
182
- method: 'POST',
183
- headers: { 'Content-Type': 'application/json' },
184
- body: JSON.stringify({ text, options }),
185
- signal: AbortSignal.timeout(2000),
186
- });
187
- if (res.ok) {
188
- const payload = await res.json();
189
- if (Array.isArray(payload.embedding)) {
190
- return payload.embedding.map(Number);
191
- }
192
- }
193
- } catch (err) {
194
- throw new Error(`Core AI local service unavailable: ${err.message}`);
195
- }
196
- throw new Error('Core AI local service did not return a valid embedding');
197
- }
198
-
199
175
  async function embed(text, options = {}) {
200
176
  if (process.env.THUMBGATE_VECTOR_STUB_EMBED === 'true') {
201
177
  // Deterministic 384-dim unit vector: first element = 1.0, rest = 0.0
@@ -204,26 +180,6 @@ async function embed(text, options = {}) {
204
180
  return stub;
205
181
  }
206
182
  const geminiConfig = resolveGeminiEmbeddingConfig();
207
- if (geminiConfig.provider === 'coreai') {
208
- try {
209
- const vector = await embedWithCoreAI(text, options);
210
- _lastEmbeddingProfile = {
211
- generatedAt: new Date().toISOString(),
212
- source: 'local-coreai',
213
- activeProfile: {
214
- id: 'coreai',
215
- model: 'Core AI local model',
216
- outputDimensionality: vector.length,
217
- task: options.task || 'code retrieval',
218
- rationale: 'Local Core AI Apple Silicon accelerated path.',
219
- },
220
- fallbackUsed: false,
221
- };
222
- return vector;
223
- } catch (coreaiError) {
224
- console.warn(`Core AI embedding failed, falling back to local: ${coreaiError.message}`);
225
- }
226
- }
227
183
  if (geminiConfig.enabled) {
228
184
  try {
229
185
  const vector = await embedWithGemini(text, options);
@@ -108,74 +108,14 @@ function parseCommandScore(output = '', status = 0, approvalRate = 0.5) {
108
108
  };
109
109
  }
110
110
 
111
- function parseCommandLine(cmdString) {
112
- const args = [];
113
- let current = '';
114
- let inDoubleQuote = false;
115
- let inSingleQuote = false;
116
- let escaped = false;
117
-
118
- for (let i = 0; i < cmdString.length; i++) {
119
- const char = cmdString[i];
120
-
121
- if (escaped) {
122
- current += char;
123
- escaped = false;
124
- } else if (char === '\\') {
125
- if (inSingleQuote) {
126
- current += char;
127
- } else {
128
- escaped = true;
129
- }
130
- } else if (char === '"' && !inSingleQuote) {
131
- inDoubleQuote = !inDoubleQuote;
132
- } else if (char === "'" && !inDoubleQuote) {
133
- inSingleQuote = !inSingleQuote;
134
- } else if (char === ' ' && !inDoubleQuote && !inSingleQuote) {
135
- if (current) {
136
- args.push(current);
137
- current = '';
138
- }
139
- } else {
140
- current += char;
141
- }
142
- }
143
- if (current) {
144
- args.push(current);
145
- }
146
- return args;
147
- }
148
-
149
111
  function runCommand(command, {
150
112
  cwd = process.cwd(),
151
113
  env = process.env,
152
114
  timeoutMs = DEFAULT_TIMEOUT_MS,
153
115
  } = {}) {
154
116
  const startedAt = Date.now();
155
- const args = parseCommandLine(command);
156
- const exec = args.shift();
157
-
158
- const execBase = require('node:path').basename(exec).toLowerCase();
159
- let safeExec;
160
- if (exec === process.execPath) {
161
- safeExec = process.execPath;
162
- } else if (execBase === 'node' || execBase === 'node.exe') {
163
- safeExec = process.execPath;
164
- } else if (execBase === 'npm') {
165
- safeExec = 'npm';
166
- } else if (execBase === 'npm.cmd') {
167
- safeExec = 'npm.cmd';
168
- } else if (execBase === 'python3') {
169
- safeExec = 'python3';
170
- } else if (execBase === 'python') {
171
- safeExec = 'python';
172
- } else if (execBase === 'pytest') {
173
- safeExec = 'pytest';
174
- } else {
175
- throw new Error(`Binary ${exec} is not authorized for workspace evolution.`);
176
- }
177
-
178
- const result = spawnSync(safeExec, args, {
117
+ const result = spawnSync(command, [], {
118
+ shell: true,
179
119
  cwd,
180
120
  env,
181
121
  encoding: 'utf8',