/ciagent:onboardfrom ciagent
Set up CIAgent regression testing for the AI agent in this repo — write an adapter, record golden baselines, generate a test spec, and verify it. Use when the user asks to add tests, evals, or regression testing for their AI agent, or to set up CIAgent.
Ships in ciagent. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are setting up CIAgent (pip install ciagent) so this repo's AI agent has
recorded golden baselines and a runnable regression suite. The end state: the
user can run ciagent test --runs 3 and see a stability report for their agent.
Work through the steps in order. Do not skip the cost gate in step 4.
openai, anthropic, langgraph,
langchain) and for the function or endpoint that takes a user message and
returns the agent's answer.pip install "ciagent[openai]", [anthropic], [langgraph], or [all].ciagent --version then ciagent doctor (it reports what is
missing; a missing spec is expected at this point).ciagent --version prints a different version, the plugin and the CLI are
out of sync and the commands taught here may not match the installed CLI.
Stop and tell the user to update the plugin
(/plugin marketplace update ciagent, then /plugin update ciagent@ciagent)
and/or the CLI (pip install -U ciagent) before continuing.Create ciagent_adapter.py at the repo root (or inside the package if the repo
has one clear package):
def run_for_ciagent(query: str) -> str:
"""CIAgent entry point: one query in, final answer text out."""
# import the user's agent and invoke it ONCE, no chat history
...
return final_answer_text
Rules:
python -c "from ciagent_adapter import run_for_ciagent; print(run_for_ciagent('hello'))".Write ciagent_queries.txt, one query per line — 8 to 15 queries:
Recording baselines runs the real agent once per query, on the user's API keys.
State the query count and a cost ballpark, and ask the user to confirm
before step 5. If there are no API keys or the user declines: write
ciagent_spec.yaml by hand instead (same queries, adapter: set), validate with
ciagent test --mock, and tell the user which step to resume later.
ciagent bootstrap --adapter ciagent_adapter:run_for_ciagent \
--queries ciagent_queries.txt --agent <agent-name> --yes
This runs every query, saves each trace as a golden baseline under
./baselines/<agent-name>/, and writes ciagent_spec.yaml with path and cost
budgets derived from the recorded traces. Read the printed answers as they
stream by — if an answer is visibly wrong, that query should not be golden:
fix the agent or the query, delete that baseline file, and rerun.
The generated spec has path and cost budgets but no correctness checks. Add a
correctness: block per query, derived from the recorded baseline answers and
the repo's docs/KB — never from what you wish the agent said:
correctness:
expected_in_answer: ["30 days"] # hard facts, AND
any_expected_in_answer: ["$9.95", "9.95"] # phrasing variants, OR
not_in_answer: ["I don't know"] # forbidden content
Check facts, not phrasing. If the repo has a knowledge-base directory, run
ciagent generate-checks --kb <dir> --dry-run and review its candidates —
every surviving candidate was already validated against the recorded goldens.
For agents with tools that can act (send, delete, pay), also consider safety
gates: forbidden_tools in the spec's path layer, and not_in_answer leak
checks. Runnable examples of failure modes worth gating (excessive agency,
transcript poisoning, tool-output injection) ship in the package as the Agent
Failure Atlas under ciagent/examples/failure-atlas/.
ciagent test --mock # structure check, zero API calls
ciagent test --yes --format json # live run (covered by step 4 approval)
ciagent test --runs 3 --yes # stability report
Exit codes: 0 = pass (flaky-but-passing is 0), 1 = correctness failure in every
run, 2 = infra/config error. In the stability report, flips labeled
agent-variance or retrieval-variance mean the agent system changed its
behavior (an agent problem); flips labeled judge-flake mean the eval itself
is unstable (a check/judge problem). To make only agent-caused flips fail the
run, add --flaky-sources=agent (an alias covering both agent-side sources);
that is the flag to put in CI, since it gates real regressions while
tolerating judge flake.
Failing live queries are auto-staged under .ciagent/staged/ (redacted at
capture) so a repro is never lost; they can later be verified and promoted to
permanent goldens with ciagent stage list / ciagent promote (see the
check skill). Mock failures never stage.
If a check fails, fix the agent or fix a factually wrong check. Do not loosen a correct check to make the run green — report the failure to the user instead.
ciagent init scaffolds a GitHub Actions workflow (add --hook for a
pre-push hook if the user wants it).ciagent_queries.txt, ciagent_spec.yaml, baselines/,
and the workflow.pip install "ciagent[mcp]" then ciagent mcp (stdio; live runs
are refused server-side without an explicit cost cap).ciagent test --runs 3 --flaky-sources=agent is the command to watch
after future agent changes.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
2 skills in this plugin
ciagent@claude-code-workflows is listed by codehornets/agents-claude-code — review the source before installing
npx claudepluginhub codehornets/agents-claude-code --plugin ciagent