rea-ci-tests-audit
MOmorluto/rea485k近 7 天新增 7,690 个 star
Bulk-builds a project's ArcKit artefacts in parallel from a YAML recipe: computes the artefact dependency DAG, dispatches one subagent per target per wave, validates each output, commits the wave and persists progress to .arckit/state.json so a build can resume. Manual only: run /arckit:arckit-build with --plan, --resume, --target, --refresh or --recipe. Not needed for a single artefact; run that /arckit:* command directly.
You are running the ArcKit build harness. Your job is orchestration only — never read or write artefact content yourself. Spawn subagents for that.
projects/{P}-{NAME}/.arckit/state.json after every wave, before moving on.complete, every file the entry records exists (§ "Recorded paths"), AND every input file's SHA-256 matches the hash recorded at build time, skip. Otherwise the target is stale — rebuild it (and propagate staleness through the DAG). See § "Input-hash change detection".validate-arc-filename.mjs PreToolUse hook is the authoritative path normalizer — it allocates sequence numbers, applies subfolders, pads project IDs at write time. The orchestrator and workers never construct paths by string substitution or call generate-document-id.mjs directly. Read the corrected path back from the Write tool result.| Arg | Effect |
|---|---|
<project> | Project directory name or numeric ID (e.g. 001 or 001-arckit-saas). If absent, prompt user. |
--plan | Dry run. Print the wave plan, do not dispatch any Agents, exit. |
--resume | Read state.json; continue from last incomplete wave. |
--target NAME | Build only NAME and its missing dependencies. |
--refresh NAME | Force-rebuild NAME and everything downstream. An adopted NAME is re-read, never built; everything downstream of it rebuilds. |
--no-commit | Skip the per-wave git commit. |
--recipe NAME | Recipe name (default uk-saas). Resolved against the precedence list below. |
--enable ID | Build an optional target (e.g. --enable AIP), even when the project already has an artefact of its type; existing evidence is then not adopted. |
--exclude ID | Exclude an optional target: neither build it nor read an existing artefact of its type (e.g. --exclude SVCASS). |
--skip-hash-check | Treat any complete target whose recorded files are all present as up-to-date; skip SHA-256 staleness detection. Fast resume; risks missing edits to inputs. |
Recipes are external YAML files. Lookup precedence for --recipe NAME (first hit wins):
.arckit/recipes/{NAME}.yaml — user customizations preserved across plugin updates.${CLAUDE_PLUGIN_ROOT}/skills/arckit-build/recipes/{NAME}.yaml — recipes shipped with the arckit core plugin (uk-saas, uk-mod-sovereign).arckit-uae's recipes/uae-federal-ai.yaml, arckit-ca's recipes/ca-federal-fitaa.yaml). Overlays are separate plugins beside the core, so glob, in order, and take the first match:
${CLAUDE_PLUGIN_ROOT}/../../arckit-*/*/recipes/{NAME}.yaml: a marketplace install, where Claude Code caches each plugin as <marketplace>/<plugin>/<version>/. If more than one version matches, use the highest${CLAUDE_PLUGIN_ROOT}/../**/recipes/{NAME}.yaml: a checkout of the published repo (plugins/uae/recipes/, plugins/uk/finance/recipes/) or of the source repo (plugins/arckit-uae/recipes/)Default recipe is uk-saas. To customize, copy the core default to .arckit/recipes/uk-saas.yaml and edit there:
mkdir -p .arckit/recipes
cp "${CLAUDE_PLUGIN_ROOT}/skills/arckit-build/recipes/uk-saas.yaml" .arckit/recipes/uk-saas.yaml
Built-in recipes:
| Recipe | Plugin | Use case |
|---|---|---|
uk-saas | arckit (core) | UK Government managed multi-tenant SaaS — civilian departments |
uk-mod-sovereign | arckit (core) | UK MOD / sovereign / air-gapped — mod-secure + jsp-936, no SVCASS, sealed-media distribution |
uae-federal-ai | arckit-uae | UAE Federal AI — full Cabinet agentic AI decree compliance with all 12 UAE community commands, integrated research wave (general AI + AWS / Azure UAE region availability), plus core ArcKit governance |
uae-agentic-transformation | arckit-uae | UAE Federal Agentic AI Transformation — focused 24-month playbook for the 23 April 2026 Cabinet framework's 50%-of-services-by-April-2028 target; ADRs reshaped around agentic architecture (orchestration, human-in-the-loop, observability, kill-switch); PLAN + ROADMAP timeboxed to the 24-month window |
ca-federal-fitaa | arckit-ca | Canadian Federal — FITAA, ITSG-33, GC Digital Standards |
au-federal | arckit-au | Australian Federal / DISP-supplier — ASD Essential Eight, ISM, DTA DSS, Privacy Act 1988, OAIC NDB, PSPF, AI Assurance, DISP attestation (35 targets, 9 waves) |
au-energy | arckit-au-energy (composes arckit-au baseline) | Australian Energy Sector — AESCSF maturity, AER ring-fencing, AEMC NER/NGR, AEMO interfaces, DERMS/DOE, CSIP-AUS layered on the AU federal baseline (Essential Eight, ISM, OT security, SOCI/CIRMP, Privacy Act/NDB). Optional default-off SERVICE_INVENTORY (servicenow). 23 targets. First Australian sector overlay. |
uk-nhs-clinical-safety | arckit (core, references arckit-uk-nhs commands) | UK NHS Clinical Safety + UK/EU MDR — NHS DCB0129 (manufacturer) + DCB0160 (deployer) clinical safety case (Marcus Baw SAFETY.md 3-file spec), NHS DTAC (form v2.0), UK MDR 2002 + EU MDR 2017/745 SaMD/AIaMD classification. Composes with UK SaaS baseline (no swaps; adds clinical safety + medical-device regulation on top). 44 targets across 8 waves. Second sector overlay, after UK Finance Payments. |
uk-food-sfbb | arckit-uk-food | UK food safety for a small caterer in England or Wales, from the FSA's Safer food, better business for caterers pack: business profile, the five sections of safe methods, the business's own methods, the allergen information, the cleaning schedule, the suppliers and contacts, the blank diary and record sheets, and the completion record (12 targets, 4 waves), each target with a min_lines that suits its document. No ArcKit baseline. A build has nobody to answer, and its prompts give no named person's answers, so it confirms nothing: it makes the worksheets that are missing and writes each document that does not exist yet as a draft, from the answers a named person has already confirmed, and it never signs anything off. |
See ${CLAUDE_PLUGIN_ROOT}/skills/arckit-build/recipes/uk-saas.yaml for an annotated reference. Top-level keys:
recipe — recipe name (string, must match filename stem)schema_version — recipe schema version (currently 1)description — free textdefaults.version — default version stamp for outputs (e.g. "1.0")optional_targets — map of target ID → {description, default}post_build_hooks — list of {skill, args} to run after final wave (parallel)targets — list of target entriesEach targets[] entry:
| Field | Required | Notes |
|---|---|---|
id | yes | Unique target ID (e.g. PRIN, ADR-001, DIAG-C4). Never contains :, which separates the dep ID from the path in an input-hash key |
skill | yes | ArcKit skill name (e.g. arckit:requirements) |
args | yes | Args string passed to the skill, after substitution |
output.project | yes | "000-global" or "{P}-{NAME}" |
output.type | yes | ArcKit doc-type code (PRIN, REQ, ADR, DIAG, …) — used for state.json keys, NOT for path construction |
output.subfolder | no | Orientation hint shown in --plan and worker prompts; the actual subfolder is enforced by validate-arc-filename.mjs's SUBDIR_MAP at write time |
output.multi_instance | no | Orientation hint; the hook's MULTI_INSTANCE_TYPES list is authoritative |
topic | no | Used in commit messages and {TOPIC} substitution |
min_lines | no | The fewest lines the written document may have, a whole number of 1 or more, for a document that is short by nature. The worker's check (worker step 3) and the orchestrator's validation (per-wave step 4) both use it. Absent, the document must have more than 100 lines, as before, the same as min_lines: 101. scripts/check_recipes.py rejects any other value |
deps | yes | List of target IDs, may include glob "ADR-*" |
The output.subfolder / output.multi_instance fields document recipe author intent for human readers and --plan output, but the path-allocation hook is the source of truth at write time. If a recipe says subfolder: decisions for a single-instance type the hook doesn't recognise, the file lands wherever the hook decides — debug via the hook, not the recipe.
The orchestrator substitutes these placeholders in args and output.project before dispatching to workers (workers never see placeholders):
| Placeholder | Source |
|---|---|
{P} | Project ID, zero-padded (e.g. "001") |
{NAME} | Project slug (e.g. "arckit-saas") |
{V} | defaults.version from the recipe |
{TOPIC} | target.topic (multi-instance ADR/DIAG topics) |
deps: ["ADR-*"] matches all targets whose ID begins with ADR-. Exact IDs take precedence; globs expand at wave-computation time against the resolved target list (after optional-target filtering).
An exact-ID dep naming an optional target orders the build only while that target is enabled. A disabled optional target is resolved in one of two ways (run step 6):
default is false (it was named in neither --enable nor --exclude), and the project already has an artefact of its output type, the harness adopts that artefact instead of building it. The target is recorded complete with source: "pre-existing" and adopted: true, it stays in its dependents' deps, and they read the existing artefact: for a multi-instance type, the latest version of every instance. A recipe can therefore declare evidence a target should read when it exists but never generate just to satisfy a dependency, such as an existing backlog or codebase audit. An adopted target is never dispatched, on a first run, a --resume or a --refresh; it is re-resolved from the project's files on every run.--exclude), its ID is removed from every remaining target's deps. A recipe may therefore declare the true ordering — OAGOV deps [OAAL, OASEC] in oaa-full — without --exclude OASEC leaving OAGOV waiting forever on a target that will never run.--exclude ID therefore means "neither build nor read": the target is not dispatched, existing artefacts of its type are not adopted, and no worker receives their paths. --enable ID turns adoption off: the target is built like a default-on one. For a single-instance type its worker reads the latest existing artefact as its previous version and writes the next version; a multi-instance type gets a new instance. A dep naming a non-optional target that doesn't exist in the recipe is still an error.
The orchestrator records the SHA-256 of every input artefact at build time and compares against the live filesystem on the next run. This catches the "user edited REQ after the build completed but never re-ran" case that pure test -f idempotency misses.
A state entry records the files it stands for in one of two shapes. Every rule in this skill (completion, the work list, --resume, --skip-hash-check, hashing, staleness and the paths a worker may read) reads an entry through paths(t):
| Entry | Shape | paths(t) | Complete when |
|---|---|---|---|
| Built target, pre-existing target, adopted single-instance target | "path": "<repo-relative path>" | [path] | status is complete and the file exists |
| Adopted multi-instance target | "paths": ["<repo-relative path>", …] | paths | status is complete, the array is non-empty and every file in it exists |
An entry carries one shape, never both. An entry with neither, or with an empty paths array, is not complete. Only an adopted entry uses paths; a built multi-instance target such as ADR-001 records its one file in path.
A target's inputs are the resolved output paths of its deps (after glob expansion), including every path of an adopted dep. A worker may also read its own target's previous version, but that is context for version detection, not an input: it is not hashed, so a target never goes stale because of its own earlier output. Externally-supplied inputs (e.g. external/policies/*.md) are not hashed by v0.4 — only artefacts the harness itself produced or recorded as source: "pre-existing". Recipes that surface external inputs should hash them in v0.5.
Each completed target's state entry gains an input_hashes map from input key to SHA-256, with one key per file in each resolved dep's paths(dep):
path: the key is DEP_IDpaths: one key per file, DEP_ID:<repo-relative path>, for example CDAU:projects/001-arckit-saas/audits/ARC-001-CDAU-002-v1.0.mdEvery file of an adopted dep is hashed. Target IDs never contain :, so the two forms cannot collide, and the full path keeps two files with the same name in different folders apart.
"RISK": {
"status": "complete",
"path": "projects/001-arckit-saas/ARC-001-RISK-v1.0.md",
"input_hashes": {
"REQ": "9f2a...c41e",
"STKE": "1b88...07ad",
"PRIN": "44e7...bc92"
},
...
}
The map is populated by the orchestrator (Bash sha256sum) immediately after a target validates complete in per-wave step 5 — workers don't compute hashes.
--skip-hash-check)At work-list computation (run step 8), after run step 6 has re-resolved this run's adopted targets:
Start with done = { t ∈ state.targets : t.status == "complete" AND paths(t) is non-empty AND test -f every file in paths(t) }.
Direct staleness: for each t ∈ done that has an input_hashes map (adopted entries have none, so they are never stale themselves), compute its expected keys: the input keys of every resolved dep, as this run resolves it, whose entry records path or paths. t is stale if
skill); a pre-existing entry was not built from those inputs, so only its recorded keys are checkedpath for a DEP_ID key, and the named path for a DEP_ID:<path> keyMove a stale t from done back into pending and set state.targets[t].status to "stale".
Propagated staleness: walk the DAG; any target whose deps (transitively) include a stale target is itself stale. Apply in topological order so a single REQ edit cascades to RISK, HLD, SOBC, PLAN, TRACE, …
Targets explicitly named in --refresh NAME are marked stale unconditionally (existing behaviour — overrides hash check). An adopted target named in --refresh stays adopted and is not dispatched; its dependents are marked stale and the cascade continues from them.
With --skip-hash-check, skip steps 2–3 entirely. done is whatever survives step 1.
Adopted targets are never in pending, whatever these rules find: a changed or missing adopted file makes its dependents stale, through step 2 and then the step 3 cascade.
Print the staleness reason in the --plan output so users can see why a target rebuilt:
Wave 1: REQ
(stale) REQ ← file edited since last build (sha mismatch)
Wave 3: RISK, HLD, STRATEGY, ...
(stale-cascade) RISK ← REQ changed since 2026-05-12T10:14:03Z
Wave 4: DEBT
(stale) DEBT ← new input CDAU:projects/001-arckit-saas/audits/ARC-001-CDAU-002-v1.1.md
SHA-256 of typical ArcKit artefacts (≤500 KB markdown) is sub-millisecond per file. A 50-target project incurs <100 ms of hashing on --resume. Workers do no hashing; only the orchestrator does (single shell loop in per-wave step 5 and run step 8).
Standard topological sort with parallelism:
pending = recipe.targets ∩ enabled - adopted - done — where enabled reflects --enable/--exclude flags and optional_targets[id].default, adopted is the set run step 6 adopted (never dispatched), and done is computed by the staleness rules in § "Input-hash change detection" (i.e. complete AND every file in paths(t) exists AND its input keys and hashes match, unless --skip-hash-check is set). Stale targets stay in pending.done from staleness computation above.wave = { t ∈ pending : deps(t) ⊆ done ∪ adopted } (after expanding globs)|wave| > 20, split it: dispatch the first 20 (stable sort by target ID), and leave the remainder in pending for the next iteration. They have no unmet deps, so they form the next wave immediately.Why the 20 cap is load-bearing. Claude Code caps concurrently-running subagents at 20 by default (CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS, v2.1.217+) and denies over-cap spawns rather than queueing them — the 21st Agent call in a single message fails with "Concurrent subagent limit reached … Do not retry". Because this harness is halt-on-fail, an over-wide wave does not run slower, it fails. No bundled recipe exceeds 16 (CI enforces this via scripts/check_recipes.py), but a user-authored recipe under .arckit/recipes/ never passes through CI, so split at dispatch time rather than assuming the recipe is well-formed.
There is no longer a per-session spawn ceiling to budget against: Claude Code v2.1.224 removed the 200-subagent-per-session cap, and CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION is now accepted in settings but never read. Concurrency (above) and nesting depth are the only subagent limits left. Do not reintroduce a per-session budget check here.
A split wave is still one commit — commit after the whole logical wave completes, not after each chunk of 20.
Worked example — for project 001 (UK-SaaS recipe) starting from empty state, the algorithm produces something like:
Treat this as illustrative only; the harness recomputes waves at runtime from the recipe DAG.
For each wave, in order:
Print:
Wave {N}/{total}: {targets joined}
- estimated agents: {len(wave)}
- estimated duration: ~2-5 min wall-clock per agent (parallel)
Use the Agent tool with subagent_type: "general-purpose". One Agent call per target. All in the same assistant message so they run in parallel.
Pass run_in_background: false on every call in the wave. Claude Code v2.1.232 made non-teammate Agent spawns background-by-default in interactive sessions — a backgrounded spawn returns async_launched and an agentId, not the worker's report. This harness needs the reports before it can validate, commit, and decide whether to halt, so a wave is exactly the case the parameter exists for. The parameter is stripped from the tool schema in some contexts; if it is unavailable, the spawns are background-only and you must wait for every worker's completion notification before step 3 — do not proceed on async_launched results, and never infer a worker's outcome from the fact that it launched.
Per-agent prompt template (substitute {...} placeholders from the resolved target). {INPUT_PATHS_BULLETED} has one bullet per file in paths(dep) for each resolved dep, so every path of an adopted dep; an excluded or pruned dep contributes none. {PREVIOUS_VERSION_LINE} is Your target's previous version (read it to keep its IDs, owners and Revision History; write the next version beside it, never over it): {PATH} when the target already has an artefact: its recorded path on a rebuild, or the latest ARC-{P}-{TYPE}-v*.md for a single-instance type. Otherwise leave the line out. {MIN_LINES} is the target's min_lines, or 101 when it sets none.
You are an ArcKit artefact worker subagent (orchestrated by arckit-build, wave {WAVE_N}).
Project: {PROJECT_ID} ({PROJECT_NAME})
Target: {TARGET_ID}
Skill to invoke: {SKILL}
Skill args: {ARGS_RESOLVED}
Expected directory: {EXPECTED_DIR} # for orientation only — actual filename is hook-allocated
Inputs you may read (only these):
{INPUT_PATHS_BULLETED}
{PREVIOUS_VERSION_LINE}
Steps:
1. Use the Skill tool to invoke `{SKILL}` with the args above verbatim.
**Interactive Q&A handling (CRITICAL — subagents have no user available):**
If the skill calls `AskUserQuestion`, you MUST select the option marked `(Recommended)`
without asking. If no option is marked Recommended, use these defaults:
| Question header | Default |
|-----------------|---------|
| Scope | `Full system` |
| Consultation | `Surveys` |
| Phase | value from skill args, else `alpha` |
| AI mode / scope | derive from REQ FRs (AI-in-scope iff any FR mentions AI/ML/LLM) |
| Risk appetite | `Medium` |
| A choice between projects or documents (no option marked, section 5 of the reference) | none: see below |
| Anything else | first option in the list |
Document the choice you made in your final report so the orchestrator can record it.
Never block waiting for an answer. The one question you do not answer is a choice between
several projects or documents: do not pick one. Stop without writing the artefact and name the
candidates in your final report, so the orchestrator can record why the target was not built.
This is the non-interactive rule of `${CLAUDE_PLUGIN_ROOT}/references/interview-pattern.md`;
the table above wins where it names a header.
2. Capture the actual file path the skill wrote to. Inside the Write tool call,
the ArcKit `validate-arc-filename.mjs` PreToolUse hook normalizes the path
(allocates the next sequence number for multi-instance types like ADR/DIAG,
moves into the correct subfolder, pads project IDs). The hook returns the
corrected path as `updatedInput.file_path` and the actual write proceeds
there. You will see this corrected path in the Skill tool's result.
Read `ACTUAL_PATH` from that result. Do NOT call `generate-document-id.mjs`
yourself or construct paths by string substitution — the hook is the
authoritative path allocator.
3. Sanity check the corrected path via Bash:
- `test -f "$ACTUAL_PATH"` returns success
- `[ "$(wc -l < "$ACTUAL_PATH")" -ge {MIN_LINES} ]`
- `grep -c '^## Document Control\|^| Document ID' "$ACTUAL_PATH"` returns ≥ 1
4. Do NOT git commit. Do NOT modify other files. The orchestrator handles version control.
Finish in this turn. You run unattended: nobody will answer a question or say
"continue", and a message with no tool call ends your work. Do not end on a
summary that announces the next step, an offer to carry on, a list of decisions
that don't block you, or a pause because a milestone is done. Put any status
note in the same message as your next tool call and keep going until the file
is written and checked. Stop early only when nothing can move without input you
cannot get, and then say exactly what is blocking you.
Report back ≤ 200 words:
- Actual file path written + exact line count
- Top 3 findings, scores, or RAG ratings (whatever the skill produces as headline result)
- Validation result: PASS or FAIL (with reason)
- Any failures, partial completions, or warnings
- AskUserQuestion choices made (if any)
Do NOT include the document content in your report. Just the summary.
When all return, collect summaries. "Return" means the worker's ≤200-word report is in hand — not that its Agent call succeeded. A launch acknowledgement is not a result (see the run_in_background note in step 2).
For each target in wave:
test -f).{MIN_LINES} (wc -l), the value the worker checked: the target's min_lines, or 101 when it sets none.grep -c '^## Document Control' ≥ 1).One retry for a missing file. Opus 5.5 can end a worker's turn with a progress report ("next I'll write the file…") before the work is done, and that report arrives as the worker's final answer. If a target has no file, or its report announces a step it never took, re-dispatch that one target once, in the same run_in_background: false form, adding to the prompt: Your previous attempt ended before the file was written: "{LAST_LINE_OF_REPORT}". Finish the work this time. If the retry also fails, mark it failed as below. Never retry more than once: a target that stops twice needs a person to look at it.
Read projects/{P}-{NAME}/.arckit/state.json, update each target with:
{
"<TARGET_ID>": {
"status": "complete",
"path": "{ACTUAL_PATH}",
"built_at": "{ISO_TIMESTAMP}",
"wave": {WAVE_N},
"line_count": {LC},
"skill": "{SKILL}",
"topic": "{TOPIC_OR_NULL}",
"agent_summary": "{≤200-word agent report}",
"input_hashes": {
"<DEP_ID>": "{SHA256_OF_state.targets[DEP_ID].path}"
}
}
}
Compute input_hashes via Bash sha256sum on every file in each resolved dep's paths(state.targets[DEP_ID]) immediately before persisting state, keyed as § "What's recorded" describes (DEP_ID for a path, DEP_ID:<repo-relative path> for each of an adopted dep's paths). Skip deps whose entry records neither (e.g. external inputs). Targets with no deps get input_hashes: {}.
The same write persists run step 6's adoption changes: the adopted entries it recorded, and the removal of those it discarded. Read the current file first and merge into it; a later wave must not lose what an earlier wave or an earlier run recorded.
For failures: status: "failed", error: "...", wave: {WAVE_N} — do not record input_hashes for failed targets.
If --no-commit not set:
git add {OUTPUT_PATHS} projects/{P}-{NAME}/.arckit/state.json
git commit -m "$(cat <<'EOF'
Build wave {N}: {targets joined} via arckit-build
{One-line per target with line count and headline result}
Co-Authored-By: Claude Code <[email protected]>
EOF
)"
If any agent in the wave reported FAIL or validation failed:
status: "failed", error: "...", wave: {WAVE_N} for failed targets, and status: "complete" for the targets in the wave that did succeed. State is needed for --resume.--resume once fixed.Otherwise, proceed.
projects/{P}-{NAME}/.arckit/state.json:
{
"state_format_version": "0.4",
"project_id": "001",
"project_name": "001-arckit-saas",
"recipe": "uk-saas",
"recipe_path": ".claude/skills/arckit-build/recipes/uk-saas.yaml",
"started_at": "2026-05-03T16:00:00Z",
"last_wave_completed": 5,
"current_wave": 6,
"targets": {
"PRIN": {"status": "complete", "path": "projects/000-global/ARC-000-PRIN-v1.0.md", "wave": 0, "source": "pre-existing", "input_hashes": {}},
"REQ": {"status": "complete", "path": "...", "wave": 1, "source": "pre-existing", "input_hashes": {"PRIN": "44e7...bc92"}},
"RISK": {"status": "complete", "path": "...", "wave": 3, "skill": "arckit:risk", "input_hashes": {"REQ": "9f2a...c41e", "STKE": "1b88...07ad", "PRIN": "44e7...bc92"}},
"BKLG": {"status": "complete", "source": "pre-existing", "adopted": true, "path": "projects/001-arckit-saas/ARC-001-BKLG-v1.2.md"},
"CDAU": {"status": "complete", "source": "pre-existing", "adopted": true, "paths": ["projects/001-arckit-saas/audits/ARC-001-CDAU-001-v1.1.md", "projects/001-arckit-saas/audits/ARC-001-CDAU-002-v1.0.md"]},
"DEBT": {"status": "complete", "path": "...", "wave": 4, "skill": "arckit:arc42-debt", "input_hashes": {"RISK": "6c01...9e2f", "CDAU:projects/001-arckit-saas/audits/ARC-001-CDAU-001-v1.1.md": "d3a9...71b0", "CDAU:projects/001-arckit-saas/audits/ARC-001-CDAU-002-v1.0.md": "0b5e...c8d4"}},
"SVCASS": {"status": "pending"}
},
"waves": [
{"n": 0, "targets": ["PRIN"], "status": "complete", "completed_at": "..."},
{"n": 3, "targets": ["RISK", "STRATEGY"], "status": "complete", "completed_at": "..."}
]
}
State written by older versions (state_format_version: "0.3") is read-compatible: targets without input_hashes are treated as if all hashes match (no spurious rebuild on upgrade). The next successful build of any such target records its hashes and migrates the entry to 0.4 in place. The orchestrator rewrites state_format_version to "0.4" on first write.
Parse arguments from skill input (project, --plan, --resume, --recipe, --enable, --exclude, etc.). If project not specified, ask user.
Detect project: resolve <project> arg → projects/{P}-{slug}/. Confirm directory exists.
Load recipe: resolve --recipe NAME (default uk-saas) against the precedence list. Read the YAML with the Read tool. Validate top-level shape (recipe, schema_version, targets, defaults.version). Halt with a clear error if the recipe file is missing or malformed.
Resolve enabled targets: drop optional_targets whose default: false unless --enable ID was passed; drop optional_targets named in --exclude ID. Note which dropped targets are adoption candidates: those dropped only because their default is false, named in neither --enable nor --exclude. Record nothing yet. Apply {P}/{NAME}/{V}/{TOPIC} substitution to every args and output.project field.
Load state.json at projects/{P}-{NAME}/.arckit/state.json. If absent, scan project dir for existing ARC-{P}-*-v*.md files and infer initial state for the enabled targets (not for --enabled ones, which are always built, and not for adoption candidates, which step 6 resolves).
Resolve adopted evidence, on the state step 5 loaded:
ARC-{P}-{TYPE}-v*.md (or ARC-{P}-{TYPE}-*-v*.md for a multi-instance type) in the project directory and its subfolders, and take the latest version of each instance, comparing version numbers numerically (v1.10 is later than v1.9). If there is at least one, set state.targets[ID] to {"status": "complete", "source": "pre-existing", "adopted": true} plus path (single-instance type) or paths, sorted (multi-instance type), replacing any earlier entry for ID, and keep ID in its dependents' deps. If there is none, delete any earlier adopted entry for ID.adopted entry for a target that is not adopted this run: one named in --enable (it is built instead) or in --exclude.deps lists — a dep on an optional target orders the build only when that target is enabled; without pruning, the dependent target's deps could never all be done and it would sit in pending forever.These changes stay in memory until the first state write (per-wave step 5). --plan never writes them.
Subagent capability smoke-test (first wave only, skip on --resume and --plan): before dispatching the real wave, spawn one throwaway general-purpose Agent with this prompt:
"Examine your system-reminder messages — they enumerate the skills available in this conversation. Return exactly one line:
AVAILABLEif the list containsarckit:principles(or any otherarckit:*skill).NOT_AVAILABLEotherwise. Do NOT invoke any skill. Do NOT call any tool other than reading your own context."
This is a metadata check, not a skill invocation — it should complete in seconds. If the response is NOT_AVAILABLE, halt: subagents in this session do not have access to plugin skills (Failure mode #1). Suggest enabling the plugin at user-scope or running the harness from a session where claude --print '/skill list' shows the arckit:* family.
Compute work list: apply the staleness rules from § "Input-hash change detection". done = targets where status: complete AND every file in paths(t) exists AND every recorded input key is still expected, every expected key is recorded and every hash still matches AND no transitive dep is stale (steps 2–3 of the staleness rules). pending = enabled-targets − adopted − done. Stale targets have their state.targets[id].status rewritten to "stale" and re-enter the wave plan. With --skip-hash-check, skip the hash + cascade checks (step 1 only: every recorded file present).
If --plan: print the plan and exit without writing state. Print each wave with its targets and a line (skip|build|stale|stale-cascade) target ← deps per target; an (adopt) target ← path line per adopted target, listing every selected path; and an (exclude) target or (prune) target ← no existing artefact line per dropped optional target.
For each wave (sequential outer loop):
--no-commit.Post-build hooks: spawn parallel agents — one per recipe.post_build_hooks[] entry.
Final report:
/goal (Claude Code v2.1.139+)/goal keeps Claude working across turns until a completion condition is met, showing live elapsed / turns / tokens overhead. It composes naturally with this build harness when the user's intent stretches beyond a single recipe pass:
/goal every artefact under projects/001-*/ has Document Control Status: APPROVED and no Next Review Date in the past, then run /arckit:build 001 --recipe uk-saas --resume. The harness rebuilds stale targets; /goal keeps re-running it until the post-condition holds./goal no artefact under projects/001-*/ has been flagged by the stale-artifact-scan monitor, then /arckit:build 001 --refresh REQ (or whichever target the monitor flagged)./arckit:conformance violations and a green /arckit:health scan; /goal will sequence build → conformance → health → refresh-violator → build until clean.Caveats:
/goal is Claude Code only (not exposed in Codex / OpenCode / Gemini). Document the manual loop ("re-run /arckit:build --resume until state.json shows all targets complete") for non-Claude runtimes.session-learner, session-end-stamp) are observational and never block, so the cap should not interfere./goal per session; don't nest. The harness's own halt-on-fail still fires inside the goal loop.arckit:* skills — detected by the smoke-test in step 7 of the run order; halts the build before any wave dispatches. Workaround if smoke-test fails: load the skill prompt in main context once, pass as plain text to agent (deferred to v0.4+)."Recipe 'uae-federal-ai' not found. It ships in the arckit-uae community plugin. Install with: claude plugin install arckit-uae". The orchestrator maps recipe name to expected plugin via the built-in recipes table; recipes the table doesn't know about fall back to the generic precedence-list error.args field should be specific enough to skip interaction in the first place.(output.project, output.type, output.subfolder, multi_instance) tuples for non-multi-instance targets, and unique ids for multi-instance ones.test -f on every recorded path; an adopted file that is deleted or superseded is caught by the expected-key comparison. Edits are caught by the SHA-256 hash check (§ "Input-hash change detection") — the edited artefact's downstream targets are marked stale and rebuilt in dep order. Use --skip-hash-check to bypass.ADR-*) are expanded before cycle detection.arckit:* skill prompts in main context once and inline them in worker prompts when the smoke-test returns NOT_AVAILABLE. (File-hash change detection shipped in v0.4 — see § "Input-hash change detection".)extends: uk-saas); hash external inputs (e.g. external/policies/*.md) in addition to dep artefacts.--validate-only for GitHub Actions).arckit:artefact-worker subagent type; recipe "Expected output path" computed from skill metadata (single source of truth).MOmorluto/rea485k近 7 天新增 7,690 个 star
MOmorluto/rea485k近 7 天新增 7,690 个 star
MAmattpocock/skills336k近 7 天新增 4,217 个 star
MAmattpocock/skills336k近 7 天新增 4,217 个 star
MAmattpocock/skills336k近 7 天新增 4,217 个 star