agentleFS
srinandansrinandan/portfolio-copilot/skills/portfolio-analysis/SKILL.md

portfolio-analysis

Skill0 starsChanged 4 months agoApache-2.0View on GitHub

Measures current holdings against the active Investment Policy Statement's target allocation and reports drift. Use when checking portfolio health, before considering a rebalance, or when the root planner needs current drift to decide whether Action Drafting should run.

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 3

    Distinctive

    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:

    Not a persisted contract like the IPS or Holdings — this is a transient computation, produced and consumed within a single planning cycle, …

    line 41
  2. Distinctive:

    If no active IPS exists for this user (e.g.

    line 59
  3. Distinctive:

    No active IPS → skill declines to run, doesn't fabricate a report

    line 91

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “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-analysis

Purpose

Compares current holdings against the active IPS's target_allocation bands and produces a drift report — the signal Action Drafting acts on, and what a user sees when asking "how's my portfolio doing."

When this skill runs

  • User asks about portfolio health/drift directly
  • Root planner invokes it before considering whether to invoke Action Drafting (drift is the trigger condition, not a standing schedule — see ADR-0004)
  • Periodically, if the IPS's rebalancing_rules.trigger_type includes calendar (scheduling mechanism is an orchestrator concern, not specified here)

Inputs

FieldSourceRequired
HoldingsSnapshotFirestore, read-onlyYes
Active InvestmentPolicyStatementFirestore, read-onlyYes — if none exists, see failure mode below

Output: Drift Report

Not a persisted contract like the IPS or Holdings — this is a transient computation, produced and consumed within a single planning cycle, never written to Firestore on its own. (Contracts in /schemas are reserved for persisted, audited artifacts; this isn't one.)

FieldDescription
asset_classOne row per IPS target_allocation entry
current_percentSum of matching positions' market_value_usd ÷ HoldingsSnapshot.total_value_usd × 100
target_percent, min_percent, max_percentFrom the IPS
in_bandtrue if current_percent is within [min_percent, max_percent]
drift_amount_percentDistance outside the band; 0 if in band
unclassified_value_usdTotal value of holdings whose asset_class doesn't match any IPS band — reported, not silently dropped from totals
rebalance_recommendedtrue if any asset class is out of band and the IPS's drift_threshold_percent is exceeded

Failure mode: no active IPS

If no active IPS exists for this user (e.g. before onboarding completes), this skill declines to run rather than computing drift against nothing meaningful — surfaces "no investment policy set yet," doesn't fabricate a comparison.

Tools / permissions required

  • Managed Agent sandbox: reasons over the orchestrator's pre-computed drift report + IPS + holdings context. Formats a DriftReport typed output with a narrative rationale.
  • Orchestrator (outside sandbox): pre-fetches active IPS + holdings from Firestore and pre-computes drift via primitives/portfolio_analysis.py::calculate_drift before invoking the Managed Agent. See ADR-0016.
  • No Firestore write access from the Managed Agent. This skill only reads and reports; it never drafts or executes anything itself.

Registry metadata

  • Registered as: projects/{project}/locations/{location}/skills/private-portfolio-analysis
  • Skill revision: 0.1.0 (draft — not yet registered)
  • Approval scope: read:holdings,read:ips

Acceptance criteria

  1. current_percent matches hand-calculated values for a fixed test HoldingsSnapshot + IPS combination
  2. A holding whose asset_class matches no IPS band appears in unclassified_value_usd, and total portfolio value still accounts for it — it's never silently excluded
  3. rebalance_recommended is true only when both the out-of-band condition and the IPS's drift_threshold_percent condition hold — tested for boundary cases (exactly at threshold, just under, just over)
  4. No active IPS → skill declines to run, doesn't fabricate a report

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.