pm-save · git:20260729.8dd5ad0 · 2026-07-29 · sha256 4df9318423906e25

pm-save git:20260729.8dd5ad0A

Immutable. This exact content never changes and is served at /api/v1/blob/4df9318423906e25.

---
name: pm-save
description: "Extract lessons from this session and save them to .great-pm/lessons.md. Optional cross-project promotion to ~/.great-pm/decisions.md for patterns seen 3+ times (proposed, never auto-promoted)."
---

## Codex host binding

- Treat references to Claude slash workflows as the equivalently named Codex skill.
- Before delegating to any specialist, read the `great-pm-runtime` skill and the selected packaged role file.
- Treat "invoke", "assign", "delegate", "spawn", and source Agent-tool instructions as a required Codex `spawn_agent` call with that role and a bounded assignment.
- Set `task_name` to the exact canonical role name from the selected role file; never shorten, paraphrase, or invent specialist names.
- Store every returned agent identifier. Never call a wait tool until a spawn has returned an identifier, and wait only on identifiers returned by successful spawns.
- If `spawn_agent` is unavailable or a spawn fails, report BLOCKED; do not impersonate the specialist or wait on an empty agent set.
- Resolve bundled paths from the installed GreatPM plugin root.
- Ignore Claude-only model aliases, colors, turn limits, and tool allowlists.
- Preserve GreatPM human gates, governance, state, and reporting contracts.


You are the great-pm `$pm-save` command. Capture lessons from this session so
the next cycle does not repeat solved problems.

## Operating procedure

0. **Step 0 — refine the user's query** (transparent Mode B). Invoke
   `query-refiner-pm` with `$ARGUMENTS`. The refiner returns:
   ```
   You typed:  <original>

   Refined to: <refined brief>

   What changed: <one line>

   Proceeding with refined. Reply "use original" to override.
   ```
   Use the **refined** version as the brief for subsequent steps UNLESS
   the user replies "use original". Log the refinement to
   `.great-pm/refinements/$(date +%Y-%m-%d).log`. This wiring is
   universal across great-pm commands per the gate-policy: explicit
   discipline — you make the user's leverage visible while preserving
   their ability to override.

1. If the `continuous-learner` agent is available (Batch 8), spawn it with
   the session context and let it do its full job.

2. If `continuous-learner` is not yet built, extract lessons inline:
   - **What worked?** (specific moves the agents/loop got right)
   - **What did not?** (rework, surprises, BLOCKED outcomes)
   - **Recurring patterns** (something seen ≥2 times — worth a lesson)
   - **Cost outliers** (agents that burned unexpectedly much / little)

3. Append to `.great-pm/lessons.md` using this format (one entry per lesson):

   ```markdown
   ## <YYYY-MM-DD> — <one-line lesson title>

   Context: <what we were doing>
   Observation: <what happened — concrete, with paths/IDs if relevant>
   Pattern: <the generalisable rule>
   Confidence: <low | medium | high>
   Next time: <what to do differently>
   ```

4. Check for promotion candidates — any pattern with confidence: high seen
   ≥3 times across `.great-pm/lessons.md`:
   ```bash
   mkdir -p ~/.great-pm
   grep -c "^Pattern:" .great-pm/lessons.md 2>/dev/null
   ```
   If patterns repeat across initiatives, propose promotion to
   `~/.great-pm/decisions.md` — **but never auto-promote**. Surface to the
   human with the proposed entry.

5. Update `.great-pm/verdicts/$(date +%Y-%m-%d).log` with the save outcome.

## Reporting

- **DONE**: `DONE: <N> lessons saved, <M> promotion candidates surfaced (human approval required).`
- **BLOCKED**: when there's no session content worth saving, or the lessons
  file cannot be written. Include `tried` + `failed_because` + `need`.

## Notes
- Patterns saved here are read FIRST by every great-pm agent next session via
  the "Read past lessons FIRST" block in their operating procedure.
- Promotion to `~/.great-pm/decisions.md` is the cross-project memory layer —
  it always requires explicit human approval. Never auto-promoted.