Interactive workspace initialization — asks user for stock, verifies via web search, creates workspace with config
Guide the user through setting up a new company research workspace. Ask which stock they want to analyze, verify the company identity via web search, then create the workspace directory and config file.
You MUST complete this step BEFORE outputting any text to the user. Do NOT emit any prompt until you know the language setting.
Read config.yaml (project root, fall back to config.example.yaml). Check language field:
ch → all user-facing prompts in Chineseen (default) → all prompts in EnglishIf language is ch:
"请输入想分析的公司名称或股票代码(例如:英伟达 或 NVDA):"
If language is : "Which company or stock would you like to analyze? You can enter a ticker symbol (e.g., NVDA) or a company name (e.g., NVIDIA)."
enThe user may provide a ticker, a company name, or an ambiguous input.
Use the WebSearch tool to look up the company:
"{INPUT} stock company name exchange sector""{INPUT} stock ticker symbol exchange"From search results, extract: full company name, ticker, exchange, sector/industry.
Output the result as text and wait for the user's chat reply:
"I found: {COMPANY_NAME} ({TICKER}) — {EXCHANGE}, {SECTOR}. Is this correct? (yes / or type the correct company name or ticker)"
Output as text and wait for reply:
"Report type? (daily / weekly, default: daily)"
Try to get additional details:
python3 -c "
import yfinance as yf, json
t = yf.Ticker('TICKER')
info = t.info
print(json.dumps({
'name': info.get('longName', ''),
'exchange': info.get('exchange', ''),
'sector': info.get('sector', ''),
'industry': info.get('industry', ''),
'market_cap': info.get('marketCap', 0),
'currency': info.get('currency', 'USD'),
'country': info.get('country', ''),
}))
"
If yfinance fails, use the web search results — they are sufficient.
Infer from exchange:
USHKCNJPUKEUIf unclear, ask the user.
If workspaces/{TICKER}/ already exists:
workspaces/{TICKER}/final/{date}/daily_report.md or weekly_report.md (depends on run_mode in the existing status.json)Case A: Today's report already exists — ask: "Today's report for {TICKER} ({date}) already exists. Regenerate? (yes / no, default: no)"
Case B: No report for today — auto-reset: set stages_completed: [], stage: "initialized", run_date: "{date}". Continue with workspace creation.
mkdir -p workspaces/{TICKER}/{profile,raw,normalized,quant,discussion/{analyst_memos,debate/{round_1,round_2}},drafts,reviews,decision,final,exports/{pdf,web},eval} workspaces/shared/market_context/{raw,normalized,indicators}
Read the base config from project root. Prefer config.yaml if it exists (user's local config with real API keys); otherwise fall back to config.example.yaml. Create workspaces/{TICKER}/config.yaml with resolved values:
company.ticker → confirmed ticker (uppercase)company.name → confirmed company namecompany.exchange → resolved exchangecompany.market_profile → inferred marketcompany.sector_profile → resolved sector (lowercase, underscores)run_mode → user's choice (daily/weekly)Keep all other values as defaults.
Write workspaces/{TICKER}/status.json:
{
"stage": "initialized",
"started_at": "<ISO timestamp>",
"updated_at": "<ISO timestamp>",
"ticker": "<TICKER>",
"run_mode": "<daily|weekly>",
"stages_completed": [],
"current_review_loop": 0,
"errors": []
}
Workspace created for {COMPANY_NAME} ({TICKER})
Workspace: workspaces/{TICKER}/
Config: workspaces/{TICKER}/config.yaml
Mode: {daily|weekly} report
Market: {market_profile}
Sector: {sector}
Exchange: {exchange}
Starting pipeline...
CRITICAL: You MUST use the Skill tool to invoke /mm:run. This is the ONLY allowed way to start the pipeline.
Call the Skill tool with exactly these parameters:
"mm:run""workspaces/{TICKER}"Rules:
Skill("mm:mm-orchestrator") or any other skill name — only "mm:run"/mm:run/mm:run handles progress monitor setup, ownership coordination, and pipeline execution. Bypassing it causes the progress checklist to not appear.
The user does not need to type /mm:run separately. The pipeline runs 14 stages: stages 1-12 execute autonomously, stage 13 (user_review) pauses to collect user feedback on the report, then stage 14 (reflect) runs eval and memory.
Note: This skill's behavior must match plugin/commands/init.md exactly. If the init command flow changes, update both files.
language field (en or ch). JSON keys always English.