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 Sdd Fix?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/phenobarbital-sdd-fix)
---
name: sdd-fix
description: Drain the SDD work ledger — plan-fix, claim, route to the Fast or SDD lane, close by evidence, release the rest.
---
# SDD Fix
Drain the SDD work ledger: plan a severity-ordered, file-grouped batch with
`wikitoolkit ledger plan-fix --json`, claim the selected issues, route each group to the
Fast lane (branch → PR) or the SDD lane (spec → tasks → worktree), close by evidence and
release the rest. The twins never re-implement ordering, grouping or lane rules — the plan is
the contract (`planner_version` is checked before use).
**Read-only ledger**: the ledger resolves to the main checkout. If a sandbox makes it read-only,
report `shared ledger is read-only`, do not request broader filesystem access, do not create a
worktree-local ledger, and exit non-zero WITHOUT claiming anything.
## Full procedure and host adaptations
Before executing, read the [full sdd-fix procedure](../../../.claude/commands/sdd-fix.md)
and your host's adaptation contract: the [Codex adaptation contract](../../../docs/sdd/CODEX.md#codex-adaptation-contract)
on Codex, or the [Antigravity adaptation contract](../../../docs/sdd/AGY.md#antigravity-adaptation-contract) on Google Antigravity (`agy`).
## Usage
$sdd-fix # interactive picker, severity-ordered
$sdd-fix <issue-id> # non-interactive: that issue's whole group
$sdd-fix --top N # non-interactive: first N groups
$sdd-fix ... --kind K --severity S --lane fast|sdd # --lane fast is REFUSED (exit 1) for critical or vulnerability groups
## Steps
1. **Plan** — `wikitoolkit ledger plan-fix --json` (pass `--kind/--severity/--lane` through). Parse stdout as a FixPlan.
Schema (exact keys — do not guess): top level `planner_version`, `generated_at`, `total_open`, `groups`, `filters`;
each group `group_id`, `issues`, `files`, `max_severity`, `lane`, `lane_reason`, `suggested_slug`, `parents`;
each issue `issue_id` (NOT `id`), `title`, `kind`, `severity`, `discovered_from`, `about`, `files`.
Stdout may start with a navconfig banner, so parse from the first `{`. Use this snippet instead of an ad-hoc one:
`plan = json.loads(raw[raw.index("{"):])` then
`hits = [(g, i) for g in plan["groups"] for i in g["issues"] if i["issue_id"] == target]`.
Require a successful exit and `planner_version == "1"` before selecting or claiming anything.
Reject missing/unsupported versions or malformed output; never re-implement ordering, grouping or lane rules.
`--lane fast` is refused for critical or vulnerability groups; stop on that planner error.
The plan presents severity-ordered groups with metadata: group_id, max_severity, lane assignment with reason,
suggested_slug, and the list of issues/files per group. In interactive mode, render a table showing each group's
key attributes for selection.
2. **Select** — picker, or deterministic resolution from the arguments (issue-id → its whole group; --top N → first N groups).
Require a positive N. An empty plan or an issue absent from it is a no-op with an explanation, never a guessed selection.
3. **Claim** — first mint this session's actor ONCE: `ACTOR=agent:sdd-fix:<8 hex>` from
`python3 -c "import secrets; print(secrets.token_hex(4))"`, and reuse that literal string for every claim, close and unclaim
below (a constant `agent:sdd-fix` cannot tell this session's claims from a parallel session's). Then one
`wikitoolkit ledger claim <issue-id> --actor <ACTOR>` per issue in the group, immediately before
executing. The plan is a snapshot; the claim is authoritative: a non-zero exit DROPS that issue and continues. Never close an
issue merely because an earlier plan listed it. Skip groups with no successful claims; preserve the planned lane for remaining issues.
**Scope is fixed at claim time**: the issues this session claimed are its whole scope. Never widen it afterwards (a group
sibling, a QA follow-up, "fix the whole group?") — and never offer to — without first claiming each added issue with the
same actor; one whose claim fails belongs to another session and is dropped, never fixed or closed here.
4. **Prime** — `wikitoolkit ledger context <group.files…> --max-tokens 3000` (full repo-relative paths from the plan, never basenames).
5. **Route** by `group.lane`:
- NEVER switch the main checkout's branch and never require it to be clean; every lane
works inside a worktree provisioned by `parrot sdd worktree ensure`.
If execution cannot proceed, release successful claims in step 7.
- **Fast lane** (`lane == "fast"`): one worktree and one PR per group.
`parrot sdd worktree ensure --json --slug <suggested_slug> --brief-key <issue-short-id> --base-branch <base_branch>`
plans `fix-<issue-short-id>-<suggested_slug>` off `origin/<base_branch>` and returns `<wt>`;
`--base-branch <base_branch>` is what selects the `fix-` prefix. Edit inside `<wt>`, then test from `<wt>`:
when `sdd/config.json` sets `test_command`, run it once; otherwise run the affected package's tests, with
`PYTHONPATH` set to the worktree's package source when the repository's shared venv is editable-installed
against the main checkout (a bare `pytest` there imports the main checkout). Lint the changed files with
the linters the repository configures (`ruff check --fix` only when it configures ruff), `git -C <wt> commit`,
`git -C <wt> push -u origin fix-<issue-short-id>-<suggested_slug>` (the tree has no
upstream by design), then `gh pr create --base <base_branch> --title … --body …`.
ALWAYS a PR — there is no direct-push path. Once step 6 has closed the group's issues, reap
the tree: `/remove-worktree` for `fix-<issue-short-id>-<suggested_slug>`
— never `--force`, never `--delete-branch` (the PR needs the remote branch). A refusal
means something is uncommitted or unpushed: keep the tree and report it.
- **SDD lane** (`lane == "sdd"`): if any `group.parents[].open` is true, reuse that parent spec (`$sdd-task <spec> --from-issue …` per issue);
otherwise `parrot sdd ids reserve --kind feature --count 1 --base-branch <base_branch> --label <suggested_slug>`, author
`sdd/specs/<suggested_slug>.spec.md` from the group, `$sdd-task`, then
`parrot sdd worktree ensure --slug <suggested_slug> --feature-id FEAT-<NNN>`. `$sdd-done <FEAT-ID>` closes it out, including the issues its verified tasks resolve.
For a new spec, the slug comes from `suggested_slug`; never re-derive it. For a reused parent,
use that parent index's existing slug, feature_id, spec and base_branch when provisioning the worktree.
Task creation alone is not resolution: implement and validate the task in that worktree before step 6.
Every task filed for an issue MUST carry `` **Discovered-from**: `issue:<id>` `` — that link is how
`$sdd-done` finds the issue to close. If implementation does not finish in this session, hand the claim off (step 7).
6. **Close** — two keys, fail-closed: an issue closes only if the implementing agent asserts its id as resolved AND at least one of
its `files` appears in `git diff --name-only <base>...HEAD`. Then `wikitoolkit ledger close <issue-id> --reason "<what changed>"
--actor <ACTOR> --resolved-by commit:<sha>` (fast, the implementing commit on the pushed PR branch)
or `--resolved-by task:TASK-<NNN>` (SDD, a completed and validated task).
Capture `<base>` before implementation and check the diff from the implementing checkout.
Do not infer a merge or fabricate a merge SHA merely because a PR was opened.
7. **Release** — every claimed issue that failed either key: `wikitoolkit ledger unclaim <issue-id> --reason "<why>" --actor <ACTOR>`.
`ledger close`/`unclaim` refuse an issue claimed by another actor (exit 1, naming the claimant): that issue is not
this session's — report it and leave it; never pass `--force` to get past it.
Run release on every exit path, including test/push/PR failures or interrupted execution.
If unclaim itself fails, report the issue ID and reason for recovery; do not claim success.
Never leave an issue claimed silently; acknowledgement stays human-only and out of scope here.
**SDD-lane hand-off**: an issue whose `Discovered-from` task is filed in the feature's per-spec index but not yet
implemented STAYS claimed and is reported as `handed off to $sdd-done <FEAT-ID>`, which closes it by the same two
keys once the task is verified. Release it instead when no filed task cites it.
**Fast-lane failure**: when tests, commit, push or `gh pr create` fails, KEEP the worktree,
report its path, and unclaim every issue claimed for that group. Never reap a tree whose
work is not on origin, and never force-push to rescue a rejected push.
## Output
Per group processed:
- Lane used (Fast/SDD)
- Branch/PR URL (Fast) or FEAT-ID + worktree path (SDD)
- Issues closed with their resolved_by evidence
- Issues released with reason
- Issues handed off to `$sdd-done <FEAT-ID>` (SDD lane)