thumbgate 1.28.4 → 1.29.2

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 (87) hide show
  1. package/.claude/commands/dashboard.md +11 -1
  2. package/.claude/commands/thumbgate-dashboard.md +23 -8
  3. package/.claude-plugin/plugin.json +1 -1
  4. package/.well-known/llms.txt +18 -10
  5. package/.well-known/mcp/server-card.json +1 -1
  6. package/README.md +66 -3
  7. package/adapters/claude/.mcp.json +2 -2
  8. package/adapters/forge/forge.yaml +3 -3
  9. package/adapters/mcp/server-stdio.js +88 -2
  10. package/adapters/opencode/opencode.json +1 -1
  11. package/bin/cli.js +8 -8
  12. package/bin/postinstall.js +4 -13
  13. package/commands/dashboard.md +11 -1
  14. package/commands/thumbgate-dashboard.md +23 -8
  15. package/config/agent-outcome-monitor-thresholds.json +63 -0
  16. package/config/evals/agent-outcomes-baseline.json +17 -0
  17. package/config/evals/agent-outcomes-golden.json +412 -0
  18. package/config/evals/prompt-eval-baseline.json +23 -0
  19. package/config/github-about.json +5 -4
  20. package/config/post-deploy-marketing-pages.json +6 -6
  21. package/config/schemas/task-outcome-receipt.schema.json +296 -0
  22. package/docs/integrations/grafana/README.md +109 -0
  23. package/docs/integrations/grafana/thumbgate-revenue-evidence-dashboard.json +1930 -0
  24. package/openapi/openapi.yaml +475 -5
  25. package/package.json +75 -22
  26. package/public/agent-manager.html +10 -11
  27. package/public/agents-cost-savings.html +2 -2
  28. package/public/assets/brand/thumbgate-logo-transparent.svg +6 -11
  29. package/public/assets/brand/thumbgate-mark-inline-v3.svg +11 -10
  30. package/public/assets/brand/thumbgate-mark.svg +10 -11
  31. package/public/blog/inside-your-boundary.html +114 -0
  32. package/public/blog/process-over-outcome-gates.html +119 -0
  33. package/public/blog.html +296 -402
  34. package/public/brand/thumbgate-mark.svg +5 -9
  35. package/public/codex-enterprise.html +2 -2
  36. package/public/compare.html +12 -3
  37. package/public/diagnostic.html +79 -29
  38. package/public/guide.html +4 -4
  39. package/public/index.html +1090 -2098
  40. package/public/install.html +3 -3
  41. package/public/js/buyer-intent.js +33 -18
  42. package/public/numbers.html +2 -2
  43. package/public/pricing.html +268 -408
  44. package/public/pro.html +4 -4
  45. package/scripts/agent-outcome-eval.js +130 -0
  46. package/scripts/agent-outcome-monitor.js +261 -0
  47. package/scripts/agent-reasoning-traces.js +8 -9
  48. package/scripts/async-job-runner.js +107 -13
  49. package/scripts/billing.js +456 -126
  50. package/scripts/buyer-paths.js +102 -0
  51. package/scripts/cli-feedback.js +2 -2
  52. package/scripts/commercial-offer.js +18 -10
  53. package/scripts/durability/step.js +121 -12
  54. package/scripts/external-customer-audit.js +881 -0
  55. package/scripts/feedback-loop.js +26 -0
  56. package/scripts/gates-engine.js +554 -19
  57. package/scripts/grafana-revenue-evidence.js +856 -0
  58. package/scripts/human-escalation.js +265 -0
  59. package/scripts/hybrid-feedback-context.js +93 -50
  60. package/scripts/jsonl-window.js +89 -0
  61. package/scripts/judge-reward-function.js +30 -18
  62. package/scripts/lesson-embedding-index.js +3 -7
  63. package/scripts/meta-agent-loop.js +20 -2
  64. package/scripts/observability-env.js +139 -0
  65. package/scripts/observability-setup.js +55 -0
  66. package/scripts/plausible-domain-config.js +4 -0
  67. package/scripts/prompt-eval.js +81 -4
  68. package/scripts/provider-live-evidence.js +1290 -0
  69. package/scripts/provider-payment-reconciler.js +442 -0
  70. package/scripts/provider-revenue-evidence.js +249 -0
  71. package/scripts/rate-limiter.js +1 -5
  72. package/scripts/revenue-action-eligibility.js +414 -0
  73. package/scripts/revenue-evidence-remediation.js +694 -0
  74. package/scripts/revenue-offer-system.js +709 -0
  75. package/scripts/sales-pipeline.js +1117 -0
  76. package/scripts/schedule-manager.js +249 -0
  77. package/scripts/seo-gsd.js +8 -4
  78. package/scripts/stripe-credentials.js +37 -0
  79. package/scripts/stripe-revenue-catalog-audit.js +363 -0
  80. package/scripts/stripe-revenue-catalog.js +164 -0
  81. package/scripts/task-outcomes.js +425 -0
  82. package/scripts/telemetry-analytics.js +23 -3
  83. package/scripts/tool-contract-validator.js +287 -59
  84. package/scripts/tool-registry.js +143 -0
  85. package/scripts/vector-store.js +83 -7
  86. package/scripts/workflow-intake-queue.js +483 -0
  87. package/src/api/server.js +647 -118
@@ -1,15 +1,25 @@
1
1
  ---
2
2
  name: dashboard
3
3
  description: Open the local HTTP dashboard for the current project in your web browser.
4
+ allowed-tools: Bash(npx thumbgate dashboard:*)
4
5
  ---
5
6
 
6
7
  # Open Dashboard
7
8
 
8
9
  Open the local HTTP dashboard for the current project in your web browser.
9
10
 
11
+ This command wraps existing ThumbGate capability — **no new logic**.
12
+
10
13
  ## Instructions
14
+
11
15
  Execute the following command in the project directory to open the browser dashboard scoped to the current repository:
16
+
12
17
  ```bash
13
- thumbgate-dashboard
18
+ npx thumbgate dashboard --open
14
19
  ```
15
20
 
21
+ Standalone shortcut:
22
+
23
+ ```bash
24
+ thumbgate-dashboard
25
+ ```
@@ -1,15 +1,30 @@
1
1
  ---
2
2
  name: thumbgate-dashboard
3
- description: Open the local HTTP dashboard for the current project in your web browser.
3
+ description: Open the local HTTP dashboard for the current project in your web browser. Use for "open dashboard", "thumbgate-dashboard", "show my gates in the browser", "project dashboard", or "open the local ThumbGate UI".
4
+ allowed-tools: Bash(npx thumbgate dashboard:*)
4
5
  ---
5
6
 
6
- # Open Scoped ThumbGate Dashboard
7
+ # ThumbGate Dashboard
7
8
 
8
- Open the local HTTP dashboard for the current project in your web browser.
9
+ Open the local HTTP dashboard for the current project so you can inspect lessons, checks, gate stats, and tokens saved in the browser.
9
10
 
10
- ## Instructions
11
- Execute the following command in the project directory to open the browser dashboard:
12
- ```bash
13
- thumbgate-dashboard
14
- ```
11
+ This command wraps existing ThumbGate capability — **no new logic**. It runs the existing project-scoped dashboard opener.
12
+
13
+ ## Steps
14
+
15
+ 1. Open the project-scoped dashboard:
16
+ ```bash
17
+ npx thumbgate dashboard --open
18
+ ```
19
+ Equivalent standalone shortcut after a global install:
20
+ ```bash
21
+ thumbgate-dashboard
22
+ ```
23
+ 2. Confirm the browser lands on the local dashboard for this repo (lessons, checks, gate stats, tokens saved).
24
+ 3. If the command fails, run `npx thumbgate doctor` — a missing install is usually fixed by `npx thumbgate init`.
15
25
 
26
+ ## Example
27
+
28
+ ```
29
+ /thumbgate-dashboard
30
+ ```
@@ -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.28.4",
4
+ "version": "1.29.2",
5
5
  "author": {
6
6
  "name": "Igor Ganapolsky",
7
7
  "email": "ig5973700@gmail.com",
@@ -1,12 +1,19 @@
1
- # ThumbGate — Stop AI agents before they make costly mistakes.
1
+ # ThumbGate — Self-Improving Firewall for Your AI Agents
2
2
  # https://thumbgate.ai
3
3
  # https://github.com/IgorGanapolsky/ThumbGate
4
4
  # https://www.npmjs.com/package/thumbgate
5
5
 
6
- > ThumbGate prevents expensive AI mistakes before they happen. It checks
7
- > risky commands, file edits, deploys, payments, API calls, and other agent
8
- > actions before execution. 👎 Thumbs down becomes a history-aware lesson and
9
- > a Pre-Action Check; 👍 thumbs up reinforces safe patterns.
6
+ > ThumbGate is the self-improving firewall that prevents expensive AI mistakes
7
+ > before they happen. It checks risky commands, file edits, deploys, payments,
8
+ > API calls, and other agent actions before execution. Explicit feedback becomes
9
+ > reviewable local lessons; relevant lessons are re-ranked for each proposed
10
+ > action; repeated negative patterns can promote from warning to blocking gates;
11
+ > stale auto-promoted gates expire; and stale lessons archive. ThumbGate improves
12
+ > the external control layer without changing model weights.
13
+
14
+ ## Store story
15
+
16
+ ThumbGate: the self-improving firewall for AI agents. Every approval teaches it what to allow, block, or escalate next time. Self-improving under your control—not silent policy rewrite. Hermes Mobile is the control surface; ThumbGate is the learning safety layer inside it.
10
17
 
11
18
  ## What ThumbGate solves
12
19
 
@@ -19,11 +26,12 @@
19
26
 
20
27
  ## How it works
21
28
 
22
- 1. Agent makes a mistake developer gives thumbs-down
23
- 2. ThumbGate captures context and infers a structured lesson
24
- 3. Recurring failures get promoted to prevention rules
25
- 4. PreToolUse hooks block the pattern before it executes again
26
- 5. Thompson Sampling adapts gate confidence over time
29
+ 1. A developer records explicit feedback with the action and outcome context
30
+ 2. ThumbGate stores the feedback as a reviewable local lesson
31
+ 3. Relevant lessons are re-ranked for the proposed action
32
+ 4. Repeated negative patterns can promote from warning to blocking gates
33
+ 5. PreToolUse hooks return allow, warn, or deny before the next matching action
34
+ 6. Stale auto-promoted gates expire and stale lessons archive
27
35
 
28
36
  ## Agentic development cycle fit
29
37
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thumbgate",
3
- "version": "1.28.4",
3
+ "version": "1.29.2",
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
@@ -6,11 +6,11 @@
6
6
  </a>
7
7
  </p>
8
8
 
9
- **AI coding agents repeat mistakes — and one wrong tool call can wipe a directory, leak a key, or push broken code.**
9
+ **Self-Improving Firewall for Your AI Agents.** AI coding agents repeat mistakes — and one wrong tool call can wipe a directory, leak a key, or push broken code.
10
10
 
11
11
  ThumbGate is the local-first Pre-Action Checks engine for AI coding agents. It runs in the PreToolUse hook on your machine: it evaluates a proposed tool call and logs the decision before tool execution. It **hard-blocks detected secret leaks and two direct self-disable command classes by default** — commands that terminate the ThumbGate gate process or enable its bypass environment override. Other high-risk classes, including destructive deletes (`rm -rf`), force-push, fetch-and-run, direct guardrail-file edits, off-scope edits, and deploys, **warn and log by default**. Set `THUMBGATE_STRICT_ENFORCEMENT=1` to preserve deny decisions for every matched blocking rule. Works across configured Claude Code, Cursor, Codex, Gemini, Amp, Cline, and OpenCode integrations. No server is required on the local enforcement path. (Regulated-industry policy templates are roadmap directions, not shipped compliance claims.)
12
12
 
13
- Accepted feedback is stored as local lessons. Repeated concrete failures can become prevention rules that flag or block matching tool calls according to policy.
13
+ Accepted feedback is stored as local lessons. Repeated concrete failures can become prevention rules that promote from warnings to blocking gates; relevant lessons are re-ranked for each proposed action; stale auto-promoted gates expire; and stale lessons archive. The firewall improves from operations without retraining the model.
14
14
 
15
15
  <p align="center">
16
16
  <img src="docs/media/thumbgate-demo.gif" alt="ThumbGate gating an AI agent's dangerous commands (rm -rf, force-push, chmod 777) in real time — flagging them by default and hard-blocking under strict mode, while letting safe commands through" width="820" />
@@ -65,12 +65,15 @@ Spec-driven agent frameworks like **GSD** (get-shit-done) and **GitHub Spec Kit*
65
65
 
66
66
  | Command | What it does | Wraps (existing capability) |
67
67
  |---------|--------------|------------------------------|
68
+ | **`/thumbgate-dashboard`** | **Open the local project dashboard in your browser** (lessons, checks, tokens saved) | **`npx thumbgate dashboard --open`** (global bin after `npm i -g`) |
68
69
  | `/thumbgate-guard` | Turn the last agent mistake into a hard prevention rule | `capture_feedback` + `thumbgate force-gate` |
69
70
  | `/thumbgate-rules` | List the active prevention rules + lessons guarding this repo | `prevention_rules`, `get_reliability_rules`, `search_lessons` |
70
71
  | `/thumbgate-blocked` | Show what's actually been blocked — gate stats + enforcement matrix | `gate_stats`, `enforcement_matrix` |
71
72
  | `/thumbgate-protect` | Show branch/release governance; grant a scoped, expiring approval | `get_branch_governance`, `approve_protected_action` |
72
73
  | `/thumbgate-doctor` | Health-check the wiring (hooks, MCP, agent-readiness) | `thumbgate doctor` |
73
74
 
75
+ > **Open the dashboard anytime:** after `npx thumbgate init`, run **`npx thumbgate dashboard --open`** (works without a global install). Type **`/thumbgate-dashboard`** in Claude Code / Cursor, or **`/project:thumbgate-dashboard`** in Grok. After `npm i -g thumbgate`, the **`thumbgate-dashboard`** bin is also on your PATH.
76
+
74
77
  Each is a thin wrapper over an existing MCP tool or CLI command — **no new enforcement logic, just discoverability**.
75
78
 
76
79
  ---
@@ -196,6 +199,63 @@ Hand-rolled hooks are the right tool for a small, static denylist you maintain b
196
199
 
197
200
  Prompt engineering still matters, but it is only the starting point. ThumbGate adds prompt evaluation on top: proof lanes, benchmarks, and self-heal checks produce reviewable evidence about whether a prompt and workflow held up under execution. Run `npx thumbgate eval --from-feedback --write-report=.thumbgate/prompt-eval-proof.md` to turn accepted thumbs-up/down feedback into reusable eval cases and a local proof report.
198
201
 
202
+ ### How ThumbGate knows an AI agent is working
203
+
204
+ ThumbGate does not treat a plausible response, a successful tool call, or a
205
+ demo as task success. The `record_task_outcome` MCP tool and
206
+ `POST /v1/task-outcomes` API require a task-level receipt. A receipt is marked
207
+ `working: true` only when the task is completed, verification passed, evidence
208
+ is present, tool contracts and policy checks passed, no unsupported claim was
209
+ recorded, and no side effect was duplicated.
210
+
211
+ The metrics remain separate so a strong average cannot conceal an unsafe
212
+ failure:
213
+
214
+ | Layer | Measured signals |
215
+ |-------|------------------|
216
+ | Task | verified completion, evidence-backed completion, first-attempt success, repeated failure, recovery, rollback |
217
+ | Tool | contract accuracy, execution success, retry rate, duplicate side effects |
218
+ | Safety | unsafe escapes, policy violations, safe-action false blocks |
219
+ | Escalation | correct escalation rate and human decision latency |
220
+ | Efficiency | p50/p95 latency, total cost, cost per verified success |
221
+ | Business | explicit KPI values grouped by unit; no inferred revenue |
222
+
223
+ ```bash
224
+ npm run eval:agent-outcomes # 8 reviewed golden cases; fails on regression
225
+ npm run monitor:agent-outcomes # local production receipts; fails on missing evidence
226
+ npm run monitor:agent-outcomes -- --hosted
227
+ npm run monitor:agent-outcomes -- --install-schedule
228
+ ```
229
+
230
+ Prompt evaluation is deterministic first. JSON outputs are validated against
231
+ their declared schema. An LLM judge may add a separate score, but an unavailable
232
+ or failed judge is reported as `deterministic_only`; it is never converted into
233
+ a neutral pass. Empty feedback or task-outcome datasets return
234
+ `insufficient_evidence`.
235
+
236
+ Task outcome receipts are stored locally in
237
+ `.thumbgate/task-outcome-receipts.jsonl`. Observable tool traces exclude raw
238
+ hidden reasoning and deterministic tool-argument fingerprints. Human
239
+ escalation requests are append-only, must carry evidence and requester
240
+ identity, and expire. Decisions require both the ordinary API credential and
241
+ an independently revocable `X-ThumbGate-Human-Reviewer-Key`; the decision
242
+ actor comes from server-side `THUMBGATE_HUMAN_REVIEWER_ID` configuration, not
243
+ from caller-controlled JSON.
244
+
245
+ The installed daily monitor runs through ThumbGate's local scheduler rather
246
+ than consuming a GitHub-hosted cron runner. It reads operator authentication
247
+ from the existing environment or local operator config, never from command-line
248
+ arguments, and writes a machine-readable report under
249
+ `~/.thumbgate/reports/agent-outcome-monitor.json`. The GitHub workflow remains
250
+ manual for release-time verification.
251
+
252
+ The complete five-system architecture review—local RAG, tool-using agents,
253
+ multi-agent handoffs, MCP enterprise integration, and production
254
+ evaluation/observability—is maintained in
255
+ [`VERIFICATION_EVIDENCE.md`](./VERIFICATION_EVIDENCE.md). It answers why each
256
+ architecture exists, what can fail, how it is measured and secured, how it is
257
+ deployed, and what evidence is required before claiming it works.
258
+
199
259
  ### Retrieval & latency: local-first, zero network hops
200
260
 
201
261
  ThumbGate's latency advantage is structural, not a tuned cloud cluster: there is no retrieval service and no model on the enforcement path, so the gate decision never leaves your machine.
@@ -385,7 +445,7 @@ npx thumbgate background-governance # review background-agent run risk
385
445
  npx thumbgate model-candidates --workload=dashboard-analysis --provider=openai --json # evaluate GPT-5.5 routing
386
446
  npx thumbgate native-messaging-audit # inspect local browser bridges and extension hosts
387
447
  npx thumbgate dashboard --open # open local project-scoped dashboard in browser
388
- thumbgate-dashboard # standalone browser dashboard shortcut (run '/project:thumbgate-dashboard' in Claude/Grok)
448
+ thumbgate-dashboard # global bin after npm i -g thumbgate; agents: /thumbgate-dashboard (Claude/Cursor) or /project:thumbgate-dashboard (Grok)
389
449
  npx thumbgate check-update # check if a new version is available on npm/GitHub
390
450
  npx thumbgate self-update # update ThumbGate to the latest version globally
391
451
  npx thumbgate serve # start MCP server on stdio
@@ -561,6 +621,7 @@ Every Changeset is tied to the exact `main` merge commit and generates Verificat
561
621
  - **[Perplexity Command Center](docs/PERPLEXITY_MAX_COMMAND_CENTER.md)** — AI-search visibility + lead discovery
562
622
  - **[ThumbGate Bench](docs/THUMBGATE_BENCH.md)** — Reliability benchmark and ProgramBench-style cleanroom proof lane
563
623
  - **[Manus AI Skill](skills/thumbgate/SKILL.md)** — ThumbGate integration for Manus AI agents
624
+ - **Grafana Cloud revenue evidence** — The npm package includes a PII-free aggregate exporter and importable Loki dashboard. Generate the dashboard locally with `thumbgate-revenue-evidence --dashboard --out thumbgate-revenue-evidence-dashboard.json`. Snapshot preparation is dry-run by default; network delivery requires both `--send` and `THUMBGATE_GRAFANA_ZERO_SPEND_CONFIRMED=1`. Dashboard observations never promote clicks, checkout starts, or intakes into payment or customer claims. Repository operators can use the full [Grafana integration guide](docs/integrations/grafana/README.md).
564
625
 
565
626
  ---
566
627
 
@@ -626,6 +687,8 @@ Pro ($19/mo or $149/yr) is for individual operators and adds history-aware lesso
626
687
  - [**ThumbGate for Federal Agencies**](docs/FEDERAL.md) — pilot-ready posture, NIST 800-53 control mapping, OMB M-24-10 / EO 14110 alignment. Landing page: [thumbgate.ai/federal](https://thumbgate.ai/federal).
627
688
  - [First Dollar Playbook](docs/FIRST_DOLLAR_PLAYBOOK.md) — turning one painful workflow into the next booked pilot
628
689
  - [Commercial Truth](docs/COMMERCIAL_TRUTH.md) — pricing, claims, what we don't say
690
+ - [Sales Pipeline Evidence Contract](docs/SALES_PIPELINE_EVIDENCE.md) — stage-specific receipts, audits, and verified-revenue rules
691
+ - [Revenue Offer Ladder](docs/REVENUE_OFFER_LADDER.md) — productized diagnostic, sprint, recurring, and Enterprise economics without traction inflation
629
692
  - [Goal Contracts](docs/GOAL_CONTRACTS.md) — evidence-before-done contracts for multi-agent handoffs
630
693
  - [Changeset Strategy](docs/CHANGESET_STRATEGY.md) — release notes and version bump enforcement
631
694
  - [Release Confidence](docs/RELEASE_CONFIDENCE.md) — changesets, version checks, proof lanes
@@ -2,13 +2,13 @@
2
2
  "mcpServers": {
3
3
  "thumbgate": {
4
4
  "command": "npx",
5
- "args": ["--yes", "--package", "thumbgate@1.28.4", "thumbgate", "serve"]
5
+ "args": ["--yes", "--package", "thumbgate@1.29.2", "thumbgate", "serve"]
6
6
  }
7
7
  },
8
8
  "hooks": {
9
9
  "preToolUse": {
10
10
  "command": "npx",
11
- "args": ["--yes", "--package", "thumbgate@1.28.4", "thumbgate", "gate-check"]
11
+ "args": ["--yes", "--package", "thumbgate@1.29.2", "thumbgate", "gate-check"]
12
12
  }
13
13
  }
14
14
  }
@@ -9,12 +9,12 @@ version: "1"
9
9
  skills:
10
10
  thumbgate-gate-check:
11
11
  description: "ThumbGate PreToolUse gate — blocks known-bad tool calls"
12
- command: "npx --yes --package thumbgate@1.28.4 thumbgate gate-check"
12
+ command: "npx --yes --package thumbgate@1.29.2 thumbgate gate-check"
13
13
  trigger: pre_tool_use
14
14
 
15
15
  thumbgate-feedback:
16
16
  description: "ThumbGate feedback capture — logs user prompt context"
17
- command: "npx --yes --package thumbgate@1.28.4 thumbgate hook-auto-capture"
17
+ command: "npx --yes --package thumbgate@1.29.2 thumbgate hook-auto-capture"
18
18
  trigger: user_prompt
19
19
 
20
20
  mcp:
@@ -23,6 +23,6 @@ mcp:
23
23
  args:
24
24
  - "--yes"
25
25
  - "--package"
26
- - "thumbgate@1.28.4"
26
+ - "thumbgate@1.29.2"
27
27
  - "thumbgate"
28
28
  - "serve"
@@ -85,6 +85,17 @@ const {
85
85
  pairFeedbackWithReceipt,
86
86
  buildReceiptContextEntries,
87
87
  } = require('../../scripts/action-receipts');
88
+ const {
89
+ calculateTaskOutcomeMetrics,
90
+ getTaskOutcome,
91
+ readTaskOutcomes,
92
+ recordTaskOutcome,
93
+ } = require('../../scripts/task-outcomes');
94
+ const {
95
+ listEscalations,
96
+ requestEscalation,
97
+ } = require('../../scripts/human-escalation');
98
+ const { recordReasoningTrace } = require('../../scripts/agent-reasoning-traces');
88
99
  const {
89
100
  evaluateOperationalIntegrity,
90
101
  } = require('../../scripts/operational-integrity');
@@ -305,7 +316,7 @@ const {
305
316
  finalizeSession: finalizeFeedbackSession,
306
317
  } = require('../../scripts/feedback-session');
307
318
 
308
- const SERVER_INFO = { name: 'thumbgate-mcp', version: '1.28.4' };
319
+ const SERVER_INFO = { name: 'thumbgate-mcp', version: '1.29.2' };
309
320
  const COMMERCE_CATEGORIES = [
310
321
  'product_recommendation',
311
322
  'brand_compliance',
@@ -773,6 +784,11 @@ async function callTool(name, args = {}) {
773
784
  const err = new Error(`Tool contract violation on '${name}': ${validation.errors.join('; ')}`);
774
785
  err.errorCategory = 'contract';
775
786
  err.isRetryable = false;
787
+ recordMcpToolTrace(name, args, {
788
+ success: false,
789
+ category: 'contract',
790
+ evidence: validation.errors,
791
+ });
776
792
  throw err;
777
793
  }
778
794
  }
@@ -783,12 +799,34 @@ async function callTool(name, args = {}) {
783
799
  const err = new Error(`Action blocked by Semantic Firewall: ${firewallResult.message}`);
784
800
  err.errorCategory = 'permission';
785
801
  err.isRetryable = false;
802
+ recordMcpToolTrace(name, args, {
803
+ success: false,
804
+ category: 'permission',
805
+ evidence: [firewallResult.message],
806
+ });
786
807
  throw err;
787
808
  }
788
809
  }
789
810
  const startMs = Date.now();
790
- const result = await callToolInner(name, args);
811
+ let result;
812
+ try {
813
+ result = await callToolInner(name, args);
814
+ } catch (err) {
815
+ recordMcpToolTrace(name, args, {
816
+ success: false,
817
+ category: err.errorCategory || 'execution',
818
+ evidence: [err.code || err.message || 'tool execution failed'],
819
+ latencyMs: Date.now() - startMs,
820
+ });
821
+ throw err;
822
+ }
791
823
  const latencyMs = Date.now() - startMs;
824
+ recordMcpToolTrace(name, args, {
825
+ success: true,
826
+ category: 'success',
827
+ evidence: [`tool completed in ${latencyMs}ms`],
828
+ latencyMs,
829
+ });
792
830
  try {
793
831
  const { recordAuditEvent } = require('../../scripts/audit-trail');
794
832
  recordAuditEvent({
@@ -802,6 +840,41 @@ async function callTool(name, args = {}) {
802
840
  return result;
803
841
  }
804
842
 
843
+ function recordMcpToolTrace(name, args, outcome = {}) {
844
+ try {
845
+ const traceId = args.traceId || args.taskId || `mcp-${Date.now()}-${name}`;
846
+ recordReasoningTrace({
847
+ trace_id: traceId,
848
+ task_type: 'tool-use',
849
+ source: 'mcp-runtime',
850
+ success: outcome.success,
851
+ outcome: {
852
+ success: outcome.success,
853
+ terminalState: outcome.category,
854
+ },
855
+ messages: [
856
+ {
857
+ role: 'assistant',
858
+ content: `tool: ${name}`,
859
+ tool_calls: [{ function: { name } }],
860
+ },
861
+ {
862
+ role: 'tool',
863
+ content: `tool response: ${outcome.category}; ${outcome.evidence?.join('; ') || 'no evidence'}`,
864
+ success: outcome.success,
865
+ },
866
+ ],
867
+ metadata: {
868
+ latencyMs: outcome.latencyMs || 0,
869
+ argumentFingerprintStored: false,
870
+ rawArgumentsStored: false,
871
+ },
872
+ });
873
+ } catch {
874
+ // Trace telemetry must not change the tool's functional outcome.
875
+ }
876
+ }
877
+
805
878
  async function callToolInner(name, args) {
806
879
  args = args || {};
807
880
  // Semantic Aliases for high-level branding alignment
@@ -1154,6 +1227,19 @@ async function callToolInner(name, args) {
1154
1227
  ? getReceiptForAction(args.actionId)
1155
1228
  : getRecentReceipts(Number(args.limit || 20)),
1156
1229
  );
1230
+ case 'record_task_outcome':
1231
+ return toTextResult(recordTaskOutcome(args));
1232
+ case 'get_task_outcomes': {
1233
+ if (args.taskId) return toTextResult(getTaskOutcome(args.taskId));
1234
+ const limit = Number(args.limit || 20);
1235
+ return toTextResult(readTaskOutcomes().slice(-limit));
1236
+ }
1237
+ case 'get_agent_outcome_metrics':
1238
+ return toTextResult(calculateTaskOutcomeMetrics(readTaskOutcomes()));
1239
+ case 'request_human_escalation':
1240
+ return toTextResult(requestEscalation(args));
1241
+ case 'list_human_escalations':
1242
+ return toTextResult(listEscalations({ status: args.status }).slice(0, Number(args.limit || 20)));
1157
1243
  case 'verify_claim':
1158
1244
  return toTextResult(verifyClaimEvidence(args.claim, { goalContract: args.goalContract }));
1159
1245
  case 'require_evidence_for_claim': {
@@ -7,7 +7,7 @@
7
7
  "npx",
8
8
  "--yes",
9
9
  "--package",
10
- "thumbgate@1.28.4",
10
+ "thumbgate@1.29.2",
11
11
  "thumbgate",
12
12
  "serve"
13
13
  ],
package/bin/cli.js CHANGED
@@ -131,7 +131,7 @@ function upgradeNudge() {
131
131
  const pricingUrl = pricingUrlFor('cli_upgrade_nudge', COMMAND || 'general');
132
132
  const diagnosticUrl = diagnosticUrlFor('cli_upgrade_nudge', COMMAND || 'general');
133
133
  process.stderr.write(
134
- '\n Team rollout: start with the $499 Workflow Hardening Diagnostic\n' +
134
+ '\n Enterprise entry: $499 Enterprise Workflow Gate for one workflow\n' +
135
135
  ` ${diagnosticUrl}\n` +
136
136
  `\n Solo side lane: Pro — ${PRO_PRICE_LABEL}\n` +
137
137
  ' Removes solo caps; adds personal recall, dashboard proof, exports, and managed adapters.\n' +
@@ -143,8 +143,8 @@ function diagnostic() {
143
143
  const intakeUrl = diagnosticUrlFor('cli_diagnostic', COMMAND || 'diagnostic');
144
144
  const checkoutUrl = diagnosticCheckoutUrlFor('cli_diagnostic', COMMAND || 'diagnostic');
145
145
  console.log('');
146
- console.log(' ThumbGate Workflow Hardening Diagnostic');
147
- console.log(' ---------------------------------------');
146
+ console.log(' ThumbGate Enterprise Workflow Gate — $499');
147
+ console.log(' ------------------------------------------');
148
148
  console.log(' Use this when one repeated AI-agent workflow failure is already costing');
149
149
  console.log(' review time, release confidence, customer trust, or money.');
150
150
  console.log('');
@@ -1500,8 +1500,8 @@ function stats() {
1500
1500
  console.log(` Repeated Failures detected: ${payload.negatives}`);
1501
1501
  console.log(` Estimated Operational Loss: $${payload.revenueAtRisk}`);
1502
1502
  console.log(' Action Required: Run "npx thumbgate rules" to generate guardrails.');
1503
- console.log(' Strategic Recommendation: if this is a shared workflow problem, start the Workflow Hardening Sprint.');
1504
- console.log(' Team intake: https://thumbgate.ai/#workflow-sprint-intake');
1503
+ console.log(' Strategic Recommendation: if this is a shared workflow problem, start with the $499 Enterprise Workflow Gate.');
1504
+ console.log(' Enterprise entry: https://thumbgate.ai/pricing');
1505
1505
  console.log(' Solo side lane: npx thumbgate pro');
1506
1506
  } else {
1507
1507
  console.log('\n✅ System is currently high-reliability. No immediate revenue loss detected.');
@@ -1629,7 +1629,7 @@ function pro() {
1629
1629
  console.log(' - Personal recall: search lessons, rules, and proof');
1630
1630
  console.log(' - Local Pro dashboard: your own browser dashboard for search, gates, and DPO export');
1631
1631
  console.log(' - Managed adapters: Claude Code, Cursor, Codex, Gemini, Amp, Cline, OpenCode');
1632
- console.log(' - Team rollout path: Enterprise adds shared hosted lessons, org visibility, workflow proof');
1632
+ console.log(' - Enterprise Workflow Gate: $499 for one supported workflow; hosted team sync and org dashboard are not GA');
1633
1633
  console.log(' - Commercial truth doc: source of truth for traction, pricing, and proof claims');
1634
1634
  console.log('\nLinks:');
1635
1635
  console.log(` Buy Pro : ${PRO_CHECKOUT_URL}`);
@@ -3144,7 +3144,7 @@ function help() {
3144
3144
  console.log(' break-glass --reason="..." Short TTL recovery if gates over-fire');
3145
3145
  console.log(' brain [--write] Build the agent-readable context brain (lessons + rules + gates)');
3146
3146
  console.log(' pro ThumbGate Pro (dashboard, exports, sync)');
3147
- console.log(' diagnostic $499 Workflow Hardening Diagnostic for one repeated team failure');
3147
+ console.log(' diagnostic $499 Enterprise Workflow Gate for one repeated team failure');
3148
3148
  console.log(' subscribe <email> Get the 5-min setup guide + weekly tips by email');
3149
3149
  console.log('');
3150
3150
  console.log('More:');
@@ -3289,7 +3289,7 @@ const SUBCOMMAND_HELP = {
3289
3289
  stats: 'Usage: npx thumbgate stats\n\nShow gate enforcement statistics: blocked/warned counts, active gates, time saved.',
3290
3290
  trial: 'Usage: npx thumbgate trial\n\nShow Pro trial status, remaining days, and upgrade path.',
3291
3291
  pro: 'Usage: npx thumbgate pro [--activate <key>]\n\nLaunch the local Pro dashboard or activate a Pro license key.',
3292
- diagnostic: 'Usage: npx thumbgate diagnostic\n\nShow the $499 Workflow Hardening Diagnostic intake and checkout paths for teams with one repeated AI-agent workflow failure.',
3292
+ diagnostic: 'Usage: npx thumbgate diagnostic\n\nShow the $499 Enterprise Workflow Gate fit-check and checkout paths for teams with one repeated AI-agent workflow failure.',
3293
3293
  subscribe: 'Usage: npx thumbgate subscribe <email>\n\nSubscribe to the 5-minute setup guide + trial reminders.',
3294
3294
  lessons: 'Usage: npx thumbgate lessons [--query="..."] [--limit=N]\n\nSearch the lesson database (Pro feature).',
3295
3295
  search: 'Usage: npx thumbgate search <query>\n\nSearch ThumbGate knowledge base (Pro feature).',
@@ -12,27 +12,18 @@ const isQuiet = process.env.THUMBGATE_NO_NUDGE === '1' || process.env.npm_config
12
12
 
13
13
  if (isCI || isQuiet) process.exit(0);
14
14
 
15
- const {
16
- PRO_MONTHLY_PAYMENT_LINK,
17
- PRO_PRICE_LABEL,
18
- TEAM_PRICE_LABEL,
19
- } = require('../scripts/commercial-offer');
20
-
21
- // Tracked click-through path: /go/pro → /checkout/pro → Stripe.
22
- // This captures UTM attribution in our funnel before handing off to Stripe.
23
- const PRO_CTA_URL = 'https://thumbgate.ai/go/pro?utm_source=npm&utm_medium=postinstall&utm_campaign=first_dollar';
24
- const WORKFLOW_SPRINT_URL = 'https://thumbgate.ai/#workflow-sprint-intake';
25
15
  const DASHBOARD_URL = 'https://thumbgate.ai/dashboard?utm_source=npm&utm_medium=postinstall&utm_campaign=dashboard_nudge';
16
+ const MANAGED_GATE_URL = 'https://thumbgate.ai/diagnostic?utm_source=npm&utm_medium=postinstall&utm_campaign=managed_workflow_gate';
26
17
 
27
18
  process.stderr.write(`
28
19
  ╭─────────────────────────────────────────────────────╮
29
- │ ThumbGate installed — 7-day Pro trial is live.
20
+ │ ThumbGate installed — full features for 7 days.
30
21
  │ │
31
22
  │ Start now: npx thumbgate init │
32
23
  │ Updates: npx thumbgate subscribe you@company.com│
33
24
  │ │
34
25
  │ Free after trial: 3 rules, 2 captures/day. │
35
- Pro ($19/mo): unlimited everything.
26
+ Need a hard gate built for you? $499 one-time.
36
27
  ╰─────────────────────────────────────────────────────╯
37
28
 
38
29
  Trial unlocks: unlimited rules, lesson search, DPO export,
@@ -41,6 +32,6 @@ process.stderr.write(`
41
32
  npx thumbgate subscribe you@company.com
42
33
 
43
34
  Dashboard: ${DASHBOARD_URL}
44
- Keep Pro: ${PRO_CTA_URL}
35
+ Managed workflow gate: ${MANAGED_GATE_URL}
45
36
 
46
37
  `);
@@ -1,15 +1,25 @@
1
1
  ---
2
2
  name: dashboard
3
3
  description: Open the local HTTP dashboard for the current project in your web browser.
4
+ allowed-tools: Bash(npx thumbgate dashboard:*), Bash(thumbgate-dashboard:*)
4
5
  ---
5
6
 
6
7
  # Open Dashboard
7
8
 
8
9
  Open the local HTTP dashboard for the current project in your web browser.
9
10
 
11
+ This command wraps existing ThumbGate capability — **no new logic**.
12
+
10
13
  ## Instructions
14
+
11
15
  Execute the following command in the project directory to open the browser dashboard scoped to the current repository:
16
+
12
17
  ```bash
13
- thumbgate-dashboard
18
+ npx thumbgate dashboard --open
14
19
  ```
15
20
 
21
+ Standalone shortcut:
22
+
23
+ ```bash
24
+ thumbgate-dashboard
25
+ ```
@@ -1,15 +1,30 @@
1
1
  ---
2
2
  name: thumbgate-dashboard
3
- description: Open the local HTTP dashboard for the current project in your web browser.
3
+ description: Open the local HTTP dashboard for the current project in your web browser. Use for "open dashboard", "thumbgate-dashboard", "show my gates in the browser", "project dashboard", or "open the local ThumbGate UI".
4
+ allowed-tools: Bash(npx thumbgate dashboard:*)
4
5
  ---
5
6
 
6
- # Open Scoped ThumbGate Dashboard
7
+ # ThumbGate Dashboard
7
8
 
8
- Open the local HTTP dashboard for the current project in your web browser.
9
+ Open the local HTTP dashboard for the current project so you can inspect lessons, checks, gate stats, and tokens saved in the browser.
9
10
 
10
- ## Instructions
11
- Execute the following command in the project directory to open the browser dashboard:
12
- ```bash
13
- thumbgate-dashboard
14
- ```
11
+ This command wraps existing ThumbGate capability — **no new logic**. It runs the existing project-scoped dashboard opener.
12
+
13
+ ## Steps
14
+
15
+ 1. Open the project-scoped dashboard:
16
+ ```bash
17
+ npx thumbgate dashboard --open
18
+ ```
19
+ Equivalent standalone shortcut after a global install:
20
+ ```bash
21
+ thumbgate-dashboard
22
+ ```
23
+ 2. Confirm the browser lands on the local dashboard for this repo (lessons, checks, gate stats, tokens saved).
24
+ 3. If the command fails, run `npx thumbgate doctor` — a missing install is usually fixed by `npx thumbgate init`.
15
25
 
26
+ ## Example
27
+
28
+ ```
29
+ /thumbgate-dashboard
30
+ ```