feat(ms-ai-architect): Sesjon 21 — C1 Tier 1 opt-in session-forankret deteksjon (ToS-forankret) [skip-docs]
Spor C fase C1 Tier 1. Ny verifisert ToS-analyse avdekket falsk «enten/eller»: Consumer Terms §3.7 begrenser automatisert tilgang til Claude/Anthropic, IKKE kjøring av lokale node-scripts. Deteksjon kontakter aldri Claude → utenfor ToS-flaten; apply (eneste Claude-steg) forblir manuelt/in-session/gated. - lib/detection-schedule.mjs (ren): opt-in config (default AV) + shouldRunDetection gate + DETECTION_STEPS allow-liste + summarizeSkillLifecycle. Zero-dep parser. - run-detection.mjs: Claude-FRITT entrypoint — kjører kun `node` på de allow-listede deteksjons-scriptene; kan ikke invokere claude (guard-testet). - session-start-context.mjs: ubetinget bakgrunns-spawn → opt-in (default AV spawner ingenting) + surfacer skill-signaler read-only. - commands/kb-update.md: opt-in-seksjon + ToS-note; ms-ai-architect.local.md.example. TDD: ny test-detection-schedule.test.mjs (16). kb-update 139→155. Suiter uendret: validate 239 · kb-eval 100 · kb-integrity 192/192. 0 skills/-mutasjon. Tier 2 (lokal OS-timer, deteksjon-only) = neste økt. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e47fc9bd59
commit
150b20584e
6 changed files with 456 additions and 6 deletions
|
|
@ -6,6 +6,11 @@
|
|||
import { readdirSync, readFileSync, existsSync } from 'node:fs';
|
||||
import { join, relative } from 'node:path';
|
||||
import { spawn } from 'node:child_process';
|
||||
import {
|
||||
loadScheduleConfig,
|
||||
shouldRunDetection,
|
||||
summarizeSkillLifecycle,
|
||||
} from '../../scripts/kb-update/lib/detection-schedule.mjs';
|
||||
|
||||
const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT || join(process.cwd());
|
||||
const cwd = process.cwd();
|
||||
|
|
@ -62,12 +67,17 @@ if (existsSync(changeReportPath)) {
|
|||
}
|
||||
}
|
||||
|
||||
// Trigger background poll if >7 days since last check
|
||||
if (lastPollDaysAgo > 7) {
|
||||
const updateScript = join(pluginRoot, 'scripts', 'kb-update', 'run-weekly-update.mjs');
|
||||
if (existsSync(updateScript)) {
|
||||
// Opt-in background detection (Spor C / C1). Default OFF: nothing spawns unless
|
||||
// the user enabled scheduled_detection in ms-ai-architect.local.md. When on +
|
||||
// stale, run the Claude-FREE detection entrypoint (poll → report → discover →
|
||||
// skill-lifecycle) in the background. This never invokes Claude — apply stays
|
||||
// manual + in-session. See detection-schedule.mjs for the ToS rationale.
|
||||
const scheduleConfig = loadScheduleConfig(pluginRoot);
|
||||
if (shouldRunDetection(scheduleConfig, lastPollDaysAgo).run) {
|
||||
const detectScript = join(pluginRoot, 'scripts', 'kb-update', 'run-detection.mjs');
|
||||
if (existsSync(detectScript)) {
|
||||
try {
|
||||
spawn('node', [updateScript], { detached: true, stdio: 'ignore' }).unref();
|
||||
spawn('node', [detectScript], { detached: true, stdio: 'ignore' }).unref();
|
||||
} catch {
|
||||
// Non-critical — silent fail
|
||||
}
|
||||
|
|
@ -140,6 +150,17 @@ if (staleEntries.length > 0) {
|
|||
parts.push('KB: poll overdue');
|
||||
}
|
||||
|
||||
// Skill-lifecycle signals (Spor B/C) — read-only one-liner; never spawns.
|
||||
const skillReportPath = join(pluginRoot, 'scripts', 'kb-eval', 'data', 'skill-lifecycle-report.json');
|
||||
if (existsSync(skillReportPath)) {
|
||||
try {
|
||||
const skillSummary = summarizeSkillLifecycle(JSON.parse(readFileSync(skillReportPath, 'utf8')));
|
||||
if (skillSummary) parts.push(skillSummary);
|
||||
} catch {
|
||||
// Ignore — advisory only
|
||||
}
|
||||
}
|
||||
|
||||
if (nearestDeadline) {
|
||||
parts.push(`EU AI Act: ${nearestDeadline.daysLeft} dager til ${nearestDeadline.label}. Kjør /architect:classify`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue