session-to-skill-extractor
Session-to-Skill Extractor
What this is / is not
This is a filter, not a replacement for human judgment: it reviews completed agent sessions and answers exactly one question per session — did this session contain a non-obvious, generalizable procedure that should be captured for future use? It is not a transcript summarizer and not a logging tool; sessions that were merely long, or merely successful, are not automatically candidates. "Non-obvious" is load-bearing: it is not looking for things the agent already knows how to do, only for approaches that emerged through the session itself and are not codified anywhere. It surfaces candidates; a human (via promote.py) decides what actually enters the skill library. Keep its job narrow: filter → identify → articulate → dedup → queue. It never installs, deploys, auto-promotes, or edits another skill's body outside of a reviewed version bump.
Step 0 — Detect host
Run python3 scripts/detect_host.py. It prints JSON, e.g. {"host": "claude-code", "confidence": "high", "signals": ["env:CLAUDECODE=1"], "session_sources": [...]}. Honor an explicit override with python3 scripts/detect_host.py --override claude-code|codex|devin|copilot|generic. State the detected host and confidence to the user before proceeding. session_sources lists every session store actually found on the machine independent of the cascade result, so a run under one host can still mine another host's local logs if asked. If host is generic (or confidence is low and no session source looks right), ask the user for a session file path, a glob pattern, or a pasted transcript — never refuse to run.
Step 1 — Locate and filter sessions
Load sessions for the detected host:
python3 scripts/load_sessions.py --host <host> --out <work_dir>/sessions.json \
[--paths "<glob>" ...] [--lookback-days N] [--max N] [--config config.json]