[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6DSSGWNNFZS8708T3HETVDH":3,"skill-same:01M6DSSGWNNFZS8708T3HETVDH":84},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":32,"linkOnly":33,"markdownContent":34,"markdownBody":35,"frontMatter":36,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":40,"repositoryHtmlUrl":41,"repositoryHomepageUrl":42,"ownerHtmlUrl":43,"ownerBlogUrl":44,"ownerDescription":6,"updatedAt":45,"install":46,"resources":59},"01M6DSSGWNNFZS8708T3HETVDH","debrief",null,"Capture a structured session summary and publish it to the OACP org-memory debrief store as an immutable record. Run at the end of any session.","kiloloop\u002Foacp-skills","kiloloop","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F264514437?v=4","01M6DSS1K2JKZD3YRMXRH54968","Kiloloop","01M6DSS1SMM810F7327W2YX7ZZ",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fkiloloop\u002Foacp-skills\u002Fblob\u002Fmain\u002Fskills\u002Fdebrief\u002FSKILL.md",[],[5,19,20,21,22,23,24,25,26,27,28,29,30,31],"memory","session summary","run","publish","immutable","capture","session","summary","record","structured","end","as","oacp","2026-11-10 10:12:30",false,"---\nname: debrief\ndescription: Capture a structured session summary and publish it to the OACP org-memory debrief store as an immutable record. Run at the end of any session.\n---\n\n# \u002Fdebrief — Session Debrief\n\nPublish a structured summary of this session to the central org-memory debrief store:\n\n```text\n$MEMORY_HOME\u002Forg-memory\u002Fdebriefs\u002F\u003Cproject>\u002F\u003CYYYY>\u002F\u003CMM>\u002F\u003CYYYYMMDD>-\u003Cagent>-\u003Csession>.md\n```\n\n`$MEMORY_HOME` is the memory home step 1 resolves — the OACP home unless the repo is bound to its own.\n\nOne session produces exactly one file, written once at session end and never rewritten. The store is the full-fidelity session record; curated outcomes reach other agents through `agent-memory event write` instead (see \"Curation guard\" below).\n\n## Arguments\n\n- `\u002Fdebrief` — generate the summary and publish it\n- `\u002Fdebrief --dry-run` — generate and display the summary without writing anything\n\n## Instructions\n\n### 1. Identify the project\n\nResolve the project name with this fallback chain:\n\n1. The `project_name` field in the workspace marker. The marker is gitignored and lives only at the repository's main root, so resolve that root first rather than reading it from the working directory — a linked worktree has no marker of its own:\n\n   ```bash\n   ROOT=$(dirname \"$(git rev-parse --path-format=absolute --git-common-dir)\")\n   python3 -c \"import json,sys; print(json.load(open(sys.argv[1]))['project_name'])\" \"$ROOT\u002F.oacp\"\n   ```\n\n2. `basename \"$ROOT\"` — not `git rev-parse --show-toplevel`, which returns the worktree directory when the session is running inside one\n3. The working directory basename, when not in a git repo\n\nThe name must match the workspace directory under `$OACP_HOME\u002Fprojects\u002F` byte-for-byte — the store path segment is case-sensitive. If no workspace directory matches the candidate, confirm the project name with the user before publishing: the writer validates only the segment's shape, never that the workspace exists.\n\n**A repo bound to its own memory home.** An `.agent-memory.json` binding at the main repo root ties the repo to an agent-memory home other than the OACP home, so such a repo usually has no OACP workspace and the chain above finds no match. Take the binding's `project` — no confirmation needed, the binding already names it — and publish into its `home` with `--oacp-dir \"\u003Chome>\"` (step 7). `agent-memory status` prints `source: binding:\u003Cpath>` with the resolved `home:` and `project:`, but an exported `$AGENT_MEMORY_HOME` or `$OACP_HOME` outranks the binding, so run it as `env -u AGENT_MEMORY_HOME -u OACP_HOME agent-memory status` or read the file directly. If your runtime sandboxes file writes, the bound home must be writable from the session; otherwise the writer fails `Operation not permitted` on its stage file and writes nothing.\n\n**Resolve the memory home once.** Set `MEMORY_HOME` to the binding's `home` for a bound repo, otherwise to `${OACP_HOME:-$HOME\u002Foacp}` (the writer's own default). Every later step that touches memory uses this one value — the ruling lookup in step 3, publication in step 7, the curation event, `org init`, and `doctor` — so the debrief, the rulings it checks, and the event it curates all land in the same home.\n\n### 2. Collect the session identity\n\nThe writer needs five identity values. Gather them before composing the body:\n\n- **`--project`** — from step 1\n- **`--agent`** — your registered agent name (the `agents\u002F\u003Cname>\u002F` directory under the project workspace)\n- **`--runtime`** — the runtime family running the session (`claude` for Claude Code)\n- **`--session`** — a short stable session id: **1-32 lowercase letters and digits, never hyphens**. Use the first 8 characters of the harness session UUID with hyphens stripped, copied from the `session=` line the snippet below prints — never retyped. The store parses the session id as the substring after the final hyphen, so a hyphen corrupts the filename grammar. If the session keeps working after a debrief has already landed, the continuation segment takes a derived id rather than this one — see step 8.\n- **`--started-utc` \u002F `--ended-utc`** — session bounds as ISO 8601 UTC with whole seconds, e.g. `2026-08-25T20:04:11Z`. `ended_utc` must not precede `started_utc`, and the date of `started_utc` determines the filename and directory segments.\n\n> **UTC, not local time.** The store path and the `\u003CYYYYMMDD>` filename prefix are derived from `started_utc` in UTC. On a machine whose OS timezone is ahead of or behind UTC, a locally-stamped date lands the record in the wrong month directory. Generate both stamps with `date -u +%Y-%m-%dT%H:%M:%SZ`.\n>\n> **Clock, don't estimate — and read the start rather than recalling it.** `--ended-utc` is the clock at publish time. `--started-utc` is the harder one: by the end of a session its start is hours behind you, so read it off the session transcript. The first timestamped entry *is* the session start, already in UTC, and the transcript's filename is the session UUID, so one command yields both values:\n>\n> ```bash\n> python3 -c \"\n> import json, os, sys\n> p = sys.argv[1]\n> print('session=' + os.path.basename(p).split('.')[0].replace('-', '')[:8])\n> for line in open(p):\n>     d = json.loads(line)\n>     if d.get('timestamp'): print('started_utc=' + d['timestamp'][:19] + 'Z'); break\n> \" \"${CLAUDE_CONFIG_DIR:-$HOME\u002F.claude}\"\u002Fprojects\u002F*\u002F\"$CLAUDE_CODE_SESSION_ID\".jsonl\n> ```\n>\n> Claude Code exports the session UUID to Bash as `$CLAUDE_CODE_SESSION_ID`, so no identifier is typed by hand (substitute the UUID only on a version that does not export it). The transcript directory is keyed by the directory the session was launched from, so the glob finds it without deriving that name. Not every line carries a `timestamp`, so break on the first that does rather than reading line 1. Transcript stamps carry milliseconds, and the writer parses whole seconds strictly — hence the `[:19]` truncation. Do **not** substitute the file's creation stat: that is local time, a full timezone offset away from the UTC stamp the store expects.\n\n### 3. Review the session\n\nGather what actually happened:\n\n- **Accomplishments** — what was built, fixed, reviewed, or decided\n- **Decisions** — key choices and their rationale\n- **Issues** — tickets created, closed, or updated. If other agents collaborated (parallel runs, review loops), include their closures and PR activity; local `git log` alone misses them.\n- **Files changed** — `git log --name-only --format= --since=\"\u003Cstarted_utc>\"` plus `git status --short`\n- **Git activity** — `git log --oneline --since=\"\u003Cstarted_utc>\"`, in each repo touched for cross-project sessions\n- **Next actions** — carry-forward items, open threads, blockers. **Before writing them, check today's entries in `$MEMORY_HOME\u002Forg-memory\u002Fevents\u002F` and `decisions.md` for a ruling that already supersedes a plan you are about to restate.** A debrief that carries a paused or superseded plan forward as a next action re-opens it for whatever consumes the store next, and the record is immutable once published.\n\nYour conversation context is the primary source. Git activity supplements it; it does not replace what you remember of the session.\n\n### 4. Compose the body\n\nWrite the body to a scratch file, then hand that file to the writer. The body is everything after the frontmatter — the writer generates the frontmatter itself, so do not write a `---` block at the top.\n\n```markdown\n# Session Summary: \u003Cproject> — YYYY-MM-DD\n\n**Runtime**: \u003Cruntime>\n**Duration**: ~{{DURATION}} minutes\n\n## What Changed\n\n- bullet points of accomplishments\n\n## Decisions Made\n\n- key decisions with rationale\n\n## Tickets \u002F Issues\n\n- created\u002Fclosed\u002Fupdated references (or \"None\")\n\n## Files Modified\n\n- key files changed\n\n## Next Actions\n\n- [ ] carry-forward items\n\n## Notes\n\n- anything notable (omit the section if nothing)\n```\n\nLeave `{{DURATION}}` literal. The writer replaces it at publish time with the minutes between `--started-utc` and `--ended-utc`, rounded up, before hashing — a figure written by hand is a projection made before the end stamp exists. It is the only placeholder the writer fills.\n\n> **Use a file-writing tool, never a shell heredoc.** Shell expansion corrupts debrief bodies — backticks in a double-quoted heredoc execute as command substitution, and the mangling is silent. Write the body with your runtime's file-writing tool and pass the path.\n\n### 5. Resolve the writer\n\nThe writer ships inside this skill, so its path depends on where the skill is\ninstalled, never on the current working directory — a debrief is written from\nwhatever project the session was in.\n\n```bash\n# Claude Code states the skill's base directory when it loads this file; use\n# that value. For runtimes that do not, fall back to the install locations.\nSKILL_DIR=\"\u003Cbase directory for this skill>\"\nif [ ! -f \"$SKILL_DIR\u002Fscripts\u002Fwrite_debrief.py\" ]; then\n  for d in \"$PWD\u002F.claude\u002Fskills\u002Fdebrief\" \"${CLAUDE_CONFIG_DIR:-$HOME\u002F.claude}\u002Fskills\u002Fdebrief\"; do\n    [ -f \"$d\u002Fscripts\u002Fwrite_debrief.py\" ] && SKILL_DIR=\"$d\" && break\n  done\nfi\ntest -f \"$SKILL_DIR\u002Fscripts\u002Fwrite_debrief.py\" \\\n  || { echo \"debrief writer not found; re-install the skill\" >&2; exit 1; }\n```\n\nStop here if the writer cannot be resolved. Do not hand-compose a record into\nthe store — the frontmatter, the content hash, and the publication primitive\nare the writer's contract, and a hand-written file satisfies none of them.\n\n### 6. Dry run\n\n`\u002Fdebrief --dry-run` stops here. Run the step 7 command with `--dry-run`\nappended: the writer validates the identity and body, composes the exact\nrecord it would publish, prints it, and touches nothing — no directories\ncreated, no files written. Status is reported as `dry-run`.\n\nShow the composed record and the target path, then **stop**. Do not continue\nto step 7, and do not report the session as debriefed.\n\n### 7. Publish\n\n```bash\npython3 \"$SKILL_DIR\u002Fscripts\u002Fwrite_debrief.py\" \\\n  --project \"\u003Cproject>\" \\\n  --agent \"\u003Cagent>\" \\\n  --runtime \"\u003Cruntime>\" \\\n  --session \"\u003Csession>\" \\\n  --started-utc \"\u003Cstarted>\" \\\n  --ended-utc \"\u003Cended>\" \\\n  --body-file \"\u003Cpath-to-body>\" \\\n  --oacp-dir \"${MEMORY_HOME:?resolve it in step 1}\" \\\n  --json\n```\n\n`--oacp-dir` takes the home step 1 resolved; passing it every time keeps a bound repo's debrief out of the ambient OACP home, and an unset `MEMORY_HOME` stops the command instead of falling back to that home.\n\nThe writer validates the schema, fills `{{DURATION}}`, computes the content hash, stages the record privately, publishes it with an atomic no-replace link, and reads it back to confirm. Exit codes: `0` published (or an idempotent re-publish of a byte-identical record), `1` validation error, `2` publication failure.\n\nPublication is failure-atomic — the canonical path only ever holds a complete, verified record. On any failure the path stays absent; at worst a private `.stage.*` file remains, and a later successful publication of the same record sweeps it. The writer only ever publishes an inode it created itself, so a `.stage.*` file that appears from anywhere else is never adopted — `agent-memory doctor` reports it and it is safe to delete by hand.\n\n### 8. Handle a collision\n\n`--session` collisions are the one failure that needs a judgment call:\n\n- **Byte-identical record already published** → reported as `idempotent`. Nothing to do; the run already landed.\n- **Different record at the same path** → hard failure. A published debrief is never replaced. Re-publish under a **new session identifier**; the existing record stays as it is.\n\nCorrections and follow-ups are new artifacts too — a later debrief, or an event referencing the original — never an edit to a landed file.\n\n> **A session that keeps working after its own debrief.** \"One session, one file\" assumes the session ends when the debrief is written. When work continues past that point — a second wrap-up, a dispatch that lands later, a resumed session — the published record is immutable and now materially incomplete, and re-running with the same identity collides by construction. Publish a **continuation segment**: same project, agent, and runtime; the session id suffixed with the segment number (`b31ffdea` → `b31ffdea2`, then `b31ffdea3`); `started_utc` set to the previous record's `ended_utc`; `ended_utc` set to now. The suffixed form stays inside the 1-32 alphanumeric session grammar, so it needs no separate allowance. Open the body by naming the parent record and the span it covers, so the two read as one session rather than two unrelated ones. When the session sat idle between the two (a resumed session days later), `{{DURATION}}` measures that whole wall span: keep the placeholder, say on the Duration line that it is the wall span, and give the active span from command timestamps. Do not backfill the earlier record, and do not skip the write — skipping is how a session's most consequential stretch goes unrecorded.\n\n### 9. Confirm\n\nPrint the canonical path, the status, and the content hash from the writer's JSON output.\n\n## Curation guard\n\nRaw debriefs never enter `recent.md` or `events\u002F`. Only curated folds do. If the session produced an outcome other agents or projects need, write it as a separate event, with `--source-ref` set to the debrief filename stem so the two can be reconciled later (`\u002Fwrap-up` step 2b covers this when that skill is installed):\n\n```bash\nagent-memory event write --home \"${MEMORY_HOME:?resolve it in step 1}\" \\\n  --type decision --project \"\u003Cproject>\" --agent \"\u003Cagent>\" --slug \"\u003Cslug>\" \\\n  --source-ref \"\u003CYYYYMMDD>-\u003Cagent>-\u003Csession>\" --body-file \"\u003Cpath-to-event-body>\"\n```\n\n## Notes\n\n- Keep each section to the facts a later reader needs. If the session was trivial, say so rather than padding.\n- Facts over narrative: the store is read by curation tooling, not for prose.\n- Debrief files are never auto-loaded at session start; they are permanent history, not context.\n- The store does **not** have to exist first — the writer provisions its own tree. `agent-memory org init --home \"$MEMORY_HOME\"` is optional setup, never a precondition.\n- `agent-memory doctor --home \"$MEMORY_HOME\"` validates store *setup* — layout, staging artifacts, symlinks. It never opens debrief files; schema and hash correctness are the writer's contract, verified at publication.\n","# \u002Fdebrief — Session Debrief\n\nPublish a structured summary of this session to the central org-memory debrief store:\n\n```text\n$MEMORY_HOME\u002Forg-memory\u002Fdebriefs\u002F\u003Cproject>\u002F\u003CYYYY>\u002F\u003CMM>\u002F\u003CYYYYMMDD>-\u003Cagent>-\u003Csession>.md\n```\n\n`$MEMORY_HOME` is the memory home step 1 resolves — the OACP home unless the repo is bound to its own.\n\nOne session produces exactly one file, written once at session end and never rewritten. The store is the full-fidelity session record; curated outcomes reach other agents through `agent-memory event write` instead (see \"Curation guard\" below).\n\n## Arguments\n\n- `\u002Fdebrief` — generate the summary and publish it\n- `\u002Fdebrief --dry-run` — generate and display the summary without writing anything\n\n## Instructions\n\n### 1. Identify the project\n\nResolve the project name with this fallback chain:\n\n1. The `project_name` field in the workspace marker. The marker is gitignored and lives only at the repository's main root, so resolve that root first rather than reading it from the working directory — a linked worktree has no marker of its own:\n\n   ```bash\n   ROOT=$(dirname \"$(git rev-parse --path-format=absolute --git-common-dir)\")\n   python3 -c \"import json,sys; print(json.load(open(sys.argv[1]))['project_name'])\" \"$ROOT\u002F.oacp\"\n   ```\n\n2. `basename \"$ROOT\"` — not `git rev-parse --show-toplevel`, which returns the worktree directory when the session is running inside one\n3. The working directory basename, when not in a git repo\n\nThe name must match the workspace directory under `$OACP_HOME\u002Fprojects\u002F` byte-for-byte — the store path segment is case-sensitive. If no workspace directory matches the candidate, confirm the project name with the user before publishing: the writer validates only the segment's shape, never that the workspace exists.\n\n**A repo bound to its own memory home.** An `.agent-memory.json` binding at the main repo root ties the repo to an agent-memory home other than the OACP home, so such a repo usually has no OACP workspace and the chain above finds no match. Take the binding's `project` — no confirmation needed, the binding already names it — and publish into its `home` with `--oacp-dir \"\u003Chome>\"` (step 7). `agent-memory status` prints `source: binding:\u003Cpath>` with the resolved `home:` and `project:`, but an exported `$AGENT_MEMORY_HOME` or `$OACP_HOME` outranks the binding, so run it as `env -u AGENT_MEMORY_HOME -u OACP_HOME agent-memory status` or read the file directly. If your runtime sandboxes file writes, the bound home must be writable from the session; otherwise the writer fails `Operation not permitted` on its stage file and writes nothing.\n\n**Resolve the memory home once.** Set `MEMORY_HOME` to the binding's `home` for a bound repo, otherwise to `${OACP_HOME:-$HOME\u002Foacp}` (the writer's own default). Every later step that touches memory uses this one value — the ruling lookup in step 3, publication in step 7, the curation event, `org init`, and `doctor` — so the debrief, the rulings it checks, and the event it curates all land in the same home.\n\n### 2. Collect the session identity\n\nThe writer needs five identity values. Gather them before composing the body:\n\n- **`--project`** — from step 1\n- **`--agent`** — your registered agent name (the `agents\u002F\u003Cname>\u002F` directory under the project workspace)\n- **`--runtime`** — the runtime family running the session (`claude` for Claude Code)\n- **`--session`** — a short stable session id: **1-32 lowercase letters and digits, never hyphens**. Use the first 8 characters of the harness session UUID with hyphens stripped, copied from the `session=` line the snippet below prints — never retyped. The store parses the session id as the substring after the final hyphen, so a hyphen corrupts the filename grammar. If the session keeps working after a debrief has already landed, the continuation segment takes a derived id rather than this one — see step 8.\n- **`--started-utc` \u002F `--ended-utc`** — session bounds as ISO 8601 UTC with whole seconds, e.g. `2026-08-25T20:04:11Z`. `ended_utc` must not precede `started_utc`, and the date of `started_utc` determines the filename and directory segments.\n\n> **UTC, not local time.** The store path and the `\u003CYYYYMMDD>` filename prefix are derived from `started_utc` in UTC. On a machine whose OS timezone is ahead of or behind UTC, a locally-stamped date lands the record in the wrong month directory. Generate both stamps with `date -u +%Y-%m-%dT%H:%M:%SZ`.\n>\n> **Clock, don't estimate — and read the start rather than recalling it.** `--ended-utc` is the clock at publish time. `--started-utc` is the harder one: by the end of a session its start is hours behind you, so read it off the session transcript. The first timestamped entry *is* the session start, already in UTC, and the transcript's filename is the session UUID, so one command yields both values:\n>\n> ```bash\n> python3 -c \"\n> import json, os, sys\n> p = sys.argv[1]\n> print('session=' + os.path.basename(p).split('.')[0].replace('-', '')[:8])\n> for line in open(p):\n>     d = json.loads(line)\n>     if d.get('timestamp'): print('started_utc=' + d['timestamp'][:19] + 'Z'); break\n> \" \"${CLAUDE_CONFIG_DIR:-$HOME\u002F.claude}\"\u002Fprojects\u002F*\u002F\"$CLAUDE_CODE_SESSION_ID\".jsonl\n> ```\n>\n> Claude Code exports the session UUID to Bash as `$CLAUDE_CODE_SESSION_ID`, so no identifier is typed by hand (substitute the UUID only on a version that does not export it). The transcript directory is keyed by the directory the session was launched from, so the glob finds it without deriving that name. Not every line carries a `timestamp`, so break on the first that does rather than reading line 1. Transcript stamps carry milliseconds, and the writer parses whole seconds strictly — hence the `[:19]` truncation. Do **not** substitute the file's creation stat: that is local time, a full timezone offset away from the UTC stamp the store expects.\n\n### 3. Review the session\n\nGather what actually happened:\n\n- **Accomplishments** — what was built, fixed, reviewed, or decided\n- **Decisions** — key choices and their rationale\n- **Issues** — tickets created, closed, or updated. If other agents collaborated (parallel runs, review loops), include their closures and PR activity; local `git log` alone misses them.\n- **Files changed** — `git log --name-only --format= --since=\"\u003Cstarted_utc>\"` plus `git status --short`\n- **Git activity** — `git log --oneline --since=\"\u003Cstarted_utc>\"`, in each repo touched for cross-project sessions\n- **Next actions** — carry-forward items, open threads, blockers. **Before writing them, check today's entries in `$MEMORY_HOME\u002Forg-memory\u002Fevents\u002F` and `decisions.md` for a ruling that already supersedes a plan you are about to restate.** A debrief that carries a paused or superseded plan forward as a next action re-opens it for whatever consumes the store next, and the record is immutable once published.\n\nYour conversation context is the primary source. Git activity supplements it; it does not replace what you remember of the session.\n\n### 4. Compose the body\n\nWrite the body to a scratch file, then hand that file to the writer. The body is everything after the frontmatter — the writer generates the frontmatter itself, so do not write a `---` block at the top.\n\n```markdown\n# Session Summary: \u003Cproject> — YYYY-MM-DD\n\n**Runtime**: \u003Cruntime>\n**Duration**: ~{{DURATION}} minutes\n\n## What Changed\n\n- bullet points of accomplishments\n\n## Decisions Made\n\n- key decisions with rationale\n\n## Tickets \u002F Issues\n\n- created\u002Fclosed\u002Fupdated references (or \"None\")\n\n## Files Modified\n\n- key files changed\n\n## Next Actions\n\n- [ ] carry-forward items\n\n## Notes\n\n- anything notable (omit the section if nothing)\n```\n\nLeave `{{DURATION}}` literal. The writer replaces it at publish time with the minutes between `--started-utc` and `--ended-utc`, rounded up, before hashing — a figure written by hand is a projection made before the end stamp exists. It is the only placeholder the writer fills.\n\n> **Use a file-writing tool, never a shell heredoc.** Shell expansion corrupts debrief bodies — backticks in a double-quoted heredoc execute as command substitution, and the mangling is silent. Write the body with your runtime's file-writing tool and pass the path.\n\n### 5. Resolve the writer\n\nThe writer ships inside this skill, so its path depends on where the skill is\ninstalled, never on the current working directory — a debrief is written from\nwhatever project the session was in.\n\n```bash\n# Claude Code states the skill's base directory when it loads this file; use\n# that value. For runtimes that do not, fall back to the install locations.\nSKILL_DIR=\"\u003Cbase directory for this skill>\"\nif [ ! -f \"$SKILL_DIR\u002Fscripts\u002Fwrite_debrief.py\" ]; then\n  for d in \"$PWD\u002F.claude\u002Fskills\u002Fdebrief\" \"${CLAUDE_CONFIG_DIR:-$HOME\u002F.claude}\u002Fskills\u002Fdebrief\"; do\n    [ -f \"$d\u002Fscripts\u002Fwrite_debrief.py\" ] && SKILL_DIR=\"$d\" && break\n  done\nfi\ntest -f \"$SKILL_DIR\u002Fscripts\u002Fwrite_debrief.py\" \\\n  || { echo \"debrief writer not found; re-install the skill\" >&2; exit 1; }\n```\n\nStop here if the writer cannot be resolved. Do not hand-compose a record into\nthe store — the frontmatter, the content hash, and the publication primitive\nare the writer's contract, and a hand-written file satisfies none of them.\n\n### 6. Dry run\n\n`\u002Fdebrief --dry-run` stops here. Run the step 7 command with `--dry-run`\nappended: the writer validates the identity and body, composes the exact\nrecord it would publish, prints it, and touches nothing — no directories\ncreated, no files written. Status is reported as `dry-run`.\n\nShow the composed record and the target path, then **stop**. Do not continue\nto step 7, and do not report the session as debriefed.\n\n### 7. Publish\n\n```bash\npython3 \"$SKILL_DIR\u002Fscripts\u002Fwrite_debrief.py\" \\\n  --project \"\u003Cproject>\" \\\n  --agent \"\u003Cagent>\" \\\n  --runtime \"\u003Cruntime>\" \\\n  --session \"\u003Csession>\" \\\n  --started-utc \"\u003Cstarted>\" \\\n  --ended-utc \"\u003Cended>\" \\\n  --body-file \"\u003Cpath-to-body>\" \\\n  --oacp-dir \"${MEMORY_HOME:?resolve it in step 1}\" \\\n  --json\n```\n\n`--oacp-dir` takes the home step 1 resolved; passing it every time keeps a bound repo's debrief out of the ambient OACP home, and an unset `MEMORY_HOME` stops the command instead of falling back to that home.\n\nThe writer validates the schema, fills `{{DURATION}}`, computes the content hash, stages the record privately, publishes it with an atomic no-replace link, and reads it back to confirm. Exit codes: `0` published (or an idempotent re-publish of a byte-identical record), `1` validation error, `2` publication failure.\n\nPublication is failure-atomic — the canonical path only ever holds a complete, verified record. On any failure the path stays absent; at worst a private `.stage.*` file remains, and a later successful publication of the same record sweeps it. The writer only ever publishes an inode it created itself, so a `.stage.*` file that appears from anywhere else is never adopted — `agent-memory doctor` reports it and it is safe to delete by hand.\n\n### 8. Handle a collision\n\n`--session` collisions are the one failure that needs a judgment call:\n\n- **Byte-identical record already published** → reported as `idempotent`. Nothing to do; the run already landed.\n- **Different record at the same path** → hard failure. A published debrief is never replaced. Re-publish under a **new session identifier**; the existing record stays as it is.\n\nCorrections and follow-ups are new artifacts too — a later debrief, or an event referencing the original — never an edit to a landed file.\n\n> **A session that keeps working after its own debrief.** \"One session, one file\" assumes the session ends when the debrief is written. When work continues past that point — a second wrap-up, a dispatch that lands later, a resumed session — the published record is immutable and now materially incomplete, and re-running with the same identity collides by construction. Publish a **continuation segment**: same project, agent, and runtime; the session id suffixed with the segment number (`b31ffdea` → `b31ffdea2`, then `b31ffdea3`); `started_utc` set to the previous record's `ended_utc`; `ended_utc` set to now. The suffixed form stays inside the 1-32 alphanumeric session grammar, so it needs no separate allowance. Open the body by naming the parent record and the span it covers, so the two read as one session rather than two unrelated ones. When the session sat idle between the two (a resumed session days later), `{{DURATION}}` measures that whole wall span: keep the placeholder, say on the Duration line that it is the wall span, and give the active span from command timestamps. Do not backfill the earlier record, and do not skip the write — skipping is how a session's most consequential stretch goes unrecorded.\n\n### 9. Confirm\n\nPrint the canonical path, the status, and the content hash from the writer's JSON output.\n\n## Curation guard\n\nRaw debriefs never enter `recent.md` or `events\u002F`. Only curated folds do. If the session produced an outcome other agents or projects need, write it as a separate event, with `--source-ref` set to the debrief filename stem so the two can be reconciled later (`\u002Fwrap-up` step 2b covers this when that skill is installed):\n\n```bash\nagent-memory event write --home \"${MEMORY_HOME:?resolve it in step 1}\" \\\n  --type decision --project \"\u003Cproject>\" --agent \"\u003Cagent>\" --slug \"\u003Cslug>\" \\\n  --source-ref \"\u003CYYYYMMDD>-\u003Cagent>-\u003Csession>\" --body-file \"\u003Cpath-to-event-body>\"\n```\n\n## Notes\n\n- Keep each section to the facts a later reader needs. If the session was trivial, say so rather than padding.\n- Facts over narrative: the store is read by curation tooling, not for prose.\n- Debrief files are never auto-loaded at session start; they are permanent history, not context.\n- The store does **not** have to exist first — the writer provisions its own tree. `agent-memory org init --home \"$MEMORY_HOME\"` is optional setup, never a precondition.\n- `agent-memory doctor --home \"$MEMORY_HOME\"` validates store *setup* — layout, staging artifacts, symlinks. It never opens debrief files; schema and hash correctness are the writer's contract, verified at publication.\n",{"name":5,"description":7},"main","ea78d5cce0208a15b59f6f2c49e729ba71a3c5af","skills\u002Fdebrief",1,"https:\u002F\u002Fgithub.com\u002Fkiloloop\u002Foacp-skills","https:\u002F\u002Foacp.dev\u002Fskills\u002F","https:\u002F\u002Fgithub.com\u002Fkiloloop","https:\u002F\u002Fkiloloop.com","2026-10-31 14:39:52",{"source":8,"skillName":5,"commands":47,"prompt":57,"zipAvailable":58},[48,51,54],{"tool":49,"command":50},"npx","npx skills add kiloloop\u002Foacp-skills --skill debrief",{"tool":52,"command":53},"bunx","bunx skills add kiloloop\u002Foacp-skills --skill debrief",{"tool":55,"command":56},"pnpm","pnpm dlx skills add kiloloop\u002Foacp-skills --skill debrief","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fkiloloop\u002Foacp-skills\u002Fblob\u002Fmain\u002Fskills\u002Fdebrief\u002FSKILL.md",true,[60,66,72,76,80],{"path":61,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":64,"sourceHtmlUrl":65},"README.md","REFERENCE","参考文档",5672,"https:\u002F\u002Fgithub.com\u002Fkiloloop\u002Foacp-skills\u002Fblob\u002Fmain\u002Fskills\u002Fdebrief\u002FREADME.md",{"path":67,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":70,"sourceHtmlUrl":71},"scripts\u002Fwrite_debrief.py","SCRIPT","脚本",32716,"https:\u002F\u002Fgithub.com\u002Fkiloloop\u002Foacp-skills\u002Fblob\u002Fmain\u002Fskills\u002Fdebrief\u002Fscripts\u002Fwrite_debrief.py",{"path":73,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":74,"sourceHtmlUrl":75},"shared\u002FINTENT.md",6429,"https:\u002F\u002Fgithub.com\u002Fkiloloop\u002Foacp-skills\u002Fblob\u002Fmain\u002Fskills\u002Fdebrief\u002Fshared\u002FINTENT.md",{"path":77,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":78,"sourceHtmlUrl":79},"skill.yaml",338,"https:\u002F\u002Fgithub.com\u002Fkiloloop\u002Foacp-skills\u002Fblob\u002Fmain\u002Fskills\u002Fdebrief\u002Fskill.yaml",{"path":81,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":82,"sourceHtmlUrl":83},"tests\u002Ftest_write_debrief.py",33821,"https:\u002F\u002Fgithub.com\u002Fkiloloop\u002Foacp-skills\u002Fblob\u002Fmain\u002Fskills\u002Fdebrief\u002Ftests\u002Ftest_write_debrief.py",[85,96,101,122,128,137],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":32},"01M6DSWR7WDRG7C3D31R4QKW5T","\u003Cskill-name>","\u003Cone-line description>","https:\u002F\u002Fgithub.com\u002Fkiloloop\u002Foacp-skills\u002Fblob\u002Fmain\u002Ftemplate\u002Fcodex\u002FSKILL.md",[],[92,93,94,95],"skill name","name","\u003Cskill name>","line",{"skillNo":97,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":32},"01M6DSWMRPCHQH4HJJF3MATTXZ","https:\u002F\u002Fgithub.com\u002Fkiloloop\u002Foacp-skills\u002Fblob\u002Fmain\u002Ftemplate\u002Fclaude\u002FSKILL.md",[],[92,93,94,95],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":32},"01M6DSWH83XKNGJSKX2XWQCRKJ","wrap-up","End-of-session cleanup for Codex — inspect stale artifacts, run debrief, write significant org-memory events, run a delta-first self-improve pass, then publish bounded approved memory and repository changes.","https:\u002F\u002Fgithub.com\u002Fkiloloop\u002Foacp-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwrap-up\u002Fcodex\u002FSKILL.md",[],[108,109,110,21,19,111,112,113,22,114,115,116,25,117,118,119,120,29,5,121],"wrap up","up","wrap","cleanup","artifacts","repository","first","improve","write","stale","session cleanup","delta","self","codex",{"skillNo":123,"name":124,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":125,"categories":126,"keywords":127,"publishedAt":32},"01M6DSWEQBS2CE6F2H8T3VQNZY","claude","https:\u002F\u002Fgithub.com\u002Fkiloloop\u002Foacp-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwrap-up\u002Fclaude\u002FSKILL.md",[],[],{"skillNo":129,"name":103,"nameZh":6,"description":130,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":131,"categories":132,"keywords":133,"publishedAt":32},"01M6DSW99EPXDVAG8GHR785CC5","End-of-session cleanup, debrief, org-memory events, self-improve, commit, and push in one command.","https:\u002F\u002Fgithub.com\u002Fkiloloop\u002Foacp-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwrap-up\u002FSKILL.md",[],[108,109,110,120,19,134,111,135,115,136,25,118,29,5],"commit","push","command",{"skillNo":138,"name":139,"nameZh":6,"description":140,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":141,"categories":142,"keywords":143,"publishedAt":32},"01M6DSW4FRNRKRQ0TRMZAYNMKZ","self-improve","Audit and improve Codex operating guidance: skills, curated project memory, AGENTS.md, and relevant configuration. Use for explicit self-improve requests, routine wrap-up drift checks, stale or conflicting guidance, or an approved cleanup. Route release-wide OACP migrations and context-budget audits to audit-oacp-skills. Do not hand-edit generated Codex memories or installed plugin\u002Fsystem artifacts.","https:\u002F\u002Fgithub.com\u002Fkiloloop\u002Foacp-skills\u002Fblob\u002Fmain\u002Fskills\u002Fself-improve\u002Fcodex\u002FSKILL.md",[],[144,120,115,145,111,146,147,148,149,150,151,152,109,153,154,155,156,157,31,19],"self improve","project","release","audit","Budget","system","edit","context","generated","do","route","drift","memories","operating"]