docs/sgai-skills/session-control/SKILL.md
Start, stop, and steer agentic sessions in sgai workspaces. Use when you need to launch AI agent sessions, halt running sessions, or inject steering instructions to guide the agent mid-execution without stopping it.
npx skillsauth add sandgardenhq/sgai session-controlInstall 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.
Sessions are the running instances of AI agents working on a workspace. Each workspace can have at most one running session.
Endpoint: POST /api/v1/workspaces/{name}/start
# Brainstorming mode (interactive, pauses for human input)
curl -X POST $BASE_URL/api/v1/workspaces/my-project/start \
-H "Content-Type: application/json" \
-d '{"auto": false}'
# Self-drive mode (fully autonomous, no pausing)
curl -X POST $BASE_URL/api/v1/workspaces/my-project/start \
-H "Content-Type: application/json" \
-d '{"auto": true}'
Request:
{"auto": true}
Response:
{
"name": "my-project",
"status": "running",
"running": true,
"message": "session started"
}
| Mode | auto | Description |
|------|--------|-------------|
| Brainstorming | false | Pauses at key decision points to ask for input |
| Self-drive | true | Runs fully autonomously without interruption |
| Continuous | (auto-detected) | If workspace has a continuous.md prompt, uses continuous mode |
Notes:
"message": "session already running"Endpoint: POST /api/v1/workspaces/{name}/stop
curl -X POST $BASE_URL/api/v1/workspaces/my-project/stop
Response:
{
"name": "my-project",
"status": "stopped",
"running": false,
"message": "session stopped"
}
If already stopped: "message": "session already stopped"
Inject a steering instruction into a running session without stopping it. The instruction is recorded in .sgai/PROJECT_MANAGEMENT.md and workflow state navigates to the coordinator.
Endpoint: POST /api/v1/workspaces/{name}/steer
curl -X POST $BASE_URL/api/v1/workspaces/my-project/steer \
-H "Content-Type: application/json" \
-d '{"message": "Focus on the authentication module first, skip the dashboard for now"}'
Request:
{"message": "Focus on the authentication module first, skip the dashboard for now"}
Response:
{
"success": true,
"message": "steering instruction added"
}
Notes:
Get the workflow diagram showing agent flow and current position.
Endpoint: GET /api/v1/workspaces/{name}/workflow.svg
curl -s $BASE_URL/api/v1/workspaces/my-project/workflow.svg > workflow.svg
Response: SVG image (Content-Type: image/svg+xml)
Returns 404 if workflow SVG is not available.
Use the full state endpoint to check session status:
STATE=$(curl -s $BASE_URL/api/v1/state)
RUNNING=$(echo $STATE | jq '.workspaces[] | select(.name=="my-project") | .running')
AGENT=$(echo $STATE | jq -r '.workspaces[] | select(.name=="my-project") | .currentAgent')
TASK=$(echo $STATE | jq -r '.workspaces[] | select(.name=="my-project") | .task')
Key workspace state fields for session monitoring:
| Field | Type | Description |
|-------|------|-------------|
| running | bool | Is session active? |
| inProgress | bool | Is work actively happening? |
| currentAgent | string | Which agent is currently running |
| task | string | Current task description |
| status | string | Workflow status string |
| latestProgress | string | Most recent progress note |
Open the workspace in OpenCode terminal (localhost connections only).
Endpoint: POST /api/v1/workspaces/{name}/open-opencode
curl -X POST http://localhost:PORT/api/v1/workspaces/my-project/open-opencode
Response:
{
"opened": true,
"message": "opened in opencode"
}
Errors:
403 — remote connections not allowed (localhost only)409 — session not runningOpen the workspace directory in the configured editor (VS Code, etc.).
Endpoint: POST /api/v1/workspaces/{name}/open-editor
curl -X POST $BASE_URL/api/v1/workspaces/my-project/open-editor
Response:
{
"opened": true,
"editor": "code",
"message": "opened in editor"
}
# Open GOAL.md in editor
curl -X POST $BASE_URL/api/v1/workspaces/my-project/open-editor/goal
# Open PROJECT_MANAGEMENT.md in editor
curl -X POST $BASE_URL/api/v1/workspaces/my-project/open-editor/project-management
development
Monitor sgai workspace status, events, progress, diffs, and workflow diagrams. Use when you need to observe what agents are doing, track progress, get the current state of all workspaces, subscribe to real-time updates via SSE, or inspect code changes.
development
Access agents, skills, and code snippets available in sgai workspaces. Use when you need to discover what agents are defined in a workspace, browse available skills, get skill instructions, find code snippets by language, or retrieve snippet content for a specific task.
data-ai
Handle agent questions and work gates in sgai workspaces. Use when an agent is blocked waiting for human input, when you need to respond to multi-choice questions, approve work gates, or provide free-text answers to agent queries.
development
Use the sgai compose wizard to create and manage GOAL.md files for workspaces. Supports reading compose state, updating wizard fields, saving drafts, previewing generated GOAL.md content, browsing workflow templates, and writing the final GOAL.md to the workspace.