feat(ms-ai-architect): Spor D steg 2 — score-skill CLI (--json/--gate/--skill) (TDD)

Byggekloss for både SessionStart-surfacing og lifecycle-gate (D3).

- eval.mjs: ekstraher buildReport() (eksportert, testbar) ut av main() —
  samler hele korpus-rapporten (deterministisk + K10 + merget judge-cache).
- lib/skill-score.mjs: formatScoreReport() (ren) — sortert forbedringsrapport
  med score, status, floored/provisional/ujudget-tags og ⚑gulv-markering.
- score-skill.mjs (NY CLI): buildReport → scoreReport → render/json/gate.
  --skill scorer hele korpuset (K10 trenger alle søsken) men rapporterer/gater
  kun den valgte → inkrementell enkelt-skill-scoring for D3 lifecycle-gate.
- docs/development.md: ny «Skill-kvalitetsscore (Spor D)»-seksjon.

Live baseline: advisor 91, governance/security 96 (OK); engineering +
infrastructure 89 (floored av K10-gulv) UNDER mål. Gate exit=1.

Tester: kb-eval 134→142 (+8). validate 239, kb-update 316 uendret grønt.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-06-23 17:16:44 +02:00
commit c1a09062d4
5 changed files with 249 additions and 7 deletions

View file

@ -334,11 +334,12 @@ export function attachSiblingOverlap(skills, promptSet, { threshold = K10_OVERLA
return skills;
}
function main() {
const args = process.argv.slice(2);
const jsonOut = args.includes('--json');
const doWrite = args.includes('--write');
/**
* Assemble the full corpus report: per-skill deterministic eval (incl. N1-N5) +
* cross-skill K10 sibling-overlap + merged operator-gated judge cache. This is
* the object the score-skill CLI consumes via scoreReport(). Reads disk.
*/
export function buildReport() {
const skillNames = readdirSync(SKILLS_DIR, { withFileTypes: true })
.filter((e) => e.isDirectory() && existsSync(join(SKILLS_DIR, e.name, 'SKILL.md')))
.map((e) => e.name)
@ -360,11 +361,20 @@ function main() {
for (const s of skills) if (jr[s.name]) s.judge = jr[s.name];
}
const report = {
return {
rubric: 'K1-K10',
note: 'Deterministic: K2,K3,K5,K6,refCountConsistency,K10(siblingScopeOverlap). LLM-judge (operator-gated): K1,K4,K7,K8,K9.',
note: 'Deterministic: K2,K3,K5,K6,refCountConsistency,K10(siblingScopeOverlap),N1-N5. LLM-judge (operator-gated): K1,K4,K7,K8,K9.',
skills,
};
}
function main() {
const args = process.argv.slice(2);
const jsonOut = args.includes('--json');
const doWrite = args.includes('--write');
const report = buildReport();
const skills = report.skills;
if (doWrite) {
mkdirSync(OUT_DIR, { recursive: true });