Implement plan

From hawkyre/hawk-skills · View interactive version

Implement plan is an AI agent skill from the GitHub repository hawkyre/hawk-skills. Execute an approved Markdown plan with checks for each PR. Record evidence and progress outside the plan. Use for requests to implement or resume a plan. Use implement-plan-audited when the user wants audits during execution.

How to use this skill

Skill file

Implement a plan

Args

Process

Step 1 — Bootstrap context

Use the explicit path or the plan identified by the conversation. Ask if multiple tasks match.

Without an explicit file path, prefer plan.md in that directory. If only HTML exists, use the reader rules below.

Stop if no plan exists. Do not select a plan by modification time.

Load:

Progressive loading is the point — more standing context degrades adherence to each item. Per-increment loading keeps attention focused.

Read the work units

The loop below calls each implementation unit an increment:

An observable check is required. A size field and a particular acceptance grammar are not.

Read references/execution-state.md before recording or resuming work.

Step 2 — Build the execution schedule

Build the dependency graph from the work units. Reject duplicate ids, unknown dependencies, and cycles before execution.

The ready set contains unfinished units whose dependencies are all done in state.json.

Check that saved completion evidence still applies before skipping a completed unit.

Blocked dependencies block their dependents; they do not make them ready.

Step 3 — Execute increments

For each ready increment, run the per-increment loop below. Substeps are ordered so verification gates fire before commit.

3.1 Load increment context
3.2 Think before coding

In ≤ 4 lines of working notes:

3.3 Behavior-preservation setup (only if modifying existing code)

If the unit's file list includes existing files that will be modified:

These tests are the regression net. After modification, they either still pass (intended for refactor / additive changes) or fail (must be deliberate and explicitly called out in done-criteria). A failing pre-existing test post-modification, without a done-criteria acknowledging the change, is a regression.

For greenfield files, skip this step — no existing behavior to preserve.

3.4 Implement

Write code per the plan spec, the standards loaded in 3.1, and the common-mistakes loaded in 3.1. Incremental edits — don't rewrite whole files when a targeted change is enough.

3.5 Check command — layered retry ladder

Run the project check command:

<check-cmd> > /tmp/hawk-implement-plan-check-<inc>.log 2>&1
rg -n 'error|warning|fail|FAIL' /tmp/hawk-implement-plan-check-<inc>.log | head -50

<inc> is the increment id (e.g. inc3). If clean, proceed to 3.6. If not, escalate. Each stage must be qualitatively different from the previous — repeating the same approach with minor variations doesn't count.

After 4 stages without a clean check, stop. The escalation message lists which stages were tried, what each attempted, and the current failure. Recovery decisions (skip, modify, abort) belong to the user.

3.6 Done-criteria verification — the load-bearing gate

The check command passing means compile / lint / tests pass. It does not mean this increment did what was specified.

Read every check for this unit, including relevant use-case results and older Done when fields. Produce concrete evidence:

Save to /tmp/hawk-implement-plan-verify-<inc>.log. If you cannot produce evidence, the increment is not done — re-enter 3.4 with the verification gap as the next thing to address, or escalate.

For a unit that delivers behavior, exercise the mechanism through its application caller, not only a test that constructs it directly.

For an explicit prerequisite, verify its promised schema or compatibility result and identify the dependent unit that activates it.

Do not claim that the full use case works until the connected behavior passes its checks.

This is the gate against the "I think it works" pattern. Self-asserted done is unreliable; evidence on disk is not.

3.7 File-divergence check

Before commit, reconcile touched vs declared:

git diff --name-only HEAD > /tmp/hawk-implement-plan-touched-<inc>.log
git ls-files --others --exclude-standard >> /tmp/hawk-implement-plan-touched-<inc>.log

Compare actual changes with the unit's scope and file groups from Step 1.

Keep pre-existing user changes and execution records separate from application changes.

The file list is starting evidence, not a required exact set.

Explain necessary extra files in the worklog. For untouched listed files, check whether the intended behavior still needs work there.

Pause only for a material scope or design change. Do not add work just to match the list.

3.8 Self-review against common-mistakes

Walk through the loaded common-mistakes files for this increment. Apply each as a checklist item against the actual diff — do not paraphrase, apply. If any apply, fix before proceeding.

Lowest-asymmetry verification (same model that wrote the code is reviewing). Complements the deterministic gates above; do not rely on it alone.

3.9 Pre-commit semantic check

Targeted grep over the diff for things the check command won't catch:

Pre-commit hooks catch most of this deterministically — this step is the fallback when they don't. Surface findings; don't auto-remove without confirmation.

3.10 Record outcome

Record the outcome in worklog.md and merge progress into state.json.increments[<id>].

Follow references/execution-state.md. Keep evidence paths, attempts, and changed files there.

Preserve audit checkpoints and forwarded overrides. Do not append logs or mark execution checkboxes in the plan.

Mark done only after every check has evidence. Record a failed or blocked attempt before stopping.

Step 3.5 — Commit cadence (contract `CC-1`)

After Step 3.10 records done, commit before the next increment. This sub-step is the named contract CC-1. Sibling skills (notably implement-plan-audited) inherit it by reference; do not duplicate its rules elsewhere. The step number is stable — code-audit and implement-plan-audited reference "Step 3.5" by name.

  1. Stop-out edge cases first. If the repo is mid-rebase (.git/rebase-merge/ or .git/rebase-apply/ exists), mid-merge (.git/MERGE_HEAD exists), or has unresolved conflicts (git status --porcelain | grep -E '^(UU|AA|DD|AU|UA|UD|DU)' returns rows) — stop and surface the state. Do not commit through (matches the cap skill's discipline). Plain detached HEAD (not from a rebase) is fine — treat as non-trunk and commit.
  2. If commit=no (arg) or the user has opted out in conversation — skip.
  3. If commit=yes (arg) — proceed regardless of branch; jump to step 5.
  4. Detect the current branch: git rev-parse --abbrev-ref HEAD. If main or master — skip the commit by default. The user is on trunk; assume their own cadence. Continue execution.
  5. Otherwise — commit. Single-line message matching the repo's existing style (discovered via git log -10 --oneline). Stage by actual change, using the discovery from Step 3.7 (the /tmp/.../touched-<inc>.log). Never git add -A or git add . — they sweep in .env, scratch files, unrelated changes. Always stage by the discovered name list. Renames + deletions: git diff --name-only HEAD reports both the old (deleted) and new (modified) sides; git ls-files --others reports the post-rename name as untracked. Stage both; git auto-detects renames. A pure deletion is staged correctly by git add <deleted-path> — git records the removal.
  6. No AI attribution. No Co-Authored-By: Claude, no robot emoji, no "Generated with Claude" line, no model name in the trailer. The commit must read as if a human wrote it.
  7. If pre-commit hooks fail: fix the issue and create a new commit. Never --amend, never --no-verify. Pre-commit hooks are the repo maintainers' chosen deterministic gate; bypassing them is forbidden.
  8. If the discovered change list is empty (no-op increment, fully cached): skip the commit, log a note, continue.

Because parallel-executed increments commit serially from the orchestrator after each subagent returns, at commit time the only uncommitted changes are the just-finished increment's — git diff --name-only HEAD is unambiguous.

Step 4 — Handle failures

If the retry ladder (3.5) exhausts 4 stages without a clean check, OR 3.6 cannot produce evidence, OR 3.7 reveals material divergence the agent can't explain: stop. Report:

Ask the user: continue with a modified approach, skip this increment (mark blocked-on-user), or abort. Do not loop. Do not synthesize a different plan unilaterally.

Step 5 — Completion

When all increments are done or blocked-on-user:

  1. Run a final full check command. Capture to /tmp/hawk-implement-plan-final-check.log.
  2. Self-review the full diff against the full loaded standards set (not just per-increment subsets).
  3. Summarize to the user:

Parallel execution

When units have satisfied dependencies and no overlapping files, use subagents if their work can be isolated safely. Each prompt is self-contained:

Subagents do not commit. They return their diff to the orchestrator. The orchestrator owns the working tree and applies CC-1 serially in DAG-scheduled order after each subagent returns.

The parallel path uses the same verification gates as the serial path — done-criteria check, file-divergence check, outcome record. A subagent's "I implemented it and the check passed" is not enough; its verify log is part of what it returns, and the orchestrator confirms before committing.

Hard floors

The Process steps above are the source of truth. These are the floors that must not slip:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.