feat(opt): optimization lens CA-OPT-001 (procedure→skill) — v5.7 Fase 1 Chunk 2a

First detector of the 'is the config OPTIMAL?' axis (vs the existing 'correct?' scanners). New orchestrated scanner family CA-OPT (count 14->15), the deterministic half of the hybrid optimization lens.

CA-OPT-001 (low, Missed opportunity): a multi-step procedure in CLAUDE.md (>=6 consecutive numbered steps) that belongs in a skill. Reads recommendation + provenance from the best-practices register (BP-MECH-003). Conservative by design; the negative corpus proves null false-positives. Prose-judgment cases (lifecycle->hook, 'never'->permission) are deferred to the Chunk 2b opus analyzer.

Wiring mirrors OST: orchestrator entry, humanizer (OPT->'Missed opportunity' + family), scoring (OPT->'CLAUDE.md', existing area -> no new posture row -> byte-stable), strip-helper (OST,OPT), SC-5 regenerated under hermetic HOME (additive OPT entry only). 10 new tests; suite 1045->1055, self-audit A/A, readmeCheck passed (all verified with a clean HOME).

Note: the pre-existing TOK test reads the real ~/.claude (non-hermetic) -> run the suite with a clean HOME for deterministic results. Tracked as a separate follow-up.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-06-20 23:10:03 +02:00
commit e7833b65fc
14 changed files with 350 additions and 38 deletions

View file

@ -850,4 +850,24 @@ export const TRANSLATIONS = {
recommendation: 'See the details for which output style to adjust.',
},
},
// ─────────────────────────────────────────────────────────────
// OPT — Optimization Lens (mechanism-fit)
// Category: Missed opportunity
// ─────────────────────────────────────────────────────────────
OPT: {
static: {
'A multi-step procedure in CLAUDE.md belongs in a skill': {
title: 'A long checklist in CLAUDE.md could be a skill instead',
description: 'Your CLAUDE.md has a multi-step procedure that loads on every turn, costing tokens whether or not you\'re doing that task. Procedures fit better as a skill, whose steps load only when you actually run them.',
recommendation: 'Move the steps into a skill under `.claude/skills/`. Keep CLAUDE.md for facts Claude should always know, not step-by-step procedures.',
},
},
patterns: [],
_default: {
title: 'Your setup could fit Claude Code a little better',
description: 'A check found a setup that works but where a different mechanism would fit the job better.',
recommendation: 'See the details for the suggested change.',
},
},
};

View file

@ -42,6 +42,7 @@ const SCANNER_TO_CATEGORY = {
GAP: 'Missed opportunity',
PLH: 'Configuration mistake',
OST: 'Configuration mistake',
OPT: 'Missed opportunity',
};
/**

View file

@ -169,6 +169,7 @@ const SCANNER_AREA_MAP = {
DIS: 'Settings',
COL: 'Plugin Hygiene',
OST: 'Settings',
OPT: 'CLAUDE.md',
};
/**