Skill: Define Rikdom Investment Policy
Use this skill when the user wants to create, fill, define, review, or update data/policy.json, an Investment Policy Statement (IPS), objectives, target allocation, glide path, rebalancing rules, retirement assumptions, constraints, or guardrails.
Purpose
Interview the user and produce a valid data/policy.json for a Rikdom portfolio. The policy is prescriptive configuration consumed by humans or agents during portfolio health checks and rebalancing reviews.
This skill does not provide regulated financial advice, execute trades, propose specific buy/sell orders, run imports, or edit data/portfolio.json.
Scope
- Write only
data/policy.jsonand, if useful for resumability,data/.policy-interview.md. - Do not touch
data/portfolio.json, snapshots, FX files, imports, plugins, or schema files. - Do not edit
src/rikdom/_resources/policy.schema.json. If the user needs a field the schema does not support, place it underextensionswhen allowed and flag it in the final report. - Prefer local files only; do not fetch remote data to enrich assumptions.
Required Context
Before asking detailed questions:
- Ask for the portfolio data path if unknown:
What is your rikdom portfolio data path? You can send: (1) the data directory, (2) a full path to portfolio.json, or (3) workspace root + portfolio name.
If the user does not provide one, default to data/ in the current workspace.
- Read
src/rikdom/_resources/policy.schema.jsonas the authoritative schema. - Read
data-sample/policy.jsonas a realistic example and source of schema-shaped defaults. - If
<data-dir>/portfolio.jsonexists, read it for defaults only: portfolio id/name, base currency, countries if present, account/provider hints, and rough AUM for guardrail sizing. - If
<data-dir>/policy.jsonexists, treat this as an update: reuse existing values as defaults and only reconfirm stale, missing, or user-flagged sections. - If
<data-dir>/.policy-interview.mdexists, resume from it.
Interview Rules
- Ask one question at a time.
- Offer 3–5 concrete options plus
otherwhenever possible. - Keep explanations short and practical.
- Never dump the whole schema at the user.
- Never invent unconfirmed personal numbers. Ask, omit optional fields, or save as an open question.
- End each major section with a recap and ask:
save partial / continue / edit previous. - Write incrementally after every completed section so progress is not lost.
Interview Order
Cover every section, but allow use defaults for this section or skip optional fields.
- Identity
portfolio_idpolicy_idowner_kindresidence_countrytax_jurisdictions(may differ from residence, e.g. US person abroad)policy_base_currency
- Investor profile
birth_dateor age range if the user refuses exact dateretirement_target_ageorretirement_target_dateinvestment_horizon_yearsrisk_tolerance(emotional comfort with volatility)risk_capacity(financial ability to absorb loss)liquidity_needs_monthsincome_stabilitydependentstax_lot_method
- Accounts
Catalog every wrapper/account type: taxable brokerage, PGBL/VGBL, 401k/IRA, previdência fechada, offshore, crypto custody, cash, or other.
For each account collect:
account_id,label, optionalproviderjurisdictiontax_account_type- tax flags such as
tax_deferred,tax_free_withdrawals,early_withdrawal_penalty preferred_holdingshints for tax-aware placement
- Objectives
Always ask about:
- retirement
- emergency fund
Then ask whether to include education, home purchase, legacy, sabbatical, healthcare, or other goals.
For each objective collect kind, priority, target date/age if known, target amount if known, and funding accounts.
- Retirement assumptions
Explain real vs nominal spending in one sentence, then collect:
- desired annual spending and currency
- spending basis (
today/real vs future/nominal) - inflation assumption and index reference (e.g. BR IPCA, US CPI)
- target real/nominal return assumptions
- withdrawal rule preference: fixed SWR, Guyton-Klinger, VPW, or other
- longevity planning age
- social security/pension sources
- at least one stress scenario
- Strategic allocation
- Choose dimensions first:
asset_classdefault, plus optionalregion,currency,sector,factor. - For each bucket collect
weight_pct,min_pct,max_pct, and optionalrebalance_priority. - Validate that each dimension sums to approximately 100, using the schema's rounding tolerance when present.
- Glide path
- Choose
static,age_based, ordate_based. - If age-based, propose waypoints at current age, pre-retirement, retirement, and late retirement.
- Offer the heuristic
stocks_pct ≈ 110 − ageonly as a starting point, never as a rule.
- Rebalancing policy
- Method (
calendar,threshold, orhybridwhen supported) - Cadence
- Drift triggers: absolute percentage points and/or relative percent
- Contribution-first behavior
- Tax-awareness preferences
- No-sell windows or cooling-off periods
- Cashflow policy
- Recurring contributions: amount, currency, cadence, destination/routing
- Withdrawals: planned amount, cadence, source order, or deferred until retirement
- Constraints and exclusions
- Excluded tickers, sectors, countries, assets, leverage, derivatives, crypto, single-name caps
- ESG/screens if any
- Concentration caps
- Currency exposure and hedging preferences
- Guardrails
This is the section future agents should cite most. Collect:
- emergency fund floor as amount and months
- maximum drawdown action
- human confirmation threshold for any future action recommendation
- concentration alert threshold
- forbidden actions
- behavioral rules such as cooling-off periods or no panic selling
- Review policy
- Review cadence
- Triggers: birthday, job change, birth/death, marriage/divorce, move countries, major drawdown, inheritance, tax-law change, major market regime change
Writing And Validation
After every section:
- Update
<data-dir>/policy.jsonusing pretty JSON with stable indentation. - Preserve existing values unless the user explicitly changes them.
- Set/update provenance when the schema supports it:
provenance.llm_assisted: trueprovenance.llm_modelprovenance.created_atonly on first creationprovenance.updated_aton every write, in UTC
- Validate with the project validator:
uv run python - <<'PY'
import json
from pathlib import Path
from rikdom.policy import validate_policy
path = Path('data/policy.json')
errors = validate_policy(json.loads(path.read_text()))
if errors:
print('\n'.join(errors))
raise SystemExit(1)
print('policy.json valid')
PY
If the user's data directory is not data, substitute the correct path. If validation fails, fix schema-shape issues immediately and re-ask only for missing or ambiguous user intent.
Final Report
When finished, provide a short Markdown report with:
- Coverage matrix — populated, defaulted, skipped, or open for each major section.
- Consistency checks — allocation sums per dimension, min/max bands, glide path monotonicity, emergency fund vs liquidity months where possible, human confirmation threshold vs rough AUM where available.
- Drift snapshot — only if
portfolio.jsonexists and current weights can be computed locally; flag outside-band buckets only. Do not propose trades. - Open questions — deferred assumptions, missing values, unsupported schema needs.
Privacy And Safety
- Do not echo real account numbers, government IDs, addresses, or other sensitive PII in reports, docs, tests, or commits.
- Real identifiers belong only in local
data/policy.jsonif the user explicitly wants them there. - Use synthetic examples in any tracked sample files.
- State uncertainty clearly; the policy encodes user preferences and assumptions, not a guarantee of outcomes.