diff --git a/.claude/skills/optimize/SKILL.md b/.claude/skills/optimize/SKILL.md index 49955e9..69673a5 100644 --- a/.claude/skills/optimize/SKILL.md +++ b/.claude/skills/optimize/SKILL.md @@ -14,7 +14,7 @@ Given by the caller, in the request; any other context or rule it gives (files t - `ANALYSIS` (required): the analysis folder: `request.json` (`station`, `start`, `end`, UTC), `labels.jsonl`, `report.md`, `analysis.md`, `scripts/`. - `OUT` (required): the output folder of this run (`sessions/_/` in Optimizer). -- Defaults, relative to Optimizer's root (its links), which the request may override: `DETECTORS: detectors/`, `TOOLS: tools/`, `DATA: data`, `LABELS: labeling/auto` (the folder of the `.jsonl` label files, JSONL: `id`, `start`, `end`, `family`, `description`), `FAMILIES: labeling/families.md` (the families and their boundaries, one detector per family). +- Defaults, relative to Optimizer's root (its links), which the request may override: `DETECTORS: detectors/`, `BENCH: ~/aimsight-models/rules/bench` (the benchmark of the detectors, outside them: it measures `$DETECTORS`), `TOOLS: tools/`, `DATA: data`, `LABELS: labeling/auto` (the folder of the `.jsonl` label files, JSONL: `id`, `start`, `end`, `family`, `description`), `FAMILIES: labeling/families.md` (the families and their boundaries, one detector per family). Derived from `/request.json`: @@ -28,11 +28,11 @@ Derived from `/request.json`: ## Commands -- events: `python3 /scripts/categories.py --from --to ` -- sensors: `python3 /bench/sensors.py --from --to ` -- range score (the goal): `python3 /bench/score.py --labels /.jsonl --from --to `; it exits with an error if no label touches the range: note it in the summary, touch nothing in the detectors and go to part 2. -- benchmark (the non-regression, about 1 min): `python3 /bench/regression.py ` -- compare (the regressions and the complexity of two benchmarks): `python3 /bench/compare.py ` +- events: `python3 /detectors/categories.py --from --to ` +- sensors: `DETECTORS= python3 /sensors.py --from --to ` +- range score (the goal): `DETECTORS= python3 /score.py --labels /.jsonl --from --to `; it exits with an error if no label touches the range: note it in the summary, touch nothing in the detectors and go to part 2. +- benchmark (the non-regression, about 1 min): `DETECTORS= python3 /regression.py ` +- compare (the regressions and the complexity of two benchmarks): `python3 /compare.py ` The measures of a step: ` > /range-.txt 2>&1` and ` > /benchmark-.txt 2>&1`. @@ -51,7 +51,7 @@ Each agent is called with the Agent tool, its `subagent_type` (`agents:upgrader` It commits each fix it keeps, message `improve: S`, with its benchmark `/benchmark-S.txt`; each rule its pruning removes is a fix of its own. Verdict `nothing to change`, or no fix commit (`git -C log --format=%h --grep ': S[0-9]*$' ..HEAD` empty): go to part 2. 3. **Measures after**: step `after`. -4. **Validator**, which reads neither the diagnosis nor the detail of the modification: `Target: . Modification: /modification.md. Base: . Checks: range: ; before: /range-before.txt; after: /range-after.txt; benchmark: ; before: /benchmark-before.txt; after: /benchmark-after.txt; after each fix: /benchmark-S*.txt; compare: ; events, for any station: python3 /scripts/categories.py --from --to . Families: . Output: /validation.md. INSTRUCTIONS: instructions/validator-detectors.md.` +4. **Validator**, which reads neither the diagnosis nor the detail of the modification: `Target: . Modification: /modification.md. Base: . Checks: range: ; before: /range-before.txt; after: /range-after.txt; benchmark: ; before: /benchmark-before.txt; after: /benchmark-after.txt; after each fix: /benchmark-S*.txt; compare: ; events, for any station: python3 /detectors/categories.py --from --to . Families: . Output: /validation.md. INSTRUCTIONS: instructions/validator-detectors.md.` - `keep`: go to part 2. - `remove`: for each fix of the `**Remove**:` line, its commits (`git -C log --format=%h --grep ': S$' ..HEAD`), from the most recent: `git -C revert --no-edit `, then `git -C commit --amend -m "improve: S removed" -m "Co-Authored-By: Claude Opus 5.5 "`. A conflict: `git -C revert --abort`, and do as for `cancel`. - `cancel`, or anything else: `git -C revert --no-commit ..HEAD && git -C commit -m "improve: modification cancelled" -m "Co-Authored-By: Claude Opus 5.5 "` (only what the fix commits changed; files already modified stay as they are). diff --git a/instructions/upgrader-detectors.md b/instructions/upgrader-detectors.md index 3a1fdee..4909202 100644 --- a/instructions/upgrader-detectors.md +++ b/instructions/upgrader-detectors.md @@ -12,7 +12,7 @@ An analyst has analysed a range of a station where the detectors perform poorly. - The context documents (the analysis report): the mechanism of each event, the sensors touched and those that do not move, the level of proof; a document may say that a label is wrong: a limit to report, not a target. - The families document **in full**: the families and their boundaries; the category of an event is its family; the mechanisms (phenomena, false friends) are the cases: `python3 labeling/scripts/cases.py --list`, their files in `labeling/auto/cases/`. - The checks' outputs before: events (run it with `2>&1`), sensors (the cadence, then the sensors of each event), range score, benchmark. -- The code of the detectors, `scripts/categories.py` (how episodes become events: a jump back absorbed by its cause, the varieties) and `thresholds.md`. You may read the station's data to understand why a rule fails. +- The code of the detectors, `detectors/categories.py` (how episodes become events: a jump back absorbed by its cause, the varieties) and `~/aimsight-models/rules/thresholds.md` (the registry of their thresholds; `thresholds.md` below). You may read the station's data to understand why a rule fails. ## The diagnosis diff --git a/instructions/validator-detectors.md b/instructions/validator-detectors.md index 8a3b2c9..f2c04ab 100644 --- a/instructions/validator-detectors.md +++ b/instructions/validator-detectors.md @@ -11,7 +11,7 @@ The upgrader has just adapted the detectors to better find the events of a singl - The range score before → after: the gain the modification sought. - The benchmarks (the score per family on each station of the reference truth, then their `Total`), all stations in full; the benchmarks after each fix, in order, say which fix makes a station go back. - The families document, and the cases (`python3 labeling/scripts/cases.py --list`). -- To understand a regression on a station: the events command on its range (from the header of the station's block in the benchmark), with `2>&1`, at HEAD and, to compare, at the base (`git -C archive | tar -x -C ` in your working folder, then the same command with the copy's `scripts/categories.py`), and the station's labels. +- To understand a regression on a station: the events command on its range (from the header of the station's block in the benchmark), with `2>&1`, at HEAD and, to compare, at the base (`git -C archive | tar -x -C ` in your working folder, then the same command with the copy's `detectors/categories.py`, `scripts/categories.py` before 2026-11-25), and the station's labels. ## What you judge, for the detectors