2026-02-13 12:01:10 +08:00
---
name : vlm-library-workflow
2026-09-25 13:38:20 +08:00
description : Operate and extend the Video Library Manager (vlm) CLI. Use for organizing video libraries (scan/parse/enrich/analyze/plan/execute), reviewing plans, resolving duplicates, or developing VLM features.
2026-02-13 12:01:10 +08:00
---
# VLM Library Workflow
2026-09-25 13:38:20 +08:00
## Safety Contract
2026-02-13 12:01:10 +08:00
2026-09-25 13:38:20 +08:00
1. Before `execute --confirm` , always run `review-plan` and report `High-risk operations` count.
2. If high-risk > 0: **stop** , wait for explicit user decision.
3. `--confirm` requires `--require-review` to enforce review gate; default does not force.
4. Never run `execute --confirm` without user confirmation.
2026-02-13 12:01:10 +08:00
2026-09-25 13:38:20 +08:00
## Execution Threshold Semantics
2026-06-01 15:32:03 +08:00
2026-09-25 13:38:20 +08:00
- `high_risk_operations` : count of non-no-op operations with risk flags (printed by `review-plan` ).
- `review_export_rows` : internal count (not printed); may be larger. Do not use `wc -l` on CSV.
- If export row count is needed, parse CSV data rows or add the count to CLI output.
2026-02-13 12:01:10 +08:00
2026-09-25 13:38:20 +08:00
## High-Risk Closed Loop
2026-02-13 12:01:10 +08:00
2026-09-25 13:38:20 +08:00
When high-risk > 0, use the same plan and CSV path throughout:
2026-06-01 15:32:03 +08:00
2026-09-25 13:38:20 +08:00
1. `vlm review-plan --input <plan> --output <csv>`
2. Human reviews CSV (modify decision or keep)
3. `vlm apply-review --plan <plan> --csv <csv>` — **required even if no changes** (writes `review_applied_at` )
4. `vlm execute --plan <plan>` (dry-run with updated plan)
5. Get explicit user confirmation
6. `vlm execute --plan <plan> --confirm --require-review --review-csv <csv>`
2026-02-13 12:01:10 +08:00
2026-09-25 13:38:20 +08:00
Three rejection paths: missing CSV, missing `review_applied_at` , CSV path mismatch.
2026-02-13 12:01:10 +08:00
2026-09-25 13:38:20 +08:00
## Workflow Phases
2026-02-13 12:01:10 +08:00
2026-09-25 13:38:20 +08:00
| Phase | Purpose | Artifact |
|-------|---------|----------|
| config | Set `library_root` | `~/.vlm/config.yaml` |
| scan | Discover files | `inventory.csv` |
| parse | Extract identities | `identities.json` |
| enrich | Add TMDB metadata | `identities.json` (updated) |
| analyze | Detect gaps/duplicates | `analysis.json` |
| plan | Generate operations | `plan.json` |
| review-plan | Export high-risk + preview | `plan_manual_review.csv` |
| apply-review | Sync manual decisions | `plan.json` (updated) |
| execute | Dry-run, then confirm | rollback log |
| rollback | Revert if needed | restored files |
2026-02-13 12:01:10 +08:00
2026-09-25 13:38:20 +08:00
## Decision Rules
2026-02-13 12:01:10 +08:00
2026-09-25 13:38:20 +08:00
**duplicate_keep strategies** (5): `by_quality` , `by_reputation` , `by_reputation_quality_time` , `first_seen` , `manual` .
2026-02-13 12:01:10 +08:00
2026-09-25 13:38:20 +08:00
**Parser boundary risks** : filenames with resolution-like `1920x1080` /`1440x1080` and `Sample` clips are high-risk; require review-plan output before confirmation.
2026-02-13 12:01:10 +08:00
2026-09-25 13:38:20 +08:00
**Metadata quality** : prefer `vlm parse --inventory` when duplicate quality ranking matters.
2026-02-13 12:01:10 +08:00
2026-09-25 13:38:20 +08:00
**Analysis-assisted planning** : prefer `vlm plan --analysis` for automatic duplicate quarantine.
2026-02-13 12:01:10 +08:00
## Output Contract
2026-09-25 13:38:20 +08:00
1. Commands executed and artifacts generated.
2. Key counts (files, identities, duplicates, operations).
3. Risk counts from review-plan; blocking errors with exact remediation command.
2026-02-13 12:01:10 +08:00
## References
2026-09-25 13:38:20 +08:00
- `references/triage.md` : failure triage mapping + preflight checks.
- `references/dev-map.md` : module → test → verification mapping.
- For CLI options: run `vlm <command> --help` . Do not trust memory.