thumbgate 1.27.6 → 1.27.8
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/commands/thumbgate-blocked.md +27 -0
- package/.claude/commands/thumbgate-doctor.md +30 -0
- package/.claude/commands/thumbgate-guard.md +36 -0
- package/.claude/commands/thumbgate-protect.md +30 -0
- package/.claude/commands/thumbgate-rules.md +30 -0
- package/.claude-plugin/plugin.json +1 -1
- package/.well-known/llms.txt +6 -2
- package/.well-known/mcp/server-card.json +1 -1
- package/README.md +49 -5
- package/adapters/claude/.mcp.json +2 -2
- package/adapters/letta/README.md +41 -0
- package/adapters/letta/thumbgate-letta-adapter.js +133 -0
- package/adapters/mcp/server-stdio.js +16 -1
- package/adapters/opencode/opencode.json +1 -1
- package/adapters/policy-engine/ethicore-guardian-client.js +68 -0
- package/adapters/policy-engine/thumbgate-policy-engine-adapter.js +260 -0
- package/bench/observability-eval-suite.json +26 -0
- package/bin/cli.js +180 -2
- package/bin/postinstall.js +1 -1
- package/config/gate-templates.json +84 -0
- package/config/gates/claim-verification.json +6 -0
- package/config/gates/default.json +20 -0
- package/config/github-about.json +1 -1
- package/config/model-candidates.json +50 -0
- package/package.json +66 -25
- package/public/agent-manager.html +41 -1
- package/public/agents-cost-savings.html +1 -1
- package/public/ai-malpractice-prevention.html +2 -1
- package/public/assets/brand/github-social-preview.png +0 -0
- package/public/assets/brand/thumbgate-icon-512.png +0 -0
- package/public/assets/brand/thumbgate-icon-pro-512.png +0 -0
- package/public/assets/brand/thumbgate-icon-team-512.png +0 -0
- package/public/assets/brand/thumbgate-logo-1200x360.png +0 -0
- package/public/assets/brand/thumbgate-mark-inline.svg +15 -0
- package/public/assets/brand/thumbgate-mark-pro.svg +23 -0
- package/public/assets/brand/thumbgate-mark-team.svg +26 -0
- package/public/assets/brand/thumbgate-mark.svg +15 -0
- package/public/assets/brand/thumbgate-wordmark.svg +20 -0
- package/public/assets/claude-thumbgate-statusbar.svg +8 -0
- package/public/assets/codex-thumbgate-statusbar-test.svg +9 -0
- package/public/assets/legal-intake-control-flow.svg +66 -0
- package/public/blog.html +1 -1
- package/public/brand/thumbgate-mark.svg +15 -0
- package/public/brand/thumbgate-og.svg +16 -0
- package/public/codex-enterprise.html +1 -1
- package/public/codex-plugin.html +1 -1
- package/public/compare.html +23 -3
- package/public/dashboard.html +312 -30
- package/public/federal.html +1 -1
- package/public/guide.html +5 -4
- package/public/index.html +167 -49
- package/public/js/buyer-intent.js +672 -0
- package/public/learn.html +74 -7
- package/public/lessons.html +2 -1
- package/public/numbers.html +3 -3
- package/public/pricing.html +63 -15
- package/public/pro.html +7 -7
- package/scripts/activation-quickstart.js +187 -0
- package/scripts/agent-memory-lifecycle.js +211 -0
- package/scripts/async-eval-observability.js +236 -0
- package/scripts/auto-promote-gates.js +75 -4
- package/scripts/build-metadata.js +24 -3
- package/scripts/cli-schema.js +22 -0
- package/scripts/dashboard-chat.js +2 -1
- package/scripts/dashboard.js +8 -0
- package/scripts/export-databricks-bundle.js +5 -1
- package/scripts/export-dpo-pairs.js +7 -2
- package/scripts/feedback-aggregate.js +281 -0
- package/scripts/feedback-loop.js +34 -0
- package/scripts/filesystem-search.js +35 -10
- package/scripts/gates-engine.js +198 -6
- package/scripts/gemini-embedding-policy.js +2 -1
- package/scripts/hook-stop-anti-claim.js +227 -0
- package/scripts/hook-thumbgate-cache-updater.js +18 -2
- package/scripts/lesson-inference.js +8 -3
- package/scripts/lesson-search.js +17 -1
- package/scripts/operational-integrity.js +39 -5
- package/scripts/plausible-domain-config.js +4 -2
- package/scripts/rate-limiter.js +12 -6
- package/scripts/secret-redaction.js +166 -0
- package/scripts/security-scanner.js +100 -0
- package/scripts/self-distill-agent.js +3 -1
- package/scripts/self-harness-optimizer.js +141 -0
- package/scripts/seo-gsd.js +635 -0
- package/scripts/statusline-cache-path.js +17 -2
- package/scripts/statusline-cache-read.js +57 -0
- package/scripts/statusline-local-stats.js +9 -1
- package/scripts/statusline-meta.js +5 -2
- package/scripts/statusline.sh +13 -1
- package/scripts/sync-telemetry-from-prod.js +374 -0
- package/scripts/telemetry-analytics.js +9 -0
- package/scripts/thumbgate-search.js +85 -19
- package/scripts/tool-contract-validator.js +76 -0
- package/scripts/vector-store.js +44 -0
- package/scripts/workspace-evolver.js +62 -2
- package/src/api/server.js +715 -86
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Self-Harness Optimizer
|
|
4
|
+
*
|
|
5
|
+
* Implements the continuous self-improving loop from the "Self-Harness" paradigm (arXiv:2606.09498):
|
|
6
|
+
* 1. Weakness Mining: Reads auto-promoted gates from repeated failures (.thumbgate/auto-promoted-gates.json)
|
|
7
|
+
* 2. Harness Proposal: Generates technical rules and injects them directly into system prompts (AGENTS.md & GEMINI.md)
|
|
8
|
+
* 3. Validation: Runs quick test suites to ensure prompt updates do not introduce regressions.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const { execSync } = require('child_process');
|
|
14
|
+
|
|
15
|
+
const ROOT = path.join(__dirname, '..');
|
|
16
|
+
const GATES_PATH = path.join(ROOT, '.thumbgate', 'auto-promoted-gates.json');
|
|
17
|
+
const AGENTS_MD_PATH = path.join(ROOT, 'AGENTS.md');
|
|
18
|
+
const GEMINI_MD_PATH = path.join(ROOT, 'GEMINI.md');
|
|
19
|
+
|
|
20
|
+
const RULE_SECTION_HEADER = '## 🛡️ Self-Harness Prevention Rules (Auto-Generated)';
|
|
21
|
+
|
|
22
|
+
function readGates() {
|
|
23
|
+
if (!fs.existsSync(GATES_PATH)) return [];
|
|
24
|
+
try {
|
|
25
|
+
const data = JSON.parse(fs.readFileSync(GATES_PATH, 'utf-8'));
|
|
26
|
+
return Array.isArray(data.gates) ? data.gates : [];
|
|
27
|
+
} catch (err) {
|
|
28
|
+
console.error('Failed to parse auto-promoted-gates.json:', err);
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function generateRuleSection(gates) {
|
|
34
|
+
if (gates.length === 0) {
|
|
35
|
+
return `${RULE_SECTION_HEADER}\n\n- No active auto-generated prevention rules at this time.\n`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const lines = [
|
|
39
|
+
RULE_SECTION_HEADER,
|
|
40
|
+
'',
|
|
41
|
+
'> [!IMPORTANT]',
|
|
42
|
+
'> The following rules were automatically derived from execution failures and thumbs-down feedback.',
|
|
43
|
+
'> You MUST follow these constraints strictly to prevent repeated errors.',
|
|
44
|
+
''
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
gates.forEach(gate => {
|
|
48
|
+
// Extract rule message or pattern
|
|
49
|
+
const ruleText = gate.message ? gate.message.replace('Automatically blocked due to repeated failures: ', '') : `NEVER match pattern: ${gate.pattern}`;
|
|
50
|
+
lines.push(`- **Rule [${gate.id}]**: ${ruleText}`);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
lines.push('');
|
|
54
|
+
return lines.join('\n');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function updatePromptFile(filePath, newSection) {
|
|
58
|
+
if (!fs.existsSync(filePath)) {
|
|
59
|
+
console.warn(`Prompt file not found: ${filePath}`);
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
64
|
+
const backup = content;
|
|
65
|
+
|
|
66
|
+
let newContent;
|
|
67
|
+
const index = content.indexOf(RULE_SECTION_HEADER);
|
|
68
|
+
if (index !== -1) {
|
|
69
|
+
// Replace existing section till the end or next major section
|
|
70
|
+
const before = content.substring(0, index);
|
|
71
|
+
const remainder = content.substring(index);
|
|
72
|
+
|
|
73
|
+
// Find next header (e.g. '## ')
|
|
74
|
+
const nextHeaderIndex = remainder.slice(RULE_SECTION_HEADER.length).search(/\n## /);
|
|
75
|
+
if (nextHeaderIndex !== -1) {
|
|
76
|
+
const after = remainder.substring(RULE_SECTION_HEADER.length + nextHeaderIndex + 1);
|
|
77
|
+
newContent = before + newSection + after;
|
|
78
|
+
} else {
|
|
79
|
+
newContent = before + newSection;
|
|
80
|
+
}
|
|
81
|
+
} else {
|
|
82
|
+
// Append to the end of the file
|
|
83
|
+
newContent = content.trim() + '\n\n' + newSection;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
fs.writeFileSync(filePath, newContent, 'utf-8');
|
|
87
|
+
return backup;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function validateAndRollback(backups) {
|
|
91
|
+
console.log('Running quick validation suite...');
|
|
92
|
+
try {
|
|
93
|
+
execSync('npm run verify:quick', { cwd: ROOT, stdio: 'inherit' });
|
|
94
|
+
console.log('✅ Validation succeeded! No regressions detected.');
|
|
95
|
+
|
|
96
|
+
// Auto-commit prompt updates to git if validation succeeds
|
|
97
|
+
try {
|
|
98
|
+
execSync('git add AGENTS.md GEMINI.md', { cwd: ROOT, stdio: 'ignore' });
|
|
99
|
+
execSync('git commit -m "chore(prompt): auto-update self-harness prevention rules [auto-commit]"', { cwd: ROOT, stdio: 'ignore' });
|
|
100
|
+
console.log('✅ Prompt updates auto-committed to git.');
|
|
101
|
+
} catch (gitErr) {
|
|
102
|
+
console.warn('⚠️ Git commit failed or no changes to commit:', gitErr.message);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return true;
|
|
106
|
+
} catch (err) {
|
|
107
|
+
console.error('❌ Validation failed! Reverting prompt changes.');
|
|
108
|
+
for (const [filePath, backupContent] of Object.entries(backups)) {
|
|
109
|
+
if (backupContent) {
|
|
110
|
+
fs.writeFileSync(filePath, backupContent, 'utf-8');
|
|
111
|
+
console.log(`Reverted: ${path.basename(filePath)}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function main() {
|
|
119
|
+
console.log('Mining weaknesses from auto-promoted gates...');
|
|
120
|
+
const gates = readGates();
|
|
121
|
+
console.log(`Found ${gates.length} active gates.`);
|
|
122
|
+
|
|
123
|
+
const newSection = generateRuleSection(gates);
|
|
124
|
+
const backups = {};
|
|
125
|
+
|
|
126
|
+
console.log('Updating AGENTS.md...');
|
|
127
|
+
backups[AGENTS_MD_PATH] = updatePromptFile(AGENTS_MD_PATH, newSection);
|
|
128
|
+
|
|
129
|
+
console.log('Updating GEMINI.md...');
|
|
130
|
+
backups[GEMINI_MD_PATH] = updatePromptFile(GEMINI_MD_PATH, newSection);
|
|
131
|
+
|
|
132
|
+
const success = validateAndRollback(backups);
|
|
133
|
+
if (!success) {
|
|
134
|
+
process.exit(1);
|
|
135
|
+
}
|
|
136
|
+
console.log('Self-Harness optimization complete.');
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (require.main === module) {
|
|
140
|
+
main();
|
|
141
|
+
}
|