Agent Zero AI framework
Split A0 remote workflow skills by affordance
Alessandroa3d41e2ca14c
diff --git a/plugins/_a0_connector/prompts/agent.connector_tool.code_execution_remote.md b/plugins/_a0_connector/prompts/agent.connector_tool.code_execution_remote.mdindex 4c94d5f30..a6f67717d 100644--- a/plugins/_a0_connector/prompts/agent.connector_tool.code_execution_remote.md+++ b/plugins/_a0_connector/prompts/agent.connector_tool.code_execution_remote.md@@ -1,7 +1,7 @@# code_execution_remote toolRuns shell-backed execution on the machine where the subscribed A0 CLI is running.-Load `a0-cli-remote-workflows` before using this tool for nontrivial local project work.+Load `code-execution-remote` before using this tool for nontrivial local project work.Current local access mode: `{{access_mode}}`diff --git a/plugins/_a0_connector/prompts/agent.connector_tool.text_editor_remote.md b/plugins/_a0_connector/prompts/agent.connector_tool.text_editor_remote.mdindex 367354196..35c3f1f85 100644--- a/plugins/_a0_connector/prompts/agent.connector_tool.text_editor_remote.md+++ b/plugins/_a0_connector/prompts/agent.connector_tool.text_editor_remote.md@@ -1,7 +1,7 @@# text_editor_remote toolReads, writes, and patches files on the machine where the subscribed A0 CLI is running.-This is different from server-side file tools. Load `a0-cli-remote-workflows` before using it for edits.+This is different from server-side file tools. Load `text-editor-remote` before using it for edits.Current access mode: `{{access_mode}}`diff --git a/plugins/_a0_connector/skills/a0-cli-remote-workflows/SKILL.md b/plugins/_a0_connector/skills/a0-cli-remote-workflows/SKILL.mddeleted file mode 100644index 5b57d75db..000000000--- a/plugins/_a0_connector/skills/a0-cli-remote-workflows/SKILL.md+++ /dev/null@@ -1,64 +0,0 @@-----name: a0-cli-remote-workflows-description: Guide safe use of A0 CLI remote shell execution and remote file editing on the connected host machine. Load before using code_execution_remote or text_editor_remote for local project work through the CLI connector.-version: 1.0.0-author: Agent Zero Team-tags: ["agent-zero", "a0", "cli", "connector", "remote-execution", "remote-files"]-trigger_patterns:- - "code_execution_remote"- - "text_editor_remote"- - "remote file editing"- - "remote shell execution"- - "edit my local files through a0 cli"- - "run commands on the cli host"-allowed_tools:- - code_execution_remote- - text_editor_remote------# A0 CLI Remote Workflows--## Boundary--Use `code_execution_remote` and `text_editor_remote` only for work on the machine where A0 CLI is running. These paths, shells, runtimes, and files belong to the CLI host, not the Agent Zero server or Docker container.--If the task belongs inside Agent Zero's own runtime, use the normal server-side tools instead.--## Access Modes--- Read only: inspect files and poll/reset existing execution sessions. Do not attempt writes or mutating shell work until the user switches the CLI to Read&Write with F3.-- Read&Write: shell-backed execution, writes, and patches may modify the CLI host. Keep changes narrow and intentional.-- Execution may also be disabled locally in the CLI. If a remote tool returns a structured disabled/no-client error, explain the required CLI toggle instead of falling back to the server filesystem.--## Remote Execution--- Use `runtime=terminal` for shell commands, `runtime=python` for Python snippets, and `runtime=nodejs` for Node.js snippets.-- Reuse the same integer `session` while continuing a workflow; session state is local to the CLI frontend.-- Use `runtime=output` when a previous command is still running or returned before the shell reached a prompt.-- Use `runtime=reset` when a session is stuck or a clean shell is safer.-- Treat `runtime=input` as deprecated compatibility for sending one line to a running shell.-- Match the remote host shell syntax. A Windows CLI may need PowerShell syntax even when Agent Zero runs on Linux.--## Remote File Editing--- Start with `read` when inspecting a file or preparing line-based edits.-- Use `write` only when replacing or creating the whole file is truly the right operation.-- Prefer `patch` with `patch_text` for context-anchored edits, especially after inserts/deletes or when line numbers may have shifted.-- Use `patch` with `edits` only for small line-range edits based on the latest remote read.-- If freshness-aware line patching rejects an edit as stale, reread the file and retry with updated ranges.--## Patch Text Rules--- `patch_text` supports update hunks for one file.-- Use one `@@ existing line` anchor, then `+new line` entries for insertion.-- For replacement, use `@@ before target` followed by `-old` and `+new`, or use `@@ old target` followed by the same replacement pair.-- Do not repeat the same old line as both context and deletion in one hunk.-- Every non-header content line must begin with exactly one prefix: space for context, `+` for additions, or `-` for removals.-- Do not stack multiple `@@` anchors for one insert.--## Failure Handling--- If no CLI is connected or subscribed, ask the user to connect A0 CLI to this chat.-- If writes are blocked, tell the user to switch local access to Read&Write with F3.-- If execution is disabled, tell the user to enable remote execution in the CLI.-- If a request times out or the CLI disconnects, poll once if a session may still be running; otherwise summarize the failure and wait for reconnection.diff --git a/plugins/_a0_connector/skills/code-execution-remote/SKILL.md b/plugins/_a0_connector/skills/code-execution-remote/SKILL.mdnew file mode 100644index 000000000..331587026--- /dev/null+++ b/plugins/_a0_connector/skills/code-execution-remote/SKILL.md@@ -0,0 +1,45 @@+---+name: code-execution-remote+description: Guide safe use of code_execution_remote for shell-backed execution on the connected A0 CLI host machine.+version: 1.0.0+author: Agent Zero Team+tags: ["agent-zero", "a0", "cli", "connector", "remote-execution", "shell"]+trigger_patterns:+ - "code_execution_remote"+ - "remote shell execution"+ - "run commands on the cli host"+ - "run python on the cli host"+ - "run node on the cli host"+allowed_tools:+ - code_execution_remote+---++# Code Execution Remote++## Boundary++Use `code_execution_remote` only for shell-backed execution on the machine where A0 CLI is running. Shells, runtimes, and paths belong to the CLI host, not the Agent Zero server or Docker container.++If the task belongs inside Agent Zero's own runtime, use the normal server-side execution tool instead.++## Access Modes++- Remote execution can be disabled locally in the CLI. If the tool returns a disabled/no-client error, explain the required CLI toggle instead of falling back to the server runtime.+- Read&Write local file access allows mutating runtimes such as `terminal`, `python`, and `nodejs`.+- Read only local file access blocks mutating runtimes. `runtime=output` and `runtime=reset` remain available for existing sessions.++## Runtimes++- Use `runtime=terminal` for shell commands, `runtime=python` for Python snippets, and `runtime=nodejs` for Node.js snippets.+- Reuse the same integer `session` while continuing a workflow; session state is local to the CLI frontend.+- Use `runtime=output` when a previous command is still running or returned before the shell reached a prompt.+- Use `runtime=reset` when a session is stuck or a clean shell is safer.+- Treat `runtime=input` as deprecated compatibility for sending one line to a running shell.+- Match the remote host shell syntax. A Windows CLI may need PowerShell syntax even when Agent Zero runs on Linux.++## Failure Handling++- If no CLI is connected or subscribed, ask the user to connect A0 CLI to this chat.+- If execution is disabled, tell the user to enable remote execution in the CLI.+- If mutating runtimes are blocked, tell the user to switch local file access to Read&Write with F3.+- If a request times out or the CLI disconnects, poll once if a session may still be running; otherwise summarize the failure and wait for reconnection.diff --git a/plugins/_a0_connector/skills/text-editor-remote/SKILL.md b/plugins/_a0_connector/skills/text-editor-remote/SKILL.mdnew file mode 100644index 000000000..457469e55--- /dev/null+++ b/plugins/_a0_connector/skills/text-editor-remote/SKILL.md@@ -0,0 +1,51 @@+---+name: text-editor-remote+description: Guide safe use of text_editor_remote for reading, writing, and patching files on the connected A0 CLI host machine.+version: 1.0.0+author: Agent Zero Team+tags: ["agent-zero", "a0", "cli", "connector", "remote-files", "file-editing"]+trigger_patterns:+ - "text_editor_remote"+ - "remote file editing"+ - "edit my local files through a0 cli"+ - "read files on the cli host"+ - "patch files on the cli host"+allowed_tools:+ - text_editor_remote+---++# Text Editor Remote++## Boundary++Use `text_editor_remote` only for file work on the machine where A0 CLI is running. These paths and files belong to the CLI host, not the Agent Zero server or Docker container.++If the task belongs inside Agent Zero's own runtime, use the normal server-side file tools instead.++## Access Modes++- Read&Write: reads, writes, and patches may modify the CLI host. Keep changes narrow and intentional.+- Read only: inspect files only. If writes are blocked, tell the user to switch local file access to Read&Write with F3.++## Editing Flow++- Start with `read` when inspecting a file or preparing line-based edits.+- Use `write` only when replacing or creating the whole file is truly the right operation.+- Prefer `patch` with `patch_text` for context-anchored edits, especially after inserts/deletes or when line numbers may have shifted.+- Use `patch` with `edits` only for small line-range edits based on the latest remote read.+- If freshness-aware line patching rejects an edit as stale, reread the file and retry with updated ranges.++## Patch Text Rules++- `patch_text` supports update hunks for one file.+- Use one `@@ existing line` anchor, then `+new line` entries for insertion.+- For replacement, use `@@ before target` followed by `-old` and `+new`, or use `@@ old target` followed by the same replacement pair.+- Do not repeat the same old line as both context and deletion in one hunk.+- Every non-header content line must begin with exactly one prefix: space for context, `+` for additions, or `-` for removals.+- Do not stack multiple `@@` anchors for one insert.++## Failure Handling++- If no CLI is connected or subscribed, ask the user to connect A0 CLI to this chat.+- If writes are blocked, tell the user to switch local file access to Read&Write with F3.+- If a request times out or the CLI disconnects, summarize the failure and wait for reconnection.diff --git a/skills/computer-use-remote/SKILL.md b/skills/computer-use-remote/SKILL.mdindex c31b76dc7..fc19e4337 100644--- a/skills/computer-use-remote/SKILL.md+++ b/skills/computer-use-remote/SKILL.md@@ -14,7 +14,6 @@ trigger_patterns:- "native ui"allowed_tools:- computer_use_remote- - code_execution_remote---# Computer Use Remote@@ -25,6 +24,8 @@ Load this skill before using `computer_use_remote` for local desktop and nativeIf the task is browser-only and the user is flexible, prefer direct browser tooling because it is usually more reliable and token-efficient than screenshot-driven desktop control.+If the task needs shell execution on the CLI host, load `code-execution-remote` separately rather than treating desktop control and shell execution as one affordance.+## Core Loop1. Call `start_session` first.diff --git a/tests/test_a0_connector_prompt_gating.py b/tests/test_a0_connector_prompt_gating.pyindex ee544a983..790ecde42 100644--- a/tests/test_a0_connector_prompt_gating.py+++ b/tests/test_a0_connector_prompt_gating.py@@ -198,8 +198,8 @@ def test_computer_use_enabled_cli_adds_computer_stub():assert "code_execution_remote tool" not in prompt-def test_remote_workflow_skills_parse():- connector_skill = _parse_skill_frontmatter(+def test_remote_affordance_skills_parse():+ legacy_connector_skill = (PROJECT_ROOT/ "plugins"/ "_a0_connector"@@ -207,11 +207,40 @@ def test_remote_workflow_skills_parse():/ "a0-cli-remote-workflows"/ "SKILL.md")+ text_editor_skill = _parse_skill_frontmatter(+ PROJECT_ROOT+ / "plugins"+ / "_a0_connector"+ / "skills"+ / "text-editor-remote"+ / "SKILL.md"+ )+ code_execution_skill = _parse_skill_frontmatter(+ PROJECT_ROOT+ / "plugins"+ / "_a0_connector"+ / "skills"+ / "code-execution-remote"+ / "SKILL.md"+ )computer_skill = _parse_skill_frontmatter(PROJECT_ROOT / "skills" / "computer-use-remote" / "SKILL.md")- assert connector_skill["name"] == "a0-cli-remote-workflows"- assert connector_skill["description"]+ assert not legacy_connector_skill.exists()+ assert text_editor_skill["name"] == "text-editor-remote"+ assert text_editor_skill["allowed_tools"] == ["text_editor_remote"]+ assert code_execution_skill["name"] == "code-execution-remote"+ assert code_execution_skill["allowed_tools"] == ["code_execution_remote"]assert computer_skill["name"] == "computer-use-remote"- assert computer_skill["description"]+ assert computer_skill["allowed_tools"] == ["computer_use_remote"]+++def test_remote_tool_stubs_point_to_per_tool_skills():+ text_stub = (PROMPT_ROOT / "agent.connector_tool.text_editor_remote.md").read_text(encoding="utf-8")+ exec_stub = (PROMPT_ROOT / "agent.connector_tool.code_execution_remote.md").read_text(encoding="utf-8")++ assert "Load `text-editor-remote`" in text_stub+ assert "Load `code-execution-remote`" in exec_stub+ assert "a0-cli-remote-workflows" not in text_stub+ assert "a0-cli-remote-workflows" not in exec_stub