Experts¶
Experts wrap the agent loop with intake → triage → fix → verify → publish.
When should I use which expert?
See the Early Adopter Use Cases guide — each scenario explains why, the command, and the benefit.
bug-fix — CI failure auto-remediation¶
| When | CI failed (compiler, tests, coverage, lint) |
| Input | --log FILE or --run-id GITHUB_RUN_ID |
| Verify | --verify-cmd (should match CI) |
code-agent experts run bug-fix \
--log /tmp/ci.log \
--verify-cmd "pytest -q" \
--dry-run
code-agent experts run bug-fix \
--log /tmp/ci.log \
--verify-cmd "pytest -q" \
--publish
Parsers: TypeScript/tsc, ESLint, mypy, Rust, Go, pytest, coverage, Python tracebacks, generic.
Flow:
- Parse log → signals
- RCA — correlate with git diff + history
- Build fix task (RCA in MR body)
- Agent loop +
verify_cmd - Optional publish → branch
ci-fix/<run_id>-<fp>
| Output | Success | Skipped | Failed |
|---|---|---|---|
status | done | skipped | failed |
signal_count | ≥ 1 | 0 or duplicate | ≥ 1 |
mr_url | if --publish | prior MR if duplicate | — |
Artifacts: signals.json, rca.json, fix_request.json, trace.json, diff.patch
code-review — PR inline line comments¶
| When | First-pass review on a PR diff (nits, bugs, security smells) |
| Input | --pr N (required) |
| Output | One GitHub Review with inline comments (side=RIGHT) |
| Publish | Comment-only — does not open an MR |
code-agent experts run code-review --pr 42 -w .
code-agent experts run code-review --pr 42 --dry-run -w . # print findings, no API post
Findings: .code-agent/runs/<run_id>/review-findings.json. Lines not in the PR diff are skipped. Invalid JSON → exit 2 (fail closed).
test-intel — intelligent test selection¶
| When | Speed up PR CI — run only impacted tests |
| Input | Git diff vs main (no log required) |
Does not invoke the coding agent — produces a test plan only.
| Output | Description |
|---|---|
plan.verify_cmd | e.g. pytest -q tests/test_foo.py … |
plan.impacted_tests | Pytest node ids from diff |
plan.shards | Parallel shard groups |
| Artifact | .code-agent/runs/<run_id>/test_plan.json |
deploy-guard — continuous verification¶
| When | After deploy / canary — compare metrics to baseline |
| Input | --metrics-file FILE |
Metrics JSON:
| Decision | Meaning |
|---|---|
pass | No anomalies |
block | Anomaly; no rollback (default) |
rollback | Only with auto_rollback + --confirm-rollback |
sre-expert — incident response¶
| When | Alertmanager or generic webhook payload |
| Input | --log ALERT.json |
Formats: Alertmanager { "alerts": [...] } or generic { "kind": "incident", ... }.
MR branch prefix: sre-fix/…
monitoring-expert — observability audit¶
| When | Weekly audit or pre-release instrumentation check |
| Input | None (scans repo) |
Finds missing Prometheus/OTel metrics and invalid alert rules.
Shared expert flags¶
| Flag | Effect |
|---|---|
--dry-run | No publish; may still write locally |
--publish | Commit + draft MR |
--no-artifacts | Skip .code-agent/runs/ |
-w | Workspace root |
See Commands for the full flag list.