# Build

> >-

- **Type:** Skill
- **Install:** `agentstack add skill-titusz-skills-build`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [titusz](https://agentstack.voostack.com/s/titusz)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [titusz](https://github.com/titusz)
- **Source:** https://github.com/titusz/skills/tree/main/plugins/long-horizon/skills/build

## Install

```sh
agentstack add skill-titusz-skills-build
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

Run **one CID-loop iteration** — Continuous Iterative Development. You are the **orchestrator**: you
do no implementation yourself. You spawn four **roles**, each as an independent fresh-context
subagent, in order, and route their results. The roles ship with this plugin and read their own
context from `.cid/`; you only launch them and read the files they commit.

The point of four separate subagents is **role isolation**: the role that implements (`advance`)
must never be the role that reviews it (`review`). Do not collapse them or do their work inline.
Sequencing, the no-inline-implementation rule, and staying out of the pack files are enforced by
the Rules below, not by structure — hold to them exactly (design rationale:
`references/automation.md` → Design notes).

## Steps

1. **Preflight.** Confirm the CID context pack exists (`.cid/target.md`). If it
    does not, stop and tell the user to run `/long-horizon:init` first — never scaffold it yourself.
    Read `.cid/policy.md` for the **branch model**: ensure you are on the loop
    branch (create it if it does not exist — on a repo with no commits this simply starts it); the
    loop never commits to the protected branch. Run `git status --short` and note the starting
    state. *Done when* you have confirmed the pack, are on the loop branch, and noted the git state.

2. **update-state.** Spawn the `long-horizon:update-state` agent (Agent tool,
    `subagent_type: "long-horizon:update-state"`, prompt: "Run your role for this CID iteration.").
    When it returns, read `.cid/state.md`.

    - If `state.md` shows `## Status: IDLE` **and** records an unratified phase transition
        (a `Transition:` line under `## Phase` — whether recorded this iteration or carried
        forward from an aborted one) → skip to step 5 (`review` runs ratify-only) and route its
        signal. No phase change may end the loop unreviewed.
    - If it shows `## Status: IDLE` with no transition recorded → **stop the iteration**, emit
        `LOOP: IDLE` with the blockers it names, and report. Do not spawn the other roles.
        *Done when* `state.md` reflects this iteration's assessment (including the current phase), or
        you have emitted `LOOP: IDLE`, or you have routed to step 5 for ratification.

3. **define-next.** Spawn the `long-horizon:define-next` agent
    (`subagent_type: "long-horizon:define-next"`, same prompt). When it returns, read
    `.cid/next.md`.

    - If it says `## Step: NONE` → if `state.md` records a `Transition:` line, skip
        `advance` and go to step 5 (`review` runs ratify-only); otherwise stop, emit `LOOP: IDLE`
        with its `## Reason`, and report.
    - Otherwise confirm it defines exactly one work package with runnable Verification.
        *Done when* `next.md` holds one scoped, verifiable step (or you emitted `LOOP: IDLE`).

4. **advance.** Spawn the `long-horizon:advance` agent
    (`subagent_type: "long-horizon:advance"`, same prompt). It implements, tests to the phase's bar,
    runs the quality gate, writes `handoff.md`, and commits. *Done when* the subagent has returned
    and committed (or written a blocker handoff).

5. **review.** Spawn the `long-horizon:review` agent (`subagent_type: "long-horizon:review"`, same
    prompt). It independently inspects the diff, re-runs the gates, ratifies any phase transition
    `state.md` recorded this iteration, curates learnings, sets the verdict, appends the journal
    row, and pushes on PASS (per policy). When routed here from step 2 or 3 without an advance
    commit, it runs ratify-only (see the review role). When it returns, read
    `.cid/handoff.md`. *Done when* `handoff.md` carries a `**Verdict:**` and a
    `**Loop:**` line.

6. **Route the loop signal** from `handoff.md`:

    - `**Loop:** IDLE` → no autonomous work remains (project converged, or everything left is
        human-blocked — there is no separate `DONE` signal; target-met convergence is an IDLE
        case). Emit `LOOP: IDLE` and surface the blockers.
    - `**Loop:** STOP` (a `HUMAN REVIEW REQUESTED` was raised) → **halt**. Emit `LOOP: STOP` and
        surface the exact reason to the human. This is the one stop the autonomous loop keeps; do not
        try to resolve a human-only decision yourself.
    - `**Loop:** CONTINUE` (the normal case, **including a NEEDS_WORK verdict** — the next iteration
        retries) → emit `LOOP: CONTINUE`.
        *Done when* you have emitted exactly one `LOOP:` signal.

7. **Report.** End your output with this block verbatim (so a `/goal` evaluator — which reads only
    what you surfaced in the conversation — and the human can read the outcome without opening
    files):

    ```
    CID iteration complete.
    Phase:     (note a transition as "old → new")
    Verdict: 
    Loop:    
    Step:     → " on a ratify-only iteration; or "-">
    Note:    
    ```

    Use `Verdict: SKIPPED` when the iteration stopped before `review` ran (IDLE at step 2/3, or a
    dead role).

## Rules

- **Spawn, don't do.** Never implement, scope, or assess inline — that destroys role isolation.
    Launch the subagents and read what they commit.
- **One iteration per invocation.** Looping across iterations is the driver's job (`/goal`,
    `/loop`, or a scheduled task) — see `references/automation.md` in this skill for driving the loop
    unattended.
- **Run roles in order** and stop early on `LOOP: IDLE` (steps 2–3) or `LOOP: STOP` (step 6). Do
    not spawn a later role after a stop signal.
- **Stay out of the agents' files.** They own `.cid/*`; you only read them to
    route.
- If a subagent dies or returns nothing, report it as a failed iteration (`LOOP: STOP`, Note: which
    role died) rather than papering over it.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [titusz](https://github.com/titusz)
- **Source:** [titusz/skills](https://github.com/titusz/skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-titusz-skills-build
- Seller: https://agentstack.voostack.com/s/titusz
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
