---
name: serialize
description: Update the active session file before closing down, or checkpoint mid-session. Refreshes the entrypoint and appends a dated log entry. Supports --name to give the session a descriptive suffix, and --archive to move it to sessions/archive/ so the next launch starts fresh. Prompts at buildup (first entry after scaffolding) and teardown. Invoke when the user asks "do you need to serialize anything?" or explicitly via /serialize. This is the session-maintenance primitive for muxr-managed harnesses (tanuki, dunn, nomograph).
allowed-tools: Bash(git *) Bash(git) Bash(mv) Bash(muxr *) Bash(muxr) Read Edit Write
---

# Serialize

Session maintenance for muxr-managed harnesses. The session file is the
memory of the session. This skill keeps it current so re-entry requires
no re-explanation.

## When to use

- User asks "do you need to serialize anything?" -- always run this
- User explicitly invokes `/serialize`
- At meaningful mid-session checkpoints (phase transitions, major
  decisions, new topic)
- Always at session close

## The session file

Lives at `<harness-root>/campaigns/<campaign>/sessions/<date>[-<suffix>].md`.

Frontmatter has two fields: `campaign:` and `entrypoint:`. The body is
an append-only dated log.

## What this skill does

### Checkpoint mode -- no flags

1. Refresh `entrypoint:` in frontmatter. One line describing where the
   next session should pick back up. Not a summary of this session; a
   pointer to the next unit of work.
2. Append a dated log entry (`## YYYY-MM-DD`) with:
   - Decisions locked
   - Blockers hit
   - What landed (files written, changes shipped)
   - What's pending for the next session

Show the diff for approval before writing.

### Rename mode -- `/serialize --name <suffix>`

Everything in checkpoint mode, plus rename the session file:

```
campaigns/<campaign>/sessions/2026-04-24.md
-> campaigns/<campaign>/sessions/2026-04-24-<suffix>.md
```

Suffix is kebab-case, describes the session topic. Examples:
`retrieval-precision`, `cadence-prep`, `airgap-blockers`.

**Do not `mv` the file yourself.** Delegate to muxr so the tmux
session, the session file on disk, and the runtime's display name
all stay coupled:

```
muxr rename <harness>/<campaign>/<date>-<suffix>
```

(e.g. `muxr rename tanuki/harness/2026-04-24-retrieval-precision`).

`muxr rename` is authoritative for harness state: it moves the
session file, renames the tmux session, and notifies the runtime.
Skip the muxr call only if muxr is not available in the harness;
fall back to a direct `mv` then.

After the rename completes, do the checkpoint-mode work (refresh
`entrypoint:`, append the dated log entry) against the *new* path.

Use when the session's topic has crystallized and you want the filename
to reflect it.

### Archive mode -- `/serialize --archive [<suffix>]`

Everything in checkpoint mode, plus move the session file:

```
campaigns/<campaign>/sessions/2026-04-24[-<existing-suffix>].md
-> campaigns/<campaign>/sessions/archive/2026-04-24-<suffix>.md
```

If a suffix is provided and the file doesn't already have one, add it
during the move. If already suffixed, keep the existing suffix unless
a new one is passed (override).

Use at session close when the work is done for good. Next launch on this
campaign starts a fresh session file.

## Prompting discipline

**Buildup prompt** -- the first time `/serialize` runs on a freshly
scaffolded session file (body has only the TEMPLATE skeleton), ask:
"Want to name this session now? Pass `--name <suffix>` if so, or skip
for a date-only filename."

**Teardown prompt** -- when the user signals session close ("wrapping
up," "done for today," "closing down"), ask: "Archive this session?
If yes, what suffix describes it? e.g. `--archive retrieval-precision`."

## Discipline

- Show the diff for approval before writing or moving any file.
- Do not touch `campaign.md` unless paths, synthesist_trees, or
  conventions actually changed, and only on explicit instruction.
- If the session file does not exist, stop and surface to the human --
  scaffolding is muxr's job, not this skill's.
- Do not overwrite existing log entries. Append only.
- Do not delete `entrypoint:`; rewrite it. An empty entrypoint breaks
  re-entry.

## Finding the session

The session file path comes from the muxr launch:
`muxr <harness> <campaign>` opens `campaigns/<campaign>/sessions/<date>.md`.

In a running session, Claude typically has this path in context from
the launch composition. If not, glob:

```
campaigns/*/sessions/<date>*.md
```

and pick the most recent non-archived file.

## Usage

```
/serialize                              # mid-session checkpoint
/serialize --name retrieval-precision   # checkpoint + rename
/serialize --archive                    # checkpoint + archive (date only)
/serialize --archive retrieval-precision # checkpoint + archive with suffix
```

## What this skill won't do

- Invent an entrypoint -- if there's no clear next action, ask the human
- Modify the campaign file -- separate, explicit operation
- Create a session file from scratch -- that's muxr's job
- Rename across campaigns -- the file stays in its campaign dir
