integrate-apeiron
Add apeiron drift-detection or continual-learning behavior to an existing training framework. Use when the user already has a training loop, such as vanilla PyTorch, Lightning, Hugging Face Trainer, or Accelerate, and wants to integrate apeiron rather than adopt apeiron's runner. Inspects the target
Install
mkdir -p .claude/skills/integrate-apeiron && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/13595" && unzip -o skill.zip -d .claude/skills/integrate-apeiron && rm skill.zipInstalls to .claude/skills/integrate-apeiron
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Add apeiron drift-detection or continual-learning behavior to an existing training framework. Use when the user already has a training loop, such as vanilla PyTorch, Lightning, Hugging Face Trainer, or Accelerate, and wants to integrate apeiron rather than adopt apeiron's runner. Inspects the target repo, recommends the lightest viable integration path, writes adapter glue, and smoke-tests it. If `import apeiron` fails, use install-apeiron first.About this skill
Integrate Apeiron
Integrate apeiron into an existing training framework with the least coupling that meets the user's goal.
Input
- Target project directory: use the path the user gives, otherwise the current working directory.
Background
Verify APIs against source before writing glue:
cat src/main.py
cat src/apeiron/drift_detection/detectors/base.py
cat src/apeiron/drift_detection/load_drift_detector.py
grep -nA12 "class ContinuousMonitor" src/apeiron/driver/continuous_monitor.py
Current conceptual paths:
- Drift detectors are standalone:
detector.update(metric_value: float) -> DriftSignal. DriftSignalcarries fields such asdrift_detected,regime, anddrift_score; confirm exact fields in source.ContinuousMonitordrives the full apeiron loop and requires aBaseModelHarness, config, and detector.- CL updaters such as EWC, JVP, and KFAC are harness-coupled, so using them implies the harness and monitor path.
Procedure
1. Confirm Apeiron Is Importable
From the target project environment, run:
python -c "import apeiron; print('apeiron', apeiron.__file__)"
If this fails, stop and use or recommend install-apeiron before continuing.
2. Discover The Framework
In the target project, locate:
- framework indicators such as
pytorch_lightning,lightning,transformers,Trainer, oraccelerate - manual PyTorch loops with
loss.backward()andoptimizer.step() - the scalar quality metric available per step or epoch, such as validation accuracy or loss
- the model object and data iterator when the full monitor path may be needed
Summarize what you found before proposing changes.
3. Choose The Integration Path
Recommend the lightest path that satisfies the user's goal:
- Detectors-only adapter: best when the user wants drift detection or wants to trigger their own retraining.
- Harness plus
ContinuousMonitor: required when the user wants apeiron CL regularizers or the full monitor-to-adapt loop.
Confirm the chosen path with the user before editing their training loop.
4. Detectors-Only Adapter
For the light path, add a small module such as <their_pkg>/apeiron_drift.py that:
- constructs one detector, such as ADWIN, KSWIN, or PageHinkley
- exposes a hook called from the existing eval step
- calls
signal = detector.update(metric) - calls a user-provided callback when
signal.drift_detected - leaves the drift response, such as log, retrain, or reload, to the user's callback
Wire the hook into the loop with a minimal, clearly marked edit.
5. Harness And Monitor Adapter
For the full path:
- Write a
BaseModelHarnesssubclass wrapping the existing model and data loaders. - Read
src/apeiron/model/torch_model_harness.pyandexamples/mnist/model.pyfor the current abstract methods. - Preserve current method names exactly, including
get_optmizerif that is what the ABC declares. - Build a config with
build_configfrom a small TOML or construct the current config object directly. - Construct and run
ContinuousMonitorusingsrc/main.pyas the wiring reference.
6. Smoke-Test
Prove the wiring before handing back:
- Detectors-only: run a short script feeding synthetic metric values through the hook and assert that a
DriftSignalis returned. Use an obvious shift when trying to exercise the callback. - Full path: run only a tiny CPU-bound loop or monitor pass with minimal iterations, no network logging, and small stream settings.
Read failures, fix the glue, and re-run until the smoke test passes.
7. Report
Report:
- detected framework
- chosen integration path
- files added or edited
- exact insertion point in the loop
- how to run the smoke test
- what happens when drift is detected
- assumptions the user should revisit, especially the detection metric and detector sensitivity
Notes
- Keep edits to the user's loop minimal and easy to revert.
- Do not hardcode detector, monitor, or harness signatures; read them from source first.