Skip to content

Automation recipes

The bundled sc CLI drives scripts, agent instructions, and terminal workflows while the app runs. Begin every automation with a connection check and use the installed help for exact syntax:

Terminal window
sc status --json
sc help worktree

Run these commands from an app-launched terminal in the worktree:

Terminal window
sc worktree status --json
sc worktree checks --json
sc worktree diff-summary --json
sc worktree review-checklist --json

Use status for the app-owned branch, target, path, and change counts. checks refreshes PR/MR check detail when needed. Limit a diff summary to one file with --file PATH.

List open app-managed threads before an agent reviews or fixes the diff:

Terminal window
sc worktree review-list --status open --json
sc worktree review-get "$COMMENT_ID" --json

Add a line-range or file-level comment:

Terminal window
sc worktree review-add --file src/auth.ts \
--start-line 41 --end-line 46 \
--author "Automated review" \
"Handle the expired-token path." --json
sc worktree review-add --file src/auth.ts --anchor file \
--author "Automated review" \
"This module needs an integration-level check." --json

Reply through a provider and optionally resolve the thread:

Terminal window
sc worktree review-reply "$COMMENT_ID" --provider codex \
--resolve "Fixed and verified." --json

Get the same hierarchy the sidebar uses:

Terminal window
sc workspace list --json

For a long-lived dashboard, sc workspace watch --json emits a snapshot followed by JSON Lines deltas. Rows include sections, projects, worktrees, Git and PR/MR status, and nested agent sessions.

Open or select a workspace:

Terminal window
sc workspace open /Users/example/project --activate --json
sc workspace select "$WORKSPACE_ID" --activate --json

Create manual and filtered sidebar sections:

Terminal window
sc section create "Mine" --manual --json
sc section create "Needs review" \
--rule review_decision=review_required --json
sc section create "Release work" --branch-glob 'release/*' --json

Run sc section assign "Mine" --json from the worktree you want to place. Use section unassign, edit, move, and delete to maintain the workspace. Filter rules are repeatable, so one section can require both a branch pattern and failing checks.

Creating a managed worktree requires an explicit human request. Read sc instructions worktree first.

Create an idle worktree with exact workspace and project IDs:

Terminal window
sc worktree create \
--workspace "$WORKSPACE_ID" \
--project "$PROJECT_ID" \
--json

From a verified app-launched agent session, create a task-bearing worktree:

Terminal window
sc worktree create \
--project docs \
--from-file /tmp/docs-task.md \
--provider codex \
--background \
--json

Use the supplied task for the real work; do not create a worktree merely to delegate. Select an existing row with sc worktree select "$ITEM_ID" --activate --json.

Terminal window
sc chat providers --json
SESSION_ID=$(sc chat new --provider codex --reasoning medium --activate)
sc chat send "$SESSION_ID" "Summarize the current diff." --watch

Send a larger prompt from standard input:

Terminal window
sc chat send "$SESSION_ID" --stdin --watch < prompt.txt

sc chat events "$SESSION_ID" streams live session events. Use sc chat stop, cancel, or close according to whether you need to end the active turn or the session.

From an app-launched terminal:

Terminal window
sc tab title "Docs Review"

The command can also target a tracked agent or nested session explicitly; see sc help tab.

App-managed orchestration now has its own documentation section:

  • Pass --json to ordinary app commands and --output json to orchestration and coordination commands.
  • Run worktree and section commands from the intended worktree when possible.
  • Prefer IDs or stable labels over numeric layout indexes.
  • Treat live session IDs as ephemeral.
  • Use a file or standard input for multiline prompts to avoid shell-quoting errors.
  • Read the relevant sc instructions <topic> guide before a managed worktree, layout, orchestration, or review mutation.

See CLI automation for the complete command map and authorization boundaries.