Tidy - Session Completion Checklist
Complete all work and clean up the workspace. Work is NOT complete until git push succeeds.
Usage
code
/tidy
Run this at the end of any work session to ensure all changes are committed, pushed, and issues are updated.
Mandatory Workflow
Execute ALL steps in order. Do not skip steps.
Step 1: Assess Current State
Run these commands to understand the workspace state:
bash
git status git stash list bd list --status=in-progress
Identify:
- •Uncommitted changes
- •Untracked files that should be committed or deleted
- •Stashed changes that need resolution
- •In-progress issues that need updates
Step 2: Handle Uncommitted Changes
If there are changes:
- •Review what changed:
git diff - •Stage relevant files:
git add <specific-files>(avoidgit add -A) - •Commit with clear message: Follow repo's commit style
- •Delete temporary files: Remove any scratch files, debug logs, etc.
If changes shouldn't be committed:
- •Stash if needed later:
git stash push -m "description" - •Or discard:
git checkout -- <file>(only if truly unwanted)
Step 3: Run Quality Gates (if code changed)
Only run if actual code was modified (not just docs or config):
bash
# Language-specific - run what applies go test ./... go vet ./... npm test npm run lint cargo test cargo clippy
Fix any failures before proceeding. Do not push broken code.
Step 4: Update Issue Status
bash
# Check current issues bd list # Close completed work bd close <issue-id> --comment "Completed in <commit-sha>" # Update in-progress items bd update <issue-id> --status=blocked --comment "Waiting on X"
Step 5: File Issues for Remaining Work
If there's follow-up work needed:
bash
bd create --title "Follow-up: description" --description "Details..."
Include:
- •What needs to be done
- •Why it wasn't done now
- •Any relevant context or file references
Step 6: Sync and Push
This is MANDATORY. Work is not complete until pushed.
bash
# Pull any remote changes git pull --rebase # Sync issues with remote bd sync # Push all changes git push # Verify push succeeded git status
The output MUST show "Your branch is up to date with 'origin/...'"
If push fails:
- •Resolve conflicts
- •Re-run quality gates
- •Push again
- •Repeat until successful
Step 7: Clean Up
bash
# Clear resolved stashes
git stash list
git stash drop <stash@{n}> # For each resolved stash
# Prune deleted remote branches
git fetch --prune
# Clean up merged local branches (optional)
git branch --merged | grep -v "main\|master\|\*" | xargs git branch -d
Step 8: Final Verification
Run final checks:
bash
git status # Should show clean working tree git log -1 --oneline # Verify last commit is yours git log origin/main..HEAD # Show commits ahead of main (if on branch) bd list --status=open # Show remaining open issues
Output Format
After completing all steps, report:
markdown
## Session Tidy Complete ### Commits - [commit-sha] [commit-message] ### Issues Updated - Closed: #[id] [title] - Created: #[id] [title] ### Status - Working tree: Clean - Remote sync: Up to date - Open issues: [N] remaining ### Notes [Any follow-up context for next session]
Critical Rules
- •NEVER stop before pushing - Local-only commits are lost work
- •NEVER say "ready to push when you are" - YOU must push
- •NEVER skip quality gates - Don't push broken code
- •NEVER commit sensitive files - Check for .env, credentials, keys
- •ALWAYS verify push succeeded - Check
git statusoutput
Error Recovery
Push rejected (non-fast-forward)
bash
git pull --rebase # Resolve any conflicts git push
Tests failing
bash
# Fix the issue first # Re-run tests # Only then commit and push
Merge conflicts
bash
# Resolve conflicts in each file git add <resolved-files> git rebase --continue git push
Stash conflicts
bash
# Apply stash to see conflicts git stash pop # Resolve conflicts # Either commit or re-stash with new context
When NOT to Use /tidy
- •In the middle of active work (finish the task first)
- •When you need to context-switch urgently (use
git stashinstead) - •For quick questions or research sessions (no code changed)
Guidelines
- •Complete the loop - Every session should end with a clean, pushed state
- •Document what's left - File issues for any incomplete work
- •Update issue status - Keep the backlog accurate
- •Verify everything - Don't assume commands succeeded
- •Hand off cleanly - Next session (or person) should have full context