Stocktake

From raddue/crucible · View interactive version

Stocktake is an AI agent skill from the GitHub repository raddue/crucible. Audits all crucible skills for overlap, staleness, broken references, and quality. Quick scan or full evaluation modes.

How to use this skill

Skill file

Skill Stocktake

Audits all crucible skills for overlap, staleness, broken references, and quality.

Announce at start: "I'm using the stocktake skill to audit skill health."

When to Activate

Modes

| Mode | Trigger | Duration |

|------|---------|----------|

| Quick scan | results.json exists (default) | ~5 min |

| Full stocktake | results.json absent, or /stocktake full | ~20 min |

| Efficiency report | /stocktake efficiency | ~5 min |

Results cache: skills/stocktake/results.json

Quick Scan Flow

  1. Read skills/stocktake/results.json
  2. Identify skills that have changed since evaluated_at timestamp (compare file mtimes)
  3. If no changes: report "No changes since last run." and stop
  4. Re-evaluate only changed skills using the same evaluation criteria
  5. Carry forward unchanged skills from previous results
  6. Output only the diff
  7. Save updated results to skills/stocktake/results.json

Full Stocktake Flow

Phase 1 — Inventory

Enumerate all skill directories under skills/. For each:

Present inventory table:

| Skill | Files | Lines | Last Modified | Description |

|-------|-------|-------|---------------|-------------|

Structural invariants (repo-level). Run the tracked invariant checker from the repo root and treat a non-zero exit as a stocktake failure to surface:

(Other tracked checkers under scripts/check_*.py may be run here too as they are brought into alignment.)

Phase 2 — Quality Evaluation

Dispatch an Opus Explore agent with all skill contents and the evaluation checklist.

Each skill is evaluated against:

Each skill gets a verdict:

| Verdict | Meaning |

|---------|---------|

| Keep | Useful and current |

| Improve | Worth keeping, specific improvements needed |

| Retire | Low quality, stale, or cost-asymmetric |

| Merge into [X] | Substantial overlap with another skill; name the merge target |

Reason quality requirements — the reason field must be self-contained and decision-enabling:

Phase 3 — Summary Table

| Skill | Verdict | Reason |

|-------|---------|--------|

Phase 4 — Consolidation

  1. Retire / Merge: present detailed justification per skill before confirming with user
  2. Improve: present specific improvement suggestions with rationale
  3. Save results to skills/stocktake/results.json

Efficiency Report Flow

Triggered by /stocktake efficiency or by forge feed-forward when 10+ chronicle signals with efficiency data exist.

Step 1: Load Chronicle Data

  1. Read ~/.claude/projects/<hash>/memory/chronicle/signals.jsonl
  2. If the file is missing or empty: report "No efficiency data available. Run a pipeline with enriched manifest tracking to begin collecting data." and stop.
  3. Filter to signals that have a metrics.efficiency sub-object.
  4. If fewer than 3 signals have efficiency data: report available data with caveat: "Insufficient data for trend analysis. N signals available, 3+ recommended for meaningful comparison."
  5. Report: "N of M total signals include efficiency data." (where M is total signals, N is signals with efficiency).

Step 2: Per-Skill Summary

Group filtered signals by skill. For each skill, compute:

If any skill has average rework >30%, append a note: "[skill]: rework >30% — consider reviewing dispatch templates or quality-gate prompts for this skill."

Output:

## Skill Efficiency Report
**Period:** <oldest signal date> to <newest signal date>
**Tracked runs:** N
**Disclaimer:** Estimates based on dispatch file sizes (chars/4). Actual token consumption may vary +/-30%.

### Per-Skill Summary
| Skill | Runs | Avg Est. Tokens (in+out) | Rework % | Avg Duration | Avg Dispatches | Trend |
|-------|------|--------------------------|----------|--------------|----------------|-------|

Step 3: Dispatch Breakdown

For each skill, compute dispatch tier distribution and categorize dispatches as review vs. implementation:

Note: Review vs. implementation breakdown requires reading manifest entries (role field). If manifests are not available (only chronicle signals), report "N/A" for these columns.

Output:

### Dispatch Breakdown
| Skill | Opus % | Sonnet % | Haiku % | Review % | Impl % |
|-------|--------|----------|---------|----------|--------|

Step 4: Structural Efficiency

For each skill, compute:

Output:

### Structural Efficiency
| Skill | Avg Input/Dispatch | Context Distribution | Quality Overhead % |
|-------|--------------------|-----------------------|--------------------|

Step 5: Baseline Comparison (Structural)

For each skill with sufficient data (3+ runs):

Output:

### Baseline Comparison (Structural)
| Skill | Avg Total Context | Avg Input/Dispatch | Context Focus Ratio | Quality Investment |
|-------|-------------------|--------------------|---------------------|--------------------|

**Interpretation:** Context focus ratio measures how much of the total pipeline context each
subagent receives. Lower values mean more focused dispatches. Quality investment shows the
fraction of dispatches dedicated to review, red-team, and quality gates. These are structural
comparisons, not cost savings claims — they measure how the skill distributes work, not what
a monolithic alternative would cost.

Step 6: Cache Results

Save efficiency report data to skills/stocktake/results.json under a new efficiency key (separate from the skill verdict cache):

{
  "efficiency": {
    "computed_at": "2026-04-07T10:00:00Z",
    "signals_with_efficiency": 15,
    "total_signals": 42,
    "per_skill": {
      "build": { "runs": 8, "avg_est_tokens": 52600, "avg_duration_m": 45, "trend": "stable" },
      "debugging": { "runs": 5, "avg_est_tokens": 25000, "avg_duration_m": 22, "trend": "improving" }
    }
  }
}

Results File Schema

skills/stocktake/results.json:

{
  "evaluated_at": "2026-03-07T10:00:00Z",
  "mode": "full",
  "skills": {
    "skill-name": {
      "path": "skills/skill-name/SKILL.md",
      "verdict": "Keep",
      "reason": "Concrete, actionable, unique value for X workflow",
      "mtime": "2026-01-15T08:30:00Z"
    }
  }
}

Safety

Integration

Red Flags

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.