Green

From shenxingy/Clade · View interactive version

Green is an AI agent skill from the GitHub repository shenxingy/Clade. Run the repository's real CI gates locally and drive them to green — read the failing step, fix the cause, re-run only that job, repeat. Use before pushing, after a red hosted run, or whenever \"make CI pass\" is the ask. Never weakens a gate to make it pass.

How to use this skill

Skill file

Clade for Codex

This workflow runs directly in Codex. Do not launch the claude CLI or

delegate the workflow to Clade's MCP bridge.

Codex compatibility rules:

$clade:green; a bare $name does not select the installed Clade plugin.

has only CLAUDE.md, treat it as legacy project guidance and read it too.

state). Existing legacy Claude state may be read for migration, but do not

create new vendor-specific state.

$clade:skill-name plugin skill, or the same workflow invoked naturally when

explicit skill invocation is not available.

workflow names a vendor-specific tool. If a capability is unavailable, use

the documented fallback instead of spawning another agent CLI.

containing this SKILL.md; resolve that root before invoking a helper.

Canonical Clade workflow

/green — take the build from red to green on hardware you already own

Hosted CI is billed per job, rounded up to the minute, and multiplied by

platform (Linux 1x, Windows 2x, macOS 10x). Pushing to find out whether a

change compiles is the most expensive possible way to ask that question, and

the slowest. This skill asks it locally.

<plugin-root>/skills/green/scripts/ci-local.py parses .github/workflows/*.yml and runs the same

run: blocks, so it cannot drift from CI the way a hand-maintained checklist

does — one such checklist in this toolkit was wrong twice.

The rule that outranks the goal

Never change a gate to make it pass. The goal is a correct build, not a

green one, and the difference is the whole value of the exercise. Specifically

forbidden unless the user asks for it in those words:

masks the exit code and turns red into green while changing nothing

once and then passed — that hides a flake instead of explaining it

If the honest fix is genuinely to change the gate — the test encoded the old

contract and the contract moved — say so explicitly, show the assertion and the

new intended behaviour, and let the user decide. A gate weakened quietly is

worse than a red build, because a red build is still telling the truth.

Loop

1. See the plan before running it

python3 <plugin-root>/skills/green/scripts/ci-local.py --list

If the answer is ci-local: no .github/workflows under <path>, this repository

has no hosted CI to mirror. Exit 1 there means nothing to run, not red —

say so, then fall back to the gates the project documents itself (its

AGENTS.md, AGENTS.md, or Makefile) and report which of those you ran.

Never report a build green on the strength of a runner that found no gates.

Read what will be skipped and why. A job needing a platform this machine is not

belongs on the machine that has it, not on a hosted runner at 2x or 10x; the

runner labels are compared case-insensitively, as GitHub does, so

[self-hosted, macOS] and an ARM64 label name a platform. A workflow

triggered by pull_request_target and by no push or pull_request, a workflow

whose push trigger filters on tags: alone (a tag tier, run on a head that

carries a tag), and a job whose if: is false on every push and pull_request

(a schedule or dispatch tier) genuinely do not run here; say so rather than

reporting a clean run that covered less than it looks.

A ↳ UNPROVEN line is different in kind: a lane the hosted run executes on

every push that this runner cannot reproduce — a job using services:,

container:, strategy:, a reusable workflow or a defaults: other than

run: shell: bash, or one whose body it cannot read; a runs-on: or job-level

if: it cannot evaluate; a step whose if: or ${{ }} expression it cannot

evaluate; a step that needs a repository secret — declared on the step,

inherited from job or workflow env, or used in run: — which never runs here,

because a tool run without it falls back to this machine's own credentials

(~/.aws, gh auth, ~/.npmrc); an action step other than checkout, cache,

artifact upload/download or a setup-* action, so a job whose only gates are a

lint action or a local composite is unproven, not setup-only. A step whose

INHERITED env holds a non-secret ${{ }} value (a workflow-level

REPO: ${{ github.repository }}) runs with that variable unset, and its pass is

unproven too. Those are usually the backend, E2E and migration lanes, the ones

that cover the surface a change most often breaks. Name them before you run

anything; they will not become green here.

2. Run

python3 <plugin-root>/skills/green/scripts/ci-local.py --json

Use --json: it gives the failing job, the step name, the exit code, the exact

command, and the output tail, which is what you need to fix without guessing.

Pass a job argument through as --job <name> when the user named one.

Read verdict first, not the exit code — during the report-only rollout a

partial, flaky or none run still exits 0 (--strict makes it 2):

unless asked.

unproven (job, step, reason) was proven here: it was skipped, or it ran

without env only the hosted run sets. Report PARTIAL with each unproven lane

and its reason, and say what would prove it — the hosted run, or a machine

with the services it needs. Never shorten PARTIAL to "green" or "CI will

pass".

entry in flaky (job, step, first_exit, first_output_tail) failed once

and passed on the one rerun ci-local gives every failed step. That first

failure is real and unexplained. Investigate it as in step 3b; never report

the rerun's pass as green or as a fix.

unproven say why. Report it as nothing proven, then fall back to the gates

the project documents itself, as in step 1.

without inherited env; if so, that may be the whole cause. A failed step was

already run twice (first_exit is the first attempt's code; exit_code and

output_tail are the rerun's), unless it hit the step timeout. After the fix,

a re-run can come back partial or flaky, which is still not green.

A partial run lists its flaky steps too, and a fail run can carry them

beside the failure: handle each of them as in step 3b as well.

3. Diagnose one failure at a time

For each entry in failed:

hypothesis. A truncated read is how a mid-stream counter gets mistaken for a

result — a tail -4 of a passing suite once read as "7 passed, 5 failed"

when the real answer was 187/187.

hand, the difference is the environment (CI=true, a clean checkout, a

missing build artefact, a stale deployed copy), and that difference is the

bug.

filenames and the change added an eighth" is a cause; "the test fails" is not.

3b. A FLAKY step: find the cause, do not count the pass

For each entry in flaky:

and it names the case that failed.

directory, and under load if the host was busy. A test that shares state,

depends on order, races a timer or a port, or reads the wall clock is the

usual cause; name the one you found.

with a retry, a sleep or a skip — and re-run that job.

first exit code and the first attempt's output. Do not run ci-local again

until it comes back green and call that green: a pass is what a flake does

most of the time.

4. Fix the cause, then re-run only that job

python3 <plugin-root>/skills/green/scripts/ci-local.py --job "<job name>" --json

Re-running one job keeps the loop short. Re-run the full set once at the

end, because a fix in one job can break another — that is the whole reason CI

runs everything.

5. Stop conditions

skipped and why, stop.

PARTIAL with the unproven lanes, stop. It is not a green result.

each flaky step with what step 3b found, stop. It is not a green result, and

a flake you could not explain is not fixed.

reason, stop. It is not a green result either.

hypotheses mean the model of the failure is wrong; a third guess is a loop,

not progress.

the user can run it.

a behaviour change) → stop and ask. Do not decide it by editing.

When the red run was on GitHub, not here

Pull the failure down rather than pushing again to watch it:

gh run list --status failure --limit 5          # find the run
gh run view <run-id> --log-failed | tail -60    # one run's failing step

For several failed runs at once, ~/.clade/scripts/scan-ci-failures.sh . 5

already collects each run's failing step with its log tail. Read its output

rather than re-implementing it — it emits ===TASK=== blocks, so take the

prose and ignore the framing.

Then reproduce it locally with --job and continue from step 3. Note that

GitHub expires logs; if they are gone, identify the failing commit and

reconstruct the cause from the diff — git show <sha> against the test that

broke is usually enough.

6. Before reporting green, look at what you touched

git diff --stat HEAD -- .github/workflows/ '*test*' '*conftest*' \
  ruff.toml pytest.ini setup.cfg tox.ini package.json

Every file listed is a gate. Name each one at the top of the report with its

reason, or undo it — an empty output here is the claim you are making when you

report green. An anti-cheat rule enforced only by the honesty of the agent it

constrains is the weakest form there is, and that agent is under pressure to

produce green.

Report

State plainly:

output names, and the cause, or that none was found

Never report "CI will pass" from a subset, and never from a PARTIAL or FLAKY

run or one where nothing ran. Report what ran.

Delivery completion

If this workflow changes files or external state:

repository task.

$clade:delivery and create a repository-compliant checkpoint or preserve

the work when committing is unavailable.

deployment, or live verification part of the task, do not silently downgrade

the result to local-only work.

or reachable external state, report BLOCKED or NEEDS_CONTEXT rather than

appending a "not committed/pushed/deployed" caveat after DONE.

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.