Build

From CERTCC/Vultron · View interactive version

Build is an AI agent skill from the GitHub repository CERTCC/Vultron. Completes the highest-priority pending implementation task: loads project context, selects the next task from GitHub Issues, implements it, validates, opens a PR, and updates plan history. Use when the user asks to continue planned implementation work or turn the next prioritized item into a complet

How to use this skill

Skill file

Skill: Build

Quick Start

  1. Sync the worktree to origin/main before loading any context.
  2. Invoke orient-agent to load baseline context.
  3. Select the target issue or bundle (auto or explicit) and fail fast on blockers.
  4. Claim every member.
  5. Invoke deepen-context with hints and the Governing specs: floor from the issue(s).
  6. Implement and self-check, validate, have a fresh subagent review the branch,

open one PR closing every member, archive.

Workflow

Phase 0 — Sync

Move the worktree HEAD to origin/main before loading any context. Do not

use git checkout main — that branch may be checked out in another worktree.

git fetch origin main && git checkout --detach origin/main

Detach rather than git reset --hard: a reset moves whatever branch is

checked out, which may be another session's, and discards uncommitted work.

A detached checkout moves no branch and refuses to overwrite local changes.

If this fails, stop and investigate before proceeding. On success, orient-agent

reads fresh specs and notes, and the task branch created by claim-issue.sh in

Phase 2 will be rooted at the latest origin/main commit.

Phase 1 — Orient

Invoke the orient-agent skill.

Phase 2 — Select, Gate, and Claim

  1. Determine the target issue mode:

that is a bundle: implement all of them in one PR that closes every

member. Follow .agents/skills/shared/bundling.md § "Executing a bundle".

Do not ask whether to take only the first, and do not drop members —

bundling exists to get more than one issue done in a PR.

(work-epic-tasks always passes it). Keep it for the hold gate in step 5

and the claim in step 7.

unblocked Now-Epic flow below.

  1. List open Now-Epics:

```bash

bash .agents/skills/shared/query-now-epics.sh

```

The top-priority group is the first Epic with at least one unblocked

open leaf sub-issue.

  1. Query leaf Issues of that Epic and apply eligibility and fit:

```bash

bash .agents/skills/shared/query-epic-subissues.sh <EPIC_NUMBER> \

| PYTHONPATH= uv run bundle-fit --workflow build

```

Eligibility alone (state=OPEN, no assignees, no stale-claim, all

blockedBy CLOSED, subIssues.totalCount==0) is not sufficient: an

Idea or Concern leaf clears every one of those gates and still must not

be built — it belongs to plan-issue, and a Bug belongs to bugfix.

bundle-fit enforces that routing, orders candidates by the authoritative

Project #24 Schedule tier rather than sub-issue list order (PAD-03-001,

PAD-15-014), and respects the size budget. See bundling.md for the rule table.

  1. Take the tool's proposed bundle. Auto-selection may return several members;

confirm they share one design idea in a single sentence (bundling.md

§ "Selecting a bundle") and drop any member that needs a different one.

  1. Empty-Epic gate — applies to both auto-selected and explicit issues:

Query the selected issue's type and sub-issue count:

```bash

bash .agents/skills/shared/query-issue-type.sh <ISSUE_NUMBER>

```

If issueType.name == "Epic" and subIssues.totalCount == 0:

1. Leave labels alone: the epic-needs-planning workflow keeps

needs-planning on an Epic with no sub-issues.

2. Post an actionable comment on the Epic:

```bash

gh issue comment <ISSUE_NUMBER> --repo CERTCC/Vultron \

--body "No implementable sub-issues found. Run \/plan-issue <ISSUE_NUMBER>\ to decompose this Epic into Tasks before building."

```

3. Tell the user: "Epic #N has no sub-issues and cannot be built yet. Run

/plan-issue N to decompose it into Tasks first."

4. Stop. Do not claim, branch, or proceed.

  1. Fail-fast blocker gate on every selected issue (auto-selected or explicit),

and, for an explicit bundle, a homogeneity gate:

stop and name the skill it belongs to (bugfix for a Bug; plan-issue

for an Idea, Concern, or Epic). Do not silently work or drop it.

bash .agents/skills/shared/epic-hold.sh <N> [<EPIC_RUN>]. Exit 3 means

its Epic is claimed by an epic run, which owns its Tasks and Features

even in a later wave. Stop and ask the user before working it. The run

itself passes --epic-run <Epic>, which clears the hold for that Epic

only. Auto-selection never reaches this case: bundle-fit already holds

those candidates back as "not workable yet".

line and has no comment from the user confirming or overriding it: ask

that decision now, with the recommended answer as the recommended option

(issue-creation-requirements.md). Record the answer as an issue

comment and proceed with it. Unattended, or on silence: stop, with the

decision stated.

  1. Pre-claim AC verification gate — fetch the issue body and verify

each acceptance criterion against origin/main HEAD before claiming:

For each - [ ] AC-N: <text> item in the issue body, grep

origin/main for concrete evidence the AC is already satisfied (e.g.,

the described file exists with the required content, the named function

or class is present, the referenced behavior is implemented).

If no - [ ] AC-N: items are found in the issue body (prose-format

or free-form ACs), the gate cannot run mechanically — and that is where

already-delivered work slips through. Read the prose, list its concrete

claims, and check each against origin/main by hand as above. Only then

proceed to step 7 (or close per the rules below) (#1907, #3036).

If all ACs are confirmed satisfied on origin/main:

1. Post a reference comment on the issue citing the PR(s) that

delivered the work:

```bash

gh issue comment <N> --repo CERTCC/Vultron --body "$(cat <<'EOF'

All acceptance criteria are already satisfied on origin/main (delivered

by #<PR>). Closing without further work.

EOF

)"

```

2. Close the issue:

```bash

gh issue close <N> --repo CERTCC/Vultron

```

3. Stop. Do not claim, branch, or deepen context.

If any AC is unconfirmed, proceed to step 7 and claim normally.

  1. Claim the Issue — or every bundle member, onto one branch named for the

first member:

```bash

bash .agents/skills/shared/claim-issue.sh [--epic-run <Epic>] <N> task <slug> [<OTHER_MEMBERS>...]

```

GitHub creates the branch, linked to the issue, and that branch is the

lock (PAD-04-001). A build that is a non-final part of a split (its PR

says Part of #N) keeps that claim and works on an unlinked sibling

branch instead, because a PR from the linked branch closes #N

(PAD-04-008; shared/bundling.md § "Split PRs"). The script then assigns

you, comments, and sets Status = In Progress. Abort immediately if it

exits non-zero: exit 1 means already claimed or failed, and exit 3 means

held by an epic run (step 5).

  1. Fetch each issue's body and comments (including any comments not yet

loaded in step 6). Use the full content as implementation context

throughout Phases 3–5.

Phase 3 — Deepen Context

Invoke deepen-context with focus hints derived from the issue body

(e.g., "wire layer", "BT integration", "embargo lifecycle"), and pass

as the spec floor every spec ID in each member's Governing specs: line

plus any other spec IDs the issue body or comments cite. If an issue has no

Governing specs: line, say so and pass the cited IDs you found (or an

explicitly empty floor).

deepen-context returns a Spec manifest. Keep it: it goes into the PR

body (Phase 8), and reviewers use it as their spec floor.

Then, before the first commit, write the build context file that the pre-push

reviewer and the pr-ship phases reuse instead of loading context again

(.agents/skills/shared/build-context.md § "Writing it", PAD-07-015). Save the

manifest to /tmp/spec-manifest-<N>.txt and run build-context write with the

focus hints, notes and glossary sections deepen-context read.

Phase 4 — Verify Before Coding

  1. Compose-before-create gate (all domain types — blocking):

Load .agents/skills/shared/compose-before-create.md and apply the

per-subsystem search patterns for every subsystem the task touches (use

cases, wire handlers, adapters, demo helpers). Do not write any new code

until this search is complete. If an existing artifact covers the

requirement, compose or subclass it — do not re-implement.

  1. Search vultron/ and test/ to confirm the current state.
  2. Do not assume missing functionality; verify in code.
  3. A missing prerequisite is part of the task. When the work needs

something that does not exist yet (most often a test or check, such as the

verification: check that a split of a requirement with no

verification_debt: marker needs, MS-10-016), the task becomes "build the

prerequisite, then do the task". A person given the task would do the

backfill, and nobody else in the workflow will. Take the first tier that

fits:

1. Small enough to build in this PR: build it. This is the default.

Do not file it, and do not stop.

2. Too big for this PR, but its test can be written now: ask first.

Present the deferral through Gate 1 (completeness-doctrine.md

§ "Gate 1"): what remains, measured, in plain language. This is the one

first-order item Gate 1 accepts (§ "Depth"). On approval, file the

follow-up issue through create-issue (type Task, reason

opened-as deferred, a size: from its AC count, a Governing specs:

line, the approval cited in its body, and no blocks: the task is done

anyway). Then do the task, and write a strict xfail test, with

@pytest.mark.spec("<ID>"), that states the missing behavior and cites

that issue (reason="<ID>: <what>. Tracked by #N.";

notes/spec-authoring-rules.md § "Use a Strict xfail for

Not-Yet-Implemented Specs"). The gap is held by a test that fails

loudly once the work lands, not by a note. Unattended, or on silence,

this tier is unavailable: build it, or hold the PR as a draft with the

missing piece stated.

3. No test can be written yet (the behavior is outside what agents may

build, such as production key handling, ADR-0164, or it needs a design

decision first): ask the user, and when the answer settles the design,

write the test and build it (completeness-doctrine.md § "Ask, Then

Finish"; as a sub-agent, return the Question: block it describes).

If a separate issue is the answer, file it

through create-issue (type Task, reason opened-as separate-defect,

a size: from its AC count, blocks the current issue, the current

issue's Epic as the suggested parent, a Governing specs: line), and

stop. Unattended, or on silence: stop, with the open question stated

on the current issue.

Never stop at "can't do X until someone writes the test". Writing the test

is the move that unblocks it. A learning file is not a substitute for any

tier (upward-reflection.md).

Phase 5 — Implement

See .claude/skills/shared/completeness-doctrine.md for the project standard

on what "done" means — loaded by orient-agent in Phase 1.

  1. Implement the full intent of the selected task, not just the happy path.

Edge cases, error handling, and type correctness are part of the task, not

optional add-ons.

  1. Follow project conventions. "Keep the change focused" means do not expand

into adjacent unscoped work — it does not mean implement less than the task

requires.

  1. Add or update tests for every new or changed behavior. A behavior with no

test is not done.

  1. Reuse existing helpers and keep the implementation DRY.

**If this task creates or modifies a BT node (required — BTC-01-001,

BTND-07-005):**

a. Node inventory: grep vultron/core/behaviors/ for existing node

classes whose protocol state, domain, or semantic action overlaps with

what you are about to implement. Search for the target state value, the

action name, and the affected domain (e.g. "RM.CLOSED",

"EM.EXITED", "active_embargo = None", "add_participant_status").

If a matching node exists, compose or delegate from it — do not

re-implement.

b. Base-class check (BTND-07-009, BTND-07-010): for any emit, send,

or state-transition node, check vultron/core/behaviors/ for an

existing base class whose update() frame covers the same

guard+emit+outbox or guard+transition+log pattern. Consult the domain

base-class table in

CODE0.

If a matching base exists, subclass it. If none exists for your domain,

create it first, then write the concrete node.

c. Sibling-domain scan: check peer trees in sibling modules for the

same trigger condition appearing more than once. A shared trigger (e.g.

IsRemoveEmbargoEvent appearing in two trees) signals a shared behavior

need that should be a single composed subtree, not two parallel

implementations.

d. AC-1 compliance gate: any node that reads EM/RM/CS state MUST do

so through the appropriate Read*StateNode. Any node that writes

EM/RM/CS state MUST do so through Write*StateNode. Inline reads

(e.g. case.current_status.em.state) and inline writes are AC-1

violations regardless of context and must be caught before review.

  1. Sub-agents may help, but main-agent validation is mandatory.
  2. Pre-review self-check — on every PR, once the diff is finished, run the

four items in .agents/skills/shared/pre-review-self-check.md: affected-text

sweep, failure-path pass, branch coverage, reuse check. Fix what each one

turns up, then write its result into a draft PR body at

/tmp/pr-body-<N>.md (the pr-body-guide.md implementation template, with

the four results under Self-check: in ## Verification). The step is done

when all four results are written; the Phase 7 reviewer reads them.

Scope expansion judgment: If implementing this task reveals adjacent work,

the default is to fix it now — FILE (keep a record) and DEFER (leave it for

later) are separate decisions. Apply

.agents/skills/shared/completeness-doctrine.md:

without "also") → just do it; no issue, the diff is the record.

(- Closes #N, one-line "why"). Filing is not deferring.

measured remainder in plain language, and get explicit approval. On

silence (unattended), DEFER is unavailable: finish it in this PR, or hold

the PR (draft, blocked, the unfinished item stated). Never file an issue as the

way to get the PR merged, and do not park the rationale in a learning file as a

substitute for doing the work. Only second-order findings are eligible, apart

from the missing check of Phase 4 step 4, tier 2.

overturned premise, ask if/what to file. On silence (unattended), halt —

leave the PR blocked rather than acting on the new premise unreviewed.

Phase 6 — Validate

  1. Run the linters:

```bash

G=.agents/skills/shared/run-if-changed.sh

uv run ruff check --fix && uv run ruff format

uv run ruff check && "$G" mypy vultron/ test/ .mypy.ini uv.lock -- uv run mypy

```

ruff and mypy, never pyright: CI owns it (PAD-18-026, PAD-18-027).

Do not run pytest here. The local gate — the linters plus the

branch diff's targeted test set — runs once before the first push, in

create-pr Phase 3, adjacent to the push it guards (PAD-18-001,

PAD-18-017). No local gate runs the whole unit or integration suite

(PAD-18-008): CI runs both on the push, and GitHub's required CI gate

refuses the merge until that run passes. While implementing, run the

specific test files you are writing or changing

(uv run pytest <path> -n 0) as often as you like; those are development

runs, not the gate.

  1. Spec backstop (blocking). Update the Spec manifest from Phase 3 if the

work drifted, then resolve it against the diff per deepen-context

§ "Backstop" until

spec-backstop --manifest /tmp/spec-manifest-<issue>.txt exits 0 (no

--paths: the branch diff is what ships). The resolved manifest is what

goes into the PR body. Exit 0 is a floor, not proof of completeness — read

the no deterministic signal and no Python source in the diff notes as

"this part rests on your judgment".

  1. Do not skip or delegate validation. Never bypass a pre-commit hook

(--no-verify, SKIP=); fix what it reports. The sole exception is the

devcontainer actionlint hang (notes/devcontainer-tooling.md).

  1. Apply branch-ownership and pre-existing-failure rules from

completeness-doctrine.md § "Finding Severity".

  1. If pre-existing is proven, the PR is still held: a failing check blocks the

PR whatever its cause (completeness-doctrine.md § "Never Merge on Red"). Do

not open or merge it past the red. Create or update a Bug issue via

create-issue (reason opened-as separate-defect, blocks the current

issue) with evidence (failing command/output, clean-base proof, causality

check, blocked/unblocked impact), add a handoff comment, and record the Bug

link as a learning file in plan/incoming/learnings/. Do not wire the bug

under the task that found it: create-issue routes it by its own theme to

a same-theme Epic, because a bug filed under the work that found it lands

in the wrong theme.

Phase 7 — Pre-Push Review by a Fresh Agent

The review runs in a subagent that did not write the change, before the first

push, so its findings cost no fix commit and no CI run (PAD-07-001, ADR-0139).

  1. Commit everything. The reviewer reads origin/main...HEAD, so uncommitted

work is invisible to it (PAD-07-005).

  1. Spawn a fresh subagent with exactly this prompt:

```text

In <worktree>, on branch <branch>, run the pr-triage skill in pre-push

mode: /pr-triage --pre-push <N> [<M>...] --body /tmp/pr-body-<N>.md

Make no code changes. Return the artifact path and the finding count.

```

The prompt is the whole hand-off: the reviewer's value is a context that

never saw the author's reasoning, so its blind spots differ. The subagent

writes the artifact to the path

bash .agents/skills/pr-triage/prepush-delta.sh --path prints.

  1. Resolve every finding by its decision_outcome, as pr-execute would:

fix-now inline; fix-now-file inline plus an issue the PR closes; a

defer-ask or inversion-halt through the gates in Phase 5's scope

judgment, which on an unattended run means fix it or hold the PR as a draft.

Write each finding's resolution into the artifact (pr-triage/REFERENCE.md

§ "Review-Mode Fields") and commit the fixes (PAD-07-003, PAD-07-010).

  1. Hand the fixes to the post-push triage, which reviews them as part of its

delta; the pre-push review runs once (PAD-07-006).

The step is done when every finding in the artifact has a resolution.

There is no advisory category: every finding is fixed here, filed and fixed,

or holds the PR.

Nearby debt

Before opening the PR, apply the nearby-debt rule from

.claude/skills/shared/completeness-doctrine.md § "Net Issues: Close More Than

You Open": list open opened:debt issues whose Where: names a file in the

diff and fix them in this PR (- Closes #N each). State the closes/opens line in

the PR body per pr-body-guide.md. Any issue you file takes --opened-as.

Phase 8 — Open PR and Finalize

  1. Do not set a size: label. The pr-size-label workflow measures the

whole-PR diff and applies it on every push (PAD-05-002), and the Issue keeps

its AC-count estimate untouched so estimate-versus-actual stays queryable

(PAD-05-010). See shared/sizing.md. To see the size before pushing:

PYTHONPATH= uv run pr-size --base origin/main.

  1. Invoke the create-pr skill to push and open the PR. One bundle is one PR:

the body carries - Closes #N once per member, in bundle order, and the

Changes section names each member's change so a reviewer can map every hunk

to a closed issue (pr-body-guide.md; bundling.md § "Executing a bundle").

The body includes a ## Specs section carrying the Spec manifest from

Phase 3 (pr-body-guide.md § "Specs").

```text

type: implementation

title: <short title>

body: </tmp/pr-body-<N>.md from Phase 5, completed per pr-body-guide.md>

labels: <topic labels only — never size:, see step 1>

issue_number: <N> # the first bundle member

manifest: /tmp/spec-manifest-<N>.txt # resolved in Phase 6 step 2

```

create-pr freshens the branch onto origin/main (cherry-pick),

validates, pushes, and returns the PR URL. Use the returned URL in the

archive-history call below.

  1. Invoke check-docs-sync while CI runs in the cloud. Apply any small docs

updates inline and commit them before finalizing:

```text

Commit message: docs: sync docs/ for issue #<N>

```

Then record the outcome (PD-03-013): edit the PR body to replace the

Docs: pending check-docs-sync placeholder create-pr wrote with the

Docs: line check-docs-sync reported, and push any docs commit. Then run

pr-body-lint --pr-json at the final stage, with --closes-work-item (a

build PR closes a Task or Feature, so it needs a Docs: line even when

it changes no .py), and fix every finding (PAD-20-005; check-docs-sync

§ Step 5).

Do this before archive-history. The session is not done while the

placeholder remains.

  1. Post the pre-push review on the PR as a comment: each finding with its

resolution, so a human sees what the review found (PAD-07-004).

  1. Invoke archive-history — once per bundle member, each entry carrying the

same PR URL:

```text

TYPE = implementation

TITLE = <short task title>

SOURCE = ISSUE-<N>

BODY = "## Issue #<N> — <title>\n\n<completion summary, PR link>"

```

  1. Run the upward-reflection checklist per

.agents/skills/shared/upward-reflection.md and route each triggered

item to the destination that file specifies (BW-07-004). Most route to a

GitHub issue or an in-session fix, not to a learning file. Do not write

completion summaries, and do not record decisions that were made, applied,

and shipped in this session (BW-07-008).

  1. Invoke commit if any learning files were created in plan/incoming/learnings/.

Constraints

bundle — see .agents/skills/shared/bundling.md.

bundle cannot be finished, finish what you can, close only those members, and

say which you left and why.

tests, its own acceptance criteria. A bundle amortizes context, never rigor.

Docs: pending check-docs-sync (Phase 8 step 3, PD-03-013).

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.