---
phase: 260521-myj-investigate-context-save-removal
plan: 01
type: execute
wave: 1
status: complete
completed: 2026-05-21
duration: ~50min
tasks_total: 3
tasks_complete: 3
plugin_version_before: 1.10.24
plugin_version_after: 1.10.25
commits:
  - eac0b9e  # Task A: refactor — remove subcommand + dead handler
  - 7752cfd  # Task B: chore — purge user-visible references + golden fixture
  - 104ac27  # Task C (DEPLOY contract step 1): docs — fill v1.10.25 CHANGELOG entry
  - 00f28e2  # Task C (DEPLOY auto-bump): chore — bump plugin to v1.10.25
  - 6cdc733  # Task C wrap-up: Cargo.lock sync + debug note structural follow-up
files_modified:
  - src/cli.rs
  - src/live/mod.rs
  - src/live/context.rs
  - src/common/outcomes.rs
  - src/owl/resume.rs
  - plugin/spt/skills/listen/SKILL.md
  - plugin/spt/skills/live/SKILL.md
  - tests/cli_parse.rs
  - tests/golden_live.rs
  - tests/golden/live/unknown_cmd.stderr
  - scripts/capture_golden.sh
  - plugin/spt/.claude-plugin/plugin.json
  - Cargo.toml
  - Cargo.lock
  - CHANGELOG.md
  - .planning/debug/doyle-fresh-ctx-after-v1-10-16.md
files_deleted:
  - tests/golden/live/context_save.exitcode
  - tests/golden/live/context_save.stderr
  - tests/golden/live/context_save.stdout
psyche_md_byte_identical: true
---

# quick-260521-myj: Investigate context-save removal — SUMMARY

## One-liner

Removed the operator-callable `$LIVE context-save` subcommand entirely
(footgun: a smoke-test invocation could clobber a rich
`agents/{id}/live_context.md` with a 228-byte stub); Psyche LLM is now the
sole writer of live_context.md via the Write tool.

## Tasks Completed

### Task A — `eac0b9e` (refactor)
Removed the operator-callable surface for `$LIVE context-save` from the binary:
- `src/cli.rs`: dropped `ContextSave { self_id, summary }` clap variant
- `src/live/mod.rs`: dropped the dispatch arm + `pub use context::context_save_result` re-export
- `src/live/context.rs`: deleted `run_save` (CLI handler) + `context_save_result` (dead structured variant)
- `src/common/outcomes.rs`: deleted `ContextSaveOutcome` struct
- Test pruning per `<test_pruning_guidance>` from orchestrator (details below)
- `cargo build --release` clean (3 pre-existing dead-code warnings unchanged)

### Task B — `7752cfd` (chore)
Purged user-visible references and regenerated the golden fixture:
- `src/owl/resume.rs`: removed `- Save context: $LIVE context-save {} <summary>` line from live-perch banner; rebalanced placeholder/arg count (9 → 8)
- `plugin/spt/skills/listen/SKILL.md`: reworded L144 from "final context-save trigger" → "final write-to-live_context.md trigger"
- `plugin/spt/skills/live/SKILL.md`: reworded L225 from "captured at last context-save" → "captured at the last live_context.md write"
- `tests/cli_parse.rs`: deleted `parse_live_context_save` test
- `tests/golden_live.rs`: deleted `golden_context_save` test
- `tests/golden/live/unknown_cmd.stderr`: removed `|context-save` token from clap usage line
- `tests/golden/live/context_save.{exitcode,stdout,stderr}`: deleted orphan fixture files
- `scripts/capture_golden.sh`: removed capture step for the deleted context_save fixture (live discovery, not in the plan but required to keep the capture script consistent)
- `cargo test --release --test cli_parse` 42/42 green; `cargo test --release --test golden_live` 14/14 green

### Task C — `104ac27` + `00f28e2` + `6cdc733` (deploy + docs)
Patch-bumped plugin + binary, deployed, updated debug note, sanity-checked psyche.md:
- `CHANGELOG.md`: filled v1.10.25 entry under `### Removed` heading (UX-focused language per project convention)
- DEPLOY.ps1 -Bump patch: 1.10.24 → 1.10.25; marketplace HEAD pushed (`933b798`); plugin cache refreshed; installed_plugins.json points at 1.10.25
- `Cargo.lock`: synced owl package version 1.10.14 → 1.10.25 (DEPLOY.ps1 does not stage Cargo.lock — per the plan's documented follow-up commit pattern, e.g., 62cebea after 3723d47 in Phase 18.8.1 Plan 04)
- `.planning/debug/doyle-fresh-ctx-after-v1-10-16.md`: appended "Structural follow-up (2026-05-21)" section under Resolution citing this plan's removal commits; advanced frontmatter `updated:` to 2026-05-21; reworded Status block to reflect structural follow-up shipped
- `psyche.md` confirmed byte-identical to pre-plan state (`git diff HEAD~4 HEAD psyche.md` returns empty)

## Callsite-audit table (with resolution commits)

| # | Site | Path:Line (pre-removal) | Bucket | Action | Commit |
|---|------|-------------------------|--------|--------|--------|
| 1 | Clap subcommand variant | `src/cli.rs:301-305` (`ContextSave { self_id, summary }`) | (b) | DELETED | `eac0b9e` |
| 2 | Dispatcher arm | `src/live/mod.rs:52-62` | (b) | DELETED | `eac0b9e` |
| 3 | Public re-export | `src/live/mod.rs:12` | (b) | DELETED | `eac0b9e` |
| 4 | CLI handler `run_save` | `src/live/context.rs:323-401` | (b) | DELETED | `eac0b9e` |
| 5 | Structured variant `context_save_result` | `src/live/context.rs:840-903` | (c) DEAD | DELETED | `eac0b9e` |
| 6 | `ContextSaveOutcome` struct | `src/common/outcomes.rs:136` | (c) DEAD | DELETED | `eac0b9e` |
| 7 | `context_saved: bool` on `SignoffOutcome` | `src/common/outcomes.rs:145`; set at `src/live/signoff.rs:182` | n/a | KEPT (out of scope) | — |
| 8 | Resume banner line | `src/owl/resume.rs:111` | (b) | DELETED + arg rebalance | `7752cfd` |
| 9 | `listen/SKILL.md:144` | doc-only mention | (b) | REWORDED to "write-to-live_context.md trigger" | `7752cfd` |
| 10 | `live/SKILL.md:225` | doc-only mention (commit-subject) | (b) | REWORDED to "captured at the last live_context.md write" | `7752cfd` |
| 11 | `tests/cli_parse.rs:452-462` parse_live_context_save | test | (b) | DELETED | `7752cfd` |
| 12 | `tests/golden_live.rs:211-...` golden_context_save | test | (b) | DELETED + 3 fixture files | `7752cfd` |
| 13 | Git commit-subject literal `"context-save"` | `src/live/start.rs:67`, `src/live/fork.rs:122`, `src/common/tracked.rs:2305,2312,2465` | NOT a callsite | KEPT (semantic preservation per callsite_audit row 13) | — |
| 14 | `psyche.md` lines 101, 257, 266-280 | (a)-shaped semantic-only | KEPT unchanged — Psyche LLM Write-tool semantics | — |
| 15 | `tests/golden/live/unknown_cmd.stderr:2` | (b) | REGENERATED without `|context-save` token | `7752cfd` |
| 16 | `CHANGELOG.md:285,311,313` | historical doc | KEPT; new entry added under `## [1.10.25]` | `104ac27` |
| 17 | `scripts/capture_golden.sh:99` | (b) — capture-script call | REMOVED (deviation, see below) | `7752cfd` |

Bucket totals after resolution: (a) = 0, (b) = 13 (12 planned + 1 deviation: capture_golden.sh), (c) = 2 (dead post-removal, both deleted).

## Version bump

| Surface | Before | After |
|---------|--------|-------|
| `plugin/spt/.claude-plugin/plugin.json` | 1.10.24 | 1.10.25 |
| `Cargo.toml` `[package].version` | 1.10.24 | 1.10.25 |
| `Cargo.lock` `name = "owl"` | 1.10.14 | 1.10.25 |
| Marketplace HEAD (cplugs) | e7712ac | 933b798 |
| installed_plugins.json `spt@cplugs` | 1.10.24 | 1.10.25 |
| Plugin cache at `~/.claude/plugins/cache/cplugs/spt/` | 1.10.24, 1.10.23 | 1.10.25, 1.10.24 (1.10.23 pruned) |

## Verification

- `cargo build --release` — exits 0 (3 pre-existing dead-code warnings: `check_alive`, `HookInput.source`, `should_fire` — none related to this removal)
- `cargo test --release --lib -- --test-threads=1` — 703 passed, 1 failed, 3 ignored
  - **The single failure** (`owl::version_changelog::tests::current_version_honors_override_in_debug_builds`) is pre-existing and unrelated to this removal: the test asserts `current_version() == "1.99.99"` under `SPT_OVERRIDE_PKG_VERSION`, which only fires under `debug_assertions`. Running the test in `--release` exercises the `env!("CARGO_PKG_VERSION")` branch which returns the real 1.10.25. The same failure exists on HEAD~5 (pre-Task-A baseline).
- `cargo test --release --test cli_parse` — 42 passed, 0 failed
- `cargo test --release --test golden_live` — 14 passed, 0 failed
- `cargo clippy --release -- -D warnings` — 34 errors, ALL pre-existing (collapsible_if, manual_pattern_char_comparison, etc. in `src/live/wrapper/mod.rs`, `src/live/boot_spine.rs`, etc. — unrelated to this removal; HEAD~5 produces an identical 35 errors). Per orchestrator scope-boundary rule, NOT auto-fixed (out of scope).
- Production grep audit (per orchestrator's `<final_grep_acceptance>`): all remaining `context-save|context_save|ContextSave` hits in `src/` are in the acceptable set (commit-subject literals + historical comments); zero hits in `plugin/`; psyche.md untouched.

## Psyche.md byte-identical check

```
$ git diff HEAD~5 HEAD psyche.md
(empty — exit 0)
$ grep -c "agents/{{self_id}}/live_context.md" psyche.md
5
$ grep -nE '\$LIVE context-save|owl live context-save' psyche.md
(empty)
```

Pass: 5 write-site references preserved; zero shell-out references introduced. The Psyche LLM's Write-tool semantics for `agents/{{self_id}}/live_context.md` are unchanged.

## Deviations from plan

### Task A test-pruning decisions (per `<test_pruning_guidance>` from orchestrator)

Per the guidance, each test that touched `context_save_result` was categorized as DELETE (assertion-on-context-save-output) or REWRITE (uses context_save_result as a fixture-builder for an assertion on a different module).

| Test | Decision | Rationale |
|------|----------|-----------|
| `context_save_writes_frontmatter_at_file_head` (L1597) | DELETE | Asserts on `context_save_result`'s output (file-head fence, machine line, body shape). |
| `context_save_omits_optional_keys_outside_repo` (L1644) | DELETE | Asserts on `context_save_result`'s output (D-11 optional-key omission). |
| `run_save_and_context_save_result_emit_identical_bytes` (L1696) | DELETE | Asserts the D-07 lockstep invariant between the two removed writers; both are gone, the invariant no longer applies. |
| `context_save_lands_commit_in_agent_worktree` (L1867) | DELETE | Asserts on the `context_save_result` commit subject and worktree marker. |
| `amend_signoff_inserts_frontmatter_inside_section` (L1729) | **REWRITE** | Asserts on `amend_signoff_result`'s output; uses `context_save_result` only to seed the initial body. Rewrote the seed to a new `seed_live_context()` helper that does `fs::write` of `format!("{}{}\n", stamp.yaml_frontmatter(), body)` into the agent worktree (byte-identical to what `context_save_result` would have written, minus the git commit which the test doesn't assert on). |
| `amend_signoff_keeps_file_head_frontmatter` (L1780) | **REWRITE** | Same shape as above: seeds via `seed_live_context`. |
| `amend_signoff_multiple_amendments_stamp_each_section_independently` (L1822) | **REWRITE** | Same shape as above: seeds via `seed_live_context`. |

The `seed_live_context` helper is documented as a quick-260521-myj fixture shim in a comment inside `mod tests`. All 3 rewritten amend tests pass under `cargo test --release --lib live::context::tests::amend_signoff_` (serial).

### Other deviations

- **`scripts/capture_golden.sh` cleanup**: the plan's <files> list did not include this script, but a live grep audit found `capture context_save live sh -c "echo 'saved context' | $LIVE context-save testid inline-summary"` on line 99 — calling the now-deleted subcommand. The capture invocation now references a dead command and would fail on the next golden-regen. Removed the line + added a comment explaining the removal (Rule 3 auto-fix: out-of-date callsite to the deleted subcommand). Committed in Task B (`7752cfd`).
- **Documentation comments referencing `run_save` / `context_save_result`**: preserved as-is in `src/owl/echo_commune.rs:315` (comment about historical fixture state), `src/common/git.rs:246` (rustdoc), `src/live/start.rs:43,46`, and several places in `src/live/context.rs`. These are explanatory and the names appearing in COMMENTS are not a CLI surface, so per the orchestrator's acceptance criteria these are not "unacceptable hits." (They could be rewritten in a follow-up doc-polish pass.)
- **Plugin version bumped externally mid-task**: I started with plugin.json at 1.10.23. While I was executing Task A, an external bump (likely a separate session deploy from a parallel agent) moved plugin.json to 1.10.24 (commit `5a49d6f`) BEFORE my Task A commit landed. This is reflected in commit topology — HEAD~5 at task start would have been `cfc2522 chore: bump spt plugin to v1.10.23` if I had been alone. The intermediate 1.10.24 bump is independent of this plan and shipped a separate fix (Phase 25 P05 — psyche-pulse chunk reassembly). My DEPLOY.ps1 invocation went 1.10.24 → 1.10.25 as expected.
- **Task C atomicity**: per the plan's `<action>` step 1 ("If Cargo.lock was not staged in the same commit … make a separate commit"), Task C ships as multiple commits rather than one atomic commit. The orchestrator's stated single-commit subject for Task C (`chore(260521-myj): bump plugin patch, document removal in CHANGELOG + debug note`) is used on the FINAL wrap-up commit (`6cdc733`) that ships Cargo.lock + debug note; the DEPLOY.ps1 auto-bump (`00f28e2`) and pre-required CHANGELOG entry (`104ac27`) use their own subjects per the DEPLOY.ps1 contract.

## Known stubs / deferred items

None — the removal is complete and the binary surface is consistent. Pre-existing clippy warnings and the one pre-existing release-mode test failure are documented in the Verification section.

## Self-Check

- [x] All 3 tasks executed and committed
- [x] cargo build --release exits 0
- [x] cargo test --release (serial) shows only the 1 pre-existing release-mode failure
- [x] Final grep audit matches orchestrator's `<final_grep_acceptance>` exactly
- [x] Plugin v1.10.25 deployed; marketplace HEAD pushed; cache refreshed
- [x] CHANGELOG.md has a curated `### Removed` entry under `## [1.10.25]`
- [x] Debug note `.planning/debug/doyle-fresh-ctx-after-v1-10-16.md` cites this plan's removal commits
- [x] psyche.md is byte-identical to pre-plan state (Psyche LLM Write-tool semantics preserved)
- [x] All 5 truths in the plan's `must_haves` are satisfied (subcommand removed, Psyche LLM remains sole writer, banners cleaned, signoff write site preserved, plugin patch-bumped, tracked-repo `live_context.md` cannot be clobbered by operator)

## Self-Check: PASSED
