Skill v1.0.0
currentLLM-judged scan90/100version: "1.0.0" name: muse-subagent description: Standard Operating Procedure for securely delegating coding tasks to Muse AI as a native conversational sub-agent using the OS-Free TypeScript Binary.
Muse Sub-Agent Integration Skill
This skill allows Antigravity agents to securely spawn Muse AI as a native sub-agent to perform complex coding modifications, brainstorming, and reasoning natively inside a workspace.
Architecture: OS-Free TypeScript CLI (muse-cli-agent)
We have completely migrated away from the legacy Rust binary (which caused realpath and timezone crashes under Android proot). Muse is now operated via the OS-Free TypeScript Binary located at: /data/data/com.termux/files/home/Projects/muse-cli-agent
This TS agent handles:
- Meta API Device Flow: Native
auth.tspipeline for authentication. - Interactive Agent TUI: Native
tui.tsusinginquirerandchalkfor live streaming CLI chat. - LMK-Safe Sequential Execution: All workspace tools (
bash,read_file) run strictly sequentially (noPromise.all) to avoid triggering the Android Low Memory Killer. - JSON-RPC Bridge: The TS binary can seamlessly spawn
muse_agent.pyas a Python child process if heavy JSONL/MSP features are needed.
Manual Testing & Script Usage
If you (or the user) want to test the new TypeScript CLI Agent natively, follow these exact steps:
- Navigate to the Project:
``bash cd ~/Projects/muse-cli-agent ``
- Compile the TypeScript Binary:
``bash npm run build ``
- Login to Meta API (Device Auth Flow) OR OpenCode Zen:
``bash npm run login # Logs into Meta API muse-cli login opencode # Logs into OpenCode Zen (Free models) `` (This will output a Device Code. Open the URL provided to authorize the CLI).
- Launch the Interactive TUI Agent:
``bash npm run start ` *(This boots the beautiful chalk REPL where you can chat, select providers like OpenCode, use slash commands like /tools or /model`, and instruct the agent).*
How to Invoke Muse Programmatically (For Agents)
To seamlessly use Muse as a headless sub-agent, you MUST use the exec subcommand. You can use the --json flag to emit machine-readable JSONL events (thoughts, tool calls, results) on stdout for your orchestration scripts.
New Feature (Hybrid Advance Optimized Architecture): The exec command now has full feature parity with the TUI, meaning it executes tools natively. You can also attach a Python JSON-RPC bridge script to dynamically merge Python tools into the agent's toolset.
1. Bash / Direct Execution
node /data/data/com.termux/files/home/Projects/muse-cli-agent/dist/index.js exec --json --bridge-script /path/to/script.py "Refactor the auth middleware to use the new spec."
Note: If the prompt is too large for the shell, write it to a file and use `--prompt-file <path>`.
2. Python Orchestration (Leviathan / Brain Bridge)
When orchestrating Muse within Python, spawn it using subprocess and parse the JSONL stdout in real-time:
import subprocessimport jsoncmd = ["node", "/data/data/com.termux/files/home/Projects/muse-cli-agent/dist/index.js","exec", "--json", "Refactor the auth middleware"]process = subprocess.Popen(cmd, stdout=subprocess.PIPE, text=True)for line in process.stdout:event = json.loads(line)if event.get("type") == "tool_calls":print("Muse is calling tools:", event["toolCalls"])elif event.get("type") == "text":print("Muse reasoning:", event["delta"], end="")
Critical Rules for Agents using this Skill:
- Never Use the Rust Binary (`muse exec`): Always route API and tool execution through the TS binary in
muse-cli-agent. - Compile First: If you edit
src/auth.ts,src/tui.ts, orsrc/index.ts, you MUST runnpm run buildbefore executingnode ./dist/index.js. - LMK Constraints: Rely on the TS Agent's built-in
tmp.jsonpersistence. If the agent crashes mid-turn, it can be resumed effortlessly. - Headless Tool Execution:
execnatively supportsWORKSPACE_TOOL_DEFSand--bridge-scripttool execution loops, allowing seamless orchestration.