@getpipher/workspace 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,202 @@
1
+ ---
2
+ name: workspace-session-handoff
3
+ description: Use when ending a session and work needs to continue in a new session (Claude Code or Pi). Creates a self-contained starter prompt with full context so the next session picks up seamlessly. Host-neutral — the handoff bridges sessions across either host (shared workspace + vault).
4
+ allowed-tools: ["bash", "read", "write", "edit"]
5
+ ---
6
+
7
+ # Session Handoff
8
+
9
+ Create a starter prompt file that a fresh session can use to continue work without context loss.
10
+
11
+ > **Host-neutral.** This skill works the same in Claude Code and Pi. The handoff file lives in the shared `$HANDOFF_VAULT/{project}/` vault (default `$HANDOFF_VAULT`=`~/.local/handoffs` — a local directory; override via the `HANDOFF_VAULT` env var to point at your own private/synced vault), so a session in either host can write it and the next session (same host or the other) can resume — they share the workspace and the vault. Don't assume the next session runs in the same host as this one.
12
+
13
+ ## When to Use
14
+
15
+ - End of a long session with pending tasks
16
+ - Before a context-compaction / session switch (CC: `/compact`; pi: `/reload` or restart) when work remains
17
+ - When context window is getting full and work remains
18
+ - User says "save progress", "wrap up", "continue later", "new session"
19
+
20
+ ## Output
21
+
22
+ Write to: `$HANDOFF_VAULT/{project}/session-handoff-{YYYY-MM-DD}.md` (default `$HANDOFF_VAULT`=`~/.local/handoffs`)
23
+
24
+ If a handoff file already exists for today, append a letter suffix (e.g., `-b`, `-c`).
25
+
26
+ ## Implementation
27
+
28
+ ### Step 1: Gather Context
29
+
30
+ Collect from the current conversation (do NOT re-read files you already have context for):
31
+
32
+ 1. **What was completed** — list every change shipped this session (commits, deploys, fixes)
33
+ 2. **What's pending** — unfinished tasks, next steps, blockers
34
+ 3. **Key decisions made** — architectural choices, approach decisions, trade-offs discussed
35
+ 4. **Active plan/spec** — file path to any implementation plan or design spec in progress
36
+ 5. **Known issues** — bugs found, workarounds applied, tech debt noted
37
+ 6. **File paths touched** — specific files modified (helps the next session navigate)
38
+ 7. **CI/deploy state** — are all repos green? anything deploying?
39
+ 8. **VPS/infra state** — any server-side changes made (env vars, configs, deploys)
40
+
41
+ ### Step 2: Decide if a progress table is needed
42
+
43
+ A **progress table** sits near the top of the handoff (between the header block and the Starter Prompt) and captures discrete units of long-running work — phases, slices, tasks, milestones — with status + any associated PR/issue numbers. Fastest way for a new session to scan "what's done / what's next" without reading the full Session Log.
44
+
45
+ **Generate a progress table when ANY apply:**
46
+
47
+ 1. **Predecessor handoff has one** — `ls -t "$HANDOFF_VAULT"/{project}/session-handoff-*.md | head -1` contains `## Progress Table`. Chain consistency > per-session re-evaluation.
48
+ 2. **User explicitly requested** — prompt contains "MUST include progress table" or "include the progress table".
49
+ 3. **Work has numbered discrete units** — multi-phase plan with slices/tasks (e.g., "Slice 5.7 done, next 5.8"), or stacked PR chain where order matters.
50
+ 4. **More than 3 PRs/issues stacked across sessions** — flat bullet list becomes unscannable.
51
+
52
+ **Skip the progress table when:**
53
+
54
+ - Single-session bug fix or one-off with no follow-up sessions planned.
55
+ - Continuing work without discrete numbered phases (open-ended exploration, content writing).
56
+ - Previous chain handoff doesn't have one and adding it would break the convention.
57
+
58
+ **Heuristic:** can't articulate at least 5 rows that belong in the table → don't need it.
59
+
60
+ ### Step 3: Gather progress table data (if Step 2 says yes)
61
+
62
+ 1. **Find the most recent predecessor handoff** for this project:
63
+
64
+ ```bash
65
+ ls -t "$HANDOFF_VAULT"/{project}/session-handoff-*.md 2>/dev/null | head -1
66
+ ```
67
+
68
+ Locate its `## Progress Table` section.
69
+
70
+ 2. **Copy the table verbatim as the baseline** — same column headers, same row order. Preserves chain consistency.
71
+
72
+ 3. **Apply this session's changes:**
73
+ - Flip newly-completed rows from `[ ] TODO` / `[ ] NOT STARTED` to `[x] DONE`.
74
+ - Move the `(★ next)` marker from the row that just shipped to the row this handoff recommends next.
75
+ - Add the PR number to the newly-completed row.
76
+ - Append new rows at the bottom for any newly discovered units of work.
77
+ - **Bold the row(s) this session shipped** so they're visually obvious.
78
+
79
+ 4. **Update the footer summary line** below the table — increment stack counts, test counts, clippy state, phase progress (e.g., "Phase 5: 7/10 slices done"). The footer is what the next session uses to sanity-check it's resuming from the right baseline.
80
+
81
+ **If no predecessor exists** (first handoff in chain), author a fresh table from the project's plan/spec. Default columns:
82
+
83
+ | Phase | Slice | Headline change | Status | PR |
84
+ |---|---|---|---|---|
85
+
86
+ Adapt column names to the project's vocabulary ("Milestone" instead of "Phase", "Issue" instead of "PR", etc.). Lock the column shape in this first handoff — every subsequent handoff in the chain inherits it.
87
+
88
+ ### Step 4: Write the Handoff File
89
+
90
+ Structure (the `## Progress Table` section is inserted only if Steps 2–3 produced one):
91
+
92
+ ```markdown
93
+ # {Project} — Session Handoff ({date}-{letter} — {one-line headline})
94
+
95
+ **Date:** {today}
96
+ **Working directory:** {cwd}
97
+ **Session summary:** {one-line summary of what this session accomplished}
98
+
99
+ ---
100
+
101
+ ## Progress Table
102
+
103
+ {Rendered from Step 3's data. Include footer line with stack count + test count + clippy state + phase progress. Skip this entire section if Step 2 says no.}
104
+
105
+ ---
106
+
107
+ ## Starter Prompt
108
+
109
+ Copy-paste this into a new session (CC or pi):
110
+
111
+ \```
112
+ {OPENER-ECHO — include ONLY when a progress table was generated (Steps 2–3); omit entirely otherwise. Embed the table verbatim so it travels with the prompt even if the user pastes only this block:}
113
+
114
+ FIRST — before reading any plan, touching any code, or taking any other action — render the progress table below back to me verbatim, under the heading "## Resuming — where we left off". Then continue with the task.
115
+
116
+ {full progress table copied verbatim from the ## Progress Table section above, including the footer summary line}
117
+
118
+ ---
119
+
120
+ {TASK PROMPT — always included; self-contained, no dependence on this conversation:
121
+ - What to do next (specific task/plan to execute)
122
+ - Path to any plan/spec file to read
123
+ - Key context the new session needs (decisions, constraints, gotchas)
124
+ - Build/test commands to verify state
125
+ - Any rules to follow (commit style, testing requirements, etc.)
126
+ }
127
+ \```
128
+
129
+ ---
130
+
131
+ ## Session Log
132
+
133
+ ### Completed
134
+ {Bulleted list of everything done}
135
+
136
+ ### Pending
137
+ {Bulleted list of what remains}
138
+
139
+ ### Key Decisions
140
+ {Decisions made with reasoning — the next session needs this context}
141
+
142
+ ### Known Issues
143
+ {Bugs, workarounds, fragile spots}
144
+
145
+ ### Infrastructure Changes
146
+ {VPS, env vars, deploys — anything server-side}
147
+ ```
148
+
149
+ ### Step 5: Copy handoff path to clipboard
150
+
151
+ Run the handoff file path through the OS clipboard so the user can paste it directly into a new session without re-typing.
152
+
153
+ macOS (primary target):
154
+
155
+ ```bash
156
+ printf '%s' "{path}" | pbcopy
157
+ ```
158
+
159
+ Cross-platform fallback (use this form if unsure of the environment):
160
+
161
+ ```bash
162
+ printf '%s' "{path}" | (pbcopy 2>/dev/null || xclip -selection clipboard 2>/dev/null || wl-copy 2>/dev/null || true)
163
+ ```
164
+
165
+ Verify the copy succeeded by reading it back:
166
+
167
+ ```bash
168
+ pbpaste # macOS — expected: the handoff path
169
+ ```
170
+
171
+ If the clipboard tool isn't available (e.g., remote SSH session without clipboard forwarding), skip silently — don't treat it as an error. The Confirm step still shows the path as text.
172
+
173
+ ### Step 6: Update MEMORY.md
174
+
175
+ Add a pointer to the handoff file and update any stale progress entries.
176
+
177
+ ### Step 7: Confirm
178
+
179
+ Tell the user:
180
+
181
+ > Handoff saved to `{path}` (already copied to clipboard). Start a new session in `{cwd}` and paste the path — or paste the starter prompt directly.
182
+
183
+ **If Step 2 produced a progress table, also echo it inline as a closer.** Render the table verbatim from the handoff file as a final progress snapshot, prefixed with a one-line header. Example:
184
+
185
+ > ## Final progress before new session
186
+ >
187
+ > {progress table rendered verbatim, including the footer summary line}
188
+
189
+ This gives the user a screenshot-friendly closer without requiring them to open the file.
190
+
191
+ The new session performs the mirror action on arrival: the starter prompt (Step 4) instructs it to render this same table **first**, before any work. Closer on departure, opener on arrival.
192
+
193
+ ## Rules
194
+
195
+ - **Self-contained prompt** — the new session should NOT need to read this conversation
196
+ - **No secrets in the prompt** — API keys, passwords, keypairs stay out
197
+ - **Specific over general** — "execute Task 3 in docs/plans/foo.md" beats "continue the work"
198
+ - **Include gotchas** — anything surprising or non-obvious that would trip up a fresh session
199
+ - **Private vault only** — `$HANDOFF_VAULT` (default `~/.local/handoffs`) should be a private/encrypted location, safe for strategy context. Override `$HANDOFF_VAULT` to your own private vault (e.g. an iCloud-synced or encrypted dir).
200
+ - **Progress table is part of the chain contract** — once a chain starts using a progress table, every handoff in the chain MUST include + update it. Skipping breaks scannability for the next session and forces a rebuild from prior handoffs.
201
+ - **Progress table echo is the closer, not the full handoff** — Step 7's inline table is a snapshot for the current chat. The handoff file (`.md`) is the durable artifact. Don't paraphrase or trim the table when echoing — render it verbatim.
202
+ - **Opener-echo mirrors the closer** — when a progress table exists, the starter prompt's FIRST instruction MUST be "render the table before doing anything." Embed the table inside the starter-prompt block (Step 4), not as a file reference, so it survives the user pasting the prompt alone. The fresh session renders it as its first action — a "where we left off" snapshot symmetric to Step 7's "where we ended" closer. No table generated → no opener-echo.