/xp-agents:xp-end-sessionfrom xp-agents
Ends a Claude Code session by drafting a summary, force-closing open questions, and triaging concerns and debts that may have been addressed.
Ships in xp-agents. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Sequential discipline. Run Step 1 → 2 → 3 → 4 → 5 strictly, one step per turn — make the call, observe, then decide the next. Never batch an
AskUserQuestionwith the action consuming its answer (a force-close/defer question vs the append that records its disposition).
The injected preload state provides:
SMM_DIR=<path> — pass to every append.sh call.### CANDIDATES — mechanical line-per-event narrative draft (newest at the bottom; an ... prefix means older lines were trimmed to fit budget).### OPEN_QUESTIONS — event ids of questions still open in this session.### MAYBE_ADDRESSED — concern/debt event ids whose files overlap a recent commit, each followed by indented git commit hash(es) for the audit trail (resolvable via git show).### UNCOMMITTED — count of concerns/debts/discoveries newer than the last commit event.Do not prompt the user before Step 1 — they invoked /xp-end-session because they want this work done.
Write a 1–2 paragraph narrative summary of the current session (≤2000 chars — the schema budget). Keep verbs in past tense, name what shipped and what's open. Use the ### CANDIDATES text to trigger your memory. Append using:
${CLAUDE_PLUGIN_ROOT}/smm/append.sh --smm-dir <SMM_DIR> \
--type session_summary \
--agent xp-end-session \
--content "<narrative>"
For each id in ### OPEN_QUESTIONS:
AskUserQuestion with options: answer / defer / drop.AskUserQuestion to capture the free-text answer (or use the Other field). Then:
${CLAUDE_PLUGIN_ROOT}/smm/append.sh --smm-dir <SMM_DIR> \
--type answer --agent xp-end-session \
--references '["<question_id>"]' \
--content "<user's answer>"
python3 ${CLAUDE_PLUGIN_ROOT}/smm/smm_cli.py --smm-dir <SMM_DIR> \
question close --won-fix --event-id <question_id> --rationale "<one-line reason>"
Judge each ### MAYBE_ADDRESSED grouping yourself — do not prompt the
user. Inspect any cited commit via git show <hash> (works for both solo
and teammate worktree commits). For each grouping:
Auto-resolve when the cited commits clearly fix the concern's intent. All three must hold:
files are the obvious target of the change,${CLAUDE_PLUGIN_ROOT}/smm/append.sh --smm-dir <SMM_DIR> \
--type status --agent xp-end-session \
--content "Resolved by <commit_hash>: <one-line rationale>" \
--working-on '[]' \
--metadata '{"action":"end_session_drop","resolves":["<concern_id>"],"resolved_by_commits":["<commit_hash>"]}'
Defer when the file overlap is incidental, intent isn't clearly fulfilled, or you can't confidently judge from available context. Append nothing — the concern stays open and re-surfaces at next kickoff. Default to defer when in doubt.
After processing all items, print a one-line summary to the user:
"Auto-resolved N items: . Deferred M items: — ."
Run AFTER Step 1 so the just-appended session_summary event is included in the re-scan:
python3 ${CLAUDE_SKILL_DIR}/scripts/draft_summary.py --smm-dir <SMM_DIR> \
| python3 ${CLAUDE_SKILL_DIR}/scripts/write_history.py --smm-dir <SMM_DIR>
Retention is N=5 entries — appending the 6th evicts the oldest. The pipe exits non-zero if the draft is malformed JSON or the existing history file is corrupt — surface the error and stop.
Surface the ### UNCOMMITTED value to the user verbatim. If > 0, suggest one of:
metadata.resolves: [<id>] (mirrors Step 3's auto-judge pattern)./xp-work-selection and can be dropped, deferred, or adopted then.Example output:
"Open SMM items newer than last commit: N (concerns/debts/discoveries). Drop now if addressed, or let next kickoff triage them."
If N == 0, no nag needed; report briefly and stop.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub paulingalls/xp-agents --plugin xp-agents19 skills in this plugin
/xp-acceptVerify acceptance criteria for in-progress stories and mark each done or deferred. Use when a story is ready to accept./xp-assignPer-story execution-shape decision: continue in-agent, or spawn one teammate at the chosen tier. Runs once per story after its plan is reviewed./xp-free-closeClose ad-hoc work done outside a sprint or plan: review the free branch diff and merge it into the integration branch./xp-kickoffSession start orchestrator: sequences retrospective, sprint setup, work selection, housekeeping. Use every session.Other plugins' skills for the same job