iw-item-analyzelisted
Install: claude install-skill innovation-ways/iw-ai-core
# IW Item Analyze
Analyze the execution history of work item **$IW_ITEM_ID** and propose concrete process improvements.
**Strict scope:** look only at *how the agents behaved during execution* — tool failures, retries, fix-cycles, repeated env setup, error patterns, prompt gaps. **Never review the generated code.** **Never edit any file.** This skill reports only.
---
## Phase 0 — Resolve the item and check sources
1. Read the item ID from `$IW_ITEM_ID`. If unset, fall back to the first positional argument or stop with an error — the daemon launches this step with the env var set.
2. **Check DB availability** (controls whether we use DB-first or file-only mode):
```bash
uv run iw db-identity check >/dev/null 2>&1 && echo "DB:UP" || echo "DB:DOWN"
```
3. **Locate the item** in this priority:
- **Active**: `ai-dev/active/<ID>/` exists → use directly. Worktree should be at `.worktrees/<ID>/` (raw logs live here under `ai-dev/logs/`).
- **Archived**: `ai-dev/archives/<project>/<ID>.tar.zst` exists → extract to a temp dir:
```bash
TMP=$(mktemp -d) && tar --use-compress-program=unzstd -xf ai-dev/archives/iw-ai-core/<ID>.tar.zst -C "$TMP"
```
Note: archived tarballs contain prompts + reports + execution_report only — **no raw run logs**. Signal will be weaker; the DB (if up) becomes the primary source.
- **Neither** → stop and tell the user the item cannot be found.
4. **Pull the high-level step list** (works in both modes):
```bash