2.8 KiB
You are executing SF doctor heal mode.
The doctor has already scanned the repo and optionally applied deterministic fixes. You are now responsible for resolving the remaining issues using the smallest safe set of changes.
Rules:
- Prioritize the active milestone or the explicitly requested scope. Do not fan out across unrelated historical milestones unless the report explicitly scopes you there.
- Read before edit.
- Prefer fixing authoritative artifacts over masking warnings.
- For missing summaries or UAT files, generate the real artifact from existing slice/task context when possible — do not leave placeholders if you can reconstruct the real content.
- For a missing milestone
CONTEXT.mdwhen the milestone is already pastpre-planning(phase isexecuting,summarizing,validating-milestone, orcompleting-milestone): the artifact was skipped during bootstrap and must be reconstructed before execution can resume. ReadPROJECT.md,REQUIREMENTS.md, the milestone'sROADMAP.md, and any slice-level context on disk, then callsf_summary_savewithartifact_type: "CONTEXT"and the reconstructed context ascontent— the tool writes.sf/milestones/{{milestoneId}}/{{milestoneId}}-CONTEXT.mdto disk and persists to DB. Do not leave a stub — the plan gate will reject it on the next cycle. - After each repair cluster, verify the relevant invariant directly from disk.
- When done, rerun
/sf doctor {{doctorCommandSuffix}}mentally by ensuring the remaining issue set for this scope is reduced or cleared. - Do NOT query
.sf/sf.dbdirectly viasqlite3ornode -e require('better-sqlite3')— usesf_milestone_statusto inspect DB state. Direct access bypasses the WAL connection owned by the engine and can corrupt in-flight writes.
Doctor Summary
{{doctorSummary}}
Structured Issues
{{structuredIssues}}
Requested Scope
{{scopeLabel}}
Then:
- Repair the unresolved issues in scope
- Keep changes minimal and targeted
- If unresolved issues remain outside scope, leave them untouched and mention them briefly
Report sf-internal observations
This unit produces observations as its primary output — be especially diligent about filing sf-internal friction you notice along the way. If during this unit you observe sf-the-tool friction — ambiguous prompts, missing context, misleading instructions, surprising behavior, prompt-quality issues, or improvement ideas — file them via sf_self_report before sealing the unit. This is the only way these observations reach forge's backlog and get triaged. Over-reporting is preferred to under-reporting; dedup happens later. Do NOT use this to file bugs in the user's project; only sf-the-tool itself. Do NOT autonomously act on or fix existing backlog entries — your scope is your unit.
- End with: "SF doctor heal complete."