MagicPay is for approved product workflows that need stored user data and
explicit approval on a login, identity, checkout, donation, subscription,
payment, or other sensitive page. A MagicPay product workflow session is the
parent. Browser launch or attach happens after magicpay start-session and is
recorded as a child resource inside that active session.
Stored values come from user-approved MagicPay Memory items — logins,
identities, payment cards, wallets, and reusable profile fields that the user
saved earlier. This skill's job is to bring those approved values to the
current form through Memory plan-fill and apply-fill without raw values
passing through the LLM prompt. MagicPay hides stored raw values from the
calling model; it does not make an untrusted runtime safe. If the browser,
OS, or shell is compromised, MagicPay alone does not protect against that.
MagicPay also cannot protect secrets that the user already typed into the
agent chat. The safest path is to use saved MagicPay Memory or a MagicPay
request path that keeps raw values out of the agent prompt.
Use this skill when the remaining product work is to:
start-session;magicpay plan-fill;magicpay apply-fill;magicpay fill-field; solve-captcha.
MagicPay works best as a focused companion to a browsing tool. It owns the
protected product workflow; the browser is only the execution resource used
inside that workflow.
When this skill runs in OpenClaw, do not start MagicBrowse as the first
page-control path. The browser process is always a real/native browser; the
choice is which controller drives its pages. Use OpenClaw's built-in
browser page-control tool, guided by the bundled browser-automation skill,
for normal page work when it can drive the same private-CDP browser process
that MagicPay will attach to: opening pages, checking tabs, reading snapshots,
taking screenshots, clicking controls, filling ordinary fields, and continuing
after MagicPay applies Memory fill.
This does not change the MagicPay product order. If the user task is a MagicPay
workflow, run magicpay status or config recovery, then magicpay start-session
before browser preparation. The active MagicPay product workflow is the parent;
OpenClaw's built-in page-control tool is the normal page-work owner when it
owns an attachable browser process. MagicPay binds a browser child only when a
MagicPay browser-dependent command needs one. If the built-in page-control
tool cannot expose or drive a private CDP endpoint for the same browser
process, launch the MagicPay browser child first and drive that same browser
process through an available controller such as MagicBrowse.
Use MagicBrowse only as fallback page-control if OpenClaw's built-in
page-control tool cannot reliably reach, inspect, or continue the same
attachable browser process. Do not switch to MagicBrowse just because MagicPay
mentions browser continuation.
> Plan the browser process and page-control path before page preparation. MagicPay fills and
> authorizes only inside its bound browser child: one it launched
> (magicpay launch) or one reachable over an approved private CDP
> endpoint (magicpay attach). Attachability is a property of the browser
> process, not of how it was driven: the browser must have been started
> with remote debugging or by a CDP-owning tool, and CDP cannot be enabled
> on an already-running browser without a restart. A typical already-open
> desktop browser — including one driven through screen control or a
> browser extension — has no such endpoint, so page state prepared there
> is stranded and the flow must be redone. For a MagicPay-bound task,
> confirm the endpoint exists before opening the first page; if none is
> available, launch the child with magicpay launch and prepare pages in
> that browser (for example through magicbrowse attach to the same
> endpoint).
> Consequential actions require matching typed approval. Before any submit,
> protected action, purchase, login, identity submission, account change, or
> other consequential action, get the matching typed MagicPay approval:
> authorize-payment, sign-message, or confirm-action. After typed
> approval, proceed with exactly that action; do not ask for a second approval
> unless the approved page facts changed. MagicPay fills planned fields only;
> the page-control owner handles continuation.
> Payment authorization facts are collected by the agent. Before
> magicpay authorize-payment, collect visible amount, currency,
> recipient, and optional description and recurring from the current
> page and the user's task. Ask the user when the amount, currency, recipient,
> recurring status, or task/page facts are ambiguous. Do not change existing
> itemRef selector behavior; itemRef remains a selector, not an action
> param. A successful authorize-payment covers the matching payment form
> fill and final Pay/Submit action while those facts stay unchanged.
> Fill and hand back. Use magicpay plan-fill to build a value-free
> Memory plan, then magicpay apply-fill to materialize approved values and
> write the planned fields. MagicPay stops before final commitment controls.
> Continue the browser task with the page-control owner. When the runtime has
> native page-control available and it drives the same browser process, keep
> that path as the normal continuation owner.
> Product session first. Normal MagicPay product work starts with
> magicpay status or config recovery, then magicpay start-session. Only
> after the active product workflow exists should you run magicpay launch or
> magicpay attach to bind a browser child. Do not launch or attach
> a standalone browser as the first MagicPay product step. This same
> product-session-first order applies even when native page-control is
> used for page preparation and continuation.
> Approval is channel-neutral. A pending MagicPay approval can be completed
> in MagicPay web/mobile UI or by OTP when the user chooses that channel. Do
> not ask for OTP before a pending approval request exists, do not claim OTP is
> mandatory, and do not reveal, store, repeat, or summarize OTP digits.
> Credential and browser authority are sensitive. Do not print, log, or
> share MAGICPAY_API_KEY, the local MagicPay config file
> (~/.magicpay/config.json by default or $MAGICPAY_HOME/config.json), or
> CDP endpoints.
> Memory refs and item ids are operational refs: pass them only between
> MagicPay commands; do not show them to the user, include them in reports, or
> send them to external tools.
> Use magicpay attach only for a private browser/session the user approved
> for this task, and only inside the active product workflow. If the machine
> or workspace is shared or compromised, stop and ask the user to
> rotate/revoke the key.
> Browser cleanup is separate. MagicPay owns the protected workflow, not
> the browser. magicpay close closes or clears the browser child while
> keeping the product workflow active. magicpay end-session completes only
> the MagicPay workflow and deliberately leaves browser teardown to the browser
> owner unless the user explicitly approved cleanup.
> Memory plans stay value-free. magicpay plan-fill observes the current
> page, fetches value-free Memory descriptors, and asks the Memory matcher for
> semantic target matches. It must not receive raw values, precomputed target
> matches, catalogs, materializers, or browser writers from the agent. If the
> matcher is unavailable, fail closed and surface that state.
> Provider-backed cards need payment authorization before reveal.
> magicpay plan-fill may report a non-blocking blocker with
> kind: "payment_card.authorization_required" when MagicPay Memory has a
> provider-backed payment card but the active workflow session has not been
> authorized to reveal card handles. This is not a matcher failure and not
> permission to inspect, infer, print, or ask the user for PAN/CVV. If that
> card is needed for the payment, collect the visible payment facts and run
> magicpay authorize-payment; after approval, rerun plan-fill and then
> apply-fill for the current page.
> CAPTCHA solving is recovery-only. Only call
> magicpay solve-captcha [--timeout when a real CAPTCHA is confirmed]
> present on the current browser child inside the active MagicPay workflow. It
> must not be used as generic page waiting or challenge detection. When
> continuing through MagicBrowse after a successful solve, call
> magicbrowse mark-captcha-resolved before the next
> magicbrowse act "continue...".
Use the highest-level safe fill path that can explain its result. Do not jump
straight to direct browser typing or to fill-field.
magicpay plan-fill on the current bound browser page. Use --planner-hint only for short context
about the form. Never pass raw values, target matches, target lists, Memory
catalogs, materializers, or browser writers.
magicpay apply-fill. It materializesapproved values internally, fills only planned fields, and stops before any
final commitment control. If apply-fill asks the user to choose between
Memory candidates, show only the safe labels and continue with
magicpay choose-memory --choice .
binding became stale, a target disappeared, or apply-fill reports
target_not_found / stale_target, refresh or re-observe the page and
return to plan-fill. Do not reuse the old plan.
fill-field only for targeting recovery. If plan-fill / apply-fill missed a visible field or chose the wrong observed target, and
the agent can identify the correct Memory item/field plus the current
observed targetRef, run:
```bash
magicpay fill-field --request-json '{"assignments":[{"itemRef":"mem_profile","fieldRef":"field.email","targetRef":"selector:1"}]}'
```
fill-field accepts value-free assignments only: itemRef or itemId,
fieldRef, targetRef, and optional projectionPart. It fetches the
current Memory catalog, resolves backend handles, refreshes target state,
validates approvals/provider state/target writability/projection, and
writes through the same browser bridge as apply-fill. It returns the same
apply-style result shape: status, fields, fieldDiagnostics, and
completedLedger.
fill-field is not a fallback for matcher_unavailable, missing browser connection, auth/CAPTCHA walls,
missing Memory, denied approval, unsupported targets, or raw-value entry.
For those states, follow references/statuses.md: rebind, replan, ask the
user, use typed approval, or stop.
Use projectionPart only for a visibly split typed value target. Supported
parts are year, month, day, country_code, national_number, given,
family, segment_1, segment_2, segment_3, and segment_4.
Projection diagnostics mean the part or target shape is unsafe; refine only
from visible evidence, otherwise ask, skip optional fields, or stop.
MagicPay Memory holds saved items and field descriptors. The public fill path
uses value-free descriptors and opaque refs during planning, then materializes
only the approved values needed by the active plan during apply.
Treat a Memory item as a user-owned reusable data record, not as a single field.
The item label is the human-readable name for that record and should describe
the group of fields that future fills may choose together. Good labels name the
purpose: Airline login, Traveler profile, Home shipping address, Wallet,
or Facts about user. Do not put raw values in the label, do not use one field
name as the item label when the item contains a broader record, and do not create
one item per field unless the user is saving one truly standalone fact.
Use Facts about user only for global profile facts with no narrower record.
Use narrower labels for site/account-specific logins, traveler profiles,
addresses, wallets, payment-related records, and other coherent groups. When
chat-provided reusable facts need saving, list Memory items first, update the
semantically suitable editable item, and create a new item only when no suitable
record exists.
The user's MagicPay Memory holds reusable items with human field labels,
human-readable hints, opaque fieldRef identifiers, and optional public value
types. Use labels such as Login email, Password, Full name, `Date of
birth, or Phone for user-facing text and matcher evidence; use fieldRef`
for existing-field identity in update/apply flows. Hints explain when a field is
useful without containing raw values.
Public editable value types are only:
date — canonical value YYYY-MM-DD;phone_number — canonical E.164 value, for example +14155550100;person_name — non-empty full name string.When no value type is present, Memory fill treats the field as ordinary direct
fill and does not split or normalize it. Internal card value types such as
payment_card_number and payment_card_expiry belong only to provider-backed
payment-card Memory surfaced by MagicPay after authorization; do not set or
request those types through public Memory CRUD.
Do not assume emptiness or abundance from prior context. If you need to know
whether saved Memory can fill the current page, run magicpay plan-fill and
branch on its result. If you need to list Memory items manually, pass the
current page URL with magicpay list-memory-items --url ; use
--all-sites only for explicit global Memory review or editing. Do not read or
print raw Memory contents yourself.
For Memory CRUD, list first and use stable refs. Create a new item with
magicpay create-memory-item --item-label plus field shortcuts such as
--text "Login email=ada@example.com", --date "Date of birth=1815-12-10",
--phone "Phone=+14155550100", or --person "Full name=Ada Lovelace".
Use --secret-text, --secret-date, --secret-phone, or --secret-person
when the new field should be hidden in display/logging. For existing fields,
never address by label: use `magicpay update-memory-field --field-ref
or magicpay delete-memory-field --field-ref
magicpay add-memory-field --item-id
to add one field to an existing item. --secret true|false is mutable
display/logging metadata for any field, not encryption. Use raw JSON only when
the user explicitly asks for a service/debug payload.
Provider-backed payment cards are special: before payment authorization,
plan-fill can show that a card exists through an
authorization_required Memory availability entry, but it does not expose
card field handles. Card handles appear only inside the active MagicPay
workflow session after the matching payment authorization is approved.
magicpay CLI on PATH. Install the reviewed package version with npm i -g @mercuryo-ai/magicpay-cli@latest if missing.
magicpay init (or MAGICPAY_API_KEY in the environment). Sign up at
https://agents.mercuryo.io/signup.
magicpay launch [url] after start-session, or use an approved private CDP
endpoint for magicpay attach inside the active session.
MagicPay workflow commands print one JSON result object to stdout. Branch on
fields in this order: success, then
outcomeType, then command-specific error, reason, or fill.outcome.
Use message and prose reason as user-facing text only. Do not parse text
to discover whether a result is memory_fill_required,
secret_validation_failed, verification_required, or another machine code.
Contract: `status → start-session → (launch [url] | attach
plan-fill → apply-fill → [typed approval] → end-session`. Page work between
MagicPay steps stays with the page-control owner.
magicpay status. If it reports a missing key, a cliUpdate, or still fails after init (in which case run
magicpay doctor), follow the recovery rules in
magicpay start-session [name]. This createsthe product session and product telemetry root before any browser child is
required.
magicpay launch [url] when the flow has not started in a browser yet; the new child is the browser for the whole flow, and the launch
result includes the child's cdpUrl so a page-control tool can
drive the same browser (for example magicbrowse attach );
magicpay attach when the page was already prepared in aCDP-reachable browser: your own page-control session, or a private
browser the user approved for this task. launch cannot adopt a page
prepared elsewhere;
needs refresh.
magicpay solve-captcha [--timeout .]
run magicbrowse mark-captcha-resolved, then `magicbrowse act
"continue...". If that act returns needs_handoff` again, the wall
is not actually cleared — surface to the user, do not re-mark.
Otherwise (continuation stays in MagicPay or another browser tool)
continue the normal browser or MagicPay form flow on the same page.
magicbrowse mark-captcha-resolved. Surface the failure to the user.
magicpay plan-fill.If the planner needs context, pass a short human-readable
--planner-hint . Do not pass page targets, target matches, Memory
catalogs, raw values, materializers, or browser writers.
payment_card.authorization_required or a warning that the Memory store
contains a payment card but authorization is required, treat it as
machine state from the backend: the card exists, but card handles are not
available yet in this workflow session. If the current task needs that
card, collect amount, currency, recipient, optional description,
and optional recurring, run magicpay authorize-payment, then rerun
plan-fill.
magicpay apply-fill.MagicPay refreshes the page state, materializes approved Memory values, and
fills only planned fields through the browser bridge. It does not click Pay,
Book, Send, Submit, or other final commitment controls.
apply-fill reports memory.choose_candidate, use candidate labelsonly for explaining choices to the user. Submit the selected backend-owned
choiceId with magicpay choose-memory --choice , then let
that command continue the fill.
the wrong element, follow the Fill Recovery Ladder. Use
magicpay fill-field --request-json only with value-free Memory refs
and a currently observed targetRef; never pass raw values or use it as a
replacement for plan-fill.
state first (observe or the equivalent) — success is not "fields were
filled"; keep going only from the fresh visible form state. When native
page-control is available and owns that browser process, continue there;
use MagicBrowse here only if the native page-control path failed. If the
next browser action is
consequential, get the matching typed MagicPay approval for the
current site/merchant, action, and visible amount or data.
amount, currency, recipient, and optional description and recurring, then run
`magicpay authorize-payment --amount
--recipient . Use --item-ref` only as the existing Memory item
selector. After success, continue with that exact payment and do not
ask again before final Pay/Submit unless amount, currency, recipient, or
recurring status changed.
magicpay sign-message --item-ref .
After success, sign that exact message; ask again if the message changed.
use magicpay confirm-action --summary .
--return-pending to the typedaction command. Tell the user they can approve the same request in
MagicPay UI or provide the OTP they received. If they provide OTP, run
magicpay confirm-otp --otp , then run magicpay wait-request.
If they approve in MagicPay UI, skip confirm-otp and still run
magicpay wait-request.
proceed or stop. Do not invent values or run a deterministic field matcher.
magicpay end-session once the sensitive stepis complete. This does not define browser cleanup. Return page control to
the page-control owner, or run magicpay close only when you need to close
or clear the browser child while keeping product workflow semantics separate.
When the flow deviates — changed forms, denied approvals, ambiguous forms,
page changes mid-fill — consult
Ask the user only when:
magicpay launch nor anapproved private CDP endpoint is available inside the active session;
action, or other consequential action is next and there is no matching typed
approval for the unchanged current facts;
a browser/page correction;
currency, merchant/payee recipient, recurring status, or a conflict between
the user's task and the visible checkout page;
terminally blocked;
human choice.
The Hard Rules above stay in force; these are the day-to-day defaults not
already stated there.
pass them through chat, reports, or public command arguments.
magicpay status as the normal readiness check; doctor is not astartup step.
reconstructing it manually through lower-level commands.
label, field type, field key, or refs.
by runtime output. For CLI updates, only use
npm i -g @mercuryo-ai/magicpay-cli@latest.
Open an extra reference only when it helps:
flow, browser child binding, recovery, changed-form sequence, and stop
conditions.
sensitive-action outcomes, including session_stop.
safety rules.
If a term (itemRef, fieldRef, targetRef, session_stop, etc.) is
unfamiliar, check references/commands.md and
references/statuses.md — terms are defined where
they are used.
共 13 个版本