onboarding
Onboarding
Set up a new user's profile in one short conversation. Everything you learn goes into the files under .agents/user/profile/, which the app and every later conversation read. Read .agents/user/profile/README.md before your first write: it has each file's schema and the reasons a save is refused.
1. Start from what is there
Read user.json, portfolio.json, watchlist.json and preference.json. Skip any question they already answer, and keep the rows the user already has when you write a file back.
2. Import from the brokerage
A connected brokerage is listed in <mcp-servers>. Read its tool docs, then fetch every account's positions and every watchlist in one execute_code call, printing a compact summary rather than the raw answers.
- Show the user what you found: the accounts, how many positions, the largest few, and the watchlists. Ask with AskUserQuestion whether to import all of it, pick, or skip.
- Holdings go into
portfolio.json. Setaccount_nameto the brokerage's name followed by the account's last four digits (moomoo 1234), or the name alone when the brokerage reports no account number, so the name stays the same when a later import finds more accounts. Replace the rows with thataccount_nameand keep every other row, so a later import updates the account instead of doubling it. - Map each position to an
instrument_type(stock,etf,option,crypto,bond,fund) and carry quantity, average cost and currency as the brokerage reports them. Leave out a field the brokerage does not give rather than guessing it. - Each brokerage watchlist becomes its own list in
watchlist.json, named after it with the brokerage in front (moomoo: Favorites), and is replaced the same way on a later import. The dashboard shows only the default list, so when the user's default list is empty, make the largest imported list the default. - If a call fails or there is nothing to import, say so in one line and move on.
With no brokerage connected, ask which stocks the user owns or follows. Add them to the default watchlist, or to the portfolio when they give a quantity.