--- name: resolve-my-daily-work description: Process the daily-work review report — verify each finding's premise by execution, then auto-fix the confirmed high/medium items that are mine, offer tickets for others' work, stop on the disputed ones, and write status back into the report. trigger: /resolve-my-daily-work model: opus 5 effort: high --- # /resolve-my-daily-work The counterpart to `/review-my-daily-work`. That skill **generates** the living report (review-only, never edits code); this skill **consumes** it — decides each open finding (fix / ticket / won't-fix / reject), applies the confirmed ones, and writes the outcome back into the report. Input report (written by the generator), in the shared directory `$HOME/tmp/my-daily-work-review/`: ``` $HOME/tmp/my-daily-work-review/review.md # living report — open findings, each with a > [!TIP] fix $HOME/tmp/my-daily-work-review/history.md # done-work log — the CURRENT day only (this pass appends here) $HOME/tmp/my-daily-work-review/week-.md # archive, one file per ISO week — written only by the Step 0.5 roll ``` History is the log AND the memory: it records what was decided, oldest-first, so a human can read back the day, and what keeps a settled question from being raised again is a `### Do not revisit — closed without a code change` block inside that same log. The generator dedupes by grepping every such block in the directory — `history.md` plus the `week-*.md` archives — so rolling loses nothing, and `review.md` stays what a human wants it to be: open work and nothing else. Chat and report prose in **English**; code, paths, IDs, commands and ticket names stay as they are. --- ## Principles (the whole point — read first, apply to every finding) The report is a **hypothesis list**, not a work order. "Auto-fix all of these" is never the mandate. Six rules gate every item: 1. **Effort ∝ (irreversibility × blast-radius × remaining runs).** Not "migration = quick, lib = careful". A one-shot script that already ran and won't run again needs only "does it work" — don't gold-plate it. A **re-runnable, irreversible** script over a large table — one whose README says "repeat 1→3 after release" — gets the **highest** rigor. Judge by reversibility and remaining executions, not by the file's category. 2. **Exposure + cost-asymmetry before acting.** Estimate who hits this and how often *before* touching it. Exposure provably ≈0 → **won't-fix with the evidence**, regardless of the glyph. Can't measure it **and** the cost of being wrong is low → skip. But small exposure does **not** mean skip when the cost of the wrong outcome is asymmetric and the fix is cheap (a cached permanent redirect on a state that self-heals: fix it). The real test is cost-of-inaction vs cost-of-fix, not "measurable or not". 3. **Two gates by execution, both before editing.** - **Premise gate:** reproduce the defect — run the "green" test, grep the "dead" field, hit the URL, read the code at the cited line. The report itself has been wrong (the history log's `### Do not revisit` blocks record findings rejected because their premise didn't survive contact with the output code). Confirm or refute; never fix an unconfirmed premise. - **Side-effect gate:** trace the `> [!TIP]`'s consequences before applying it. A fix that double-escapes, or that **removes a deliberate design** (a gate the code comments say was intentionally left out, a "dead" guard that's actually unreachable-by-design) is **refused with evidence**, not applied. Every TIP is a suggestion to verify, not an instruction. 4. **DRY — fix the technique, not the line.** When N findings share one root (grep-based assertions, line-number pins into shared framework, stale docs from one commit), produce **one** decision/fix covering all N. Cluster by root cause first; work clusters, not rows. 5. **Main/Critical first — but simple, obvious low items get done now.** The main pass handles 🔴 and 🟠. A ⚪ low item that is **simple & obvious** — a one-line, side-effect-clean change (typo, `!=`→`!==`, stale line-pin, broken link) — is fixed **immediately**, not deferred: it's cheaper to fix than to carry, and it rides along for free with the same premise/side-effect gates. Defer only the low items that need real work or a judgment call. Don't drown in minor items, but don't leave trivial ones rotting either. 6. **Default to my work — delivery and severity override ownership.** `git blame` the finding's exact line. Mine → in scope. Someone else's code/docs untouched by my range → **default is to offer a ticket** (🎫), not auto-fix — we can't solve all the world's problems here. Three overrides to that default: - **Blocks delivery** → try to fix it regardless of owner. Don't file a ticket and walk away while my delivery is stuck behind it. - **Trivial & safe** → just fix it, even in someone else's code (typo, `!=`→`!==`, broken link, wrong number in prose). Don't ticket trivia. - **Serious bug, anyone's code** → never let it slip. Flag it **explicitly and prominently** (🔴, first in the report TODO and first in the user summary) so it gets attention and isn't missed — whether or not it's fixed in this pass. Data loss, prod writes from tests, security, irreversible-migration hazards belong here. Standing rules that still apply: root-causes-only, minimal-impact, prove-it-before-done, no `!empty()`, commit only files I touched, all git from `$HOME`, never push without consent, tickets → Linear. --- ## Step 0. Preconditions ``` cd /rd && git branch --show-current # → BRANCH — must be my own working branch, not a shared one cd /rd && git status -s ``` - BRANCH is shared (`main`/`stage`/`master`) or detached → **STOP**. - Tree not clean → list the dirty files. Fixes must land as isolated, per-cluster commits, so a dirty tree muddies attribution. Ask to commit/stash first, or proceed only if the dirt is known scratch/build files unrelated to the findings. - Report file missing → **STOP**: run `/review-my-daily-work` first to generate it. ## Step 0.5. Roll the previous day's history before appending to it This pass writes into the standalone current-day `history.md`, and it often runs on a day when no review ran — so it owns the same roll as `review-my-daily-work` Step 0.5. The roll itself is identical; this skill additionally repairs a markerless file, since it may be the first writer of the day. Perform it **before** Step 7 appends anything: `PREV_DAY` = the `` marker on `history.md`'s first line; if the marker is missing, fall back to the date of the file's last `## …` entry. If `PREV_DAY` is earlier than today, append everything below the marker + `#` header to `week-.md` (creating it with the header `# My Daily Work Review — History — week of `), then reset `history.md` to its marker (stamped with today) and the `# My Daily Work Review — History (current day)` header. Same day → nothing to roll. Three cases this pass must handle itself, because it may be the first writer of the day: - **File missing or empty** → create it with `` and the `# My Daily Work Review — History (current day)` header **before** appending in Step 7. A markerless file cannot be rolled later — that is how two days end up in one week's archive. - **File exists but has no marker** → put the marker on the first line, above the `#` header. This is the one write that goes at the top of the file; entries themselves are always appended at the bottom (see Step 7). - **File holds entries from several days** (only possible if a previous pass skipped this step) → file each `## ` entry into the week file its own date belongs to, keeping only today's. Skipping this step is what breaks the split: the day's entries would be stamped with today's marker and never roll. ## Step 1. Parse the report Read `$HOME/tmp/my-daily-work-review/review.md`. Extract every TODO finding as `{id, severity, file, line, problem, tip}`. Note the `last-reviewed:` SHA (context only — this skill does not change it; the generator owns it). ## Step 2. Triage — filter and cluster before any work Apply the gates on paper first, in this order: 1. **Severity gate (rule 5):** work 🔴 + 🟠. For ⚪ low: if it's simple & obvious (one-line, side-effect-clean) keep it in scope for an immediate fix; otherwise set it aside as "deferred". 2. **Ownership gate (rule 6):** `git blame -L , -- ` (from `$HOME`) on each remaining finding. Mine → keep. Others' → "ticket-offer" list, **except** when it blocks delivery, or the fix is trivial & safe, or it's a serious bug — those stay in scope (a serious one is also tagged for the prominent flag in Steps 7–8). 3. **Cluster (rule 4):** group the kept findings by shared root cause. From here on the unit of work is the **cluster**, not the finding. Report the triage: N findings → K in scope (mine, high/medium), grouped into C clusters; X deferred low; Y others'-work → ticket offers. ## Step 3. Premise gate — parallel, read-only (rule 3, first gate) Fan out **one read-only subagent per cluster** (independent → one message, multiple `Agent` calls; `Explore` or `general-purpose`, read-only). Each agent reproduces the defect by execution — run the cited test, grep the field, `curl` the URL, read the code at `file:line` — and returns, per finding: `{verdict: confirmed | false-premise | inconclusive, evidence}`. - **false-premise** → this finding is **rejected** (🚫) with the evidence. Rejecting a false premise is autonomous — it removes a check that shouldn't exist / avoids a fix that would break correct code. - **inconclusive** → treat as **disputed** (Step 5), do not auto-fix. - **confirmed** → carry to Step 4. ## Step 4. Route confirmed findings For each confirmed cluster, apply rule 3's second gate (side-effects), rule 2 (exposure / cost-asymmetry) and rule 1 (effort ∝ irreversibility × blast-radius × remaining runs): - **AUTO (Step 4a):** confirmed **and** mechanical/local **and** side-effect-clean — the change is self-contained and doesn't alter a behavior contract. Examples: `!=`→`!==`, stale line-pin → symbol reference, broken relative doc link, a wrong number in prose, deleting a genuinely dead assertion, updating docs to match shipped code. These I fix without stopping (my confirmed bugs). - **STOP (Step 5):** confirmed but the fix touches a **behavior contract / deliberate design / framework / irreversible-migration semantics**, or changes user-visible behavior (e.g. 301→302), or the exposure/asymmetry call is a judgment, or an `⁉️`/`❓` item, or inconclusive premise. - **WON'T-FIX (🚫):** exposure provably ≈0 and cost-of-wrong low — record with evidence. ## Step 4a. Apply the AUTO fixes Per cluster (one fix for the shared root — rule 4): 1. Make the minimal change (rule 1 — no gold-plating). 2. **Prove it (rule: prove-it-before-done):** for code, run the narrowest relevant stest (`stest path/file.stest`) or the behavior check that reproduced it; for docs, re-read the target. Never mark ✅ on an unproven fix. 3. Commit the touched files only (`RLM-xxx : ` when a ticket applies; autocommit per completed cluster). Do **not** push — that needs consent. ## Step 5. Stop on the disputed ones Present the STOP set to the user, by ID, each with: the confirmed premise + evidence, the proposed fix, and the specific reason it needs a call (contract change / design removal / asymmetry judgment / disagreement). Wait for the decision; then act on it (fix as directed, ticket, or dismiss). ## Step 6. Offer tickets for others' work For the ticket-offer list (rule 6) and any STOP item the user wants handed off: propose a Linear ticket (summary on top, no provenance) — **offer, don't auto-create** (creating a ticket is outward-facing). On approval create it via the normal Linear flow and mark the finding 🎫 with the ticket ID. ## Step 7. Write outcomes back into the report (mirror the generator's file model) The generator's tracker is **git-based** (`last-reviewed:` SHA): its next run reviews only commits **after** that SHA and reconciles whatever is still in the TODO. So the loop-back is simply the generator's own model — **a resolved finding leaves the TODO and moves to history**. No extra ledger, no separate file. What keeps a ✅ **fixed** finding from resurfacing is **Step 3 of the generator** (the deep review), not the SHA and not Step 4. This pass commits *after* the review that produced the report, so every fix commit lands **ahead** of `last-reviewed` and the next run deep-reviews it as new work: a proven fix raises nothing, an unproven one comes back as a fresh finding. Step 4 cannot be the mechanism — it reconciles items *still in the TODO*, and Step 7 below has already removed this one. Neither mechanism covers 🚫 rejected/won't-fix or 🎫 ticketed: no commit was made, the code still reads exactly as it did, and the next commit touching that file makes a subagent raise it again. Those two need one line of memory — and that line goes in the history log, not in `review.md`. In `$HOME/tmp/my-daily-work-review/review.md`: - **Remove** every resolved finding (✅ fixed, 🚫 rejected/won't-fix, 🎫 ticketed) from the TODO. - **Leave nothing settled behind.** `review.md` holds open findings and nothing else — no "do not revisit" section, no closed items, no legend when the TODO is empty. A reader opens it to see what still needs doing; a list of questions already answered is what makes them stop opening it. The memory for 🚫/🎫 goes into the history log below. - **Keep** open items untouched, the deferred ⚪ low list, and STOP items awaiting the user's call: mark each STOP item with a `⚠️` block directly beneath its `> [!TIP]`, stating the premise you confirmed, the evidence, and the specific question. The generator carries that block forward verbatim on its next overwrite — it is how a pending decision survives. - Do **not** touch the `last-reviewed:` SHA — the generator owns it. - A finding the premise gate confirmed as **serious** (data loss, prod writes from a test, security, irreversible-migration hazard) goes **first in the TODO**, above every other group, so rule 6's promise is kept in the file and not only in the chat summary. Append the resolved ones to the **standalone current-day** history file, one dated entry (same format as `review-my-daily-work` Step 5.1 — reuse it, don't invent a new file). **It is a log: strictly oldest-first, append-only** — the new entry goes at the **bottom**, after the last one, never above it. Step 0.5 has already rolled any earlier day out of it, so this file holds today and only today; never append to a week file. The `` marker on the first line reads today's date: ``` $HOME/tmp/my-daily-work-review/history.md ``` ```markdown ## — resolved findings ### Closed - · ✅|🚫|🎫 · ### Do not revisit — closed without a code change - · 🚫|🎫 · ``` The second block is the dedupe memory the generator greps (Step 4 of `review-my-daily-work`), so it carries **only** 🚫 and 🎫 — a ✅ has a fix commit and is closed by the review of that commit, so listing it here would keep answering a question nobody is asking. Omit the block when this pass settled nothing without a code change. ## Step 8. Report to the user **Lead with any serious bug (rule 6).** If the premise gate confirmed a serious defect — data loss, prod writes from a test, security, irreversible-migration hazard — it goes **first**, called out explicitly, whether or not it was fixed this pass, so it can't be missed. Then summarize by ID: how many **fixed** (with commits), **ticketed/offered**, **rejected/won't-fix** (with the deciding evidence), **stopped for your call**, **deferred low**. State the report path and the history path. Never push; never announce un-pushed work as shipped. ## Rules - Verify by execution before touching anything; a false premise is rejected, not implemented. - Main pass = 🔴/🟠; simple & obvious ⚪ low done immediately, the rest deferred. Others' work → ticket offer by default, but fix it when it blocks delivery or is trivial & safe; surface any serious bug prominently regardless of owner. - One fix per shared root cause; effort scaled to irreversibility × blast-radius × remaining runs. - Auto-apply only confirmed + mechanical + side-effect-clean fixes; stop on contract/design/judgment. - Spent one-time scripts — a ticket's own tooling anywhere under `app/*/Plans/` (prototypes and harnesses sit loose, not only in `/scripts/`), and anything in `$HOME/tmp/` — are out of scope: never auto-fix them (as `/create-tests` skips temp/one-time scripts). Act only if the script is still to run and the bug would harm that run. A `done/` segment in the path or an opening `die()` means spent by definition; correct a doc that describes such a script wrongly, not the script. - Prove every fix; commit touched files only; all git from `$HOME`; never push without consent. - Resolved findings leave the TODO → history; the generator's Step 3 re-review of the fix commit is what keeps them from resurfacing, so an unproven fix comes back.