End-of-Chat Capture Skill
Captures the work from the current conversation into a self-contained task .md file, updates CLAUDE.md
to reference it, and provides a continuation prompt to resume work in a new session.
Conventions (governed by context-kit-steward)
--- GOVERNED CONVENTIONS (source: context-kit-steward charter v1.0) ---
Do not edit here. Change the charter in context-kit-steward and re-run it to
re-sync; local edits to this block will be overwritten on the next sync.
This skill honors these shared Context Kit conventions (full text + rationale in the
context-kit-steward charter):
- Encodes C1 (dating): record the work/conversation-START date (not wall-clock
"now"),
YYYY-MM-DD, never future; CLAUDE.md and status.md carry a Last Updated line.
- Encodes C2 (ordering): changelog.md and the status.md recent-changes table are
newest-first; history.md is chronological; insert each row in its correct date
position, not blindly at the top.
- Encodes C3 (concurrency): before editing a shared index file, re-read from disk,
make a minimal targeted insert (not a full rewrite), set Version = on-disk + 1; one
writer-of-record when multiple sessions/agents share the kit.
- Encodes C4 (session folders): per-session assets under
docs/sessions/<work-date>-<slug>/notes.md.
- Encodes C7 (hygiene): no verbatim transcripts or secrets; no absolute
mount/session paths in kit prose.
- Follows C5/C6/C8/C10: use the kit's own entity term (don't assume "tenant");
reference the global kit skills rather than embedding copies; treat leading-underscore
dirs as read-only; never
rm -- move to Trash.
When to Use
- End of any troubleshooting, configuration, or multi-step technical session
- User asks to "document what we just did" or "save this as a skill/runbook"
- A fix or procedure was reached that is likely to recur or be handed off
- User explicitly asks to update CLAUDE.md
- Trigger phrases: "create a skill file", "capture this as a task file", "update CLAUDE.md",
"document what we just did", "save this workflow", or any request to wrap up a session with documentation
- Proactive: if the user says "we're done" or "that fixed it" after a multi-step technical session,
suggest running this capture before closing. If more work remains, provide a continuation prompt for the next session.
Session Date (read this FIRST -- governs every date this skill writes)
Every date this skill records -- session folder slugs, changelog rows, history entries, task-file dates --
must be the date the CURRENT conversation STARTED, not the current wall-clock time when the capture
runs. A long session can cross midnight, and a session may be captured hours or days after the work was
done; in both cases the wall-clock "now" would record the wrong day.
Determine the session date, in this order of preference:
- The timestamp of the first message in the current conversation. If session metadata or a transcript
is available (e.g. a session-info/transcript tool, or a visible timestamp on the opening message), read
the earliest message's date from it.
- If no timestamp is exposed, scan the conversation for an explicit date the user or the environment
stated at the outset (e.g. a "Today's date is ..." line in the opening context).
- Only if neither is available, fall back to the current date -- and note in the entry that the date is
the capture date, not a confirmed session-start date.
Format every recorded date as ISO YYYY-MM-DD. Use this single resolved session date consistently
across all files written in this capture; do not re-derive it per file.
Output Mode (read this FIRST -- governs how all deliverables are returned)
Before doing anything, determine whether file-creation / code-execution tools are available. They are
available in Claude Code, Claude Cowork, and in Chat when the file-creation feature is on.
If file tools ARE available (default, preferred path)
- Produce every deliverable as a real file and present it for download/use. This means the task
.md, the updated CLAUDE.md, and the continuation prompt are each written to disk and presented --
never pasted inline, and never returned as a "go edit this file yourself" instruction.
- For updates to an existing file (
CLAUDE.md or an existing task .md): read the current version
from context, produce the COMPLETE rewritten file with all prior content preserved plus the
additions, and present that whole file as a drop-in replacement. Do not emit a partial diff or an
"insert this section here" instruction.
- Exception -- shared kit index files (CLAUDE.md, changelog.md, history.md, status.md). Do NOT deliver
these as a blind COMPLETE-file rewrite from your in-context copy -- that clobbers rows a concurrent
session appended. RE-READ from disk, then apply a MINIMAL targeted edit: insert the single new
changelog/history/status row in its correct position (see Step 0 and Step 3), or the one new CLAUDE.md
tree/Resources line, preserving everything else byte-for-byte. The full-rewrite delivery still applies
to NEW task files and session assets (which no other session is editing).
- Filenames:
- New task file -> use the naming rules in Step 2.
- Updated knowledge file -> keep the name exactly
CLAUDE.md.
- Continuation prompt ->
continuation_prompt.md.
- After presenting, give a one-line note per file stating whether it was Created or Updated.
- Exception -- continuation prompt: in ADDITION to writing
continuation_prompt.md, ALWAYS also
display the continuation prompt inline in a copyable fenced code block (see Step 4). This applies
in every environment, regardless of whether file tools are available.
- Environment note for the user: In Chat, these files are downloads -- the user must upload/replace
them in their project's knowledge to persist them. In Code/Cowork, edits to the working directory
persist automatically, so write/replace in place there.
If file tools are NOT available (fallback only)
- Use the inline labeled-block format shown in Step 5. This is the only situation in which file content
should appear inline in the chat.
Kit Layout (shared files this skill maintains)
These are the files the capture workflow reads from and writes to. Not every project will have all of
them; create one only when the workflow calls for it, and treat this list as the common set rather than
an exhaustive one.
| File |
Role |
CLAUDE.md |
Root index / entry point. References every task .md and names the current Version. The authoritative pointer a fresh Claude instance loads first. |
docs/changelog.md |
Newest-first table of changes, one row per update, keyed to the CLAUDE.md Version. The source of truth for concurrency/staleness checks (Step 0). |
docs/history.md |
Longer-form narrative log of what happened across sessions -- context and rationale that doesn't fit a changelog row. |
docs/status.md |
Current-state snapshot: what is done, in progress, or blocked right now. Overwritten/updated to reflect the present, not appended indefinitely. |
docs/sessions/<session-date>-<slug>/notes.md |
Per-session scratch notes for a single dated session. The session date (above) is the folder prefix. Where a non-writer session/agent records its work under the one-writer convention (see Optional section). |
[task_filename.md] |
Self-contained task/runbook files produced by Step 2. Each is owned by the session that created it; safe to full-rewrite. |
Step 1: Inventory Existing Files and Extract from Conversation
1a. Check for Existing Related Files
Before writing anything new, look for files that already cover this topic:
- Read CLAUDE.md (if provided or available in context) -- note every
.md file referenced and what each covers
- Scan the project directory / project knowledge for any
.md files not yet referenced in CLAUDE.md
- Compare scope: does any existing file cover the same system, procedure, or ticket as the current session?
| Match Level |
Action |
| Strong match -- same system/procedure, same or overlapping scope |
Update the existing file; do not create a new one |
| Partial match -- related topic but distinct scope or different ticket |
Update the existing file with a new section; note the distinction |
| No match -- nothing related exists |
Create a new file (proceed to Step 2 naming rules) |
When updating an existing file, preserve all prior content. Add new sections, expand existing ones, or append to open items -- never overwrite or truncate what was there. Per Output Mode, an "update" is delivered as a complete rewritten file, not a partial instruction.
1b. Extract from Conversation
Scan the full conversation for:
| Element |
What to capture |
| Purpose |
What problem was solved or what was configured |
| Scope |
Which system, client, or ticket it applies to |
| Prerequisites |
Credentials, snapshots, prior steps needed before starting |
| Procedure |
Ordered steps, including exact commands |
| Gotchas |
Errors encountered, wrong paths taken, important caveats |
| Open items |
Anything deferred, unresolved, or needing follow-up |
Step 2: Write or Update the Task File
Naming (new files only)
- snake_case, all lowercase, descriptive:
vcenter_cert_renewal.md, appx_surgery_m90q.md
- If ticket-scoped, include the ticket ID:
acme_48217_appx_repair.md
Structure
# [Task Title]
## Purpose
One sentence: what this file helps you do.
## Scope
- Client / system / ticket this applies to
- Environment context (OS version, tool versions, etc.)
- Session date: [YYYY-MM-DD -- the conversation-start date]
## Prerequisites
- [ ] Item 1 (e.g., snapshot taken, BitLocker key verified)
- [ ] Item 2
## Procedure
### Step 1: [Step Name]
What to do and why.
```shell
# Exact command(s)
```
### Step 2: [Step Name]
...
## Gotchas / Lessons Learned
- Bullet list of surprises, failures, or important caveats
## Open Items / Next Steps
- [ ] Deferred action 1
- [ ] Deferred action 2
## References
- [filename.md] -- cross-references to related skill files (filename only, no path)
Rules
- Self-contained: someone (or Claude) must be able to execute this with no other context
- Preserve all detail: do not summarize away commands, error messages, or decision points
- Use
[ ] checkboxes for prerequisites and open items
- Use
[filename.md] reference pattern for cross-links to other skill files -- filename only, no path
- Date with the session date (conversation start), not the capture time
Step 0 (REQUIRED before any shared-file update): Staleness & concurrency validation
Multiple sessions AND multiple agents may share this context at the same time. The collision-prone files
are CLAUDE.md, docs/changelog.md, docs/history.md, docs/status.md, but there may be others. Before
editing ANY of them:
- RE-READ the file from disk immediately before editing -- never write from a stale in-context copy.
- Detect concurrent edits: compare the on-disk CLAUDE.md Version to the top changelog row. If they
already disagree, another session/agent is mid-update -- pause and reconcile before writing.
- Derive the new CLAUDE.md Version from the on-disk value + 1 (never from memory); add the changelog
row for THAT number.
- One writer per shared index file at a time. If you are not the designated writer (e.g. you are a
sub-agent or a parallel session), do NOT edit the shared index files directly -- record your work in
your own
docs/sessions/<session-date>-<slug>/notes.md and hand the index update to the writer (see
Optional section). This keeps parallel agents from clobbering each other.
- Make each edit a minimal, single-row/single-line insertion (never a full-file rewrite of a shared
index), so that if two writes do interleave, they are easy to reconcile by re-reading.
Step 3: Update CLAUDE.md and the shared index files
Where each entry goes (insert at the correct position, not blindly at the top)
The point of being multi-session/multi-agent aware is that entries land in their right place, so the
kit stays coherent no matter who wrote last. Apply these placement rules:
| File |
Where the new entry goes |
CLAUDE.md |
In the most relevant existing section for the task's category (e.g. Endpoint Repair / VMware / M365). Create a new section only if nothing fits, and place that section in sensible alphabetical/topical order with the others. |
docs/changelog.md |
As a single new row in reverse-chronological position by the session date -- newest at top. If your session date is OLDER than the current top row (a late capture), insert it in date order, not above a newer row. Bump the CLAUDE.md Version per Step 0. |
docs/history.md |
As a new narrative entry in chronological position by session date. Append to the end if it is the most recent; otherwise slot it where its date belongs. |
docs/status.md |
Edit in place to reflect the present. Move resolved items out of "in progress", add new open items. Do not append a running log here. |
docs/sessions/... |
A new docs/sessions/<session-date>-<slug>/ directory keyed to THIS session, so parallel sessions never share a folder. |
CLAUDE.md entry format
### [Category: e.g., Endpoint Repair / VMware / M365]
- **[task_filename.md]** -- [1-2 sentence description of what it covers and when to load it]
Rules:
- Place in the most relevant existing section; create a new section only if nothing fits
- Keep the description to 1-2 sentences -- enough to know when to load the file
- Never remove existing entries unless explicitly asked
- Delivery (per Output Mode):
- If file tools are available: produce the complete updated
CLAUDE.md as a file (existing content
preserved + the new entry) and present it as a drop-in replacement.
- If file tools are NOT available: output the update block inline with a note indicating where to insert it.
- Exception -- shared kit index files (CLAUDE.md, changelog.md, history.md, status.md). Do NOT deliver
these as a blind COMPLETE-file rewrite from your in-context copy -- that clobbers rows a concurrent
session/agent appended. RE-READ from disk, then apply a MINIMAL targeted edit: insert the single new
changelog/history/status row in its correct chronological position (see the table above), or the one new
CLAUDE.md tree/Resources line in its correct section, preserving everything else byte-for-byte. The
full-rewrite delivery still applies to NEW task files and session assets (which no other session is editing).
Step 4: Generate Continuation Prompt for New Session
Compose a self-contained prompt the user can paste at the start of a new Claude session to resume
this work without loss of context. The prompt must include:
- Objective -- what the overall goal is and where we are in it
- Completed steps -- what was done this session (brief, factual)
- Current state -- any relevant artifacts, file paths, config values, or system state
- Next step -- the exact action to take first in the new session
- Open issues / decisions -- anything unresolved or flagged for review
Write the prompt in the user's voice, addressed to a fresh Claude instance, so it can be pasted
as-is. A new Claude instance should be able to read it and act immediately -- no follow-up questions
needed.
Delivery -- ALWAYS show inline, regardless of file tools:
Always display the full continuation prompt in the chat inside a fenced code block, so the
user can copy it directly with one click:
```
[full continuation prompt text]
```
Additionally, when file tools are available, also write it to disk as continuation_prompt.md
and present it with the other deliverables.
The inline copyable block is mandatory in every environment -- never skip it just because the file
was written to disk.
Step 5: Output
Deliver all outputs per Output Mode above. State upfront whether each task file / CLAUDE.md was
Updated (existing file) or Created (new file), and why. If a prior version of either file was
provided in context, note any meaningful changes made. State the resolved session date you used.
Preferred (file tools available)
Present the deliverables as files:
[task_filename.md] -- Created / Updated
CLAUDE.md -- Updated (complete replacement)
continuation_prompt.md -- Created
Then give a short per-file summary line, plus the reminder that in Chat the user uploads/replaces these
in the project, while in Code/Cowork they persist in place.
Finally, always end by displaying the continuation prompt inline in a copyable fenced code block
(per Step 4), even though continuation_prompt.md was also written to disk.
Fallback (no file tools available)
Use inline labeled blocks:
---
## [task_filename.md] <- Updated / Created
> Updated: added [section name] based on [ticket/session], session date [YYYY-MM-DD]
[full file content]
---
## CLAUDE.md Update
[either the full updated CLAUDE.md, or the block to insert with insertion location noted]
---
## Continuation Prompt
> Paste this at the start of a new session to resume work:
```
[prompt text -- written in the user's voice, addressed to a fresh Claude instance,
providing all context needed to proceed without referencing this session]
```
Optional: Multi-agent / multi-session writer convention
When several agents or sessions are working a shared kit at once, keep the shared index files coherent
with a one-writer rule:
- Each session/agent owns its own
docs/sessions/<session-date>-<slug>/notes.md and any task files
it creates -- these are never contended, so write them freely.
- Only the designated writer touches the shared index files (CLAUDE.md, changelog.md, history.md,
status.md) at any given moment. A non-writer records what the index should say in its session notes
and hands it off, rather than editing the index directly.
- The writer applies each handoff as a minimal, re-read-then-insert edit (Step 0), placing every row
in its correct chronological/section position (Step 3) so concurrent work merges cleanly.
Optional: Proactive Suggestion
If a multi-step technical session has clearly concluded (user says "perfect", "that worked", "we're done")
and no capture has been requested, offer:
"Want me to capture this as a task file and update your CLAUDE.md before we close out?"
1---2name: context-kit-capture3description: Capture a finished workflow or troubleshooting session as a self-contained task .md file and update CLAUDE.md. Use when wrapping up a multi-step technical session or asked to document/save the work.4---56# End-of-Chat Capture Skill78Captures the work from the current conversation into a self-contained task `.md` file, updates `CLAUDE.md`9to reference it, and provides a continuation prompt to resume work in a new session.1011---1213## Conventions (governed by context-kit-steward)1415> --- GOVERNED CONVENTIONS (source: context-kit-steward charter v1.0) ---16> Do not edit here. Change the charter in context-kit-steward and re-run it to17> re-sync; local edits to this block will be overwritten on the next sync.1819This skill honors these shared Context Kit conventions (full text + rationale in the20context-kit-steward charter):2122- **Encodes C1 (dating):** record the work/conversation-START date (not wall-clock23 "now"), `YYYY-MM-DD`, never future; CLAUDE.md and status.md carry a `Last Updated` line.24- **Encodes C2 (ordering):** changelog.md and the status.md recent-changes table are25 newest-first; history.md is chronological; insert each row in its correct date26 position, not blindly at the top.27- **Encodes C3 (concurrency):** before editing a shared index file, re-read from disk,28 make a minimal targeted insert (not a full rewrite), set Version = on-disk + 1; one29 writer-of-record when multiple sessions/agents share the kit.30- **Encodes C4 (session folders):** per-session assets under31 `docs/sessions/<work-date>-<slug>/notes.md`.32- **Encodes C7 (hygiene):** no verbatim transcripts or secrets; no absolute33 mount/session paths in kit prose.34- **Follows C5/C6/C8/C10:** use the kit's own entity term (don't assume "tenant");35 reference the global kit skills rather than embedding copies; treat leading-underscore36 dirs as read-only; never `rm` -- move to Trash.3738---3940## When to Use4142- End of any troubleshooting, configuration, or multi-step technical session43- User asks to "document what we just did" or "save this as a skill/runbook"44- A fix or procedure was reached that is likely to recur or be handed off45- User explicitly asks to update CLAUDE.md46- **Trigger phrases:** "create a skill file", "capture this as a task file", "update CLAUDE.md",47 "document what we just did", "save this workflow", or any request to wrap up a session with documentation48- **Proactive:** if the user says "we're done" or "that fixed it" after a multi-step technical session,49 suggest running this capture before closing. If more work remains, provide a continuation prompt for the next session.5051---5253## Session Date (read this FIRST -- governs every date this skill writes)5455Every date this skill records -- session folder slugs, changelog rows, history entries, task-file dates --56**must be the date the CURRENT conversation STARTED, not the current wall-clock time** when the capture57runs. A long session can cross midnight, and a session may be captured hours or days after the work was58done; in both cases the wall-clock "now" would record the wrong day.5960Determine the session date, in this order of preference:61621. The timestamp of the **first message in the current conversation**. If session metadata or a transcript63 is available (e.g. a session-info/transcript tool, or a visible timestamp on the opening message), read64 the earliest message's date from it.652. If no timestamp is exposed, scan the conversation for an explicit date the user or the environment66 stated at the outset (e.g. a "Today's date is ..." line in the opening context).673. Only if neither is available, fall back to the current date -- and note in the entry that the date is68 the capture date, not a confirmed session-start date.6970Format every recorded date as ISO `YYYY-MM-DD`. Use this single resolved **session date** consistently71across all files written in this capture; do not re-derive it per file.7273---7475## Output Mode (read this FIRST -- governs how all deliverables are returned)7677Before doing anything, determine whether file-creation / code-execution tools are available. They are78available in **Claude Code**, **Claude Cowork**, and in **Chat when the file-creation feature is on**.7980### If file tools ARE available (default, preferred path)8182- Produce **every deliverable as a real file** and present it for download/use. This means the task83 `.md`, the updated `CLAUDE.md`, and the continuation prompt are each written to disk and presented --84 **never pasted inline, and never returned as a "go edit this file yourself" instruction.**85- For **updates** to an existing file (`CLAUDE.md` or an existing task `.md`): read the current version86 from context, produce the **COMPLETE rewritten file** with all prior content preserved plus the87 additions, and present that whole file as a **drop-in replacement**. Do not emit a partial diff or an88 "insert this section here" instruction.89- **Exception -- shared kit index files (CLAUDE.md, changelog.md, history.md, status.md).** Do NOT deliver90 these as a blind COMPLETE-file rewrite from your in-context copy -- that clobbers rows a concurrent91 session appended. RE-READ from disk, then apply a MINIMAL targeted edit: insert the single new92 changelog/history/status row in its correct position (see Step 0 and Step 3), or the one new CLAUDE.md93 tree/Resources line, preserving everything else byte-for-byte. The full-rewrite delivery still applies94 to NEW task files and session assets (which no other session is editing).95- Filenames:96 - New task file -> use the naming rules in Step 2.97 - Updated knowledge file -> keep the name exactly `CLAUDE.md`.98 - Continuation prompt -> `continuation_prompt.md`.99- After presenting, give a one-line note per file stating whether it was **Created** or **Updated**.100- **Exception -- continuation prompt:** in ADDITION to writing `continuation_prompt.md`, ALWAYS also101 display the continuation prompt inline in a copyable fenced code block (see Step 4). This applies102 in every environment, regardless of whether file tools are available.103- **Environment note for the user:** In Chat, these files are downloads -- the user must upload/replace104 them in their project's knowledge to persist them. In Code/Cowork, edits to the working directory105 persist automatically, so write/replace in place there.106107### If file tools are NOT available (fallback only)108109- Use the inline labeled-block format shown in Step 5. This is the only situation in which file content110 should appear inline in the chat.111112---113114## Kit Layout (shared files this skill maintains)115116These are the files the capture workflow reads from and writes to. Not every project will have all of117them; create one only when the workflow calls for it, and treat this list as the common set rather than118an exhaustive one.119120| File | Role |121|---|---|122| `CLAUDE.md` | Root index / entry point. References every task `.md` and names the current Version. The authoritative pointer a fresh Claude instance loads first. |123| `docs/changelog.md` | Newest-first table of changes, one row per update, keyed to the CLAUDE.md Version. The source of truth for concurrency/staleness checks (Step 0). |124| `docs/history.md` | Longer-form narrative log of what happened across sessions -- context and rationale that doesn't fit a changelog row. |125| `docs/status.md` | Current-state snapshot: what is done, in progress, or blocked right now. Overwritten/updated to reflect the present, not appended indefinitely. |126| `docs/sessions/<session-date>-<slug>/notes.md` | Per-session scratch notes for a single dated session. The session date (above) is the folder prefix. Where a non-writer session/agent records its work under the one-writer convention (see Optional section). |127| `[task_filename.md]` | Self-contained task/runbook files produced by Step 2. Each is owned by the session that created it; safe to full-rewrite. |128129---130131## Step 1: Inventory Existing Files and Extract from Conversation132133### 1a. Check for Existing Related Files134135Before writing anything new, look for files that already cover this topic:1361371. **Read CLAUDE.md** (if provided or available in context) -- note every `.md` file referenced and what each covers1382. **Scan the project directory / project knowledge** for any `.md` files not yet referenced in CLAUDE.md1393. **Compare scope**: does any existing file cover the same system, procedure, or ticket as the current session?140141| Match Level | Action |142|---|---|143| **Strong match** -- same system/procedure, same or overlapping scope | Update the existing file; do not create a new one |144| **Partial match** -- related topic but distinct scope or different ticket | Update the existing file with a new section; note the distinction |145| **No match** -- nothing related exists | Create a new file (proceed to Step 2 naming rules) |146147When updating an existing file, preserve all prior content. Add new sections, expand existing ones, or append to open items -- never overwrite or truncate what was there. Per Output Mode, an "update" is delivered as a complete rewritten file, not a partial instruction.148149### 1b. Extract from Conversation150151Scan the full conversation for:152153| Element | What to capture |154|---|---|155| **Purpose** | What problem was solved or what was configured |156| **Scope** | Which system, client, or ticket it applies to |157| **Prerequisites** | Credentials, snapshots, prior steps needed before starting |158| **Procedure** | Ordered steps, including exact commands |159| **Gotchas** | Errors encountered, wrong paths taken, important caveats |160| **Open items** | Anything deferred, unresolved, or needing follow-up |161162---163164## Step 2: Write or Update the Task File165166### Naming (new files only)167- snake_case, all lowercase, descriptive: `vcenter_cert_renewal.md`, `appx_surgery_m90q.md`168- If ticket-scoped, include the ticket ID: `acme_48217_appx_repair.md`169170### Structure171172````markdown173# [Task Title]174175## Purpose176One sentence: what this file helps you do.177178## Scope179- Client / system / ticket this applies to180- Environment context (OS version, tool versions, etc.)181- Session date: [YYYY-MM-DD -- the conversation-start date]182183## Prerequisites184- [ ] Item 1 (e.g., snapshot taken, BitLocker key verified)185- [ ] Item 2186187## Procedure188189### Step 1: [Step Name]190What to do and why.191192```shell193# Exact command(s)194```195196### Step 2: [Step Name]197...198199## Gotchas / Lessons Learned200- Bullet list of surprises, failures, or important caveats201202## Open Items / Next Steps203- [ ] Deferred action 1204- [ ] Deferred action 2205206## References207- [filename.md] -- cross-references to related skill files (filename only, no path)208````209210### Rules211- **Self-contained**: someone (or Claude) must be able to execute this with no other context212- **Preserve all detail**: do not summarize away commands, error messages, or decision points213- **Use `[ ]` checkboxes** for prerequisites and open items214- **Use `[filename.md]` reference pattern** for cross-links to other skill files -- filename only, no path215- **Date with the session date** (conversation start), not the capture time216217---218219## Step 0 (REQUIRED before any shared-file update): Staleness & concurrency validation220221Multiple sessions AND multiple agents may share this context at the same time. The collision-prone files222are CLAUDE.md, docs/changelog.md, docs/history.md, docs/status.md, but there may be others. Before223editing ANY of them:2242251. RE-READ the file from disk immediately before editing -- never write from a stale in-context copy.2262. Detect concurrent edits: compare the on-disk CLAUDE.md Version to the top changelog row. If they227 already disagree, another session/agent is mid-update -- pause and reconcile before writing.2283. Derive the new CLAUDE.md Version from the on-disk value + 1 (never from memory); add the changelog229 row for THAT number.2304. **One writer per shared index file at a time.** If you are not the designated writer (e.g. you are a231 sub-agent or a parallel session), do NOT edit the shared index files directly -- record your work in232 your own `docs/sessions/<session-date>-<slug>/notes.md` and hand the index update to the writer (see233 Optional section). This keeps parallel agents from clobbering each other.2345. **Make each edit a minimal, single-row/single-line insertion** (never a full-file rewrite of a shared235 index), so that if two writes do interleave, they are easy to reconcile by re-reading.236237---238239## Step 3: Update CLAUDE.md and the shared index files240241### Where each entry goes (insert at the correct position, not blindly at the top)242243The point of being multi-session/multi-agent aware is that entries land in their **right place**, so the244kit stays coherent no matter who wrote last. Apply these placement rules:245246| File | Where the new entry goes |247|---|---|248| `CLAUDE.md` | In the **most relevant existing section** for the task's category (e.g. Endpoint Repair / VMware / M365). Create a new section only if nothing fits, and place that section in sensible alphabetical/topical order with the others. |249| `docs/changelog.md` | As a single new row in **reverse-chronological position** by the session date -- newest at top. If your session date is OLDER than the current top row (a late capture), insert it in date order, not above a newer row. Bump the CLAUDE.md Version per Step 0. |250| `docs/history.md` | As a new narrative entry in **chronological position** by session date. Append to the end if it is the most recent; otherwise slot it where its date belongs. |251| `docs/status.md` | Edit in place to reflect the present. Move resolved items out of "in progress", add new open items. Do not append a running log here. |252| `docs/sessions/...` | A new `docs/sessions/<session-date>-<slug>/` directory keyed to THIS session, so parallel sessions never share a folder. |253254### CLAUDE.md entry format255256```markdown257### [Category: e.g., Endpoint Repair / VMware / M365]258- **[task_filename.md]** -- [1-2 sentence description of what it covers and when to load it]259```260261Rules:262- Place in the most relevant existing section; create a new section only if nothing fits263- Keep the description to 1-2 sentences -- enough to know when to load the file264- **Never remove existing entries** unless explicitly asked265- **Delivery (per Output Mode):**266 - If file tools are available: produce the **complete updated `CLAUDE.md`** as a file (existing content267 preserved + the new entry) and present it as a drop-in replacement.268 - If file tools are NOT available: output the update block inline with a note indicating where to insert it.269- **Exception -- shared kit index files (CLAUDE.md, changelog.md, history.md, status.md).** Do NOT deliver270 these as a blind COMPLETE-file rewrite from your in-context copy -- that clobbers rows a concurrent271 session/agent appended. RE-READ from disk, then apply a MINIMAL targeted edit: insert the single new272 changelog/history/status row in its correct chronological position (see the table above), or the one new273 CLAUDE.md tree/Resources line in its correct section, preserving everything else byte-for-byte. The274 full-rewrite delivery still applies to NEW task files and session assets (which no other session is editing).275276---277278## Step 4: Generate Continuation Prompt for New Session279280Compose a self-contained prompt the user can paste at the start of a new Claude session to resume281this work without loss of context. The prompt must include:282283- **Objective** -- what the overall goal is and where we are in it284- **Completed steps** -- what was done this session (brief, factual)285- **Current state** -- any relevant artifacts, file paths, config values, or system state286- **Next step** -- the exact action to take first in the new session287- **Open issues / decisions** -- anything unresolved or flagged for review288289Write the prompt in the user's voice, addressed to a fresh Claude instance, so it can be pasted290as-is. A new Claude instance should be able to read it and act immediately -- no follow-up questions291needed.292293**Delivery -- ALWAYS show inline, regardless of file tools:**2942951. **Always** display the full continuation prompt in the chat inside a fenced code block, so the296 user can copy it directly with one click:297298 ~~~299 ```300 [full continuation prompt text]301 ```302 ~~~3033042. **Additionally**, when file tools are available, also write it to disk as `continuation_prompt.md`305 and present it with the other deliverables.306307The inline copyable block is mandatory in every environment -- never skip it just because the file308was written to disk.309310---311312## Step 5: Output313314Deliver all outputs per **Output Mode** above. State upfront whether each task file / CLAUDE.md was315**Updated** (existing file) or **Created** (new file), and why. If a prior version of either file was316provided in context, note any meaningful changes made. State the resolved **session date** you used.317318### Preferred (file tools available)319Present the deliverables as files:320- `[task_filename.md]` -- Created / Updated321- `CLAUDE.md` -- Updated (complete replacement)322- `continuation_prompt.md` -- Created323324Then give a short per-file summary line, plus the reminder that in Chat the user uploads/replaces these325in the project, while in Code/Cowork they persist in place.326327Finally, **always** end by displaying the continuation prompt inline in a copyable fenced code block328(per Step 4), even though `continuation_prompt.md` was also written to disk.329330### Fallback (no file tools available)331Use inline labeled blocks:332333~~~334---335## [task_filename.md] <- Updated / Created336> Updated: added [section name] based on [ticket/session], session date [YYYY-MM-DD]337[full file content]338339---340## CLAUDE.md Update341[either the full updated CLAUDE.md, or the block to insert with insertion location noted]342343---344## Continuation Prompt345> Paste this at the start of a new session to resume work:346347```348[prompt text -- written in the user's voice, addressed to a fresh Claude instance,349providing all context needed to proceed without referencing this session]350```351~~~352353---354355## Optional: Multi-agent / multi-session writer convention356357When several agents or sessions are working a shared kit at once, keep the shared index files coherent358with a one-writer rule:359360- **Each session/agent owns its own** `docs/sessions/<session-date>-<slug>/notes.md` and any task files361 it creates -- these are never contended, so write them freely.362- **Only the designated writer touches the shared index files** (CLAUDE.md, changelog.md, history.md,363 status.md) at any given moment. A non-writer records what the index *should* say in its session notes364 and hands it off, rather than editing the index directly.365- The writer applies each handoff as a **minimal, re-read-then-insert** edit (Step 0), placing every row366 in its correct chronological/section position (Step 3) so concurrent work merges cleanly.367368## Optional: Proactive Suggestion369370If a multi-step technical session has clearly concluded (user says "perfect", "that worked", "we're done")371and no capture has been requested, offer:372373> "Want me to capture this as a task file and update your CLAUDE.md before we close out?"