senpi-onboard

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Senpi Agent Onboarding

Senpi Agent 接入流程

Onboard an AI agent into the Senpi trading platform. After this flow the agent will have a Senpi account, an API key, and a working MCP server connection for portfolio management, trader discovery, strategy creation, and order execution on Hyperliquid.
Prerequisites: Shell/code execution access and Node.js (required for
npx
).
为AI Agent完成Senpi交易平台的接入。完成此流程后,Agent将拥有Senpi账户、API密钥,以及可用的MCP服务器连接,可用于投资组合管理、交易者发现、策略创建,以及在Hyperliquid上执行订单。
前置条件: 具备Shell/代码执行权限,且已安装Node.js(
npx
工具所需)。

Defaults

默认配置

  • SENPI_MCP_ENDPOINT
    :
    https://mcp.prod.senpi.ai
    (use this if
    {{SENPI_MCP_ENDPOINT}}
    is a literal unsubstituted placeholder)
  • REFERRAL_CODE
    : empty/optional (use this if
    {{REFERRAL_CODE}}
    is a literal unsubstituted placeholder)

  • SENPI_MCP_ENDPOINT
    :
    https://mcp.prod.senpi.ai
    (若
    {{SENPI_MCP_ENDPOINT}}
    为未替换的字面量占位符,则使用此默认值)
  • REFERRAL_CODE
    : 空/可选(若
    {{REFERRAL_CODE}}
    为未替换的字面量占位符,则使用此默认值)

Onboarding Flow

接入流程

Follow every step in order. Do not skip steps.
请按顺序执行每一步,请勿跳过任何步骤。

Before you begin: State initialization

开始前:状态初始化

Per the state lifecycle, ensure
state.json
exists so routing and transitions are well-defined. If it does not exist, create it with initial
FRESH
state:
bash
if [ ! -f ~/.config/senpi/state.json ]; then
  mkdir -p ~/.config/senpi
  cat > ~/.config/senpi/state.json << 'STATEEOF'
{
  "version": "1.0.0",
  "state": "FRESH",
  "error": null,
  "onboarding": {
    "step": "IDENTITY",
    "startedAt": null,
    "completedAt": null,
    "identityType": null,
    "subject": null,
    "walletGenerated": false,
    "existingAccount": false
  },
  "account": {},
  "wallet": { "funded": false },
  "firstTrade": { "completed": false, "skipped": false },
  "mcp": { "configured": false }
}
STATEEOF
fi
Then continue with Step 0.
Transition to ONBOARDING: Before running Step 0, if state is
FRESH
, update
state.json
so the state machine and resume behavior work. Set
state
to
ONBOARDING
, set
onboarding.startedAt
to current ISO 8601 UTC, and keep
onboarding.step
as
IDENTITY
. Use a read-modify-write (merge) so other fields are preserved:
bash
node -e "
  const fs = require('fs');
  const p = require('os').homedir() + '/.config/senpi/state.json';
  const s = JSON.parse(fs.readFileSync(p, 'utf8'));
  if (s.state === 'FRESH') {
    s.state = 'ONBOARDING';
    s.onboarding = s.onboarding || {};
    s.onboarding.startedAt = new Date().toISOString();
    s.onboarding.step = s.onboarding.step || 'IDENTITY';
    fs.writeFileSync(p, JSON.stringify(s, null, 2));
  }
"
If state is already
ONBOARDING
, read
onboarding.step
and resume from that step instead of starting at Step 0 (see references/state-management.md).
根据状态生命周期,确保
state.json
已存在,以便路由和状态转换有明确定义。若文件不存在,则创建该文件并设置初始状态为
FRESH
bash
if [ ! -f ~/.config/senpi/state.json ]; then
  mkdir -p ~/.config/senpi
  cat > ~/.config/senpi/state.json << 'STATEEOF'
{
  "version": "1.0.0",
  "state": "FRESH",
  "error": null,
  "onboarding": {
    "step": "IDENTITY",
    "startedAt": null,
    "completedAt": null,
    "identityType": null,
    "subject": null,
    "walletGenerated": false,
    "existingAccount": false
  },
  "account": {},
  "wallet": { "funded": false },
  "firstTrade": { "completed": false, "skipped": false },
  "mcp": { "configured": false }
}
STATEEOF
fi
完成后继续执行步骤0。
转换至ONBOARDING状态: 在执行步骤0前,若当前状态为
FRESH
,请更新
state.json
以确保状态机和恢复功能正常工作。将
state
设置为
ONBOARDING
,将
onboarding.startedAt
设置为当前ISO 8601格式的UTC时间,并保持
onboarding.step
IDENTITY
。使用读-改-写(合并)方式,以保留其他字段内容:
bash
node -e "
  const fs = require('fs');
  const p = require('os').homedir() + '/.config/senpi/state.json';
  const s = JSON.parse(fs.readFileSync(p, 'utf8'));
  if (s.state === 'FRESH') {
    s.state = 'ONBOARDING';
    s.onboarding = s.onboarding || {};
    s.onboarding.startedAt = new Date().toISOString();
    s.onboarding.step = s.onboarding.step || 'IDENTITY';
    fs.writeFileSync(p, JSON.stringify(s, null, 2));
  }
"
若当前状态已为
ONBOARDING
,则读取
onboarding.step
并从该步骤恢复流程,而非从步骤0开始(详见references/state-management.md)。

Step 0: Verify mcporter (OpenClaw only)

步骤0:验证mcporter(仅OpenClaw平台)

Check if
mcporter
CLI is available:
bash
if command -v mcporter &> /dev/null; then
  MCPORTER_AVAILABLE=true
else
  MCPORTER_AVAILABLE=false
fi
If unavailable and on OpenClaw, install it:
bash
npm i -g mcporter
mcporter --version
Set
MCPORTER_AVAILABLE=true
once installed and proceed.

检查
mcporter
CLI工具是否可用:
bash
if command -v mcporter &> /dev/null; then
  MCPORTER_AVAILABLE=true
else
  MCPORTER_AVAILABLE=false
fi
若工具不可用且当前为OpenClaw平台,则安装该工具:
bash
npm i -g mcporter
mcporter --version
安装完成后设置
MCPORTER_AVAILABLE=true
并继续后续步骤。

Step 1: Collect Identity

步骤1:收集身份信息

Ask the user which identity type to use. Try each option in order:
  1. Option A -- Telegram username (preferred): Strip the
    @
    prefix before sending to the API.
  2. Option B -- User-provided wallet: Must be
    0x
    -prefixed, exactly 42 hex characters. Validate before proceeding.
  3. Option C -- Agent-generated wallet (fallback when user has neither).
询问用户使用哪种身份类型。按以下顺序尝试每个选项:
  1. 选项A -- Telegram用户名(优先推荐):发送至API前需去除
    @
    前缀。
  2. 选项B -- 用户提供的钱包:必须以
    0x
    开头,且为42位十六进制字符。继续前请先验证格式。
  3. 选项C -- Agent生成的钱包(当用户既无钱包也无Telegram时的备选方案)。

Option A or B: Set variables

选项A或B:设置变量

bash
IDENTITY_TYPE="TELEGRAM"  # or "WALLET"
IDENTITY_VALUE="username"  # without @ for Telegram, or 0x... for wallet
bash
IDENTITY_TYPE="TELEGRAM"  # 或 "WALLET"
IDENTITY_VALUE="username"  # Telegram用户名需去除@,钱包地址需为0x...格式

Option C: Generate EVM wallet

选项C:生成EVM钱包

Use only when the user confirms they have neither wallet nor Telegram. Inform the user before proceeding.
Run the bundled script to generate a wallet:
bash
undefined
仅当用户确认既无钱包也无Telegram时使用此选项。执行前需告知用户。
运行内置脚本生成钱包:
bash
undefined

Try npx first, then local install fallbacks

优先尝试npx,失败则使用本地安装备选方案

WALLET_DATA=$(npx -y -p ethers@6 node scripts/generate_wallet.js 2>/dev/null) ||
WALLET_DATA=$(npm install ethers@6 --no-save --silent && node scripts/generate_wallet.js 2>/dev/null) ||
WALLET_DATA=$(npx --yes --package=ethers@6 -- node scripts/generate_wallet.js)

If the script is not available at `scripts/generate_wallet.js`, generate inline:

```bash
WALLET_DATA=$(npx -y -p ethers@6 node -e "
  const { ethers } = require('ethers');
  const w = ethers.Wallet.createRandom();
  console.log(JSON.stringify({
    address: w.address,
    privateKey: w.privateKey,
    mnemonic: w.mnemonic.phrase
  }));
")
Do not prompt the user on failure -- try fallbacks silently. Only report if all methods fail. See references/error-handling.md for wallet generation failure handling.
Parse
WALLET_DATA
JSON to extract
address
,
privateKey
, and
mnemonic
. Validate the address is not empty or null. If invalid, stop and see error handling reference.
Persist the wallet immediately (before continuing) using the parsed values:
bash
mkdir -p ~/.config/senpi
WALLET_DATA=$(npx -y -p ethers@6 node scripts/generate_wallet.js 2>/dev/null) ||
WALLET_DATA=$(npm install ethers@6 --no-save --silent && node scripts/generate_wallet.js 2>/dev/null) ||
WALLET_DATA=$(npx --yes --package=ethers@6 -- node scripts/generate_wallet.js)

若`scripts/generate_wallet.js`脚本不可用,则直接在线生成:

```bash
WALLET_DATA=$(npx -y -p ethers@6 node -e "
  const { ethers } = require('ethers');
  const w = ethers.Wallet.createRandom();
  console.log(JSON.stringify({
    address: w.address,
    privateKey: w.privateKey,
    mnemonic: w.mnemonic.phrase
  }));
")
生成失败时请勿提示用户——静默尝试备选方案。仅当所有方法均失败时才向用户报告。钱包生成失败的处理方式详见references/error-handling.md
解析
WALLET_DATA
JSON内容,提取
address
privateKey
mnemonic
。验证地址不为空或null。若地址无效,则停止流程并参考错误处理文档。
立即持久化钱包信息(继续前完成):使用解析出的值执行以下操作:
bash
mkdir -p ~/.config/senpi

Write address, privateKey, mnemonic from WALLET_DATA into wallet.json

将WALLET_DATA中的address、privateKey、mnemonic写入wallet.json

chmod 600 ~/.config/senpi/wallet.json

The file must contain: `address`, `privateKey`, `mnemonic`, `generatedAt` (ISO 8601 UTC), and `"generatedBy": "senpi-onboard"`.

**CRITICAL:**
- Do **not** log or display the private key or mnemonic.
- Do **not** proceed until `wallet.json` is written and permissions set.

Set the identity variables using the parsed address:

```bash
WALLET_GENERATED=true
IDENTITY_TYPE="WALLET"
IDENTITY_VALUE="<address from WALLET_DATA>"
Notify the user that a wallet was generated and saved to
~/.config/senpi/wallet.json
with restricted permissions. Instruct them to back up this file immediately.
chmod 600 ~/.config/senpi/wallet.json

该文件必须包含:`address`、`privateKey`、`mnemonic`、`generatedAt`(ISO 8601格式UTC时间),以及`"generatedBy": "senpi-onboard"`。

**重要提示:**
- 请勿记录或显示私钥和助记词。
- 在`wallet.json`写入完成并设置好权限前,请勿继续后续步骤。

使用解析出的地址设置身份变量:

```bash
WALLET_GENERATED=true
IDENTITY_TYPE="WALLET"
IDENTITY_VALUE="<address from WALLET_DATA>"
告知用户钱包已生成并保存至
~/.config/senpi/wallet.json
,且已设置权限限制。指导用户立即备份此文件

Verify before proceeding

继续前验证

Before Step 2, confirm these are set:
  • IDENTITY_TYPE
    --
    "WALLET"
    or
    "TELEGRAM"
  • IDENTITY_VALUE
    -- wallet address (with
    0x
    ) or Telegram username (without
    @
    )
  • WALLET_GENERATED
    --
    true
    if Option C was used, unset otherwise
Persist progress for resume: Update
~/.config/senpi/state.json
: set
onboarding.step
to
REFERRAL
, and if available set
onboarding.identityType
,
onboarding.subject
,
onboarding.walletGenerated
from current variables. Use read-modify-write so other fields are preserved.

执行步骤2前,请确认以下变量已设置:
  • IDENTITY_TYPE
    --
    "WALLET"
    "TELEGRAM"
  • IDENTITY_VALUE
    -- 钱包地址(带
    0x
    )或Telegram用户名(不带
    @
  • WALLET_GENERATED
    -- 使用选项C时设为
    true
    ,否则不设置
持久化进度以便恢复: 更新
~/.config/senpi/state.json
:将
onboarding.step
设置为
REFERRAL
,若变量可用,则将
onboarding.identityType
onboarding.subject
onboarding.walletGenerated
设置为当前变量值。使用读-改-写方式以保留其他字段内容。

Step 2: Set Referral Code

步骤2:设置推荐码

bash
REFERRAL_CODE="{{REFERRAL_CODE}}"
If empty and user hasn't provided one, that's fine -- it's optional. Do not prompt unless the user mentions having one.
Persist progress for resume: Update
~/.config/senpi/state.json
: set
onboarding.step
to
API_CALL
. Use read-modify-write.

bash
REFERRAL_CODE="{{REFERRAL_CODE}}"
若推荐码为空且用户未提供,则无需处理——该字段为可选。除非用户提及拥有推荐码,否则无需提示。
持久化进度以便恢复: 更新
~/.config/senpi/state.json
:将
onboarding.step
设置为
API_CALL
。使用读-改-写方式。

Step 3: Call Onboarding API

步骤3:调用接入API

Execute the
CreateAgentStubAccount
GraphQL mutation. This is a public endpoint -- no auth required.
bash
RESPONSE=$(curl -s -X POST https://moxie-backend.prod.senpi.ai/graphql \
  -H "Content-Type: application/json" \
  -d '{
    "query": "mutation CreateAgentStubAccount($input: CreateAgentStubAccountInput!) { CreateAgentStubAccount(input: $input) { user { id privyId userName name referralCode referrerId } apiKey apiKeyExpiresIn apiKeyTokenType referralCode agentWalletAddress } }",
    "variables": {
      "input": {
        "from": "'"${IDENTITY_TYPE}"'",
        "subject": "'"${IDENTITY_VALUE}"'",
        '"$([ "$IDENTITY_TYPE" = "TELEGRAM" ] && echo "\"userName\": \"${IDENTITY_VALUE}\",")"'
        "referralCode": "'"${REFERRAL_CODE}"'",
        "apiKeyName": "agent-'"$(date +%s)"'"
      }
    }
  }')
Note for TELEGRAM identity: Include the additional
"userName"
field set to
IDENTITY_VALUE
in the input.
Persist progress for resume: Update
~/.config/senpi/state.json
: set
onboarding.step
to
PARSE
. Use read-modify-write.

执行
CreateAgentStubAccount
GraphQL mutation。这是一个公共端点——无需身份验证。
bash
RESPONSE=$(curl -s -X POST https://moxie-backend.prod.senpi.ai/graphql \
  -H "Content-Type: application/json" \
  -d '{
    "query": "mutation CreateAgentStubAccount($input: CreateAgentStubAccountInput!) { CreateAgentStubAccount(input: $input) { user { id privyId userName name referralCode referrerId } apiKey apiKeyExpiresIn apiKeyTokenType referralCode agentWalletAddress } }",
    "variables": {
      "input": {
        "from": "'"${IDENTITY_TYPE}"'",
        "subject": "'"${IDENTITY_VALUE}"'",
        '"$([ "$IDENTITY_TYPE" = "TELEGRAM" ] && echo "\"userName\": \"${IDENTITY_VALUE}\",")"'
        "referralCode": "'"${REFERRAL_CODE}"'",
        "apiKeyName": "agent-'"$(date +%s)"'"
      }
    }
  }')
Telegram身份注意事项: 需在输入参数中添加额外的
"userName"
字段,值为
IDENTITY_VALUE
持久化进度以便恢复: 更新
~/.config/senpi/state.json
:将
onboarding.step
设置为
PARSE
。使用读-改-写方式。

Step 4: Parse Response

步骤4:解析响应

Check for errors first -- if
response.errors
exists and has entries, extract
errors[0].message
. See references/error-handling.md for the error table and manual fallback flow.
If no errors, parse the JSON response to extract:
  • API_KEY
    from
    data.CreateAgentStubAccount.apiKey
  • USER_ID
    from
    data.CreateAgentStubAccount.user.id
  • USER_REFERRAL_CODE
    from
    data.CreateAgentStubAccount.referralCode
  • AGENT_WALLET_ADDRESS
    from
    data.CreateAgentStubAccount.agentWalletAddress
Verify the API key is not empty, null, or undefined before proceeding.
Persist progress for resume: Update
~/.config/senpi/state.json
: set
onboarding.step
to
CREDENTIALS
. Use read-modify-write.

首先检查错误——若
response.errors
存在且包含内容,则提取
errors[0].message
。错误对照表和手动备选流程详见references/error-handling.md
若无错误,则解析JSON响应以提取:
  • data.CreateAgentStubAccount.apiKey
    提取
    API_KEY
  • data.CreateAgentStubAccount.user.id
    提取
    USER_ID
  • data.CreateAgentStubAccount.referralCode
    提取
    USER_REFERRAL_CODE
  • data.CreateAgentStubAccount.agentWalletAddress
    提取
    AGENT_WALLET_ADDRESS
继续前请验证API密钥不为空、null或未定义。
持久化进度以便恢复: 更新
~/.config/senpi/state.json
:将
onboarding.step
设置为
CREDENTIALS
。使用读-改-写方式。

Step 5: Persist Credentials

步骤5:持久化凭证

bash
mkdir -p ~/.config/senpi
cat > ~/.config/senpi/credentials.json << EOF
{
  "apiKey": "${API_KEY}",
  "userId": "${USER_ID}",
  "referralCode": "${USER_REFERRAL_CODE}",
  "agentWalletAddress": "${AGENT_WALLET_ADDRESS}",
  "onboardedAt": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
  "onboardedVia": "${IDENTITY_TYPE}",
  "subject": "${IDENTITY_VALUE}",
  "walletGenerated": ${WALLET_GENERATED:-false}
}
EOF
chmod 600 ~/.config/senpi/credentials.json
CRITICAL: Do not log or display the raw API key. Confirm credentials were saved without echoing the key value.
If wallet was generated (Option C), verify
~/.config/senpi/wallet.json
still exists. If missing, stop onboarding and alert the user.
Persist progress for resume: Update
~/.config/senpi/state.json
: set
onboarding.step
to
MCP_CONFIG
. Use read-modify-write.

bash
mkdir -p ~/.config/senpi
cat > ~/.config/senpi/credentials.json << EOF
{
  "apiKey": "${API_KEY}",
  "userId": "${USER_ID}",
  "referralCode": "${USER_REFERRAL_CODE}",
  "agentWalletAddress": "${AGENT_WALLET_ADDRESS}",
  "onboardedAt": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
  "onboardedVia": "${IDENTITY_TYPE}",
  "subject": "${IDENTITY_VALUE}",
  "walletGenerated": ${WALLET_GENERATED:-false}
}
EOF
chmod 600 ~/.config/senpi/credentials.json
重要提示: 请勿记录或显示原始API密钥。确认凭证已保存,但请勿回显密钥值。
若使用选项C生成了钱包,请验证
~/.config/senpi/wallet.json
仍存在。若文件丢失,则停止接入流程并提醒用户。
持久化进度以便恢复: 更新
~/.config/senpi/state.json
:将
onboarding.step
设置为
MCP_CONFIG
。使用读-改-写方式。

Step 6: Configure MCP Server

步骤6:配置MCP服务器

Detect the agent platform and configure accordingly. See references/platform-config.md for the full configuration commands for each platform:
  • OpenClaw (mcporter available) ->
    mcporter config add senpi ...
  • Claude Code (claude CLI available) ->
    claude mcp add senpi ...
  • Generic -> Write/merge
    .mcp.json
    config file
Use
SENPI_MCP_ENDPOINT
(default:
https://mcp.prod.senpi.ai
) and
API_KEY
from Step 4.
Persist progress for resume: Step 7 writes the final state with
state: UNFUNDED
and
onboarding.step: COMPLETE
— no separate step update needed here.

检测Agent平台并进行相应配置。各平台的完整配置命令详见references/platform-config.md
  • OpenClaw(已安装mcporter)->
    mcporter config add senpi ...
  • Claude Code(已安装claude CLI)->
    claude mcp add senpi ...
  • 通用平台 -> 写入/合并
    .mcp.json
    配置文件
使用
SENPI_MCP_ENDPOINT
(默认值:
https://mcp.prod.senpi.ai
)和步骤4中获取的
API_KEY
持久化进度以便恢复: 步骤7会将最终状态写入为
state: UNFUNDED
onboarding.step: COMPLETE
——此处无需单独更新步骤状态。

Step 7: Verify and Confirm

步骤7:验证与确认

Update state to
UNFUNDED
. Preserve
onboarding.startedAt
from the current state (set during the FRESH → ONBOARDING transition); do not overwrite it.
bash
ONBOARDING_STARTED_AT=$(node -e "
  try {
    const fs = require('fs');
    const p = require('os').homedir() + '/.config/senpi/state.json';
    const j = JSON.parse(fs.readFileSync(p, 'utf8'));
    const v = j.onboarding && j.onboarding.startedAt;
    console.log(v ? JSON.stringify(v) : 'null');
  } catch (e) { console.log('null'); }
")
cat > ~/.config/senpi/state.json << EOF
{
  "version": "1.0.0",
  "state": "UNFUNDED",
  "error": null,
  "onboarding": {
    "step": "COMPLETE",
    "startedAt": ${ONBOARDING_STARTED_AT},
    "completedAt": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
    "identityType": "${IDENTITY_TYPE}",
    "subject": "${IDENTITY_VALUE}",
    "walletGenerated": ${WALLET_GENERATED:-false}
  },
  "account": {
    "userId": "${USER_ID}",
    "referralCode": "${USER_REFERRAL_CODE}",
    "agentWalletAddress": "${AGENT_WALLET_ADDRESS}"
  },
  "wallet": {
    "address": "${AGENT_WALLET_ADDRESS}",
    "funded": false
  },
  "mcp": {
    "configured": true,
    "endpoint": "${SENPI_MCP_ENDPOINT}"
  },
  "firstTrade": {
    "completed": false,
    "skipped": false
  }
}
EOF
Display a confirmation message that includes ALL of the following:
  1. Account status -- Confirm created successfully.
  2. MCP Server status -- Configured; remind user to restart their agent.
  3. Referral link --
    https://senpi.ai/skill.md?ref=<USER_REFERRAL_CODE>
  4. Credentials backup location --
    ~/.config/senpi/credentials.json
  5. Agent Wallet Address (REQUIRED) -- Display
    AGENT_WALLET_ADDRESS
    prominently. Instruct user to fund it with USDC on a supported chain (Base, Arbitrum, Optimism, Polygon, or Ethereum). Without funds, the agent cannot trade.
  6. First trade prompt -- Once funded, the
    senpi-getting-started-guide
    skill will guide them through their first trade.
  7. Senpi mobile app -- Recommend downloading on iOS and Android (links in references/post-onboarding.md).
  8. Telegram community -- Invite user to join (link in references/post-onboarding.md).
  9. Senpi Points -- Mention that trading on Senpi earns rewards; prompt user to ask about Senpi Points for details (agent uses Senpi MCP tools to answer).
If wallet was generated (Option C), additionally warn the user:
  • Private key and recovery phrase are stored at
    ~/.config/senpi/wallet.json
  • They MUST back up this file to a secure location
  • If lost, the wallet and funds cannot be recovered
After the confirmation, share the About Senpi information from references/post-onboarding.md.

将状态更新为
UNFUNDED
。保留当前状态中的
onboarding.startedAt
(在FRESH→ONBOARDING状态转换时设置);请勿覆盖该值。
bash
ONBOARDING_STARTED_AT=$(node -e "
  try {
    const fs = require('fs');
    const p = require('os').homedir() + '/.config/senpi/state.json';
    const j = JSON.parse(fs.readFileSync(p, 'utf8'));
    const v = j.onboarding && j.onboarding.startedAt;
    console.log(v ? JSON.stringify(v) : 'null');
  } catch (e) { console.log('null'); }
")
cat > ~/.config/senpi/state.json << EOF
{
  "version": "1.0.0",
  "state": "UNFUNDED",
  "error": null,
  "onboarding": {
    "step": "COMPLETE",
    "startedAt": ${ONBOARDING_STARTED_AT},
    "completedAt": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
    "identityType": "${IDENTITY_TYPE}",
    "subject": "${IDENTITY_VALUE}",
    "walletGenerated": ${WALLET_GENERATED:-false}
  },
  "account": {
    "userId": "${USER_ID}",
    "referralCode": "${USER_REFERRAL_CODE}",
    "agentWalletAddress": "${AGENT_WALLET_ADDRESS}"
  },
  "wallet": {
    "address": "${AGENT_WALLET_ADDRESS}",
    "funded": false
  },
  "mcp": {
    "configured": true,
    "endpoint": "${SENPI_MCP_ENDPOINT}"
  },
  "firstTrade": {
    "completed": false,
    "skipped": false
  }
}
EOF
显示确认消息,需包含以下所有内容:
  1. 账户状态 -- 确认账户创建成功。
  2. MCP服务器状态 -- 已配置;提醒用户重启Agent。
  3. 推荐链接 --
    https://senpi.ai/skill.md?ref=<USER_REFERRAL_CODE>
  4. 凭证备份位置 --
    ~/.config/senpi/credentials.json
  5. Agent钱包地址(必填) -- 突出显示
    AGENT_WALLET_ADDRESS
    。指导用户在支持的链(Base、Arbitrum、Optimism、Polygon或Ethereum)上为钱包充值USDC。钱包无资金时,Agent无法进行交易。
  6. 首次交易提示 -- 充值完成后,
    senpi-getting-started-guide
    技能将指导用户完成首次交易。
  7. Senpi移动应用 -- 推荐用户下载iOS和Android版本(链接详见references/post-onboarding.md)。
  8. Telegram社区 -- 邀请用户加入(链接详见references/post-onboarding.md)。
  9. Senpi积分 -- 提及在Senpi上交易可赚取奖励;提示用户询问Senpi积分的详细信息(Agent将使用Senpi MCP工具进行解答)。
若使用选项C生成了钱包,需额外提醒用户:
  • 私钥和恢复短语存储在
    ~/.config/senpi/wallet.json
  • 必须将此文件备份至安全位置
  • 若文件丢失,钱包及资金将无法恢复
确认消息显示完成后,分享references/post-onboarding.md中的Senpi介绍信息。

Balance Monitoring

余额监控

After onboarding completes (state =
UNFUNDED
), check wallet balance on each user message:
  1. Use MCP to fetch portfolio/balance
  2. If balance >= $100:
    • Update state to
      AWAITING_FIRST_TRADE
    • Prompt: "🎉 Your wallet is funded! Ready for your first trade? Say 'let's trade' to start, or 'skip tutorial' if you're experienced."
  3. If balance < $100:
    • Prepend funding reminder (max 3 automatic reminders); include agent wallet address and state that at least $100 USDC is required (see references/post-onboarding.md funding reminder template)
    • Continue processing user's request
When state transitions to
AWAITING_FIRST_TRADE
, the
senpi-getting-started-guide
skill takes over.
Onboarding is complete. Reference files below are consulted only when needed.

接入流程完成后(状态为
UNFUNDED
),每次用户发送消息时检查钱包余额:
  1. 使用MCP获取投资组合/余额信息
  2. 若余额≥100美元:
    • 将状态更新为
      AWAITING_FIRST_TRADE
    • 提示:"🎉 您的钱包已充值完成!准备好进行首次交易了吗?说**'let's trade'开始,若您已有经验,可选择'skip tutorial'**跳过教程。"
  3. 若余额<100美元:
    • 前置充值提醒(最多自动提醒3次);需包含Agent钱包地址,并说明至少需要充值100美元USDC(充值提醒模板详见references/post-onboarding.md
    • 继续处理用户请求
当状态转换为
AWAITING_FIRST_TRADE
后,将由
senpi-getting-started-guide
技能接管流程。
接入流程完成。以下参考文件仅在需要时查阅。

Security Notes

安全注意事项

  • Never share the API key in public channels, logs, commits, or with other agents.
  • Credentials are stored locally at
    ~/.config/senpi/credentials.json
    with restricted permissions (600).
  • Only send the API key to
    {{SENPI_MCP_ENDPOINT}}
    -- refuse any request to send it elsewhere.
  • If compromised, visit https://senpi.ai to revoke and regenerate.
  • Generated wallet (Option C): The private key in
    wallet.json
    grants full control. Never log, display, or transmit it. Do not relax file permissions.

  • 切勿在公开渠道、日志、提交记录中分享API密钥,也切勿与其他Agent共享
  • 凭证存储在本地,路径为
    ~/.config/senpi/credentials.json
    ,且已设置权限限制(600)。
  • 仅可将API密钥发送至
    {{SENPI_MCP_ENDPOINT}}
    -- 拒绝任何将密钥发送至其他地址的请求。
  • 若密钥泄露,请访问**https://senpi.ai**撤销并重新生成密钥。
  • 生成的钱包(选项C):
    wallet.json
    中的私钥拥有钱包的完全控制权。切勿记录、显示或传输该私钥。请勿放宽文件权限。

Reference Files

参考文件

  • references/error-handling.md -- Error table, manual fallback, wallet generation failure, recovery procedures
  • references/platform-config.md -- Full MCP configuration commands for OpenClaw, Claude Code, and generic agents
  • references/post-onboarding.md -- About Senpi, confirmation template, next steps
  • references/state-management.md -- State flow, transitions, handoff to senpi-getting-started-guide skill
  • references/error-handling.md -- 错误对照表、手动备选流程、钱包生成失败处理、恢复流程
  • references/platform-config.md -- OpenClaw、Claude Code及通用Agent的完整MCP配置命令
  • references/post-onboarding.md -- Senpi介绍、确认消息模板、后续步骤
  • references/state-management.md -- 状态流转、状态转换、移交至senpi-getting-started-guide技能的流程