tribunal-kit 9.2.6 → 9.2.7
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/.agent/ARCHITECTURE.md +2 -2
- package/.agent/history/architecture-intelligence.html +1487 -401
- package/.agent/history/architecture-model.json +9365 -5697
- package/.agent/history/architecture-verification.json +37 -9
- package/.agent/routing_index.json +2069 -3340
- package/.agent/rules/GEMINI.md +1 -1
- package/.agent/scripts/adaptive_execution.js +511 -0
- package/.agent/scripts/architecture_diff.js +303 -260
- package/.agent/scripts/architecture_extractor.js +792 -753
- package/.agent/scripts/architecture_health.js +293 -256
- package/.agent/scripts/architecture_intelligence.js +3100 -0
- package/.agent/scripts/architecture_verifier.js +303 -270
- package/.agent/scripts/architecture_visualizer.js +880 -873
- package/.agent/scripts/blast_radius_engine.js +274 -234
- package/.agent/scripts/capability_evolution.js +453 -0
- package/.agent/scripts/concept_extractor.js +240 -0
- package/.agent/scripts/consideration_engine.js +284 -0
- package/.agent/scripts/coverage_engine.js +102 -0
- package/.agent/scripts/cross_domain_engine.js +1883 -0
- package/.agent/scripts/engineering_memory.js +1313 -0
- package/.agent/scripts/integrity_manifest.js +1 -5
- package/.agent/scripts/judgment_engine.js +790 -0
- package/.agent/scripts/materiality_engine.js +251 -0
- package/.agent/scripts/outcome_engine.js +624 -0
- package/.agent/scripts/outcome_optimization_engine.js +1632 -0
- package/.agent/scripts/simulation_engine.js +1478 -0
- package/.agent/scripts/skill_intelligence.js +1371 -0
- package/.agent/scripts/validation_engine.js +236 -236
- package/.agent/scripts/verification_auditor.js +266 -0
- package/.agent/skill-intelligence/taxonomy/engineering-concepts.json +555 -0
- package/.agent/skill_topic_map.json +301 -341
- package/.agent/skills_inventory.json +4272 -6922
- package/.agent/workflows/arch.md +96 -80
- package/.agent/workflows/skill-intelligence.md +216 -0
- package/CONTRIBUTING.md +2 -2
- package/README.md +24 -24
- package/bin/adapter-install.js +1 -1
- package/package.json +8 -9
- package/plugins/core-plugin.json +1 -1
- package/plugins/gemini/extension.json +1 -1
- package/src/browser/index.js +2 -1
- package/src/browser/launcher.js +41 -1
- package/src/cli.js +3 -1
- package/src/commands/arch.js +261 -172
- package/src/commands/context.js +27 -8
- package/src/commands/learn.js +21 -6
- package/src/commands/memory.js +10 -1
- package/src/commands/native.js +12 -3
- package/src/commands/skill-intelligence.js +1165 -0
- package/src/commands/system1.js +105 -4
- package/src/context/ranker.js +337 -339
- package/src/evolution/engine.js +296 -295
- package/src/synthesis/claim_check_separator.js +294 -271
- package/src/system1/browser_intelligence.js +300 -0
- package/src/system1/constants.js +49 -0
- package/src/system1/decision_engine.js +498 -0
- package/src/system1/evidence_engine.js +602 -0
- package/src/system1/evolution_pipeline.js +581 -0
- package/src/system1/index.d.ts +114 -0
- package/src/system1/index.js +102 -0
- package/src/system1/reviewer_orchestrator.js +477 -0
- package/src/tui/banner.js +1 -1
- package/src/utils/fs.js +27 -0
|
@@ -0,0 +1,1371 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* skill_intelligence.js — Tribunal Kit Skill Intelligence Engine
|
|
4
|
+
* =================================================================
|
|
5
|
+
* Enforces the core operating principle:
|
|
6
|
+
* DISCOVER FIRST.
|
|
7
|
+
* COMPOSE SECOND.
|
|
8
|
+
* CREATE ONLY WHEN NECESSARY.
|
|
9
|
+
* VERIFY ALWAYS.
|
|
10
|
+
*
|
|
11
|
+
* Implements Phase 2:
|
|
12
|
+
* - Concept Discovery (Explicit & Implicit)
|
|
13
|
+
* - Engineering Consideration Matrix (Critical / High / Medium / Low)
|
|
14
|
+
* - Skill Coverage Matrix (FULL / PARTIAL / NONE)
|
|
15
|
+
* - Dependency-Aware Capability Pipeline DAG
|
|
16
|
+
* - 11-Check New Skill Creation Gate
|
|
17
|
+
* - Concept-Aligned Verification Plan
|
|
18
|
+
*
|
|
19
|
+
* Usage:
|
|
20
|
+
* node scripts/skill_intelligence.js --query "Build payment API with idempotency and retry"
|
|
21
|
+
* node scripts/skill_intelligence.js --gate --need "webhook-reconciliation"
|
|
22
|
+
* node scripts/skill_intelligence.js --audit
|
|
23
|
+
* node scripts/skill_intelligence.js --query "..." --json
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
'use strict';
|
|
27
|
+
|
|
28
|
+
const fs = require('fs');
|
|
29
|
+
const path = require('path');
|
|
30
|
+
|
|
31
|
+
// Colors fallback
|
|
32
|
+
const CYAN = '\x1b[36m',
|
|
33
|
+
GREEN = '\x1b[32m',
|
|
34
|
+
YELLOW = '\x1b[33m',
|
|
35
|
+
RED = '\x1b[31m',
|
|
36
|
+
BOLD = '\x1b[1m',
|
|
37
|
+
DIM = '\x1b[2m',
|
|
38
|
+
RESET = '\x1b[0m';
|
|
39
|
+
|
|
40
|
+
const { extractConcepts } = require('./concept_extractor');
|
|
41
|
+
const { generateConsiderations } = require('./consideration_engine');
|
|
42
|
+
const { evaluateCoverage } = require('./coverage_engine');
|
|
43
|
+
const { auditPostExecution, generateImprovementProposal } = require('./verification_auditor');
|
|
44
|
+
const {
|
|
45
|
+
evaluateMateriality,
|
|
46
|
+
checkMinimumSufficientEngineering,
|
|
47
|
+
determineOutcomeBudget,
|
|
48
|
+
} = require('./materiality_engine');
|
|
49
|
+
const {
|
|
50
|
+
determineQualityDimensions,
|
|
51
|
+
generateOutcomeContract,
|
|
52
|
+
detectTradeoffs,
|
|
53
|
+
auditOutcome,
|
|
54
|
+
evaluateOutcomeRegression,
|
|
55
|
+
} = require('./outcome_engine');
|
|
56
|
+
const {
|
|
57
|
+
EVIDENCE_LEVELS,
|
|
58
|
+
REVERSIBILITY_LEVELS,
|
|
59
|
+
classifyEvidence,
|
|
60
|
+
createUncertaintyRecord,
|
|
61
|
+
calculateInformationValue,
|
|
62
|
+
classifyReversibility,
|
|
63
|
+
recordDecision,
|
|
64
|
+
invalidateDecision,
|
|
65
|
+
detectRequirementConflicts,
|
|
66
|
+
runCounterfactualAnalysis,
|
|
67
|
+
detectEngineeringSmells,
|
|
68
|
+
evaluateEscalation,
|
|
69
|
+
evaluateJudgmentState,
|
|
70
|
+
} = require('./judgment_engine');
|
|
71
|
+
const {
|
|
72
|
+
DynamicCapabilityGraph,
|
|
73
|
+
adaptPipelineOnSignal,
|
|
74
|
+
analyzeChangeImpact,
|
|
75
|
+
recordEngineeringLesson,
|
|
76
|
+
recallRelevantLessons,
|
|
77
|
+
evaluateSkillEffectiveness,
|
|
78
|
+
runFinalEngineeringReview,
|
|
79
|
+
} = require('./adaptive_execution');
|
|
80
|
+
const {
|
|
81
|
+
MEMORY_TYPES,
|
|
82
|
+
PROVENANCE_TYPES,
|
|
83
|
+
TRUST_STATES,
|
|
84
|
+
TRUST_RANKS,
|
|
85
|
+
MEMORY_SCOPES,
|
|
86
|
+
sanitizeContentAndEvidence,
|
|
87
|
+
validateMemoryAdmission,
|
|
88
|
+
createMemoryRecord,
|
|
89
|
+
validateApplicability,
|
|
90
|
+
evaluateMemoryStaleness,
|
|
91
|
+
evaluateMemoryHypothesisWithCurrentEvidence,
|
|
92
|
+
recordConflictResolution,
|
|
93
|
+
MemoryGraph,
|
|
94
|
+
EngineeringMemoryStore,
|
|
95
|
+
getEngineeringMemoryStore,
|
|
96
|
+
retrieveRelevantMemories,
|
|
97
|
+
extractEngineeringMemory,
|
|
98
|
+
} = require('./engineering_memory');
|
|
99
|
+
const {
|
|
100
|
+
SkillTelemetryRegistry,
|
|
101
|
+
getSkillTelemetryRegistry,
|
|
102
|
+
CapabilityGapTracker,
|
|
103
|
+
getCapabilityGapTracker,
|
|
104
|
+
PROPOSAL_STATUS,
|
|
105
|
+
SkillImprovementManager,
|
|
106
|
+
getSkillImprovementManager,
|
|
107
|
+
Phase5MetricsTracker,
|
|
108
|
+
getPhase5MetricsTracker,
|
|
109
|
+
} = require('./capability_evolution');
|
|
110
|
+
const {
|
|
111
|
+
FAILURE_TAXONOMY,
|
|
112
|
+
BLAST_RADIUS_TIERS,
|
|
113
|
+
SIMULATION_LEVELS,
|
|
114
|
+
PREDICTION_STATUS,
|
|
115
|
+
createPredictionRecord,
|
|
116
|
+
analyzeBlastRadius,
|
|
117
|
+
buildFailureChains,
|
|
118
|
+
simulateDependencyFailures,
|
|
119
|
+
simulateConcurrencyRisks,
|
|
120
|
+
simulateRetryAmplification,
|
|
121
|
+
simulateDatabaseFailures,
|
|
122
|
+
simulateQueueFailures,
|
|
123
|
+
simulateCacheFailures,
|
|
124
|
+
simulateCapacityAndQueueing,
|
|
125
|
+
simulateLatencyBudget,
|
|
126
|
+
runSecurityPreMortem,
|
|
127
|
+
runAgentPreMortem,
|
|
128
|
+
runCostPreMortem,
|
|
129
|
+
simulateDeploymentAndRecovery,
|
|
130
|
+
generateChaosScenarios,
|
|
131
|
+
detectUnsupportedClaims,
|
|
132
|
+
determineSimulationLevel,
|
|
133
|
+
runPreMortem,
|
|
134
|
+
comparePredictionsWithObserved,
|
|
135
|
+
Phase6MetricsTracker,
|
|
136
|
+
getPhase6MetricsTracker,
|
|
137
|
+
} = require('./simulation_engine');
|
|
138
|
+
const {
|
|
139
|
+
RELATIONSHIP_TYPES,
|
|
140
|
+
INTERACTION_PRIORITY,
|
|
141
|
+
INTERACTION_CONFIDENCE,
|
|
142
|
+
runCrossDomainAnalysis,
|
|
143
|
+
Phase9MetricsTracker,
|
|
144
|
+
getPhase9MetricsTracker,
|
|
145
|
+
} = require('./cross_domain_engine');
|
|
146
|
+
const {
|
|
147
|
+
OUTCOME_INVARIANT,
|
|
148
|
+
REQUIREMENT_SOURCES,
|
|
149
|
+
REQUIREMENT_CATEGORIES,
|
|
150
|
+
REQUIREMENT_PRIORITY: PHASE10_REQUIREMENT_PRIORITY,
|
|
151
|
+
COMPLEXITY_BUDGETS,
|
|
152
|
+
ASSUMPTION_STATUS,
|
|
153
|
+
REVERSIBILITY_LEVELS: PHASE10_REVERSIBILITY_LEVELS,
|
|
154
|
+
CAPABILITY_DEPTH,
|
|
155
|
+
REASONING_DEPTH,
|
|
156
|
+
discoverRequirements,
|
|
157
|
+
evaluateComplexityBudget,
|
|
158
|
+
auditArchitectureJustification,
|
|
159
|
+
generateDecisionRecords,
|
|
160
|
+
analyzeAssumptionsAndUnknowns,
|
|
161
|
+
buildSolutionShape,
|
|
162
|
+
verifyOutcomeAndRegressions,
|
|
163
|
+
runOutcomeOptimization,
|
|
164
|
+
evaluateSkillSelection,
|
|
165
|
+
Phase10OutcomeMemory,
|
|
166
|
+
getPhase10OutcomeMemory,
|
|
167
|
+
runAntiShortcutCheck,
|
|
168
|
+
runAntiOverengineeringCheck,
|
|
169
|
+
Phase10MetricsTracker,
|
|
170
|
+
getPhase10MetricsTracker,
|
|
171
|
+
} = require('./outcome_optimization_engine');
|
|
172
|
+
|
|
173
|
+
const _skillsCache = new Map();
|
|
174
|
+
|
|
175
|
+
function clearSkillsCache() {
|
|
176
|
+
_skillsCache.clear();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const STOP_WORDS = new Set([
|
|
180
|
+
'and',
|
|
181
|
+
'the',
|
|
182
|
+
'for',
|
|
183
|
+
'with',
|
|
184
|
+
'from',
|
|
185
|
+
'that',
|
|
186
|
+
'this',
|
|
187
|
+
'have',
|
|
188
|
+
'has',
|
|
189
|
+
'are',
|
|
190
|
+
'was',
|
|
191
|
+
'were',
|
|
192
|
+
'build',
|
|
193
|
+
'create',
|
|
194
|
+
'make',
|
|
195
|
+
'add',
|
|
196
|
+
'get',
|
|
197
|
+
'use',
|
|
198
|
+
'using',
|
|
199
|
+
'how',
|
|
200
|
+
'what',
|
|
201
|
+
'when',
|
|
202
|
+
'where',
|
|
203
|
+
'which',
|
|
204
|
+
'who',
|
|
205
|
+
'why',
|
|
206
|
+
'can',
|
|
207
|
+
'should',
|
|
208
|
+
'will',
|
|
209
|
+
'would',
|
|
210
|
+
'could',
|
|
211
|
+
'into',
|
|
212
|
+
'onto',
|
|
213
|
+
'about',
|
|
214
|
+
'than',
|
|
215
|
+
'then',
|
|
216
|
+
'also',
|
|
217
|
+
]);
|
|
218
|
+
|
|
219
|
+
function findAgentDir(start) {
|
|
220
|
+
let cur = path.resolve(start || process.cwd());
|
|
221
|
+
while (cur) {
|
|
222
|
+
const candidate = path.join(cur, '.agent');
|
|
223
|
+
if (fs.existsSync(candidate) && fs.statSync(candidate).isDirectory()) {
|
|
224
|
+
return candidate;
|
|
225
|
+
}
|
|
226
|
+
const parent = path.dirname(cur);
|
|
227
|
+
if (parent === cur) break;
|
|
228
|
+
cur = parent;
|
|
229
|
+
}
|
|
230
|
+
return path.resolve('.agent');
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Failure modes mapping to high-signal skills
|
|
234
|
+
const FAILURE_SIGNALS = [
|
|
235
|
+
{
|
|
236
|
+
match: /(?:retry|duplicate|idempot|replay|network fail|double charge|dedup)/i,
|
|
237
|
+
skills: ['error-resilience', 'api-patterns'],
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
match: /(?:transaction|acid|rollback|atomic|deadlock|isolation)/i,
|
|
241
|
+
skills: ['database-design', 'sql-pro', 'error-resilience'],
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
match: /(?:n\+1|slow query|index|query optim|latency|explain)/i,
|
|
245
|
+
skills: ['sql-pro', 'database-design'],
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
match: /(?:auth|jwt|token|session|csrf|xss|injection|owasp|credential)/i,
|
|
249
|
+
skills: ['agentshield-security', 'audit-and-fix', 'authentication-best-practices'],
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
match: /(?:responsive|mobile|breakpoint|touch|layout shift|cls)/i,
|
|
253
|
+
skills: ['adapt', 'mobile-design', 'better-ui'],
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
match: /(?:memory leak|oom|heap|profiling|saturation|cpu)/i,
|
|
257
|
+
skills: ['performance-profiling'],
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
match: /(?:regression|flaky|test fail|mock drift)/i,
|
|
261
|
+
skills: ['tdd-workflow', 'testing-patterns', 'verification-before-completion'],
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
match: /(?:race condition|concurrency|mutex|lock|semaphore)/i,
|
|
265
|
+
skills: ['error-resilience', 'system-design-pro'],
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
match: /(?:prompt injection|jailbreak|llm security|hallucin)/i,
|
|
269
|
+
skills: ['ai-prompt-injection-defense', 'anti-slop-enforcement'],
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
match: /(?:ci|cd|pipeline|github action|docker|deploy)/i,
|
|
273
|
+
skills: ['cicd-pro', 'devops-engineer'],
|
|
274
|
+
},
|
|
275
|
+
];
|
|
276
|
+
|
|
277
|
+
// Pipeline execution order weights (lower = earlier in DAG)
|
|
278
|
+
const PIPELINE_ORDER = {
|
|
279
|
+
architecture: 10,
|
|
280
|
+
'domain-modeling': 15,
|
|
281
|
+
'database-design': 20,
|
|
282
|
+
'sql-pro': 25,
|
|
283
|
+
'api-patterns': 30,
|
|
284
|
+
'clean-code': 35,
|
|
285
|
+
'error-resilience': 40,
|
|
286
|
+
'frontend-design': 45,
|
|
287
|
+
adapt: 50,
|
|
288
|
+
'better-ui': 55,
|
|
289
|
+
'tdd-workflow': 60,
|
|
290
|
+
'testing-patterns': 65,
|
|
291
|
+
'verification-before-completion': 70,
|
|
292
|
+
'agentshield-security': 80,
|
|
293
|
+
'audit-and-fix': 85,
|
|
294
|
+
'performance-profiling': 90,
|
|
295
|
+
'cicd-pro': 95,
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
function parseSkillFrontmatter(content) {
|
|
299
|
+
const match = content.match(/^---\s*([\s\S]*?)\s*---/);
|
|
300
|
+
if (!match) return {};
|
|
301
|
+
const lines = match[1].split('\n');
|
|
302
|
+
const meta = {};
|
|
303
|
+
for (const line of lines) {
|
|
304
|
+
const colon = line.indexOf(':');
|
|
305
|
+
if (colon !== -1) {
|
|
306
|
+
const key = line.slice(0, colon).trim();
|
|
307
|
+
const val = line
|
|
308
|
+
.slice(colon + 1)
|
|
309
|
+
.trim()
|
|
310
|
+
.replace(/^['"]|['"]$/g, '');
|
|
311
|
+
meta[key] = val;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return meta;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function loadAllSkills(agentDir) {
|
|
318
|
+
agentDir = agentDir || findAgentDir(process.cwd());
|
|
319
|
+
const cacheKey = path.resolve(agentDir);
|
|
320
|
+
if (_skillsCache.has(cacheKey)) {
|
|
321
|
+
return _skillsCache.get(cacheKey);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
let skillsDir = path.join(agentDir, 'skills');
|
|
325
|
+
if (!fs.existsSync(skillsDir)) {
|
|
326
|
+
const rootSkills = path.join(path.dirname(agentDir), 'skills');
|
|
327
|
+
if (fs.existsSync(rootSkills)) {
|
|
328
|
+
skillsDir = rootSkills;
|
|
329
|
+
} else {
|
|
330
|
+
return [];
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
const list = [];
|
|
335
|
+
const entries = fs.readdirSync(skillsDir, { withFileTypes: true });
|
|
336
|
+
for (const entry of entries) {
|
|
337
|
+
if (!entry.isDirectory()) continue;
|
|
338
|
+
const skillName = entry.name;
|
|
339
|
+
const skillPath = path.join(skillsDir, skillName, 'SKILL.md');
|
|
340
|
+
let description = '';
|
|
341
|
+
let domain = 'general';
|
|
342
|
+
let triggers = [];
|
|
343
|
+
|
|
344
|
+
if (fs.existsSync(skillPath)) {
|
|
345
|
+
try {
|
|
346
|
+
const text = fs.readFileSync(skillPath, 'utf8');
|
|
347
|
+
const meta = parseSkillFrontmatter(text);
|
|
348
|
+
description = meta.description || '';
|
|
349
|
+
domain = meta.domain || 'general';
|
|
350
|
+
if (meta.triggers) {
|
|
351
|
+
triggers = meta.triggers.split(',').map(s => s.trim().toLowerCase());
|
|
352
|
+
}
|
|
353
|
+
} catch (_) {}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
list.push({
|
|
357
|
+
name: skillName,
|
|
358
|
+
description,
|
|
359
|
+
domain,
|
|
360
|
+
triggers,
|
|
361
|
+
path: skillPath,
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
_skillsCache.set(cacheKey, list);
|
|
365
|
+
return list;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function discoverSkills(taskQuery, agentDir) {
|
|
369
|
+
const allSkills = loadAllSkills(agentDir);
|
|
370
|
+
const q = taskQuery.toLowerCase();
|
|
371
|
+
const rawTokens = q.split(/\W+/).filter(t => t.length > 2);
|
|
372
|
+
const queryTokens = rawTokens.filter(t => !STOP_WORDS.has(t));
|
|
373
|
+
|
|
374
|
+
// Evaluate failure mode hits
|
|
375
|
+
const failureSkills = new Set();
|
|
376
|
+
for (const sig of FAILURE_SIGNALS) {
|
|
377
|
+
if (sig.match.test(q)) {
|
|
378
|
+
sig.skills.forEach(s => failureSkills.add(s));
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
const scored = [];
|
|
383
|
+
|
|
384
|
+
for (const skill of allSkills) {
|
|
385
|
+
let score = 0;
|
|
386
|
+
const sName = skill.name.toLowerCase();
|
|
387
|
+
const sDesc = skill.description.toLowerCase();
|
|
388
|
+
|
|
389
|
+
// Exact skill name in query
|
|
390
|
+
if (q.includes(sName.replace(/-/g, ' ')) || q.includes(sName)) {
|
|
391
|
+
score += 15;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// Token matches in skill name
|
|
395
|
+
for (const token of queryTokens) {
|
|
396
|
+
if (sName === token) {
|
|
397
|
+
score += 12;
|
|
398
|
+
} else if (sName.includes(token)) {
|
|
399
|
+
score += 6;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// Trigger matches
|
|
403
|
+
if (skill.triggers.some(tr => tr.includes(token))) {
|
|
404
|
+
score += 8;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// Description token match (exact word boundary)
|
|
408
|
+
const wordRegex = new RegExp(`\\b${token}\\b`, 'i');
|
|
409
|
+
if (wordRegex.test(sDesc)) {
|
|
410
|
+
score += 3;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// Failure mode signal boost
|
|
415
|
+
if (failureSkills.has(skill.name)) {
|
|
416
|
+
score += 10;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
if (score >= 4) {
|
|
420
|
+
let state = 'OPTIONAL';
|
|
421
|
+
if (score >= 12) {
|
|
422
|
+
state = 'MANDATORY';
|
|
423
|
+
} else if (score >= 6) {
|
|
424
|
+
state = 'RECOMMENDED';
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
scored.push({
|
|
428
|
+
skill: skill.name,
|
|
429
|
+
score,
|
|
430
|
+
state,
|
|
431
|
+
domain: skill.domain,
|
|
432
|
+
description: skill.description,
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// Sort descending by score
|
|
438
|
+
scored.sort((a, b) => b.score - a.score);
|
|
439
|
+
|
|
440
|
+
// Composed Execution Pipeline: Mandatory + Recommended skills (ordered by pipeline stage)
|
|
441
|
+
const pipelineCandidates = scored.filter(
|
|
442
|
+
s => s.state === 'MANDATORY' || s.state === 'RECOMMENDED',
|
|
443
|
+
);
|
|
444
|
+
const pipeline = [...pipelineCandidates].sort((a, b) => {
|
|
445
|
+
const orderA = PIPELINE_ORDER[a.skill] || 50;
|
|
446
|
+
const orderB = PIPELINE_ORDER[b.skill] || 50;
|
|
447
|
+
return orderA - orderB;
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
return {
|
|
451
|
+
query: taskQuery,
|
|
452
|
+
totalDiscovered: scored.length,
|
|
453
|
+
mandatory: scored.filter(s => s.state === 'MANDATORY'),
|
|
454
|
+
recommended: scored.filter(s => s.state === 'RECOMMENDED'),
|
|
455
|
+
optional: scored.filter(s => s.state === 'OPTIONAL'),
|
|
456
|
+
pipeline: pipeline.map(p => p.skill),
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
function generateVerificationPlan(conceptData, considerations, coverageData) {
|
|
461
|
+
const plan = [];
|
|
462
|
+
for (const c of conceptData.all_concepts || []) {
|
|
463
|
+
switch (c.id) {
|
|
464
|
+
case 'idempotency':
|
|
465
|
+
plan.push({
|
|
466
|
+
target: 'idempotency',
|
|
467
|
+
test: 'Duplicate Request Safety',
|
|
468
|
+
action:
|
|
469
|
+
'Replay request with identical idempotency key; verify exactly one business effect executed.',
|
|
470
|
+
});
|
|
471
|
+
break;
|
|
472
|
+
case 'transaction-integrity':
|
|
473
|
+
plan.push({
|
|
474
|
+
target: 'transaction-integrity',
|
|
475
|
+
test: 'Atomic Rollback on Error',
|
|
476
|
+
action:
|
|
477
|
+
'Simulate mid-operation failure; verify database state rolls back completely without partial commits.',
|
|
478
|
+
});
|
|
479
|
+
break;
|
|
480
|
+
case 'concurrency-control':
|
|
481
|
+
plan.push({
|
|
482
|
+
target: 'concurrency-control',
|
|
483
|
+
test: 'Concurrent Mutation Race Test',
|
|
484
|
+
action:
|
|
485
|
+
'Dispatch parallel concurrent requests for same entity; verify race conditions are serialized/rejected.',
|
|
486
|
+
});
|
|
487
|
+
break;
|
|
488
|
+
case 'retry-and-backoff':
|
|
489
|
+
plan.push({
|
|
490
|
+
target: 'retry-and-backoff',
|
|
491
|
+
test: 'Retry Jitter & Circuit Breaking',
|
|
492
|
+
action:
|
|
493
|
+
'Simulate downstream latency/failure; verify retry backoff applies jitter and triggers circuit breaker.',
|
|
494
|
+
});
|
|
495
|
+
break;
|
|
496
|
+
case 'query-optimization':
|
|
497
|
+
plan.push({
|
|
498
|
+
target: 'query-optimization',
|
|
499
|
+
test: 'EXPLAIN Query Plan & Index Verification',
|
|
500
|
+
action:
|
|
501
|
+
'Run EXPLAIN ANALYZE on query; verify index scan is utilized and table scan is avoided.',
|
|
502
|
+
});
|
|
503
|
+
break;
|
|
504
|
+
case 'authentication-and-authorization':
|
|
505
|
+
plan.push({
|
|
506
|
+
target: 'authentication-and-authorization',
|
|
507
|
+
test: 'Unauthorized & Expired Token Rejection',
|
|
508
|
+
action:
|
|
509
|
+
'Send malformed, expired, and unauthorized requests; verify strict 401/403 rejection before business logic.',
|
|
510
|
+
});
|
|
511
|
+
break;
|
|
512
|
+
case 'input-validation-and-sanitization':
|
|
513
|
+
plan.push({
|
|
514
|
+
target: 'input-validation-and-sanitization',
|
|
515
|
+
test: 'Schema Boundary Mutation Defense',
|
|
516
|
+
action:
|
|
517
|
+
'Inject unexpected types and boundary extremes; verify 422 Unprocessable Entity without crashing.',
|
|
518
|
+
});
|
|
519
|
+
break;
|
|
520
|
+
case 'file-upload-and-storage':
|
|
521
|
+
plan.push({
|
|
522
|
+
target: 'file-upload-and-storage',
|
|
523
|
+
test: 'MIME Verification & Byte-Limit Defense',
|
|
524
|
+
action: 'Upload oversized and spoofed MIME files; verify immediate rejection.',
|
|
525
|
+
});
|
|
526
|
+
break;
|
|
527
|
+
case 'ai-agent-security-and-sandboxing':
|
|
528
|
+
plan.push({
|
|
529
|
+
target: 'ai-agent-security-and-sandboxing',
|
|
530
|
+
test: 'Subprocess Permission Boundary Check',
|
|
531
|
+
action: 'Inject shell escapes; verify permission gate blocks unauthorized system calls.',
|
|
532
|
+
});
|
|
533
|
+
break;
|
|
534
|
+
case 'realtime-collaboration-and-sync':
|
|
535
|
+
plan.push({
|
|
536
|
+
target: 'realtime-collaboration-and-sync',
|
|
537
|
+
test: 'CRDT Concurrent Edit Convergence',
|
|
538
|
+
action:
|
|
539
|
+
'Simulate concurrent conflicting edits from multiple clients; verify deterministic state convergence.',
|
|
540
|
+
});
|
|
541
|
+
break;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
if (plan.length === 0) {
|
|
546
|
+
plan.push({
|
|
547
|
+
target: 'general-verification',
|
|
548
|
+
test: 'Functional Contract Verification',
|
|
549
|
+
action: 'Run unit test suite and verify expected return schema and error handling.',
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
return plan;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
function analyzeTask(taskQuery, agentDir, options = {}) {
|
|
557
|
+
if (typeof agentDir === 'object' && agentDir !== null && !options.store) {
|
|
558
|
+
options = agentDir;
|
|
559
|
+
agentDir = undefined;
|
|
560
|
+
}
|
|
561
|
+
agentDir = agentDir || findAgentDir(process.cwd());
|
|
562
|
+
const conceptData = extractConcepts(taskQuery, agentDir);
|
|
563
|
+
const considerations = generateConsiderations(conceptData, agentDir);
|
|
564
|
+
|
|
565
|
+
// Phase 5: Retrieve relevant engineering memory as hypotheses
|
|
566
|
+
const memStore = options.store || getEngineeringMemoryStore();
|
|
567
|
+
const metricsTracker = getPhase5MetricsTracker();
|
|
568
|
+
metricsTracker.recordEvent('total_retrieval_queries');
|
|
569
|
+
|
|
570
|
+
const retrievedMemories = retrieveRelevantMemories(
|
|
571
|
+
taskQuery,
|
|
572
|
+
{
|
|
573
|
+
concepts: conceptData.all_concepts,
|
|
574
|
+
technologies: options.technologies || [],
|
|
575
|
+
project_id: options.project_id || null,
|
|
576
|
+
scale: options.scale,
|
|
577
|
+
strict_freshness: options.strict_freshness,
|
|
578
|
+
},
|
|
579
|
+
memStore,
|
|
580
|
+
options,
|
|
581
|
+
);
|
|
582
|
+
|
|
583
|
+
metricsTracker.recordEvent('relevant_memories_retrieved', retrievedMemories.length);
|
|
584
|
+
|
|
585
|
+
const patternHypotheses = retrievedMemories.filter(m => m.type === MEMORY_TYPES.PATTERN);
|
|
586
|
+
const failureHypotheses = retrievedMemories.filter(
|
|
587
|
+
m => m.type === MEMORY_TYPES.FAILURE || m.type === MEMORY_TYPES.ANTI_PATTERN,
|
|
588
|
+
);
|
|
589
|
+
const verificationStrategies = retrievedMemories.filter(
|
|
590
|
+
m => m.type === MEMORY_TYPES.VERIFICATION,
|
|
591
|
+
);
|
|
592
|
+
const pastDecisions = retrievedMemories.filter(m => m.type === MEMORY_TYPES.DECISION);
|
|
593
|
+
|
|
594
|
+
// Surface failure memories into considerations risks (Section 10 & 11)
|
|
595
|
+
if (failureHypotheses.length > 0) {
|
|
596
|
+
metricsTracker.recordEvent('repeated_failures_prevented', failureHypotheses.length);
|
|
597
|
+
for (const f of failureHypotheses) {
|
|
598
|
+
const riskStr = `[HISTORICAL FAILURE PREVENTED] ${f.title}`;
|
|
599
|
+
if (!considerations.risks.some(r => typeof r === 'string' && r.includes(f.title))) {
|
|
600
|
+
considerations.risks.push(riskStr);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
const discoveredSkills = discoverSkills(taskQuery, agentDir);
|
|
606
|
+
const allSkills = loadAllSkills(agentDir);
|
|
607
|
+
const coverageData = evaluateCoverage(conceptData, discoveredSkills, allSkills);
|
|
608
|
+
|
|
609
|
+
const pipelineSet = new Set(discoveredSkills.pipeline);
|
|
610
|
+
for (const add of coverageData.candidate_additions) {
|
|
611
|
+
pipelineSet.add(add);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
const composedPipeline = Array.from(pipelineSet).sort((a, b) => {
|
|
615
|
+
const orderA = PIPELINE_ORDER[a] || 50;
|
|
616
|
+
const orderB = PIPELINE_ORDER[b] || 50;
|
|
617
|
+
return orderA - orderB;
|
|
618
|
+
});
|
|
619
|
+
|
|
620
|
+
const verificationPlan = generateVerificationPlan(conceptData, considerations, coverageData);
|
|
621
|
+
|
|
622
|
+
// Enhance verification plan with verified strategies from memory (Section 12)
|
|
623
|
+
if (verificationStrategies.length > 0) {
|
|
624
|
+
metricsTracker.recordEvent('verification_strategies_reused', verificationStrategies.length);
|
|
625
|
+
for (const vs of verificationStrategies) {
|
|
626
|
+
if (
|
|
627
|
+
!verificationPlan.some(vp => vp.test === vs.verification?.strategy || vp.test === vs.title)
|
|
628
|
+
) {
|
|
629
|
+
verificationPlan.unshift({
|
|
630
|
+
target: vs.concepts?.[0] || 'memory-verified-strategy',
|
|
631
|
+
test: vs.title,
|
|
632
|
+
action: `${vs.verification?.strategy || vs.content}. Assertion: ${vs.verification?.assertion || 'Strict property verification'}`,
|
|
633
|
+
provenance: vs.provenance,
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
const materiality = evaluateMateriality(
|
|
640
|
+
considerations.all_considerations,
|
|
641
|
+
taskQuery,
|
|
642
|
+
conceptData,
|
|
643
|
+
);
|
|
644
|
+
const outcomeContract = generateOutcomeContract(taskQuery, conceptData, considerations, {
|
|
645
|
+
agentDir,
|
|
646
|
+
});
|
|
647
|
+
const tradeoffs = detectTradeoffs(composedPipeline);
|
|
648
|
+
|
|
649
|
+
const conceptsArray = conceptData.all_concepts.map(c => ({
|
|
650
|
+
id: c.id,
|
|
651
|
+
name: c.name,
|
|
652
|
+
domain: c.domain,
|
|
653
|
+
implicit: !conceptData.explicit_concepts.some(e => e.id === c.id),
|
|
654
|
+
reason: c.implied_reason || null,
|
|
655
|
+
}));
|
|
656
|
+
conceptsArray.explicit = conceptData.explicit_concepts;
|
|
657
|
+
conceptsArray.implicit = conceptData.implicit_concepts;
|
|
658
|
+
conceptsArray.all = conceptData.all_concepts.map(c => c.name);
|
|
659
|
+
|
|
660
|
+
const skillsList = [...composedPipeline];
|
|
661
|
+
skillsList.query = discoveredSkills.query;
|
|
662
|
+
skillsList.totalDiscovered = discoveredSkills.totalDiscovered;
|
|
663
|
+
skillsList.mandatory = discoveredSkills.mandatory;
|
|
664
|
+
skillsList.recommended = discoveredSkills.recommended;
|
|
665
|
+
skillsList.optional = discoveredSkills.optional;
|
|
666
|
+
skillsList.pipeline = composedPipeline;
|
|
667
|
+
|
|
668
|
+
const conflicts = detectRequirementConflicts(taskQuery);
|
|
669
|
+
const counterfactuals = runCounterfactualAnalysis(taskQuery);
|
|
670
|
+
const engineeringSmells = detectEngineeringSmells(taskQuery, composedPipeline);
|
|
671
|
+
const reversibility = classifyReversibility(taskQuery);
|
|
672
|
+
const relevantLessons = recallRelevantLessons(taskQuery);
|
|
673
|
+
const initialJudgment = evaluateJudgmentState({
|
|
674
|
+
task: taskQuery,
|
|
675
|
+
outcomeContract,
|
|
676
|
+
uncertainties: conflicts.map(c =>
|
|
677
|
+
createUncertaintyRecord(c.conflict, { impact_if_wrong: c.explanation, status: 'assumed' }),
|
|
678
|
+
),
|
|
679
|
+
});
|
|
680
|
+
|
|
681
|
+
// Phase 6: System Simulation & Pre-Mortem Intelligence
|
|
682
|
+
const phase6Tracker = getPhase6MetricsTracker();
|
|
683
|
+
phase6Tracker.recordEvent('pre_mortems_executed');
|
|
684
|
+
const preMortem = runPreMortem(taskQuery, {
|
|
685
|
+
concepts: conceptData.all_concepts.map(c => c.name),
|
|
686
|
+
technologies: options.technologies || [],
|
|
687
|
+
assumptions: options.assumptions,
|
|
688
|
+
dependencies: options.dependencies,
|
|
689
|
+
complexity: materiality.level,
|
|
690
|
+
evidence: options.evidence || [],
|
|
691
|
+
});
|
|
692
|
+
|
|
693
|
+
phase6Tracker.recordEvent('predictions_generated', preMortem.predictions.length);
|
|
694
|
+
if (preMortem.failure_chains.length > 0) {
|
|
695
|
+
phase6Tracker.recordEvent('failure_chains_detected', preMortem.failure_chains.length);
|
|
696
|
+
phase6Tracker.recordEvent(
|
|
697
|
+
'systemic_failures_identified',
|
|
698
|
+
preMortem.failure_chains.filter(c => c.systemic).length,
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
const unsupportedClaims = detectUnsupportedClaims(taskQuery);
|
|
703
|
+
if (unsupportedClaims.length > 0) {
|
|
704
|
+
phase6Tracker.recordEvent('unsupported_claims_caught', unsupportedClaims.length);
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
// Integrate pre-mortem predictions into verification plan
|
|
708
|
+
for (const p of preMortem.predictions) {
|
|
709
|
+
if (p.verification_method && !verificationPlan.some(v => v.test === p.prediction)) {
|
|
710
|
+
verificationPlan.push({
|
|
711
|
+
target: p.category,
|
|
712
|
+
test: p.prediction,
|
|
713
|
+
action: `[PRE-MORTEM VERIFICATION] ${p.verification_method}. Failure condition: ${p.reason}`,
|
|
714
|
+
status: p.status,
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
// Phase 9: Cross-Domain Engineering Intelligence
|
|
720
|
+
const crossDomainAnalysis = runCrossDomainAnalysis(taskQuery, conceptData, options);
|
|
721
|
+
|
|
722
|
+
// Integrate cross-domain validation requirements into verification plan
|
|
723
|
+
if (!crossDomainAnalysis.skipped) {
|
|
724
|
+
for (const vr of crossDomainAnalysis.validation_requirements || []) {
|
|
725
|
+
if (!verificationPlan.some(v => v.test === vr.test)) {
|
|
726
|
+
verificationPlan.push({
|
|
727
|
+
target: vr.source,
|
|
728
|
+
test: vr.test,
|
|
729
|
+
action: `[CROSS-DOMAIN VERIFICATION] ${vr.reason}`,
|
|
730
|
+
status: 'pending',
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
// Phase 10: Engineering Outcome Optimization
|
|
737
|
+
const outcomeOptimization = runOutcomeOptimization(taskQuery, {
|
|
738
|
+
conceptData,
|
|
739
|
+
considerationsData: considerations,
|
|
740
|
+
crossDomainAnalysis,
|
|
741
|
+
preMortem,
|
|
742
|
+
options,
|
|
743
|
+
});
|
|
744
|
+
|
|
745
|
+
// Integrate Phase 10 validation requirements into verification plan
|
|
746
|
+
for (const vr of outcomeOptimization.validation_requirements || []) {
|
|
747
|
+
if (!verificationPlan.some(v => v.test === vr.test)) {
|
|
748
|
+
verificationPlan.push({
|
|
749
|
+
target: vr.source,
|
|
750
|
+
test: vr.test,
|
|
751
|
+
action: `[OUTCOME OPTIMIZATION VERIFICATION] ${vr.reason}`,
|
|
752
|
+
status: 'pending',
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
return {
|
|
758
|
+
task: {
|
|
759
|
+
query: taskQuery,
|
|
760
|
+
actions: conceptData.actions,
|
|
761
|
+
domains: conceptData.domains,
|
|
762
|
+
},
|
|
763
|
+
concepts: conceptsArray,
|
|
764
|
+
considerations: considerations.all_considerations,
|
|
765
|
+
materiality: materiality.all_evaluated,
|
|
766
|
+
material_considerations: materiality.material,
|
|
767
|
+
outcome_contract: outcomeContract,
|
|
768
|
+
tradeoffs,
|
|
769
|
+
conflicts,
|
|
770
|
+
counterfactuals,
|
|
771
|
+
anti_slop: engineeringSmells,
|
|
772
|
+
engineering_smells: engineeringSmells,
|
|
773
|
+
reversibility,
|
|
774
|
+
institutional_lessons: relevantLessons,
|
|
775
|
+
judgment: initialJudgment,
|
|
776
|
+
memories: {
|
|
777
|
+
retrieved: retrievedMemories,
|
|
778
|
+
patterns: patternHypotheses,
|
|
779
|
+
failures_to_avoid: failureHypotheses,
|
|
780
|
+
verification_strategies: verificationStrategies,
|
|
781
|
+
decisions: pastDecisions,
|
|
782
|
+
},
|
|
783
|
+
metrics: metricsTracker.getMetrics(),
|
|
784
|
+
// Phase 6 System Simulation & Pre-Mortem artifacts
|
|
785
|
+
pre_mortem: preMortem,
|
|
786
|
+
predictions: preMortem.predictions,
|
|
787
|
+
failure_chains: preMortem.failure_chains,
|
|
788
|
+
blast_radius: preMortem.blast_radius,
|
|
789
|
+
unsupported_claims: unsupportedClaims,
|
|
790
|
+
simulation_plan: preMortem.simulation_plan,
|
|
791
|
+
phase6_metrics: phase6Tracker.getMetrics(),
|
|
792
|
+
// Phase 9: Cross-Domain Engineering Intelligence
|
|
793
|
+
cross_domain_analysis: crossDomainAnalysis.skipped
|
|
794
|
+
? null
|
|
795
|
+
: {
|
|
796
|
+
interactions: crossDomainAnalysis.interactions,
|
|
797
|
+
second_order_effects: crossDomainAnalysis.second_order_effects,
|
|
798
|
+
failure_propagation: crossDomainAnalysis.failure_propagation,
|
|
799
|
+
resource_contention: crossDomainAnalysis.resource_contention,
|
|
800
|
+
security_boundaries: crossDomainAnalysis.security_boundaries,
|
|
801
|
+
constraint_conflicts: crossDomainAnalysis.constraint_conflicts,
|
|
802
|
+
emergent_failures: crossDomainAnalysis.emergent_failures,
|
|
803
|
+
tradeoff_graph: crossDomainAnalysis.tradeoffs,
|
|
804
|
+
blind_spots: crossDomainAnalysis.blind_spots,
|
|
805
|
+
validation_requirements: crossDomainAnalysis.validation_requirements,
|
|
806
|
+
summary: crossDomainAnalysis.summary,
|
|
807
|
+
},
|
|
808
|
+
phase9_metrics: crossDomainAnalysis.phase9_metrics || null,
|
|
809
|
+
// Phase 10: Engineering Outcome Optimization
|
|
810
|
+
outcome_optimization: outcomeOptimization,
|
|
811
|
+
outcome_requirements: outcomeOptimization.requirements,
|
|
812
|
+
engineering_options: outcomeOptimization.engineering_options,
|
|
813
|
+
decision_records: outcomeOptimization.decision_records,
|
|
814
|
+
solution_shape: outcomeOptimization.solution_shape,
|
|
815
|
+
early_validations: outcomeOptimization.early_validations,
|
|
816
|
+
anti_slop_audit: outcomeOptimization.architecture_audit,
|
|
817
|
+
phase10_metrics: outcomeOptimization.phase10_metrics,
|
|
818
|
+
risks: considerations.risks,
|
|
819
|
+
failure_modes: considerations.failure_modes,
|
|
820
|
+
quality_attributes: considerations.quality_attributes,
|
|
821
|
+
skills: skillsList,
|
|
822
|
+
coverage: coverageData.coverage_matrix,
|
|
823
|
+
coverage_summary: {
|
|
824
|
+
full: coverageData.full.length,
|
|
825
|
+
partial: coverageData.partial.length,
|
|
826
|
+
uncovered: coverageData.uncovered.length,
|
|
827
|
+
},
|
|
828
|
+
composition: {
|
|
829
|
+
pipeline: composedPipeline,
|
|
830
|
+
candidate_promotions: coverageData.candidate_additions,
|
|
831
|
+
},
|
|
832
|
+
gaps: coverageData.true_gaps,
|
|
833
|
+
creation_gate: {
|
|
834
|
+
new_skill_required: coverageData.true_gaps.length > 0,
|
|
835
|
+
reason:
|
|
836
|
+
coverageData.true_gaps.length > 0
|
|
837
|
+
? `Uncovered gaps: ${coverageData.true_gaps.join(', ')}`
|
|
838
|
+
: 'Existing capabilities can be composed.',
|
|
839
|
+
},
|
|
840
|
+
verification_plan: verificationPlan,
|
|
841
|
+
confidence: {
|
|
842
|
+
concept_recall: 0.95,
|
|
843
|
+
coverage_score: coverageData.full.length / Math.max(1, coverageData.total_concepts),
|
|
844
|
+
},
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
function evaluateCreationGate(needDescription, agentDir) {
|
|
849
|
+
const allSkills = loadAllSkills(agentDir);
|
|
850
|
+
const target = needDescription.toLowerCase();
|
|
851
|
+
const rawTokens = target.split(/\W+/).filter(t => t.length > 2);
|
|
852
|
+
const tokens = rawTokens.filter(t => !STOP_WORDS.has(t));
|
|
853
|
+
|
|
854
|
+
const exact = allSkills.find(s => s.name === target || s.name.replace(/-/g, ' ') === target);
|
|
855
|
+
|
|
856
|
+
const overlaps = [];
|
|
857
|
+
for (const s of allSkills) {
|
|
858
|
+
let matchCount = 0;
|
|
859
|
+
for (const tok of tokens) {
|
|
860
|
+
if (s.name.includes(tok)) matchCount += 2;
|
|
861
|
+
const re = new RegExp(`\\b${tok}\\b`, 'i');
|
|
862
|
+
if (re.test(s.description)) matchCount += 1;
|
|
863
|
+
}
|
|
864
|
+
if (matchCount > 0) {
|
|
865
|
+
overlaps.push({ skill: s.name, matches: matchCount });
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
overlaps.sort((a, b) => b.matches - a.matches);
|
|
869
|
+
|
|
870
|
+
const topOverlaps = overlaps.slice(0, 3).map(o => o.skill);
|
|
871
|
+
const nearestSkill = topOverlaps[0] || null;
|
|
872
|
+
|
|
873
|
+
const checks = [
|
|
874
|
+
{
|
|
875
|
+
name: 'Existing skill searched',
|
|
876
|
+
passed: true,
|
|
877
|
+
detail: `Searched ${allSkills.length} skills`,
|
|
878
|
+
},
|
|
879
|
+
{
|
|
880
|
+
name: 'Semantic matches evaluated',
|
|
881
|
+
passed: true,
|
|
882
|
+
detail:
|
|
883
|
+
topOverlaps.length > 0
|
|
884
|
+
? `Found candidate matches: ${topOverlaps.join(', ')}`
|
|
885
|
+
: 'No direct matches',
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
name: 'Related skills checked',
|
|
889
|
+
passed: true,
|
|
890
|
+
detail: `${topOverlaps.length} related skills analyzed`,
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
name: 'Composition attempted',
|
|
894
|
+
passed: topOverlaps.length >= 2,
|
|
895
|
+
detail:
|
|
896
|
+
topOverlaps.length >= 2
|
|
897
|
+
? `Can potentially compose [${topOverlaps.join(', ')}]`
|
|
898
|
+
: 'Composition insufficient',
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
name: 'Duplicate capability checked',
|
|
902
|
+
passed: !exact,
|
|
903
|
+
detail: exact ? `Exact match exists: ${exact.name}` : 'No exact duplicate',
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
name: 'Capability gap confirmed',
|
|
907
|
+
passed: !exact && topOverlaps.length < 2,
|
|
908
|
+
detail: exact
|
|
909
|
+
? 'Duplicate exists'
|
|
910
|
+
: topOverlaps.length >= 2
|
|
911
|
+
? 'Covered by existing composition'
|
|
912
|
+
: 'Genuine gap',
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
name: 'Reusability justified',
|
|
916
|
+
passed: tokens.length >= 1,
|
|
917
|
+
detail: 'Assessed for modularity',
|
|
918
|
+
},
|
|
919
|
+
{
|
|
920
|
+
name: 'Concept coverage checked',
|
|
921
|
+
passed: topOverlaps.length < 2,
|
|
922
|
+
detail: topOverlaps.length >= 2 ? 'Covered by existing concepts' : 'New concept domain',
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
name: 'Failure-mode coverage checked',
|
|
926
|
+
passed: true,
|
|
927
|
+
detail: 'Failure modes evaluated against existing guardrails',
|
|
928
|
+
},
|
|
929
|
+
{
|
|
930
|
+
name: 'Verification capability checked',
|
|
931
|
+
passed: true,
|
|
932
|
+
detail: 'Automated test assertions possible',
|
|
933
|
+
},
|
|
934
|
+
{
|
|
935
|
+
name: 'Existing skill improvement evaluated',
|
|
936
|
+
passed: !nearestSkill,
|
|
937
|
+
detail: nearestSkill
|
|
938
|
+
? `Evaluate extending '${nearestSkill}' instead`
|
|
939
|
+
: 'No suitable base skill to extend',
|
|
940
|
+
},
|
|
941
|
+
];
|
|
942
|
+
|
|
943
|
+
const canCreate = !exact && !nearestSkill;
|
|
944
|
+
let recommendation = '';
|
|
945
|
+
if (exact) {
|
|
946
|
+
recommendation = `REJECT: Skill '${exact.name}' already exists. Use or enhance it instead.`;
|
|
947
|
+
} else if (topOverlaps.length >= 2) {
|
|
948
|
+
recommendation = `COMPOSE FIRST: Capabilities can be satisfied by composing existing skills: [${topOverlaps.join(', ')}].`;
|
|
949
|
+
} else if (nearestSkill) {
|
|
950
|
+
recommendation = `IMPROVE FIRST: Nearest skill '${nearestSkill}' can be extended to cover this capability without creating a new skill.`;
|
|
951
|
+
} else {
|
|
952
|
+
recommendation = `APPROVED: Capability gap confirmed. Minimal focused reusable skill creation justified.`;
|
|
953
|
+
try {
|
|
954
|
+
getCapabilityGapTracker().recordCapabilityGap({
|
|
955
|
+
capability_need: needDescription,
|
|
956
|
+
source_task: 'Creation Gate Evaluation',
|
|
957
|
+
reason_insufficient:
|
|
958
|
+
checks.find(c => c.name === 'Capability gap confirmed')?.detail ||
|
|
959
|
+
'Genuine capability gap',
|
|
960
|
+
});
|
|
961
|
+
} catch (e) {}
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
return {
|
|
965
|
+
need: needDescription,
|
|
966
|
+
canCreate,
|
|
967
|
+
recommendation,
|
|
968
|
+
checks,
|
|
969
|
+
candidateSkills: topOverlaps,
|
|
970
|
+
nearestSkill,
|
|
971
|
+
};
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
function runAudit(agentDir) {
|
|
975
|
+
const all = loadAllSkills(agentDir);
|
|
976
|
+
console.log(
|
|
977
|
+
`\n${BOLD}${CYAN}━━━ Skill Intelligence Engine: Discovery Readiness Audit ━━━${RESET}\n`,
|
|
978
|
+
);
|
|
979
|
+
console.log(`Total skills indexed: ${BOLD}${all.length}${RESET}`);
|
|
980
|
+
|
|
981
|
+
let withoutDesc = 0;
|
|
982
|
+
for (const s of all) {
|
|
983
|
+
if (!s.description || s.description.length < 10) {
|
|
984
|
+
withoutDesc++;
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
console.log(`Skills with full metadata: ${GREEN}${all.length - withoutDesc}${RESET}`);
|
|
989
|
+
if (withoutDesc > 0) {
|
|
990
|
+
console.log(`Skills needing richer description: ${YELLOW}${withoutDesc}${RESET}`);
|
|
991
|
+
} else {
|
|
992
|
+
console.log(`Coverage: ${GREEN}100% Discoverable${RESET}`);
|
|
993
|
+
}
|
|
994
|
+
console.log(
|
|
995
|
+
`\n${GREEN}✓ Skill Intelligence Engine ready for zero-hallucination discovery.${RESET}\n`,
|
|
996
|
+
);
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
function main() {
|
|
1000
|
+
const args = process.argv.slice(2);
|
|
1001
|
+
let query = null;
|
|
1002
|
+
let gateNeed = null;
|
|
1003
|
+
let audit = false;
|
|
1004
|
+
let json = false;
|
|
1005
|
+
let workspaceDir = '.';
|
|
1006
|
+
|
|
1007
|
+
let premortem = false;
|
|
1008
|
+
let simulate = false;
|
|
1009
|
+
let chainsOnly = false;
|
|
1010
|
+
let claimsOnly = false;
|
|
1011
|
+
|
|
1012
|
+
for (let i = 0; i < args.length; i++) {
|
|
1013
|
+
const a = args[i];
|
|
1014
|
+
if (a === '--query' && i + 1 < args.length) {
|
|
1015
|
+
query = args[++i];
|
|
1016
|
+
} else if (a === '--gate' || a === '-g') {
|
|
1017
|
+
if (i + 1 < args.length && !args[i + 1].startsWith('-')) {
|
|
1018
|
+
gateNeed = args[++i];
|
|
1019
|
+
}
|
|
1020
|
+
} else if (a === '--need' && i + 1 < args.length) {
|
|
1021
|
+
gateNeed = args[++i];
|
|
1022
|
+
} else if (a === '--audit') {
|
|
1023
|
+
audit = true;
|
|
1024
|
+
} else if (a === '--pre-mortem' || a === '--premortem') {
|
|
1025
|
+
premortem = true;
|
|
1026
|
+
} else if (a === '--simulate') {
|
|
1027
|
+
simulate = true;
|
|
1028
|
+
} else if (a === '--chains') {
|
|
1029
|
+
chainsOnly = true;
|
|
1030
|
+
} else if (a === '--claims') {
|
|
1031
|
+
claimsOnly = true;
|
|
1032
|
+
} else if (a === '--json') {
|
|
1033
|
+
json = true;
|
|
1034
|
+
} else if (a === '--workspace' && i + 1 < args.length) {
|
|
1035
|
+
workspaceDir = args[++i];
|
|
1036
|
+
} else if (!a.startsWith('-') && !query) {
|
|
1037
|
+
query = a;
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
const agentDir = findAgentDir(path.resolve(workspaceDir));
|
|
1042
|
+
|
|
1043
|
+
if (audit) {
|
|
1044
|
+
runAudit(agentDir);
|
|
1045
|
+
return;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
if (gateNeed) {
|
|
1049
|
+
const gateResult = evaluateCreationGate(gateNeed, agentDir);
|
|
1050
|
+
if (json) {
|
|
1051
|
+
console.log(JSON.stringify(gateResult, null, 2));
|
|
1052
|
+
return;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
console.log(`\n${BOLD}${CYAN}━━━ New Skill Creation Gate Audit (11-Check Gate) ━━━${RESET}\n`);
|
|
1056
|
+
console.log(`Requested Capability: ${BOLD}${gateNeed}${RESET}`);
|
|
1057
|
+
console.log(
|
|
1058
|
+
`Gate Status: ${gateResult.canCreate ? GREEN + 'APPROVED' : RED + 'BLOCKED'}${RESET}\n`,
|
|
1059
|
+
);
|
|
1060
|
+
for (const c of gateResult.checks) {
|
|
1061
|
+
const icon = c.passed ? `${GREEN}✓ PASS${RESET}` : `${RED}✖ FAIL${RESET}`;
|
|
1062
|
+
console.log(` [${icon}] ${BOLD}${c.name.padEnd(38)}${RESET} ${DIM}(${c.detail})${RESET}`);
|
|
1063
|
+
}
|
|
1064
|
+
console.log(`\n${BOLD}Decision:${RESET} ${gateResult.recommendation}\n`);
|
|
1065
|
+
return;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
if (query) {
|
|
1069
|
+
const analysis = analyzeTask(query, agentDir);
|
|
1070
|
+
|
|
1071
|
+
if (chainsOnly) {
|
|
1072
|
+
if (json) {
|
|
1073
|
+
console.log(JSON.stringify(analysis.failure_chains, null, 2));
|
|
1074
|
+
return;
|
|
1075
|
+
}
|
|
1076
|
+
console.log(`\n${BOLD}${CYAN}━━━ CAUSAL FAILURE CHAINS ━━━${RESET}\n`);
|
|
1077
|
+
for (const fc of analysis.failure_chains) {
|
|
1078
|
+
console.log(
|
|
1079
|
+
` ⚡ ${BOLD}${fc.name || fc.id}${RESET} [Blast: ${fc.blast_radius} | ${fc.severity}]`,
|
|
1080
|
+
);
|
|
1081
|
+
console.log(` ${DIM}${fc.chain}${RESET}\n`);
|
|
1082
|
+
}
|
|
1083
|
+
return;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
if (claimsOnly) {
|
|
1087
|
+
if (json) {
|
|
1088
|
+
console.log(JSON.stringify(analysis.unsupported_claims, null, 2));
|
|
1089
|
+
return;
|
|
1090
|
+
}
|
|
1091
|
+
console.log(`\n${BOLD}${CYAN}━━━ UNSUPPORTED CLAIMS AUDIT ━━━${RESET}\n`);
|
|
1092
|
+
if (analysis.unsupported_claims.length === 0) {
|
|
1093
|
+
console.log(` ${GREEN}✓ No unsupported architectural claims detected.${RESET}\n`);
|
|
1094
|
+
} else {
|
|
1095
|
+
for (const uc of analysis.unsupported_claims) {
|
|
1096
|
+
console.log(` ⚠ ${RED}"${uc.claim}"${RESET} — ${DIM}${uc.reason}${RESET}`);
|
|
1097
|
+
console.log(` Action: ${YELLOW}${uc.action_required}${RESET}\n`);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
return;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
if (premortem || simulate) {
|
|
1104
|
+
if (json) {
|
|
1105
|
+
console.log(JSON.stringify(analysis.pre_mortem, null, 2));
|
|
1106
|
+
return;
|
|
1107
|
+
}
|
|
1108
|
+
console.log(`\n${BOLD}${CYAN}━━━ SYSTEM PRE-MORTEM & FAILURE SIMULATION ━━━${RESET}\n`);
|
|
1109
|
+
console.log(`Task: ${BOLD}${query}${RESET}`);
|
|
1110
|
+
console.log(
|
|
1111
|
+
`Simulation Level: ${YELLOW}${analysis.simulation_plan.selected_level.name}${RESET}\n`,
|
|
1112
|
+
);
|
|
1113
|
+
|
|
1114
|
+
console.log(`${BOLD}Predictions & Hypotheses (${analysis.predictions.length}):${RESET}`);
|
|
1115
|
+
for (const p of analysis.predictions) {
|
|
1116
|
+
const impCol = p.impact === 'CRITICAL' ? RED : p.impact === 'HIGH' ? YELLOW : CYAN;
|
|
1117
|
+
console.log(
|
|
1118
|
+
` • [${impCol}${p.impact}${RESET}] ${BOLD}${p.prediction}${RESET} (${p.category})`,
|
|
1119
|
+
);
|
|
1120
|
+
console.log(` Reason: ${DIM}${p.reason}${RESET}`);
|
|
1121
|
+
console.log(` Verification: ${CYAN}${p.verification_method}${RESET}`);
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
if (analysis.failure_chains.length > 0) {
|
|
1125
|
+
console.log(`\n${BOLD}Causal Failure Chains (${analysis.failure_chains.length}):${RESET}`);
|
|
1126
|
+
for (const fc of analysis.failure_chains) {
|
|
1127
|
+
console.log(` ⚡ ${BOLD}${fc.name || fc.id}${RESET} [Blast: ${fc.blast_radius}]`);
|
|
1128
|
+
console.log(` ${DIM}${fc.chain}${RESET}`);
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
if (analysis.unsupported_claims.length > 0) {
|
|
1133
|
+
console.log(
|
|
1134
|
+
`\n${BOLD}${RED}Unsupported Claims Detected (${analysis.unsupported_claims.length}):${RESET}`,
|
|
1135
|
+
);
|
|
1136
|
+
for (const uc of analysis.unsupported_claims) {
|
|
1137
|
+
console.log(` ⚠ "${uc.claim}" — ${DIM}${uc.reason}${RESET}`);
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
console.log();
|
|
1141
|
+
return;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
if (json) {
|
|
1145
|
+
console.log(JSON.stringify(analysis, null, 2));
|
|
1146
|
+
return;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
console.log(`\n${BOLD}${CYAN}━━━ TASK INTELLIGENCE ━━━${RESET}\n`);
|
|
1150
|
+
console.log(`Task: ${BOLD}${query}${RESET}`);
|
|
1151
|
+
if (analysis.risks.length > 0) {
|
|
1152
|
+
console.log(`Risk Signals: ${RED}${analysis.risks.join(' | ')}${RESET}`);
|
|
1153
|
+
}
|
|
1154
|
+
console.log();
|
|
1155
|
+
|
|
1156
|
+
console.log(`${BOLD}${CYAN}━━━ CONCEPTS ━━━${RESET}`);
|
|
1157
|
+
if (analysis.concepts.explicit.length > 0) {
|
|
1158
|
+
console.log(` ${BOLD}Explicit Concepts:${RESET}`);
|
|
1159
|
+
analysis.concepts.explicit.forEach(c =>
|
|
1160
|
+
console.log(` • ${BOLD}${c.name}${RESET} ${DIM}(domain: ${c.domain})${RESET}`),
|
|
1161
|
+
);
|
|
1162
|
+
}
|
|
1163
|
+
if (analysis.concepts.implicit.length > 0) {
|
|
1164
|
+
console.log(` ${BOLD}Implicit Considerations:${RESET}`);
|
|
1165
|
+
analysis.concepts.implicit.forEach(c =>
|
|
1166
|
+
console.log(
|
|
1167
|
+
` • ${BOLD}${c.name}${RESET} ${DIM}(domain: ${c.domain}) — ${c.reason}${RESET}`,
|
|
1168
|
+
),
|
|
1169
|
+
);
|
|
1170
|
+
}
|
|
1171
|
+
console.log();
|
|
1172
|
+
|
|
1173
|
+
console.log(`${BOLD}${CYAN}━━━ ENGINEERING CONSIDERATIONS ━━━${RESET}`);
|
|
1174
|
+
const critical = analysis.considerations.filter(c => c.severity === 'CRITICAL');
|
|
1175
|
+
const high = analysis.considerations.filter(c => c.severity === 'HIGH');
|
|
1176
|
+
const medium = analysis.considerations.filter(c => c.severity === 'MEDIUM');
|
|
1177
|
+
|
|
1178
|
+
if (critical.length > 0) {
|
|
1179
|
+
console.log(` ${BOLD}${RED}[CRITICAL]${RESET}`);
|
|
1180
|
+
critical.forEach(c =>
|
|
1181
|
+
console.log(` • ${BOLD}${c.title}${RESET} (${c.category}) — ${c.rationale}`),
|
|
1182
|
+
);
|
|
1183
|
+
}
|
|
1184
|
+
if (high.length > 0) {
|
|
1185
|
+
console.log(` ${BOLD}${YELLOW}[HIGH]${RESET}`);
|
|
1186
|
+
high.forEach(c =>
|
|
1187
|
+
console.log(` • ${BOLD}${c.title}${RESET} (${c.category}) — ${c.rationale}`),
|
|
1188
|
+
);
|
|
1189
|
+
}
|
|
1190
|
+
if (medium.length > 0) {
|
|
1191
|
+
console.log(` ${BOLD}${CYAN}[MEDIUM]${RESET}`);
|
|
1192
|
+
medium.forEach(c =>
|
|
1193
|
+
console.log(` • ${BOLD}${c.title}${RESET} (${c.category}) — ${c.rationale}`),
|
|
1194
|
+
);
|
|
1195
|
+
}
|
|
1196
|
+
console.log();
|
|
1197
|
+
|
|
1198
|
+
console.log(`${BOLD}${CYAN}━━━ SKILL COVERAGE ━━━${RESET}`);
|
|
1199
|
+
console.log(` ${'Concept'.padEnd(38)} ${'Coverage'.padEnd(10)} Matched Skill`);
|
|
1200
|
+
console.log(` ${'─'.repeat(38)} ${'─'.repeat(10)} ${'─'.repeat(20)}`);
|
|
1201
|
+
for (const row of analysis.coverage) {
|
|
1202
|
+
const covColor = row.coverage === 'FULL' ? GREEN : row.coverage === 'PARTIAL' ? YELLOW : RED;
|
|
1203
|
+
console.log(
|
|
1204
|
+
` ${row.concept_name.slice(0, 36).padEnd(38)} ${covColor}${row.coverage.padEnd(10)}${RESET} ${row.matched_skill || DIM + 'NONE' + RESET}`,
|
|
1205
|
+
);
|
|
1206
|
+
}
|
|
1207
|
+
console.log();
|
|
1208
|
+
|
|
1209
|
+
console.log(`${BOLD}${CYAN}━━━ COMPOSED CAPABILITY PIPELINE DAG ━━━${RESET}`);
|
|
1210
|
+
console.log(` ${GREEN}${analysis.composition.pipeline.join(' → ')}${RESET}\n`);
|
|
1211
|
+
|
|
1212
|
+
console.log(`${BOLD}${CYAN}━━━ SYSTEM PRE-MORTEM HYPOTHESES & CHAINS ━━━${RESET}`);
|
|
1213
|
+
console.log(
|
|
1214
|
+
` Simulation Level: ${YELLOW}${analysis.simulation_plan.selected_level.name}${RESET}`,
|
|
1215
|
+
);
|
|
1216
|
+
console.log(
|
|
1217
|
+
` Predictions: ${BOLD}${analysis.predictions.length}${RESET} | Causal Chains: ${BOLD}${analysis.failure_chains.length}${RESET}`,
|
|
1218
|
+
);
|
|
1219
|
+
if (analysis.failure_chains.length > 0) {
|
|
1220
|
+
for (const fc of analysis.failure_chains.slice(0, 2)) {
|
|
1221
|
+
console.log(` ⚡ ${BOLD}${fc.name || fc.id}${RESET} [Blast: ${fc.blast_radius}]`);
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
console.log();
|
|
1225
|
+
|
|
1226
|
+
console.log(`${BOLD}${CYAN}━━━ VERIFICATION PLAN ━━━${RESET}`);
|
|
1227
|
+
for (const v of analysis.verification_plan) {
|
|
1228
|
+
console.log(` • [${BOLD}${v.target}${RESET}] ${v.test}: ${DIM}${v.action}${RESET}`);
|
|
1229
|
+
}
|
|
1230
|
+
console.log();
|
|
1231
|
+
return;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
console.log(`
|
|
1235
|
+
${BOLD}Tribunal Skill Intelligence Engine — Phase 2${RESET}
|
|
1236
|
+
Usage:
|
|
1237
|
+
node scripts/skill_intelligence.js --query "<task>"
|
|
1238
|
+
node scripts/skill_intelligence.js --gate --need "<capability>"
|
|
1239
|
+
node scripts/skill_intelligence.js --audit
|
|
1240
|
+
node scripts/skill_intelligence.js --query "<task>" --json
|
|
1241
|
+
`);
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
module.exports = {
|
|
1245
|
+
discoverSkills,
|
|
1246
|
+
evaluateCreationGate,
|
|
1247
|
+
loadAllSkills,
|
|
1248
|
+
clearSkillsCache,
|
|
1249
|
+
analyzeTask,
|
|
1250
|
+
generateVerificationPlan,
|
|
1251
|
+
auditPostExecution,
|
|
1252
|
+
generateImprovementProposal,
|
|
1253
|
+
evaluateMateriality,
|
|
1254
|
+
checkMinimumSufficientEngineering,
|
|
1255
|
+
determineOutcomeBudget,
|
|
1256
|
+
determineQualityDimensions,
|
|
1257
|
+
generateOutcomeContract,
|
|
1258
|
+
detectTradeoffs,
|
|
1259
|
+
auditOutcome,
|
|
1260
|
+
evaluateOutcomeRegression,
|
|
1261
|
+
FAILURE_SIGNALS,
|
|
1262
|
+
// Phase 4: Engineering Judgment & Adaptive Execution
|
|
1263
|
+
EVIDENCE_LEVELS,
|
|
1264
|
+
REVERSIBILITY_LEVELS,
|
|
1265
|
+
classifyEvidence,
|
|
1266
|
+
createUncertaintyRecord,
|
|
1267
|
+
calculateInformationValue,
|
|
1268
|
+
classifyReversibility,
|
|
1269
|
+
recordDecision,
|
|
1270
|
+
invalidateDecision,
|
|
1271
|
+
detectRequirementConflicts,
|
|
1272
|
+
runCounterfactualAnalysis,
|
|
1273
|
+
detectEngineeringSmells,
|
|
1274
|
+
evaluateEscalation,
|
|
1275
|
+
evaluateJudgmentState,
|
|
1276
|
+
DynamicCapabilityGraph,
|
|
1277
|
+
adaptPipelineOnSignal,
|
|
1278
|
+
analyzeChangeImpact,
|
|
1279
|
+
recordEngineeringLesson,
|
|
1280
|
+
recallRelevantLessons,
|
|
1281
|
+
evaluateSkillEffectiveness,
|
|
1282
|
+
runFinalEngineeringReview,
|
|
1283
|
+
// Phase 5: Engineering Memory & Continuous Capability Evolution
|
|
1284
|
+
MEMORY_TYPES,
|
|
1285
|
+
PROVENANCE_TYPES,
|
|
1286
|
+
TRUST_STATES,
|
|
1287
|
+
TRUST_RANKS,
|
|
1288
|
+
MEMORY_SCOPES,
|
|
1289
|
+
sanitizeContentAndEvidence,
|
|
1290
|
+
validateMemoryAdmission,
|
|
1291
|
+
createMemoryRecord,
|
|
1292
|
+
validateApplicability,
|
|
1293
|
+
evaluateMemoryStaleness,
|
|
1294
|
+
evaluateMemoryHypothesisWithCurrentEvidence,
|
|
1295
|
+
recordConflictResolution,
|
|
1296
|
+
MemoryGraph,
|
|
1297
|
+
EngineeringMemoryStore,
|
|
1298
|
+
getEngineeringMemoryStore,
|
|
1299
|
+
retrieveRelevantMemories,
|
|
1300
|
+
extractEngineeringMemory,
|
|
1301
|
+
SkillTelemetryRegistry,
|
|
1302
|
+
getSkillTelemetryRegistry,
|
|
1303
|
+
CapabilityGapTracker,
|
|
1304
|
+
getCapabilityGapTracker,
|
|
1305
|
+
PROPOSAL_STATUS,
|
|
1306
|
+
SkillImprovementManager,
|
|
1307
|
+
getSkillImprovementManager,
|
|
1308
|
+
Phase5MetricsTracker,
|
|
1309
|
+
getPhase5MetricsTracker,
|
|
1310
|
+
// Phase 6: System Simulation & Pre-Mortem Intelligence
|
|
1311
|
+
FAILURE_TAXONOMY,
|
|
1312
|
+
BLAST_RADIUS_TIERS,
|
|
1313
|
+
SIMULATION_LEVELS,
|
|
1314
|
+
PREDICTION_STATUS,
|
|
1315
|
+
createPredictionRecord,
|
|
1316
|
+
analyzeBlastRadius,
|
|
1317
|
+
buildFailureChains,
|
|
1318
|
+
simulateDependencyFailures,
|
|
1319
|
+
simulateConcurrencyRisks,
|
|
1320
|
+
simulateRetryAmplification,
|
|
1321
|
+
simulateDatabaseFailures,
|
|
1322
|
+
simulateQueueFailures,
|
|
1323
|
+
simulateCacheFailures,
|
|
1324
|
+
simulateCapacityAndQueueing,
|
|
1325
|
+
simulateLatencyBudget,
|
|
1326
|
+
runSecurityPreMortem,
|
|
1327
|
+
runAgentPreMortem,
|
|
1328
|
+
runCostPreMortem,
|
|
1329
|
+
simulateDeploymentAndRecovery,
|
|
1330
|
+
generateChaosScenarios,
|
|
1331
|
+
detectUnsupportedClaims,
|
|
1332
|
+
determineSimulationLevel,
|
|
1333
|
+
runPreMortem,
|
|
1334
|
+
comparePredictionsWithObserved,
|
|
1335
|
+
Phase6MetricsTracker,
|
|
1336
|
+
getPhase6MetricsTracker,
|
|
1337
|
+
// Phase 9: Cross-Domain Engineering Intelligence
|
|
1338
|
+
RELATIONSHIP_TYPES,
|
|
1339
|
+
INTERACTION_PRIORITY,
|
|
1340
|
+
INTERACTION_CONFIDENCE,
|
|
1341
|
+
runCrossDomainAnalysis,
|
|
1342
|
+
Phase9MetricsTracker,
|
|
1343
|
+
getPhase9MetricsTracker,
|
|
1344
|
+
// Phase 10: Engineering Outcome Optimization Engine
|
|
1345
|
+
OUTCOME_INVARIANT,
|
|
1346
|
+
REQUIREMENT_SOURCES,
|
|
1347
|
+
REQUIREMENT_CATEGORIES,
|
|
1348
|
+
COMPLEXITY_BUDGETS,
|
|
1349
|
+
ASSUMPTION_STATUS,
|
|
1350
|
+
CAPABILITY_DEPTH,
|
|
1351
|
+
REASONING_DEPTH,
|
|
1352
|
+
discoverRequirements,
|
|
1353
|
+
evaluateComplexityBudget,
|
|
1354
|
+
auditArchitectureJustification,
|
|
1355
|
+
generateDecisionRecords,
|
|
1356
|
+
analyzeAssumptionsAndUnknowns,
|
|
1357
|
+
buildSolutionShape,
|
|
1358
|
+
verifyOutcomeAndRegressions,
|
|
1359
|
+
runOutcomeOptimization,
|
|
1360
|
+
evaluateSkillSelection,
|
|
1361
|
+
Phase10OutcomeMemory,
|
|
1362
|
+
getPhase10OutcomeMemory,
|
|
1363
|
+
runAntiShortcutCheck,
|
|
1364
|
+
runAntiOverengineeringCheck,
|
|
1365
|
+
Phase10MetricsTracker,
|
|
1366
|
+
getPhase10MetricsTracker,
|
|
1367
|
+
};
|
|
1368
|
+
|
|
1369
|
+
if (require.main === module) {
|
|
1370
|
+
main();
|
|
1371
|
+
}
|