docs/sgai-skills/monitoring/SKILL.md
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.
npx skillsauth add sandgardenhq/sgai monitoringInstall 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.
Monitor the sgai factory to understand what agents are doing and track their progress.
Returns all workspaces and their complete state.
Endpoint: GET /api/v1/state
curl -s $BASE_URL/api/v1/state | jq .
Response:
{
"workspaces": [
{
"name": "my-project",
"dir": "/path/to/workspaces/my-project",
"running": true,
"needsInput": false,
"inProgress": true,
"pinned": false,
"isRoot": false,
"isFork": false,
"hasSgai": true,
"status": "working",
"badgeClass": "badge-running",
"badgeText": "Running",
"currentAgent": "go",
"task": "Writing authentication endpoints",
"latestProgress": "Created JWT middleware",
"cost": {
"inputTokens": 45000,
"outputTokens": 12000,
"cacheCreationInputTokens": 8000,
"cacheReadInputTokens": 32000
},
"events": [...],
"projectTodos": [...],
"agentTodos": [...],
"commits": [...],
"log": [...],
"pendingQuestion": null,
"forks": []
}
]
}
| Field | Description |
|-------|-------------|
| running | Session is active |
| needsInput | Blocked waiting for human response |
| inProgress | Work is actively happening |
| status | Workflow status: "working", "agent-done", "complete", etc. |
| currentAgent | Currently executing agent |
| task | Current task being worked on |
| latestProgress | Most recent progress note |
| pendingQuestion | Non-null when human input needed |
| badgeText | Human-readable status badge |
"cost": {
"inputTokens": 45000,
"outputTokens": 12000,
"cacheCreationInputTokens": 8000,
"cacheReadInputTokens": 32000
}
"events": [
{
"timestamp": "2026-02-27T17:00:00Z",
"formattedTime": "5:00 PM",
"agent": "coordinator",
"description": "Planning implementation",
"showDateDivider": false,
"dateDivider": ""
}
]
Equivalent to filtering state by workspace name:
curl -s $BASE_URL/api/v1/state | jq '.workspaces[] | select(.name == "my-project")'
Or use the MCP tool get_workspace_state:
get_workspace_state(workspace: "my-project")
Subscribe to state change notifications.
Endpoint: GET /api/v1/signal
curl -s -N $BASE_URL/api/v1/signal
Events emitted:
event: reload
data: {}
event: reload
data: {}
Each reload event means state has changed. Fetch /api/v1/state after receiving one.
#!/bin/bash
while true; do
curl -s -N "$BASE_URL/api/v1/signal" | while IFS= read -r line; do
if [[ "$line" == "event: reload" ]]; then
echo "State changed, fetching..."
curl -s $BASE_URL/api/v1/state > /tmp/latest-state.json
fi
done
echo "SSE disconnected, reconnecting..."
sleep 2
done
Get the current code changes (jj diff) for a workspace.
Endpoint: GET /api/v1/workspaces/{name}/diff
curl -s $BASE_URL/api/v1/workspaces/my-project/diff
Response:
{
"diff": "diff --git a/cmd/api/auth.go b/cmd/api/auth.go\nnew file mode 100644\n..."
}
Get a visual diagram of the agent workflow.
Endpoint: GET /api/v1/workspaces/{name}/workflow.svg
# Save to file
curl -s $BASE_URL/api/v1/workspaces/my-project/workflow.svg > workflow.svg
# Or open directly in browser
open $BASE_URL/api/v1/workspaces/my-project/workflow.svg
Returns SVG with the agent flow graph. The current agent is highlighted.
The agentSequence field shows the execution history:
curl -s $BASE_URL/api/v1/state | jq '.workspaces[0].agentSequence'
Response:
[
{
"agent": "coordinator",
"model": "openai/gpt-5.5 (xhigh)",
"elapsedTime": "2m 15s",
"isCurrent": false
},
{
"agent": "go",
"model": "openai/gpt-5.5 (low)",
"elapsedTime": "8m 42s",
"isCurrent": true
}
]
Check what the agent has planned:
# Project-level todos (from TodoWrite)
curl -s $BASE_URL/api/v1/state | jq '.workspaces[0].projectTodos'
# Agent-level todos (current agent's todo list)
curl -s $BASE_URL/api/v1/state | jq '.workspaces[0].agentTodos'
Todo format:
[
{
"id": "todo-1",
"content": "Implement JWT authentication",
"status": "in_progress",
"priority": "high"
}
]
curl -s $BASE_URL/api/v1/state | jq '.workspaces[0].commits'
Response:
[
{
"changeId": "abc123",
"commitId": "def456",
"timestamp": "2026-02-27T17:00:00Z",
"bookmarks": ["main"],
"description": "cmd/api: add authentication endpoints",
"graphChar": "◆"
}
]
For root workspaces, check their forks:
curl -s $BASE_URL/api/v1/state | jq '.workspaces[] | select(.isRoot) | .forks'
Fork entry:
[
{
"name": "feature-auth",
"dir": "/path/to/workspaces/feature-auth",
"running": true,
"needsInput": false,
"inProgress": true,
"pinned": false,
"commitAhead": 3,
"commits": [...],
"summary": "Implementing auth"
}
]
documentation
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.
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.