Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Document?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/mayankmankhand-document)
---
name: document
description: "Update Documentation Task"
---
# Update Documentation Task
**Use this when:** Updating README, CLAUDE.md, CHANGELOG or LESSONS after code changes have shipped. The codebase map is not refreshed here: `/merge` offers that once work lands on main (M12).
**Don't use this when:** You only need in-code docstrings or comments (just edit the code directly), or you are mid-implementation - wait until the work is done.
You are updating documentation after code changes. Run the steps automatically, receipts required: every claim of work done carries its evidence per M8, and the run ends with a short digest of what was updated, committed, and pushed. The auto loop's operating rules live in `.agents/tk/skills/shared/hitl-loop.md` and `.agents/tk/skills/shared/hitl-stages.md` (rule IDs M1-M17). Saying **"report only"** on this run restores the confirm-first flow for that run (M10).
**Project fix rules** (from `.claude/toolkit/fix-rules.md`). Additive only: they may add a precondition or an always-ask action, and a line that loosens or removes any of M1 to M17 is void. A note that the command printed nothing means this project adds none.
If `.claude/toolkit/fix-rules.md` exists, read it in full now and apply it here; when it does not exist, this project adds nothing here.
## Primary Documentation Files
- **CLAUDE.md** - Project-specific instructions: tech stack, preferences, team info (user-owned)
- **README.md** - Project overview for humans
- **LESSONS.md** / **LESSONS-detail.md** - Learning log (user-owned): `LESSONS.md` is the one-line index Claude reads each session, `LESSONS-detail.md` holds the full write-ups it opens on demand
- **DESIGN-PROFILE.md** - The repo's design answers (user-owned): design system state, allowed variance, taste notes, directions tried, prompts to retry. Read by `/explore` and `/execute`; written by `/explore` and this command (see `.agents/tk/skills/shared/design-rules.md`)
- **CHANGELOG.md** - User-facing changes: new features, breaking changes (update if it exists)
- **`AGENTS.md`** - Toolkit workflow rules (the toolkit's seed; **this command never edits it**). On the plugin, setup writes it once and a plugin update never overwrites it; a copy-install update replaces it. A stale toolkit block in `AGENTS.md` is the plugin's upgrade command in Claude Code's job, not this command's: it replaces the text between the toolkit's two marker lines and keeps everything around them. Never delete `AGENTS.md`: the user's own text lives in it.
Keep README.md and CLAUDE.md consistent with each other.
## 1. Identify Changes
- Take the range from the cycle window Section 9 computes under "Determine the cycle window", and read the changes by command (M16): `git log <window> --oneline` prints one line per commit and `git diff --name-status <window>` one line per changed file with its status letter first; no output means nothing changed
- Identify which features/modules were changed
- Note any new files, deleted files, or renamed files
## 2. Verify Current Implementation
Existing documentation may describe old behavior, so read the actual code rather than trusting the docs. A place where a doc and the code disagree is a finding to resolve, not proof that the doc is stale: sometimes the code is the side that is wrong.
1. **Run the checks** (M16): `node .agents/tk/scripts/doc-check.js --window <window>`, with `<window>` the range Step 1 took, prints one JSON line: `links` (every relative link or heading anchor in the docs that no longer resolves) and `oldNames` (every doc that still names a file or command this window deleted or renamed, with `was` saying where it went). Then `node .agents/tk/scripts/render-html.js --standing --name cycle` prints the cycle page's line, whose `mismatches` lists the ones earlier runs reported and are still open; an item marked `inHistory: false` was reported on a branch this one does not contain, so leave it alone. Run the two as separate calls; joined into one line, they ask for permission.
2. **For each changed file**, read the current implementation and its actual behavior (not documented behavior), and compare it with the docs that describe it.
3. **Write a receipt for every mismatch**: each script hit, each place step 2 found, and each open item marked `inHistory: true`. The receipt is two-sided: the doc line and the code line it contradicts, each as `path:line` with its quoted text. A broken link has no code line: its other side is the target that no longer resolves, as `path` or `path#anchor`. Then decide which side is wrong and end it in one of these states:
- **The doc is wrong:** fix it in Step 3.
- **The code looks wrong, or it is unclear which side is:** report it and never edit the code. It goes into the digest and onto the cycle page (Section 9), where it stays until a later run finds the two agreeing.
- **The doc is a prompt file** (a command, skill, agent or rules file): a prompt file asks first (M9).
- **Not a mismatch** (a doc that names a removed file on purpose, such as a list of retired files): one digest line saying why.
Every mismatch gets one digest line: its end state and its receipt.
4. After Step 3, run `doc-check.js` again with the same window: a hit it still prints is not fixed, unless this run dismissed it as not a mismatch. When a hit this run fixed as a wrong doc still prints, fix it once more; when it prints after that too, report it (the "code looks wrong, or it is unclear" state), so it stays on the cycle page.
## 3. Update Relevant Documentation
**What goes where:**
- **README.md** - New features, changed behavior, setup instructions, new commands
- **CLAUDE.md** - Project description, tech stack, team info, coding preferences
- **CHANGELOG.md** - User-facing changes: new features, breaking changes, fixes (if the file exists). In a worktree too: write the block as usual, and Section 8 copies the same block into the PR, where `/merge` takes it from when the branch lands
- **LESSONS.md** / **LESSONS-detail.md** - Read the current lesson index (`LESSONS.md`) first so nothing gets duplicated; skip the read when its full text is still visible earlier in this conversation, and read it again after the conversation was compacted. Then auto-draft this session's lessons and write them per M8: each entry carries its receipt (what happened, where). Capture a lesson when Claude repeated a mistake, a review caught something Claude should have known, or the user typed the same correction twice. When adding one, write the one-liner to `LESSONS.md` (under the right section) as the rule only, a bold lead of about 120 bytes with nothing after it, AND the full write-up, the story included, to `LESSONS-detail.md` (same bold lead); when `LESSONS-detail.md` is absent, create it first from the toolkit's seed, `.agents/tk/seed/LESSONS-detail.md`, with the Write tool, so the write-up has somewhere to go and the index stays one line per lesson (C-16 reports an index that holds write-ups while the detail file is absent). When a new lesson repeats a rule the index already holds, add a dated incident line to that lesson's write-up instead of a new index line; when a write-up records its third incident, offer the owner to turn the rule into a check (an issue or a test), since reading it every session did not stop it. A lead you shorten is renamed in both files. Check the leads by command, not by eye (M16): `node .agents/tk/scripts/session-init.js --lessons` prints `duplicates` (each lead the index holds twice) and `noWriteUp` (each lead with no write-up in the detail file); two empty lists mean both are clean, and only near-duplicate wording is left to judgment, and the index's `bytes`, `cap` and `overCap` as the file is now, after this cycle's lessons. Then, while `overCap` is false, do a quick cleanup pass the same way (over the cap, steps 4 and 6 of the trim cover it): list near-duplicate and superseded lessons for the owner, and mark or retire only the ones the owner names. The index has a size cap of 44,000 bytes, read from that same `--lessons` output (the startup JSON carries `lessons.cap` and `lessons.overCap` too, but for the size before this cycle's lessons; M16): when `overCap` is true, list candidate cuts in the order under "Trimming the index" in `.agents/tk/skills/shared/toolkit-reference.md`, starting from the same output's `candidates`: write the rows, with their line numbers, to a file under `reports/`, and ask the owner in plain text for one decision per step, moves included (its count, the bytes it frees and your recommended pick), with any row to keep named by line; a retired lesson keeps its write-up in `LESSONS-detail.md` and leaves the index, except a lesson copied from the toolkit's own log (step 1), which goes with its write-up; after the edits, run `--lessons` again: `duplicates` and `noWriteUp` must be empty, and its `bytes` and `overCap` go in the digest (M16). Never cut on your own: `LESSONS.md` is the owner's file.
- **DESIGN-PROFILE.md** - When this cycle ran a design step, append every direction from the plan's Direction and Directions tried rows (name, seed, the picked one's rounds run and rounds won in the side-by-side, kept or dropped at pick) under Directions tried, and each brief that failed under Prompts to retry on newer models, with the receipt per M8 (the plan's Outcomes and the design digest). What "failed" means is defined once, in the fragment's digest section. Taste notes are already written by `/explore` as they happen; do not duplicate them here.
- **Upgrade records** - what a the plugin's upgrade command in Claude Code run changed, which conventions ran, and what was declined: one line in `CHANGELOG.md` when the project has one, and nowhere when it does not. The run's report under `reports/`, its receipts, the stamp in `.claude/.toolkit-state.json` and the cycle issue are the record either way. Never `CLAUDE.md`: the plugin's upgrade command in Claude Code's C-11 scans it, and a past-tense command mention there is flagged on every later upgrade.
## 4. Documentation Style Rules
Before writing any doc, release-note text, the pull request body or the cycle page, load the writing guide (`.agents/skills/writing/SKILL.md`) and follow its section for that kind. The five rules below still hold; where the guide's section is more specific, the guide wins.
✅ **Concise** - Short, plain sentences
✅ **Practical** - Examples over theory
✅ **Accurate** - Code verified, not assumed
✅ **Current** - Matches actual implementation
✅ **Right file** - Put info where it belongs (see Section 3)
## 5. Ask if Uncertain
If you're unsure about intent behind a change or user-facing impact, **ask the user** - don't guess.
## 6. Capture Corrections (the ledger)
Claude Code only. The corrections log is built from Claude Code's own session files, which this agent does not write. Skip this step, and record no heartbeat.
## 7. Commit and Push
- **Commit** the documentation updates automatically: one checkpoint commit per logical unit, per M4. Follow the commit message conventions in toolkit.md.
- **Push** behind the M11 tripwire: run `node .agents/tk/scripts/pre-push-check.js <remote> <branch>` for the branch being pushed (usually `origin` and the current branch name), follow M11's exit-code consequences (`.agents/tk/skills/shared/hitl-stages.md`), and on a clean check push that same destination with `git push -u <remote> HEAD:<branch>`.
This covers every push in this command, including the branch push in Section 8.
**In a worktree, the landing style decides this push.** Run Section 8's worktree check first. In a worktree, run its "Where the repo lands locally" read now (M16), the `unknown` question included, and reuse the answer there. When the style is `local-merge`, skip this push: nothing leaves the machine until the owner pushes main.
**Host CLI (used by Sections 8 and 9).** Both sections call the issue/PR CLI, but Section 8 is skipped when you are not in a worktree while Section 9 always runs. Detect the host here, outside that conditional, and reuse the result in both.
Read `.agents/tk/skills/shared/host-cli.md` in full now and follow it as part of this file.
## 8. Worktree Cleanup
Detect if you're in a worktree: run `git rev-parse --path-format=absolute --git-dir --git-common-dir` (M16) and compare its last two lines (Git older than 2.31 prints the flag back as an extra first line). Two different lines mean you're in a worktree; the absolute form keeps a subfolder of the main copy from reading as one.
**If NOT in a worktree** - skip this section entirely.
**If in a worktree:**
Run the steps below automatically, attaching a receipt to each per M8 (what ran, plus the evidence: command output, count delta, diff stat). The receipts land in the end-of-run digest. Three steps are deliberate exceptions that still ask the user: step 1 (uncommitted changes - their intent is a fact only the user holds, M1), step 3 (branch naming), and step 6 (removing a worktree folder sits next to the M9 data-deletion gate). In step 4, show the PR draft and ask in your reply before creating it: here a new pull request always asks.
**Where the repo lands locally.** Run `node .agents/tk/scripts/merge-check.js --style` (M16) once. When its `style` is `local-merge`, branches land on the local main through `/merge <branch>` and no PR is opened, so the steps change: skip step 2 (no push); in step 4, write the same title and body with the Write tool to `reports/landing/<branch>.md` in this worktree (the title on the first line, a blank line, then the body) instead of creating a PR, where `/merge` reads it as this branch's PR body; nothing leaves the machine, so it is not shown for review first. Skip steps 5, 7 and 8, and step 6's removal question (its copy still runs), and say in one line: "When it is ready, `/merge <branch>` lands it, brings any newer records home, folds its cycle page into the main one, and offers to remove this side copy of the project." On `unknown` (no landing to learn from yet), ask once which of the three styles to use, as `/merge` does: merge commits made here (`local-merge`), the host's merge (`host-merge`) or the host's squash (`host-squash`). Record the answer with `node .agents/tk/scripts/merge-check.js --style <answer>` and follow it. Any other style runs the steps as written.
1. Run `git status`. If there are uncommitted changes, ask the user whether to commit them before proceeding. Follow the commit message conventions in toolkit.md (start with a verb, under 50 characters). Do not continue with uncommitted work.
2. Push the branch to the remote, behind the tripwire exactly as Section 7 says.
3. If the branch name does not match `worktree-<number>-<label>` (`worktree.issueBranch` in the JSON `node .agents/tk/scripts/session-init.js` prints is `true` when it matches and `false` when it does not; if the script was unavailable, `git rev-parse --abbrev-ref HEAD` prints the name to test against `^worktree-[0-9]+-[A-Za-z0-9._-]+$`; M16), ask the user: "Your branch still has its default name. Want to rename it before creating the PR?" If they say yes, record the branch's cut point first (`node .agents/tk/scripts/merge-check.js --record-cut`, M16; it writes nothing when the cut is already recorded), then rename it to `worktree-<issue-number>-<short-label>`, the branch naming rule in the toolkit reference; the rename carries the recorded cut with it.
4. Draft a PR title and body summarizing the branch's changes. After the summary, the body carries three parts, in this order and in the formats of "The PR body parts" in `.agents/tk/skills/shared/merge-rules.md`, so they outlive the branch, the worktree and a squash: `## Decisions`, one line per Critical Decision of this cycle's plan as `- <decision> - <why>` (`- None recorded` when the cycle had no plan); `## Changelog`, the block Section 3 wrote to `CHANGELOG.md`, byte for byte, in a fence of four backticks, or one more than the longest backtick run inside it (left out when the cycle wrote no block); and the line `Cut from: <sha>`, with the `cut` that `node .agents/tk/scripts/merge-check.js --cut <branch>` prints (M16; left out when it prints none). Show it to the user for review, then create the PR by running the **"Create PR / MR" row** for the detected host, following the quoting rule under the invocation table: the title in single quotes (each `'` written as `'\''`), the body in a `mktemp -d` file on both hosts (inline on GitLab only through the table's `Unknown flag` fallback), and never double quotes or `$(...)`. Take the command from that row rather than from memory: the base-branch flag and the body flag are both named differently on GitLab, double-quoted text has its backticks run as commands, and a command substitution stops for an approval prompt.
5. Show the user the PR URL, and the next step in one line: "When it is ready, `/merge <N>` lands it, checked for lost work."
6. Bring this worktree's records home, in both landing styles: `node .agents/tk/scripts/merge-check.js --bring-home <branch>` (M16) copies the files git does not track under `plans/` and `reports/`, and the dated pages under `artifacts/html/`, into the main copy. `git worktree remove` deletes them without a word, and so does Claude Code when a worktree session it made ends with nothing uncommitted, so this run is the last moment they are sure to exist. It replaces a main-copy file only when it brought that file home itself and nothing changed it since, and lists every file it copied in the record its `manifest` names. On exit 2 it stopped: say why in one line and do not offer the removal. Otherwise say in one line how many it copied and refreshed and the `manifest` path. When it listed nothing under `differs` or `leftover`, add that it is safe to close this session once this `/document` run finishes. When it listed something, name each of those paths instead, and say that removing this worktree's folder, by hand or when Claude Code closes the session, deletes them. Then, unless the repo lands locally, ask the user: "Want me to delete this side copy of the project? Its records are copied to the main copy, and the branch and PR will stay. Only the local folder is removed.", naming each path it listed under `differs` (a record the main copy holds differently) or `leftover` (a file that is not a record, or a change never committed), and each under `ignored` (an ignored file outside the records, such as a build folder or a map built here), since removing the folder deletes all of those.
7. If they say yes, finish Section 9 first, because it reads this branch and writes this copy's marker. Then, as the run's last command, run `git worktree remove <worktree-root-path>` from outside the worktree directory. When step 6 listed a `differs` or `leftover` path, the removal needs a yes that names those files, as `/merge`'s cleanup does: a differing record is ignored by git, so a plain removal deletes it without refusing. An `ignored` path needs no yes beyond the question, which already named it. If removal fails due to untracked files (build artifacts, .env.local, etc.), let the user know they can clean up manually or use `--force`.
8. The branch stays alive on the remote until the PR is merged or closed. To re-create the worktree later if fixes are needed: `git worktree add <path> <branch-name>`.
## 9. Cycle Summary (HTML, default-on)
Generate a one-page HTML summary of what shipped this cycle. Runs on every `/document`, per `.agents/tk/skills/shared/html-outputs.md` (default-on).
### Determine the cycle window
The "cycle" is everything since the last `/document` run, tracked by a marker file.
1. Run `node .agents/tk/scripts/session-init.js --cycle-start` (M16). It prints `start` and `source`: this working copy's marker (`artifacts/html/.last-cycle`, the last summarized commit), else the newest plan's `**Start commit:**`, else the main copy's marker, each taken only when HEAD contains it. A fresh worktree has no marker of its own, and its plan's start commit or the main copy's marker is where its cycle began.
2. **When `start` is set:** window = `<start>..HEAD`, with the sha pasted as literal words.
3. **When `start` is null** (a first run or a fresh clone, or a marker from a rebased or other branch with no plan behind it): fall back to the last merged PR's merge commit, using the **"Most recently merged"** fenced block for the detected host (or the most recent merge in `git log` if that CLI call fails). Run it exactly as written there: it sorts on the merge date on purpose, because taking the first row of a merged list sorts by CREATION date on BOTH hosts and hands back a stale PR that was opened long ago and merged late. Window = `<last-merge>..HEAD`. If no merged PR exists (a fresh repository), keep the last 20 commits, found with literal calls: run `git log --skip=20 -1 --format=%H` as its own call (M16). When it prints a sha, that is `<oldest>` and the window is `<oldest>..HEAD` (exactly 20 commits); paste that sha as words into `git log <oldest>..HEAD --oneline` and `git diff --stat <oldest> HEAD`. When it prints nothing (fewer than 21 commits exist), the whole history is the window, and every later `<window>` call takes its whole-history form: `git log --oneline` for the commits, `git log --format=%ad --date=short` for the commit chart, `git diff --stat 4b825dc642cb6eb9a060e54bf8d69288fbee4904 HEAD` for the changes and `git diff --name-status 4b825dc642cb6eb9a060e54bf8d69288fbee4904 HEAD` for the files by category (that sha is git's empty tree, the same on every repository, so a one-commit repo still gets a non-empty summary), and `node .agents/tk/scripts/doc-check.js --window <root>..HEAD` for the doc checks: run `git log --max-parents=0 --format=%H` as its own call (M16), and run the check once for each sha it prints, as `<root>`. That script takes commits only, so the empty tree exits 2, and with no `--window` it never looks for old names and still prints an empty list. Step 4's window line says "the whole history". Never `$(...)` around any of these, not even a command that is allowed on its own: default permission mode stops for approval on any command substitution, and that stop is what this spelled-out fallback removes. The moves are the ones "Temporary folders" in `.agents/tk/skills/shared/html-outputs.md` describes: one call prints a value, and the value is pasted into the next command as literal words.
4. **State the chosen window in plain English** before generating, especially on any fallback: naming the `source`, e.g., "Summarizing the saved checkpoints since `<ref>` (cycle marker found)." or "Summarizing the saved checkpoints since `<ref>`, where this cycle's plan started (this side copy has no cycle marker yet)." or "The cycle marker was missing or stale, so I am summarizing since `<ref>` instead. Check that this scope looks right." This lets the user catch a wrong window (for example a marker SHA from a different branch) before trusting the summary.
### Decide whether to generate
Inspect `git diff --stat <window>`. If there are **zero meaningful changes** (only whitespace or a single typo fix), skip the HTML but still advance the marker (last step). Otherwise generate the summary.
### Generate the summary
Do NOT hand-write the HTML. Produce a JSON payload matching the schema documented at the top of `.agents/tk/skills/shared/shells/document-shell.html` (read its header comment for the exact fields); the helper injects it into the prebuilt shell. Contents:
- **The cycle's name** -> `title`. Give it a real name ("The Page That Can Go Empty"), never the words "Cycle Summary". It is the loudest element on the page and the line the running log carries forward, and a generic title is dropped from that log entirely.
- **The narrative** - the first screen, and the reason the page exists. Three short blocks: `priorState` (what the system did *before* this cycle), `whatShipped` (what changed), `why` (why it changed). For `why`, when the CHANGELOG entry you have just written carries a `### Why` section, route that section here rather than composing the same reasoning twice; a project whose CHANGELOG has no such section writes `why` fresh. Any of the three may be omitted; a missing one is skipped, not stubbed.
- **Diagram** (optional) -> `diagram`, a self-contained inline `<svg>`, and ONLY when the cycle has a flow worth drawing. Most cycles have none, and omitting the key is the normal case. No CDN and no library: the page works offline. A value that does not parse as SVG is dropped silently, so never let the diagram carry meaning the prose does not also carry.
- **Do NOT author `sinceLast` or `cycleLog`.** The renderer owns both and overwrites whatever you supply: `sinceLast` is what changed since the reader last opened the page, and `cycleLog` is the running history, built from the page this run replaces.
- **Files changed by category** (commands, skills, scripts, docs) from `git diff --name-status <window>` -> `filesByCategory`
- **Documentation deltas** - which of README / CLAUDE.md / CHANGELOG / LESSONS changed, one line each -> `docDeltas`
- **Docs and code disagree** -> `docMismatches` and `docMismatchesFixed`. `docMismatches` holds each mismatch this run reported (Step 2's "code looks wrong, or it is unclear" state), one object each: `{"doc": "<path>", "docLine": <n>, "docText": "<the quoted doc text>", "code": "<path>", "codeLine": <n>, "codeText": "<the quoted code text>", "why": "<one line: why it was not fixed>"}`. `docMismatchesFixed` lists the `key` of each open item Step 2 re-checked and found agreeing. A carried item is never dropped by leaving it out: the renderer carries every open item forward unless its key is in `docMismatchesFixed`, and records each new item's date and commit itself.
- **PR link** - the PR from Section 8 (worktree runs), else the most recent PR via the **"Most recent PR / MR (URL)" row** for the detected host (the URL field is named differently on each host, so read it off that row), else omit -> `prLink` / `prNote`
- **Mini commit chart** - commits per day across the window, from `git log --format=%ad --date=short <window>` -> `commitChart` (the shell renders the inline bars)
- **Where the time went** -> `timeBreakdown`. Leave `timeBreakdown` out: the time report is read from Claude Code's own session files, which this agent does not write. Say so in one digest line.
Write the JSON as `data.json` in a fresh folder from `mktemp -d /tmp/document-render.XXXXXX`, made and used per "Temporary folders" in `.agents/tk/skills/shared/html-outputs.md`. Then run the helper from the project root with that folder as `<render-dir>`. The cycle summary is a **standing page**, one per branch, kept in the main copy's `artifacts/html/` from a worktree too: `--stable` writes `cycle.html` on the default branch and `cycle-<branch>.html` on any other, and replaces it on every run, so cycle pages never pile up, and the helper reads the page it is about to overwrite to build `sinceLast` and the running `cycleLog`. A branch's first page starts from the main page's log and open doc mismatches, and `/merge` folds it back into the main page when the branch lands, so worktrees running cycles side by side never replace each other's headline or link.
Check the publish gate first (see **"Render for the viewport"** in `.agents/tk/skills/shared/html-viewing.md`): if this session can publish, add `--no-abs` to the command below.
```
node .agents/tk/scripts/render-html.js --shell document --name cycle --stable --data <render-dir>/data.json
```
**The name is `cycle`, not `document`.** `--name` feeds both the filename and the artifact index key, and the timestamped pages this replaces already own the key `document`. Rendering under that name would make the lookup below return an old cycle page's URL and update *that page* forever instead of publishing the standing one.
Because this is a `--stable` type, look up its recorded page before publishing:
```
node .agents/tk/scripts/render-html.js --index-url --name cycle
```
The lookup resolves `cycle` to this branch's page, as the render does. Update the page whose URL comes back; publish a new one when nothing does. Then show it to the user per the **"Viewing the Artifact"** rules in `.agents/tk/skills/shared/html-viewing.md`: publish is the primary viewport, the local open is the fallback, and that section holds the whole decision.
### Advance the marker (LAST step)
After the HTML is written (or deliberately skipped), write the current `HEAD` SHA to `artifacts/html/.last-cycle`, overwriting the previous value.
**This must be the final action of `/document`, apart from a removal approved in Section 8.** The marker is a high-water mark meaning "every commit up to here is already summarized." Writing it last guarantees that an interrupted run re-summarizes the same window (a harmless duplicate) rather than skipping work permanently. Never write the marker before the summary exists.
**The marker and the standing page remember different things, on purpose.** `.last-cycle` owns one fact and only that fact: where the git window starts. The page's data island owns what the running log already contains. Because the two never answer the same question, they cannot disagree. Never read the window from the page, and never read the log from the marker. The marker belongs to the working copy and the page to its branch, so after a worktree's branch lands and is folded in, the main copy's next run summarizes those commits again and the log can hold a second entry for them: the harmless duplicate, never a skipped window.
## HTML Output Rules
Every HTML decision above (whether to render, `--no-abs`, publish or open locally, record the publish) is governed by the shared rules fragments, inlined here so they are in context when the render runs.
Read `.agents/tk/skills/shared/html-outputs.md` in full now and follow it as part of this file.
Read `.agents/tk/skills/shared/html-viewing.md` in full now and follow it as part of this file.
**Next:** none. This is the last stage of the cycle, so no command follows it.