Skip to content

Commit 30f50eb

Browse files
docs(agentic): add getting-started for first-time recipe runs (#29426)
## **Description** Adds `scripts/perps/agentic/GETTING_STARTED.md` — onboarding doc for devs who already have a daily simulator + Metro running and want to try the agentic recipe toolkit without breaking their setup. Headline is port + simulator isolation: pick (or create) a dedicated simulator, set `IOS_SIMULATOR` + a non-8081 `WATCHER_PORT` in `.js.env`, copy the wallet fixture, run `yarn a:setup:ios`, verify with `yarn a:status`, then run `provider-smoke.json`. Also documents the `yarn a:*` family and links to `perps-agentic-system-design.md`, `perps-agentic-feedback-loop.md`, `perps-agentic-scripts-quickref.md`, and ADR 0058. ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: ## **Manual testing steps** ```gherkin Feature: agentic getting-started doc Scenario: developer follows the doc on a fresh side simulator Given a developer has their dev simulator + Metro running on 8081 And they have never run an agentic recipe before When they follow the steps in scripts/perps/agentic/GETTING_STARTED.md Then yarn a:setup:ios completes without touching the dev simulator or 8081 And yarn a:status returns a route + selected account And validate-recipe.sh teams/perps/recipes/provider-smoke.json passes ``` ## **Screenshots/Recordings** N/A — docs only. ### **Before** No onboarding entry point for the agentic toolkit. ### **After** `scripts/perps/agentic/GETTING_STARTED.md` walks a first-time user from zero to a passing recipe in ~5 commands. ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [ ] I've included tests if applicable - [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. #### Performance checks (if applicable) N/A — docs-only change. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: documentation-only change with no runtime or build logic modifications. > > **Overview** > Adds `scripts/perps/agentic/GETTING_STARTED.md` to onboard developers to the agentic recipe toolkit, emphasizing **isolated simulator + non-8081 Metro port** setup via `.js.env` (`IOS_SIMULATOR`, `WATCHER_PORT`). > > Documents creating a local wallet fixture, running `yarn a:setup:ios`, validating wiring via `yarn a:status`, and executing a first smoke recipe, plus a quick reference to the `yarn a:*` script family and links to deeper design docs. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 6f46b14. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Nick Gambino <nicholas.gambino@consensys.net>
1 parent e7ec5b0 commit 30f50eb

1 file changed

Lines changed: 101 additions & 0 deletions

File tree

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Getting Started — Agentic Recipes
2+
3+
Run your first recipe on a side simulator without touching the iPhone-16-Pro + Metro you already use to develop.
4+
5+
## Prereqs
6+
7+
You already have the repo cloned, Pods installed, an iOS simulator booted, and Metro on `8081` for daily work. Keep it running. This doc spins up a *second* simulator on a *different* Metro port. `node`, `jq`, `xcrun`, and your wallet seed phrase are the only extras.
8+
9+
## Setup
10+
11+
**1. Create a dedicated simulator + pick a port.** Recommended: a fresh simulator used only for recipes — keeps your dev sim's wallet, history, and notifications untouched and makes it obvious which window is the recipe runner.
12+
13+
```bash
14+
xcrun simctl create "mm-agentic" "iPhone 15" # one-time; reuse the same name forever
15+
```
16+
17+
(Or skip this and pick any non-dev simulator from `xcrun simctl list devices available | grep iPhone`.)
18+
19+
Append to `.js.env` (preflight reads these; they override defaults):
20+
21+
```bash
22+
IOS_SIMULATOR=mm-agentic # the dedicated sim, NOT your dev sim
23+
WATCHER_PORT=8062 # any free port other than 8081
24+
```
25+
26+
**2. Create the wallet fixture.** The recipe needs an unlocked wallet at boot:
27+
28+
```bash
29+
mkdir -p .agent
30+
cp scripts/perps/agentic/wallet-fixture.example.json .agent/wallet-fixture.json
31+
# Edit .agent/wallet-fixture.json — fill in `password` and at least one account
32+
# (type `mnemonic` with a 12-word seed, or `privateKey` with `0x...`).
33+
```
34+
35+
`.agent/wallet-fixture.json` is gitignored. Use a throwaway seed for testnet work.
36+
37+
**3. Run preflight.** Boots the chosen simulator, builds + installs the app on `$WATCHER_PORT`, starts Metro, connects CDP, imports the fixture wallet:
38+
39+
```bash
40+
yarn a:setup:ios
41+
```
42+
43+
Expected tail: `=== Preflight complete ===` with all steps green. Your dev simulator + Metro on `8081` keep running untouched.
44+
45+
**4. Verify the toolkit is wired up.** Do not skip — recipes require all three (Metro, CDP, route) to be live:
46+
47+
```bash
48+
yarn a:status
49+
```
50+
51+
Expected: JSON with a `route` field (e.g. `"Wallet"`) and a selected account address. Empty/error output ⇒ stop and re-check step 3 before running a recipe.
52+
53+
## Run a recipe
54+
55+
```bash
56+
bash scripts/perps/agentic/validate-recipe.sh \
57+
scripts/perps/agentic/teams/perps/recipes/provider-smoke.json
58+
```
59+
60+
What to look for: a Mermaid graph prints, then per-node `pass` lines (`check-testnet → decide-testnet → … → done`), then `summary: pass`. Artifacts (`trace.json`, `summary.json`, `workflow.mmd`) land in the recipe's output dir.
61+
62+
## What to try next
63+
64+
| Recipe | What it does | Notes |
65+
|---|---|---|
66+
| `teams/perps/recipes/app-lifecycle.json` | App launch + route smoke | No funded account needed |
67+
| `teams/perps/recipes/full-trade-lifecycle.json` | Open → TPSL → close on testnet | Needs a funded testnet account in fixture |
68+
| `teams/perps/recipes/reference-decimal-key-screens.json` | Visual decimal/format audit | Produces screenshots |
69+
70+
## Troubleshooting
71+
72+
Re-run `yarn a:status` first when anything looks off — it pinpoints which leg (Metro / CDP / route) is down.
73+
74+
- **`Neither IOS_SIMULATOR nor SIM_UDID is set`**`.js.env` change wasn't picked up. New shell, or check the var name.
75+
- **Preflight booted/built on your dev simulator**`IOS_SIMULATOR` matches the dev sim's name. Pick a different one.
76+
- **CDP timeout, "targets found on 8081 but none on $PORT"**`WATCHER_PORT` collided or wasn't exported. Confirm `.js.env` has a non-8081 port and re-run.
77+
- **`Wallet fixture not found`** — step 2 was skipped or `.agent/wallet-fixture.json` is in the wrong directory (must be repo root).
78+
79+
After a successful run, `xcrun simctl list devices | grep Booted` shows both simulators (dev + recipe) booted.
80+
81+
## The `a:*` script family
82+
83+
`a` is for *agentic* — thin yarn aliases over the same scripts in `scripts/perps/agentic/` that validate-recipe.sh uses. Same plumbing the toolkit uses to drive the app, exposed for humans. Goal is for these to become the default way to launch the app for daily dev once they've fully replaced the legacy `yarn start` / `yarn ios` flow.
84+
85+
| Script | What it does |
86+
|---|---|
87+
| `yarn a:setup:ios` / `:android` | Full clean: deps + build + install + Metro + CDP + wallet (this doc, step 3) |
88+
| `yarn a:ios` / `:android` | Same as `a:setup:*` but skips clean — fast re-launch when build artifacts are warm |
89+
| `yarn a:start` / `a:stop` | Metro lifecycle on `$WATCHER_PORT` |
90+
| `yarn a:reload` | Reload the JS bundle without restarting Metro |
91+
| `yarn a:status` | Health probe (Metro + CDP + route) |
92+
| `yarn a:navigate` | Drive the app to a route from the CLI |
93+
| `yarn a:watch` | Interactive Metro with live log filtering |
94+
95+
## Further reading
96+
97+
- [docs/perps/perps-agentic-system-design.md](../../../docs/perps/perps-agentic-system-design.md) — architecture: CDP bridge, recipe runner, eval refs/flows
98+
- [docs/perps/perps-agentic-feedback-loop.md](../../../docs/perps/perps-agentic-feedback-loop.md) — how recipes plug into the dev/PR loop
99+
- [docs/perps/perps-agentic-scripts-quickref.md](../../../docs/perps/perps-agentic-scripts-quickref.md) — full command reference for everything under `scripts/perps/agentic/`
100+
- [README.md](./README.md) — directory map for this folder
101+
- ADR — [decisions/core/0058-recipe-based-verification-system.md](https://github.com/MetaMask/decisions/blob/main/decisions/core/0058-recipe-based-verification-system.md) — why recipes exist

0 commit comments

Comments
 (0)