skills/csa/SKILL.md
Use when: executing tasks via csa run/review/debate, session mgmt
npx skillsauth add ryderfreeman4logos/cli-sub-agent csaInstall 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.
Unified CLI interface for executing coding tasks across multiple AI tools with persistent sessions, recursive agent spawning, and resource-aware scheduling.
| Tool | Compress | Yolo |
|------|----------|------|
| opencode | /compact | auto |
| codex | /compact | auto |
| claude-code | /compact | auto |
All tools run in yolo mode by default (auto-approve all actions).
Before constructing ANY csa run, csa review, or csa debate command, verify:
--sa-mode true|false — REQUIRED at root depth (CSA_DEPTH=0). Sub-agent calls (depth > 0) inherit automatically.--tier <name> — canonical selector whenever project [tiers] is non-empty.--tool <tool> — only a soft try-first preference inside the selected tier. [review].tool and [debate].tool behave the same way; ordered arrays are tried in listed order before remaining tier models, and they no longer hard-whitelist the tier.--model-spec, --force-ignore-tier-setting/--force-tier, and broad direct-routing force flags are emergency-only under configured tiers. They are rejected unless [tier_policy].allow_force_bypass = true is set in the global config, or CSA is continuing an already-trusted inherited #1741 subtree pin. Project .csa/config.toml cannot grant this.Priority chain: inherited trusted pin > --tier > config tier / tier mapping > soft tool preference > auto-select. Direct bypass is outside the normal chain and requires the global escape hatch.
# When tiers ARE configured (most CSA projects):
# Use tier names from your .csa/config.toml [tiers] section
csa run --sa-mode true --tier <tier-name> "Implement feature X"
csa review --sa-mode true --tier <tier-name> --tool codex --range main...HEAD
csa debate --sa-mode true --tier <tier-name> --tool claude-code "REST vs gRPC?"
# Emergency exact model only when global [tier_policy].allow_force_bypass=true
# or when continuing an inherited trusted subtree pin:
csa run --sa-mode true --force-ignore-tier-setting --model-spec codex/openai/gpt-5.4/xhigh "Emergency pinned run"
# When tiers are NOT configured (legacy / simple projects):
csa run --sa-mode true --tool codex "Implement feature X"
Prefer this form for general csa dispatch when tiers are configured:
csa run --sa-mode true \
--tier <tier-name> \
--timeout 7200 \
--prompt-file /path/to/prompt.md
Add --tool <tool> only when you want try-first ordering inside that tier:
csa run --sa-mode true \
--tier <tier-name> \
--tool codex \
--timeout 7200 \
--prompt-file /path/to/prompt.md
Why this is the canonical LLM-friendly form:
--tier preserves the configured quality/cost policy and fallback chain--tool is optional try-first ordering, not a brittle hard filter--timeout 7200 is the sprint-safe defaultDefault to tier-based routing. Use direct --model-spec only for the global
escape hatch or an inherited trusted subtree pin.
Full guide: references/prompt-crafting-guide.md (load on demand).
Quick checklist for every CSA dispatch prompt:
Three agentic anchors (add to every prompt for ~20% task completion improvement):
Key principles:
CSA session spawn has a fixed cold-start cost (~10K-60K tokens for rules/context ingestion). For small tasks, the cold-start cost can exceed the actual work cost by 10-20x.
Prefer native subagent (Agent tool) or direct execution when:
Use CSA when:
~/.local/state/csa/.csa again. Depth is tracked and limited.tool/provider/model/thinking_budget.When the task is specifically review or debate:
csa reviewcsa debatecsa review / csa debate with a hand-written csa run
prompt unless the built-in command is blocked by a concrete, documented error.csa session wait timeout is not evidence of
failure by itself.Execution commands (run, review, debate, batch, plan run, claude-sub-agent)
require --sa-mode true|false when invoked from the top level (root depth).
--sa-mode true: Enable autonomous safety — injects prompt-guard mechanisms--sa-mode false: Disable autonomous safety (interactive use)CSA-spawned children auto-detect via CSA_DEPTH + CSA_INTERNAL_INVOCATION env vars
(both set automatically by CSA when spawning sub-processes). Manual scripts that only
set CSA_DEPTH without CSA_INTERNAL_INVOCATION=1 will still get the root-caller error.
# Root caller MUST specify --sa-mode
csa run --sa-mode true "Implement feature X"
csa review --sa-mode true --range main...HEAD
csa debate --sa-mode true "REST vs gRPC?"
# Internal sub-agent call (depth > 0) accepts explicit --sa-mode; inherited mode is also supported
csa run --sa-mode true "Sub-task Y"
Error if omitted at root depth:
Error: --sa-mode true|false is required for root callers on execution commands: command `run`
csa init --non-interactive
# Creates .csa/config.toml with detected tools
# Analysis (read-only)
csa run --sa-mode false "Analyze the authentication flow"
# Implementation — tier-based (preferred when tiers configured)
csa run --sa-mode true --tier <tier-name> "Fix the login bug"
# Implementation — direct tool (only when NO tiers configured)
csa run --sa-mode true --tool codex "Fix the login bug"
# Resume existing session via fork
csa run --sa-mode true --tier <tier-name> --fork-from 01JK... "Continue the refactor"
# Ephemeral session (no project context, auto-cleanup)
csa run --sa-mode false --ephemeral "What is the CAP theorem?"
csa session list # List all sessions
csa session list --tree # Show tree hierarchy
csa session list --tool opencode # Filter by tool
csa session delete --session 01JK... # Delete a session
csa config show # Display current config
csa config edit # Open in $EDITOR
csa config validate # Validate config file
# Sub-agent inherits depth tracking via CSA_DEPTH env var
csa run --sa-mode true --tier <tier-name> --parent $CSA_SESSION_ID \
"Research PostgreSQL extensions"
Max recursion depth is configurable (default: 5).
Multiple analysis tasks can run in parallel safely:
# Sub-agent calls (depth > 0) — --sa-mode inherited from parent
csa run --sa-mode true --session research-db "Query database docs" &
csa run --sa-mode true --session research-ui "Query frontend docs" &
wait
Warning: Parallel writes are extremely risky!
Potential issues:
cargo build locks target/ directoryCargo.lock, package-lock.json, etc.Rules:
Recommended pattern:
# Step 1: Parallel research (read-only, sub-agent depth — --sa-mode inherited)
csa run --sa-mode true --session research-1 "Research A" &
csa run --sa-mode true --session research-2 "Research B" &
wait
# Step 2: Serial implementation (write)
csa run --sa-mode true --tier <tier-name> --session impl-1 "Implement A based on research"
csa run --sa-mode true --tier <tier-name> --session impl-2 "Implement B based on research"
If a tool is already running in a session, you'll see:
Tool 'opencode' is currently locked by another process (PID 12345)
Wait for the other process to finish, or use a different session.
If you see "Max recursion depth exceeded":
If you see "Insufficient system memory":
Each tool has a different context compression command:
opencode, codex, claude-code: /compactcsa session compress automatically selects the correct command.
CSA sets these env vars for child processes:
CSA_SESSION_ID: Current session ULIDCSA_DEPTH: Current recursion depthCSA_PROJECT_ROOT: Project root pathCSA_PARENT_SESSION: Parent session ULID (if spawned as sub-agent)Project config lives at .csa/config.toml. Key sections:
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.
data-ai
Recover main-agent context after `/clear`, `/compact`, or lost local thread state by using `csa recall` against recorded Claude main sessions.
tools
Use when: merged PR had HIGH/CRITICAL findings that represent a bug class — extracts reusable coding rule
tools
Use when: review found 2+ independent findings in different files, fix phase can parallelize RECON