skill-miner
Mine recurring routines from Codex history, deduplicate them, and propose only the strongest new skill gaps.
Codex Runtime
- Dependencies: Python 3; Git; target Git repository; Codex rollout/session storage
Python 3Gittarget Git repositoryCodex rollout/session storage- Execution: Operate directly in the main Codex agent. Analyze each batch directly; delegation is optional only when the environment permits it.
- Resolve
SKILL_DIRfrom this loadedSKILL.mdand use a private scratch directory for generated digest files. - Never print, log, or expose secret values.
Inputs and Preflight
- Confirm
python3andgitare available, resolve the target Git repository, and verify the requested Codex rollout/session storage paths are readable. If any mandatory dependency is unavailable, stop without changing the backlog and report the missing command, repository, or storage path. - Confirm the requested time window or session limit and the number of batches, normally three.
- Confirm current Codex rollout JSONL exists under
~/.codex/sessions/. This global directory is the rollout source, not the assumed location of project snapshots. - Resolve the relevant current repository with
git rev-parse --show-toplevel. If<repo-root>/.codex/sessionsexists, use it as the project-local context snapshot root. - When the user requests cross-project mining, resolve each approved project root and add its existing
.codex/sessionsdirectory separately. - Read
BACKLOG.md,REFERENCE.md, the installed~/.codex/skillsnames, and the parallel collection manifest when available. - Treat every rollout, snapshot, installed skill, and backlog entry as read-only evidence. Do not modify session history or installed skills.
Procedure
- Digest current Codex history with the generated helper:
Pass the project flag only when that directory exists. OmitPROJECT_ROOT="$(git rev-parse --show-toplevel)" SCRATCH_DIR="$(mktemp -d "${TMPDIR:-/tmp}/skill-miner.XXXXXX")" chmod 700 "$SCRATCH_DIR" cd "$SCRATCH_DIR" python3 "$SKILL_DIR/scripts/digest_codex.py" --dir "$HOME/.codex/sessions" --context-dir "$PROJECT_ROOT/.codex/sessions" --out "$SCRATCH_DIR/digest.txt" --batches 3 --limit <N>--limitwhen the user requests the full history. For cross-project mining, add an additional--context-dirargument with"<project-root>/.codex/sessions"for each approved root. The helper deduplicates candidates, ranks valid rollouts and snapshots together, excludes tool payloads, and redacts credential-shaped values. - Use the original
scripts/digest.pyonly for deliberate, read-only analysis of historical Claude data. Never use it for current Codex rollouts. - Build the dedupe set from installed skill names and all
builtordeclinedentries inBACKLOG.md. Keep existingproposedanddeferredentries visible during synthesis. - Read
REFERENCE.md, then analyze each batch directly. Cluster repeatable multi-step routines, preserve actual trigger language, count sessions, retain session IDs, assess TigerClaw impact, and mark overlap with an existing skill. - Merge candidates across batches. Rank by frequency multiplied by impact; rank convergence across two or more batches higher. Drop one-off debugging, vague aspirations, existing-skill coverage, and
builtordeclinedbacklog items. - Prepare at most three evidence-backed candidates. Append genuinely new candidates to
BACKLOG.mdwith statusproposed, impact, first-seen date, session evidence, and a concise note. Never alter historical status without explicit approval. - Present one ranked build-decision question with the recommendation first. Never auto-build; a separate approved workflow must build a selected skill and later mark it
built.
Safety and Errors
- This is a read-only / propose-only research workflow: session evidence and installed skills remain untouched, and no candidate is built automatically.
- The only routine ledger mutation is an evidence-backed append of a new
proposedrow toBACKLOG.md. - Never claim recurrence without session IDs and counts. State when evidence appears only once.
- If rollouts are missing, digest output is empty, parsing is partial, or evidence conflicts, report the limitation and do not manufacture candidates.
Output Contract
Return the examined session count and date range, batches analyzed, dedupe sources, top one to three candidates with trigger phrases and session evidence, backlog rows appended, and one ranked build-decision question. State that no skill was built.