| name | plan-archive |
| description | Archive a completed or abandoned plan for future reference. Use when the user runs /plan-archive or asks to archive a finished plan. |
| license | MIT |
| disable-model-invocation | true |
You are archiving the user's completed (or abandoned) plan for future reference.
To do this, follow these steps precisely:
- Read
.copilot/plan-critique-config.json and get plansFolder path from settings. If that file does not
exist, read .claude/plan-critique-config.json instead.
If neither file exists or plansFolder is not set:
Respond with "No plans folder configured. Run /plan-create first to set up."
- Get the Copilot CLI session id from the
COPILOT_AGENT_SESSION_ID environment variable. Read it with
echo $COPILOT_AGENT_SESSION_ID on macOS or Linux, or $env:COPILOT_AGENT_SESSION_ID on Windows.
If the variable is empty, use the literal value default instead. Store this as sessionId.
- Clean up stale sessions: scan
[plansFolder]/.sessions/ for files and delete every file that has not been
modified in the last 7 days. This is non-blocking cleanup, never abort the run because of it.
- Read the current session's plan from
[plansFolder]/.sessions/[sessionId] if it exists. Store as sessionPlan.
- Scan
[plansFolder]/ for subdirectories (each subdirectory is a plan).
Exclude archived/ and .sessions/ folders and any files, only list plan directories.
If no plan folders exist: Respond with "No plans found. Nothing to archive."
- Select the plan to archive:
- Check prerequisites. If
[plansFolder]/[selected-plan]/plan.md does not exist or is empty:
Respond with "Nothing to archive. Plan file is missing or empty."
- Ensure
[plansFolder]/archived/ exists, create it if not.
- Extract metadata:
- Read
plan.md to get the plan title (first H1 heading). If no title, use folder name.
- Read
critique.md to get keywords (if available)
- Read
execution-log.md to get execution status (if available)
- Generate archive folder name using format:
YYYY-MM-DD_HH-MM-SS_[slug]/
Example: 2026-01-12_14-30-00_add-user-authentication/
- Create the archive folder at
[plansFolder]/archived/[folder-name]/
- Copy contents from
[plansFolder]/[selected-plan]/ to the archive:
- Include:
plan.md, execution-log.md (if exists), all other files (SQL, images, etc.)
- Exclude:
critique.md, execution-state.json
- Create
archive-info.md in the archive folder using the format in
archive-info-format.md.
- Delete the original plan folder
[plansFolder]/[selected-plan]/ entirely.
- Clean up session references to the archived plan:
- Delete
[plansFolder]/.sessions/[sessionId] if it contains the archived plan slug.
- Scan all other session files and delete any that reference the archived plan (handles stale references).
- Respond with confirmation:
Plan archived to: [plansFolder]/archived/[folder-name]/
The original plan folder has been removed.
Create a new plan with `/plan-create`.
Notes:
- Never include critique.md in the archive (only keywords are preserved in archive-info.md)
- Always include the full original plan and all supporting files
- Include execution log only if the plan was executed
- Use current timestamp for the archive folder name
- Preserve the original file structure within the archived folder
- Always delete the original plan folder after archiving
- It is valid to archive a plan that was never executed (abandoned, reference, or superseded plans).
In this case, the execution status will be
NOT_EXECUTED.