一键导入
argent-create-flow
// Record a reusable flow (scripted sequence of MCP tool calls) that can be replayed later with a single command. Use when the user asks to create, record, or build a flow, or to script a sequence of device actions.
// Record a reusable flow (scripted sequence of MCP tool calls) that can be replayed later with a single command. Use when the user asks to create, record, or build a flow, or to script a sequence of device actions.
Interact with an iOS simulator or Android emulator using argent MCP tools. Use when tapping UI elements, performing gestures, scrolling, typing text, pressing hardware buttons, launching apps, opening URLs, taking screenshots.
Set up and connect to an iOS simulator using argent MCP tools. Use when starting a new session, booting an iOS simulator, getting an iOS UDID, or before any iOS simulator interaction task.
Debug a React Native app via Metro CDP using argent debugger tools. Use when connecting to Metro, inspecting React components, reading console logs, or evaluating JavaScript in the app runtime.
Step-by-step workflows for developing or debugging React Native apps on iOS simulator or Android emulator. Use when starting the app, debugging Metro, fixing builds, diagnosing runtime errors, or running tests.
Optimizes a React Native app by profiling first to find real bottlenecks, then sweeping for mechanical issues. Entry-point for all performance work. Use when the app feels slow, user asks to optimize, fix re-renders, reduce jank, or improve startup. Delegates to argent-react-native-profiler for measurement.
Autonomously test an app UI (iOS or Android) by running interact-screenshot-verify loops using argent MCP tools. Use when testing a UI flow, verifying login works, testing navigation, or running an end-to-end UI test scenario.
| name | argent-create-flow |
| description | Record a reusable flow (scripted sequence of MCP tool calls) that can be replayed later with a single command. Use when the user asks to create, record, or build a flow, or to script a sequence of device actions. |
A flow is a recorded sequence of MCP tool calls saved to a .yaml file in the .argent/flows/ directory. Each step is executed live as you add it, so you verify it works before it becomes part of the flow. Replay a finished flow with flow-execute.
| Tool | Purpose |
|---|---|
flow-start-recording | Start recording — takes a name and executionPrerequisite, creates the file |
flow-add-step | Execute a tool call live and record it if it succeeds |
flow-add-echo | Add a label/comment that prints during replay |
flow-finish-recording | Stop recording and get a summary |
flow-read-prerequisite | Read a flow's execution prerequisite without running it |
flow-execute | Replay a saved flow by name |
flow-start-recording with a descriptive name, the absolute project_root, and an executionPrerequisite describing the required app state before running the flow (e.g. "App on home screen after a fresh reload"). project_root is stored for the session — you do not need to pass it again to subsequent tools.flow-add-step with the tool name and args. The tool runs immediately — check the result before moving on.flow-add-echo between steps to describe what each section does.flow-finish-recording to stop recording. It returns the file path where the flow was saved and a summary of all steps. You can edit the .yaml file directly afterwards to remove, reorder, or tweak steps.Every tool during recording returns the current flow file contents so you can track what has been recorded.
Call flow-execute with the flow name. If the flow has an execution prerequisite:
flow-execute again with prerequisiteAcknowledged: true.flow-read-prerequisite beforehand to inspect the prerequisite without triggering a run.prerequisiteAcknowledged: true, the flow runs all steps in order and returns every tool call result (including screenshots) merged into a single response.If the flow has no prerequisite, it runs immediately without needing acknowledgment.
The command parameter is the MCP tool name. The args parameter is a JSON string (not an object):
command: "launch-app"
args: "{\"udid\": \"<UDID>\", \"bundleId\": \"com.apple.Preferences\"}"
command: "gesture-tap"
args: "{\"udid\": \"<UDID>\", \"x\": 0.5, \"y\": 0.35}"
command: "screenshot"
args: "{\"udid\": \"<UDID>\"}"
For tools with no arguments, omit args entirely.
project_root only to flow-start-recording. It is stored for the session and automatically used by all subsequent flow tools. An error is returned if the path is not absolute.flow-add-step, flow-add-echo, or flow-finish-recording. The active flow is tracked automatically after flow-start-recording.flow-add-step, flow-add-echo, or flow-finish-recording without an active recording returns an error: "No active flow. Call flow-start-recording first."flow-start-recording while already recording, the active flow switches to the new one. The response tells you which flow was abandoned and which is now active. The old flow's file remains on disk..yaml file directly to remove or reorder entries.flow-start-recording { name: "open-settings", project_root: "/Users/dev/MyApp", executionPrerequisite: "Simulator booted with app installed" }
flow-add-echo { message: "Launch Settings app" }
flow-add-step { command: "launch-app", args: "{\"udid\": \"ABC\", \"bundleId\": \"com.apple.Preferences\"}" }
flow-add-echo { message: "Tap General" }
flow-add-step { command: "gesture-tap", args: "{\"udid\": \"ABC\", \"x\": 0.5, \"y\": 0.35}" }
flow-add-echo { message: "Tap About" }
flow-add-step { command: "gesture-tap", args: "{\"udid\": \"ABC\", \"x\": 0.5, \"y\": 0.17}" }
flow-finish-recording {}
flow-execute { name: "open-settings", project_root: "/Users/dev/MyApp" }
→ Returns: notice with executionPrerequisite: "Simulator booted with app installed"
"Verify the prerequisite is met and call flow-execute again with prerequisiteAcknowledged set to true."
flow-execute { name: "open-settings", project_root: "/Users/dev/MyApp", prerequisiteAcknowledged: true }
→ Runs all steps, returns merged results with status and output for every step
Flow files use YAML. The top-level is an object with executionPrerequisite (describes required state) and steps (array of actions):
- echo: <message> — a label- tool: <name> with optional args: — a tool call. Add delayMs: <ms> to sleep that long before the step runs (use sparingly — only when the app needs a fixed wait between actions).Example .yaml file:
executionPrerequisite: Simulator booted with app installed
steps:
- echo: Launch Settings app
- tool: launch-app
args:
udid: ABC
bundleId: com.apple.Preferences
- echo: Tap General
- tool: gesture-tap
args:
udid: ABC
x: 0.5
y: 0.35
- echo: Tap About
- tool: gesture-tap
args:
udid: ABC
x: 0.5
y: 0.17
You do not need the user to ask for a flow. Record one proactively when you recognize any of these patterns:
argent-react-native-profiler and argent-native-profiler skills).Flows break. UI layouts change, coordinates drift, screens get added or removed. When flow-execute returns a failure, follow this procedure to diagnose and fix the flow instead of silently re-recording or giving up.
After every flow-execute, classify the outcome before proceeding:
| Outcome | Signal | Action |
|---|---|---|
| Success | All steps completed, final screenshot shows expected state | Continue with task |
| Hard error | A step has ERROR in the result — engine stopped there | Enter §10.2 |
| Silent misfire | All steps completed but final screenshot shows wrong screen | Enter §10.2 |
| Partial divergence | Intermediate screenshot shows wrong state even though later steps ran | Enter §10.2 |
For silent misfires and partial divergence, echo annotations (§10.5) are your reference for what each screen should look like.
screenshot to see where the app actually is now.describe or debugger-component-tree to get the current element tree.| Root cause | Symptoms |
|---|---|
| Coordinate drift | Tap succeeded but hit wrong element; elements shifted positions |
| Missing element | Target element not present in element tree |
| Wrong screen | Screenshot shows entirely different page than expected |
| Timing | Element exists in tree but tap missed; loading spinner visible |
| State mismatch | First step fails — executionPrerequisite was not actually met |
Choose the lightest strategy that fits:
Strategy 1 — Edit the YAML (coordinate drift, parameter changes).
Read .argent/flows/<flow-name>.yaml, update the broken step's x/y, bundleId, text, or other args. Re-run flow-execute to verify.
Strategy 2 — Manual recovery + continue (timing/transient issues, one-off replay). Manually execute the failed step with corrected coordinates from §10.2 discovery, then manually execute remaining steps. Does not fix the YAML — use only when re-recording is not worth it.
Strategy 3 — Re-record from failure point (structural changes, new intermediate screens).
Navigate the app to the state just before the failure point. Call flow-start-recording with the same flow name (overwrites). Re-add the working prefix steps via flow-add-step, then continue recording new steps from the divergence point. Call flow-finish-recording.
Strategy 4 — Full re-record (major changes, unclear diagnosis, or 3+ broken steps).
Reset the app to prerequisite state (restart-app + launch-app). Record from scratch with the same flow name.
Decision heuristic:
After applying a correction, re-run flow-execute to verify.
Hard cap: 2 correction cycles. Do not enter an unbounded fix loop.
Apply these when recording new flows to reduce future breakage:
"On Settings > General screen, about to tap About" not "Tap About". During diagnosis these tell you what the screen should look like.screenshot steps after screen transitions. These produce images in the flow result you can inspect during diagnosis."App on home tab, user logged in, simulator UDID is <X>" — not "App running". Verify with screenshot + describe before acknowledging."Tapping 'Submit' button (testID: submit-btn) at 0.5, 0.82". During repair, use describe to find the element by label and update coordinates. Only use screenshot for permission or system overlays when describe cannot expose the target reliably.