Session skill mining

From getcrew44/crew44 · View interactive version

Session skill mining is an AI agent skill from the GitHub repository getcrew44/crew44. Use when the user explicitly asks to inspect past Codex or Claude Code sessions, runs, or chats from a specific time range and extract reusable upgrades (skills to codify, memories to pin, or strategy-shaped findings that can be represented as skills or memories). Also invoked by the auto-optimizer

How to use this skill

Skill file

Session Skill Mining

Review AI coding sessions, run metadata, and edit history from an explicit time range and identify two kinds of upgrades:

  1. Skills — reusable patterns worth codifying as a SKILL.md
  2. Memories — facts about the project or the user worth pinning so the agent does not rediscover them every session

Strategy-shaped findings are still in scope: routing, scheduling, agent shape, cost, queueing, and role-boundary patterns. Do not emit a separate strategy kind. Map them to:

The auto-optimizer (Auto optimization route in Crew44) invokes this skill on a schedule and parses the JSON block from your response. When invoked manually by the user, emit both the readable summary and the JSON so the user can see what would be persisted.

Guardrails

Quality bar — surface less, but mean it

You are judged on signal-to-noise, not volume. Default to NOT surfacing. An empty suggestions array is a valid and often correct response. If a candidate does not clearly clear the bar below, drop it.

The cost of a false positive is high: the user has to read, judge, and reject it, and a single weak suggestion poisons trust in the entire scan. The cost of a missed signal is low: the same pattern will fire again next week if it is real.

Reject by default

Surface only when at least one of these is true

False-positive examples (internalize these)

Good surfacings (mirror these)

When to use

Sources

Default locations:

Timestamps are usually ISO-8601 UTC in each JSONL record. Normalize the user's requested range to exact start and end datetimes, including timezone. If the user gives only dates, interpret the range as local-time full days.

Steps

  1. Confirm or infer the exact time range. Ask one clarifying question only if the range is missing or ambiguous.
  2. Collect candidate transcript files from the sources above. Prefer filename dates to narrow the scan, then filter by per-record timestamps.
  3. Read only the relevant records inside the range. Preserve source, session id, timestamp, cwd/project, role, and a short note about the exchange.
  4. Ignore system noise, tool dumps, generated binary/base64 content, and one-off implementation details.
  5. Inspect existing skill and agent definitions, if available, to avoid duplicate recommendations.
  6. Identify reusable skill patterns:
  1. Identify strategy-shaped patterns, then map them into skill or memory:

If the finding is a reusable decision process, classify it as skill. If it is a durable fact or constraint, classify it as memory-project or memory-user.

  1. Identify memory candidates (project-scoped — memory-project):
  1. Identify memory candidates (user-scoped — memory-user):
  1. Classify each finding as one of:
  1. Apply the Quality bar section above to every candidate before listing it. Reject framework boilerplate, patterns derivable from current code in <60 seconds, bug post-mortems whose fix is already merged, mid-iteration noise (skills that are not a crystallized procedure, memories that are session-ephemeral), generic engineering advice, content already in CLAUDE.md/AGENTS.md/README, single-task or one-off decisions, and anything containing secrets or private credentials. When in doubt, drop.
  2. Group similar findings. For skill candidates, state trigger conditions, reusable procedure, evidence sessions, confidence, and whether it should become a new skill or update an existing one. For memory candidates, state scope, durable fact/preference, evidence, and why it is not derivable from current code.
  3. If the user asks to create files, hand off to Coding Agent with selected candidate names, evidence summary, and target skill or memory locations.

Useful scan commands

Use equivalent tools when direct shell access is unavailable.

find "${CODEX_HOME:-$HOME/.codex}/sessions" -name '*.jsonl' -print
find "${CLAUDE_CONFIG_DIR:-$HOME/.claude}/projects" -name '*.jsonl' -print

For large ranges, avoid printing full transcripts. Extract compact fields with jq or a small script, then inspect only promising sessions.

When inspecting SQLite or JSONL indexes, keep every command bounded:

Output format

Start with coverage:

Then list candidate skills:

Then list candidate memories:

When you find a strategy-shaped signal, do not create a separate strategy section. Put it in candidate skills if it is a reusable procedure, or candidate memories if it is durable context.

When useful, include a compact draft:

---
name: proposed-skill-name
description: Use when ...
---

# Proposed Skill Name

## Steps

1. ...

Structured output (required when invoked by auto-optimizer; recommended for manual use)

Reply with a short plain-English summary the user can skim, then a single fenced JSON block. The block must match the schema below; the daemon parses it. If you cannot produce valid JSON, do not invent it — emit an empty suggestions array instead.

{
  "schema_version": 1,
  "scan_summary": { "window": "2026-05-06..2026-05-13", "runs_analyzed": 142 },
  "suggestions": [
    {
      "id": "k-1",
      "kind": "skill",
      "priority": "high",
      "title": "Bundle the 6-step locale video prep into a skill",
      "body": "Milo runs the same prep ritual before every doubao-tts job: check 16:9 crop, normalize audio to -14 LUFS, name subtitles {locale}.vtt, copy to /out/locale/, verify duration <= 90s, log to ledger. Five runs in 8 days, near-identical.",
      "impact": "-4m/run",
      "evidence": { "runs": ["t-091","t-088","t-082"], "windows": ["5 runs, 8d window"] },
      "preview": {
        "type": "skill",
        "name": "locale-video-prep",
        "lines": [
          "# locale-video-prep",
          "",
          "Required reading before any locale promo render.",
          "",
          "## Steps",
          "1. Verify aspect ratio is 16:9 (crop, do not pad).",
          "2. Normalize audio to -14 LUFS."
        ]
      }
    },
    {
      "id": "m-1",
      "kind": "memory-project",
      "priority": "high",
      "title": "This repo uses pnpm workspaces; npm install breaks it",
      "body": "Three lockfile-recovery sessions in the last week. Worth pinning so no agent runs npm install at the repo root again.",
      "impact": "Prevents 10m/slip",
      "evidence": { "runs": ["t-114","t-112","t-109"], "windows": ["3 lockfile-recovery sessions"] },
      "preview": {
        "type": "memory",
        "scope": "crew44",
        "scope_id": "PASTE-PROJECT-UUID-HERE",
        "text": "Project uses pnpm workspaces. Never run npm install at the repo root."
      }
    },
    {
      "id": "u-1",
      "kind": "memory-user",
      "priority": "med",
      "title": "Jordan prefers em-dashes over semicolons in copy",
      "body": "Across 7 copy reviews, you replaced 19 of 21 agent-written semicolons with em-dashes.",
      "impact": "Style fit",
      "evidence": { "runs": ["t-114","t-082"], "windows": ["7 copy reviews, 14d"] },
      "preview": {
        "type": "memory",
        "scope": "Jordan",
        "text": "In copy, prefer em-dashes over semicolons."
      }
    }
  ]
}

Field rules

Honor surfaces and threshold

The auto-optimizer's scan prompt lists which surfaces are enabled and the priority threshold. If surfaces.memory=false you must skip both memory-project and memory-user. Do not emit strategy candidates. If threshold=high you must skip med and low candidates. The daemon also re-validates server-side; emitting filtered candidates wastes tokens but does not harm the system.

Last-pass check before emitting

For every candidate you are about to include, walk through this checklist. If any answer is "no" or "yes (for the wrong column)," drop the candidate.

A scan that emits 0–2 strong suggestions per week beats a scan that emits 5 weak ones. The user trusts the next scan based on the worst suggestion in this one.

Privacy rules

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.