Agent Guide

ci-assess and ci-pipeline-audit measure a pipeline against the profile its

Agent guide: propose, review and adopt a constraint

Prompt-first procedure: Describe the outcome you want in your agent conversation. The agent should select and load the appropriate AIWG assets, explain material changes, request any needed approval, and report verification evidence. Exact commands and flags appear only in the CLI reference.

`ci-assess` and `ci-pipeline-audit` measure a pipeline against the profile its environment selects. `ci-architect` may propose a new constraint from an established pattern. A proposal is a draft. It becomes part of a profile only after the operator approves that exact change. `ci-doctor` consults recovery constraints when main is red and does not apply them on its own.

The contracts and the shipped `aiwg:cicd-complete/enterprise-cost` profile are described in constraint profiles.

Assess and audit

Use `assessConstraintProfile` and `renderAssessmentReport` in `$AIWG_ROOT/agentic/code/frameworks/cicd-complete/validators/profile-assessment.mjs`. Pass the pipeline, its environments, phase `audit-time`, rendered workflow text and the provider target. The result has one row per selected constraint:

FieldMeaning
enforcementEffective `off`, `advisory` or `blocking` after profile and overrides
status`met`, `violated`, `not-expressible` or `off`
evidenceFile and line for the subject, or the inspected workflow
fixValidator message, or why the provider cannot express the field

`off` is not evaluated. `not-expressible` is not a pass. GitHub Actions cannot express scheduler weights (`capacity.spot-first`, `capacity.pack-for-consolidation`). Gitea cannot express those weights or native runner scaling (`capacity.scale-to-zero`, `capacity.pool-caps`). GitLab has no installed workflow renderer, so the profile is not expressible there. Do not invent output.

`auditFindings` turns `blocking` violations into findings and `advisory` violations into recommendations. Each item names the constraint id and the fix. Write both into `ci-assessment-report-template`.

Where redacted run history is already on hand, pass runner-minutes per pull request, runner-minutes per main batch, the share of on-demand capacity, idle-runner time, queue wait and the normalized backpressure export. Missing fields stay unavailable. Do not invent zeros and do not call a billing API.

Propose

`ci-architect` starts from the selected profile. To extend it, call `proposeConstraint` in `$AIWG_ROOT/agentic/code/frameworks/cicd-complete/validators/constraint-proposals.mjs` with one of:

  • `concurrency-group-hygiene`
  • `cache-keys`
  • `artifact-retention`
  • `matrix-pruning`
  • `path-based-job-selection`
  • `flaky-test-quarantine`

The returned draft has:

  • `source`: the practice the proposal rests on
  • `rationale` and `tradeoff`
  • `params`: a draft-07 schema, plus `defaults` that satisfy it
  • `check`: phase, validator and, for `json-schema`, target and assertion
  • `definition`: a `ConstraintDefinition` document

Write that draft under the artifact root from the agent-owned artifacts operation. Validate `definition` against `$AIWG_ROOT/agentic/code/frameworks/cicd-complete/schemas/constraint-definition.schema.json` before asking the operator to review it. A schema-valid draft is not adopted.

Review

Show the operator the pattern, source, rationale, trade-off, params and check. Ask with the provider's native question tool. One question, two options:

  • Adopt this constraint into the operator profile
  • Keep the proposal as a draft

Record the answer only from that tool:

{
  "tool": "question",
  "questionId": "adopt-hygiene.concurrency-groups",
  "decision": "approve",
  "answer": "Adopt this constraint into the operator profile",
  "constraintId": "hygiene.concurrency-groups",
  "profile": "example:operator-cost"
}

`decision` is `approve` only when the operator selects Adopt. Keep as draft, a dismissed question, or a missing answer is not approval. Do not synthesize `confirmed: true`. A design preview, an assessment finding or this guide does not approve adoption.

Adopt

Call `commitProfileAdoption` with the operator directory, a profile document whose `metadata.name` matches the approval, the proposal, the approval record and `shippedRoot` set to the cicd-complete framework root. The helper writes the definition and the updated profile only under that operator directory.

The shipped tree is read-only. The helper refuses a destination inside `$AIWG_ROOT/agentic/code/frameworks/cicd-complete`, including `profiles/enterprise-cost.json` and `constraints/`. It also refuses when the approval record is missing, names a different constraint or profile, or carries a synthesized confirmation. The agent never edits a shipped profile on its own.

Give the operator profile a distinct `metadata.name`. Choose `advisory` or `blocking` explicitly. `advisory` warns; `blocking` refuses projection when the check fails. Installing the operator directory as a WorkflowExtension with `constraints: auto-discover` and `profiles: auto-discover` makes the existing registry load it. Select it from `CIEnvironment` the same way as any other profile.

Red main

When the pipeline is red, `ci-doctor` calls `redMainRecoverySuggestions`. For `recovery.main-green-gate` it suggests the profile's fix label (`fixes-main` unless overridden). For `recovery.fix-forward` it suggests a small fix-forward change, or a cleaner revert with an owned issue. Suggestions do not edit workflows, labels or branches. Applying one still needs its own authorization.