script-discoverylisted
Install: claude install-skill e128/dotnet-reference
# Script Discovery
## Flags
Parse `$ARGUMENTS`, stripping each flag before processing remaining text:
- `--days N`: session history window (default 7)
- `--top N`: candidates to detail and optionally build (default 3)
- `--report-only`: produce report, skip approval gate and build (Phases 4–5)
- `--scan-skills`: static analysis mode → run Phase 1b instead of 1a (reads agent/skill files for inline bash to extract, then updates those files to reference the new scripts after building)
Default (no `--scan-skills`) is session-mining mode (Phase 1a).
---
## Phase 1a: Session Mining (default mode)
Skip if `--scan-skills`. Run these in parallel — they are independent:
```bash
scripts/session-mine.sh all --days 7 --json
scripts/session-health.sh tool-counts --days 7 --json
scripts/session-health.sh bash-commands --days 7 --category --json
scripts/session-health.sh stats --days 7 --json
scripts/session-health.sh topics --days 7 --json
scripts/session-health.sh errors --days 7 --json
scripts/help.sh
rg "pattern|workflow|manual|TODO" lode/ -l 2>/dev/null || true
```
`session-mine.sh all` provides tool frequencies, repeated commands, most-read files, and agent spawns.
**Data source failure handling.** If any source returns an error or `status: "skip"`, log it and continue — do not abort. Note it in the Phase 3 "Data gaps" section.
### Error patterns (proxy for hook blocks)
From the `errors` output, recurring categories that indicate a missing script:
| Error category | Wha