patterns/csa-review/skills/csa-review/SKILL.md
Use when: running CSA-driven code review, independent model selection
npx skillsauth add ryderfreeman4logos/cli-sub-agent csa-reviewInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Check your initial prompt. If it contains the literal string "Use the csa-review skill", then:
YOU ARE THE REVIEW AGENT. Follow these rules:
git diff, reading files, and analyzing code yourself. Avoid spawning csa run/csa review/csa debate sub-agents unless the scope genuinely requires delegation (e.g., a 50K-line changeset that won't fit). Fractal recursion is allowed up to the configured ceiling (project.max_recursion_depth, default 5) and pipeline::load_and_validate enforces it, but a reviewer that nests more reviewers rarely adds value and complicates artifact attribution. When in doubt, read and analyze in-process.git add, git commit, git push, git merge, git rebase, git checkout, git reset, git stash, or any gh pr * mutation command. Review mode must not mutate repo or PR state.consistency_scope=touched-files, extend consistency checks to bounded full content for touched files as defined in Review Protocol. If it contains consistency_scope=diff-only or omits the parameter, keep consistency checks limited to the collected diff.Only if you are Claude Code and a human user typed /csa-review in the chat:
Run structured code reviews through CSA, ensuring:
~/.local/state/csa/, not ~/.codex/.scope: one of:
uncommitted (default)base:<branch> (e.g., base:main)commit:<sha>range:<from>...<to>files:<pathspec>mode (optional): review-only (default) or review-and-fixreview_mode (optional): standard (default) or red-teamsecurity_mode (optional): auto (default) | on | offconsistency_scope (optional): diff-only (default) | touched-filestool (optional): override review tool (default: auto-detect independent reviewer)context (optional): path to TODO.md or spec.toml to check implementation alignment against the planned designWhen operating under SA mode (e.g., dispatched by /sa or any autonomous workflow),
ALL csa invocations MUST include --sa-mode true. This includes csa run,
csa review, csa debate, and any other execution commands. Omitting --sa-mode
at root depth causes a hard error; passing false when the caller is in SA mode
breaks prompt-guard propagation.
The review tool is configured in ~/.config/cli-sub-agent/config.toml under [review]:
[review]
tool = "auto" # or "codex", "claude-code", "opencode"
Auto mode (default):
claude-code -> review with codexcodex -> review with claude-codeSince this skill is designed to be invoked from Claude Code, the default auto behavior selects codex as the review tool.
If the user explicitly passes tool, use that instead.
When the review scope covers main...HEAD (i.e., pre-PR review), the orchestrator MUST:
csa todo find --branch $(git branch --show-current) to find the plan for the current branch.spec.toml, pass it as context so the review agent can check explicit criteria; otherwise pass TODO.md when available.Why: Pre-PR reviews should align diff behavior with branch intent, but the branch may legitimately lack a stored TODO/spec artifact.
Exception: If the user explicitly provides context=<path>, skip auto-detection and use the provided path.
Construct a comprehensive review prompt that the review agent will execute autonomously. The prompt includes all review instructions so the agent is fully self-contained.
IMPORTANT: The review agent reads CLAUDE.md itself. Do NOT read CLAUDE.md in the orchestrator and pass its content. The agent needs to build its own project understanding.
The review prompt instructs the agent to: read project context (CLAUDE.md + AGENTS.md), collect the diff for the given scope, perform a three-pass review (discovery, evidence filtering, adversarial security), apply Spec Alignment when context is TODO.md or spec.toml, switch to adversarial hypothesis generation when review_mode=red-team, and generate structured outputs.
See: Review Protocol for the full agent instructions (scope commands, AGENTS.md compliance, three-pass review, non-negotiable rules).
See: Output Schema for the JSON findings schema and Markdown report template.
SID=$(csa run --sa-mode true --tier tier-3-complex --tool {review_tool} \
--description "code-review: {scope}" \
"{REVIEW_PROMPT}")
csa session wait --session "$SID"
Key behaviors:
~/.local/state/csa/ (not ~/.codex/).After CSA returns:
$CSA_SESSION_DIR/reviewer-{N}/review-report.md if generated.$CSA_SESSION_DIR/reviewer-{N}/review-findings.json summary (finding count by priority).If mode is review-and-fix, resume the same CSA session to fix all P0 and P1 issues, generate $CSA_SESSION_DIR/reviewer-{N}/fix-summary.md and $CSA_SESSION_DIR/reviewer-{N}/post-fix-review-findings.json, and mark any remaining P0/P1 as incomplete.
See: Fix Workflow for the full fix mode protocol and verification steps.
After fixes, optionally run:
just pre-commit
or trigger another review round to verify fixes.
| Command | Effect |
|---------|--------|
| /csa-review | Auto-selects codex, reviews uncommitted changes, security_mode=auto |
| /csa-review scope=base:main security_mode=on | Reviews all changes since main with mandatory security pass |
| /csa-review scope=uncommitted review_mode=red-team | Reviews adversarially, focusing on breakage paths and counterexamples |
| /csa-review scope=uncommitted mode=review-and-fix | Reviews, then fixes P0/P1 in the same session |
| /csa-review scope=uncommitted context=$(csa todo show -t <ts> --path) | Reviews and checks alignment against a TODO plan |
| /csa-review scope=uncommitted context=/abs/path/to/spec.toml | Reviews against explicit criteria from spec.toml |
| /csa-review tool=opencode scope=base:dev | Uses opencode instead of auto-detected tool |
When running in fix mode (--fix or mode=review-and-fix), the reviewer MUST attach explicit adjudication to each Critical and High severity finding using its stable fid.
Verdict options:
Accepted: finding is valid and a fix is required.Rejected: finding is a false positive or otherwise invalid.Deferred: finding needs more context or human decision.For each adjudicated finding, the reviewer MUST:
Accepted | Rejected | Deferred).AdjudicationRecord.Required output block format:
<!-- CSA:ADJUDICATION fid=<finding_id> verdict=accepted -->
Rationale: This unsafe block lacks a SAFETY comment and could cause UB.
<!-- CSA:ADJUDICATION:END -->
Notes:
verdict values in markers MUST be lowercase: accepted, rejected, deferred.When findings are contested, use the debate skill for adversarial arbitration. Findings must never be silently dismissed — every finding deserves independent evaluation.
Adjudication-specific escalation rule:
Accepted and reviewer B marks the same fid Rejected, that finding is automatically escalated and treated as Deferred until human review resolves it.See: Disagreement Escalation for the full dispute resolution protocol.
--fix (CLI)The csa review CLI has a built-in --fix flag that resumes the same session
to fix issues found during review. This is the recommended way to implement
the "reviewer fixes its own findings" pattern:
csa review --sa-mode true --branch main --fix --max-rounds 3
How it works:
HAS_ISSUES and --fix is enabled, the reviewer session
resumes with a fix prompt (same session, same context).--max-rounds (default: 3) or until gates pass.Key constraints:
--fix is not supported with --reviewers > 1 (multi-reviewer consensus).readonly_project_root to false (the fix must write).review_meta.json)After every csa review run, structured metadata is written to
{session_dir}/review_meta.json with the following fields:
{
"session_id": "01KM...",
"head_sha": "abc123def456",
"decision": "pass",
"verdict": "CLEAN",
"tool": "claude-code",
"scope": "range:main...HEAD",
"exit_code": 0,
"fix_attempted": true,
"fix_rounds": 1,
"timestamp": "2026-03-22T05:30:00Z"
}
This metadata enables downstream consumers (pr-bot, commit skill,
orchestration scripts) to programmatically query review results without
parsing free-form text output. The decision field uses the five-value
ReviewDecision enum: pass, fail, skip, uncertain, unavailable.
unavailable means the reviewer infrastructure failed across all configured
tier models (for example quota/auth/network), while uncertain means the
reviewer ran but could not reach a confident conclusion. Legacy four-state
reviewer output (CLEAN, HAS_ISSUES, SKIP, UNCERTAIN) still parses for
backward compatibility.
When --fix is enabled, the metadata is updated after each fix round with
the latest verdict, exit code, and cumulative fix round count.
| File | Purpose |
|------|---------|
| references/review-protocol.md | Full agent review instructions: project context, scope commands, AGENTS.md compliance, three-pass review, non-negotiable rules |
| references/output-schema.md | JSON findings schema (review-findings.json) and Markdown report template (review-report.md) |
| references/red-team-mode.md | Adversarial prompt fragment for review_mode=red-team |
| references/fix-workflow.md | Fix mode protocol (Step 5) and verification (Step 6) for review-and-fix mode |
| references/disagreement-escalation.md | Finding dispute resolution via debate skill with independent models |
~/.local/state/csa/ (verify with csa session list).~/.codex/.csa calls from the review agent are permitted up to project.max_recursion_depth (default 5; enforced by pipeline::load_and_validate), but are unusual for a read-only review. If the review agent delegates, session tree depth should remain shallow and each nested call must justify itself (e.g., scope genuinely too large for a single agent).$CSA_SESSION_DIR/reviewer-{N}/review-findings.json and $CSA_SESSION_DIR/reviewer-{N}/review-report.md were generated.review-findings.json includes a complete agents_md_checklist with no missing applicable rules.review-report.md includes AGENTS.md checklist section with all items checked.context was spec.toml, every criterion is either supported by evidence or surfaced as spec-deviation / unverified-criterion.review_mode=red-team, review-findings.json contains review_mode: "red-team" and keeps the standard finding schema.Critical/High finding includes one adjudication block with fid, verdict, and 1-2 sentence rationale.tools
--- name = "csa-setup" version = "0.1.0" description = "Install CSA, Weave, and coding workflow patterns for AI agent bots" homepage = "https://github.com/RyderFreeman4Logos/cli-sub-agent" target = "agent-bots" --- # CSA Setup > Installation guide for AI agent bots (openclaw, Moltis, etc.) to set up > CSA and Weave with optional coding workflow patterns. ## Skill Files | File | Description | |------|-------------| | **skill.md** (this file) | Installation and setup guide | | **skills/AGENTS.
testing
Use when: converting TODO plan or open GitHub issues into deterministic execution checklist
development
Use when: full dev cycle branch->plan->implement->review->PR->merge
development
Use when running a non-blocking CSA background code health scan that uses csa health and csa tokuin estimate to propose refactoring GitHub issues for files over token or complexity thresholds.