Add a Maida Regression Gate
Turn an existing deterministic Maida trace into a reviewable baseline and pre-merge gate. Use the CLI scaffolder as the source of truth, then replace its placeholders with the repository's real offline agent command and baseline path.
Safety contract
- Keep runs and inspection local. Do not upload traces, invoke hosted models, expose credentials, or trigger GitHub Actions during setup.
- Do not commit, push, create or edit a pull request, or publish anything without explicit authorization. Adding workflow files locally is not authorization to activate them remotely.
- Never use
--force over existing policy or workflow files without explicit approval. Merge with existing CI and preserve unrelated user changes.
- Never create a baseline from an unreviewed, failing, live-provider, or nondeterministic run.
- Never weaken policy or update a baseline merely to make a failure pass. Intentional baseline changes belong in the explicit
maida accept --reason workflow after diagnosis.
Workflow
1. Inspect the repository and current evidence
- Read repository instructions,
git status, README, dependency and lock files, CI workflows, tests, agent entrypoint, and existing .maida files.
- Confirm Maida instrumentation encloses one complete agent invocation and identify a deterministic command that exercises it without network access or side effects.
- Confirm the existing package manager and the locally available
maida version. Read that version's maida init, baseline, assert, and policy help or docs before relying on flags.
- If there is no deterministic known-good run, stop and explain what test fixture or instrumentation is missing. Do not substitute
maida demo; the baseline must describe the target agent.
2. Present the change plan
Before mutation, state:
- the exact offline agent command and why it represents known-good behavior;
- the files
maida init --github may create and any existing files that require a merge;
- the proposed baseline path and meaningful policy checks;
- the targeted verification commands and isolated
MAIDA_DATA_DIR.
Call out that the generated workflow will not be run, committed, or pushed by this skill.
3. Scaffold safely
- Run
maida init --github from the repository root without --force.
- Inspect
.maida/policy.yaml and .github/workflows/maida.yml; do not assume creation means they are ready.
- Replace the workflow's placeholder
agent-script with the real repository command or script input supported by the pinned action. Point policy at .maida/policy.yaml and, after baseline creation, point baseline at its checked-in path.
- Preserve the generated pinned action reference. Do not silently substitute a floating branch, an older major, or hand-written GitHub API logic.
- Ensure workflow permissions remain least-privilege: repository contents read access and pull-request write access only when the action must post its report.
4. Capture and review the initial baseline
Use one temporary data directory for the agent command and all following Maida commands so the user's real ~/.maida state remains untouched:
- Run the deterministic known-good agent once.
- Run
maida list --json and inspect the latest run's name, status, event counts, tools, and absence of sensitive fixture values.
- Run
maida baseline --out .maida/baselines/<stable-agent-name>.json. Do not extract or pass a run ID; baseline selects the latest run.
- Inspect the baseline's structural signature: event counts, ordered tool calls, models, guardrail events, final status, and source run metadata.
- Show the baseline diff before proceeding. If the run is incomplete, surprising, or contains sensitive data, stop, remove it from the proposed changes, and fix the instrumentation or fixture first.
The baseline is behavioral evidence, not a golden output assertion. Do not hand-edit its generated structural fields.
5. Make policy intentional
Review the starter tolerances against the observed trace. Enable only checks supported by the repository's expected behavior. Prefer explicit pre-merge invariants such as:
no_loops: true when repeated behavior is never acceptable;
no_new_tools: true when the approved tool set is stable;
no_guardrails: true when guardrail activation means the run already degraded;
expect_status: ok for successful agent workflows;
- hard caps when the team can justify stable ceilings.
Explain every non-default tolerance or cap. Avoid zero-tolerance duration or token limits for nondeterministic production agents unless the project explicitly requires them.
6. Reproduce the gate locally
Under the same isolated data directory:
- Run the known-good agent again.
- Run
maida assert --baseline .maida/baselines/<stable-agent-name>.json without a run ID.
- Confirm exit code
0, the expected checks, and no unexpected ignored checks.
- Run repository tests or validation for the policy and workflow when available.
Do not invoke the GitHub workflow, push a test branch, or make a provider call for verification. If the local assertion fails, diagnose it rather than loosening policy reflexively.
7. Hand off for review
Show git diff and summarize the baseline signature, policy decisions, generated workflow input, exact commands and exit codes, risks, and files requiring manual review. Leave all files uncommitted unless the user separately requests a commit.
1---2name: maida-add-regression-gate3description: Add a reviewed Maida baseline, policy-as-code configuration, and GitHub Actions behavioral regression gate to an already instrumented agent repository. Use when asked to establish known-good agent behavior, configure maida assert, scaffold maida-ai/maida-assert, or add Maida pre-merge CI protection.4---56# Add a Maida Regression Gate78Turn an existing deterministic Maida trace into a reviewable baseline and pre-merge gate. Use the CLI scaffolder as the source of truth, then replace its placeholders with the repository's real offline agent command and baseline path.910## Safety contract1112- Keep runs and inspection local. Do not upload traces, invoke hosted models, expose credentials, or trigger GitHub Actions during setup.13- Do not commit, push, create or edit a pull request, or publish anything without explicit authorization. Adding workflow files locally is not authorization to activate them remotely.14- Never use `--force` over existing policy or workflow files without explicit approval. Merge with existing CI and preserve unrelated user changes.15- Never create a baseline from an unreviewed, failing, live-provider, or nondeterministic run.16- Never weaken policy or update a baseline merely to make a failure pass. Intentional baseline changes belong in the explicit `maida accept --reason` workflow after diagnosis.1718## Workflow1920### 1. Inspect the repository and current evidence2122- Read repository instructions, `git status`, README, dependency and lock files, CI workflows, tests, agent entrypoint, and existing `.maida` files.23- Confirm Maida instrumentation encloses one complete agent invocation and identify a deterministic command that exercises it without network access or side effects.24- Confirm the existing package manager and the locally available `maida` version. Read that version's `maida init`, `baseline`, `assert`, and policy help or docs before relying on flags.25- If there is no deterministic known-good run, stop and explain what test fixture or instrumentation is missing. Do not substitute `maida demo`; the baseline must describe the target agent.2627### 2. Present the change plan2829Before mutation, state:3031- the exact offline agent command and why it represents known-good behavior;32- the files `maida init --github` may create and any existing files that require a merge;33- the proposed baseline path and meaningful policy checks;34- the targeted verification commands and isolated `MAIDA_DATA_DIR`.3536Call out that the generated workflow will not be run, committed, or pushed by this skill.3738### 3. Scaffold safely3940- Run `maida init --github` from the repository root without `--force`.41- Inspect `.maida/policy.yaml` and `.github/workflows/maida.yml`; do not assume creation means they are ready.42- Replace the workflow's placeholder `agent-script` with the real repository command or script input supported by the pinned action. Point `policy` at `.maida/policy.yaml` and, after baseline creation, point `baseline` at its checked-in path.43- Preserve the generated pinned action reference. Do not silently substitute a floating branch, an older major, or hand-written GitHub API logic.44- Ensure workflow permissions remain least-privilege: repository contents read access and pull-request write access only when the action must post its report.4546### 4. Capture and review the initial baseline4748Use one temporary data directory for the agent command and all following Maida commands so the user's real `~/.maida` state remains untouched:49501. Run the deterministic known-good agent once.512. Run `maida list --json` and inspect the latest run's name, status, event counts, tools, and absence of sensitive fixture values.523. Run `maida baseline --out .maida/baselines/<stable-agent-name>.json`. Do not extract or pass a run ID; `baseline` selects the latest run.534. Inspect the baseline's structural signature: event counts, ordered tool calls, models, guardrail events, final status, and source run metadata.545. Show the baseline diff before proceeding. If the run is incomplete, surprising, or contains sensitive data, stop, remove it from the proposed changes, and fix the instrumentation or fixture first.5556The baseline is behavioral evidence, not a golden output assertion. Do not hand-edit its generated structural fields.5758### 5. Make policy intentional5960Review the starter tolerances against the observed trace. Enable only checks supported by the repository's expected behavior. Prefer explicit pre-merge invariants such as:6162- `no_loops: true` when repeated behavior is never acceptable;63- `no_new_tools: true` when the approved tool set is stable;64- `no_guardrails: true` when guardrail activation means the run already degraded;65- `expect_status: ok` for successful agent workflows;66- hard caps when the team can justify stable ceilings.6768Explain every non-default tolerance or cap. Avoid zero-tolerance duration or token limits for nondeterministic production agents unless the project explicitly requires them.6970### 6. Reproduce the gate locally7172Under the same isolated data directory:73741. Run the known-good agent again.752. Run `maida assert --baseline .maida/baselines/<stable-agent-name>.json` without a run ID.763. Confirm exit code `0`, the expected checks, and no unexpected ignored checks.774. Run repository tests or validation for the policy and workflow when available.7879Do not invoke the GitHub workflow, push a test branch, or make a provider call for verification. If the local assertion fails, diagnose it rather than loosening policy reflexively.8081### 7. Hand off for review8283Show `git diff` and summarize the baseline signature, policy decisions, generated workflow input, exact commands and exit codes, risks, and files requiring manual review. Leave all files uncommitted unless the user separately requests a commit.