thumbgate 0.9.10 → 0.9.12

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 (115) hide show
  1. package/.claude-plugin/README.md +2 -2
  2. package/.claude-plugin/marketplace.json +4 -2
  3. package/.claude-plugin/plugin.json +1 -1
  4. package/.well-known/mcp/server-card.json +1 -1
  5. package/README.md +115 -312
  6. package/adapters/README.md +1 -1
  7. package/adapters/claude/.mcp.json +2 -2
  8. package/adapters/codex/config.toml +4 -4
  9. package/adapters/mcp/server-stdio.js +61 -1
  10. package/adapters/opencode/opencode.json +4 -2
  11. package/bin/cli.js +156 -8
  12. package/bin/memory.sh +3 -3
  13. package/config/e2e-critical-flows.json +4 -0
  14. package/config/gates/default.json +74 -2
  15. package/config/github-about.json +1 -1
  16. package/config/mcp-allowlists.json +27 -0
  17. package/package.json +22 -5
  18. package/plugins/amp-skill/INSTALL.md +1 -0
  19. package/plugins/amp-skill/SKILL.md +1 -0
  20. package/plugins/claude-codex-bridge/.claude-plugin/plugin.json +1 -1
  21. package/plugins/claude-codex-bridge/.mcp.json +4 -2
  22. package/plugins/claude-skill/INSTALL.md +1 -0
  23. package/plugins/codex-profile/.codex-plugin/plugin.json +1 -1
  24. package/plugins/codex-profile/.mcp.json +4 -2
  25. package/plugins/codex-profile/INSTALL.md +1 -1
  26. package/plugins/codex-profile/README.md +1 -1
  27. package/plugins/cursor-marketplace/.cursor-plugin/plugin.json +1 -1
  28. package/plugins/cursor-marketplace/README.md +3 -3
  29. package/plugins/cursor-marketplace/mcp.json +3 -1
  30. package/plugins/cursor-marketplace/scripts/gate-check.sh +15 -5
  31. package/plugins/gemini-extension/INSTALL.md +3 -3
  32. package/plugins/opencode-profile/INSTALL.md +1 -1
  33. package/public/dashboard.html +15 -8
  34. package/public/index.html +125 -185
  35. package/public/js/buyer-intent.js +252 -0
  36. package/public/pro.html +1085 -0
  37. package/scripts/__pycache__/train_from_feedback.cpython-312.pyc +0 -0
  38. package/scripts/adk-consolidator.js +14 -2
  39. package/scripts/agent-readiness.js +3 -1
  40. package/scripts/agent-security-hardening.js +4 -4
  41. package/scripts/auto-promote-gates.js +2 -0
  42. package/scripts/auto-wire-hooks.js +105 -17
  43. package/scripts/behavioral-extraction.js +2 -6
  44. package/scripts/billing.js +107 -3
  45. package/scripts/budget-guard.js +2 -2
  46. package/scripts/build-metadata.js +14 -0
  47. package/scripts/context-engine.js +1 -0
  48. package/scripts/deploy-policy.js +3 -17
  49. package/scripts/dpo-optimizer.js +3 -6
  50. package/scripts/ensure-repo-bootstrap.js +129 -0
  51. package/scripts/export-dpo-pairs.js +2 -3
  52. package/scripts/export-kto-pairs.js +3 -4
  53. package/scripts/export-training.js +8 -6
  54. package/scripts/feedback-attribution.js +23 -11
  55. package/scripts/feedback-loop.js +40 -2
  56. package/scripts/feedback-to-rules.js +2 -1
  57. package/scripts/filesystem-search.js +3 -2
  58. package/scripts/gates-engine.js +760 -29
  59. package/scripts/generate-pretool-hook.sh +0 -0
  60. package/scripts/gtm-revenue-loop.js +20 -1
  61. package/scripts/hook-auto-capture.sh +8 -3
  62. package/scripts/hook-runtime.js +81 -0
  63. package/scripts/hook-stop-self-score.sh +3 -3
  64. package/scripts/hook-thumbgate-cache-updater.js +99 -38
  65. package/scripts/hosted-config.js +4 -16
  66. package/scripts/hybrid-feedback-context.js +54 -14
  67. package/scripts/install-mcp.js +13 -3
  68. package/scripts/intent-router.js +2 -2
  69. package/scripts/license.js +52 -14
  70. package/scripts/local-model-profile.js +3 -2
  71. package/scripts/mcp-config.js +62 -7
  72. package/scripts/meta-policy.js +4 -8
  73. package/scripts/money-watcher.js +166 -16
  74. package/scripts/obsidian-export.js +1 -0
  75. package/scripts/operational-integrity.js +480 -0
  76. package/scripts/post-everywhere.js +35 -12
  77. package/scripts/pr-manager.js +14 -11
  78. package/scripts/profile-router.js +2 -0
  79. package/scripts/prompt-dlp.js +1 -0
  80. package/scripts/publish-decision.js +10 -0
  81. package/scripts/published-cli.js +61 -0
  82. package/scripts/risk-scorer.js +3 -2
  83. package/scripts/rlhf_session_start.sh +32 -0
  84. package/scripts/skill-quality-tracker.js +3 -5
  85. package/scripts/social-analytics/db/social-analytics.db-shm +0 -0
  86. package/scripts/social-analytics/db/social-analytics.db-wal +0 -0
  87. package/scripts/social-analytics/engagement-audit.js +202 -0
  88. package/scripts/social-analytics/instagram-thumbgate-post.js +45 -7
  89. package/scripts/social-analytics/install-growth-automation.js +114 -0
  90. package/scripts/social-analytics/load-env.js +46 -0
  91. package/scripts/social-analytics/poll-all.js +23 -23
  92. package/scripts/social-analytics/pollers/plausible.js +2 -4
  93. package/scripts/social-analytics/pollers/zernio.js +3 -0
  94. package/scripts/social-analytics/publish-instagram-thumbgate.js +22 -3
  95. package/scripts/social-analytics/publish-thumbgate-launch.js +322 -0
  96. package/scripts/social-analytics/publishers/reddit.js +7 -12
  97. package/scripts/social-analytics/publishers/zernio.js +301 -22
  98. package/scripts/social-analytics/reconcile-thumbgate-campaign.js +165 -0
  99. package/scripts/social-analytics/schedule-thumbgate-campaign.js +275 -0
  100. package/scripts/social-analytics/sync-launch-assets.js +185 -0
  101. package/scripts/social-post-hourly.js +185 -0
  102. package/scripts/social-quality-gate.js +119 -3
  103. package/scripts/social-reply-monitor.js +184 -37
  104. package/scripts/statusline-cache-path.js +27 -0
  105. package/scripts/statusline-local-stats.js +16 -0
  106. package/scripts/statusline-meta.js +22 -0
  107. package/scripts/statusline.sh +40 -33
  108. package/scripts/sync-version.js +24 -3
  109. package/scripts/test-coverage.js +21 -13
  110. package/scripts/tool-registry.js +97 -0
  111. package/scripts/train_from_feedback.py +32 -9
  112. package/scripts/validate-feedback.js +3 -2
  113. package/scripts/vector-store.js +2 -3
  114. package/scripts/verify-obsidian-setup.sh +3 -3
  115. package/src/api/server.js +281 -33
@@ -21,7 +21,7 @@ The extension path is useful when a team wants Claude Desktop to keep one workfl
21
21
  Use the portable npm launcher:
22
22
 
23
23
  ```bash
24
- claude mcp add thumbgate -- npx -y thumbgate serve
24
+ claude mcp add thumbgate -- npx --yes --package thumbgate thumbgate serve
25
25
  ```
26
26
 
27
27
  Or use the project bootstrap:
@@ -65,7 +65,7 @@ Optional hosted path:
65
65
  "mcpServers": {
66
66
  "thumbgate": {
67
67
  "command": "npx",
68
- "args": ["-y", "thumbgate", "serve"],
68
+ "args": ["--yes", "--package", "thumbgate", "thumbgate", "serve"],
69
69
  "env": {
70
70
  "THUMBGATE_BASE_URL": "https://thumbgate-production.up.railway.app",
71
71
  "THUMBGATE_API_KEY": "tg_YOUR_KEY_HERE"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thumbgate",
3
- "version": "0.9.10",
3
+ "version": "0.9.12",
4
4
  "plugins": [
5
5
  {
6
6
  "name": "thumbgate",
@@ -11,7 +11,9 @@
11
11
  "package": "thumbgate",
12
12
  "command": "npx",
13
13
  "args": [
14
- "-y",
14
+ "--yes",
15
+ "--package",
16
+ "thumbgate",
15
17
  "thumbgate",
16
18
  "serve"
17
19
  ]
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "thumbgate",
3
3
  "description": "Pre-action gates that block AI coding agents from repeating known mistakes. Captures feedback, auto-promotes failures into prevention rules, and enforces them via PreToolUse hooks.",
4
- "version": "0.9.10",
4
+ "version": "0.9.12",
5
5
  "author": {
6
6
  "name": "Igor Ganapolsky"
7
7
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thumbgate",
3
- "version": "0.9.10",
3
+ "version": "0.9.12",
4
4
  "description": "ThumbGate — 👍👎 feedback that teaches your AI agent. Thumbs down a mistake, it never happens again.",
5
5
  "homepage": "https://github.com/IgorGanapolsky/thumbgate",
6
6
  "transport": "stdio",
package/README.md CHANGED
@@ -1,374 +1,177 @@
1
1
  # ThumbGate
2
2
 
3
- > **npm package:** `thumbgate` install with `npx thumbgate init`
3
+ Make your AI coding agent self-improving. One thumbs-down creates a gate that permanently blocks the mistake.
4
4
 
5
5
  [![CI](https://github.com/IgorGanapolsky/ThumbGate/actions/workflows/ci.yml/badge.svg)](https://github.com/IgorGanapolsky/ThumbGate/actions/workflows/ci.yml)
6
- [![Self-Healing](https://github.com/IgorGanapolsky/ThumbGate/actions/workflows/self-healing-monitor.yml/badge.svg)](https://github.com/IgorGanapolsky/ThumbGate/actions/workflows/self-healing-monitor.yml)
7
6
  [![npm](https://img.shields.io/npm/v/thumbgate)](https://www.npmjs.com/package/thumbgate)
8
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
9
- [![Node](https://img.shields.io/badge/node-%3E%3D18.18.0-brightgreen)](package.json)
10
- [![Sponsor](https://img.shields.io/badge/Sponsor-%E2%9D%A4-pink?logo=github)](https://github.com/sponsors/IgorGanapolsky)
11
- [![Buy Me a Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-FFDD00?logo=buymeacoffee&logoColor=black)](https://buymeacoffee.com/igorganapolsky)
12
- [![Pro Pack](https://img.shields.io/badge/Pro%20Pack-%2419%2Fmo%20or%20%24149%2Fyr-635bff?logo=stripe&logoColor=white)](https://thumbgate-production.up.railway.app/checkout/pro?utm_source=github&utm_medium=readme&utm_campaign=thumbgate) — Free stays local-first with 5 daily feedback captures, 10 daily lesson searches, unlimited recall, and gating. Vague thumbs feedback can be distilled from the last ~10 messages and failed tool call. Pro adds a personal local dashboard, **Model Hardening Advisor**, and **LoRA/PEFT export**. Team rollout starts at the shared hosted lesson DB, org dashboard, and generated hosted review views.
8
+ [![Try Free](https://img.shields.io/badge/Pro-Try%20Free%20→-635bff?style=for-the-badge&logo=stripe&logoColor=white)](https://thumbgate-production.up.railway.app/checkout/pro?utm_source=github&utm_medium=readme&utm_campaign=badge_cta)
13
9
 
14
- **Repo boundary:** this repository is the public base runtime (`thumbgate`). The paid overlay now lives in the separate [`thumbgate-pro`](https://github.com/IgorGanapolsky/thumbgate-pro) repo/package and inherits from this base instead of shipping from a `pro/` subtree here.
10
+ **[Pro Page](https://thumbgate-production.up.railway.app/pro?utm_source=github&utm_medium=readme&utm_campaign=pro_page)** · **[Live Dashboard](https://thumbgate-production.up.railway.app/dashboard?utm_source=github&utm_medium=readme&utm_campaign=top_cta)** · **[Pricing](https://thumbgate-production.up.railway.app/#pricing?utm_source=github&utm_medium=readme&utm_campaign=top_cta)** · **[Setup Guide](https://thumbgate-production.up.railway.app/guide?utm_source=github&utm_medium=readme&utm_campaign=top_cta)**
15
11
 
16
- **Thumbs down a mistake. It never happens again.**
12
+ ### Get Started
17
13
 
18
- The safety net for vibe coding. Give your AI agent a thumbs-down and it auto-generates a prevention rule. Give a thumbs-up and it reinforces good behavior. Pre-action gates physically block the agent before it repeats a known mistake a reliability layer for one sharp agent, without another planner or swarm.
14
+ **ThumbGate Pro (Recommended)**zero config, team analytics, shared lesson DB:
19
15
 
20
- > **Honest disclaimer:** ThumbGate is context-engineered behavioral steering — it injects feedback into context to condition the model's behavior. It does not update model weights. Feedback becomes searchable memory, prevention rules, and gates that block known-bad actions before they execute.
16
+ [![Sign up for ThumbGate Pro](https://img.shields.io/badge/>>%20Start%20Free%20→%20ThumbGate%20Pro-635bff?style=for-the-badge)](https://thumbgate-production.up.railway.app/checkout/pro?utm_source=github&utm_medium=readme&utm_campaign=get_started)
21
17
 
22
- Works with **Claude Code, Cursor, Codex, Gemini, Amp, OpenCode**, and any MCP-compatible agent.
23
-
24
- **[Live Demo Dashboard](https://thumbgate-production.up.railway.app/dashboard?utm_source=github&utm_medium=readme&utm_campaign=thumbgate)** | **[Setup Guide](https://thumbgate-production.up.railway.app/guide?utm_source=github&utm_medium=readme&utm_campaign=thumbgate)** | **[Landing Page](https://thumbgate-production.up.railway.app/?utm_source=github&utm_medium=readme&utm_campaign=thumbgate)** | **[Verification Evidence](docs/VERIFICATION_EVIDENCE.md)**
25
-
26
- Most memory tools only help an agent remember. ThumbGate also enforces.
27
-
28
- **The problem without it:**
29
-
30
- > BEFORE: Agent force-pushes to main. You correct it. Next session, it force-pushes again.
18
+ Free for individual developers. Pro adds team dashboards, DPO export, and unlimited lesson search. [See pricing →](https://thumbgate-production.up.railway.app/#pricing?utm_source=github&utm_medium=readme&utm_campaign=pricing_link)
31
19
 
32
- **With ThumbGate (`thumbgate`):**
33
-
34
- > AFTER: Gate blocks the force-push before it executes. Agent can't repeat the mistake.
35
-
36
- - `recall` injects the right context at session start.
37
- - `search_lessons` shows promoted lessons plus the corrective action, lifecycle state, linked rules, linked gates, and the next harness fix the system should make.
38
- - `retrieve_lessons` surfaces per-action lessons for the tool or workflow you are about to run.
39
- - `search_thumbgate` searches feedback state across feedback logs, ContextFS memory, and prevention rules (context engineering, not weight training).
40
- - History-aware distillation turns a vague `👍` or `👎` into a concrete lesson proposal from the last ~10 messages plus the failed tool call.
41
- - Feedback sessions let Cursor, Claude Desktop, Codex, and the hosted API keep appending context to the same feedback record before promotion.
42
- - Pre-action gates physically block tool calls that match known failure patterns.
43
- - Session handoff and primer keep continuity across sessions without adding an extra orchestrator.
44
-
45
- Free and self-hosted users can invoke `search_lessons` directly through MCP, and via the CLI with `npx thumbgate lessons`.
20
+ **Paid path for individual operators:** [ThumbGate Pro](https://thumbgate-production.up.railway.app/pro?utm_source=github&utm_medium=readme&utm_campaign=pro_page) is the buyer-ready page for the personal local dashboard, DPO export, and review-ready evidence. It makes the paid upgrade legible before checkout while the self-hosted path below stays optimized for open source evaluation.
46
21
 
47
- ## See it in action
48
-
49
- ```
50
- $ npx thumbgate serve
51
- [gate] ⛔ Blocked: git push --force (rule: no-force-push, confidence: 0.94)
52
- [gate] ✅ Passed: git push origin feature-branch
53
- ```
54
-
55
- ## Quick Start
22
+ **Open Source (Self-Hosted):**
56
23
 
57
24
  ```bash
58
- # One command install — auto-detects your agent
59
25
  npx thumbgate init
60
-
61
- # Or add the MCP server directly
62
- claude mcp add thumbgate -- npx -y thumbgate serve
63
- codex mcp add thumbgate -- npx -y thumbgate serve
64
- amp mcp add thumbgate -- npx -y thumbgate serve
65
- gemini mcp add thumbgate "npx -y thumbgate serve"
66
-
67
- # Wire PreToolUse enforcement hooks
68
- npx thumbgate init --agent claude-code
69
- npx thumbgate init --agent codex
70
- npx thumbgate init --agent gemini
71
-
72
- # Health check and inspect lessons
73
- npx thumbgate doctor
74
- npx thumbgate lessons
75
- npx thumbgate dashboard
76
26
  ```
77
27
 
78
- ## Claude Code Skill
79
-
80
- If you use Claude Code, ThumbGate is available as a built-in skill:
28
+ ## Before / After
81
29
 
82
- ```bash
83
- # Type in any Claude Code session:
84
- /thumbgate
85
30
  ```
31
+ WITHOUT THUMBGATE WITH THUMBGATE
86
32
 
87
- The skill auto-triggers on keywords like "gate", "feedback", "block mistake", "prevention rule", and "thumbs down". It provides inline access to all ThumbGate commands — capture feedback, view gates, search lessons, and check system health.
33
+ Session 1: Session 1:
34
+ Agent force-pushes to main. Agent force-pushes to main.
35
+ You correct it. You 👎 it.
88
36
 
89
- **Free skill** includes: install, capture feedback, view active gates, search lessons, health checks.
90
- **Pro skill** adds: multi-hop recall, DPO export, gate debugger, and gate wiring support.
91
- **Team rollout** adds: shared hosted lesson DB, org dashboard visibility, and generated hosted review views for multi-agent workflows.
37
+ Session 2: Session 2:
38
+ Agent force-pushes again. ⛔ Gate blocks force-push.
39
+ It learned nothing. Agent uses safe push instead.
92
40
 
93
- Source: [`.claude/skills/thumbgate/SKILL.md`](.claude/skills/thumbgate/SKILL.md)
41
+ Session 3: Session 3+:
42
+ Same mistake. Again. Permanently fixed.
43
+ ```
94
44
 
95
45
  ## How It Works
96
46
 
97
47
  ```
98
- 1. You give feedback → 👎 "Force-pushed and lost commits"
99
- 2. ThumbGate distills → Uses recent conversation + failed action when the signal is vague
100
- 3. ThumbGate validates → Rejects vague signals, promotes actionable ones
101
- 4. Rules auto-generate → "Block git push --force to protected branches"
102
- 5. Gates enforce → PreToolUse hook fires → BLOCKED before execution
103
- 6. Agent improves → Same mistake never happens again
48
+ YOU THUMBGATE YOUR AGENT
49
+ │ │ │
50
+ 👎 "broke prod" │ │
51
+ ├───────────────────────►│ │
52
+ │ │ distill + validate
53
+ │ │ ┌─────────────────┐
54
+ │ │ │ lesson + rule │ │
55
+ │ │ │ created │ │
56
+ │ │ └─────────────────┘ │
57
+ │ │ │
58
+ │ │ PreToolUse hook fires │
59
+ │ │◄───────────────────────────┤ tries same mistake
60
+ │ │ ⛔ BLOCKED │
61
+ │ ├───────────────────────────►│ forced to try safe path
62
+ │ │ │
63
+ │ 👍 "good fix" │ │
64
+ ├───────────────────────►│ │
65
+ │ │ reinforced ✅ │
66
+ │ │ │
104
67
  ```
105
68
 
106
- Pipeline: **Capture → Distill recent history → Validate → Remember → Propose rule → Gate → Export**
107
-
108
- Feedback session flow:
69
+ ## The Loop
109
70
 
110
71
  ```
111
- 👎 Thumbs down → Session opens → User types follow-up context → Session finalizes → Lesson inferred from full conversation
72
+ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
73
+ │ Capture │────►│ Distill │────►│ Remember │────►│ Rule │────►│ Gate │
74
+ │ 👍 / 👎 │ │ history- │ │ SQLite + │ │ auto-gen │ │ PreTool │
75
+ │ │ │ aware │ │ FTS5 DB │ │ from │ │ Use hook │
76
+ │ │ │ │ │ │ │ failures │ │ enforces │
77
+ └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘
112
78
  ```
113
79
 
114
- ## What's New in v0.9.9
115
-
116
- - **ADK-Style Progressive Disclosure** — 3-tier skill loading (L1 metadata → L2 rules → L3 resources) that cuts token usage by 82%. Skill factory auto-generates new skill packs from recurring failure patterns. `measureSkillTokens()` shows exact token cost per tier.
117
- - **Agent Security Hardening** — credential attestation tracks what creds each agent uses per tool call. Privilege escalation detection checks tool calls against MCP profile allowlists. Dependency attestation gate blocks known-compromised packages (event-stream, ua-parser-js).
118
- - **Ephemeral Agent Store** — per-agent isolated namespaces for background agents with <10s lifetimes. Auto-merge into main store with PII governance check. Data compaction removes old non-promoted entries.
119
- - **Prompt-Level DLP** — scans tool call inputs for PII/secrets BEFORE execution. Shadow tool detection flags actions bypassing MCP. Governance score (0-100 + letter grade A-F) per agent session.
120
- - **Memory Migration** — imports Claude Code MEMORY.md files into ThumbGate's SQLite lesson DB. Health check warns on the 200-line cap Mem0 exposed. Comparison data for marketing.
121
-
122
- ### Previous (v0.9.6)
123
-
124
- - **Background Agent Governance** — run tracking, pre-run governance gates, CI auto-feedback capture. Blocks agents with >50% failure rate. Warns on protected branches and large blast radius. Auto-captures CI pass/fail as structured feedback — no human in the loop. Governance report shows per-agent pass rates and gate blocks.
125
- - **Hallucination Detector** — decomposes agent claims ("deployed", "tests pass", "PR merged") into verifiable sub-claims, checks each against evidence. Confidence-weighted gates: low confidence blocks, medium warns, high allows. Retrieval-grounded verification flags contradictions with prevention rules.
126
- - **PII Scanner + Data Governance** — detects emails, phone numbers, SSNs, credit cards in feedback content. DPO export gate blocks pairs containing PII. User-controlled preferences for what data can be exported, shared, or retained. Compliance-ready audit summary.
127
- - **CLI Inline Feedback** — `node scripts/cli-feedback.js down "broke tests"` captures feedback and echoes lesson + stats to terminal. No browser needed.
128
- - **Statusline Lessons** — Claude Code statusbar shows most recent lesson with clickable dashboard/lessons links. Auto-created on every feedback capture.
129
-
130
- ### Previous (v0.9.5)
131
-
132
- - **Conversation Context Capture** — Captures the last 5-10 conversation turns alongside every thumbs up/down, so lessons include the full story, not just a one-liner summary.
133
- - **History-aware lesson distillation** — Vague thumbs feedback can reuse the recent conversation window plus the failed tool call to propose `whatWentWrong`, `whatToChange`, and a concrete lesson instead of discarding the signal.
134
- - **Feedback Sessions** — Follow-up messages after thumbs up/down ("you lied about X", "you forgot Y") are captured for 60 seconds and folded into the lesson.
135
- - **Self-Healing Reflector** — On negative feedback, automatically runs a post-mortem: analyzes what went wrong, checks for recurrence, and proposes a specific rule back to the user.
136
- - **Structured IF/THEN Rules** — Every lesson is extracted as a structured rule with trigger, action, confidence, and scope — not flat text.
137
- - **Per-Action Lesson Retrieval** — `retrieve_lessons` MCP tool returns top-K relevant lessons for each tool call using keyword matching, file path overlap, and recency decay.
138
-
139
- ### Previous (v0.9.0)
140
-
141
- - **Domain skill packs** — installable best-practice rule sets for Stripe, Railway, database migrations. Auto-match by task context.
142
- - **Before/after eval harness** — 6 built-in eval cases, 100% pass rate with ThumbGate vs 0% without.
143
- - **MetaClaw slow loop** — idle-time DPO export scheduler via LaunchAgent cron.
144
- - **Metered outcome billing** — $0.10/blocked action (Pro), $0.08/seat (Team), floor pricing.
145
- - **AI Control Tower** — per-tool KPIs (P50/P90/P95 latency, success rate), SLO threshold alerts, access anomaly detection.
146
- - **Daily digest + weekly stats** — ambient Slack/Teams/Discord push. Social-ready weekly stats for build-in-public.
147
- - **Statusline upgrade** — Claude Code statusbar shows SLO violations, at-risk tools, anomalies inline.
148
- - **Gemini MCP adapter** — 14 tool declarations for native Gemini agent interop.
80
+ ## Quick Start (Self-Hosted)
149
81
 
150
- ### Previous (v0.8.5)
82
+ ```bash
83
+ npx thumbgate init # auto-detect agent + wire hooks
84
+ npx thumbgate doctor # health check
85
+ npx thumbgate lessons # inspect learned lessons
86
+ npx thumbgate dashboard # local dashboard
87
+ ```
151
88
 
152
- - **Gate reasoning chains** — every block/warn explains WHY: pattern match, gate identity, source, bypass hints, historical fire count
153
- - **Multi-hop retrieval** — iterative retrieve → prune → refine loop for complex queries, inspired by Context-1 agentic retrieval
154
- - **Active context pruning** — re-scores accumulated items after each retrieval hop, drops weak chunks to keep context quality high
155
- - **Thompson Sampling calibration** — minimum sample threshold (5) prevents low-sample overconfidence; confidence tiers (none/low/medium/high)
156
- - **Org dashboard** — `org_dashboard` MCP tool aggregates gate decisions across all agent sessions (Team rollout: full visibility, Free preview: 3 agents)
157
- - **Distractor-aware DPO** — training data export includes near-miss same-domain distractors for harder negatives
158
- - **Funnel invariant CI** — 13 tests prevent checkout path regression; Pro parity enforced across free/Pro npm packages
159
- - **Dual-signal feedback** — optional `failureType` ("decision" vs "execution") on `capture_feedback` creates separate Thompson Sampling sub-arms per failure dimension, inspired by Gen-Searcher's dual reward system
89
+ Or wire MCP directly: `claude mcp add thumbgate -- npx -y thumbgate serve`
160
90
 
161
- ![Context Engineering Architecture](https://raw.githubusercontent.com/IgorGanapolsky/ThumbGate/main/docs/diagrams/thumbgate-architecture-pb.png)
91
+ Works with **Claude Code, Cursor, Codex, Gemini, Amp, OpenCode**, and any MCP-compatible agent.
162
92
 
163
- ## Pre-Action Gates
93
+ > **Want team analytics and shared lessons?** [Start with ThumbGate Pro →](https://thumbgate-production.up.railway.app/checkout/pro?utm_source=github&utm_medium=readme&utm_campaign=quickstart_cta) Free for individual devs. No credit card required.
164
94
 
165
- Gates are the enforcement layer. They do not ask the agent to cooperate — they physically block the action.
95
+ ## Built-in Gates
166
96
 
167
- ```text
168
- Agent tries git push --force
169
- → PreToolUse hook fires
170
- → gates-engine checks rules
171
- → BLOCKED: no force pushes to protected branches
172
97
  ```
173
-
174
- Built-in gates:
175
-
176
- - `push-without-thread-check` block push if PR threads unresolved
177
- - `force-push` block `git push --force` to protected branches
178
- - `protected-branch-push` block direct pushes to main/master
179
- - `package-lock-reset` block destructive lock file changes
180
- - `env-file-edit` block edits to `.env` files with secrets
181
-
182
- Define custom gates in [`config/gates/custom.json`](config/gates/custom.json).
183
-
184
- ## What Actually Works
185
-
186
- | Actually works | Does not work |
187
- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
188
- | `recall` injects past context into the next session | Thumbs up/down changing model weights |
189
- | `session_handoff` and `session_primer` preserve continuity | Agents magically remembering what happened last session |
190
- | `search_lessons` exposes corrective actions, lifecycle state, linked rules, linked gates, and next harness fixes | Feedback stats automatically improving behavior by themselves |
191
- | Natural-language harness specs keep workflow control legible and portable across runtimes | Re-implementing the same agent-control logic in every adapter |
192
- | Pre-action gates block known-bad tool calls before execution | Agents self-correcting without context injection or gates |
193
- | Auto-promotion turns repeated failures into warn/block rules | Calling this model training in the strict sense |
194
- | Rejection ledger shows why vague feedback was rejected | Vague signals silently helping the system |
195
-
196
- ## Core MCP Tools
197
-
198
- ### Essential profile
199
-
200
- | Tool | Purpose |
201
- | ---------------------- | ----------------------------------------------------------------------------------------------------------- |
202
- | `capture_feedback` | Accept up/down signal + context, validate, promote to memory |
203
- | `open_feedback_session`| Start a linked feedback session when the correction needs multiple follow-up messages |
204
- | `append_feedback_context` | Add more transcript or operator notes to the open feedback session |
205
- | `finalize_feedback_session` | Close the linked session and promote the combined evidence into one feedback record |
206
- | `recall` | Recall relevant past failures and rules for the current task |
207
- | `search_lessons` | Search promoted lessons with corrective action, lifecycle state, rules, gates |
208
- | `retrieve_lessons` | Retrieve the highest-signal lessons for a specific tool, action, or workflow context |
209
- | `reflect_on_feedback` | Propose a reusable rule or lesson from the recent conversation window |
210
- | `search_thumbgate` | Search feedback state across feedback logs, ContextFS, and rules (context engineering, not weight training) |
211
- | `prevention_rules` | Generate prevention rules from repeated mistakes |
212
- | `enforcement_matrix` | Inspect promotion rate, active gates, and rejection ledger |
213
- | `feedback_stats` | Approval rate and failure-domain summary |
214
- | `estimate_uncertainty` | Bayesian uncertainty estimate for risky tags |
215
- | `org_dashboard` | **Team** — Shared lessons plus org-wide multi-agent visibility, adherence rates, and risk alerts |
216
- | `open_feedback_session` | Start a feedback session after thumbs up/down to capture follow-up context |
217
- | `append_feedback_context` | Add follow-up messages to an open feedback session within the 60-second window |
218
- | `finalize_feedback_session` | Close the session and fold all follow-up context into the lesson |
219
- | `retrieve_lessons` | Return top-K relevant lessons for a tool call using keyword matching, file path overlap, and recency decay |
220
- | `reflect_on_feedback` | Run a self-healing post-mortem on negative feedback — analyzes what went wrong and proposes a rule |
221
-
222
- Natural-language harnesses now live in [`harnesses/`](harnesses) and can be executed through the async runtime:
223
-
224
- ```bash
225
- node scripts/async-job-runner.js --list-harnesses
226
- node scripts/async-job-runner.js --run-harness=repo-full-verification --harness-inputs='{"verificationCommand":"npm run verify:full"}'
98
+ ┌─────────────────────────────────────────────────────────┐
99
+ │ ENFORCEMENT LAYER │
100
+ │ │
101
+ │ ⛔ force-push blocks git push --force │
102
+ │ ⛔ protected-branch → blocks direct push to main │
103
+ │ ⛔ unresolved-threads → blocks push with open reviews │
104
+ │ ⛔ package-lock-reset blocks destructive lock edits │
105
+ │ ⛔ env-file-edit blocks .env secret exposure │
106
+ │ │
107
+ │ + custom gates in config/gates/custom.json
108
+ └─────────────────────────────────────────────────────────┘
227
109
  ```
228
110
 
229
- Long-context local backends can now expose sparse-attention routing hints through the profile router:
111
+ ## Feedback Sessions
230
112
 
231
- ```bash
232
- THUMBGATE_PROVIDER_MODE=local \
233
- THUMBGATE_LOCAL_MODEL_FAMILY=deepseek-r1 \
234
- THUMBGATE_LOCAL_MODEL_SERVER=sglang \
235
- THUMBGATE_INDEXCACHE_ENABLED=true \
236
- npm run profile:route
237
113
  ```
238
-
239
- ThumbGate treats IndexCache-style acceleration as a backend capability, not a blanket claim. Long-context retrieval-heavy workloads will recommend sparse-attention local backends when they are actually available.
240
-
241
- Lean install for recall + gates + lesson search only:
242
-
243
- ```bash
244
- THUMBGATE_MCP_PROFILE=essential claude mcp add thumbgate -- npx -y thumbgate serve
114
+ 👎 thumbs down
115
+ └─► open_feedback_session
116
+ └─► "you lied about deployment" (append_feedback_context)
117
+ └─► "tests were actually failing" (append_feedback_context)
118
+ └─► finalize_feedback_session
119
+ └─► lesson inferred from full conversation
245
120
  ```
246
121
 
247
- Free and self-hosted users can invoke `search_lessons` directly through MCP to inspect corrective action per lesson. For broader retrieval across feedback logs, ContextFS memory, and prevention rules, use `search_thumbgate` (searches feedback state, not model weights) through MCP or the authenticated `GET /v1/search` API.
122
+ History-aware distillation turns vague signals into concrete lessons using the last ~10 messages and the failed tool call.
248
123
 
249
- ### Dispatch profile
124
+ Free and self-hosted users can invoke `search_lessons` directly through MCP, and via the CLI with `npx thumbgate lessons`.
250
125
 
251
- Phone-safe read-only surface for remote ops:
126
+ ## Pricing
252
127
 
253
- ```bash
254
- THUMBGATE_MCP_PROFILE=dispatch claude mcp add thumbgate -- npx -y thumbgate serve
255
- npx thumbgate dispatch
128
+ ```
129
+ ┌──────────────┬──────────────────────┬──────────────────────────────┐
130
+ │ FREE │ PRO $19/mo or $149/yr│ TEAM $12/seat/mo (min 3) │
131
+ ├──────────────┼──────────────────────┼──────────────────────────────┤
132
+ │ Unlimited │ Unlimited feedback │ Shared hosted lesson DB │
133
+ │ feedback │ captures + search │ Org dashboard │
134
+ │ captures │ DPO export │ Gate template library │
135
+ │ 5 daily │ Personal dashboard │ Workflow hardening sprint │
136
+ │ lesson │ │ │
137
+ │ searches │ │ │
138
+ └──────────────┴────────────────────┴──────────────────────────────┘
256
139
  ```
257
140
 
258
- Guide: [docs/guides/dispatch-ops.md](docs/guides/dispatch-ops.md)
259
-
260
- ## ThumbGate vs Alternatives
261
-
262
- | Feature | ThumbGate | SpecLock | Mem0 | .cursorrules |
263
- | -------------------------------- | ------------------------------------------------- | ---------------------------------------------- | ------------------ | ---------------- |
264
- | Blocks mistakes before execution | **Yes** — PreToolUse gates | Yes — Patch Firewall | No | No |
265
- | Learns from your feedback | **Yes** — thumbs up/down | No — manual spec writing | Yes — auto-capture | No |
266
- | Works across sessions | **Yes** — SQLite + JSONL | Yes — encrypted store | Yes — cloud | No — per-project |
267
- | Auto-generates rules | **Yes** — from repeated failures | No — manual or Gemini compile | No | No |
268
- | Agent support | Claude Code, Codex, Gemini, Amp, Cursor, OpenCode | Claude Code, Cursor, Windsurf, Cline, Bolt.new | Claude, Cursor | Cursor only |
269
- | Install | `npx thumbgate init` | `npx speclock setup` | Cloud signup | Edit file |
270
- | Cost | **Free** ($19/mo or $149/yr Pro; Team rollout starts at $12/seat/mo) | Free | Free tier + paid | Free |
271
- | npm weekly downloads | **724** | 98 | N/A | N/A |
272
-
273
- **When to use ThumbGate:** You want your agent to learn from mistakes automatically and enforce what it learned. One thumbs-down creates a gate.
141
+ Free includes unlimited feedback captures, 5 daily lesson searches, unlimited recall, and gating. History-aware distillation turns vague feedback into concrete lessons. Feedback sessions (`open_feedback_session` → `append_feedback_context` → `finalize_feedback_session`) link follow-up context to one record.
274
142
 
275
- **When to use SpecLock:** You have a written spec/PRD and want to lock specific sections from AI modification. Manual constraint authoring.
143
+ It does not update model weights. It's context engineering enforcement that gets smarter every session.
276
144
 
277
- **When to use Mem0:** You want cloud-hosted memory shared across apps. No enforcement.
145
+ **[Get Pro](https://thumbgate-production.up.railway.app/checkout/pro?utm_source=github&utm_medium=readme&utm_campaign=thumbgate)** | **[Start Team Rollout](https://thumbgate-production.up.railway.app/#workflow-sprint-intake?utm_source=github&utm_medium=readme&utm_campaign=team_rollout)** | **[Live Dashboard](https://thumbgate-production.up.railway.app/dashboard?utm_source=github&utm_medium=readme&utm_campaign=thumbgate)**
278
146
 
279
147
  ## Tech Stack
280
148
 
281
- ### Core runtime
282
-
283
- - **Node.js** `>=18.18.0`
284
- - **Module system:** CommonJS CLI/server runtime
285
- - **Primary entry points:** CLI, MCP stdio server, authenticated HTTP API, OpenAPI adapters
286
-
287
- ### Interfaces
288
-
289
- - **MCP stdio:** [adapters/mcp/server-stdio.js](adapters/mcp/server-stdio.js)
290
- - **HTTP API:** [src/api/server.js](src/api/server.js)
291
- - **OpenAPI surfaces:** [openapi/openapi.yaml](openapi/openapi.yaml), [adapters/chatgpt/openapi.yaml](adapters/chatgpt/openapi.yaml)
292
- - **CLI:** `npx thumbgate ...`
293
-
294
- ### Storage and retrieval
295
-
296
- - **Local memory:** JSONL logs in `.claude/memory/feedback` or `.thumbgate/*`
297
- - **Lesson DB (v0.8.0):** SQLite + FTS5 full-text search via `better-sqlite3` — dual-written alongside JSONL. Indexed by signal, domain, tags, importance. Replaces linear Jaccard token-overlap with sub-millisecond ranked search.
298
- - **Corrective actions (v0.8.0):** On negative feedback, `capture_feedback` returns `correctiveActions[]` — top 3 remediation steps inferred from similar past failures by tag/domain overlap.
299
- - **Context assembly:** ContextFS packs and provenance logs
300
- - **Default retrieval path:** SQLite FTS5 (primary) with JSONL Jaccard fallback
301
- - **Semantic/vector lane:** LanceDB + Apache Arrow + local embeddings via Hugging Face Transformers
302
-
303
- ### Intelligence layer
304
-
305
- - **MemAlign-inspired dual recall:** Principle-based memory (distilled rules) + episodic context (raw feedback with timestamps). Recall surfaces both lanes ranked by relevance.
306
- - **Thompson Sampling:** Bayesian multi-armed bandit over feedback tags — adapts gate sensitivity per failure domain based on observed positive/negative signal ratios.
307
- - **Corrective action inference:** On negative feedback, the lesson DB infers top-3 remediation steps from similar past failures by tag/domain overlap.
308
- - **Bayesian belief update:** Each memory carries a posterior belief that updates on new evidence — high-entropy contradictions auto-prune.
309
-
310
- ### Enforcement and automation
311
-
312
- - **PreToolUse enforcement:** [scripts/gates-engine.js](scripts/gates-engine.js)
313
- - **Hook wiring:** `init --agent claude-code|codex|gemini`
314
- - **Browser automation / ops:** `playwright-core`
315
- - **Social analytics store:** `better-sqlite3`
316
-
317
- ### Billing and hosting
318
-
319
- - **Billing:** Stripe
320
- - **Hosted API / landing page:** Railway
321
- - **Worker lane:** Cloudflare Workers in [`workers/`](workers)
322
-
323
- ## Agent Integration Guides
324
-
325
- - [Claude Desktop extension](docs/CLAUDE_DESKTOP_EXTENSION.md)
326
- - [Cursor plugin operations](docs/CURSOR_PLUGIN_OPERATIONS.md)
327
- - [Continuity tools integration](docs/guides/continuity-tools-integration.md)
328
- - [OpenCode integration](docs/guides/opencode-integration.md)
329
-
330
- ## Operator Contract
331
-
332
- For autonomous agent runs against this or any repo using this workflow:
333
-
334
- - [WORKFLOW.md](WORKFLOW.md) — scope, proof-of-work, hard stops, done criteria
335
- - [.github/ISSUE_TEMPLATE/ready-for-agent.yml](.github/ISSUE_TEMPLATE/ready-for-agent.yml) — bounded intake template
336
- - [.github/pull_request_template.md](.github/pull_request_template.md) — proof-first PR handoff
337
-
338
- ## Pro Pack
339
-
340
- **[$19/mo or $149/yr](https://thumbgate-production.up.railway.app/checkout/pro?utm_source=github&utm_medium=readme&utm_campaign=thumbgate)** — personal local dashboard, DPO export, advanced data exports, and founder-license support for individual operators.
341
-
342
- **[Start Team Rollout](https://thumbgate-production.up.railway.app/#workflow-sprint-intake?utm_source=github&utm_medium=readme&utm_campaign=team_rollout)** — shared hosted lesson DB, org dashboard, generated hosted review views, curated gate templates, and workflow-hardening rollout support for teams.
343
-
344
- ### Free vs Pro
345
-
346
- | Feature | Free | Pro ($19/mo or $149/yr) | Team rollout ($12/seat/mo, min 3) |
347
- | --------------------------------- | ------ | ----------------------- | --------------------------------- |
348
- | Feedback capture (thumbs up/down) | 5/day | Unlimited | Shared across team workflow |
349
- | Lesson search | 10/day | Unlimited | Shared hosted lesson DB |
350
- | Recall | Unlimited | Unlimited | Shared hosted recall |
351
- | Prevention rules | Yes | Yes | Team-wide rollout |
352
- | PreToolUse gates | Yes | Yes | Team-wide rollout |
353
- | Thompson Sampling | Basic | Advanced | Advanced |
354
- | DPO training export | No | Yes | Yes |
355
- | Databricks export | No | Yes | Yes |
356
- | Personal local dashboard | No | Yes | Yes |
357
- | Org dashboard + active agents | No | No | Yes |
358
- | Gate template library | No | No | Yes |
359
- | Workflow hardening sprint | No | No | Yes |
360
- | Priority support | No | Yes | Yes |
361
-
362
- Free keeps the core safety policy, up to 10 auto-promoted gates, 5 daily feedback captures, 10 daily lesson searches, and unlimited recall on your machine.
149
+ ```
150
+ ┌─────────────────────────────────────────────────────────┐
151
+ │ STORAGE │ INTELLIGENCE │ ENFORCEMENT │
152
+ │ │ │ │
153
+ │ SQLite + FTS5 │ MemAlign dual │ PreToolUse │
154
+ │ LanceDB vectors │ recall │ hook engine │
155
+ │ JSONL logs │ Thompson Sampling│ Gates config │
156
+ │ ContextFS │ │ Hook wiring │
157
+ ├───────────────────┼───────────────────┼──────────────────┤
158
+ │ INTERFACES │ BILLING │ HOSTING │
159
+ │ │ │ │
160
+ │ MCP stdio │ Stripe │ Railway │
161
+ │ HTTP API │ │ Cloudflare │
162
+ │ CLI │ │ Workers │
163
+ │ Node.js >=18 │ │ │
164
+ └───────────────────┴───────────────────┴──────────────────┘
165
+ ```
363
166
 
364
- **[Get Pro — $19/mo or $149/yr](https://thumbgate-production.up.railway.app/checkout/pro?utm_source=github&utm_medium=readme&utm_campaign=thumbgate_cta)** — recurring self-serve for individual operators.
167
+ ## Docs
365
168
 
366
- **[Founder one-time offer — $49](https://buy.stripe.com/aFa4gz1M84r419v7mb3sI05)**preserved legacy founder checkout path.
169
+ - [Commercial Truth](docs/COMMERCIAL_TRUTH.md) — pricing, claims, what we don't say
170
+ - [Verification Evidence](docs/VERIFICATION_EVIDENCE.md) — proof artifacts
171
+ - [WORKFLOW.md](WORKFLOW.md) — agent-run contract (scope, hard stops, proof commands)
172
+ - [ready-for-agent issue template](.github/ISSUE_TEMPLATE/ready-for-agent.yml) — intake for agent tasks
367
173
 
368
- - [Commercial Truth](docs/COMMERCIAL_TRUTH.md)
369
- - [Verification Evidence](docs/VERIFICATION_EVIDENCE.md)
370
- - [Pitch](docs/PITCH.md)
371
- - [Anthropic Marketplace Strategy](docs/ANTHROPIC_MARKETPLACE_STRATEGY.md)
174
+ Pro overlay: [`thumbgate-pro`](https://github.com/IgorGanapolsky/thumbgate-pro) — separate repo/package inheriting from this base.
372
175
 
373
176
  ## License
374
177
 
@@ -3,7 +3,7 @@
3
3
  - `chatgpt/openapi.yaml`: import into GPT Actions.
4
4
  - `gemini/function-declarations.json`: Gemini function-calling definitions.
5
5
  - `mcp/server-stdio.js`: underlying local MCP stdio server implementation.
6
- - `claude/.mcp.json`: example Claude Code MCP config using `npx -y thumbgate@0.9.10 serve`.
6
+ - `claude/.mcp.json`: example Claude Code MCP config using `npx --yes --package thumbgate@0.9.12 thumbgate serve`.
7
7
  - `codex/config.toml`: example Codex MCP profile section using the same version-pinned portable launcher.
8
8
  - `amp/skills/thumbgate-feedback/SKILL.md`: Amp skill template.
9
9
  - `opencode/opencode.json`: portable OpenCode MCP profile using the same version-pinned portable launcher.
@@ -2,13 +2,13 @@
2
2
  "mcpServers": {
3
3
  "thumbgate": {
4
4
  "command": "npx",
5
- "args": ["-y", "thumbgate@0.9.10", "serve"]
5
+ "args": ["--yes", "--package", "thumbgate@0.9.12", "thumbgate", "serve"]
6
6
  }
7
7
  },
8
8
  "hooks": {
9
9
  "preToolUse": {
10
10
  "command": "npx",
11
- "args": ["-y", "thumbgate@0.9.10", "gate"]
11
+ "args": ["--yes", "--package", "thumbgate@0.9.12", "thumbgate", "gate-check"]
12
12
  }
13
13
  }
14
14
  }
@@ -1,9 +1,9 @@
1
1
  # Codex MCP profile (copy into ~/.codex/config.toml or merge section)
2
2
  [mcp_servers.thumbgate]
3
- command = "node"
4
- args = ["bin/cli.js", "serve"]
3
+ command = "npx"
4
+ args = ["--yes", "--package", "thumbgate@0.9.12", "thumbgate", "serve"]
5
5
 
6
6
  # Hard PreToolUse hook for Codex
7
7
  [hooks.pre_tool_use]
8
- command = "node"
9
- args = ["bin/cli.js", "gate"]
8
+ command = "npx"
9
+ args = ["--yes", "--package", "thumbgate@0.9.12", "thumbgate", "gate-check"]