agentleFS
KCNyuKCNyu/clawock/skills/portfolio-swarm-review/SKILL.md

portfolio-swarm-review

Skill23 starsChanged 3 months agoMITView on GitHub

Multi-agent swarm review of kcn's current holdings. Inspired by TauricResearch/TradingAgents framework already in workspace — three-tier analysis (analysts → bull/bear debate → risk debate + judge) with confidence scoring. Use for post-close reviews, holiday/next-session planning, pre-add sizing decisions, and any moment where a single-pass review is not enough. For lighter single-shot work, use portfolio-risk-review.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If a leg is stale, name the exact ticker and limit confidence on conclusions involving it.

    line 32
  2. Distinctive:

    Before any role analysis, classify current regime — this calibrates everything downstream:

    line 48
  3. Distinctive:

    Call out asymmetric upside specifically (leverage, catalyst dates, sentiment-vs-fundamentals gaps)

    line 97
  4. Distinctive:

    Every claim tied to a real ticker in the current book

    line 206
  5. Distinctive:

    Don't let high-conviction theme hide a bad structure (e.g.

    line 209

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Portfolio Swarm Review

Multi-agent portfolio review. Structure mirrors the TauricResearch/TradingAgents design — analysts (Tier 1) → researchers (Tier 2) → risk debators + judge (Tier 3). Each tier is distinct in the output; the Judge synthesizes. (The reference repo is no longer cloned locally; the structure is recorded here.)

Required reads

In this order:

  1. /root/.openclaw/workspace/MEMORY.md
  2. /root/.openclaw/workspace/portfolio.json
  3. /root/.openclaw/workspace/INVESTMENT_SOP.md
  4. /root/.openclaw/workspace/TOOLS.md for data chain detail
  5. ../daily-deep-brief/references/technical-playbooks.md before any add / average-down synthesis

Active vs exited comes from portfolio.json alone (shares > 0 / == 0); the hand-maintained summary that used to be step 3 drifted 3.5 months and was deleted (#1067).

Fresh data rule

Refresh quotes before producing conclusions:

/root/.local/bin/clawock analyze-us    # US 7-route fallback
/root/.local/bin/clawock analyze-hk    # HK Tencent + Eastmoney full-batch cross-check/fallback → stooq → yfinance

If a leg is stale, name the exact ticker and limit confidence on conclusions involving it. 00100 only has Tencent — flag explicitly if that leg fails. KR linkage: read the KR names off portfolio.json (shares > 0) each run — 07709/07747 come and go, and SKHY (SK Hynix ADR) is an independent line.

Holdings bucketing — read each run, do not hardcode

Pull live set from portfolio.json (shares > 0). Stable bucket structure; contents drift:

  • US growth / single-name beta — active US non-leveraged growth names
  • US leverage ETF — anything is_leveraged_etf: true
  • US theme / special situation — catalyst-driven names
  • HK lower-beta core — index/sector ETFs (e.g. 03032, 03033)
  • HK single-name — individual equities (e.g. 00100 AI, 02208 wind)
  • HK leverage ETF — 2x/3x recipes (e.g. 07226)

Regime detection (run first)

Before any role analysis, classify current regime — this calibrates everything downstream:

RegimeTriggerImplication for sizing
Trending upIndex ADX > 25, MA20 > MA50, RSI 50-70 across bookMomentum-friendly — leveraged ETF holdable, trim only on overheats (RSI > 75)
Trending downIndex ADX > 25, MA20 < MA50, broad lower lowsRisk-off — leveraged ETF decay accelerates, prefer cash, no add
Range-boundADX < 20, sideways action, RSI mean-reverting around 50Mean-reversion plays — T-only, fade extremes
Volatile / regime changeHigh variance, conflicting MA stacks, sentiment chaosReduce size, widen stops, no convictions until clarity returns

Index proxies: 纳指 / QQQ for US growth book; ^HSTECH for HK tech-heavy book.

Tier 1 — Analysts (parallel)

Four analyst roles, run independently. Mirrors tradingagents/agents/analysts/.

Analyst 1 — Position / Market

  • For each active holding: price vs cost, PnL $ and %, distance to breakeven
  • Technical state: trend, RSI-14, MA20/50 stance, immediate support/resistance
  • Classify: core / tactical / weak / leverage-risk
  • Output: one-line verdict per ticker + strongest/weakest called out

Analyst 2 — Fundamentals

  • Recent earnings / revenue trend for non-ETF names
  • Valuation snapshot (P/E, P/S vs sector and history)
  • Balance sheet headlines for special-situation names (cash runway, debt)
  • For ETFs: underlying basket health, NAV premium/discount, decay since holding date
  • Output: per non-ETF holding — "fair / stretched / cheap"; per ETF — "structurally OK / decay-risk now"

Analyst 3 — News / Sentiment

  • Finnhub news from scripts (analyze_*_stocks.py without --no-news already pulls 7 days + keyword sentiment)
  • For US names: Reddit (r/wallstreetbets + r/stocks JSON, no auth) + clawock web-search "{TICKER} news" --days 7 --bucket research (DeepSeek and Tavily side by side, each labelled)
  • For HK names: 雪球 HK 评论区 + 富途社区 (scrapling StealthyFetcher) + clawock web-search "{中文名} 港股" --days 7 --bucket research (DeepSeek + Tavily)
  • 南向资金 当日 net (web search) for HK macro tone
  • Output per holding: sentiment score -1 to +1 + 1-2 narratives + divergence vs price call-out

Analyst 4 — Cross-Market Linkage

  • US side: 纳指 / 罗素 / SOX tone; theme threads (stablecoin reg for CRCL, space/defense for RKLB, AI infra threads)
  • HK side: 恒科 direction; 南向资金 flow; sector policy (风电 / AI / 监管)
  • Inter-market: US tech overnight → HK tech open relationship; note when the link breaks
  • Output: supportive / neutral / weak tag per chain, single most important inter-market signal

Tier 2 — Bull vs Bear Researchers

Mirrors tradingagents/agents/researchers/. Run after Tier 1; each researcher reads all four analyst reports and argues a position.

Bull Researcher

  • Compose the strongest "hold and add" case using Tier 1 outputs
  • Cite specific analyst findings as evidence (not gut)
  • Identify what would have to be true for the position to work out
  • Call out asymmetric upside specifically (leverage, catalyst dates, sentiment-vs-fundamentals gaps)

Bear Researcher

  • Compose the strongest "trim and avoid" case
  • Cite specific risk findings, decay math, sentiment topping signals
  • Identify the worst plausible outcome and what triggers it
  • Counter the bull's strongest point directly

The output is a debate snippet (not a checklist), 100-200 words each side.

Tier 3 — Risk Debate + Judge

Mirrors tradingagents/agents/risk_mgmt/ + managers/risk_manager.py.

Aggressive Risk Voice

  • Argues for upside capture; pushes for full sizing on conviction names
  • Quotes bull's strongest points
  • Specifically calls out where the conservative voice misses opportunity cost

Conservative Risk Voice

  • Argues for capital preservation; pushes for trim on weak structure
  • Quotes bear's strongest points
  • Specifically calls out where the aggressive voice underestimates tail risk

Neutral Voice

  • Calls the middle ground — what specifically should size up, what should size down, what stays
  • Required: pick a side for each contested holding, no "it depends" outputs

Judge (Risk Manager)

Final synthesis. Weighs the three risk voices given:

  • The user's documented risk preference: aggressive (per workspace MEMORY.md), so the aggressive voice gets weight unless its structural counter is strong
  • Current regime (from regime detection above)
  • Data freshness — any stale leg downgrades confidence

Output strategy decisions per ticker. The same ticker may have separate core_position, intraday_t, and risk_rebalance decisions on the same day:

  • Hold and watch — thesis intact, no action
  • Trim on rebound — thesis weakening, wait for strength
  • T-only — no overnight conviction, fade extremes
  • Add only on trigger — explicit trigger (price / MA cross / earnings / policy)
  • Cut — thesis broken, exit on next acceptable bid (use sparingly)

Each item: ticker + concrete reason + concrete trigger/level if applicable.

Signal-source weighting (driven_by edge — REQUIRED)

Not every signal source has earned the right to drive a decision. Read the current v2 ledger metrics (decision_metrics.by_driver, by_strategy, and by_condition) and compare n_episodes, average benefit, and date-cluster CI. Never copy a point-in-time rate from an old report. If n is small or the CI crosses zero, call it directional evidence only. The registered policy prefers hard catalysts and treats sentiment as supporting evidence. The model may disagree, stating its hypothesis and falsifier; source type alone does not veto an action. Policy-based deleveraging is a separate risk_rebalance decision with driven_by=risk_rule, not a claim of timing edge.

For active-call sizing, the authored confidence is an audit field, not a win probability. decision_metrics.hierarchical_calibration.current_group_calibrators is this ledger's own track record per action + driver + condition + regime group; it carries only evidence_sufficient=true rows (omitted counts live in current_group_calibrators_omitted / omitted_abstain_reasons), and a group missing from it is one with too little evidence. Treat it as evidence, not as a size formula: the brief's postflight stamps the matched row on each active decision, and how much it should weigh on the size is a judgment to argue inside the packet's bounds — show the calibrated probability, CI and resolved level when you lean on it, and say so when you size against it. It never cancels a in-force risk_rebalance + risk_rule hard-stop or regime obligation, because that is policy rather than timing alpha.

Position / leverage hard caps (REQUIRED — overrides signal logic AND regime)

The drawdown was a construction problem (US β≈4.4, 73% leveraged ETFs, HK 85% one factor), not a signal problem. Since 2026-10-11 (#2873, kcn) concentration and leveraged-ETF weight are state to review, not breaches: one name, leveraged or not, may be a whole leg. What still binds is the hard stop, the HSTECH regime dial on the HK leveraged leg, and the US β line. Check these registered thresholds against the live book. A cap requires a reasoned response, not an automatic trim/cut; only an in-force hard-stop or regime obligation forces action:

CapThreshold (GUARDRAIL_CAPS key)If breached
Single name, leveraged or not>35% review (single_name_review_pct); no hard cap (single_name_mandatory_pct, leveraged_single_name_pct = 100)Advisory concentration_reviews row: review the thesis; not a breach
Measured correlated clusterno hard cap (correlated_cluster_pct = 100), measured with ≥80% book coverage—
Leveraged ETFs (per leg)no base cap (lev_etf_leg_pct = 100); the HK leg's cap is multiplied by the HSTECH regime dial (green ×1 / amber ×0.5 / red ×0)Respond: swap 2x→1x or explain holding
US β vs S&P≤6.0 (us_beta_max)Respond: de-lever or explain holding
Single leveraged ETF stop−18% vs cost (lev_etf_stop_pct)Hard stop → swap 2x→1x same factor (keep exposure, stop decay)

Holdings on a strategy with forbid_reduce_advice (now infinite_ammo_dca) get no hard-stop and no regime de-lever row; their weight still shows as a review row.

Rules: an in-force hard stop or regime de-lever requires a concrete action, except where adaptive.may_stand or an active durable override permits holding. A cap row the guardrail does raise (single name, leveraged sleeve, correlated cluster, β) must be answered — a trim, or a hold with its reason and what would change it — and is never a forced sale: the rule names an amount to shed and no place for it to go. A >35% review row is advisory, not a breach, and must not be converted into a trim merely for diversification. Tag true breaches driven_by=risk_rule (disciplinary rebalancing, not news). The trending-up/risk-on HOLD is a policy default; a reasoned strategy departure may also change the call. Compare which exposure to reduce rather than choosing solely from the regime label. The registered destination is the 2x→1x same-factor swap per brief_preflight.LEV_1X_SWAP; the model may instead explain holding cash after the required sale. A risk-rule buy must still satisfy its paired mandate; 1x→2x re-entry only on 🧭 regime green. The numbers are GUARDRAIL_CAPS in src/clawock/portfolio/guardrail.py, which compute_risk_guardrail and the brief's 「🚦 仓位/杠杆硬闸」 read; where this table and that dict differ, the dict wins and the book's live risk_guardrail.breaches is the list to answer.

Read risk_discipline.records alongside the detector output and report each open breach's stable ID, age, acknowledgement and execution-evidence state. A plan-local override has no authority; only a durable, reasoned, unexpired override does. While a critical/high record remains open, do not recommend adding the same name, leveraged sleeve or factor. Exits remain legal, as does a same-plan 2×→1× pair whose factor-adjusted exposure decreases.

Confidence scoring

End the report with a confidence score per major call, 0-100%:

ConfidenceCalibration
80-100%All four analysts align, both researchers' strongest cases converge, fresh data, regime clear
60-79%Most analysts align, one analyst dissents, regime clear
40-59%Analysts split, regime mixed, or one major data leg stale
20-39%Conflicting signals, regime change suspected, multiple stale legs
< 20%Don't act on this read; wait for clarity

Final output structure

Header

  • Regime: {trending up / trending down / range / volatile}
  • Data freshness: timestamp + any stale ticker flagged with ⚠️
  • Book summary: total US PnL, total HK PnL, biggest winner/loser

Tier 1 — Analyst reports

Four sub-sections (Market, Fundamentals, News/Sentiment, Cross-Market). Each terse — tables where data, prose where judgment.

Tier 2 — Bull vs Bear

Two paragraphs, side by side framing.

Tier 3 — Risk debate

  • Aggressive voice (paragraph)
  • Conservative voice (paragraph)
  • Neutral voice (paragraph)

Judge synthesis

Strategy decisions with ticker, strategy_id, action, condition, driver, and reason. Preserve simultaneous strategies instead of forcing one blended verdict.

Confidence calls

Bullet list: "{Action} {Ticker} — confidence XX% — {one-line reason}"

Next-session plan

Concrete plan: what to watch first at the open, which holdings matter most, price/macro triggers that flip the stance.

Style rules

  • Practical, not academic
  • Every claim tied to a real ticker in the current book
  • The four analysts' outputs must be DIFFERENT angles, not the same content reformatted
  • Bull/Bear must actually disagree on at least one position — if they fully agree, the debate failed and the user should know
  • Don't let high-conviction theme hide a bad structure (e.g. "RKLB story is strong" doesn't mean today's RSI 75 is a buy)
  • Tables for any 3+ data points
  • ⚠️ stale data flagged before any conclusion uses it
  • Final plan concise enough to trade from

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.