Skip to content

Commit 7ec9add

Browse files
ci(release): publish latest release
1 parent 7c25a91 commit 7ec9add

769 files changed

Lines changed: 42991 additions & 11277 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: argent-android-emulator-setup
3+
description: Set up and connect to an Android emulator using argent MCP tools. Use when starting a new session on Android, booting an emulator, getting a device serial, or before any UI interaction task.
4+
---
5+
6+
## 1. Prerequisites
7+
8+
- **Android SDK Platform Tools** on PATH β€” provides `adb`.
9+
- **Android Emulator** on PATH β€” needed to boot AVDs. If you will only use an already-running emulator or a physical device, adb alone is sufficient.
10+
- An AVD created via Android Studio or `avdmanager create avd`.
11+
12+
Verify with `adb version` and `emulator -list-avds`.
13+
14+
## 2. Setup
15+
16+
1. **Find a ready device** β€” call `list-devices`. Filter for entries with `platform: "android"`. Ready devices (`state: "device"`) come first. Pick the first `serial` (e.g. `emulator-5554`) unless the user specified one.
17+
2. **Boot if needed** β€” if nothing Android is ready, call `boot-device` with `avdName: <name>` from the same call's `avds` list. The tool transparently picks hot vs cold boot: it probes the AVD's `default_boot` snapshot, restores it under a tight deadline when usable, and falls back to a full cold boot otherwise. Hot path is typically ~30s; cold path takes 2–10 min. On any stage failure the tool kills the emulator process it started so your next call starts from a clean state.
18+
3. **Metro (for React Native)** β€” once a device is up, run `adb -s <serial> reverse tcp:8081 tcp:8081` so the device can reach Metro on your host. Repeat if the device restarts. See the `argent-metro-debugger` skill.
19+
20+
## 3. Using the device
21+
22+
Pass the Android serial as `udid` to the unified interaction tools β€” `gesture-tap`, `gesture-swipe`, `describe`, `screenshot`, `launch-app`, `keyboard`, etc. Dispatch is automatic based on the id shape. See `argent-device-interact` for platform-neutral interaction tooling and the Android-specific gotchas section at the bottom of that skill.
23+
24+
## 4. Notes
25+
26+
- Serials are the adb device id. iOS UDIDs and Android serials are not interchangeable, but you do NOT need to tell the tools which platform β€” dispatch is automatic.
27+
- `describe` on Android returns a shallower tree than iOS (no accessibility-service equivalent), but covers most tap-target discovery.
28+
- `reinstall-app` on Android always installs with `-g` so first-launch runtime permissions are pre-granted.
29+
- To kill the emulator when you're done, run `adb -s <serial> emu kill` from a shell.
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
---
2+
name: argent-create-flow
3+
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 simulator actions.
4+
---
5+
6+
## 1. Overview
7+
8+
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`.
9+
10+
## 2. Tools
11+
12+
| Tool | Purpose |
13+
| ------------------------ | -------------------------------------------------------------------------- |
14+
| `flow-start-recording` | Start recording β€” takes a name and executionPrerequisite, creates the file |
15+
| `flow-add-step` | Execute a tool call live and record it if it succeeds |
16+
| `flow-add-echo` | Add a label/comment that prints during replay |
17+
| `flow-finish-recording` | Stop recording and get a summary |
18+
| `flow-read-prerequisite` | Read a flow's execution prerequisite without running it |
19+
| `flow-execute` | Replay a saved flow by name |
20+
21+
## 3. Workflow
22+
23+
### Recording
24+
25+
1. **Start**: Call `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.
26+
2. **Build step-by-step**: For each action, call `flow-add-step` with the tool name and args. The tool runs immediately β€” check the result before moving on.
27+
3. **Add labels**: Use `flow-add-echo` between steps to describe what each section does.
28+
4. **Finish**: Call `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.
29+
30+
Every tool during recording returns the current flow file contents so you can track what has been recorded.
31+
32+
### Replaying
33+
34+
Call `flow-execute` with the flow name. If the flow has an execution prerequisite:
35+
36+
1. The tool returns a **notice** with the prerequisite text instead of running. It asks you to verify the prerequisite is met and call `flow-execute` again with `prerequisiteAcknowledged: true`.
37+
2. You can also call `flow-read-prerequisite` beforehand to inspect the prerequisite without triggering a run.
38+
3. Once you pass `prerequisiteAcknowledged: true`, the flow runs all steps in order and returns every tool call result (including screenshots) merged into a single response.
39+
40+
If the flow has no prerequisite, it runs immediately without needing acknowledgment.
41+
42+
## 4. flow-add-step Usage
43+
44+
The `command` parameter is the MCP tool name. The `args` parameter is a **JSON string** (not an object):
45+
46+
```
47+
command: "launch-app"
48+
args: "{\"udid\": \"<UDID>\", \"bundleId\": \"com.apple.Preferences\"}"
49+
```
50+
51+
```
52+
command: "gesture-tap"
53+
args: "{\"udid\": \"<UDID>\", \"x\": 0.5, \"y\": 0.35}"
54+
```
55+
56+
```
57+
command: "screenshot"
58+
args: "{\"udid\": \"<UDID>\"}"
59+
```
60+
61+
For tools with no arguments, omit `args` entirely.
62+
63+
## 5. Important Rules
64+
65+
- **Every step runs live.** You will see the real tool result (including screenshots). Use this to verify the step worked before continuing.
66+
- **Only successful steps are recorded.** If a tool call fails, nothing is written to the flow file β€” fix the issue and try again.
67+
- **Pass `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.
68+
- **You do NOT need to pass a flow name** to `flow-add-step`, `flow-add-echo`, or `flow-finish-recording`. The active flow is tracked automatically after `flow-start-recording`.
69+
- **Start before adding.** Calling `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."_
70+
- **One flow at a time.** If you call `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.
71+
- **Mistakes can be edited out.** If a step was recorded by mistake, edit the `.yaml` file directly to remove or reorder entries.
72+
73+
## 6. Example Session
74+
75+
```
76+
flow-start-recording { name: "open-settings", project_root: "/Users/dev/MyApp", executionPrerequisite: "Simulator booted with app installed" }
77+
flow-add-echo { message: "Launch Settings app" }
78+
flow-add-step { command: "launch-app", args: "{\"udid\": \"ABC\", \"bundleId\": \"com.apple.Preferences\"}" }
79+
flow-add-echo { message: "Tap General" }
80+
flow-add-step { command: "gesture-tap", args: "{\"udid\": \"ABC\", \"x\": 0.5, \"y\": 0.35}" }
81+
flow-add-echo { message: "Tap About" }
82+
flow-add-step { command: "gesture-tap", args: "{\"udid\": \"ABC\", \"x\": 0.5, \"y\": 0.17}" }
83+
flow-finish-recording {}
84+
```
85+
86+
## 7. Replay Example
87+
88+
```
89+
flow-execute { name: "open-settings", project_root: "/Users/dev/MyApp" }
90+
β†’ Returns: notice with executionPrerequisite: "Simulator booted with app installed"
91+
"Verify the prerequisite is met and call flow-execute again with prerequisiteAcknowledged set to true."
92+
93+
flow-execute { name: "open-settings", project_root: "/Users/dev/MyApp", prerequisiteAcknowledged: true }
94+
β†’ Runs all steps, returns merged results with status and output for every step
95+
```
96+
97+
## 8. Flow File Format
98+
99+
Flow files use YAML. The top-level is an object with `executionPrerequisite` (describes required state) and `steps` (array of actions):
100+
101+
- `- echo: <message>` β€” a label
102+
- `- 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).
103+
104+
Example `.yaml` file:
105+
106+
```yaml
107+
executionPrerequisite: Simulator booted with app installed
108+
steps:
109+
- echo: Launch Settings app
110+
- tool: launch-app
111+
args:
112+
udid: ABC
113+
bundleId: com.apple.Preferences
114+
- echo: Tap General
115+
- tool: gesture-tap
116+
args:
117+
udid: ABC
118+
x: 0.5
119+
y: 0.35
120+
- echo: Tap About
121+
- tool: gesture-tap
122+
args:
123+
udid: ABC
124+
x: 0.5
125+
y: 0.17
126+
```
127+
128+
## 9. When to Proactively Record a Flow
129+
130+
You do not need the user to ask for a flow. Record one proactively when you recognize any of these patterns:
131+
132+
- **About to re-profile**: You completed a profiling session and are about to apply a fix and re-profile. Record the interaction steps now so the re-profile replays them identically (see `argent-react-native-profiler` and `argent-native-profiler` skills).
133+
- **Repeating steps**: You have already performed a multi-step interaction sequence once and the task requires doing it again (comparison, retry, re-test).
134+
- **Complex path discovered**: You worked through a non-trivial sequence of taps/swipes/navigation to reach a desired app state. Capture it before it is lost.
135+
- **User says "again" / "one more time"**: Any request to redo what you just did is a signal to record first, then replay.
136+
137+
## 10. Flow Self-Improvement
138+
139+
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.
140+
141+
### 10.1 Classify the Result
142+
143+
After every `flow-execute`, classify the outcome before proceeding:
144+
145+
| Outcome | Signal | Action |
146+
| ---------------------- | --------------------------------------------------------------------- | ------------------ |
147+
| **Success** | All steps completed, final screenshot shows expected state | Continue with task |
148+
| **Hard error** | A step has `ERROR` in the result β€” engine stopped there | Enter Β§10.2 |
149+
| **Silent misfire** | All steps completed but final screenshot shows wrong screen | Enter Β§10.2 |
150+
| **Partial divergence** | Intermediate screenshot shows wrong state even though later steps ran | Enter Β§10.2 |
151+
152+
For silent misfires and partial divergence, echo annotations (Β§10.5) are your reference for what each screen _should_ look like.
153+
154+
### 10.2 Diagnose
155+
156+
1. Note the failure step index and error message (if hard error).
157+
2. Call `screenshot` to see where the app actually is now.
158+
3. Call `describe` or `debugger-component-tree` to get the current element tree.
159+
4. Compare current state to what the failed step expected. Classify the root cause:
160+
161+
| Root cause | Symptoms |
162+
| ---------------- | --------------------------------------------------------------- |
163+
| Coordinate drift | Tap succeeded but hit wrong element; elements shifted positions |
164+
| Missing element | Target element not present in element tree |
165+
| Wrong screen | Screenshot shows entirely different page than expected |
166+
| Timing | Element exists in tree but tap missed; loading spinner visible |
167+
| State mismatch | First step fails β€” executionPrerequisite was not actually met |
168+
169+
5. State the diagnosis in one sentence before attempting any correction.
170+
171+
### 10.3 Correct
172+
173+
Choose the lightest strategy that fits:
174+
175+
**Strategy 1 β€” Edit the YAML** (coordinate drift, parameter changes).
176+
Read `.argent/flows/<flow-name>.yaml`, update the broken step's `x`/`y`, `bundleId`, `text`, or other args. Re-run `flow-execute` to verify.
177+
178+
**Strategy 2 β€” Manual recovery + continue** (timing/transient issues, one-off replay).
179+
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.
180+
181+
**Strategy 3 β€” Re-record from failure point** (structural changes, new intermediate screens).
182+
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`.
183+
184+
**Strategy 4 β€” Full re-record** (major changes, unclear diagnosis, or 3+ broken steps).
185+
Reset the app to prerequisite state (`restart-app` + `launch-app`). Record from scratch with the same flow name.
186+
187+
**Decision heuristic:**
188+
189+
- 1 step broken, parameter-only change β†’ Strategy 1
190+
- 1 step broken, transient issue, not worth persisting β†’ Strategy 2
191+
- 2–3 steps broken or flow structure partially changed β†’ Strategy 3
192+
- 3+ steps broken, or unclear root cause β†’ Strategy 4
193+
- Flow used for profiling comparison (must be identical) β†’ Strategy 4
194+
195+
### 10.4 Verify and Bound Retries
196+
197+
After applying a correction, re-run `flow-execute` to verify.
198+
199+
- If it succeeds β†’ done. Report what changed (e.g. "Fixed step 4: updated tap coordinates from 0.5,0.35 to 0.5,0.42").
200+
- If it fails at a **different** step β†’ return to Β§10.2 for a second attempt.
201+
- If this is already the second correction attempt β†’ **stop**. Report the diagnosis to the user and recommend a full re-record or manual investigation.
202+
203+
**Hard cap: 2 correction cycles.** Do not enter an unbounded fix loop.
204+
205+
### 10.5 Making Flows Resilient
206+
207+
Apply these when recording new flows to reduce future breakage:
208+
209+
- **Echo expected state, not just actions.** Write `"On Settings > General screen, about to tap About"` not `"Tap About"`. During diagnosis these tell you what the screen _should_ look like.
210+
- **Add screenshot steps after critical navigation.** Insert `screenshot` steps after screen transitions. These produce images in the flow result you can inspect during diagnosis.
211+
- **Write specific executionPrerequisites.** `"App on home tab, user logged in, simulator UDID is <X>"` β€” not `"App running"`. Verify with `screenshot` + `describe` before acknowledging.
212+
- **Prefer launch-app / open-url over navigation chains.** Deep links are more resilient to layout changes than tap sequences.
213+
- **Echo accessibility labels for coordinate taps.** When recording a tap, add an echo with the target's label or testID: `"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.

0 commit comments

Comments
Β (0)