$cf-later-do
Process the deferred side-tasks in docs/later/: pick one, fix it (via $cf-fix or $cf-plan), remove it once verified, then move to the next.
Background
plugin/lib/capture-later.sh is the write side — execution skills call it to record an out-of-scope problem as docs/later/YYYY-MM-DD-<name>.md with frontmatter (date, source, optional slug/problem, conversation_id). This skill is the read/resolve side that closes the loop.
Workflow
Step 0: Custom Guide
bash "${PLUGIN_ROOT}/lib/load-custom-guide.sh" cf-later-do
If the block above printed anything, apply only the ## Before, ## Rules, and ## After sections; if it shows the raw command instead of output, re-run that exact load-custom-guide.sh fence now.
Step 1: Resolve the backlog directory
LATER_DIR = $CF_DOCS_ROOT/later(preferCF_DOCS_ROOTfrom the SessionStart bootstrap context; if absent, runpwdfor$CWDand use$CWD/{docsDir}/later, wheredocsDircomes from.coding-friend/config.json, defaultdocs).- If
LATER_DIRdoes not exist OR contains no*.mdfiles → print> No deferred items in docs/later/.and stop cleanly.
Step 2: Scan and parse
Read every LATER_DIR/*.md. For each file, parse the YAML frontmatter (date, source, slug?, problem?, conversation_id), the # title line, and the body. Build an in-memory list of items.
Step 3: Present the picker
Show a numbered list, sorted by date oldest-first (longest-deferred first). One line per item:
[N] <title> — <date> · source: <source> · <problem or one-line body summary>
Ask the user to choose: a number N, or q to quit. (Use a plain numbered list + an open question — use plain text, not a structured question, since the item count is dynamic.) If the user quits → stop cleanly.
Step 4: Classify and route the chosen item
Determine the item's nature from source + problem + body:
- bug-like (
source∈ {cf-fix,cf-sys-debug}, or the text describes an error / regression / failing test) → route to$cf-fix. - feature/refactor-like (
source∈ {cf-plan,cf-optimize,cf-ship,cf-implementer}, or the text describes a new feature / refactor / optimization / added test) → route to$cf-plan. - unclear → ask the user whether to use
$cf-fixor$cf-plan.
The task description handed to the routed skill = the problem field (if present) + the full body of the item. Include one reference line for the human reader only:
> Reference: slug=<slug> · source=<source> · conversation_id=<id>
Do NOT claim to reopen or restore context from the .jsonl session behind conversation_id — surface it as a human-readable pointer only.
Step 5: Run the routed workflow
Load the chosen skill ($cf-fix or $cf-plan) with the Step 4 task description and run it to completion. Because a loaded skill continues in the same agent, control returns here afterward.
Step 6: Remove the file — ONLY on verified completion
- Concrete completion signal: the routed skill reached its own verified-DONE state —
$cf-fixpassing thecf-verificationgate (tests/verify pass), or$cf-planfinishing all phases and verified. Any other outcome (failed, blocked, user aborted mid-way) → KEEP the file, do NOT remove, and print> Item kept in docs/later/ (not completed). - Deletion guard (required): before removing, resolve the file path and verify it is inside
$CF_DOCS_ROOT/later/. Reject any name containing/,\, or..(mirrors thecf-plan-resumepath-traversal guard). Only delete when the path passes this check. - On successful removal → print
> ✅ Resolved and removed: <title>.
Step 7: Suggest the next item and loop
- Re-scan
LATER_DIR. If items remain → show the updated list (oldest-first) and suggest the next item to tackle (prefer one sharing the sameslug/sourceas the item just resolved if related; otherwise the oldest). Ask whether to continue → if yes, go back to Step 3. - If no items remain → print
> 🎉 docs/later/ is empty — no deferred items left.and stop.
Rules
- Only ever delete files inside
$CF_DOCS_ROOT/later/. Never delete when the routed skill has not reached verified-DONE. - No context restoration from
conversation_id— display it as a reference only. - Slash-only — this skill is never auto-invoked.
- Read side only — never modify
capture-later.shor write newdocs/later/files. - Respect
.coding-friend/ignorepatterns.
Completion Protocol
- DONE — At least one item resolved and removed; remaining backlog reported (or empty).
- DONE_NOTHING — Backlog empty at start, or user quit without picking.
- KEPT — Item picked but the fix did not reach verified-DONE; file retained.