labali-spotify-delete-draft-episodes
Treat this skill as a layered system, not a single script.
Layer Contract
SKILL.md(this file) is the policy layer.- Define goals, constraints, success criteria, and decision boundaries.
- Stay semantic and stable across UI changes.
references/architecture.mdis the strategy layer.- Define execution model, failure handling, and quality standards.
scripts/*.tsis the execution layer.- Scripts are execution assets, not the skill definition itself.
- Prefer a policy-executor (strategy cache): reusable stage logic + bounded semantic decisions.
- Deterministic trajectory scripts are valid for simple stable pages, but not required.
- Any execution script can become stale and should be replaceable.
Script Classification
Deterministic trajectory script- Fixed UI path replay with minimal runtime inference.
- Best for stable UI, fastest when valid, most brittle under UI drift.
Policy executor (strategy cache)(current reliability baseline)- Fixed orchestration skeleton with semantic candidate selection and fallback.
- Reduces repeated reasoning while retaining bounded adaptation to UI changes.
Fully deliberative run- Runtime-first semantic re-discovery with little pre-structured flow.
- Most adaptive but highest variance in speed/cost.
This skill uses unified runtime by design: deterministic trajectory cache first, then policy executor fallback for reliability.
The deterministic first-level cache script is available at scripts/deterministic.ts with CLI wrapper scripts/run_deterministic.ts.
Required Constraints
- Use browser automation only.
- Do not use Spotify APIs.
- Use semantic interactions first (visible text, label, role).
- Login is manual; session reuse is required.
- Deletion success is validated by business state, not by click success.
- Scope deletions to
Draftfilter only.
NEVER
- Never confirm deletion success by click outcome alone — verify the Draft list no longer contains the deleted episode.
- Never delete episodes outside the Draft filter scope — only target episodes in the Draft list.
- Never return success before the policy executor's business-state verification passes.
Success Criteria
A run is successful only when all conditions hold:
- The target show is selected by
show_id/show URL. - At least one Draft episode is deleted in default mode (
delete_all_drafts=false). - In full-cleanup mode (
delete_all_drafts=true), final check confirms noDraftepisodes remain.
Runtime Inputs
Use skill.yaml as the source of truth for input schema.
Operational Mode
- Delete mode:
- Default:
delete_all_drafts=falsedeletes only the first Draft episode. - Full cleanup: set
delete_all_drafts=trueto delete all Draft episodes (bounded bymax_delete).
- Default:
- Default unified mode: run deterministic trajectory cache first, then auto-downgrade to policy executor.
- Deterministic trajectory cache (
scripts/deterministic.ts) is optional acceleration only. - Policy executor (
scripts/executor.ts) is mandatory reliability baseline and must succeed independently. - Set
disable_deterministic_cache=true(or CLI--disable_deterministic_cache true) to skip deterministic mode and run policy executor directly.
- Deterministic trajectory cache (
- If deterministic trajectory cache fails:
- continue with policy executor in the same run,
- record deterministic failure context for later optimization.
- If policy executor fails:
- prioritize policy repair and retry in a loop until business-success criteria pass,
- do not return success before verification passes.
If policy executor stage decisions are unclear, load
references/architecture.mdbefore proceeding.
- After task completion:
- use deterministic failure records plus policy-success evidence to optimize deterministic mode incrementally,
- keep deterministic mode optional; never weaken policy baseline for speed-only changes.
Resources
- Architecture and standards:
references/architecture.md - Workflow map and semantic action plan:
references/plan.md - Unified deterministic->policy entry:
scripts/auto-executor.ts - Executor orchestration entry:
scripts/executor.ts - Deterministic first-level cache entry:
scripts/deterministic.ts - Stage detection module:
scripts/stage-detector.ts - Draft deletion module:
scripts/deleter.ts - Verification module:
scripts/verifier.ts - Shared core runtime module:
scripts/core.ts - CLI wrapper:
scripts/run.ts - Deterministic CLI wrapper:
scripts/run_deterministic.ts - Regression checks:
tests/test_regression.sh