Add setup contract

From brabos-ai/code-addiction · View interactive version

Add setup contract is an AI agent skill from the GitHub repository brabos-ai/code-addiction. Use when a state-materializing command starts — compare the receipt setup-shape to the shipped sidecar shape and route FIRST-RUN / CURRENT / STALE. Consumed by /add-qa-setup STEP add-qa-setup.classify-receipt and STEP add-qa-setup.receipt.

How to use this skill

Skill file

Setup Shape Comparison

<!-- uses:

-->

Overview

Procedure for comparing a project's materialized state with the shape the framework currently ships. It compares two hashes and routes. It never reads a changelog and never decides what to improve.

When to Use

When NOT to Use

Inputs

| Input | Source |

|---|---|

| RECEIPT_PATH | The command's section of .codeadd/settings.json — add-qa-setup → section qa |

| RECORDED | qa["setup-shape"] (sha256: + 16 hex) |

| CURRENT | contracts.<command>.shape in {{addpath:contracts.json}} |

| SIGNAL | SETUP_QA: / SETUP_QA_STALE: from status.cjs |

| FORCE_UPGRADE | --upgrade flag on the calling command |

Procedure

1. Classify the project state

Materialized state is present when any owner: setup path declared in the command's contract exists.

| Receipt | Materialized state | Classification | Action |

|---|---|---|---|

| absent | absent | FIRST-RUN | Materialize normally, then write the receipt at CURRENT |

| absent | present | STALE | Re-materialize under the merge rules. Do not treat as FIRST-RUN |

| present | any | Compare at step 2 | |

⛔ Never treat a project that already holds an owner: setup path as FIRST-RUN.

2. Compare

| Condition | Action |

|---|---|

| CURRENT unreadable (no sidecar) | Pre-contracts install. Skip the compare, report it, continue. Never guess a shape |

| RECORDED unreadable | STALE |

| RECORDED == CURRENT and not FORCE_UPGRADE | CURRENT. Go to step 3 (drift check), then step 4 |

| RECORDED != CURRENT or FORCE_UPGRADE | STALE. Re-materialize, then step 3, then step 4 |

3. Re-materialize (STALE and `--upgrade`) + drift check

Apply the calling command's merge rules. For add-qa-setup:

For every materialized entry with owner: setup that this run did not just regenerate:

| Result | Action |

|---|---|

| Hash match | Nothing to report |

| Hash mismatch | Report the drift; do not silently overwrite. Offer to regenerate, rewrite the recorded hash only after the user confirms which side wins |

| File missing | Report it as a gap; offer to re-materialize |

⛔ Entries with owner: shared carry hash: null and are checked for existence only.

4. Rewrite the receipt fields and `qa.log` — always

Rewrite the receipt on every run, including a verified-current no-op.

Schema and field vocabulary: {{skill:add--settings/SKILL.md}}.

Refusal Rules (hard)

| Situation | Response |

|---|---|

| .codeadd/settings.json is unparseable or the qa section holds no readable setup-shape | Treat as STALE. Do not invent a setup-shape |

| A merge item is ambiguous | Surface the item verbatim and ask. Do not improvise |

Rules

ALWAYS:

NEVER:

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.