Upload SKILL.md
Browse files
.claude/skills/implement-drift/SKILL.md
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: implement-drift
|
| 3 |
+
description: Implement the drift detection layer to satisfy tests/test_drift.py
|
| 4 |
+
disable-model-invocation: true
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
Implement `osint_core/drift.py` to satisfy `tests/test_drift.py`.
|
| 8 |
+
|
| 9 |
+
1. **Read first:**
|
| 10 |
+
- Read `osint_core/drift.py` — it is pseudocode (raises `SyntaxError` on import), treat it as a design spec only
|
| 11 |
+
- Read `tests/test_drift.py` in full — these are the contract tests to satisfy
|
| 12 |
+
- Required exports: `DriftAssessment`, `DriftSignal`, `DriftType`, `DriftVector`, `TelemetrySnapshot`, `aggregate_signals`, `assess_drift`, `choose_dominant_drift_type`, `estimate_confidence`, `recommend_correction`
|
| 13 |
+
|
| 14 |
+
2. **Implement from scratch** (do not edit the pseudocode in-place):
|
| 15 |
+
- Use `from __future__ import annotations`
|
| 16 |
+
- Use `@dataclass(frozen=True)` for all value objects
|
| 17 |
+
- Use `Literal[...]` or `enum.Enum` for `DriftType` and correction verbs
|
| 18 |
+
- `assess_drift` must be **pure** — no mutations to inputs (see `test_assess_drift_is_pure_and_does_not_mutate_inputs`)
|
| 19 |
+
- Correction priority: `policy > structural > behavioral > adversarial > operational > statistical`
|
| 20 |
+
- Adversarial signals must CONSTRAIN before the system ADAPTs; statistical drift may ADAPT only when nothing higher-priority fires
|
| 21 |
+
|
| 22 |
+
3. **Iterate test-by-test:**
|
| 23 |
+
```bash
|
| 24 |
+
pytest tests/test_drift.py -v -x # stop at first failure
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
4. **When all pass:**
|
| 28 |
+
```bash
|
| 29 |
+
pytest -v
|
| 30 |
+
ruff check osint_core/drift.py
|
| 31 |
+
bandit -r osint_core/drift.py
|
| 32 |
+
```
|