prune-plans-pb
Delete old plan versions or entire plans based on retention preferences, explicit age, or interactive selection. Keeps the latest version of each plan by default.
What this skill does
<purpose>
Prune old plan versions from `~/.things/playbook/plans/`. Three modes: use the configured `plan_retention_days` preference (default), specify `--older-than <days>` explicitly, or use `--interactive` to pick specific plans or versions. Default and `--older-than` modes delete old VERSIONS but always keep the latest version per slug. Interactive mode allows deleting entire plans or specific versions.
</purpose>
<critical-constraint>
Never delete the only remaining version of a plan. If a plan directory has only one `v*.md` file, it cannot be pruned in age-based modes. In interactive mode, warn the user and require explicit confirmation.
</critical-constraint>
<steps>
<step id="load-config" number="1">
<description>Load Configuration</description>
<load-config>
<action>Resolve the user's home directory.</action>
<command language="bash" output="home" tool="Bash">echo $HOME</command>
<constraint>Never pass `~` to the Read tool.</constraint>
<read path="<home>/.things/config.json" output="config" />
<if condition="config-missing">Tell the user: "Run `/things:setup-things` first." Then stop.<exit /></if>
<read path="<home>/.things/playbook/preferences.json" output="preferences" />
<if condition="preferences-missing">Tell the user: "Run `/setup-pb` first." Then stop.<exit /></if>
</load-config>
</step>
<step id="determine-mode" number="2">
<description>Determine Pruning Mode</description>
<action>Parse `$ARGUMENTS` for:</action>
- **--older-than <days>**: Delete plan versions older than N days (keeps latest per slug)
- **--interactive**: Show all plans with version counts for manual selection
<if condition="--interactive">
<action>Use interactive mode (step 4).</action>
</if>
<if condition="--older-than provided">
<action>Use the explicit days value.</action>
</if>
<if condition="no flags">
<action>Use `preferences.plan_retention_days`.</action>
<if condition="plan_retention_days is null or missing">
<action>Tell the user: "No retention policy configured and no `--older-than` flag provided. Either run `/setup-pb reconfigure` to set `plan_retention_days`, or use `--older-than <days>` or `--interactive`." Then stop.</action>
<exit />
</if>
</if>
</step>
<step id="find-candidates" number="3">
<description>Find Deletion Candidates (age-based)</description>
<if condition="age-based mode">
<action>For each plan directory in `<home>/.things/playbook/plans/`, list all `v*.md` files. For each file, parse the date from frontmatter. Calculate age in days from today.</action>
<action>Filter to versions older than the threshold, but NEVER include the latest (highest-numbered) version of any plan.</action>
<if condition="no candidates">
<action>Tell the user: "No plan versions older than <N> days found (latest versions are always kept)." Then stop.</action>
<exit />
</if>
<output>
Plan versions older than <N> days (latest versions excluded):
<slug>/v<N>.md (<date>, <age> days old)
<slug>/v<N>.md (<date>, <age> days old)
...
Total: <count> versions to delete
</output>
<ask-user-question>
<question>Delete these <count> old plan versions?</question>
<option label="Yes">Delete all listed versions</option>
<option label="No">Cancel -- keep everything</option>
</ask-user-question>
</if>
</step>
<step id="interactive-selection" number="4">
<description>Interactive Selection</description>
<if condition="interactive mode">
<action>List all plan directories with their version counts and latest version info.</action>
<if condition="no plans">
<action>Tell the user: "No plans found." Then stop.</action>
<exit />
</if>
<output>
Plans:
1. <slug>/ -- <version-count> versions (latest: v<N>, "<title>", <status>)
2. <slug>/ -- <version-count> versions (latest: v<N>, "<title>", <status>)
...
</output>
<ask-user-question>
<question>Which plans would you like to manage? Enter numbers (e.g., "1,3") or "all".</question>
</ask-user-question>
<action>For each selected plan, show individual versions:</action>
<output>
<slug>/
v1.md -- <date>, "<title>" <status>
v2.md -- <date>, "<title>" <status> (latest)
</output>
<ask-user-question>
<question>What would you like to delete? Enter version numbers (e.g., "v1"), "old" (all except latest), or "all" (entire plan).</question>
</ask-user-question>
<if condition="user-chose-all AND plan-has-only-one-version">
<ask-user-question>
<question>This is the only version of "<slug>". Deleting it removes the entire plan. Are you sure?</question>
<option label="Yes">Delete the plan entirely</option>
<option label="No">Cancel</option>
</ask-user-question>
</if>
<ask-user-question>
<question>Confirm: delete <count> selected items?</question>
<option label="Yes">Delete selected</option>
<option label="No">Cancel</option>
</ask-user-question>
</if>
</step>
<step id="delete-files" number="5">
<description>Delete Files</description>
<action>Delete each confirmed file.</action>
<command language="bash" tool="Bash">rm "<home>/.things/playbook/plans/<slug>/v<N>.md"</command>
<action>If all versions of a plan were deleted, remove the empty directory.</action>
<command language="bash" tool="Bash">rmdir "<home>/.things/playbook/plans/<slug>" 2>/dev/null || true</command>
</step>
<step id="rebuild" number="6">
<description>Trigger Rebuild</description>
<action>Read `<home>/.things/registry.json` to find the rebuild command for `playbook/plans`. Execute it.</action>
<constraint>If the rebuild command is not found, fall back to: `python3 <cached-path>/scripts/rebuild-index.py <home>/.things`</constraint>
</step>
<step id="git-workflow" number="7">
<description>Handle Git Workflow</description>
<git-workflow>
<action>Pull latest before committing.</action>
<command language="bash" tool="Bash">git -C <home>/.things pull --rebase 2>/dev/null || true</command>
<action>Read git workflow from `config.json` (`git.workflow`).</action>
<if condition="workflow-auto">Automatically `git add`, `git commit -m "prune: <count> plan versions"`, and `git push`.</if>
<if condition="workflow-ask">
<ask-user-question>
<question>Commit and push the pruned plans?</question>
<option>Yes -- commit and push</option>
<option>Commit only</option>
<option>No -- I'll handle git myself</option>
</ask-user-question>
</if>
<if condition="workflow-manual">Tell the user the pruning is complete.</if>
</git-workflow>
</step>
<step id="confirm" number="8">
<description>Confirm</description>
<completion-message>
Pruned <count> plan versions.
Remaining: <remaining-plans> plans with <remaining-versions> total versions
</completion-message>
</step>
</steps>
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.