thumbgate 1.37.3 → 1.39.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.
Files changed (134) hide show
  1. package/.agents/skills/aws-strands-harness-not-clone/SKILL.md +53 -0
  2. package/.agents/skills/bolt-forge-opt-in-not-clone/SKILL.md +72 -0
  3. package/.agents/skills/decisive-step-evaluator/SKILL.md +47 -0
  4. package/.agents/skills/fiddler-control-plane-honesty/SKILL.md +61 -0
  5. package/.agents/skills/halo-trace-optimize-not-clone/SKILL.md +60 -0
  6. package/.agents/skills/harness-evolution-ceiling/SKILL.md +52 -0
  7. package/.agents/skills/infoq-architect-honesty-not-clone/SKILL.md +37 -0
  8. package/.agents/skills/meko-datapack-honesty-not-clone/SKILL.md +45 -0
  9. package/.agents/skills/mintlify-knowledge-honesty-not-clone/SKILL.md +49 -0
  10. package/.agents/skills/model-distress-governance/SKILL.md +56 -0
  11. package/.agents/skills/omp-coordination-honesty-not-clone/SKILL.md +94 -0
  12. package/.agents/skills/saas-moat-honesty-not-clone/SKILL.md +22 -0
  13. package/.agents/skills/salt-code-policy-honesty-not-clone/SKILL.md +76 -0
  14. package/.agents/skills/siren-mcp-governance/SKILL.md +50 -0
  15. package/.agents/skills/vs-coverage-gap-not-clone/SKILL.md +69 -0
  16. package/.agents/skills/wisdom-context-artifact-not-clone/SKILL.md +67 -0
  17. package/.claude-plugin/plugin.json +1 -1
  18. package/.well-known/mcp/server-card.json +1 -1
  19. package/adapters/claude/.mcp.json +2 -2
  20. package/adapters/forge/forge.yaml +3 -3
  21. package/adapters/future-agi/.mcp.json +1 -1
  22. package/adapters/future-agi/config.toml +1 -1
  23. package/adapters/future-agi/opencode.json +1 -1
  24. package/adapters/herdr/herdr-plugin.toml +2 -2
  25. package/adapters/hotdata/hotdata-vector-store.js +575 -0
  26. package/adapters/mcp/server-stdio.js +1 -1
  27. package/adapters/opencode/opencode.json +1 -1
  28. package/adapters/strands/STRANDS.md +107 -0
  29. package/adapters/strands/strands-box-diode.js +344 -0
  30. package/adapters/strands/strands-decider-adapter.js +445 -0
  31. package/adapters/strands/strands-middleware.js +192 -0
  32. package/adapters/tailscale/.mcp.json +15 -0
  33. package/adapters/tailscale/TAILSCALE.md +117 -0
  34. package/adapters/tailscale/config.toml +16 -0
  35. package/bin/cli.js +602 -21
  36. package/config/gate-templates.json +109 -0
  37. package/config/gates/default.json +13 -0
  38. package/config/schemas/task-outcome-receipt.schema.json +12 -0
  39. package/package.json +150 -21
  40. package/public/blog/2026-09-28-pretool-secret-deny.html +83 -0
  41. package/public/blog/2026-10-01-aws-strands-harness-token-firewall.html +77 -0
  42. package/public/blog/2026-10-01-model-distress-relief-seeking-firewall.html +71 -0
  43. package/public/blog/2026-10-02-salt-code-honest-steal-40-guardrails.html +106 -0
  44. package/public/blog/2026-10-05-why-3-days-of-triage-wont-save-ai-speed-code.html +119 -0
  45. package/public/blog/2026-10-09-your-code-got-a-third-author-governance.html +141 -0
  46. package/public/connectors.html +329 -0
  47. package/public/enterprise-governance.html +311 -0
  48. package/public/gaming-playbook.html +732 -0
  49. package/public/index.html +77 -51
  50. package/public/install.html +7 -7
  51. package/public/learn.html +14 -0
  52. package/public/numbers.html +2 -2
  53. package/public/onboarding.html +794 -0
  54. package/public/operator-framework.html +385 -0
  55. package/public/pricing.html +14 -10
  56. package/scripts/activesaddler-curriculum-doctor.js +357 -0
  57. package/scripts/agent-context-artifact.js +325 -0
  58. package/scripts/agent-egress-policy.js +2 -2
  59. package/scripts/agent-operations-planner.js +1 -1
  60. package/scripts/agent-outcome-eval.js +1 -1
  61. package/scripts/agent-reliability-client.js +148 -0
  62. package/scripts/apple-minions-idle-compute-steal.js +428 -0
  63. package/scripts/autoresearch-runner.js +20 -1
  64. package/scripts/billing.js +0 -1
  65. package/scripts/cli-demo.js +505 -1
  66. package/scripts/cli-schema.js +36 -0
  67. package/scripts/colab-compute-honesty.js +93 -0
  68. package/scripts/corporate-email-isolation-diode.js +299 -0
  69. package/scripts/coverage-gap.js +396 -0
  70. package/scripts/dashboard-chat.js +3 -3
  71. package/scripts/dashboard.js +2 -2
  72. package/scripts/decisive-step-doctor.js +256 -0
  73. package/scripts/decisive-step-evaluator.js +390 -0
  74. package/scripts/entitlement.js +18 -7
  75. package/scripts/experiment-tracker.js +5 -3
  76. package/scripts/feedback-loop.js +26 -3
  77. package/scripts/fiddler-control-plane-honesty.js +303 -0
  78. package/scripts/financial-control-plane.js +10 -2
  79. package/scripts/gates-engine.js +3 -1
  80. package/scripts/github-license-compliance-diode.js +378 -0
  81. package/scripts/halo-trace-optimizer.js +631 -0
  82. package/scripts/harness-ceiling-doctor.js +326 -0
  83. package/scripts/hf-papers.js +1 -1
  84. package/scripts/human-escalation.js +7 -1
  85. package/scripts/hybrid-feedback-context.js +53 -7
  86. package/scripts/infoq-architect-honesty.js +362 -0
  87. package/scripts/lesson-graph.js +785 -0
  88. package/scripts/lesson-inference.js +1 -1
  89. package/scripts/lesson-retrieval.js +26 -18
  90. package/scripts/license.js +122 -21
  91. package/scripts/llm-behavior-monitor.js +1 -1
  92. package/scripts/llm-obs-honesty.js +52 -0
  93. package/scripts/local-model-profile.js +11 -7
  94. package/scripts/mailer/resend-mailer.js +6 -3
  95. package/scripts/mcp-transport-strategy.js +1 -1
  96. package/scripts/meko-datapack-honesty.js +414 -0
  97. package/scripts/migrate-lesson-graph.js +442 -0
  98. package/scripts/mintlify-knowledge-honesty.js +647 -0
  99. package/scripts/model-distress-detector.js +207 -0
  100. package/scripts/model-distress-doctor.js +368 -0
  101. package/scripts/multi-harness-invariants.js +305 -0
  102. package/scripts/omp-coordination-honesty.js +488 -0
  103. package/scripts/pro-local-dashboard.js +20 -3
  104. package/scripts/prompt-eval.js +1 -1
  105. package/scripts/prove-herdr-adapter.js +367 -3
  106. package/scripts/rag-embedding-identity.js +1 -1
  107. package/scripts/rrsi-regularizer.js +531 -0
  108. package/scripts/saas-moat-honesty.js +443 -0
  109. package/scripts/salt-code-policy-honesty.js +1204 -0
  110. package/scripts/secret-redaction.js +58 -0
  111. package/scripts/session-export-gate.js +368 -0
  112. package/scripts/siren-mcp-governance.js +539 -0
  113. package/scripts/strands-box-doctor.js +130 -0
  114. package/scripts/strands-harness-doctor.js +390 -0
  115. package/scripts/stripe-revenue-catalog-audit.js +12 -0
  116. package/scripts/stripe-revenue-catalog.js +40 -0
  117. package/scripts/switchyard-router.js +153 -0
  118. package/scripts/tailscale-p2p-doctor.js +252 -0
  119. package/scripts/task-outcomes.js +148 -3
  120. package/scripts/thumbgate-board-loop.js +4 -2
  121. package/scripts/thumbgate-daily-discoveries-publish.js +86 -38
  122. package/scripts/triage-savings-calculator.js +181 -0
  123. package/scripts/vector-store.js +41 -2
  124. package/scripts/vulnerability-pre-action-diode.js +319 -0
  125. package/scripts/windbg-evidence-diagnostics.js +241 -0
  126. package/scripts/workflow-intake-queue.js +1 -1
  127. package/scripts/workspace-agent-routines.js +534 -6
  128. package/scripts/workspace-evolver.js +143 -13
  129. package/server.json +2 -2
  130. package/skills/aws-strands-harness-not-clone/SKILL.md +53 -0
  131. package/skills/siren-mcp-governance/SKILL.md +50 -0
  132. package/src/api/server.js +191 -5
  133. package/src/mcp-writeguard.js +1 -1
  134. package/src/session-interactivity.js +284 -0
@@ -0,0 +1,390 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ /**
5
+ * scripts/strands-harness-doctor.js
6
+ *
7
+ * Audit and enforce AWS Strands Harness Architecture (The New Stack 2026-10 FORMAT Steal).
8
+ *
9
+ * Core Principles:
10
+ * 1. "The way a harness manages the surrounding agent machinery materially affects cost and performance."
11
+ * (Token efficiency via output shunting, context compaction threshold, in-loop recovery).
12
+ * 2. "AWS Strands Harness came out 45% cheaper than Claude Code and Codex, and 77% cheaper on Terminal-Bench 2.1."
13
+ * (Tool output bounded <= 350 lines / 16KB, avoiding unpruned firehose context pollution).
14
+ * 3. "No features require Bedrock; all deployment paths are open."
15
+ * (Provider-agnostic decoupling: Bedrock, Anthropic, OpenAI, Gemini, local Ollama).
16
+ * 4. "Harness execution without pre-action governance is cheap, high-speed disaster."
17
+ * (Every tool call must pass through ThumbGate's PreToolUse diode before execution).
18
+ *
19
+ * Usage:
20
+ * node scripts/strands-harness-doctor.js
21
+ * node scripts/strands-harness-doctor.js --json
22
+ * node scripts/strands-harness-doctor.js --map-only
23
+ * node scripts/strands-harness-doctor.js --check
24
+ */
25
+
26
+ const fs = require('node:fs');
27
+ const path = require('node:path');
28
+
29
+ const STRANDS_DEFAULTS = Object.freeze({
30
+ maxOutputLines: 350,
31
+ maxOutputBytes: 16 * 1024, // 16 KB
32
+ compactionThresholdPct: 0.75, // Trigger compaction at 75% context window utilization
33
+ terminalBenchSavingsBenchmarkPct: 0.77, // 77% cheaper on Terminal-Bench 2.1 ($56.29 vs $248.05)
34
+ overallCostSavingsBenchmarkPct: 0.45, // 45% cheaper across ALFWorld, GAIA, WebShop, etc.
35
+ });
36
+
37
+ /**
38
+ * Shunt / truncate oversized tool output to prevent context window pollution.
39
+ */
40
+ function evaluateOutputShunt(output, options = {}) {
41
+ const maxLines = options.maxLines || options.maxOutputLines || STRANDS_DEFAULTS.maxOutputLines;
42
+ const maxBytes = options.maxBytes || options.maxOutputBytes || STRANDS_DEFAULTS.maxOutputBytes;
43
+
44
+ if (typeof output !== 'string') {
45
+ output = String(output || '');
46
+ }
47
+
48
+ const byteLength = Buffer.byteLength(output, 'utf8');
49
+ const lines = output.split('\n');
50
+ const lineCount = lines.length;
51
+
52
+ const requiresShunt = lineCount > maxLines || byteLength > maxBytes;
53
+
54
+ if (!requiresShunt) {
55
+ return {
56
+ shunted: false,
57
+ originalLineCount: lineCount,
58
+ originalBytes: byteLength,
59
+ shuntedContent: output,
60
+ reductionPct: 0,
61
+ };
62
+ }
63
+
64
+ const keepLines = Math.floor(maxLines / 2);
65
+ let head = lines.slice(0, keepLines).join('\n');
66
+ let tail = lines.slice(-keepLines).join('\n');
67
+ const omittedCount = Math.max(0, lineCount - (keepLines * 2));
68
+
69
+ const marker = `\n... [ThumbGate Token-Shunt: ${omittedCount} lines (${Math.max(0, byteLength - maxBytes)} bytes) omitted. Target with grep or offset/limit] ...\n`;
70
+ let shuntedContent = `${head}${marker}${tail}`;
71
+ let shuntedBytes = Buffer.byteLength(shuntedContent, 'utf8');
72
+
73
+ // Enforce byte limit strictly: if head + marker + tail exceeds maxBytes (e.g. single-line or wide lines)
74
+ if (shuntedBytes > maxBytes) {
75
+ const markerBytes = Buffer.byteLength(marker, 'utf8');
76
+ const budgetForText = Math.max(0, maxBytes - markerBytes);
77
+ const halfChars = Math.floor(budgetForText / 2);
78
+
79
+ let headStr = output.slice(0, halfChars);
80
+ let tailStr = output.slice(-halfChars);
81
+ while (Buffer.byteLength(`${headStr}${marker}${tailStr}`, 'utf8') > maxBytes && (headStr.length > 0 || tailStr.length > 0)) {
82
+ if (headStr.length > 0) headStr = headStr.slice(0, -10);
83
+ if (tailStr.length > 0) tailStr = tailStr.slice(10);
84
+ }
85
+ shuntedContent = `${headStr}${marker}${tailStr}`;
86
+ shuntedBytes = Buffer.byteLength(shuntedContent, 'utf8');
87
+ }
88
+
89
+ const reductionPct = Number(((1 - (shuntedBytes / byteLength)) * 100).toFixed(2));
90
+ const finalLines = shuntedContent.split('\n').length;
91
+
92
+ return {
93
+ shunted: true,
94
+ originalLineCount: lineCount,
95
+ originalBytes: byteLength,
96
+ shuntedLineCount: finalLines,
97
+ shuntedBytes,
98
+ reductionPct,
99
+ shuntedContent,
100
+ };
101
+ }
102
+
103
+ /**
104
+ * Audit context compaction threshold and ensure durable rules are pinned.
105
+ */
106
+ function evaluateCompactionThreshold({
107
+ currentTokens = 0,
108
+ maxWindowTokens = 128000,
109
+ thresholdPct = STRANDS_DEFAULTS.compactionThresholdPct,
110
+ pinnedRules = [],
111
+ } = {}) {
112
+ const utilization = maxWindowTokens > 0 ? currentTokens / maxWindowTokens : 0;
113
+ const shouldCompact = utilization >= thresholdPct;
114
+
115
+ return {
116
+ utilization: Number((utilization * 100).toFixed(2)),
117
+ thresholdPct: Number((thresholdPct * 100).toFixed(2)),
118
+ shouldCompact,
119
+ pinnedRulesPreserved: Array.isArray(pinnedRules) && pinnedRules.length > 0,
120
+ pinnedRuleCount: Array.isArray(pinnedRules) ? pinnedRules.length : 0,
121
+ status: shouldCompact ? 'compaction_recommended' : 'window_healthy',
122
+ };
123
+ }
124
+
125
+ /**
126
+ * Audit in-loop overflow recovery without crashing the session.
127
+ */
128
+ function simulateOverflowRecovery({
129
+ turns = [],
130
+ maxTokens = 8000,
131
+ pinnedSystemPrompt = 'You are a governed agent operating under ThumbGate firewalls.',
132
+ } = {}) {
133
+ const totalTokens = turns.reduce((acc, t) => acc + (t.tokens || 100), 0);
134
+ const overflow = totalTokens > maxTokens;
135
+
136
+ if (!overflow) {
137
+ return {
138
+ recovered: false,
139
+ action: 'none',
140
+ survivingTurns: turns.length,
141
+ estimatedTokens: totalTokens,
142
+ };
143
+ }
144
+
145
+ // Gracefully retain system prompt, last turn, and lessons
146
+ const surviving = turns.filter((t) => t.isPinned || t.isLastTurn);
147
+ const prunedCount = turns.length - surviving.length;
148
+
149
+ return {
150
+ recovered: true,
151
+ action: 'pruned_history_in_loop',
152
+ prunedTurns: prunedCount,
153
+ survivingTurns: surviving.length,
154
+ systemPromptPreserved: Boolean(pinnedSystemPrompt),
155
+ status: 'recovered_without_throw',
156
+ };
157
+ }
158
+
159
+ /**
160
+ * Verify that the harness does not hard-code Bedrock or proprietary lock-in.
161
+ */
162
+ function auditProviderDecoupling(config = {}) {
163
+ const supportedProviders = ['bedrock', 'anthropic', 'openai', 'gemini', 'ollama'];
164
+ const provider = (config.provider || 'bedrock').toLowerCase();
165
+ const isDecoupled = supportedProviders.includes(provider);
166
+
167
+ return {
168
+ configuredProvider: provider,
169
+ supportedProviders,
170
+ isDecoupled,
171
+ supportsLocalFallback: supportedProviders.includes('ollama'),
172
+ requiresProprietaryLockIn: false,
173
+ };
174
+ }
175
+
176
+ /**
177
+ * Audit pre-action safety diode: every mutating tool must be governed.
178
+ */
179
+ function evaluatePreActionDiode(toolCall = {}) {
180
+ const name = toolCall.name || '';
181
+ const input = toolCall.input || {};
182
+ const cmd = input.command || input.cmd || '';
183
+
184
+ const dangerousPatterns = [
185
+ /rm\s+(-rf|-fr|--recursive)/i,
186
+ /git\s+push.*(--force|-f)/i,
187
+ /chmod\s+777/i,
188
+ /deploy-to-qa\.py/i,
189
+ /api[_-]?key\s*=\s*['"][a-z0-9_-]{20,}['"]/i,
190
+ ];
191
+
192
+ let blocked = false;
193
+ let violation = null;
194
+
195
+ for (const pattern of dangerousPatterns) {
196
+ if (pattern.test(cmd) || pattern.test(JSON.stringify(input))) {
197
+ blocked = true;
198
+ violation = `Matched dangerous pattern: ${pattern.toString()}`;
199
+ break;
200
+ }
201
+ }
202
+
203
+ return {
204
+ toolName: name,
205
+ enforced: true,
206
+ decision: blocked ? 'BLOCK' : 'ALLOW',
207
+ violation,
208
+ diodeStatus: blocked ? 'INTERDICTED' : 'CLEAN',
209
+ };
210
+ }
211
+
212
+ /**
213
+ * Run full doctor audit on AWS Strands Harness configuration and runtime state.
214
+ */
215
+ function runDoctor(options = {}) {
216
+ const rootDir = options.rootDir || process.cwd();
217
+ const configPath = path.join(rootDir, 'adapters', 'strands', 'config.json');
218
+
219
+ let adapterConfig = {
220
+ provider: 'bedrock',
221
+ tokenShunt: { maxOutputLines: 350, maxOutputBytes: 16384 },
222
+ compaction: { thresholdPct: 0.75 },
223
+ preActionDiode: { enabled: true },
224
+ };
225
+
226
+ if (fs.existsSync(configPath)) {
227
+ try {
228
+ adapterConfig = JSON.parse(fs.readFileSync(configPath, 'utf8'));
229
+ } catch {
230
+ // fallback to defaults
231
+ }
232
+ }
233
+
234
+ // 1. Shunt audit
235
+ const sampleLargeOutput = Array.from({ length: 600 }, (_, i) => `log line ${i + 1}: agent test output`).join('\n');
236
+ const shuntResult = evaluateOutputShunt(sampleLargeOutput, adapterConfig.tokenShunt);
237
+
238
+ // 2. Compaction audit
239
+ const compactionResult = evaluateCompactionThreshold({
240
+ currentTokens: 100000,
241
+ maxWindowTokens: 128000,
242
+ thresholdPct: adapterConfig.compaction?.thresholdPct || 0.75,
243
+ pinnedRules: ['Never force-push main', 'Verify evidence before done'],
244
+ });
245
+
246
+ // 3. Overflow recovery audit
247
+ const sampleTurns = Array.from({ length: 25 }, (_, i) => ({
248
+ turn: i,
249
+ tokens: 400,
250
+ isPinned: i === 0,
251
+ isLastTurn: i === 24,
252
+ }));
253
+ const recoveryResult = simulateOverflowRecovery({
254
+ turns: sampleTurns,
255
+ maxTokens: 8000,
256
+ });
257
+
258
+ // 4. Provider decoupling audit
259
+ const providerResult = auditProviderDecoupling(adapterConfig);
260
+
261
+ // 5. Pre-action diode audit
262
+ const safeToolCall = { name: 'shell_execute', input: { command: 'git status' } };
263
+ const dangerousToolCall = { name: 'shell_execute', input: { command: 'rm -rf /tmp/test' } };
264
+ const safeDiode = evaluatePreActionDiode(safeToolCall);
265
+ const dangerousDiode = evaluatePreActionDiode(dangerousToolCall);
266
+
267
+ const checks = [
268
+ {
269
+ name: 'output_shunting',
270
+ pass: shuntResult.shunted && shuntResult.reductionPct > 30,
271
+ detail: `Shunted ${shuntResult.originalLineCount} -> ${shuntResult.shuntedLineCount} lines (${shuntResult.reductionPct}% token reduction)`,
272
+ },
273
+ {
274
+ name: 'compaction_threshold_preservation',
275
+ pass: compactionResult.shouldCompact && compactionResult.pinnedRulesPreserved,
276
+ detail: `Compaction triggered at ${compactionResult.utilization}% utilization with ${compactionResult.pinnedRuleCount} pinned rules preserved`,
277
+ },
278
+ {
279
+ name: 'in_loop_overflow_recovery',
280
+ pass: recoveryResult.recovered && recoveryResult.systemPromptPreserved,
281
+ detail: `Recovered without throw: pruned ${recoveryResult.prunedTurns} turns, kept ${recoveryResult.survivingTurns} vital turns`,
282
+ },
283
+ {
284
+ name: 'provider_decoupling',
285
+ pass: providerResult.isDecoupled && providerResult.supportsLocalFallback,
286
+ detail: `Provider '${providerResult.configuredProvider}' decoupled; local Ollama/ThumbGate fallback supported`,
287
+ },
288
+ {
289
+ name: 'pre_action_safety_diode',
290
+ pass: safeDiode.decision === 'ALLOW' && dangerousDiode.decision === 'BLOCK',
291
+ detail: 'ThumbGate PreToolUse diode successfully blocked dangerous mutating tool call while allowing safe query',
292
+ },
293
+ ];
294
+
295
+ const overallPass = checks.every((c) => c.pass);
296
+
297
+ return {
298
+ name: 'strands-harness-doctor',
299
+ version: '1.0.0',
300
+ timestamp: new Date().toISOString(),
301
+ status: overallPass ? 'healthy' : 'unhealthy',
302
+ benchmarks: {
303
+ terminalBench2_1CostSavingsClaim: '77% cheaper ($56.29 vs $248.05 on Fable 5 across 89 trials)',
304
+ sixBenchmarkAverageSavingsClaim: '45% cheaper than Claude Code and Codex',
305
+ architectureMechanism: 'Harness-level output shunting + context compaction + in-loop recovery',
306
+ },
307
+ checks,
308
+ };
309
+ }
310
+
311
+ function printTextReport(report) {
312
+ console.log(`\n=== AWS Strands Harness Doctor (ThumbGate Diode) ===`);
313
+ console.log(`Status: ${report.status.toUpperCase()} | Timestamp: ${report.timestamp}`);
314
+ console.log(`\nBenchmark Reference:`);
315
+ console.log(` • Terminal-Bench 2.1: ${report.benchmarks.terminalBench2_1CostSavingsClaim}`);
316
+ console.log(` • Multi-Benchmark Avg: ${report.benchmarks.sixBenchmarkAverageSavingsClaim}`);
317
+ console.log(` • Core Mechanism: ${report.benchmarks.architectureMechanism}`);
318
+ console.log(`\nArchitectural Checks:`);
319
+ for (const c of report.checks) {
320
+ const icon = c.pass ? '✅' : '❌';
321
+ console.log(` ${icon} ${c.name}: ${c.detail}`);
322
+ }
323
+ console.log('');
324
+ }
325
+
326
+ function main() {
327
+ const argSet = new Set(process.argv.slice(2));
328
+ const jsonMode = argSet.has('--json');
329
+ const mapOnly = argSet.has('--map-only');
330
+ const checkMode = argSet.has('--check');
331
+
332
+ if (mapOnly) {
333
+ const map = {
334
+ source: 'AWS Strands Harness (The New Stack 2026-10 / Marc Brooker)',
335
+ architecturePillars: [
336
+ 'Harness-Level Output Shunting (<= 350 lines / 16KB)',
337
+ 'Context Compaction Threshold Honesty (>= 75% window with pinned lesson preservation)',
338
+ 'In-Loop Overflow Recovery (recovers without unhandled throw or task failure)',
339
+ 'Multi-Model Decoupling (Bedrock, Anthropic, OpenAI, Gemini, Ollama local)',
340
+ 'Pre-Action Governance Diode (ThumbGate PreToolUse prevents catastrophic tool mutations)',
341
+ ],
342
+ rulesetMap: {
343
+ 'gate-strands-harness-output-compaction': 'Enforces 16KB/350 line ceiling on tool returns',
344
+ 'gate-strands-pre-action-tool-diode': 'Evaluates PreToolUse safety on shell/file/agent mutations',
345
+ 'gate-strands-bedrock-lockin-guard': 'Ensures no feature hardcodes Bedrock-only lock-in',
346
+ },
347
+ };
348
+ if (jsonMode) {
349
+ console.log(JSON.stringify(map, null, 2));
350
+ } else {
351
+ console.log('=== AWS Strands Harness Architecture Map ===');
352
+ console.log(`Source: ${map.source}\n`);
353
+ console.log('Architecture Pillars:');
354
+ for (const p of map.architecturePillars) {
355
+ console.log(` - ${p}`);
356
+ }
357
+ console.log('\nRuleset Map:');
358
+ for (const [k, v] of Object.entries(map.rulesetMap)) {
359
+ console.log(` - ${k}: ${v}`);
360
+ }
361
+ }
362
+ process.exit(0);
363
+ }
364
+
365
+ const report = runDoctor();
366
+
367
+ if (jsonMode) {
368
+ console.log(JSON.stringify(report, null, 2));
369
+ } else {
370
+ printTextReport(report);
371
+ }
372
+
373
+ if (checkMode && report.status !== 'healthy') {
374
+ process.exit(1);
375
+ }
376
+ }
377
+
378
+ module.exports = {
379
+ STRANDS_DEFAULTS,
380
+ evaluateOutputShunt,
381
+ evaluateCompactionThreshold,
382
+ simulateOverflowRecovery,
383
+ auditProviderDecoupling,
384
+ evaluatePreActionDiode,
385
+ runDoctor,
386
+ };
387
+
388
+ if (require.main === module) {
389
+ main();
390
+ }
@@ -31,6 +31,18 @@ const DEFAULT_STRIPE_PUBLIC_PAYMENT_RAILS = Object.freeze([
31
31
  priceId: 'price_1TsO6kGGBpd520QYbbEgThb3',
32
32
  expectedActive: true,
33
33
  }),
34
+ // Operator Framework rails served via /go/operator-* (verified 2026-10-16).
35
+ ...[
36
+ ['operator_sprint_diagnostic', 'plink_1TbM1cGGBpd520QYxCgHVqkz', 'fZueVd9eA4r42dz7mb3sI2W', 'price_1TX5mTGGBpd520QY1MjCH2BZ'],
37
+ ['operator_turnkey_setup', 'plink_1UQwBSGGBpd520QYgHMnwv3D', '14A8wP62o0aOcSd35V3sJ0Q', 'price_1UQw8pGGBpd520QYGr85jyhK'],
38
+ ['operator_managed_retainer', 'plink_1UQwBSGGBpd520QYux4veyz3', '9B614n0I43n03hD35V3sJ0P', 'price_1UQw8pGGBpd520QYNUbngVy6'],
39
+ ].map(([offerId, paymentLinkId, slug, priceId]) => Object.freeze({
40
+ offerId,
41
+ paymentLinkId,
42
+ url: `https://buy.stripe.com/${slug}`,
43
+ priceId,
44
+ expectedActive: true,
45
+ })),
34
46
  ]);
35
47
 
36
48
  function parseArgs(argv = []) {
@@ -44,6 +44,46 @@ const DEFAULT_STRIPE_REVENUE_CATALOG = Object.freeze([
44
44
  expectedPriceActive: true,
45
45
  expectedProductActive: true,
46
46
  }),
47
+ // Operator Framework $499 Sprint Diagnostic Payment Link (separate price on
48
+ // the "ThumbGate — Sprint Diagnostic" product), verified in Stripe 2026-10-16.
49
+ Object.freeze({
50
+ offerId: 'operator_sprint_diagnostic',
51
+ priceId: 'price_1TX5mTGGBpd520QY1MjCH2BZ',
52
+ productId: 'prod_UW82mY4J9yND1i',
53
+ unitAmountCents: 49900,
54
+ currency: 'usd',
55
+ cadence: 'one_time',
56
+ intervalCount: null,
57
+ status: 'current',
58
+ expectedPriceActive: true,
59
+ expectedProductActive: true,
60
+ }),
61
+ // Operator Framework service rails (/operator-framework), verified in Stripe
62
+ // 2026-10-15: Turnkey Setup $2,500 once and Managed Retainer $500/mo.
63
+ Object.freeze({
64
+ offerId: 'operator_turnkey_setup',
65
+ priceId: 'price_1UQw8pGGBpd520QYGr85jyhK',
66
+ productId: 'prod_VRpoNq4gtjHSqq',
67
+ unitAmountCents: 250000,
68
+ currency: 'usd',
69
+ cadence: 'one_time',
70
+ intervalCount: null,
71
+ status: 'current',
72
+ expectedPriceActive: true,
73
+ expectedProductActive: true,
74
+ }),
75
+ Object.freeze({
76
+ offerId: 'operator_managed_retainer',
77
+ priceId: 'price_1UQw8pGGBpd520QYNUbngVy6',
78
+ productId: 'prod_VRpolIw7nbbOZO',
79
+ unitAmountCents: 50000,
80
+ currency: 'usd',
81
+ cadence: 'month',
82
+ intervalCount: 1,
83
+ status: 'current',
84
+ expectedPriceActive: true,
85
+ expectedProductActive: true,
86
+ }),
47
87
  Object.freeze({
48
88
  offerId: 'team_monthly_legacy',
49
89
  priceId: 'price_1TMIagGGBpd520QY1fUOawZt',
@@ -352,6 +352,152 @@ function describeNemotronLightning() {
352
352
  companion: 'NeMo Switchyard (multi-model step routing + evaluation)',
353
353
  };
354
354
  }
355
+ const DEVIN_FUSION_SOURCE_URL = 'https://cognition.com/blog/devin-fusion';
356
+ const DEVIN_FUSION_GATE_ID = 'devin-fusion-sidekick-compaction-switch';
357
+
358
+ const DEVIN_FUSION_RAIL_MAP = Object.freeze([
359
+ {
360
+ devinFusionConcept: 'Parallel Frontier Main + Sidekick agents with independent persistent cached contexts (avoids Smart Friend / Advisor tool cache misses; 60% lower cost at 63.1 FrontierCode)',
361
+ thumbgateRail: 'evaluateDualCacheAndCompactionSwitch (parallel_dual_cache with 300s cache-TTL guard; rejects uncached advisor-tool cross-calls)',
362
+ },
363
+ {
364
+ devinFusionConcept: 'Main agent takes minimal actions (plan, ambiguity, final review) and delegates slow Playwright/e2e test runs (-62% cost), mechanical deprecations (-32%), and upstream reuse (-25%)',
365
+ thumbgateRail: 'evaluateDevinFusionSidekickSplit (delegates mechanical/test-suite work to Sidekick; blocks delegation when judgmentIsDeliverable=true)',
366
+ },
367
+ {
368
+ devinFusionConcept: 'Dynamic mid-session model switching coupled to context compaction boundaries ("model switching for free" with zero extra cache-miss penalty)',
369
+ thumbgateRail: 'evaluateDualCacheAndCompactionSwitch (switchTriggeredAtCompaction=true -> extraCacheMissPenalty=0)',
370
+ },
371
+ ]);
372
+
373
+ /**
374
+ * Decide whether a sub-task belongs on the Frontier Main Agent or the Sidekick Agent.
375
+ * Delegating when judgment IS the deliverable backfires (e.g. 54 -> 27 on FrontierCode);
376
+ * delegating slow test suites (-62%), mechanical deprecations (-32%), or upstream reuse (-25%)
377
+ * saves cost at equal or higher quality.
378
+ */
379
+ function evaluateDevinFusionSidekickSplit({
380
+ taskType = 'implementation',
381
+ judgmentIsDeliverable = false,
382
+ ambiguityScore = 0.2,
383
+ slowVerificationSuite = false,
384
+ mechanicalMultiFile = false,
385
+ reuseUpstreamPattern = false,
386
+ } = {}) {
387
+ const highAmbiguity = Number(ambiguityScore) >= 0.6;
388
+ if (judgmentIsDeliverable || highAmbiguity) {
389
+ return {
390
+ assignedTo: 'frontier_main',
391
+ delegationAllowed: false,
392
+ reason: 'judgment_or_ambiguity_is_the_deliverable_keep_on_main',
393
+ expectedCostSavingsPercent: 0,
394
+ };
395
+ }
396
+
397
+ if (slowVerificationSuite) {
398
+ return {
399
+ assignedTo: 'sidekick',
400
+ delegationAllowed: true,
401
+ reason: 'slow_test_or_e2e_verification_suite',
402
+ expectedCostSavingsPercent: 62,
403
+ };
404
+ }
405
+ if (mechanicalMultiFile) {
406
+ return {
407
+ assignedTo: 'sidekick',
408
+ delegationAllowed: true,
409
+ reason: 'mechanical_multi_file_deprecation_or_refactor',
410
+ expectedCostSavingsPercent: 32,
411
+ };
412
+ }
413
+ if (reuseUpstreamPattern) {
414
+ return {
415
+ assignedTo: 'sidekick',
416
+ delegationAllowed: true,
417
+ reason: 'mechanical_upstream_pattern_reuse',
418
+ expectedCostSavingsPercent: 25,
419
+ };
420
+ }
421
+
422
+ return {
423
+ assignedTo: String(taskType).toLowerCase() === 'review' || String(taskType).toLowerCase() === 'plan'
424
+ ? 'frontier_main'
425
+ : 'sidekick',
426
+ delegationAllowed: String(taskType).toLowerCase() !== 'review' && String(taskType).toLowerCase() !== 'plan',
427
+ reason: 'standard_main_plans_sidekick_executes',
428
+ expectedCostSavingsPercent: 38,
429
+ };
430
+ }
431
+
432
+ /**
433
+ * Audit dual-cache persistence (5-minute TTL) and compaction-boundary model switching.
434
+ */
435
+ function evaluateDualCacheAndCompactionSwitch({
436
+ pattern = 'parallel_dual_cache',
437
+ idleSeconds = 120,
438
+ cacheTtlSeconds = 300,
439
+ midSessionModelSwitch = false,
440
+ switchTriggeredAtCompaction = true,
441
+ } = {}) {
442
+ const isAdvisorAntiPattern = /smart_friend|advisor_tool/i.test(String(pattern || ''));
443
+ const cacheWarm = !isAdvisorAntiPattern && Number(idleSeconds) <= Number(cacheTtlSeconds);
444
+ const extraCacheMissPenalty = !midSessionModelSwitch
445
+ ? 0
446
+ : (switchTriggeredAtCompaction ? 0 : 1);
447
+
448
+ return {
449
+ pattern,
450
+ cacheWarm,
451
+ cacheExpiredByTtl: Number(idleSeconds) > Number(cacheTtlSeconds),
452
+ isAdvisorAntiPattern,
453
+ midSessionModelSwitch: Boolean(midSessionModelSwitch),
454
+ switchTriggeredAtCompaction: Boolean(switchTriggeredAtCompaction),
455
+ extraCacheMissPenalty,
456
+ freeCompactionSwitch: Boolean(midSessionModelSwitch && switchTriggeredAtCompaction),
457
+ };
458
+ }
459
+
460
+ function buildDevinFusionHonestyReport(options = {}) {
461
+ const findings = [];
462
+ const claim = String(options.claim || '').trim();
463
+ if (/\bdelegate\s+ambiguous\s+judgment\s+to\s+sidekick\b/i.test(claim)) {
464
+ findings.push({
465
+ id: 'delegating-judgment-backfires',
466
+ severity: 'fail',
467
+ gateId: DEVIN_FUSION_GATE_ID,
468
+ message: 'When product/UX judgment is the deliverable, delegating coding to the sidekick loses subtle intent (54 -> 27 on FrontierCode); keep judgment on the frontier main agent.',
469
+ });
470
+ }
471
+ if (/\bswitch\s+models\s+every\s+turn\s+without\s+compaction\b/i.test(claim)) {
472
+ findings.push({
473
+ id: 'uncompacted-switch-cache-miss',
474
+ severity: 'fail',
475
+ gateId: DEVIN_FUSION_GATE_ID,
476
+ message: 'Couple mid-session model switches to context compaction boundaries to avoid extra KV-cache miss penalties.',
477
+ });
478
+ }
479
+
480
+ return {
481
+ ok: findings.length === 0,
482
+ status: findings.length === 0 ? 'ready' : 'fail',
483
+ sourceUrl: DEVIN_FUSION_SOURCE_URL,
484
+ gateId: DEVIN_FUSION_GATE_ID,
485
+ railMap: DEVIN_FUSION_RAIL_MAP,
486
+ findings,
487
+ };
488
+ }
489
+
490
+ function runCli(argv = process.argv.slice(2)) {
491
+ const args = {};
492
+ for (const a of argv) {
493
+ if (!a.startsWith('--')) continue;
494
+ const [k, ...rest] = a.slice(2).split('=');
495
+ args[k] = rest.length ? rest.join('=') : true;
496
+ }
497
+ const report = buildDevinFusionHonestyReport(args);
498
+ process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
499
+ return report.ok ? 0 : 1;
500
+ }
355
501
 
356
502
  module.exports = {
357
503
  DEFAULT_POOL,
@@ -363,4 +509,11 @@ module.exports = {
363
509
  evaluateRoutingAlgorithm,
364
510
  buildAlwaysOnAgentPlan,
365
511
  describeNemotronLightning,
512
+ DEVIN_FUSION_SOURCE_URL,
513
+ DEVIN_FUSION_GATE_ID,
514
+ DEVIN_FUSION_RAIL_MAP,
515
+ evaluateDevinFusionSidekickSplit,
516
+ evaluateDualCacheAndCompactionSwitch,
517
+ buildDevinFusionHonestyReport,
518
+ runCli,
366
519
  };