gate-remediation
Skill0 starsChanged 5 months agoMITView on GitHub
Use when a scheduled or operator-initiated workflow should resolve `REPAIR_PROVIDERS` against the discovered installed provider set or an explicit provider selection, normalize selected-provider quality/security findings into issue clusters, expand conservatively across one or more local repositories inside the allowed target boundary, drive repo-scoped remediation to PRs, and wait for fresh provider evidence before reporting the cluster repaired.
In this repository28 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- api-pentestSkill
- bitbucketSkill
- change-implementationSkill
- cloud-pentestSkill
- code-reviewSkill
- confluenceSkill
- delivery-metricsSkill
- deployment-verificationSkill
- fortifySkill
- github-issueSkill
- githubSkill
- github-workflowSkill
- gitlabSkill
- incident-responseSkill
- jenkinsSkill
- jiraSkill
- knowledge-captureSkill
- monitor-checkSkill
- network-pentestSkill
- obsidianSkill
- pentestSkill
- release-orchestrationSkill
- repo-understandingSkill
- security-fix-guideSkill
- sonarqubeSkill
- sprint-kickoffSkill
- using-orbitSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
62 rules. About 0 are common, 23 are distinctive, and 39 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈23
Distinctive · estimate
This author's own choices. Worth a look.
39
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
When an interactive run omits REPAIR_PROVIDERS or uses REPAIR_PROVIDERS=auto, and multiple providers are installed for the current run:
- Distinctive: line 17
treat provider-choice collection as a standalone input-only stage that outranks repo inspection, historical-run recovery, and …
- Distinctive: line 19
Do not use memories, prior reports, or old session transcripts to infer which providers are installed for the current run or what the …
- Very specific: line 20
before the provider-choice question is asked and answered, skip any generic memory lookup or repo-history quick pass that the host would …
- Distinctive: line 21
before the provider-choice question is asked and answered, limit local reads to the current installed sibling-skill tree, the direct user …
- Very specific: line 22
before the provider-choice question is asked and answered, Do not read report/, ~/.config/gate-remediation/reports/, …
- Distinctive: line 23
before the provider-choice question is asked and answered, Do not resume an old run, Do not validate repositories, inspect Git state, read …
- Distinctive: line 26
if local discovery requires reading installed skill files or other local metadata, do that discovery silently and ask the question …
- Very specific: line 27
keep the concrete discovered provider labels plus all visible in that first question, but do not freeze the wording to any one canned …
- Very specific: line 28
After the user answers all, resolve selectedProviders internally to the full discovered installed-provider set for the current run and …
- Very specific: line 75
If multiple targeting inputs are present, resolve them in this order: REPO_PATHS, then REPO_NAMES + ROOT_DIR, then ROOT_DIR.
- Distinctive: line 79
Ask for any missing required inputs in one plain-text message.
- Very specific: line 80
Prefer the smallest missing set that unblocks the current targeting route and provider-selection route.
- Very specific: line 81
Use normalized shared field names from ../using-orbit/references/common-input-contract.md whenever the input belongs to the shared …
- Distinctive: line 82
Avoid provider-specific aliases when the shared field name already expresses the same fact.
- Distinctive: line 92
Follow the packaged launchers for all external-system access.
- Distinctive: line 96
Keep repository-wide provider-resolution, write-confirmation, and stop-condition rules in the shared references instead of duplicating the …
- Very specific: line 100
Run packaged config get checks for the sibling CLIs needed by the active phase.
- Very specific: line 104
If config is missing and the user provides the values, run the matching config set yourself, rerun config get, then continue.
- Very specific: line 105
Do not ask the user to edit config files manually when the packaged CLI already supports config set.
- Very specific: line 114
Keep installed and configured as separate facts in both run state and operator guidance.
- Very specific: line 115
Do not redefine "user has this provider" to mean config get succeeds.
- Very specific: line 120
When REPAIR_PROVIDERS is omitted, resolve it exactly like REPAIR_PROVIDERS=auto.
- Very specific: line 126
If an explicitly selected provider is installed but config get fails, stop as WAIT_USER_CONFIG and guide the user through the matching …
- Very specific: line 127
If an explicitly selected provider is not installed, stop as BLOCKED and tell the user which provider skill must be installed.
- Very specific: line 128
If automation with omitted provider input or auto finds installed providers but none with successful config get, stop as WAIT_USER_CONFIG.
- Very specific: line 129
If omitted provider input or auto finds no supported provider skill installed at all, stop as BLOCKED instead of pretending the run has no …
- Very specific: line 134
When REPO_PATHS is present, validate those repositories directly and skip recursive ROOT_DIR discovery unless conservative …
- Very specific: line 135
When REPO_NAMES is present, resolve names only under ROOT_DIR and skip unrelated repositories.
- Very specific: line 136
When only ROOT_DIR is present, keep the current full-inventory discovery behavior.
- Very specific: line 138
Treat zero-hit or multi-hit REPO_NAMES resolution as MAPPING_AMBIGUOUS.
- Very specific: line 152
Do not drive provider selection from config.json.
- Distinctive: line 162
Use that root for candidate lists, per-repository state, reports, isolated worktrees, and routine non-provider local config persistence.
- Distinctive: line 190
keep the existing repo-local state machine where possible
- Very specific: line 191
keep legacy WAIT_MASTER_BUILD, WAIT_MASTER_SONAR, and MASTER_REGRESSED only for the SonarQube default-branch follow-up path
- Very specific: line 192
add WAIT_CLUSTER for repositories whose local patching work is finished but whose issue cluster is still waiting on other repositories or …
- Very specific: line 202
when a reopened cluster returns from selected-provider refresh to NEEDS_REPAIR, clear WAIT_CLUSTER and reactivate the required repo work …
- Distinctive: line 214
create or update one PR
- Distinctive: line 216
never widen repo scope or declare cluster completion
- Very specific: line 223
no foreign active lock owns codex/auto-gate-remediation
- Very specific: line 225
use MAX_CONCURRENT_REPOS as the worker batch ceiling
- Very specific: line 226
if SUBAGENT_MODE=off or worker dispatch is unavailable, process the repository inline with the same tracked branch, worktree, PR, and …
- Distinctive: line 231
Read findings only from the selected providers.
- Very specific: line 235
If a required dependent repository is unresolved or outside allowed scope, mark the cluster BLOCKED_DEPENDENT_SCOPE.
- Distinctive: line 240
If the branch exists and belongs to another active owner, skip the repository.
- Distinctive: line 247
Run local verification before every push.
- Distinctive: line 250
Follow repo-scoped verification and selected-provider evidence until the repository either converges, remains patchable, or stops.
- Distinctive: line 251
If the active repair attempt is still red or unclear, read the matching scoped issue or finding details from the selected providers before …
- Very specific: line 252
When the selected ci provider is github-workflow, tie remote verification to the known workflow run and use github-workflow build get plus …
- Very specific: line 256
When the tracked remediation PR becomes MERGED, switch from PR-scoped follow-up to parent-owned post-merge follow-up.
- Very specific: line 258
When selectedProviders includes sonarqube, use WAIT_MASTER_BUILD and WAIT_MASTER_SONAR only for the SonarQube default-branch follow-up …
- Very specific: line 259
When selectedProviders includes sonarqube and that existing path does not auto-start within the wait window and the job is triggerable, …
- Very specific: line 260
When sonarqube is outside selectedProviders, keep the repository in WAIT_CLUSTER while the parent tracks selected-provider refresh or other …
- Very specific: line 263
Keep the issue cluster WAIT_PROVIDER_REFRESH until every selected provider required for completion is fresh and clear for the current …
- Distinctive: line 276
If a selected-provider remediation PR was still safe to produce, report any remaining cross-repository or out-of-scope follow-up work as …
- Distinctive: line 306
every required repository in the cluster is complete
- Distinctive: line 307
no required dependent repository is unresolved
- Distinctive: line 308
every selected provider has fresh clear evidence for the current repair attempt
- Very specific: line 310
If selectedProviders=["sonarqube","fortify"], both providers must clear before the cluster is done.
- Very specific: line 311
If selectedProviders=["sonarqube"], Fortify may be reported as follow-up but must not block completion.
- Very specific: line 312
If selectedProviders=["fortify"], SonarQube may be reported as follow-up but must not block completion.
- Distinctive: line 335
Do not include preflight-passed boilerplate, local state file paths, reviewer-fallback internals, exact local verification command lists, …
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Gate Remediation
Use this skill for scheduled or operator-initiated remediation whose repair scope is resolved from REPAIR_PROVIDERS against the current discovered installed provider set or an explicit provider selection. The workflow should normalize findings from the selected providers, cluster them into issue-level repair scope, expand conservatively across one or more repositories when the issue clearly requires it, drive each repository through repo-scoped worktrees and PRs, and wait for fresh selected-provider evidence before considering the issue repaired.
Critical Interactive Prompt-Shape Override
When an interactive run omits REPAIR_PROVIDERS or uses REPAIR_PROVIDERS=auto, and multiple providers are installed for the current run:
- treat provider-choice collection as a standalone input-only stage that outranks repo inspection, historical-run recovery, and provider-specific preflight
- discover the installed-provider set silently first
- Do not use memories, prior reports, or old session transcripts to infer which providers are installed for the current run or what the provider-choice question should look like. Use only current live local discovery for this run.
- before the provider-choice question is asked and answered, skip any generic memory lookup or repo-history quick pass that the host would normally run for repo tasks; Do not read
MEMORY.mdor any other memory file for this stage - before the provider-choice question is asked and answered, limit local reads to the current installed sibling-skill tree, the direct user inputs already present in the conversation, and only the minimal current workspace metadata needed to enumerate installed providers
- before the provider-choice question is asked and answered, Do not read
report/,~/.config/gate-remediation/reports/,~/.config/gate-remediation/runs/,~/.config/gate-remediation/clusters/, priorstate.jsonfiles,~/.codex/memories/,~/.codex/sessions/, archived sessions, rollout summaries, or target repository source trees - before the provider-choice question is asked and answered, Do not resume an old run, Do not validate repositories, inspect Git state, read prior provider findings, or Do not call provider CLI or selected provider CLIs
- then make the very first user-visible assistant message the provider-choice question itself
- suppress any acknowledgement, progress update, commentary, or "I will inspect/check first" sentence that the base host environment would normally emit before exploring
- if local discovery requires reading installed skill files or other local metadata, do that discovery silently and ask the question immediately after discovery completes
- keep the concrete discovered provider labels plus
allvisible in that first question, but do not freeze the wording to any one canned sentence, fixed provider list, or fixed provider count - After the user answers
all, resolveselectedProvidersinternally to the full discovered installed-provider set for the current run and continue without asking the user to restate it asREPAIR_PROVIDERS=... - this prompt-shape override takes precedence over generic host progress-update habits for this specific input-collection step
Capability Dependencies
- One
repoprovider skill such asbitbucket,github, orgitlabfor remediation branches, PR reuse, and review-policy enhancements - SonarQube Skill when
sonarqubeis in the selected repair scope - Fortify Skill when
fortifyis in the selected repair scope - One
ciprovider such asjenkinsorgithub-workflowwhen remote verification or selected-provider post-merge follow-up is required
repo-understanding is a source-first local helper used during diagnosis and patching. Do not treat it as a sibling packaged CLI that requires config get preflight.
Inputs
| Variable | Required | Description | Example |
MODE | Yes | One of shadow or repair | repair |
REPAIR_PROVIDERS | No | One of auto, one installed provider name, or a comma-separated explicit provider list; when omitted, resolve it with the same installed-provider rules as auto. Interactive runs ask when multiple providers are installed, and automation runs select the installed-plus-configured subset | auto |
REPO_PATHS | Conditional | Comma-separated absolute local repository paths; highest-priority targeting input | /path/to/workspace/sample-org/sample-portal,/path/to/workspace/sample-org/sample-admin-web |
REPO_NAMES | Conditional | Comma-separated repository names resolved only under ROOT_DIR | sample-portal,sample-admin-web |
ROOT_DIR | Conditional | Discovery root for REPO_NAMES or full-inventory mode; optional containment check for REPO_PATHS | /path/to/workspace/sample-org |
DEFAULT_BRANCH_CANDIDATES | No | Override config.json default branch candidates | master,main,develop |
MAX_CONCURRENT_REPOS | No | Override config.json concurrency limit | 2 |
MAX_ITERATIONS_PER_REPO | No | Override config.json per-repository iteration cap | 3 |
MAX_RUNTIME_PER_REPO_MIN | No | Override config.json per-repository runtime cap | 120 |
SUBAGENT_MODE | No | One of off or auto; controls repair-worker dispatch for eligible repo work items | auto |
Normally provide:
- one repository-targeting route
- and optionally one provider-selection route
Repository-targeting routes:
REPO_PATHSREPO_NAMESplusROOT_DIRROOT_DIR
Provider-selection routes:
- omit
REPAIR_PROVIDERSand resolve it with the same rules asauto REPAIR_PROVIDERS=autoREPAIR_PROVIDERS=<installed-provider-name>REPAIR_PROVIDERS=<provider-a>,<provider-b>,...
REPO_PATHS may also be paired with ROOT_DIR when ROOT_DIR should act as the dependent-repository expansion boundary instead of only an exact-set containment check.
If multiple targeting inputs are present, resolve them in this order: REPO_PATHS, then REPO_NAMES + ROOT_DIR, then ROOT_DIR. Validate lower-priority scope constraints against the winning input and stop on conflicts.
Missing-input collection rules
Ask for any missing required inputs in one plain-text message.
Prefer the smallest missing set that unblocks the current targeting route and provider-selection route.
Use normalized shared field names from ../using-orbit/references/common-input-contract.md whenever the input belongs to the shared capability contract.
Avoid provider-specific aliases when the shared field name already expresses the same fact.
Before You Start
Read:
../using-orbit/references/safety-rules.mdreferences/usage.mdreferences/commands.md
Follow the packaged launchers for all external-system access. Do not call raw REST APIs.
The shared write confirmation protocol in ../using-orbit/references/safety-rules.md still applies by default. shadow mode remains repo/remote read/report only, but internal local-state persistence under ~/.config/gate-remediation/ remains allowed in both shadow and repair, including routine run-state writes and non-provider local config persistence in config.json. In repair mode, only the additional repo-local or remote writes listed under Allowed Automatic Writes may bypass the shared confirmation protocol. All other shared safety rules still apply.
Keep repository-wide provider-resolution, write-confirmation, and stop-condition rules in the shared references instead of duplicating the full protocol here.
Config Guidance
- Run packaged
config getchecks for the sibling CLIs needed by the active phase. - Discover sibling provider skills before any provider
config getchecks;installedandconfiguredare separate facts. - For an explicit
REPAIR_PROVIDERSlist, first verify every requested provider skill is installed, then runconfig getfor those requested providers. - For omitted provider input or
REPAIR_PROVIDERS=auto, first discover installed supported provider skills. In interactive runs, resolve the user's choice from that installed set before providerconfig getchecks for the chosen providers. In automation runs, runconfig getfor those installed supported provider skills first, then resolveselectedProvidersfrom the installed-plus-configured subset. - If config is missing and the user provides the values, run the matching
config setyourself, rerunconfig get, then continue. - Do not ask the user to edit config files manually when the packaged CLI already supports
config set. - One selected
repoprovider and one selectedqualityprovider are baseline-required for the normal repair path. jenkinsorgithub-workflowbecomes required when remote verification or post-merge follow-up is in scope and aciprovider is installed or selected.- Missing config for the current
security_scanprovider should degrade that inventory or follow-up route rather than block a safe quality-first remediation path by itself.
Installed Versus Configured Providers
- A provider counts as installed when its sibling skill is present and callable through the expected packaged launcher.
- A provider counts as configured only when the packaged
config getsucceeds. - Keep
installedandconfiguredas separate facts in both run state and operator guidance. - Do not redefine "user has this provider" to mean
config getsucceeds.
Provider Selection
- Explicit
REPAIR_PROVIDERSis the hard repair scope for the run. First verify every requested provider skill is installed, then runconfig getfor every requested provider. - When
REPAIR_PROVIDERSis omitted, resolve it exactly likeREPAIR_PROVIDERS=auto. Do not read or bootstrap provider-selection behavior from~/.config/gate-remediation/config.json, and ignore any legacyrepairProvidersDefaultfield if it is still present there. - In an interactive run with omitted provider input or
REPAIR_PROVIDERS=auto, first discover installed providers. Select the only installed provider automatically. When multiple providers are installed, ask the user to choose one provider from the discovered installed-provider list for the current run, or choose the menu labelall. - Build that interactive question from the actual discovered installed-provider set for the current run. Phrase it naturally for the current conversation language instead of reusing one fixed sentence template, but inline the discovered option labels in the question itself and ask the user to reply with exactly one provider name or
all. Do not hardcode provider names into the question text, do not hardcode provider counts such as "two providers", and do not ask the user to reply with a literalREPAIR_PROVIDERS=...assignment in that first choice prompt. - In that interactive menu,
allresolves internally to the full discovered installed-provider set for the current run; it is not a literal acceptedREPAIR_PROVIDERSvalue, and the user must not be asked to restateallas a comma-separated assignment before continuation. - In a Chinese interactive run, do not pin the first question to one canned wording. Generate the wording from the actual discovered installed-provider set for that run, keep the concrete provider labels and
allvisible in the question, and still require exactly one provider name orall. - In an automation run with omitted provider input or
REPAIR_PROVIDERS=auto, do not ask the user. First discover installed supported provider skills, then runconfig getfor those installed supported provider skills, and finally resolveselectedProvidersfrom the installed-plus-configured subset. - If an explicitly selected provider is installed but
config getfails, stop asWAIT_USER_CONFIGand guide the user through the matchingconfig setinstead of silently narrowing scope. - If an explicitly selected provider is not installed, stop as
BLOCKEDand tell the user which provider skill must be installed. - If automation with omitted provider input or
autofinds installed providers but none with successfulconfig get, stop asWAIT_USER_CONFIG. - If omitted provider input or
autofinds no supported provider skill installed at all, stop asBLOCKEDinstead of pretending the run has no repair scope. - Persist the resolved run snapshot as
selectedProviders; do not mutate it mid-run.
Repository Targeting
- When
REPO_PATHSis present, validate those repositories directly and skip recursiveROOT_DIRdiscovery unless conservative dependent-repository expansion later requires an allowedROOT_DIRboundary. - When
REPO_NAMESis present, resolve names only underROOT_DIRand skip unrelated repositories. - When only
ROOT_DIRis present, keep the current full-inventory discovery behavior. - In targeted modes, continue only tracked repositories inside the explicit target set unless issue-cluster expansion is required and still inside the allowed boundary.
- Treat zero-hit or multi-hit
REPO_NAMESresolution asMAPPING_AMBIGUOUS.
Local Defaults
Persist routine defaults in ~/.config/gate-remediation/config.json.
Recommended defaults:
defaultBranchCandidates=["master","main","develop"]maxConcurrentRepos=2maxIterationsPerRepo=3maxRuntimePerRepoMin=120subagentMode="auto"
Do not drive provider selection from config.json. If an older local config file still contains repairProvidersDefault, ignore that legacy field or remove it during routine local cleanup; omitted REPAIR_PROVIDERS now follows the same rules as auto.
Local Persistence
Persist local state under:
~/.config/gate-remediation/Use that root for candidate lists, per-repository state, reports, isolated worktrees, and routine non-provider local config persistence.
Hourly Run Order
- For an interactive run where
REPAIR_PROVIDERSis omitted orautoand multiple providers are installed, silently discover installed providers first and ask the provider-choice question from the discovered installed-provider list plusallas the first user-visible question; before that choice is answered, do not load tracked state, resolve the active target set, or run provider-specific preflight. - Load tracked repository state from
~/.config/gate-remediation/repos/. - Resolve the active target set from
REPO_PATHS,REPO_NAMES + ROOT_DIR, orROOT_DIR. - Resolve the provider-selection route for the run: if
REPAIR_PROVIDERSis omitted, treat it exactly likeauto; continue from the already collected provider choice when step 1 applied; otherwise discover installed providers, ask from the discovered installed-provider list plusallwhen interactiveautohas multiple installed providers, resolve the user's choice first, run providerconfig getonly for the providers required by that path, and persist the resolvedselectedProvidersset for the run. - Refresh findings only from the selected providers.
- Normalize those findings into
findingrecords and cluster them into issue-level repair scope. - Expand to additional repositories only when the cluster clearly requires them and the target boundary allows it.
- Enqueue or continue one
repo_work_itemper required repository.
Cluster states
DISCOVEREDNEEDS_REPAIRPATCHINGWAIT_USER_CONFIGWAIT_USER_MERGEWAIT_PROVIDER_REFRESHBLOCKED_DEPENDENT_SCOPEBLOCKEDEXHAUSTEDDONE
Repo work item states and parent-managed waits
- keep the existing repo-local state machine where possible
- keep legacy
WAIT_MASTER_BUILD,WAIT_MASTER_SONAR, andMASTER_REGRESSEDonly for the SonarQube default-branch follow-up path - add
WAIT_CLUSTERfor repositories whose local patching work is finished but whose issue cluster is still waiting on other repositories or selected providers; this is a parent-managed per-repository waiting state, and the matching repo work item is inactive until the parent clearsWAIT_CLUSTER
Parent responsibilities
- resolve
REPAIR_PROVIDERS - record
installedProviders,providerConfigStatus, andselectedProviders - normalize provider findings into
findingrecords - cluster findings into issue-level repair scope
- decide dependent-repo expansion conservatively
- persist cluster state and repo work items
- when a reopened cluster returns from selected-provider refresh to
NEEDS_REPAIR, clearWAIT_CLUSTERand reactivate the required repo work items for the next repair cycle - decide cluster completion and blocking
- produce the final operator summary
Worker responsibilities
- own one repository only
- execute one
repo_work_itemfor one cluster - reuse the tracked worktree and branch
- diagnose repo-local blockers
- apply patches
- run local verification
- create or update one PR
- return repo-local facts to the parent
- never widen repo scope or declare cluster completion
Worker eligibility rules
MODE=repair- the repository is inside the active target set
- the repository is required by an active issue cluster that is in
NEEDS_REPAIRorPATCHING - no foreign active lock owns
codex/auto-gate-remediation - the repository is not already in a parent-managed waiting state such as
WAIT_CLUSTER - use
MAX_CONCURRENT_REPOSas the worker batch ceiling - if
SUBAGENT_MODE=offor worker dispatch is unavailable, process the repository inline with the same tracked branch, worktree, PR, and verification semantics
Phase 1: Inventory
- Resolve the provider-selection route for the run: if
REPAIR_PROVIDERSis omitted, treat it exactly likeauto; then discover installed providers, ask from the discovered installed-provider list plusallwhen interactiveautohas multiple installed providers, resolve the user's choice first, run providerconfig getonly for the providers required by that path, and persist the resolvedselectedProvidersset for the run under the provider-selection rules above. - Read findings only from the selected providers.
- Normalize those findings into provider-agnostic
findingrecords. - Cluster conservative matches into issue-level repair scope.
- Expand to additional repositories only when the cluster clearly requires them and the target boundary allows it.
- If a required dependent repository is unresolved or outside allowed scope, mark the cluster
BLOCKED_DEPENDENT_SCOPE.
Phase 2: Repair To PR
- Fetch the remote state for
codex/auto-gate-remediation. - If the branch exists and belongs to another active owner, skip the repository.
- Reuse the existing remediation branch and PR when they already exist.
- In
SUBAGENT_MODE=auto, dispatch eligible repositories in batches up toMAX_CONCURRENT_REPOS; if worker dispatch is unavailable, continue inline instead of stopping for orchestration reasons alone. - Inside the active repair worker or inline fallback path, when the original evidence is too broad, cross-cutting, or failed to converge on the first pass, refresh or reuse the
repo-understandingcache and use its local search or explain helpers to narrow likely edit targets before the next patch cycle. If it does not improve focus, fall back to the normal remediation flow without blocking on it. - Diagnose repo-local failures by root cause.
- Attempt one small repo-local baseline-enabling repair first when the default branch baseline is red but still fixable in-repo.
- Apply a small patch set for the selected-provider findings that are clearly repairable in this repository for the active issue cluster, including cheap repo-local Fortify findings when they are in scope.
- Run local verification before every push.
- Before creating a new remediation PR, compute selected repo-provider reviewer enhancements when available. For Bitbucket, call
bitbucket repo required-reviewersand pass the resulting reviewers intobitbucket pr create --reviewers; for GitHub, use the equivalent repository review-policy enhancement when the selected provider exposes one; for GitLab, continue with plaingitlab pr create/gitlab pr updateand record degraded reviewer behavior. - Push the remediation branch and create or update one PR.
- Follow repo-scoped verification and selected-provider evidence until the repository either converges, remains patchable, or stops.
- If the active repair attempt is still red or unclear, read the matching scoped issue or finding details from the selected providers before choosing the next patch or stop reason.
- When the selected
ciprovider isgithub-workflow, tie remote verification to the known workflow run and usegithub-workflow build getplusgithub-workflow build consolefor follow-up instead of assuming Jenkins-only paths.
Phase 3: Post-merge Follow-up
- When the tracked remediation PR becomes
MERGED, switch from PR-scoped follow-up to parent-owned post-merge follow-up. - Record
mergedAtand the merged revision from the tracked PR metadata asexpectedDefaultRevision. WhenselectedProvidersincludessonarqube, fetchorigin/<default-branch>only to confirm when the default branch has reached that same merged revision; do not rebind follow-up to newer unrelated head commits. - When
selectedProvidersincludessonarqube, useWAIT_MASTER_BUILDandWAIT_MASTER_SONARonly for the SonarQube default-branch follow-up subpath while waiting for the existing default-branch Jenkins path or GitHub Workflow path and the fresh default-branch SonarQube analysis. - When
selectedProvidersincludessonarqubeand that existing path does not auto-start within the wait window and the job is triggerable, trigger that existing CI path manually through the selected provider. - When
sonarqubeis outsideselectedProviders, keep the repository inWAIT_CLUSTERwhile the parent tracks selected-provider refresh or other cluster-level follow-up instead of forcingWAIT_MASTER_BUILDorWAIT_MASTER_SONAR.WAIT_CLUSTERremains parent-managed until the cluster is either cleared or reopened. - In dual-provider or multi-provider runs, once the SonarQube default-branch subpath is fresh and clear, if any other selected provider still needs refresh or is still pending, move the repository into
WAIT_CLUSTERwhile the parent keeps the cluster inWAIT_PROVIDER_REFRESH. - Poll the selected providers until fresh post-change evidence is available for the recorded post-merge evidence target for this repair attempt, such as the merged revision or another provider-specific patched target.
- Keep the issue cluster
WAIT_PROVIDER_REFRESHuntil every selected provider required for completion is fresh and clear for the current repair attempt. - If fresh selected-provider evidence still shows the issue unresolved, return the cluster to
NEEDS_REPAIR. Use legacy repo stateMASTER_REGRESSEDonly for the SonarQube default-branch regression path; if SonarQube is already fresh and clear but another selected provider later returns fresh unresolved evidence for the recorded post-merge evidence target, keep or move the repository inWAIT_CLUSTERuntil the parent clears that waiting state and re-enqueues or reactivates the required repo work items so they become repairable again on the next cycle. Reopen another repair cycle only when no active remediation PR already exists and the same recorded post-merge evidence target plusfailureFingerprintpair is still new. Once a reopen attempt for that pair is recorded in cluster or per-repository state, treat it as already handled and suppress duplicate reopen.
WAIT_PROVIDER_REFRESH means the code-side change is already in place for the current repair attempt, but at least one selected provider has not yet produced fresh post-change evidence tied conservatively to that repair attempt.
Phase 4: Stop Reporting
- State the stop classification and the concrete blocker facts.
- Explain why that blocker prevents a safe remediation continuation in the current run.
- Give the user a short
next actionslist. - Say whether rerun is useful immediately or only after the listed actions are completed.
- Persist that operator guidance in the local report and per-repository state.
- Make the user-visible stop guidance concise Chinese by default.
- If a selected-provider remediation PR was still safe to produce, report any remaining cross-repository or out-of-scope follow-up work as follow-up guidance instead of a hard stop reason.
- When the blocker is
BLOCKEDbecause of missing provider installation, distinguish the cases explicitly: name the missing provider skill when selection came from an explicit provider list; otherwise, if the run used omitted provider input orauto, tell the user that no supported provider skill is installed and that at least one provider skill must be installed before rerun.
Allowed Automatic Writes
Internal local-state persistence under ~/.config/gate-remediation/ is allowed in both shadow and repair, including routine config.json updates for non-provider defaults plus normal run-state and report persistence.
In repair mode only, these additional repo-local or remote writes may bypass the shared confirmation protocol:
- local code edits
- local test edits
- local build or scanner configuration edits
- remediation branch creation or reuse
- commits on
codex/auto-gate-remediation - PR create and PR update
- manual trigger of the existing default-branch Jenkins job or GitHub Actions workflow only when the run is already in the SonarQube default-branch post-merge follow-up path, the documented wait window expires, and the path is triggerable
Forbidden Automatic Writes
- merge to the default branch
- tracker writes
- docs writes
- SonarQube server-side gate or profile changes
- Fortify suppression or waiver actions
- review comments or approvals that impersonate a human reviewer
Completion
An issue cluster is DONE only when:
selectedProvidersis fixed for the run- every required repository in the cluster is complete
- no required dependent repository is unresolved
- every selected provider has fresh clear evidence for the current repair attempt
If selectedProviders=["sonarqube","fortify"], both providers must clear before the cluster is done.
If selectedProviders=["sonarqube"], Fortify may be reported as follow-up but must not block completion.
If selectedProviders=["fortify"], SonarQube may be reported as follow-up but must not block completion.
Final Run Report
The terminal final answer is an operator handoff, not a replay log.
Report priority:
- current issue cluster state
- whether the user must do anything now
- 1-3 key facts that justify the current state
- what the automation will do next
Report rules:
- In a single-repository run, use at most four short Chinese lines or bullets for that issue cluster in this order:
<cluster>: <state>or<repo>: <state>when one cluster maps cleanly to one repository现在要做:...or现在不用做:...关键事实:...下一步:...
- In a multi-repository run, start with one Chinese dashboard line that gives counts for
need user action,automation continues, andblocked, then list only issue clusters that need user action or are blocked. Collapse normal tracked clusters into counts unless the user explicitly asked for full inventory. - Mention out-of-scope provider follow-up only when it creates a separate actionable follow-up. Do not repeat advisory follow-up counts in every green-PR or wait-for-merge case.
- Mention the concrete blocker reason only when the run stopped or the repository needs manual takeover.
- Do not include preflight-passed boilerplate, local state file paths, reviewer-fallback internals, exact local verification command lists, or root-cause file paths unless they change the current operator decision.
- Persist full detail under
~/.config/gate-remediation/; keep the terminal final answer short.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

