Commandtypescript
/done Command
Archive a completed feature to .ai/know/archive/
Prerequisites
- Activate the know-tool skill for graph validation
Workflow
1. Detect Git Worktree Status (Optional)
Steps:
- Check if feature has an associated worktree:
WORKTREE_PATH=".ai/worktrees/<feature-name>" HAS_WORKTREE=false if [ -d "$WORKTREE_PATH" ]; then HAS_WORKTREE=true fi - Determine current location:
MAIN_WORKTREE=$(git worktree list | head -1 | awk '{print $1}') CURRENT_TOPLEVEL=$(git rev-parse --show-toplevel) - If worktree exists (
HAS_WORKTREE=true):- If currently IN that worktree: Switch to main repo first
- If in main or different worktree: Proceed from current location
- If no worktree: Skip to step 2 (Verify Feature Completion)
2. Verify Feature Completion
Steps:
- Extract feature name from conversation or prompt user
- Verify feature exists in
.ai/know/<feature-name>/ - Check that all tasks in
todo.mdare completed (all checkboxes checked)- If not all complete, warn user and ask for confirmation
- Check spec-graph status is "done" or "complete"
3. Merge Feature Branch (if worktree exists)
Skip this step if HAS_WORKTREE=false
Steps:
- Ensure in main repo:
cd $MAIN_WORKTREE - Sync .ai/know from worktree (changes made in worktree):
cp -r "$WORKTREE_PATH/.ai/know/<feature-name>/" .ai/know/<feature-name>/ - Merge feature branch:
git checkout main git merge --no-ff feature/<feature-name> -m "Merge feature: <feature-name>" - Ask user: "Delete feature branch? [Yes/No]"
- If Yes:
git branch -d feature/<feature-name>
- If Yes:
4. Remove Git Worktree (if worktree exists)
Skip this step if HAS_WORKTREE=false
Steps:
- Remove the worktree:
git worktree remove "$WORKTREE_PATH" - Verify removal was successful
5. Archive Feature Directory
Steps:
- Move entire feature directory:
- FROM:
.ai/know/<feature-name>/ - TO:
.ai/know/archive/<feature-name>/
- FROM:
- Confirm the move was successful
6. Update Spec-Graph
Steps:
- Update phase status to "done" (using haiku agent)
- Validate both spec-graph and code-graph
- Confirm graphs are consistent
Example Usage
User: /know-done user-authentication
Assistant: Checks completion, moves to archive, confirms success
Safety Checks
- Verify all todos are checked before archiving
- Confirm feature directory exists
- Ensure archive directory exists (create if needed)
- Don't overwrite existing archived features (prompt for new name if conflict)
Notes
- Features can be un-archived by manually moving them back
- Archive maintains full history (proposal, todo, plan, spec)
- Worktree handling (optional - only if
.ai/worktrees/<feature>/exists):- Worktree path:
.ai/worktrees/<feature-name>/ - Branch naming:
feature/<feature-name> - Automatically detects if feature was built in a worktree
- Switches to main repo if currently in feature worktree
- Syncs
.ai/know/<feature>/from worktree to main - Merges feature branch using
--no-fffor clear history - Removes worktree after successful merge
- Skips worktree steps if no worktree exists (feature developed directly on main)
- Worktree path: