---
name: save-checkpoint
description: Save the current context, rules, and referenced files as a reusable checkpoint for future use.
argument-hint: "<name> <topic>"
---

# Save Checkpoint

Extract the current context, reference files, rules, and active skills to create a reusable checkpoint.

## Inputs

1.  **Name**: A short slug/identifier representing the checkpoint name (e.g., `new-agent-skill`, `docs-writing`).
2.  **Topic**: A description of the content/theme handled by this checkpoint (e.g., `Create a skill for AI agents.`).

Parse these from the user's argument (e.g., `new-skill "Create a skill for AI agents."`). If any of these inputs are missing or unclear, ask the user interactively to provide them.

## Output File Location

-   Save the checkpoint file under `../../checkpoints/` relative to this skill file.
-   Format the filename as: `checkpoint-<name>-<timestamp>.md` where `<timestamp>` is the current timestamp (YYYYMMDD_HHmm) in local time, and `<name>` is the checkpoint name.

## Checkpoint Document Structure

Create the checkpoint markdown file with the following sections (excluding session-specific status, changes, and next steps):

1.  **Checkpoint Info**:
    -   **Name**: The checkpoint name.
    -   **Topic**: The content/theme handled by this checkpoint.
2.  **Relevant Info**:
    -   Organize and summarize background, design, and domain knowledge needed for this topic.
3.  **Templates** (Optional):
    -   Relative paths and summaries of reusable template files if any.
4.  **Precautions** (Optional):
    -   Summarize constraints, coding rules, required skills, and other precautions during development.

## Steps

1.  Parse `name` and `topic` from the arguments (or ask the user if missing).
2.  Gather relevant info, templates, and precautions from the current context. Do not include any other information.
    -   Relevant Info (Required): Organize and summarize the information necessary for the topic.
    -   Templates (Optional): Describe the summary and path of any reusable template files if any.
    -   Precautions (Optional): Summarize the precautions regarding the topic.
3.  Create the content according to the checkpoint document structure, and write it to the target checkpoint file (`../../checkpoints/checkpoint-<name>-<timestamp>.md`).
4.  Report to the user that the checkpoint has been saved successfully.

## Precautions

-   Do not include personal or confidential information in the checkpoint.
