AGENT SKILL

session-delete

Deletes a Claude Code session file, with optional cleanup of associated task lists and tasks. Warns about orphaned tasks before deleting. Use when the user has already named or identified one specific session to remove — "delete session <id>", "remove session". For finding and bulk-deleting sessions by criteria (old/empty/tiny), use session-cleanup instead.

License 许可
Apache-2.0
最近更新
2026-11-15
Stars
★ 0
Forks
0

01 前言 Front Matter

name
session-delete
description
Deletes a Claude Code session file, with optional cleanup of associated task lists and tasks. Warns about orphaned tasks before deleting. Use when the user has already named or identified one specific session to remove — "delete session <id>", "remove session". For finding and bulk-deleting sessions by criteria (old/empty/tiny), use session-cleanup instead.
allowed-tools
Bash(python3 "${CLAUDE_PLUGIN_ROOT}/scripts/session_store.py":*) Bash(ls:*)

02 资源文件 1

03 SKILL.md 正文

Session Delete

Delete a session and optionally its associated tasks.

When to Use

  • User has already named or identified one specific session to delete
  • "delete session <id>", "remove session"

When NOT to Use

  • Finding and bulk-deleting sessions by criteria (old/empty/tiny) → use session-cleanup instead

Step 1: Preview what will be deleted

python3 "${CLAUDE_PLUGIN_ROOT}/scripts/session_store.py" session-detail <session-id>

Show the session summary, token usage, and associated task lists. Also show the file path (session.path) so the user can inspect it manually if desired: ls -la "<path>".

Step 2: Confirm before deleting

NEVER delete without an explicit AskUserQuestion confirmation — never a printed "(yes/no)" prompt. A printed question is not a real turn boundary; AskUserQuestion is. Present:

  • Session ID and project
  • File path (for manual inspection)
  • Number of associated task lists and tasks that will become orphans

Ask via AskUserQuestion: "Delete this session?" with a follow-up on whether to also delete associated tasks (default: do not delete tasks unless the user opts in).

Step 3: Execute deletion

If user confirms, delete with or without tasks:

# Delete session only (tasks become orphans)
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/session_store.py" delete-session <session-id>

# Delete session and associated tasks
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/session_store.py" delete-session <session-id> --delete-tasks

Always delete through this script, not a manual rm — it validates the ID, keeps the deletion contained to the projects directory, and reports orphaned task lists. A manual rm skips all of that.

Step 4: Report result

Show what was deleted: session file path, and if tasks were deleted, how many.

Safety

  • Never delete without an explicit AskUserQuestion confirmation — never a printed "(yes/no)" prompt
  • Always show what will be deleted first
  • Always show the file path for manual inspection
  • Default to NOT deleting associated tasks unless user opts in
  • Delete only through the script (Step 3) — never suggest a raw rm on a session file

Testing & Validation

Eval suite: evals/session-delete/ — 3 scenarios, skill-tester Quick Workflow blind comparison, all passed. Eval 3 verified that declining the AskUserQuestion confirmation correctly aborts the deletion.

Last dated run record: evals/session-delete/workspace/iteration-1/eval-{1,2,3}/with_skill/grading.json, 2026-09-03. scripts/smoke_test.py structural self-check also passing as of the same date.

Verify this skill activates on:

  • "delete session abc-123"
  • "remove this session"

Verify it does NOT activate on:

  • "clean up old sessions" (bulk, criteria-based) → session-cleanup

Quality gates:

  • [ ] Deletion is always gated by a real AskUserQuestion call, never a printed "(yes/no)" prompt
  • [ ] No raw rm shortcut is offered as a deletion path

04 同仓库更多 Skills

AndreHahm
AndreHahm/andres-cc-marketplace

demo

Fixture skill used by scripts.marketplace_ci sync tests.

★ 0
AndreHahm
AndreHahm/andres-cc-marketplace

export-demo

Fixture skill used by scripts.marketplace_ci export tests.

★ 0
AndreHahm
AndreHahm/andres-cc-marketplace

work-to-development

Validate an accepted Linear Issue's readiness for implementation (criteria, dependencies, duplicate/existing artifacts) and request governed branch/worktree creation through git-kit:starting-work — recording work-started Git/GitHub evidence and a deliberate Linear Started transition only after Git identity is read back and verified. Use when asked to start work on a Linear issue, begin development for an accepted issue, or prepare an accepted issue for implementation. Never creates a branch directly — always delegates to git-kit.

★ 0
AndreHahm
AndreHahm/andres-cc-marketplace

work-linking

Create and maintain stable cross-system links and authority labels between Notion and Linear records, and detect/repair drift between them. Use when asked to link a Notion record to a Linear record, check for drift between Notion and Linear, or repair a broken/stale link. Repairs only the bounded non-authoritative copy or link — never chooses by newest timestamp, and never creates a reverse-write loop against either system's own authority.

★ 0
AndreHahm
AndreHahm/andres-cc-marketplace

status-and-learning

Produce a dated, explicitly non-live Linear-to-Notion progress summary, or capture an outcome/learning after work completes. Use when asked to summarize progress to Notion, report portfolio status, or capture what was learned from a completed piece of work — not to disposition open follow-up items (see open-item-management for that). Never runs automatically or continuously — every summary is a deliberate, approved snapshot, not a live sync.

★ 0
AndreHahm
AndreHahm/andres-cc-marketplace

repository-gates

Discover, delegate, record, and invalidate this repository's actual Git/GitHub lifecycle gates (pre-commit, pre-push, PR required checks, Codex delta review, review requirements, merge rights) and the repository-policy provider profile that maps governed operations to git-kit. Use when asked what gates apply to this repository, to discover repository policy before starting Wave 2 work, or to check whether prior gate evidence is still valid after new commits. Discovery and delegation only — never executes a gate's own internal logic, and never invents a gate the repository doesn't actually define (in particular, never assumes a "Review Changes" gate exists).

★ 0