thumbgate 1.2.0 → 1.4.0
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.
- package/.claude-plugin/README.md +4 -4
- package/.claude-plugin/marketplace.json +32 -13
- package/.claude-plugin/plugin.json +15 -2
- package/.well-known/llms.txt +60 -0
- package/.well-known/mcp/server-card.json +1 -1
- package/README.md +133 -23
- package/adapters/README.md +1 -1
- package/adapters/chatgpt/openapi.yaml +168 -0
- package/adapters/claude/.mcp.json +2 -2
- package/adapters/codex/config.toml +2 -2
- package/adapters/mcp/server-stdio.js +85 -2
- package/adapters/opencode/opencode.json +1 -1
- package/bin/cli.js +215 -19
- package/bin/postinstall.js +8 -2
- package/config/budget.json +18 -0
- package/config/gates/code-edit.json +61 -0
- package/config/gates/db-write.json +61 -0
- package/config/gates/default.json +154 -3
- package/config/gates/deploy.json +61 -0
- package/config/github-about.json +2 -1
- package/config/merge-quality-checks.json +23 -0
- package/config/model-tiers.json +11 -0
- package/openapi/openapi.yaml +168 -0
- package/package.json +47 -13
- package/plugins/claude-codex-bridge/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-codex-bridge/.mcp.json +1 -1
- package/plugins/claude-codex-bridge/scripts/codex-bridge.js +1 -3
- package/plugins/codex-profile/.codex-plugin/plugin.json +1 -1
- package/plugins/codex-profile/.mcp.json +1 -1
- package/plugins/codex-profile/INSTALL.md +27 -4
- package/plugins/codex-profile/README.md +33 -9
- package/plugins/cursor-marketplace/.cursor-plugin/plugin.json +1 -1
- package/plugins/cursor-marketplace/README.md +2 -2
- package/plugins/cursor-marketplace/commands/capture-feedback.md +2 -2
- package/plugins/cursor-marketplace/rules/feedback-capture.mdc +3 -3
- package/plugins/cursor-marketplace/skills/capture-feedback/SKILL.md +3 -2
- package/plugins/opencode-profile/INSTALL.md +1 -1
- package/public/blog.html +73 -0
- package/public/compare/mem0.html +189 -0
- package/public/compare/speclock.html +180 -0
- package/public/compare.html +12 -4
- package/public/guide.html +5 -5
- package/public/guides/claude-code-prevent-repeated-mistakes.html +161 -0
- package/public/guides/codex-cli-guardrails.html +158 -0
- package/public/guides/cursor-prevent-repeated-mistakes.html +161 -0
- package/public/guides/pre-action-gates.html +162 -0
- package/public/guides/stop-repeated-ai-agent-mistakes.html +159 -0
- package/public/index.html +169 -70
- package/public/learn/ai-agent-persistent-memory.html +1 -0
- package/public/lessons.html +334 -17
- package/public/llm-context.md +140 -0
- package/public/pro.html +24 -22
- package/scripts/__pycache__/train_from_feedback.cpython-312.pyc +0 -0
- package/scripts/access-anomaly-detector.js +1 -1
- package/scripts/adk-consolidator.js +1 -5
- package/scripts/agent-security-hardening.js +4 -6
- package/scripts/agentic-data-pipeline.js +1 -3
- package/scripts/async-job-runner.js +1 -5
- package/scripts/audit-trail.js +7 -5
- package/scripts/background-agent-governance.js +2 -10
- package/scripts/billing.js +2 -16
- package/scripts/budget-enforcer.js +173 -0
- package/scripts/build-codex-plugin.js +152 -0
- package/scripts/capture-railway-diagnostics.sh +97 -0
- package/scripts/check-congruence.js +133 -15
- package/scripts/claude-feedback-sync.js +320 -0
- package/scripts/cli-telemetry.js +4 -1
- package/scripts/commercial-offer.js +5 -7
- package/scripts/content-engine/linkedin-content-generator.js +154 -0
- package/scripts/content-engine/output/linkedin-memento-validation.md +17 -0
- package/scripts/content-engine/output/linkedin-posts-2026-04-09.md +175 -0
- package/scripts/content-engine/reddit-thread-finder.js +154 -0
- package/scripts/context-engine.js +21 -6
- package/scripts/contextfs.js +33 -44
- package/scripts/dashboard.js +104 -0
- package/scripts/decision-journal.js +341 -0
- package/scripts/delegation-runtime.js +1 -5
- package/scripts/distribution-surfaces.js +26 -0
- package/scripts/document-intake.js +927 -0
- package/scripts/ephemeral-agent-store.js +1 -8
- package/scripts/evolution-state.js +1 -5
- package/scripts/experiment-tracker.js +1 -5
- package/scripts/export-databricks-bundle.js +1 -5
- package/scripts/export-hf-dataset.js +1 -5
- package/scripts/export-training.js +1 -5
- package/scripts/feedback-attribution.js +1 -16
- package/scripts/feedback-history-distiller.js +1 -16
- package/scripts/feedback-loop.js +17 -5
- package/scripts/feedback-root-consolidator.js +2 -21
- package/scripts/feedback-session.js +49 -0
- package/scripts/feedback-to-rules.js +188 -28
- package/scripts/filesystem-search.js +1 -9
- package/scripts/fs-utils.js +104 -0
- package/scripts/gates-engine.js +149 -4
- package/scripts/github-about.js +32 -8
- package/scripts/gtm-revenue-loop.js +1 -5
- package/scripts/harness-selector.js +148 -0
- package/scripts/hosted-job-launcher.js +1 -5
- package/scripts/hybrid-feedback-context.js +7 -33
- package/scripts/intervention-policy.js +753 -0
- package/scripts/lesson-db.js +3 -18
- package/scripts/lesson-inference.js +194 -16
- package/scripts/lesson-retrieval.js +60 -24
- package/scripts/llm-client.js +59 -0
- package/scripts/local-model-profile.js +18 -2
- package/scripts/managed-lesson-agent.js +183 -0
- package/scripts/marketing-experiment.js +8 -22
- package/scripts/meta-agent-loop.js +624 -0
- package/scripts/metered-billing.js +1 -1
- package/scripts/model-tier-router.js +10 -1
- package/scripts/money-watcher.js +1 -4
- package/scripts/obsidian-export.js +1 -5
- package/scripts/operational-integrity.js +369 -34
- package/scripts/org-dashboard.js +6 -1
- package/scripts/per-step-scoring.js +2 -4
- package/scripts/pr-manager.js +201 -19
- package/scripts/pro-features.js +3 -2
- package/scripts/prompt-dlp.js +3 -3
- package/scripts/prove-adapters.js +2 -5
- package/scripts/prove-attribution.js +1 -5
- package/scripts/prove-automation.js +3 -5
- package/scripts/prove-cloudflare-sandbox.js +1 -3
- package/scripts/prove-data-pipeline.js +1 -3
- package/scripts/prove-intelligence.js +1 -3
- package/scripts/prove-lancedb.js +1 -5
- package/scripts/prove-local-intelligence.js +1 -3
- package/scripts/prove-packaged-runtime.js +326 -0
- package/scripts/prove-predictive-insights.js +1 -3
- package/scripts/prove-runtime.js +13 -0
- package/scripts/prove-training-export.js +1 -3
- package/scripts/prove-workflow-contract.js +1 -5
- package/scripts/rate-limiter.js +6 -4
- package/scripts/reddit-dm-outreach.js +14 -4
- package/scripts/schedule-manager.js +3 -5
- package/scripts/security-scanner.js +448 -0
- package/scripts/self-distill-agent.js +579 -0
- package/scripts/semantic-dedup.js +115 -0
- package/scripts/skill-exporter.js +1 -3
- package/scripts/skill-generator.js +1 -5
- package/scripts/social-analytics/engagement-audit.js +1 -18
- package/scripts/social-analytics/pollers/linkedin.js +26 -16
- package/scripts/social-analytics/publishers/linkedin.js +1 -1
- package/scripts/social-analytics/publishers/zernio.js +51 -0
- package/scripts/social-pipeline.js +1 -3
- package/scripts/social-post-hourly.js +47 -4
- package/scripts/statusline-links.js +6 -5
- package/scripts/statusline-local-stats.js +2 -0
- package/scripts/statusline.sh +38 -7
- package/scripts/sync-branch-protection.js +340 -0
- package/scripts/tessl-export.js +1 -3
- package/scripts/thumbgate-search.js +32 -1
- package/scripts/tool-kpi-tracker.js +1 -1
- package/scripts/tool-registry.js +108 -4
- package/scripts/vector-store.js +1 -5
- package/scripts/weekly-auto-post.js +1 -1
- package/scripts/workflow-sentinel.js +205 -4
- package/skills/thumbgate/SKILL.md +2 -2
- package/src/api/server.js +273 -4
- package/scripts/social-analytics/db/social-analytics.db-shm +0 -0
- /package/scripts/social-analytics/db/{social-analytics.db-wal → analytics.sqlite} +0 -0
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const crypto = require('crypto');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const {
|
|
7
|
+
captureFeedback,
|
|
8
|
+
getFeedbackPaths,
|
|
9
|
+
readJSONL,
|
|
10
|
+
analyzeFeedback,
|
|
11
|
+
} = require('./feedback-loop');
|
|
12
|
+
const { normalizeFeedbackText } = require('./feedback-quality');
|
|
13
|
+
const {
|
|
14
|
+
resolveFeedbackDir,
|
|
15
|
+
resolveProjectDir,
|
|
16
|
+
} = require('./feedback-paths');
|
|
17
|
+
const { refreshStatuslineCache } = require('./hook-thumbgate-cache-updater');
|
|
18
|
+
|
|
19
|
+
const SYNC_STATE_FILE = 'claude-feedback-sync-state.json';
|
|
20
|
+
const DEFAULT_RECENT_FEEDBACK_LIMIT = 250;
|
|
21
|
+
const DEFAULT_PROCESSED_ID_LIMIT = 512;
|
|
22
|
+
const DUPLICATE_WINDOW_MS = 30 * 1000;
|
|
23
|
+
|
|
24
|
+
function getClaudeHistoryPath(options = {}) {
|
|
25
|
+
if (options.historyPath) return options.historyPath;
|
|
26
|
+
if (process.env.THUMBGATE_CLAUDE_HISTORY_PATH) return process.env.THUMBGATE_CLAUDE_HISTORY_PATH;
|
|
27
|
+
const homeDir = options.homeDir || process.env.HOME || process.env.USERPROFILE || '';
|
|
28
|
+
return path.join(homeDir, '.claude', 'history.jsonl');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function getSyncStatePath(options = {}) {
|
|
32
|
+
const feedbackDir = resolveFeedbackDir({ feedbackDir: options.feedbackDir });
|
|
33
|
+
return path.join(feedbackDir, SYNC_STATE_FILE);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function readSyncState(options = {}) {
|
|
37
|
+
const statePath = getSyncStatePath(options);
|
|
38
|
+
try {
|
|
39
|
+
const parsed = JSON.parse(fs.readFileSync(statePath, 'utf8'));
|
|
40
|
+
return {
|
|
41
|
+
historyOffset: Number(parsed.historyOffset || 0),
|
|
42
|
+
historySize: Number(parsed.historySize || 0),
|
|
43
|
+
processedIds: Array.isArray(parsed.processedIds) ? parsed.processedIds : [],
|
|
44
|
+
statePath,
|
|
45
|
+
};
|
|
46
|
+
} catch {
|
|
47
|
+
return {
|
|
48
|
+
historyOffset: 0,
|
|
49
|
+
historySize: 0,
|
|
50
|
+
processedIds: [],
|
|
51
|
+
statePath,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function writeSyncState(state, options = {}) {
|
|
57
|
+
const statePath = getSyncStatePath(options);
|
|
58
|
+
const payload = {
|
|
59
|
+
historyOffset: Number(state.historyOffset || 0),
|
|
60
|
+
historySize: Number(state.historySize || 0),
|
|
61
|
+
processedIds: Array.isArray(state.processedIds) ? state.processedIds.slice(-DEFAULT_PROCESSED_ID_LIMIT) : [],
|
|
62
|
+
updatedAt: new Date().toISOString(),
|
|
63
|
+
};
|
|
64
|
+
fs.mkdirSync(path.dirname(statePath), { recursive: true });
|
|
65
|
+
fs.writeFileSync(statePath, JSON.stringify(payload, null, 2));
|
|
66
|
+
return payload;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function readHistoryEntriesSince(filePath, state) {
|
|
70
|
+
if (!filePath || !fs.existsSync(filePath)) {
|
|
71
|
+
return {
|
|
72
|
+
entries: [],
|
|
73
|
+
nextOffset: 0,
|
|
74
|
+
size: 0,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const stat = fs.statSync(filePath);
|
|
79
|
+
const safeOffset = state && state.historyOffset > 0 && state.historyOffset <= stat.size
|
|
80
|
+
? state.historyOffset
|
|
81
|
+
: 0;
|
|
82
|
+
|
|
83
|
+
const fileBuffer = fs.readFileSync(filePath);
|
|
84
|
+
const contents = fileBuffer.slice(safeOffset).toString('utf8');
|
|
85
|
+
|
|
86
|
+
const entries = contents
|
|
87
|
+
.split('\n')
|
|
88
|
+
.map((line) => line.trim())
|
|
89
|
+
.filter(Boolean)
|
|
90
|
+
.map((line) => {
|
|
91
|
+
try {
|
|
92
|
+
return JSON.parse(line);
|
|
93
|
+
} catch {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
.filter(Boolean);
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
entries,
|
|
101
|
+
nextOffset: stat.size,
|
|
102
|
+
size: stat.size,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function normalizeProjectPath(value) {
|
|
107
|
+
try {
|
|
108
|
+
return value ? path.resolve(String(value)) : null;
|
|
109
|
+
} catch {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function parseHistoryTimestamp(value) {
|
|
115
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
116
|
+
return value > 1e12 ? value : value * 1000;
|
|
117
|
+
}
|
|
118
|
+
const text = String(value || '').trim();
|
|
119
|
+
if (!text) return null;
|
|
120
|
+
if (/^\d+$/.test(text)) {
|
|
121
|
+
const numeric = Number(text);
|
|
122
|
+
return numeric > 1e12 ? numeric : numeric * 1000;
|
|
123
|
+
}
|
|
124
|
+
const parsed = Date.parse(text);
|
|
125
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function detectSignal(text) {
|
|
129
|
+
const normalized = String(text || '').toLowerCase();
|
|
130
|
+
if (/(thumbs?\s*down|that failed|that was wrong|fix this)/i.test(normalized)) return 'down';
|
|
131
|
+
if (/(thumbs?\s*up|that worked|looks good|nice work|perfect|good job)/i.test(normalized)) return 'up';
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function extractPromptText(entry) {
|
|
136
|
+
const candidates = [
|
|
137
|
+
entry && entry.display,
|
|
138
|
+
entry && entry.message && entry.message.content,
|
|
139
|
+
entry && entry.attachment && entry.attachment.prompt,
|
|
140
|
+
entry && entry.content,
|
|
141
|
+
];
|
|
142
|
+
|
|
143
|
+
for (const candidate of candidates) {
|
|
144
|
+
if (typeof candidate === 'string' && candidate.trim()) {
|
|
145
|
+
return candidate.trim();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return '';
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function buildExternalId(entry, promptText) {
|
|
152
|
+
const hash = crypto.createHash('sha256');
|
|
153
|
+
hash.update(String(entry.sessionId || ''));
|
|
154
|
+
hash.update('|');
|
|
155
|
+
hash.update(String(entry.timestamp || ''));
|
|
156
|
+
hash.update('|');
|
|
157
|
+
hash.update(String(entry.project || entry.cwd || ''));
|
|
158
|
+
hash.update('|');
|
|
159
|
+
hash.update(String(promptText || ''));
|
|
160
|
+
return `claude-history:${hash.digest('hex')}`;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function toHistoryCandidate(entry, options = {}) {
|
|
164
|
+
const promptText = extractPromptText(entry);
|
|
165
|
+
const signal = detectSignal(promptText);
|
|
166
|
+
if (!signal) return null;
|
|
167
|
+
|
|
168
|
+
const projectDir = normalizeProjectPath(options.projectDir);
|
|
169
|
+
const entryProject = normalizeProjectPath(entry.project || entry.cwd || '');
|
|
170
|
+
if (projectDir && entryProject && entryProject !== projectDir && !entryProject.startsWith(`${projectDir}${path.sep}`)) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
if (projectDir && !entryProject) {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return {
|
|
178
|
+
externalId: buildExternalId(entry, promptText),
|
|
179
|
+
promptText,
|
|
180
|
+
signal,
|
|
181
|
+
timestampMs: parseHistoryTimestamp(entry.timestamp),
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function normalizeCandidateText(value) {
|
|
186
|
+
return normalizeFeedbackText(String(value || '').replace(/\s+/g, ' '));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function hasMatchingFeedbackEntry(candidate, feedbackEntries) {
|
|
190
|
+
const candidateText = normalizeCandidateText(candidate.promptText);
|
|
191
|
+
if (!candidateText) return false;
|
|
192
|
+
|
|
193
|
+
return feedbackEntries.some((entry) => {
|
|
194
|
+
const signal = entry && entry.signal === 'negative' ? 'down' : 'up';
|
|
195
|
+
if (signal !== candidate.signal) return false;
|
|
196
|
+
|
|
197
|
+
const feedbackText = normalizeCandidateText(
|
|
198
|
+
entry.submittedContext
|
|
199
|
+
|| entry.context
|
|
200
|
+
|| entry.whatWentWrong
|
|
201
|
+
|| entry.whatWorked
|
|
202
|
+
|| ''
|
|
203
|
+
);
|
|
204
|
+
if (feedbackText !== candidateText) return false;
|
|
205
|
+
|
|
206
|
+
const feedbackTimestamp = Date.parse(entry.timestamp || '');
|
|
207
|
+
if (!Number.isFinite(feedbackTimestamp) || !Number.isFinite(candidate.timestampMs)) {
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
return Math.abs(feedbackTimestamp - candidate.timestampMs) <= DUPLICATE_WINDOW_MS;
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function syncClaudeHistoryFeedback(options = {}) {
|
|
215
|
+
if (options.disabled || process.env.THUMBGATE_DISABLE_CLAUDE_HISTORY_SYNC === '1') {
|
|
216
|
+
return {
|
|
217
|
+
importedCount: 0,
|
|
218
|
+
skippedCount: 0,
|
|
219
|
+
reason: 'disabled',
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const originalEnv = {
|
|
224
|
+
THUMBGATE_FEEDBACK_DIR: process.env.THUMBGATE_FEEDBACK_DIR,
|
|
225
|
+
THUMBGATE_PROJECT_DIR: process.env.THUMBGATE_PROJECT_DIR,
|
|
226
|
+
THUMBGATE_CLAUDE_HISTORY_PATH: process.env.THUMBGATE_CLAUDE_HISTORY_PATH,
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
if (options.feedbackDir) process.env.THUMBGATE_FEEDBACK_DIR = options.feedbackDir;
|
|
230
|
+
if (options.projectDir && !options.feedbackDir) process.env.THUMBGATE_PROJECT_DIR = options.projectDir;
|
|
231
|
+
if (options.historyPath) process.env.THUMBGATE_CLAUDE_HISTORY_PATH = options.historyPath;
|
|
232
|
+
|
|
233
|
+
try {
|
|
234
|
+
const feedbackDir = resolveFeedbackDir({ feedbackDir: options.feedbackDir });
|
|
235
|
+
const projectDir = normalizeProjectPath(options.projectDir) || resolveProjectDir({
|
|
236
|
+
cwd: process.cwd(),
|
|
237
|
+
env: process.env,
|
|
238
|
+
});
|
|
239
|
+
const historyPath = getClaudeHistoryPath(options);
|
|
240
|
+
const state = readSyncState({ feedbackDir });
|
|
241
|
+
const history = readHistoryEntriesSince(historyPath, state);
|
|
242
|
+
const existingEntries = readJSONL(path.join(feedbackDir, 'feedback-log.jsonl'), {
|
|
243
|
+
maxLines: DEFAULT_RECENT_FEEDBACK_LIMIT,
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
let importedCount = 0;
|
|
247
|
+
let skippedCount = 0;
|
|
248
|
+
const processedIds = new Set(state.processedIds || []);
|
|
249
|
+
|
|
250
|
+
for (const entry of history.entries) {
|
|
251
|
+
const candidate = toHistoryCandidate(entry, { projectDir });
|
|
252
|
+
if (!candidate) continue;
|
|
253
|
+
if (processedIds.has(candidate.externalId)) {
|
|
254
|
+
skippedCount += 1;
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (hasMatchingFeedbackEntry(candidate, existingEntries)) {
|
|
259
|
+
processedIds.add(candidate.externalId);
|
|
260
|
+
skippedCount += 1;
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const captureResult = captureFeedback({
|
|
265
|
+
signal: candidate.signal,
|
|
266
|
+
context: candidate.promptText,
|
|
267
|
+
whatWentWrong: candidate.signal === 'down' ? candidate.promptText : undefined,
|
|
268
|
+
whatWorked: candidate.signal === 'up' ? candidate.promptText : undefined,
|
|
269
|
+
tags: ['claude-history-sync', 'auto-capture-fallback'],
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
if (captureResult && captureResult.feedbackEvent) {
|
|
273
|
+
existingEntries.push(captureResult.feedbackEvent);
|
|
274
|
+
}
|
|
275
|
+
processedIds.add(candidate.externalId);
|
|
276
|
+
importedCount += 1;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
writeSyncState({
|
|
280
|
+
historyOffset: history.nextOffset,
|
|
281
|
+
historySize: history.size,
|
|
282
|
+
processedIds: Array.from(processedIds),
|
|
283
|
+
}, { feedbackDir });
|
|
284
|
+
|
|
285
|
+
if (importedCount > 0) {
|
|
286
|
+
refreshStatuslineCache(analyzeFeedback(path.join(feedbackDir, 'feedback-log.jsonl')), path.join(feedbackDir, 'statusline_cache.json'));
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
return {
|
|
290
|
+
importedCount,
|
|
291
|
+
skippedCount,
|
|
292
|
+
historyPath,
|
|
293
|
+
feedbackDir,
|
|
294
|
+
projectDir,
|
|
295
|
+
};
|
|
296
|
+
} finally {
|
|
297
|
+
if (originalEnv.THUMBGATE_FEEDBACK_DIR == null) delete process.env.THUMBGATE_FEEDBACK_DIR;
|
|
298
|
+
else process.env.THUMBGATE_FEEDBACK_DIR = originalEnv.THUMBGATE_FEEDBACK_DIR;
|
|
299
|
+
|
|
300
|
+
if (originalEnv.THUMBGATE_PROJECT_DIR == null) delete process.env.THUMBGATE_PROJECT_DIR;
|
|
301
|
+
else process.env.THUMBGATE_PROJECT_DIR = originalEnv.THUMBGATE_PROJECT_DIR;
|
|
302
|
+
|
|
303
|
+
if (originalEnv.THUMBGATE_CLAUDE_HISTORY_PATH == null) delete process.env.THUMBGATE_CLAUDE_HISTORY_PATH;
|
|
304
|
+
else process.env.THUMBGATE_CLAUDE_HISTORY_PATH = originalEnv.THUMBGATE_CLAUDE_HISTORY_PATH;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
module.exports = {
|
|
309
|
+
SYNC_STATE_FILE,
|
|
310
|
+
detectSignal,
|
|
311
|
+
extractPromptText,
|
|
312
|
+
getClaudeHistoryPath,
|
|
313
|
+
hasMatchingFeedbackEntry,
|
|
314
|
+
parseHistoryTimestamp,
|
|
315
|
+
readHistoryEntriesSince,
|
|
316
|
+
readSyncState,
|
|
317
|
+
syncClaudeHistoryFeedback,
|
|
318
|
+
toHistoryCandidate,
|
|
319
|
+
writeSyncState,
|
|
320
|
+
};
|
package/scripts/cli-telemetry.js
CHANGED
|
@@ -5,7 +5,9 @@ const crypto = require('crypto');
|
|
|
5
5
|
const fs = require('fs');
|
|
6
6
|
const path = require('path');
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const _DEFAULT_TELEMETRY_HOST = 'https://thumbgate-production.up.railway.app';
|
|
9
|
+
// Respect THUMBGATE_API_URL so test environments can point to a local stub
|
|
10
|
+
const TELEMETRY_ENDPOINT = `${process.env.THUMBGATE_API_URL || _DEFAULT_TELEMETRY_HOST}/v1/telemetry/ping`;
|
|
9
11
|
const INSTALL_ID_PATH = path.join(process.env.HOME || process.env.USERPROFILE || '.', '.thumbgate', 'install-id');
|
|
10
12
|
|
|
11
13
|
/**
|
|
@@ -80,6 +82,7 @@ function trackEvent(eventType, metadata = {}) {
|
|
|
80
82
|
});
|
|
81
83
|
req.on('error', () => {}); // silently ignore
|
|
82
84
|
req.on('timeout', () => req.destroy());
|
|
85
|
+
req.on('socket', (s) => s.unref()); // fire-and-forget: never block process exit
|
|
83
86
|
req.end(payload);
|
|
84
87
|
} catch (_) {} // never crash the CLI
|
|
85
88
|
}
|
|
@@ -2,20 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
const PRO_MONTHLY_PAYMENT_LINK = 'https://buy.stripe.com/5kQ4gzbmI9Lo6tPayn3sI06';
|
|
4
4
|
const PRO_ANNUAL_PAYMENT_LINK = 'https://buy.stripe.com/3cI8wPfCYaPs2dzdKz3sI07';
|
|
5
|
-
const PRO_FOUNDER_PAYMENT_LINK = 'https://buy.stripe.com/aFa4gz1M84r419v7mb3sI05';
|
|
6
5
|
|
|
7
6
|
const PRO_MONTHLY_PRICE_ID = 'price_1THQY7GGBpd520QYHoS7RG0J';
|
|
8
7
|
const PRO_ANNUAL_PRICE_ID = 'price_1THQZ7GGBpd520QYxzDRnxhB';
|
|
9
|
-
const TEAM_MONTHLY_PRICE_ID = '
|
|
8
|
+
const TEAM_MONTHLY_PRICE_ID = 'price_1TKLUhGGBpd520QYr5pgEZit';
|
|
10
9
|
|
|
11
10
|
const PRO_MONTHLY_PRICE_DOLLARS = 19;
|
|
12
11
|
const PRO_ANNUAL_PRICE_DOLLARS = 149;
|
|
13
|
-
const TEAM_MONTHLY_PRICE_DOLLARS =
|
|
14
|
-
const TEAM_ANNUAL_PRICE_DOLLARS =
|
|
12
|
+
const TEAM_MONTHLY_PRICE_DOLLARS = 99;
|
|
13
|
+
const TEAM_ANNUAL_PRICE_DOLLARS = 1188;
|
|
15
14
|
const TEAM_MIN_SEATS = 3;
|
|
16
15
|
|
|
17
|
-
const PRO_PRICE_LABEL = '$19/mo or $149/yr';
|
|
18
|
-
const TEAM_PRICE_LABEL = '
|
|
16
|
+
const PRO_PRICE_LABEL = '$19/mo or $149/yr (individual)';
|
|
17
|
+
const TEAM_PRICE_LABEL = '$99/seat/mo — Agent governance for engineering teams';
|
|
19
18
|
|
|
20
19
|
function normalizePlanId(value) {
|
|
21
20
|
const text = String(value || '').trim().toLowerCase();
|
|
@@ -39,7 +38,6 @@ function normalizeSeatCount(value, fallback = TEAM_MIN_SEATS) {
|
|
|
39
38
|
module.exports = {
|
|
40
39
|
PRO_MONTHLY_PAYMENT_LINK,
|
|
41
40
|
PRO_ANNUAL_PAYMENT_LINK,
|
|
42
|
-
PRO_FOUNDER_PAYMENT_LINK,
|
|
43
41
|
PRO_MONTHLY_PRICE_ID,
|
|
44
42
|
PRO_ANNUAL_PRICE_ID,
|
|
45
43
|
TEAM_MONTHLY_PRICE_ID,
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* LinkedIn Content Generator for ThumbGate Gates
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* node scripts/content-engine/linkedin-content-generator.js
|
|
8
|
+
* node scripts/content-engine/linkedin-content-generator.js --preview
|
|
9
|
+
*
|
|
10
|
+
* Suggested package.json scripts:
|
|
11
|
+
* "content:linkedin": "node scripts/content-engine/linkedin-content-generator.js"
|
|
12
|
+
* "content:linkedin:preview": "node scripts/content-engine/linkedin-content-generator.js --preview"
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const crypto = require('crypto');
|
|
16
|
+
const fs = require('fs');
|
|
17
|
+
const path = require('path');
|
|
18
|
+
|
|
19
|
+
// Read gate config
|
|
20
|
+
const configPath = path.join(__dirname, '../../config/gates/default.json');
|
|
21
|
+
let config;
|
|
22
|
+
try {
|
|
23
|
+
config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
24
|
+
} catch (err) {
|
|
25
|
+
process.stderr.write(`Failed to load gate config from ${configPath}: ${err.message}\n`);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Select 7 diverse gates across severity levels
|
|
30
|
+
const severityOrder = { critical: 0, high: 1, medium: 2, low: 3 };
|
|
31
|
+
const gatesBySeverity = {
|
|
32
|
+
critical: [],
|
|
33
|
+
high: [],
|
|
34
|
+
medium: [],
|
|
35
|
+
low: []
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
config.gates.forEach(gate => {
|
|
39
|
+
const severity = gate.severity || 'low';
|
|
40
|
+
if (gatesBySeverity[severity]) {
|
|
41
|
+
gatesBySeverity[severity].push(gate);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Select one from each severity, then fill remaining from largest buckets
|
|
46
|
+
const selected = [];
|
|
47
|
+
['critical', 'high', 'medium', 'low'].forEach(severity => {
|
|
48
|
+
if (gatesBySeverity[severity].length > 0) {
|
|
49
|
+
selected.push(gatesBySeverity[severity][0]);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Fill remaining slots (7 total) — shuffle with crypto-secure randomness (Fisher-Yates)
|
|
54
|
+
const remaining = config.gates.filter(g => !selected.includes(g));
|
|
55
|
+
for (let i = remaining.length - 1; i > 0; i--) {
|
|
56
|
+
const j = crypto.randomInt(i + 1);
|
|
57
|
+
[remaining[i], remaining[j]] = [remaining[j], remaining[i]];
|
|
58
|
+
}
|
|
59
|
+
while (selected.length < 7 && remaining.length > 0) {
|
|
60
|
+
selected.push(remaining.pop());
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Generate LinkedIn post content
|
|
64
|
+
const posts = selected.map((gate, index) => {
|
|
65
|
+
const hookLines = [
|
|
66
|
+
'🚨 Your AI agents are running without guardrails.',
|
|
67
|
+
'⚠️ One missing gate. One catastrophic mistake.',
|
|
68
|
+
'🛡️ Even the best engineers miss edge cases.',
|
|
69
|
+
'💥 Your deployment pipeline has a blind spot.',
|
|
70
|
+
'🔓 Git operations—unguarded by default.',
|
|
71
|
+
'🎯 Prevention beats firefighting.',
|
|
72
|
+
'⏱️ How fast can your agent destroy a month of work?'
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
const gateDescriptions = {
|
|
76
|
+
'local-only-git-writes': 'Blocks git writes when local-only mode is active, preventing accidental remote pushes during development.',
|
|
77
|
+
'task-scope-required': 'Enforces explicit task scoping before any git, PR, or publish operations can proceed.',
|
|
78
|
+
'protected-file-approval-required': 'Requires human approval before modifying sensitive files like CLAUDE.md, configs, and skills.',
|
|
79
|
+
'gh-pr-create-restricted': 'Restricts PR creation to explicitly approved workflows, preventing unvetted code changes.',
|
|
80
|
+
'gh-pr-merge-restricted': 'Blocks PR merges without explicit permission, enforcing code review discipline.',
|
|
81
|
+
'branch-governance-required': 'Demands branch governance context before release, deploy, or publish actions.',
|
|
82
|
+
'force-push': 'Blocks destructive force-push operations—no exceptions.',
|
|
83
|
+
'protected-branch-push': 'Prevents direct pushes to main/develop. All changes flow through PR review.',
|
|
84
|
+
'release-readiness-required': 'Ensures releases only happen from releasable mainline commits with version alignment.',
|
|
85
|
+
'admin-merge-bypass-blocked': 'Blocks admin merge bypass. Code review gates apply equally to everyone.',
|
|
86
|
+
'push-without-thread-check': 'Forces thread review before pushing—prevents shipping unresolved feedback.',
|
|
87
|
+
'env-file-edit': 'Warns when editing .env files—catches accidental token deletion.',
|
|
88
|
+
'unverified-skill-use': 'Validates skill provenance before delegating to subagents in restricted modes.',
|
|
89
|
+
'production-deploy-approval': 'Requires human sign-off on production deployments.',
|
|
90
|
+
'schema-migration-approval': 'Demands approval for database schema migrations—no surprise breaking changes.',
|
|
91
|
+
'supply-chain-dep-add': 'Audits package.json mutations for typosquatting and suspicious installs.',
|
|
92
|
+
'deny-network-egress': 'Warns on unauthorized egress—catches exfiltration attempts early.'
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const post = `
|
|
96
|
+
## Post ${index + 1}: ${gate.id.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ')}
|
|
97
|
+
|
|
98
|
+
${hookLines[index % hookLines.length]}
|
|
99
|
+
|
|
100
|
+
${gateDescriptions[gate.id] || `Protects your workflow by ${gate.message.toLowerCase()}`}
|
|
101
|
+
|
|
102
|
+
The problem? AI agents run autonomously. A single unchecked operation—a force-push, an unapproved deploy, a dependency injection—can unwind days of work in seconds. Traditional CI won't catch it. Your human reviewer might miss it.
|
|
103
|
+
|
|
104
|
+
The solution? **Gate \`${gate.id}\`** in ThumbGate stops high-risk operations *before* they execute. No second chances. Just prevention.
|
|
105
|
+
|
|
106
|
+
This isn't about slowing down. It's about building trust in autonomous systems. Every gate is a rule learned from real failures.
|
|
107
|
+
|
|
108
|
+
🔒 Install ThumbGate today:
|
|
109
|
+
\`\`\`bash
|
|
110
|
+
npx thumbgate@latest init
|
|
111
|
+
\`\`\`
|
|
112
|
+
|
|
113
|
+
Then add this gate to your config and sleep better.
|
|
114
|
+
|
|
115
|
+
#AIGovernance #DevTools #AgentSafety #EngineeringTeams
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
`;
|
|
119
|
+
return post;
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// Generate output filename with today's date
|
|
123
|
+
const today = new Date();
|
|
124
|
+
const dateStr = today.toISOString().split('T')[0]; // YYYY-MM-DD
|
|
125
|
+
const outputDir = path.join(__dirname, 'output');
|
|
126
|
+
const outputFile = path.join(outputDir, `linkedin-posts-${dateStr}.md`);
|
|
127
|
+
|
|
128
|
+
// Create output directory if it doesn't exist
|
|
129
|
+
if (!fs.existsSync(outputDir)) {
|
|
130
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Generate markdown content
|
|
134
|
+
const markdown = `# LinkedIn Content: ThumbGate Gates (${dateStr})
|
|
135
|
+
|
|
136
|
+
Generated from: \`config/gates/default.json\`
|
|
137
|
+
Gate count in config: ${config.gates.length}
|
|
138
|
+
Posts generated: ${selected.length}
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
${posts.join('\n')}
|
|
142
|
+
`;
|
|
143
|
+
|
|
144
|
+
// Output or write file
|
|
145
|
+
const preview = process.argv.includes('--preview');
|
|
146
|
+
if (preview) {
|
|
147
|
+
console.log(markdown);
|
|
148
|
+
console.log(`\n✅ Preview mode (${selected.length} posts)`);
|
|
149
|
+
} else {
|
|
150
|
+
fs.writeFileSync(outputFile, markdown, 'utf8');
|
|
151
|
+
console.log(`✅ Generated ${selected.length} LinkedIn posts to: ${outputFile}`);
|
|
152
|
+
console.log(` Severities: ${selected.map(g => g.severity).sort().join(', ')}`);
|
|
153
|
+
console.log(` Gates: ${selected.map(g => g.id).join(', ')}`);
|
|
154
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# ThumbGate: Validated in Production
|
|
2
|
+
|
|
3
|
+
Academic research just proved what we've been running in production for 18 months.
|
|
4
|
+
|
|
5
|
+
The Memento-Skills paper (arXiv 2603.18743) demonstrates that external skill memory systems — ones that rewrite themselves from failure feedback — achieve 26-116% accuracy improvements without touching the model. No retraining. No fine-tuning. Just structured context engineering.
|
|
6
|
+
|
|
7
|
+
That's exactly what ThumbGate does. We capture agent failures, infer prevention rules, and inject them as PreToolUse gates. The paper's Read → Execute → Reflect → Write loop maps directly to our capture → infer → enforce → block cycle. The academic validation confirms what we've observed: you don't need to retrain your model to make it safer and more reliable. You need better context.
|
|
8
|
+
|
|
9
|
+
ThumbGate processes real-world AI agent failures — git operations, code edits, file writes, API calls — and learns from them. Every "thumbs down" on a failed action becomes a lesson. Every lesson becomes a rule. Every rule becomes a gate that stops the same mistake from happening again. The feedback loop is tight. The enforcement is immediate.
|
|
10
|
+
|
|
11
|
+
The paper validates the core insight: agents fail in predictable ways, and those patterns can be captured, learned, and blocked without model modification. That's not theoretical. We're doing it now, across 48+ tool adapters and 4,500+ prevention gates, with zero retraining.
|
|
12
|
+
|
|
13
|
+
Context engineering works. The research proves it. The production metrics show it.
|
|
14
|
+
|
|
15
|
+
Try it: `npx thumbgate@latest init`
|
|
16
|
+
|
|
17
|
+
#AIGovernance #AgentSafety #MementoSkills #ContextEngineering
|