# Usage Guide Hands-on walkthroughs for sage's core workflows. For command-by-command reference see [COMMANDS.md](COMMANDS.md); for moat-demonstration stories see [use-case-kill-switch.md](use-case-kill-switch.md) and [use-case-bench.md](use-case-bench.md). ## Table of contents - [Parallel multi-runtime security audit](#parallel-multi-runtime-security-audit) - [Headless CI mode](#headless-ci-mode) - [8 runtimes, one interface](#8-runtimes-one-interface) - [MCP + skills ecosystem](#mcp--skills-ecosystem) - [Agent guardrails](#agent-guardrails) - [Task templates](#task-templates) - [Plan orchestrator](#plan-orchestrator) - [Live monitoring](#live-monitoring) - [Task tracking](#task-tracking) - [Tracing](#tracing) --- ## Parallel multi-runtime security audit Run different AI agents on the same code simultaneously, each in an isolated git branch: ```bash sage create reviewer --worktree review-branch --runtime claude-code sage create auditor --worktree audit-branch --runtime kiro sage send --headless --json reviewer "Review cmd_send() for bugs" & sage send --headless --json auditor "Security audit cmd_send()" & wait # reviewer (Claude Code, 12s): 3 bugs — unsafe ls parsing, missing error handling # auditor (Kiro, 41s): 6 issues — path traversal, command injection, unsafe glob # Wall time: 41s (parallel), not 53s (sequential) ``` ## Headless CI mode No tmux, no terminal, structured JSON out: ```bash sage send --headless --json reviewer "Is this safe? eval(\$user_input)" ``` ```json { "status": "done", "task_id": "headless-1775793946", "exit_code": 0, "elapsed": 34, "output": "UNSAFE. eval \"$user_input\" is a critical command injection vulnerability..." } ``` GitHub Action: ```yaml - uses: youwangd/SageCLI@main with: runtime: claude-code task: "Review this PR for security issues" ``` ## 8 runtimes, one interface ```bash sage create a1 --runtime claude-code # Anthropic Claude (Bedrock) sage create a2 --runtime gemini-cli # Google Gemini sage create a3 --runtime codex # OpenAI Codex sage create a4 --runtime cline # Cline sage create a5 --runtime kiro # Kiro (Bedrock) sage create a6 --runtime ollama --model llama3.2:3b # local sage create a7 --runtime llama-cpp # local GGUF sage create a8 --runtime bash # custom shell handler # Identical JSON output regardless of runtime: sage send --headless --json a1 "Review this code" sage send --headless --json a6 "Review this code" ``` ## MCP + skills ecosystem ```bash sage mcp add github --command "npx" --args "@modelcontextprotocol/server-github" sage create dev --runtime claude-code --mcp github sage skill install https://github.com/user/code-review-skill sage create reviewer --runtime claude-code --skill code-review-pro sage send reviewer "Review PR #42" ``` ## Agent guardrails ```bash sage create worker --runtime claude-code --timeout 30m # auto-kill after 30m sage create worker --runtime claude-code --max-turns 50 # stop after 50 tasks sage env set worker API_KEY=sk-xxx sage env set worker DATABASE_URL=postgres://... ``` ## Task templates Predefined templates with checklists and structured output: ```bash sage task --list # review (auto) Code review with prioritized findings # test (auto) Generate comprehensive test suite # spec (auto) Write technical specification # implement (auto) Implement a feature from spec # refactor (auto) Refactor code while preserving behavior # document (auto) Generate documentation # debug (auto) Debug and fix a reported issue sage task review src/auth.py src/middleware.py sage task test src/api/ --message "Focus on edge cases" sage task refactor src/legacy.py --timeout 180 sage task debug --message "Users report 500 on /login after upgrade" ``` Templates live in `~/.sage/tasks/` as markdown files with YAML frontmatter (runtime preference, input type, checklist). Background mode: ```bash sage task implement --message "Add JWT refresh tokens" --background # ✓ task t-123 → sage-task-implement-... (background) ``` ## Plan orchestrator