agentleFS
WarshoowWarshoow/afk.sh/skills/afk-debrief/SKILL.md

afk-debrief

Skill3 starsChanged 45 days agoMITView on GitHub

Goes through a finished afk run — reads .afk/summary.md and the traces, sorts each non-green by cause (wrong gate, ticket too big, real failure), proposes what to fix and what to relaunch, and records afk's own defects in its docs/defects.md. Run on waking up, before merging. Triggers: /afk-debrief, \"go through the run\", \"why is #48 red?\".

  • Reads credentials

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    No file → no run made it to the end.

    line 20
  2. Distinctive:

    Read it before judging a red: it holds what no trace contains and what the diff cannot show — the hypothesis taken because nobody was there …

    line 82
  3. Distinctive:

    No file → the session never wrote one.

    line 89
  4. Distinctive:

    Only then, and only if the journal is silent on the point you need, get back into the session that produced the red — the summary gives …

    line 92
  5. Distinctive:

    The sorting is the whole job: Only write in what would have broken the same way on any repo: the orchestrator, the worktrees, the gate, the …

    line 159

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/afk-debrief

The run is over. This skill reads what it left behind, says why each ticket is not green, and proposes what to fix before relaunching.

A red is not a verdict on the ticket: the gate may have been wrong, the worktree badly seeded, the model unavailable. Sorting that out is the whole job.

1 — The summary

cat .afk/summary.md

No file → no run made it to the end; go to .afk/<n>.out. The file's own legend explains its columns.

2 — Read the run before the tickets

Four things are read on the whole, and a single one of them can explain every red at once:

What you see in the summaryWhat it says
integration red while the tickets are greenit is not N problems, it is one: the combination. .afk/integration-verify.txt, worktree kept in .afk/wt/_integration
"duplicate numbers"two branches took the same ADR or migration number. No gate can see it, git neither: renumber before merging. The number stays with whoever cites it most (git grep -c decides)
"same path created by several branches"two branches created the same file, with two APIs both of them right. Each compiles without the other: only the combination says so
"tickets from this run cited in the merged docs"a sentence may be in the future tense about something delivered ten minutes ago. No git conflict, no gate: reread the cited lines
"Model" column ≠ the requested model, without (+N subagents)FALLBACK_MODEL kicked in: the main one was unavailable. Last night's greens ran on the backup model, read them more closely
"Model" column with (+N subagents)the session spawned N subagents; they carry the model of their definition (.claude/agents/*.md) and not the ticket's. One extra model comes from them, not from a fallback — and part of the cost too (defect 41)
"Context" column close to the windowticket too big, even green. It is the thermometer of the slicing, not a quality grade
"the base was already red before the run"the gate was failing on origin/<base> before any ticket ran. Open .afk/base-verify.txt before judging a red: a ticket whose <n>-fail.txt names the same failure is not to blame, and relaunches as-is once the base is fixed. A base-verify.txt starting not rerun: means green: the base had the content of the last complete gate that passed
"no CI on this repo"the local gate is the only one that ran for the whole run. If it was replaced on some tickets, those had no complete gate at all — the line names them

And one warning: a 100% green rate means nothing if the gate verifies nothing. The tickets marked ⚠ had a local gate replaced by their Verify: line — on a repo that has CI, only CI ran the repo's complete gate; without CI, nobody ran it.

3 — Sort each non-green

For each ticket that is not green, the worker left the cause in .afk/<n>.status (reason=), and the detail is in a specific file:

cat .afk/<n>.status          # result, reason, session, model, cost
cat .afk/<n>.out             # the orchestrator's trace for this ticket
Result / reasonWhere it is writtenLikely causeWhat to do
ko / setup<n>-setup.logthe install failed in the worktree: no lockfile at the root, an indispensable gitignored file not seededfix SETUP_CMD or SEED_GLOBS in .afk.env, then relaunch the ticket
ko / verify<n>-fail.txt (last failure kept)to be decided: wrong gate or real failure — see step 5depending on the verdict
ko / pr<n>.outa PR is already open on this branchclose the PR, or close the ticket
ko / build<n>-<attempt>-build.err, and the summary's resume= linethe build command (AFK_BUILD_CMD) exited nonzero; its last stderr line is the reason. No second attemptfix on the build command's side, then relaunch as-is
conflict<n>-wt.errstacking its blockers' branches conflicted, before any sessionserialise the blockers, or resolve by hand and relaunch
ko, no commit<n>-verify.txtthe agent produced nothing, on every attempt, and the ticket's gate fails on the base (so nothing absorbed it). The base itself is broken only if the summary says so (.afk/base-verify.txt); otherwise the session stopped early: it ended its turn announcing its next step, or refusedbase red: fix it first, the whole batch depends on it. Otherwise read the session's last message and relaunch as-is
draft / cutthe PR itselfthe timeout fired: the session may have been cut in the middle of a filereread it in full before leaving draft, and see whether the ticket deserves a Timeout: line
draft / abnormalthe PR + <n>-<attempt>.jsonthe session stopped between two actions, subtype says whichreread; the work present compiles, its completeness is not guaranteed
draft / not committedthe PR itselfthe orchestrator caught up a working tree the agent had not committedthe work is there; check the commit message, it carries the ticket title and not the repo's format
unproven greenthe summarylocal gate replaced (Verify:) and CI inconclusive: nothing ran the complete gatererun CI, or run the complete gate by hand on the branch
push refused<n>-push.txtthe remote refused the branch (token without the workflow scope, branch already there). The work is complete and green locallypush by hand from the kept worktree — that is the whole fix: a relaunch would redo the same work
frozen<n>.outits blocker was not delivered — or the session itself said a prerequisite was missing from its base (result=frozen, the reason is in a comment on the issue and in <n>-<attempt>.json)nothing to do about it: deliver what is missing and it will start. The label has not moved
absorbedthe comment left on the issuenothing to do, the base was already green: a predecessor had delivered its contentcheck then close the ticket
/ CI red<n>-ci.txtthe local gate was green, the repo's CI was not: the local gate is narrower than CIwiden VERIFY_CMD, or the ticket's Verify: line

4 — Read the journal, then ask the session

Each session keeps a decision journal, appended as it goes, at .afk/<n>-work.tsv: six tab-separated columns — ts, phase, decision, why, evidence, result. afk.sh asks every ticket for it, and build_prompt holds the contract.

column -t -s $'\t' .afk/<n>-work.tsv          # one red
grep -H . .afk/*-work.tsv | head -40          # the whole run at a glance

Read it before judging a red: it holds what no trace contains and what the diff cannot show — the hypothesis taken because nobody was there to decide, the option ruled out and what ruled it out, the red gate and what the session concluded from it, the premise that turned out false, anything done outside the ticket's scope. A result of ko or abandoned on a line whose evidence says none is the signature of a session that guessed.

No file → the session never wrote one. Note it as an afk defect (step 7) if it happens across a whole run: the instruction is in the prompt, so it is the prompt that failed.

Only then, and only if the journal is silent on the point you need, get back into the session that produced the red — the summary gives what it takes:

(cd .afk/wt/<n> && claude --resume <id>)

Useful when the failure is a design choice, useless when the environment was broken — in that case the answer is in .afk.env.

5 — Wrong gate or real failure

A ko / verify does not yet say whose fault it is. The red ticket's worktree is kept, dependencies installed:

cd .afk/wt/<n>
git log --oneline origin/<base>..HEAD      # what the agent produced
<the ticket's gate>                         # rerun it by hand
git stash list; git status                  # what it left hanging

Then compare what the gate complains about with what the agent touched:

git -C .afk/wt/<n> diff --name-only origin/<base>..HEAD

The gate complains about files absent from that list → it is the environment or the gate, not the ticket: the worktree does not have what it needs, or the gate is wider than the scope. It complains about files from the list → real failure, and <n>-fail.txt says which one.

Decide in the worktree as it is: resetting it onto the base destroys the state of the failure, which is exactly what you came to read.

6 — Decide, then propose

A table, one ticket per line: relaunch as-is / fix the gate then relaunch / re-slice / take it by hand, each with the reason in one line.

Then the actions, ready to paste — the exact label names are in docs/agents/triage-labels.md:

gh issue edit <n> --add-label <ready-for-agent> --remove-label <ready-for-human>

A ticket to re-slice gets named as such; /afk-preflight step 5 cuts it.

Propose, wait for approval, relabel nothing unprompted. A ticket put back to ready-for-agent starts again the next night: it is a run decision.

7 — Record what is an afk defect

afk's repo is mounted in every project: it is the only place that spans the runs and the projects. RUNS.md already receives each run's facts, appended by afk.sh. What needs judgement goes into docs/defects.md, and you are the one who puts it there.

The path is the script's, not the project's:

d=$(dirname "$(readlink -f "$(command -v afk.sh || echo ./afk.sh)")")
tail -40 "$d/docs/defects.md"      # the format of an entry
grep -h '^## ' "$d"/docs/defects*.md | tail -3   # the last number taken (the archive carries it)

The sorting is the whole job. Only write in what would have broken the same way on any repo: the orchestrator, the worktrees, the gate, the prompt, the parent/child protocol. A flaky test, a badly tuned .afk.env, a badly sliced ticket are project problems — they get fixed over there and have no business in this register.

An afk defect is recognised by one thing: the trace blames the wrong culprit. A healthy ticket marked red, a freeze with no real blocker, a green that compiled nothing, a ticket burning its attempts for a reason that is not its own.

Next number — the highest in docs/defects.md and docs/defects-fixed.md, plus one; a defect already there gets an "Again" paragraph, not a new number. Verdict in the title (fixed if you already have the fix, open otherwise), and three paragraphs: what was seen, the cause, what was done about it. An entry is written in docs/defects.md, which only keeps the live defects; a fixed defect goes into docs/defects-fixed.md, and one that a later fix closes moves there as-is, keeping its number. Then show the entry you wrote. Unlike tickets and PRs, you do not wait for approval on this one: a defect that is not recorded comes back, and gets re-diagnosed from scratch.

Nothing to record is the normal case.

8 — Cleanup

Red worktrees are kept on purpose. Once the ticket is understood:

git worktree remove --force .afk/wt/<n>

Until then they hold the exact state of the failure, node_modules included.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.