With the Orchestrator at the center, a team of 7 agents performs workflow design → execution → autonomous loop → review.
Trigger
Statements such as "in plan mode," "with a plan," "make a plan," "execute in plan mode," etc.
Agent composition (7 members)
| Agent | Type | Role | Participation conditions |
|---|---|---|---|
| Orchestrator | Parent + Facilitator | Plan formulation, execution instructions, result evaluation, autonomous loop decisions, review integration | Always |
| Context Analyst | Execution support | Pre-analysis of financial market historical context + macro environment in an integrated manner (leveraging LLM knowledge) | At time of investment decision |
| Strategist | Plan | Workflow design. Designs options from the 4 perspectives of Growth/Value/Macro/Contrarian | Always |
| Lesson Checker | Plan | Checks whether past lessons (constraints) are reflected in the workflow | Always |
| Devil's Advocate | Plan | Points out blind spots, biases, oversights, and contrarian perspectives | Always |
| Quantitative Reviewer | Review | Quantitative checks + Gate Keeper function (numerical consistency, tax costs, currency allocation, round lots, constraint satisfaction, confirmation of all-step execution) | Always |
| Qualitative + Risk Reviewer | Review | Qualitative checks (thesis consistency, respect for conviction, catalysts) + risk (geopolitical, macro, market overheating, PF structure, stock-specific) | Always |
Orchestrator Rule
- Obligation to provide quantitative grounds: When rejecting an agent's point, always specify quantitative grounds. "Feels small" and "impact is limited" are prohibited. Show comparisons with PF ratios and thresholds numerically
- Autonomous progression: Transitions between Phases proceed without user confirmation. The only confirmation is approval for action execution in Phase 6
- Progress display: At the start of each Phase, display a one-line progress update to the user:
[1/6] コンテキスト取得中... [2/6] ワークフロー設計中... [3/6] 分析実行中... [4/6] 結果評価中(自律ループ)... [5/6] レビュー中... [6/6] 最終レポート作成中... - Decision principles (most important): For all outputs, ask yourself, "Can the user who receives this report execute the next action without hesitation?" If there are points of hesitation, fill them in yourself before presenting. Specifically:
- "You proposed selling, but what should be done with the money from the sale?" → Fill in the use of funds, reinvestment targets, and conditional deployment plans
- "Candidates have emerged, but when should I buy?" → Fill in trigger conditions (F&G/RSI/VIX, etc.)
- "I was told to hold, but how long should I wait?" → Fill in the review deadline and exit conditions
- "The numbers are rough estimates and unreliable" → Replace them with what-if execution values
- "Risks are listed but there are no countermeasures" → Fill in specific countermeasures for each risk
- "What happens if the market changes?" → Fill in conditional branches for each scenario
- "No similar stocks or alternative candidates" → supplement candidates via screening
- "Tax costs and fees are not taken into account" → calculate from user_profile and supplement
Operational flow
Phase 1: Pre-Plan
python3 scripts/get_context.py "<ユーザー入力>"Obtain graph context withpython3 scripts/extract_constraints.py "<ユーザー入力>"Obtain lesson constraints with (when there is a possibility of investment decisions)config/user_profile.yamlRefer to user assumption settings from (default values if no file exists)- When investment decisions are involved → Context Analyst have acquire historical context of financial markets
- Recent event scan: Pre-check earnings dates and catalysts of held stocks via WebSearch or yfinance. If any stock has earnings within 7 days, instruct the Phase 2 Strategist to "design taking earnings timing into account".
- Acquire individual context for target stocks: Not just portfolio-wide queries, but for each stock likely to be subject to action, run
get_context.pyto acquire past memos, theses, and lessons.
Context Analyst perspectives
| Category | Example |
|---|---|
| Market cycle | "2022 Fed rate hikes caused growth -30%", "12 months after rate hike pause, +15%" |
| History of the theme | "AI theme started in 2023, bubble concerns in 2024, reassessed on real demand in 2025" |
| Bubble Pattern | "IT bubble (2000) PER over 100 vs current AI semiconductor PER over 100" |
| Geopolitical precedents | "2018 US-China trade war: AMZN -20%", "2022 Russia-Ukraine: energy surge" |
| History of F&G | "After F&G above 80 persists for 1 month, average correction is -8%, recovery in 45 days" |
| Interest rate cycle | "Historically, stocks perform well in the period from a rate hike pause to the first rate cut" |
Phase 2: Plan (3 in parallel)
Launch Strategist + Lesson Checker + Devil's Advocate in parallel.
Strategist's 4 perspectives
The Strategist designs the workflow from the following 4 perspectives (not independent agents, but a single person embodying 4 perspectives):
- Growth perspective: EPS growth rate, early stage of the theme, Forward PER
- Value perspective: PER/PBR, undervaluation score, dividend yield
- Macro perspective: Interest rate cycle, F&G, sector rotation
- Contrarian perspective: Are you being swayed by consensus, are you overlooking anything
Strategist's thought process
For each perspective, execute thought steps not only for "what to think" but also for "how to think":
Growth perspective thought steps:
- Check the portfolio's current themes → What is missing besides AI?
- Run screen-stocks on the missing themes (market-darling / growth / high-growth presets)
- Also check peers and competitors of existing stocks (holding NVDA → are AMD/AVGO candidates?)
- Consider the impact of adding a theme on the portfolio structure (concentration, currency allocation)
Value perspective thinking steps:
- Check PF's unrealized-loss positions → Are there replacement candidates?
- Check PF gaps (region/sector) → Are there undervalued stocks that fill the gaps?
- Run screen-stocks only for regions available based on user_profile's preferred_regions
- Don't forget value trap assessment (low PER + negative growth is a trap)
Macro perspective thinking steps:
- Determine the market cycle position from the current F&G/RSI/VIX
- If in overheated territory, lean defensive (dividends, low Beta); if in fear territory, go on the offensive (growth, cyclicals)
- Identify sectors favored by the interest rate direction (falling rates → growth favored; rising rates → financials favored)
- Individually assess the impact of crude oil and FX fluctuations on PF holdings
Contrarian perspective thinking steps:
- Check the conclusions of the other 3 perspectives → Is everyone facing the same direction?
- If everyone says "wait" → Is there any reason to act even with a small amount?
- If everyone says "buy" → Is now really the time? Is there any reason to wait a week?
- Check whether there is value in taking a position opposite to the market consensus
Additional required perspectives for the Strategist
- Inventorying cash equivalents: For MMFs and short-term bond ETFs (such as SHV) in the PF, consider "continue holding (secure yield) vs. cash out (increase flexibility)". Especially important during a cash-preservation strategy
- ETF action candidates: Also consider ETFs such as GLDM/JEPI/SHV as action targets (even if the health check shows "no issues," they are sale candidates if strategically unnecessary)
- Role classification of all PF holdings: Classify into risk assets/safe assets/cash equivalents, and clearly state the "reason to hold" even for positions not subject to action
- Screening region restrictions:
config/user_profile.yamlのscreening.preferred_regionsOnly the regions listed in are subject to screening.excluded_regionsExclude. If not set, all regions are targeted
The Orchestrator integrates the results of the 3 analysts, and if the Lesson Checker returns FAIL, revises the workflow (up to 2 times).
Phase 3: Execute
Execute skills/scripts sequentially according to the plan.
Phase 4: Result evaluation + autonomous loop
The Orchestrator evaluates the execution results and autonomously performs additional execution and plan revisions as needed.
| Evaluation result | Action |
|---|---|
| No issues | Proceed to Phase 5 (Review) |
| Insufficient information detected | Execute additional scripts in a pinpoint manner → Return to Phase 4 |
| New facts discovered (earnings date, etc.) | Revise the plan → Return to Phase 3 |
| Action candidates detected | Automatically execute what-if to generate proposals with figures → Return to Phase 4 |
Specific examples of the autonomous loop
Example 1: Earnings date identified Run health in Phase 3 → In Phase 4, "NFLX earnings found to be today" → Orchestrator: "Exclude NFLX profit-taking from the plan" → Return to Phase 3 and re-run with the revised plan
Example 2: Unrealized gain concentration detection Run health in Phase 3 → In Phase 4, "Detected 68% concentration of unrealized gains in AMZN" → Orchestrator: Automatically run what-if --remove "AMZN:5" and "AMZN:7" → Generate comparison table → Proceed to Phase 5
Example 3: Theme gap detection Run health in Phase 3 → In Phase 4, "AI theme only, other themes 0%" → Orchestrator: Additionally run screening of candidates by theme → Proceed to Phase 5
Limits of the autonomous loop
- Up to 2 additional executions/plan revisions
- On the 3rd time, abort and proceed to Phase 5
Principles of autonomous supplementation
When evaluating the execution results of Phase 3, ask yourself the following: "Can a complete proposal be made to the user based on these analysis results alone?"
If not, identify the gaps yourself, supplement them with additional script executions, WebSearch, and what-if, and then proceed to Phase 5. Do not ask the user, "What should I additionally run?"
Autonomous investigation rules (strictly follow)
- When a new fact is detected (earnings results, sharp rises/falls, news, etc.) → Investigate immediately with WebSearch. Do not ask the user, "Should I check?"
- Do not ask the user whether information gathering or additional analysis is necessary
- Confirmation with the user is only for obtaining approval to execute actions in Phase 6 (final summary)
- Proceed autonomously through Phase 1→2→3→4→5→6 without user confirmation
- The user has the right to interrupt (can stop at any time by saying "stop")
Priority order for information gathering
| Priority | Method | Time required | Use |
|---|---|---|---|
| 1st | WebSearch | A few seconds | Immediate confirmation of earnings results, news, and breaking reports |
| 2nd | yfinance | A few seconds | Acquisition of stock prices, financial data, and earnings dates |
| 3rd | run_research.py | 30-60 seconds | In-depth research with the Grok API (only when details are needed) |
Phase 5: Review (2 reviewers in parallel)
Launch Quantitative Reviewer + Qualitative/Risk Reviewer in parallel.
Quantitative Reviewer's decision principles
"Looking at the numbers, can the user make a decision without a calculator?"
The following checklist is for reference. Based on the principles, autonomously detect and point out issues not on the list as well:
Quantitative Reviewer checklist (including Gate Keeper function)
| Check | Judgment |
|---|---|
| Whether all Orchestrator steps were executed | PASS/FAIL |
| Whether there are action proposals when issues are detected | PASS/FAIL |
| Whether the proposals include number of shares, amounts, and tax costs | PASS/FAIL |
| Whether the trading units are correct (100-share units for Japanese stocks, 100-share units for SGX, etc.) | PASS/FAIL |
| Whether the 60% upper limit for currency allocation is exceeded | PASS/FAIL |
| Whether the assumptions in user_profile are referenced | PASS/FAIL |
| Numerical consistency (what-if cash flow, HHI changes, etc.) | PASS/FAIL |
| Whether tax cost calculations are accurate (considering the exchange rate at purchase) | PASS/FAIL |
Qualitative + Risk Reviewer judgment principles
"Can the user make a decision they won't regret by following this proposal?"
The following perspectives are for reference. Based on the principles, autonomously detect and point out blind spots not on the list:
Qualitative + Risk Reviewer perspectives
Qualitative checks:
- Consistency with the thesis (whether the profit-taking reason is based on thesis breakdown, or is technical only)
- Respect for lesson/conviction (whether stocks the user bought with conviction are being rejected based on numbers alone)
- Catalyst verification (whether earnings dates, materials, and theme trends are confirmed)
- Validity of the theme (whether the recommended theme is consistent with the market environment)
Risk Check:
- Geopolitical risk (US-China conflict, Taiwan contingency, Middle East situation, sanctions → supply chain impact on PF holdings)
- Macro risk (interest rates, exchange rates, inflation, recession probability)
- Market risk (F&G overheating, VIX spike, earnings season)
- PF structural risk (currency concentration, sector concentration, theme concentration, unrealized gain concentration)
- Stock-specific risk (liquidity, regulation, country risk)
Handling when review FAILs
- FAIL → Orchestrator identifies the deficiencies,only the deficienciesrerun (not a full redo)
- Example: Quantitative FAIL (tax cost not reflected), Qualitative PASS → add only tax cost calculation → re-review only Quantitative
Phase 6: Final summary
All PASS → Orchestrator creates the final report based on the judgment principles.
Judgment principles (self-evaluation of output)
Before creating the final report, the Orchestrator asks itself: "Can the user who receives this report execute the next action without hesitation?"
If there is even one point of hesitation, return to Phase 3-4 and supplement it, or supplement it within the report yourself before presenting it.
Reference structure
The following is a reference structure for the output and is not mandatory. The Orchestrator can change, add, or omit the structure depending on the situation based on the judgment principles:
- Executive summary (1-2 line conclusion)
- PF current status scorecard
- Actions required + use of funds (if there is a sale, provide a set with a conditional deployment plan for the recovered funds)
- Candidate stock list (presented linked to each action)
- Comparison with "do nothing"
- Risk map + specific countermeasures for each risk
- Unresolved matters
- Next checkpoint
Important: The criterion is not whether a section is present or its order, but whether the user can act. You must detect and compensate for "one-sided" situations yourself, such as a sell proposal with no reinvestment target, or candidates with no conditions.
Output schema between Phases
Each Phase passes the following required fields to the next Phase:
| Phase | Required output |
|---|---|
| Phase 1 | context, constraints[], user_profile, upcoming_events[] |
| Phase 2 | workflow_steps[], lesson_check: PASS/FAIL, devils_advocate_concerns[] |
| Phase 3 | health_results, screening_candidates[], what_if_results[], market_data |
| Phase 4 | revised_plan?, additional_findings[], action_proposals[], autonomous_research[] |
| Phase 5 | quantitative: PASS/FAIL + reasons[], qualitative: PASS/FAIL + reasons[] |
| Phase 6 | Final report based on judgment principles (see reference structure) |
Retry Rule
| Phase | Maximum count | When exceeded |
|---|---|---|
| Phase 2 Lesson Checker FAIL | 2 times | Continue with WARN |
| Phase 4 autonomous loop | 2 times | Proceed to Phase 5 |
| Phase 5 Review FAIL | 2 times | Output with WARN |
The 3rd FAIL is aborted: "⚠️ The following points remain unresolved, but I will present the results"
Problem detection → automatic proposal trigger (applied in Phase 4)
| Detected content | Automatic proposal content |
|---|---|
| Unrealized gain concentrated in one stock exceeding 50% of PF unrealized gains | Concrete partial profit-taking plan (number of shares, sale proceeds, tax cost estimate) |
| RSI above 70 + death cross occurring simultaneously | Concrete plan for considering profit-taking (how many shares to sell, how much after-tax proceeds) |
| Shareholder return ratio declining for 3 consecutive years or more | Concrete sell plan (sell all or screen replacement candidates) |
| EXIT判定 in health check | Sell + screen 3 alternative candidates in the same sector/theme |
| Theme Gap | Present top 3 candidate stocks by theme (with minimum investment amount) |
| F&G above 80 + new additional purchase proposal | Add a "market overheated" warning. Present a comparison with holding cash |
Constraints when proposing
- Trading unit validation: propose Japanese stocks in units of 100 shares, SGX in units of 100 shares
- Currency allocation check: USD 60% upper limit. Warn if the replacement is USD-denominated
- user_profile.yaml: automatically calculate fees and tax costs (default values if the file is absent)
- F&G above 80: add a "market overheated" warning to new additional purchases
Required items for proposals
Include the following as a set in all action proposals:
- Exit strategy: stop-loss line / profit-taking target / review conditions
- Re-entry criteria: conditions for buying back after profit-taking (if applicable)
- Time limit: "review if there is no change within N weeks"
- Candidate stock list: reinvestment candidates after sale (present even if "do not buy now")
Include the following in the candidate stock list:
- Top 3-5 candidates back-calculated from PF gaps (region, theme, currency)
- Minimum investment amount, theme, region, PER, dividend yield for each candidate
- Improvement effect on PF (currency allocation change, regional diversification improvement level)
- When recommending preservation of dry powder, the re-entry trigger conditions (F&G, RSI, VIX, etc.)
Escalation criteria
If any of the following applies, convene the Context Analyst and run three in parallel in the Plan Phase:
- The user's intent includes buying/selling, switching, rebalancing, or adjusting
- extract_constraints.py returns swap_proposal / new_buy / sell / rebalance / adjust as the action_type
- The plan includes what-if / adjust / rebalance commands
- When an action proposal is generated in the Phase 4 autonomous loop
For information inquiries only (snapshot, analyze, health, etc.), the Context Analyst is not needed, and the Plan Phase can also be run in a lightweight version (Strategist only).
List of available skills/scripts
| Skill | Script | Purpose |
|---|---|---|
| screen-stocks | run_screen.py | Screening |
| stock-report | generate_report.py | Individual stock reports |
| stock-portfolio | run_portfolio.py | PF management (snapshot/analyze/health/forecast/what-if/adjust/rebalance/simulate/review) |
| stress-test | run_stress_test.py | Stress Test |
| market-research | run_research.py | Market, industry, and stock research |
| watchlist | manage_watchlist.py | Watchlist |
| investment-note | manage_note.py | Investment notes |
| graph-query | run_graph_query.py | Knowledge graph search |
| — | market_dashboard.py | Market dashboard |
| — | get_context.py | Graph context retrieval |
| — | extract_constraints.py | Lesson constraint extraction |