Portfolio risk monitor
Standalone Execution Contract
Treat this skill folder as self-contained. When the skill is installed or copied alone, run commands from this directory and use scripts/run.mjs for dry-run, fixture, and live execution.
Do not hand-write QVeris curl or ad hoc API calls for normal operation. Manual QVeris calls are allowed only for debugging provider behavior, must be labelled manual_debug, and must not be reported as a successful skill E2E run. The skill E2E path is successful only when scripts/run.mjs produces the Markdown report, structured JSON, and trace artifact.
scripts/lib/qveris-runtime.mjs is bundled runtime plumbing for this skill package. No repository-level shared directory is required when using the skill as an installed package.
Natural-Language Invocation Contract
When this skill is triggered by a user request, treat the skill as responsible for the final artifacts. The user should not need to know or request a command. Produce these canonical outputs whenever the user asks for analysis, a report, or a reusable result:
- Markdown report
- Schema-valid business JSON
- QVeris trace JSON with tool IDs, providers, parameters, execution IDs, costs, skipped calls, and missing-data notes
Use scripts/run.mjs internally to produce the canonical outputs. Always pass a business JSON output path when producing artifacts. In the final response, link the report, business JSON, and trace, and summarize paid calls, credits, execution status, and missing-data limits.
Do not create alternate runners, alternate schemas, or one-off JSON shapes for normal use. If the canonical runner lacks a metric, state the gap in missing_data and improve this skill later; do not silently replace the skill with ad hoc code. Manual QVeris calls, web search, or provider-specific debugging may supplement the analysis only when labelled manual_debug; they cannot replace the canonical runner output or be reported as successful skill E2E.
If the user has not authorized paid QVeris calls, stop after dry-run/preflight or ask for approval. If the user authorizes QVeris spend, run live and stay within the stated budget.
Internal Deterministic Runner
Use the local runner internally before composing a free-form answer:
node scripts/run.mjs --dry-run --holdings AAPL:25,NVDA:25,MSFT:20,TSLA:15,CASH:15 --benchmark SPY --window-days 30
node scripts/run.mjs --live --holdings AAPL:25,NVDA:25,MSFT:20,TSLA:15,CASH:15 --benchmark SPY --window-days 30 --max-paid-calls 25 --max-credits 520 --output artifacts/live-smoke.md --json-output artifacts/live-smoke.json --trace artifacts/live-smoke-trace.json
The runner performs QVeris Discover / Inspect preflight, enforces paid-call and credit budgets, writes a Markdown report, writes schema-valid business JSON, and writes a JSON trace.
Workflow
- Clarify ticker, market, time window, user objective, and maximum paid QVeris Call budget.
- Use QVeris Discover (POST /search) to find the needed finance, market, filing, news, transcript, or social capabilities.
- Use QVeris Inspect (POST /tools/by-ids) before paid execution. Show coverage, parameters, latency, success signal, and billing_rule when available.
- Ask for explicit user approval before paid Call execution.
- Use QVeris Call (POST /tools/execute) only for the bounded sources needed for the task.
- Return the requested finance output with evidence strength, missing data, QVeris capabilities used, paid Call count, estimated credits, and a not-investment-advice disclaimer.
Output Contract
Return these sections unless the user asks for a narrower format:
- Objective and scope
- Data sources discovered and inspected
- Evidence table with source type, recency, and confidence
- Analysis or ranking
- Risks, dissenting evidence, and missing proof
- QVeris calls used and estimated credits
- Not investment advice
The JSON artifact must include concentration HHI, top holding exposure, role-level missing_data, measurable_risks, and risk_metrics when historical prices are available. risk_metrics covers observation count, latest close, daily and annualized volatility, max drawdown, 95% historical VaR, and benchmark correlation when both top-holding and benchmark histories return usable records.
Cost Guardrails
- Discover and Inspect are treated as free preflight actions.
- Paid actions are QVeris Call executions.
- Provider fallback attempts are also paid actions and must remain inside
--max-paid-calls and --max-credits; fallback attempts are recorded in the trace.
- If estimated credits exceed the user's budget, reduce tickers, shorten windows, or ask for approval before continuing.
Methodology Reference
Read references/methodology.md when the user asks where the workflow comes from or how to adapt it. Read references/source-review.md for GitHub research and references/qveris-tool-map.md before changing QVeris data routing.
Source Inspiration
This skill is QVeris-native and does not copy source project text, prompts, code, or branding. It adapts public workflow patterns from permissively licensed finance AI projects:
- virattt/ai-hedge-fund (MIT): Multi-lens investment agents, valuation, sentiment, fundamentals, technicals, risk manager, and portfolio manager patterns.
- AI4Finance-Foundation/FinRL (MIT): Train-test-trade workflow, market environment, risk controls, and strategy evaluation patterns.
- microsoft/qlib (MIT): Quant research pipeline, alpha seeking, factor modeling, backtesting, risk modeling, and portfolio optimization patterns.
1---2name: qveris-portfolio-risk-monitor3description: Monitor a portfolio for concentration, drawdown, volatility, catalyst, news, and liquidity risks with auditable QVeris calls. Use when an agent needs QVeris-powered finance research, live market data, filings/news evidence, cost-aware tool calls, or source-backed investment analysis for this workflow.4---5
6# Portfolio risk monitor
7
8## Standalone Execution Contract
9
10Treat this skill folder as self-contained. When the skill is installed or copied alone, run commands from this directory and use `scripts/run.mjs` for dry-run, fixture, and live execution.
11
12Do not hand-write QVeris `curl` or ad hoc API calls for normal operation. Manual QVeris calls are allowed only for debugging provider behavior, must be labelled `manual_debug`, and must not be reported as a successful skill E2E run. The skill E2E path is successful only when `scripts/run.mjs` produces the Markdown report, structured JSON, and trace artifact.
13
14`scripts/lib/qveris-runtime.mjs` is bundled runtime plumbing for this skill package. No repository-level shared directory is required when using the skill as an installed package.
15
16## Natural-Language Invocation Contract
17
18When this skill is triggered by a user request, treat the skill as responsible for the final artifacts. The user should not need to know or request a command. Produce these canonical outputs whenever the user asks for analysis, a report, or a reusable result:
19
20- Markdown report
21- Schema-valid business JSON
22- QVeris trace JSON with tool IDs, providers, parameters, execution IDs, costs, skipped calls, and missing-data notes
23
24Use `scripts/run.mjs` internally to produce the canonical outputs. Always pass a business JSON output path when producing artifacts. In the final response, link the report, business JSON, and trace, and summarize paid calls, credits, execution status, and missing-data limits.
25
26Do not create alternate runners, alternate schemas, or one-off JSON shapes for normal use. If the canonical runner lacks a metric, state the gap in `missing_data` and improve this skill later; do not silently replace the skill with ad hoc code. Manual QVeris calls, web search, or provider-specific debugging may supplement the analysis only when labelled `manual_debug`; they cannot replace the canonical runner output or be reported as successful skill E2E.
27
28If the user has not authorized paid QVeris calls, stop after dry-run/preflight or ask for approval. If the user authorizes QVeris spend, run live and stay within the stated budget.
29
30## Internal Deterministic Runner
31
32Use the local runner internally before composing a free-form answer:
33
34```bash
35node scripts/run.mjs --dry-run --holdings AAPL:25,NVDA:25,MSFT:20,TSLA:15,CASH:15 --benchmark SPY --window-days 30
36node scripts/run.mjs --live --holdings AAPL:25,NVDA:25,MSFT:20,TSLA:15,CASH:15 --benchmark SPY --window-days 30 --max-paid-calls 25 --max-credits 520 --output artifacts/live-smoke.md --json-output artifacts/live-smoke.json --trace artifacts/live-smoke-trace.json
37```
38
39The runner performs QVeris Discover / Inspect preflight, enforces paid-call and credit budgets, writes a Markdown report, writes schema-valid business JSON, and writes a JSON trace.
40
41## Workflow
42
431. Clarify ticker, market, time window, user objective, and maximum paid QVeris Call budget.
442. Use QVeris Discover (POST /search) to find the needed finance, market, filing, news, transcript, or social capabilities.
453. Use QVeris Inspect (POST /tools/by-ids) before paid execution. Show coverage, parameters, latency, success signal, and billing_rule when available.
464. Ask for explicit user approval before paid Call execution.
475. Use QVeris Call (POST /tools/execute) only for the bounded sources needed for the task.
486. Return the requested finance output with evidence strength, missing data, QVeris capabilities used, paid Call count, estimated credits, and a not-investment-advice disclaimer.
49
50## Output Contract
51
52Return these sections unless the user asks for a narrower format:
53
54- Objective and scope
55- Data sources discovered and inspected
56- Evidence table with source type, recency, and confidence
57- Analysis or ranking
58- Risks, dissenting evidence, and missing proof
59- QVeris calls used and estimated credits
60- Not investment advice
61
62The JSON artifact must include concentration HHI, top holding exposure, role-level `missing_data`, `measurable_risks`, and `risk_metrics` when historical prices are available. `risk_metrics` covers observation count, latest close, daily and annualized volatility, max drawdown, 95% historical VaR, and benchmark correlation when both top-holding and benchmark histories return usable records.
63
64## Cost Guardrails
65
66- Discover and Inspect are treated as free preflight actions.
67- Paid actions are QVeris Call executions.
68- Provider fallback attempts are also paid actions and must remain inside `--max-paid-calls` and `--max-credits`; fallback attempts are recorded in the trace.
69- If estimated credits exceed the user's budget, reduce tickers, shorten windows, or ask for approval before continuing.
70
71## Methodology Reference
72
73Read `references/methodology.md` when the user asks where the workflow comes from or how to adapt it. Read `references/source-review.md` for GitHub research and `references/qveris-tool-map.md` before changing QVeris data routing.
74
75## Source Inspiration
76
77This skill is QVeris-native and does not copy source project text, prompts, code, or branding. It adapts public workflow patterns from permissively licensed finance AI projects:
78
79- virattt/ai-hedge-fund (MIT): Multi-lens investment agents, valuation, sentiment, fundamentals, technicals, risk manager, and portfolio manager patterns.
80- AI4Finance-Foundation/FinRL (MIT): Train-test-trade workflow, market environment, risk controls, and strategy evaluation patterns.
81- microsoft/qlib (MIT): Quant research pipeline, alpha seeking, factor modeling, backtesting, risk modeling, and portfolio optimization patterns.