Skip to content
Agentmart
Submit a tool

preserve

Keep each approved plan as a record in the plans directory, on approval or on request

Skill by markwharton

IndexedMIT★ 12
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/markwharton-preserve

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Keep each approved plan as a record in the plans directory, on approval or on request

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/preserve

What's inside

Skill name
preserve
Description
Keep each approved plan as a record in the plans directory, on approval or on request
License
MIT
Instructions
92 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# pk preserve

`pk preserve` copies an approved Claude Code plan, byte for byte, into
the plans directory, `preserve.dir` in `.pk.json`, under a dated,
sequenced, slugged filename and commits it with a `plan:` message.
The commit holds the plan file alone; anything else staged stays
staged.

## Modes

The hook fires when a plan is approved (ExitPlanMode) and follows
`preserve.mode` in `.pk.json`:

- `auto`: preserve and commit at once
- `manual` (default): record the approved plan in a pending pointer
  and say so; nothing is committed until you ask
- `off`: do nothing

## Completing a manual preserve

Type `/plankit:preserve`, or run `pk preserve` in the repository. The
explicit invocation consumes the pending pointer and commits, whatever
the mode. `--push` also pushes the commit. `--dry-run` previews the
filename and commit message.

Identical plan bytes are never preserved twice; a duplicate reports
the existing file. A plan shorter than `minPlanSize` bytes is ignored (`grep minPlanSize internal/preserve/preserve.go`).
A typed run with nothing pending says so; the hook declines in
silence, because its stdout is the response envelope.

## Preserving a plan revised after approval

The approval hook reads the plan's path from `tool_response.filePath`
on stdin and records it in `.git/pk-pending-plan`. A typed
`pk preserve` consumes the pointer. A plan revised after it was
preserved has no pointer: preserve it again with `--plan <path>`, and
it becomes the next sequence number for the day. The same rules
apply: the path is a Claude Code plan under `~/.claude/plans/`, and
identical bytes report the existing file. While the pointer names a
different plan, `--plan` refuses and names both files; preserve the
pending plan first.

## Discarding a pending plan

The hook records the pointer in the repository the session runs in.
When the approved plan belongs to another repository and was preserved
there with `--plan`, the pointer here still names it, and a later
`pk preserve` would commit that plan into the wrong repository.
`pk preserve --discard` removes the pointer without preserving anything
and names the plan it pointed at; with nothing pending it says so.
`--dry-run` shows what would be discarded. A pointer whose plan file no
longer exists is discarded the same way and reported as such.
`pk status` shows the pending plan, so a stale pointer is easy to see.
Discarding is the developer's call: a session never discards a plan on
its own.

## Flags

<!-- generated: flags -->
```
  --discard
        Remove the pending plan pointer without preserving the plan it names
  --dry-run
        Preview without writing or committing
  --plan <value>
        Plan file to preserve, for a plan revised after approval (a path under ~/.claude/plans)
  --push
        Push to origin after committing
```

Every command also accepts `--plain`, `--project-dir <value>`, and `--quiet`; see `pk help help`.
<!-- /generated: flags -->

## Settings

<!-- generated: settings -->
The `preserve` section of `.pk.json`:

```
"preserve": {
  "dir": "<dir>",
  "mode": "auto" | "manual" | "off"
}
```

- `preserve.dir`: a directory, relative to the repository root; default `docs/plans`. Where preserved plans are written and kept immutable; forward slashes, inside the repository.
- `preserve.mode`: `auto`, `manual`, or `off`; default `manual`. An approved plan is committed at once, recorded for `/plankit:preserve` to commit, or ignored.

An unknown key or a value outside these fails the whole file when it loads, with a message naming the key: `pk` commands exit 2, and each hook reports the message and takes no action until it is fixed. An absent key means its default. `pk status` reads the file back and reports the first problem.
<!-- /generated: settings -->

From markwharton/plankit, MIT.

More from markwharton/plankit

Signals

Stars
12
Forks
0
Open issues
0
Last commit (this folder)
Oct 19, 2026 (11 days ago)
Last release
Oct 19, 2026 (11 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from markwharton

Cite this page

preserve skill. Agent Mart. https://agentmart.dev/skills/markwharton-preserve (last updated 2026-10-24)