{ "schema_version": 2, "diagram_type": "workflow", "meta": { "title": "TrackGo Cursor Agent Tool-Call Loop", "locale": "en", "quality_profile": "showcase", "views": [ { "id": "success-path", "label": "Allow and reply", "focus": ["user_prompt", "parent_agent", "tool_select", "shell_hook", "run_shell", "user_reply"], "note": "Matching shell commands that are allowed skip the consent wait and return a reply." }, { "id": "consent-paths", "label": "Ask, wait, revise", "focus": ["shell_hook", "consent_wait", "revise_cmd"], "note": "git push and non-tmux dev servers pause with permission ask. The hook never returns deny." }, { "id": "evidence-path", "label": "Session evidence", "focus": ["session_files", "compact_hint"], "note": "sessionStart loads prior context; afterFileEdit counts tool calls; sessionEnd may evaluate a transcript." } ] }, "lanes": [ { "id": "user", "label": "User surface" }, { "id": "agent", "label": "Agent runtime" }, { "id": "policy", "label": "Policy & exception", "variant": "exception" }, { "id": "tools", "label": "Tools & observability" } ], "phases": [ { "id": "intake", "label": "Intake", "fromCol": 0, "toCol": 1 }, { "id": "route", "label": "Select + gate", "fromCol": 2, "toCol": 3, "variant": "emphasis" }, { "id": "execute", "label": "Execute + record", "fromCol": 4, "toCol": 5, "variant": "dashed" } ], "groups": [ { "id": "policy_gate", "label": "Policy boundary", "lane": "policy", "fromCol": 3, "toCol": 3, "variant": "security" }, { "id": "exception_wait", "label": "Exception handling", "lane": "policy", "fromCol": 4, "toCol": 5, "variant": "security" }, { "id": "tool_work", "label": "Tool execution", "lane": "tools", "fromCol": 2, "toCol": 2, "variant": "dashed" }, { "id": "shell_run", "label": "Shell run", "lane": "tools", "fromCol": 5, "toCol": 5, "variant": "dashed" }, { "id": "evidence", "label": "Observability", "lane": "tools", "fromCol": 0, "toCol": 1, "variant": "dashed" } ], "mainPath": ["user_prompt", "parent_agent", "tool_select", "shell_hook", "run_shell", "user_reply"], "semanticChecks": { "allowedRoots": ["user_prompt", "session_files"], "allowedTerminals": ["user_reply", "consent_wait", "revise_cmd", "compact_hint"] }, "nodes": [ { "id": "user_prompt", "lane": "user", "col": 0, "type": "external", "label": "User prompt", "sublabel": "Cursor chat", "width": 132 }, { "id": "user_reply", "lane": "user", "col": 5, "type": "frontend", "label": "Final reply", "sublabel": "answer + diffs", "width": 132 }, { "id": "parent_agent", "lane": "agent", "col": 1, "type": "backend", "label": "Parent agent", "sublabel": "rules + skills", "width": 132 }, { "id": "tool_select", "lane": "agent", "col": 2, "type": "backend", "label": "Select tool", "sublabel": "Shell or files", "width": 132 }, { "id": "shell_hook", "lane": "policy", "col": 3, "type": "security", "label": "Shell hook", "sublabel": "before-shell.sh", "width": 132 }, { "id": "consent_wait", "lane": "policy", "col": 4, "type": "security", "label": "Consent wait", "sublabel": "permission ask", "width": 132 }, { "id": "revise_cmd", "lane": "policy", "col": 5, "type": "messagebus", "label": "Revise command", "sublabel": "wrap in tmux", "width": 132 }, { "id": "file_tools", "lane": "tools", "col": 2, "type": "backend", "label": "File tools", "sublabel": "Read / Grep / Write", "width": 132 }, { "id": "run_shell", "lane": "tools", "col": 5, "type": "messagebus", "label": "Run Shell", "sublabel": "permission allow", "width": 132 }, { "id": "session_files", "lane": "tools", "col": 0, "type": "database", "label": "Session files", "sublabel": ".cursor/sessions", "width": 132 }, { "id": "compact_hint", "lane": "tools", "col": 1, "type": "database", "label": "Compact hint", "sublabel": "afterFileEdit", "width": 132 } ], "edges": [ { "id": "prompt-to-agent", "from": "user_prompt", "to": "parent_agent" }, { "id": "load-session", "from": "session_files", "to": "parent_agent", "label": "sessionStart", "variant": "dashed", "role": "async" }, { "id": "agent-selects", "from": "parent_agent", "to": "tool_select", "label": "plan next tool", "variant": "emphasis" }, { "id": "select-to-hook", "from": "tool_select", "to": "shell_hook", "label": "dev or git push" }, { "id": "select-to-files", "from": "tool_select", "to": "file_tools", "label": "other tools", "role": "branch" }, { "id": "hook-allow", "from": "shell_hook", "to": "run_shell", "label": "allow", "variant": "emphasis" }, { "id": "hook-ask", "from": "shell_hook", "to": "consent_wait", "label": "ask", "variant": "security", "role": "error" }, { "id": "wait-revise", "from": "consent_wait", "to": "revise_cmd", "label": "agent_message", "variant": "dashed", "role": "branch" }, { "id": "shell-reply", "from": "run_shell", "to": "user_reply", "variant": "emphasis", "role": "return", "fromSide": "right", "toSide": "right", "route": "outside-right" }, { "id": "files-return", "from": "file_tools", "to": "parent_agent", "label": "tool result", "role": "return" }, { "id": "edit-count", "from": "file_tools", "to": "compact_hint", "label": "afterFileEdit", "variant": "dashed", "role": "async" } ], "cards": [ { "dot": "rose", "title": "What the hook gates", "items": [ "Asks on git push and non-tmux * run dev; never denies; errors exit 0" ] }, { "dot": "cyan", "title": "Evidence the repo writes", "items": [ "sessionStart loads 7-day .tmp files; afterFileEdit logs at 50 calls" ] } ] }