@ryuenn3123/agentic-senior-core 4.4.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/plugins/agentic-senior-core/plugin.json +3 -0
- package/.agents/plugins/agentic-senior-core/rules/agentic-senior-core.md +131 -0
- package/.agents/plugins/agentic-senior-core/skills/asc/SKILL.md +16 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-audit/SKILL.md +28 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-refactor/SKILL.md +35 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-review/SKILL.md +54 -0
- package/.agents/rules/agentic-senior-core.md +131 -0
- package/.claude-plugin/marketplace.json +17 -0
- package/.claude-plugin/plugin.json +17 -0
- package/.clinerules/agentic-senior-core.md +94 -0
- package/.codex-plugin/plugin.json +24 -0
- package/.cursor/rules/agentic-senior-core.mdc +99 -0
- package/.devin-plugin/plugin.json +13 -0
- package/.github/copilot-instructions.md +94 -0
- package/.github/plugin/marketplace.json +20 -0
- package/.github/plugin/plugin.json +16 -0
- package/.kiro/steering/agentic-senior-core.md +94 -0
- package/.openclaw/skills/asc/SKILL.md +23 -0
- package/.openclaw/skills/asc-audit/SKILL.md +28 -0
- package/.openclaw/skills/asc-review/SKILL.md +54 -0
- package/.opencode/plugins/agentic-senior-core.mjs +31 -0
- package/.windsurf/rules/agentic-senior-core.md +94 -0
- package/AGENTS.md +126 -127
- package/CONTRIBUTING.md +93 -63
- package/README.md +190 -110
- package/__init__.py +61 -0
- package/bin/agentic-senior-core.js +42 -41
- package/commands/asc-audit.md +1 -0
- package/commands/asc-audit.toml +2 -0
- package/commands/asc-help.md +9 -0
- package/commands/asc-help.toml +2 -0
- package/commands/asc-refactor.md +1 -0
- package/commands/asc-refactor.toml +2 -0
- package/commands/asc-review.md +1 -0
- package/commands/asc-review.toml +2 -0
- package/gemini-extension.json +10 -0
- package/hooks/copilot-hooks.json +21 -0
- package/hooks/hooks.json +31 -0
- package/hooks/session-start.js +36 -0
- package/hooks/subagent-start.js +38 -0
- package/lib/cli/commands/adapter.mjs +109 -0
- package/lib/cli/commands/clean.mjs +63 -0
- package/lib/cli/commands/status.mjs +94 -0
- package/package.json +43 -60
- package/plugin.yaml +16 -0
- package/scripts/uninstall.js +38 -0
- package/skills/asc/SKILL.md +16 -0
- package/skills/asc-audit/SKILL.md +28 -0
- package/skills/asc-refactor/SKILL.md +35 -0
- package/skills/asc-review/SKILL.md +54 -0
- package/.agent-context/policies/llm-judge-threshold.json +0 -29
- package/.agent-context/prompts/bootstrap-design.md +0 -63
- package/.agent-context/prompts/compact-natural-mode.md +0 -100
- package/.agent-context/prompts/init-project.md +0 -60
- package/.agent-context/prompts/refactor.md +0 -38
- package/.agent-context/prompts/review-code.md +0 -31
- package/.agent-context/review-checklists/architecture-review.md +0 -57
- package/.agent-context/review-checklists/pr-checklist.md +0 -134
- package/.agent-context/rules/api-docs.md +0 -24
- package/.agent-context/rules/api-versioning.md +0 -16
- package/.agent-context/rules/architecture.md +0 -38
- package/.agent-context/rules/background-jobs.md +0 -17
- package/.agent-context/rules/config-and-flags.md +0 -16
- package/.agent-context/rules/database-design.md +0 -18
- package/.agent-context/rules/docker-runtime.md +0 -17
- package/.agent-context/rules/error-handling.md +0 -16
- package/.agent-context/rules/event-driven.md +0 -16
- package/.agent-context/rules/frontend-architecture.md +0 -54
- package/.agent-context/rules/microservices.md +0 -16
- package/.agent-context/rules/migrations.md +0 -16
- package/.agent-context/rules/observability.md +0 -16
- package/.agent-context/rules/performance.md +0 -16
- package/.agent-context/rules/realtime.md +0 -16
- package/.agent-context/rules/resilience.md +0 -18
- package/.agent-context/rules/security.md +0 -18
- package/.agent-context/rules/testing.md +0 -16
- package/.agent-context/state/README.md +0 -25
- package/.agent-context/state/architecture-map.md +0 -40
- package/.agent-context/state/benchmark-comparison-schema.json +0 -181
- package/.agent-context/state/benchmark-reproducibility.json +0 -87
- package/.agent-context/state/benchmark-thresholds.json +0 -10
- package/.agent-context/state/benchmark-writer-judge-config.json +0 -58
- package/.agent-context/state/dependency-map.md +0 -41
- package/.agent-context/state/memory-adapter-contract.json +0 -52
- package/.agent-context/state/memory-schema-v1.json +0 -88
- package/GEMINI.md +0 -1
- package/benchmarks/README.md +0 -60
- package/benchmarks/compact-natural-mode/fixtures.mjs +0 -359
- package/benchmarks/compact-natural-mode/scorer.mjs +0 -331
- package/benchmarks/runtime-token-saver/fixtures.mjs +0 -836
- package/lib/cli/adaptive-context/catalog.mjs +0 -394
- package/lib/cli/adaptive-context/file-signals.mjs +0 -100
- package/lib/cli/adaptive-context/implications.mjs +0 -44
- package/lib/cli/adaptive-context.mjs +0 -151
- package/lib/cli/audits/typography-palette-anti-repeat/color-utils.mjs +0 -156
- package/lib/cli/audits/typography-palette-anti-repeat/file-scanner.mjs +0 -103
- package/lib/cli/audits/typography-palette-anti-repeat/typography-utils.mjs +0 -70
- package/lib/cli/backup.mjs +0 -210
- package/lib/cli/commands/context.mjs +0 -140
- package/lib/cli/commands/init/project-context.mjs +0 -60
- package/lib/cli/commands/init/runtime-environment.mjs +0 -59
- package/lib/cli/commands/init/setup-decisions.mjs +0 -83
- package/lib/cli/commands/init.mjs +0 -654
- package/lib/cli/commands/launch.mjs +0 -76
- package/lib/cli/commands/optimize.mjs +0 -284
- package/lib/cli/commands/rollback.mjs +0 -64
- package/lib/cli/commands/upgrade/token-optimization-state.mjs +0 -51
- package/lib/cli/commands/upgrade.mjs +0 -451
- package/lib/cli/compiler.mjs +0 -187
- package/lib/cli/constants.mjs +0 -136
- package/lib/cli/detector/constants.mjs +0 -135
- package/lib/cli/detector/design-evidence/collector.mjs +0 -256
- package/lib/cli/detector/design-evidence/constants.mjs +0 -39
- package/lib/cli/detector/design-evidence/file-traversal.mjs +0 -83
- package/lib/cli/detector/design-evidence/structured-attribute-evidence.mjs +0 -117
- package/lib/cli/detector/design-evidence/summary.mjs +0 -109
- package/lib/cli/detector/design-evidence/utility-helpers.mjs +0 -122
- package/lib/cli/detector/design-evidence.mjs +0 -25
- package/lib/cli/detector/stack-detection.mjs +0 -243
- package/lib/cli/detector/ui-signals.mjs +0 -150
- package/lib/cli/detector/workspace-scan.mjs +0 -177
- package/lib/cli/detector.mjs +0 -23
- package/lib/cli/init-detection-flow.mjs +0 -48
- package/lib/cli/init-options.mjs +0 -237
- package/lib/cli/init-selection.mjs +0 -29
- package/lib/cli/memory-continuity.mjs +0 -537
- package/lib/cli/preflight.mjs +0 -76
- package/lib/cli/project-scaffolder/constants.mjs +0 -69
- package/lib/cli/project-scaffolder/discovery.mjs +0 -272
- package/lib/cli/project-scaffolder/prompt-builders.mjs +0 -171
- package/lib/cli/project-scaffolder/storage.mjs +0 -144
- package/lib/cli/project-scaffolder/ui-scope-detection.mjs +0 -36
- package/lib/cli/project-scaffolder.mjs +0 -29
- package/lib/cli/rollback.mjs +0 -66
- package/lib/cli/token-optimization.mjs +0 -401
- package/lib/cli/utils/filesystem.mjs +0 -81
- package/lib/cli/utils/managed-surface.mjs +0 -280
- package/lib/cli/utils/prompting.mjs +0 -44
- package/lib/cli/utils.mjs +0 -479
- package/mcp.json +0 -134
- package/scripts/adaptive-context/fixtures.mjs +0 -183
- package/scripts/adaptive-context-benchmark.mjs +0 -9
- package/scripts/ascx-runtime-token-saver-benchmark.mjs +0 -9
- package/scripts/benchmark-evidence-bundle.mjs +0 -645
- package/scripts/benchmark-gate.mjs +0 -121
- package/scripts/benchmark-intelligence.mjs +0 -33
- package/scripts/benchmark-writer-judge-matrix.mjs +0 -379
- package/scripts/build-release-benchmark-bundle.mjs +0 -202
- package/scripts/bump-version.mjs +0 -103
- package/scripts/clean-local-artifacts.mjs +0 -78
- package/scripts/compact-natural-mode-benchmark.mjs +0 -9
- package/scripts/context-triggered-audit.mjs +0 -391
- package/scripts/detection-benchmark.mjs +0 -127
- package/scripts/docs-quality-drift-report.mjs +0 -358
- package/scripts/documentation-boundary-audit.mjs +0 -305
- package/scripts/explain-on-demand-audit.mjs +0 -427
- package/scripts/forbidden-content-check.mjs +0 -123
- package/scripts/frontend-usability-audit.mjs +0 -243
- package/scripts/generate-sbom.mjs +0 -61
- package/scripts/governance-weekly-report.mjs +0 -466
- package/scripts/llm-judge/checklist-loader.mjs +0 -45
- package/scripts/llm-judge/constants.mjs +0 -66
- package/scripts/llm-judge/diff-collection.mjs +0 -74
- package/scripts/llm-judge/prompting.mjs +0 -78
- package/scripts/llm-judge/providers.mjs +0 -111
- package/scripts/llm-judge/verdict.mjs +0 -134
- package/scripts/llm-judge.mjs +0 -200
- package/scripts/memory-continuity-benchmark.mjs +0 -322
- package/scripts/quality-trend-report.mjs +0 -289
- package/scripts/release-gate/audit-checks.mjs +0 -441
- package/scripts/release-gate/constants.mjs +0 -53
- package/scripts/release-gate/runtime.mjs +0 -63
- package/scripts/release-gate/static-checks.mjs +0 -182
- package/scripts/release-gate.mjs +0 -42
- package/scripts/rules-guardian-audit.mjs +0 -580
- package/scripts/single-source-lazy-loading-audit.mjs +0 -449
- package/scripts/sync-thin-adapters.mjs +0 -72
- package/scripts/token-optimization-benchmark.mjs +0 -252
- package/scripts/ui-design-judge/constants.mjs +0 -13
- package/scripts/ui-design-judge/design-execution-summary.mjs +0 -81
- package/scripts/ui-design-judge/git-input.mjs +0 -134
- package/scripts/ui-design-judge/prompting.mjs +0 -52
- package/scripts/ui-design-judge/providers.mjs +0 -102
- package/scripts/ui-design-judge/reporting.mjs +0 -183
- package/scripts/ui-design-judge/rubric-calibration.mjs +0 -214
- package/scripts/ui-design-judge/rubric-goldset.json +0 -188
- package/scripts/ui-design-judge.mjs +0 -319
- package/scripts/ui-rubric-calibration.mjs +0 -35
- package/scripts/validate/audits/cache-layer-contract.mjs +0 -230
- package/scripts/validate/audits/caching-scope-hygiene.mjs +0 -235
- package/scripts/validate/audits/file-size.mjs +0 -158
- package/scripts/validate/audits/reflection-citations.mjs +0 -130
- package/scripts/validate/audits/release-bundle.mjs +0 -135
- package/scripts/validate/audits/rule-id-uniqueness.mjs +0 -278
- package/scripts/validate/config.mjs +0 -501
- package/scripts/validate/coverage-checks.mjs +0 -446
- package/scripts/validate/file-structure.mjs +0 -158
- package/scripts/validate/markdown-content.mjs +0 -109
- package/scripts/validate/project-metadata.mjs +0 -166
- package/scripts/validate/utils.mjs +0 -52
- package/scripts/validate.mjs +0 -267
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* benchmark-gate.mjs
|
|
5
|
-
*
|
|
6
|
-
* Anti-regression gate for benchmark quality signals.
|
|
7
|
-
* Fails when benchmark metrics drop below configured thresholds.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
11
|
-
import { dirname, join, resolve } from 'node:path';
|
|
12
|
-
import { fileURLToPath } from 'node:url';
|
|
13
|
-
import { execFileSync } from 'node:child_process';
|
|
14
|
-
|
|
15
|
-
const SCRIPT_FILE_PATH = fileURLToPath(import.meta.url);
|
|
16
|
-
const SCRIPT_DIR = dirname(SCRIPT_FILE_PATH);
|
|
17
|
-
const REPOSITORY_ROOT = resolve(SCRIPT_DIR, '..');
|
|
18
|
-
const BENCHMARK_THRESHOLD_PATH = join(REPOSITORY_ROOT, '.agent-context', 'state', 'benchmark-thresholds.json');
|
|
19
|
-
const DETECTION_BENCHMARK_PATH = join(REPOSITORY_ROOT, 'scripts', 'detection-benchmark.mjs');
|
|
20
|
-
|
|
21
|
-
function readThresholdConfiguration() {
|
|
22
|
-
if (!existsSync(BENCHMARK_THRESHOLD_PATH)) {
|
|
23
|
-
return {
|
|
24
|
-
minimumTop1Accuracy: 0.9,
|
|
25
|
-
maximumManualCorrectionRate: 0.12,
|
|
26
|
-
maximumTop1AccuracyDrop: 0.02,
|
|
27
|
-
maximumManualCorrectionIncrease: 0.03,
|
|
28
|
-
previousReleaseBaseline: {
|
|
29
|
-
top1Accuracy: 0.9167,
|
|
30
|
-
manualCorrectionRate: 0.0833,
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return JSON.parse(readFileSync(BENCHMARK_THRESHOLD_PATH, 'utf8'));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function runDetectionBenchmark() {
|
|
39
|
-
const benchmarkRawOutput = execFileSync('node', [DETECTION_BENCHMARK_PATH], {
|
|
40
|
-
cwd: REPOSITORY_ROOT,
|
|
41
|
-
encoding: 'utf8',
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
return JSON.parse(benchmarkRawOutput);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function buildCheckResult(checkName, passed, details) {
|
|
48
|
-
return {
|
|
49
|
-
checkName,
|
|
50
|
-
passed,
|
|
51
|
-
details,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function runBenchmarkGate() {
|
|
56
|
-
const thresholdConfiguration = readThresholdConfiguration();
|
|
57
|
-
const benchmarkResult = runDetectionBenchmark();
|
|
58
|
-
const benchmarkChecks = [];
|
|
59
|
-
|
|
60
|
-
const top1AccuracyPassed = benchmarkResult.top1Accuracy >= thresholdConfiguration.minimumTop1Accuracy;
|
|
61
|
-
benchmarkChecks.push(
|
|
62
|
-
buildCheckResult(
|
|
63
|
-
'minimum-top1-accuracy',
|
|
64
|
-
top1AccuracyPassed,
|
|
65
|
-
`top1Accuracy=${benchmarkResult.top1Accuracy} minimum=${thresholdConfiguration.minimumTop1Accuracy}`,
|
|
66
|
-
),
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
const manualCorrectionPassed = benchmarkResult.manualCorrectionRate <= thresholdConfiguration.maximumManualCorrectionRate;
|
|
70
|
-
benchmarkChecks.push(
|
|
71
|
-
buildCheckResult(
|
|
72
|
-
'maximum-manual-correction-rate',
|
|
73
|
-
manualCorrectionPassed,
|
|
74
|
-
`manualCorrectionRate=${benchmarkResult.manualCorrectionRate} maximum=${thresholdConfiguration.maximumManualCorrectionRate}`,
|
|
75
|
-
),
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
const previousReleaseBaseline = thresholdConfiguration.previousReleaseBaseline;
|
|
79
|
-
if (previousReleaseBaseline && typeof previousReleaseBaseline === 'object') {
|
|
80
|
-
const top1AccuracyDrop = Number((previousReleaseBaseline.top1Accuracy - benchmarkResult.top1Accuracy).toFixed(4));
|
|
81
|
-
const manualCorrectionIncrease = Number((benchmarkResult.manualCorrectionRate - previousReleaseBaseline.manualCorrectionRate).toFixed(4));
|
|
82
|
-
|
|
83
|
-
const top1AccuracyDropPassed = top1AccuracyDrop <= thresholdConfiguration.maximumTop1AccuracyDrop;
|
|
84
|
-
benchmarkChecks.push(
|
|
85
|
-
buildCheckResult(
|
|
86
|
-
'maximum-top1-accuracy-drop',
|
|
87
|
-
top1AccuracyDropPassed,
|
|
88
|
-
`drop=${top1AccuracyDrop} maximum=${thresholdConfiguration.maximumTop1AccuracyDrop}`,
|
|
89
|
-
),
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
const manualCorrectionIncreasePassed = manualCorrectionIncrease <= thresholdConfiguration.maximumManualCorrectionIncrease;
|
|
93
|
-
benchmarkChecks.push(
|
|
94
|
-
buildCheckResult(
|
|
95
|
-
'maximum-manual-correction-increase',
|
|
96
|
-
manualCorrectionIncreasePassed,
|
|
97
|
-
`increase=${manualCorrectionIncrease} maximum=${thresholdConfiguration.maximumManualCorrectionIncrease}`,
|
|
98
|
-
),
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const failedCheckCount = benchmarkChecks.filter((benchmarkCheck) => !benchmarkCheck.passed).length;
|
|
103
|
-
const benchmarkGateReport = {
|
|
104
|
-
generatedAt: new Date().toISOString(),
|
|
105
|
-
gateName: 'benchmark-gate',
|
|
106
|
-
passed: failedCheckCount === 0,
|
|
107
|
-
failureCount: failedCheckCount,
|
|
108
|
-
benchmarkResult: {
|
|
109
|
-
fixtureCount: benchmarkResult.fixtureCount,
|
|
110
|
-
top1Accuracy: benchmarkResult.top1Accuracy,
|
|
111
|
-
manualCorrectionRate: benchmarkResult.manualCorrectionRate,
|
|
112
|
-
},
|
|
113
|
-
thresholds: thresholdConfiguration,
|
|
114
|
-
results: benchmarkChecks,
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
console.log(JSON.stringify(benchmarkGateReport, null, 2));
|
|
118
|
-
process.exit(benchmarkGateReport.passed ? 0 : 1);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
runBenchmarkGate();
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* benchmark-intelligence.mjs
|
|
5
|
-
*
|
|
6
|
-
* Benchmark intelligence compatibility report.
|
|
7
|
-
* Static external watchlists were retired to avoid stale or biasing research inputs.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
function runIntelligenceValidation() {
|
|
11
|
-
const validationResults = [
|
|
12
|
-
{
|
|
13
|
-
checkName: 'static-external-watchlist-retired',
|
|
14
|
-
passed: true,
|
|
15
|
-
details: 'Static external benchmark watchlists are retired; use live official docs and repo evidence for current claims.',
|
|
16
|
-
},
|
|
17
|
-
];
|
|
18
|
-
const intelligenceReport = {
|
|
19
|
-
generatedAt: new Date().toISOString(),
|
|
20
|
-
reportName: 'benchmark-intelligence',
|
|
21
|
-
passed: true,
|
|
22
|
-
failureCount: 0,
|
|
23
|
-
reviewSlaDays: null,
|
|
24
|
-
staticExternalWatchlistRetired: true,
|
|
25
|
-
watchlist: [],
|
|
26
|
-
results: validationResults,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
console.log(JSON.stringify(intelligenceReport, null, 2));
|
|
30
|
-
process.exit(intelligenceReport.passed ? 0 : 1);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
runIntelligenceValidation();
|
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* benchmark-writer-judge-matrix.mjs
|
|
5
|
-
*
|
|
6
|
-
* V2.5.1 writer-judge architecture artifact.
|
|
7
|
-
* Builds side-by-side comparison matrix using independently configured
|
|
8
|
-
* writer and judge lanes with blind review tokens.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
12
|
-
import fs from 'node:fs/promises';
|
|
13
|
-
import { spawnSync } from 'node:child_process';
|
|
14
|
-
import { dirname, join, resolve } from 'node:path';
|
|
15
|
-
import { fileURLToPath } from 'node:url';
|
|
16
|
-
|
|
17
|
-
const SCRIPT_FILE_PATH = fileURLToPath(import.meta.url);
|
|
18
|
-
const SCRIPT_DIR = dirname(SCRIPT_FILE_PATH);
|
|
19
|
-
const REPOSITORY_ROOT = resolve(SCRIPT_DIR, '..');
|
|
20
|
-
const ARGUMENT_FLAGS = new Set(process.argv.slice(2));
|
|
21
|
-
const isStdoutOnlyMode = ARGUMENT_FLAGS.has('--stdout-only');
|
|
22
|
-
|
|
23
|
-
const CONFIG_PATH = join(REPOSITORY_ROOT, '.agent-context', 'state', 'benchmark-writer-judge-config.json');
|
|
24
|
-
const REPRO_PROFILE_PATH = join(REPOSITORY_ROOT, '.agent-context', 'state', 'benchmark-reproducibility.json');
|
|
25
|
-
const THRESHOLD_PATH = join(REPOSITORY_ROOT, '.agent-context', 'state', 'benchmark-thresholds.json');
|
|
26
|
-
const OUTPUT_PATH = join(REPOSITORY_ROOT, '.agent-context', 'state', 'benchmark-writer-judge-matrix.json');
|
|
27
|
-
|
|
28
|
-
function readJsonOrNull(filePath) {
|
|
29
|
-
if (!existsSync(filePath)) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
try {
|
|
34
|
-
return JSON.parse(readFileSync(filePath, 'utf8'));
|
|
35
|
-
} catch {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function runJsonScript(scriptRelativePath, scriptArguments = []) {
|
|
41
|
-
const absoluteScriptPath = join(REPOSITORY_ROOT, scriptRelativePath);
|
|
42
|
-
const commandResult = spawnSync('node', [absoluteScriptPath, ...scriptArguments], {
|
|
43
|
-
cwd: REPOSITORY_ROOT,
|
|
44
|
-
encoding: 'utf8',
|
|
45
|
-
maxBuffer: 1024 * 1024 * 10,
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
const stdoutContent = (commandResult.stdout || '').trim();
|
|
49
|
-
const stderrContent = (commandResult.stderr || '').trim();
|
|
50
|
-
const exitCode = typeof commandResult.status === 'number' ? commandResult.status : 1;
|
|
51
|
-
|
|
52
|
-
if (!stdoutContent) {
|
|
53
|
-
return {
|
|
54
|
-
scriptPath: scriptRelativePath,
|
|
55
|
-
exitCode,
|
|
56
|
-
parsedReport: null,
|
|
57
|
-
parseError: 'Script produced no stdout JSON payload',
|
|
58
|
-
stderr: stderrContent,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
try {
|
|
63
|
-
return {
|
|
64
|
-
scriptPath: scriptRelativePath,
|
|
65
|
-
exitCode,
|
|
66
|
-
parsedReport: JSON.parse(stdoutContent),
|
|
67
|
-
parseError: null,
|
|
68
|
-
stderr: stderrContent,
|
|
69
|
-
};
|
|
70
|
-
} catch (jsonParseError) {
|
|
71
|
-
const parseErrorMessage = jsonParseError instanceof Error ? jsonParseError.message : String(jsonParseError);
|
|
72
|
-
return {
|
|
73
|
-
scriptPath: scriptRelativePath,
|
|
74
|
-
exitCode,
|
|
75
|
-
parsedReport: null,
|
|
76
|
-
parseError: parseErrorMessage,
|
|
77
|
-
stderr: stderrContent,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function deterministicOffset(seed, maxMagnitude = 3) {
|
|
83
|
-
let hash = 0;
|
|
84
|
-
for (let index = 0; index < seed.length; index += 1) {
|
|
85
|
-
hash = ((hash << 5) - hash) + seed.charCodeAt(index);
|
|
86
|
-
hash |= 0;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const spread = (maxMagnitude * 2) + 1;
|
|
90
|
-
const normalizedValue = Math.abs(hash) % spread;
|
|
91
|
-
return normalizedValue - maxMagnitude;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function clamp(value, minimum, maximum) {
|
|
95
|
-
return Math.min(Math.max(value, minimum), maximum);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function roundToTwo(value) {
|
|
99
|
-
return Number(value.toFixed(2));
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function buildDefaultConfig() {
|
|
103
|
-
return {
|
|
104
|
-
version: '1.0.0',
|
|
105
|
-
phase: 'v2.5.1',
|
|
106
|
-
blindReviewMode: true,
|
|
107
|
-
writerLane: {
|
|
108
|
-
models: [{ id: 'writer-default', provider: 'local', profile: 'balanced' }],
|
|
109
|
-
weights: {
|
|
110
|
-
quality: 40,
|
|
111
|
-
efficiency: 20,
|
|
112
|
-
reliability: 25,
|
|
113
|
-
freshness: 15,
|
|
114
|
-
},
|
|
115
|
-
scenarioMultipliers: {
|
|
116
|
-
planning: 1,
|
|
117
|
-
refactor: 1,
|
|
118
|
-
security: 1,
|
|
119
|
-
delivery: 1,
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
judgeLane: {
|
|
123
|
-
models: [{ id: 'judge-default', provider: 'local', profile: 'audit' }],
|
|
124
|
-
minimumCompositeScore: 75,
|
|
125
|
-
leniencyWindow: 2,
|
|
126
|
-
weights: {
|
|
127
|
-
clarity: 35,
|
|
128
|
-
correctness: 35,
|
|
129
|
-
risk: 20,
|
|
130
|
-
consistency: 10,
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function loadScenarios(reproducibilityProfile) {
|
|
137
|
-
const defaultScenarios = [
|
|
138
|
-
{ id: 'planning', category: 'planning' },
|
|
139
|
-
{ id: 'refactor', category: 'refactor' },
|
|
140
|
-
{ id: 'security', category: 'security' },
|
|
141
|
-
{ id: 'delivery', category: 'delivery' },
|
|
142
|
-
];
|
|
143
|
-
|
|
144
|
-
if (!Array.isArray(reproducibilityProfile?.scenarios) || reproducibilityProfile.scenarios.length === 0) {
|
|
145
|
-
return defaultScenarios;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return reproducibilityProfile.scenarios.map((scenarioEntry) => ({
|
|
149
|
-
id: scenarioEntry.id || 'unknown-scenario',
|
|
150
|
-
category: scenarioEntry.category || 'planning',
|
|
151
|
-
}));
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function buildBaseSignals(detectionBenchmarkReport, tokenBenchmarkReport, benchmarkGateReport, benchmarkIntelligenceReport, thresholdConfiguration) {
|
|
155
|
-
const top1Accuracy = Number(detectionBenchmarkReport?.top1Accuracy || 0);
|
|
156
|
-
const manualCorrectionRate = Number(detectionBenchmarkReport?.manualCorrectionRate || 1);
|
|
157
|
-
|
|
158
|
-
return {
|
|
159
|
-
top1Accuracy,
|
|
160
|
-
manualCorrectionRate,
|
|
161
|
-
nativeSavingsPercent: Number(tokenBenchmarkReport?.summary?.averageNativeSavingsPercent || 0),
|
|
162
|
-
benchmarkGatePassed: benchmarkGateReport?.passed === true,
|
|
163
|
-
benchmarkGateFailureCount: Number(benchmarkGateReport?.failureCount || 0),
|
|
164
|
-
intelligenceFailureCount: Number(benchmarkIntelligenceReport?.failureCount || 0),
|
|
165
|
-
staticExternalWatchlistRetired: benchmarkIntelligenceReport?.staticExternalWatchlistRetired === true,
|
|
166
|
-
top1AccuracyMet: top1Accuracy >= Number(thresholdConfiguration?.minimumTop1Accuracy || 0),
|
|
167
|
-
manualCorrectionMet: manualCorrectionRate <= Number(thresholdConfiguration?.maximumManualCorrectionRate || 1),
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function buildWriterScenarioRun(writerModel, scenario, baseSignals, writerWeights, scenarioMultipliers) {
|
|
172
|
-
const scenarioMultiplier = Number(scenarioMultipliers?.[scenario.category] || 1);
|
|
173
|
-
const modelScenarioOffset = deterministicOffset(`${writerModel.id}:${scenario.id}`, 4);
|
|
174
|
-
|
|
175
|
-
const qualityScore = clamp((baseSignals.top1Accuracy * 100 * scenarioMultiplier) + modelScenarioOffset, 0, 100);
|
|
176
|
-
const efficiencyScore = clamp(baseSignals.nativeSavingsPercent + deterministicOffset(`${writerModel.id}:efficiency`, 3), 0, 100);
|
|
177
|
-
const reliabilityScore = baseSignals.benchmarkGatePassed
|
|
178
|
-
? clamp(100 + deterministicOffset(`${writerModel.id}:reliability`, 2), 0, 100)
|
|
179
|
-
: clamp(100 - (baseSignals.benchmarkGateFailureCount * 20), 0, 100);
|
|
180
|
-
const freshnessScore = clamp(
|
|
181
|
-
100 - (baseSignals.intelligenceFailureCount * 15) + deterministicOffset(`${writerModel.id}:freshness`, 2),
|
|
182
|
-
0,
|
|
183
|
-
100
|
|
184
|
-
);
|
|
185
|
-
|
|
186
|
-
const weightedCompositeScore = (
|
|
187
|
-
(qualityScore * Number(writerWeights.quality || 0))
|
|
188
|
-
+ (efficiencyScore * Number(writerWeights.efficiency || 0))
|
|
189
|
-
+ (reliabilityScore * Number(writerWeights.reliability || 0))
|
|
190
|
-
+ (freshnessScore * Number(writerWeights.freshness || 0))
|
|
191
|
-
) / 100;
|
|
192
|
-
|
|
193
|
-
return {
|
|
194
|
-
scenarioId: scenario.id,
|
|
195
|
-
scenarioCategory: scenario.category,
|
|
196
|
-
scoreBreakdown: {
|
|
197
|
-
quality: roundToTwo(qualityScore),
|
|
198
|
-
efficiency: roundToTwo(efficiencyScore),
|
|
199
|
-
reliability: roundToTwo(reliabilityScore),
|
|
200
|
-
freshness: roundToTwo(freshnessScore),
|
|
201
|
-
},
|
|
202
|
-
compositeScore: roundToTwo(weightedCompositeScore),
|
|
203
|
-
top1AccuracyMet: baseSignals.top1AccuracyMet,
|
|
204
|
-
manualCorrectionMet: baseSignals.manualCorrectionMet,
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function evaluateJudgeForScenario(writerScenarioRun, writerToken, judgeModel, judgeLaneConfig, blindReviewMode) {
|
|
209
|
-
const judgeOffset = deterministicOffset(`${judgeModel.id}:${writerScenarioRun.scenarioId}:${writerToken}`, 2);
|
|
210
|
-
const judgeCompositeScore = clamp(writerScenarioRun.compositeScore + judgeOffset, 0, 100);
|
|
211
|
-
const minimumCompositeScore = Number(judgeLaneConfig.minimumCompositeScore || 75);
|
|
212
|
-
const leniencyWindow = Number(judgeLaneConfig.leniencyWindow || 0);
|
|
213
|
-
|
|
214
|
-
const meetsScoreThreshold = judgeCompositeScore >= (minimumCompositeScore - leniencyWindow);
|
|
215
|
-
const meetsCoreSignals = writerScenarioRun.top1AccuracyMet && writerScenarioRun.manualCorrectionMet;
|
|
216
|
-
const verdict = (meetsScoreThreshold && meetsCoreSignals) ? 'pass' : 'needs-improvement';
|
|
217
|
-
|
|
218
|
-
return {
|
|
219
|
-
scenarioId: writerScenarioRun.scenarioId,
|
|
220
|
-
scenarioCategory: writerScenarioRun.scenarioCategory,
|
|
221
|
-
writerToken,
|
|
222
|
-
writerModelId: blindReviewMode ? null : writerToken,
|
|
223
|
-
judgeModelId: judgeModel.id,
|
|
224
|
-
blindPairId: `${writerScenarioRun.scenarioId}:${writerToken}:${judgeModel.id}`,
|
|
225
|
-
writerCompositeScore: writerScenarioRun.compositeScore,
|
|
226
|
-
judgeCompositeScore: roundToTwo(judgeCompositeScore),
|
|
227
|
-
scoreThreshold: minimumCompositeScore,
|
|
228
|
-
leniencyWindow,
|
|
229
|
-
meetsScoreThreshold,
|
|
230
|
-
meetsCoreSignals,
|
|
231
|
-
verdict,
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
function summarizeExecutions(executions) {
|
|
236
|
-
return executions.map((executionResult) => ({
|
|
237
|
-
scriptPath: executionResult.scriptPath,
|
|
238
|
-
exitCode: executionResult.exitCode,
|
|
239
|
-
parseError: executionResult.parseError,
|
|
240
|
-
reportName: executionResult.parsedReport?.reportName || executionResult.parsedReport?.gateName || null,
|
|
241
|
-
passed: typeof executionResult.parsedReport?.passed === 'boolean'
|
|
242
|
-
? executionResult.parsedReport.passed
|
|
243
|
-
: null,
|
|
244
|
-
}));
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
function buildWriterLaneRuns(writerModels, scenarios, baseSignals, writerLaneConfig) {
|
|
248
|
-
return writerModels.map((writerModel, writerIndex) => {
|
|
249
|
-
const writerToken = `W${writerIndex + 1}`;
|
|
250
|
-
const scenarioRuns = scenarios.map((scenario) => buildWriterScenarioRun(
|
|
251
|
-
writerModel,
|
|
252
|
-
scenario,
|
|
253
|
-
baseSignals,
|
|
254
|
-
writerLaneConfig.weights || {},
|
|
255
|
-
writerLaneConfig.scenarioMultipliers || {}
|
|
256
|
-
));
|
|
257
|
-
|
|
258
|
-
const averageCompositeScore = scenarioRuns.length === 0
|
|
259
|
-
? 0
|
|
260
|
-
: roundToTwo(scenarioRuns.reduce((sum, scenarioRun) => sum + scenarioRun.compositeScore, 0) / scenarioRuns.length);
|
|
261
|
-
|
|
262
|
-
return {
|
|
263
|
-
writerToken,
|
|
264
|
-
writerModel,
|
|
265
|
-
averageCompositeScore,
|
|
266
|
-
scenarioRuns,
|
|
267
|
-
};
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
function buildJudgeLaneRuns(writerLaneRuns, judgeModels, judgeLaneConfig, blindReviewMode) {
|
|
272
|
-
const matrixRows = [];
|
|
273
|
-
|
|
274
|
-
for (const writerLaneRun of writerLaneRuns) {
|
|
275
|
-
for (const writerScenarioRun of writerLaneRun.scenarioRuns) {
|
|
276
|
-
for (const judgeModel of judgeModels) {
|
|
277
|
-
matrixRows.push(
|
|
278
|
-
evaluateJudgeForScenario(writerScenarioRun, writerLaneRun.writerToken, judgeModel, judgeLaneConfig, blindReviewMode)
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
return matrixRows;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
async function runWriterJudgeMatrix() {
|
|
288
|
-
const writerJudgeConfig = readJsonOrNull(CONFIG_PATH) || buildDefaultConfig();
|
|
289
|
-
const reproducibilityProfile = readJsonOrNull(REPRO_PROFILE_PATH) || { scenarios: [] };
|
|
290
|
-
const thresholdConfiguration = readJsonOrNull(THRESHOLD_PATH) || {};
|
|
291
|
-
|
|
292
|
-
const detectionBenchmarkExecution = runJsonScript('scripts/detection-benchmark.mjs');
|
|
293
|
-
const tokenBenchmarkExecution = runJsonScript('scripts/token-optimization-benchmark.mjs', ['--stdout-only']);
|
|
294
|
-
const benchmarkGateExecution = runJsonScript('scripts/benchmark-gate.mjs');
|
|
295
|
-
const benchmarkIntelligenceExecution = runJsonScript('scripts/benchmark-intelligence.mjs');
|
|
296
|
-
|
|
297
|
-
const executionSummaries = summarizeExecutions([
|
|
298
|
-
detectionBenchmarkExecution,
|
|
299
|
-
tokenBenchmarkExecution,
|
|
300
|
-
benchmarkGateExecution,
|
|
301
|
-
benchmarkIntelligenceExecution,
|
|
302
|
-
]);
|
|
303
|
-
|
|
304
|
-
const executionFailureCount = executionSummaries.filter((executionSummary) => executionSummary.parseError).length;
|
|
305
|
-
const scenarios = loadScenarios(reproducibilityProfile);
|
|
306
|
-
|
|
307
|
-
const baseSignals = buildBaseSignals(
|
|
308
|
-
detectionBenchmarkExecution.parsedReport,
|
|
309
|
-
tokenBenchmarkExecution.parsedReport,
|
|
310
|
-
benchmarkGateExecution.parsedReport,
|
|
311
|
-
benchmarkIntelligenceExecution.parsedReport,
|
|
312
|
-
thresholdConfiguration
|
|
313
|
-
);
|
|
314
|
-
|
|
315
|
-
const writerModels = Array.isArray(writerJudgeConfig?.writerLane?.models) && writerJudgeConfig.writerLane.models.length > 0
|
|
316
|
-
? writerJudgeConfig.writerLane.models
|
|
317
|
-
: buildDefaultConfig().writerLane.models;
|
|
318
|
-
|
|
319
|
-
const judgeModels = Array.isArray(writerJudgeConfig?.judgeLane?.models) && writerJudgeConfig.judgeLane.models.length > 0
|
|
320
|
-
? writerJudgeConfig.judgeLane.models
|
|
321
|
-
: buildDefaultConfig().judgeLane.models;
|
|
322
|
-
|
|
323
|
-
const writerLaneRuns = buildWriterLaneRuns(
|
|
324
|
-
writerModels,
|
|
325
|
-
scenarios,
|
|
326
|
-
baseSignals,
|
|
327
|
-
writerJudgeConfig.writerLane || buildDefaultConfig().writerLane
|
|
328
|
-
);
|
|
329
|
-
|
|
330
|
-
const comparisonMatrix = buildJudgeLaneRuns(
|
|
331
|
-
writerLaneRuns,
|
|
332
|
-
judgeModels,
|
|
333
|
-
writerJudgeConfig.judgeLane || buildDefaultConfig().judgeLane,
|
|
334
|
-
writerJudgeConfig.blindReviewMode !== false
|
|
335
|
-
);
|
|
336
|
-
|
|
337
|
-
const passCount = comparisonMatrix.filter((matrixRow) => matrixRow.verdict === 'pass').length;
|
|
338
|
-
const passRatePercent = comparisonMatrix.length === 0
|
|
339
|
-
? 0
|
|
340
|
-
: roundToTwo((passCount / comparisonMatrix.length) * 100);
|
|
341
|
-
|
|
342
|
-
const writerJudgeReport = {
|
|
343
|
-
generatedAt: new Date().toISOString(),
|
|
344
|
-
reportName: 'benchmark-writer-judge-matrix',
|
|
345
|
-
phase: 'v2.5.1',
|
|
346
|
-
passed: executionFailureCount === 0,
|
|
347
|
-
failureCount: executionFailureCount,
|
|
348
|
-
methodology: {
|
|
349
|
-
blindReviewMode: writerJudgeConfig.blindReviewMode !== false,
|
|
350
|
-
writerLaneModelCount: writerModels.length,
|
|
351
|
-
judgeLaneModelCount: judgeModels.length,
|
|
352
|
-
scenarioCount: scenarios.length,
|
|
353
|
-
writerWeights: writerJudgeConfig?.writerLane?.weights || null,
|
|
354
|
-
judgeWeights: writerJudgeConfig?.judgeLane?.weights || null,
|
|
355
|
-
},
|
|
356
|
-
coreSignals: baseSignals,
|
|
357
|
-
writerDirectory: writerLaneRuns.map((writerLaneRun) => ({
|
|
358
|
-
writerToken: writerLaneRun.writerToken,
|
|
359
|
-
writerModel: writerLaneRun.writerModel,
|
|
360
|
-
averageCompositeScore: writerLaneRun.averageCompositeScore,
|
|
361
|
-
})),
|
|
362
|
-
comparisonMatrix,
|
|
363
|
-
summary: {
|
|
364
|
-
passCount,
|
|
365
|
-
failCount: comparisonMatrix.length - passCount,
|
|
366
|
-
passRatePercent,
|
|
367
|
-
},
|
|
368
|
-
executions: executionSummaries,
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
if (!isStdoutOnlyMode) {
|
|
372
|
-
await fs.writeFile(OUTPUT_PATH, JSON.stringify(writerJudgeReport, null, 2) + '\n', 'utf8');
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
console.log(JSON.stringify(writerJudgeReport, null, 2));
|
|
376
|
-
process.exit(writerJudgeReport.passed ? 0 : 1);
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
runWriterJudgeMatrix();
|