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

reviewer

Skill0 starsChanged 4 months agoApache-2.0View on GitHub

Reviews a drafted ProposedAction against the active Investment Policy Statement and rules, producing a ReviewerVerdict with per-rule pass/fail results and an overall_pass flag. Runs between Action Drafting and the Human-in-the-Loop approval gate.

33 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use tester, planner and 2 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • KJ-devsSkill

    tester

    Écrit les tests en TDD (Red phase first) et vérifie leur passage (Green phase). Frontend avec Playwright, backend avec BDD Given-When-Then.

    Also in 4 projects that use this

  • am-willSkill

    planner

    Create comprehensive, phased implementation plans with sprints and atomic tasks. Use when user says: "make a plan", "create a plan", "plan this out", "plan the implementation", "help me plan", "design a plan", "draft a plan", "write a plan", "outline the steps", "break this down into tasks", "what's the plan for", or any similar planning request. Also triggers on explicit "/planner" or "/plan" commands.

    Also in 5 projects that use this

  • tesla0225Skill

    orchestrator

    Issue/要件を受けたら分解→担当割当→実装→検証→統合を回す手順。未整備なら /repo-init でbootstrap。

    Also in 4 projects that use this

  • Harut8Skill

    architect

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 24 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Before the HITL approval gate (whose gate check reads reviewer_verdict.overall_pass)

    line 33
  2. Distinctive:

    Before Alpaca execution (which refuses execution when the reviewer fails, per ADR-0014)

    line 35
  3. Distinctive:

    No BigQuery access. No write access.

    line 46
  4. Very specific:

    Every rule produces a RuleResult with passed=true or passed=false — no rule is silently skipped.

    line 134

“Common” is measured: kept by at least 6 in 10 of the 24 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

reviewer

Purpose

Validates a drafted ProposedAction before it reaches the human. Reads the active InvestmentPolicyStatement, current HoldingsSnapshot, and the ProposedAction itself; produces a ReviewerVerdict with itemized rule_results and a single overall_pass boolean.

Per ADR-0014's defense-in-depth pattern, the LLM's verdict is advisory. The orchestrator re-runs every rule deterministically in orchestrator/reviewer/rules.py and uses that verdict for enforcement. This SKILL.md defines the rules for both — the LLM reasons over them here, the orchestrator enforces them in code. Any divergence is audited.

When this skill runs

  • Immediately after Action Drafting produces a ProposedAction with status: drafted
  • Before the HITL approval gate (whose gate check reads reviewer_verdict.overall_pass)
  • Before Alpaca execution (which refuses execution when the reviewer fails, per ADR-0014)

Inputs (pre-computed by orchestrator preloader)

FieldSourceRequired
proposed_actionAction Drafting output, drafted this cycleYes
active_ipsFirestore, read-onlyYes
holdingsFirestore, read-onlyYes

No BigQuery access. No write access. No external tools.

Rules to evaluate

For each rule below, produce a RuleResult with:

  • rule_id: exact string as listed
  • description: short human-readable
  • passed: true / false
  • detail: optional explanation, especially when passed=false

excluded_ticker

Fails if proposed_action.ticker appears in active_ips.constraints.excluded_tickers.

excluded_sector

Fails if the sector of proposed_action.ticker appears in active_ips.constraints.excluded_sectors. Sector lookup uses the same static map the orchestrator's primitives/action_drafting.py::KNOWN_SECTOR_MAP provides; if excluded_sectors is defined in the IPS and the ticker isn't in the map (sector is Unknown), this rule fails-closed to prevent unverified sector exposure.

concentration_limit

Applies to buys only. Fails a buy whose resulting position value (current position + trade value) would exceed active_ips.constraints.concentration_limit_percent of total portfolio value. A sell always passes this rule: a concentration ceiling can only be breached by adding to a position, and a sell strictly reduces it — failing a trim because the remaining position is still above the limit would make an overweight holding (e.g. a broad-market ETF held as the core sleeve) impossible to unwind. allocation_band_direction separately vets that a sell moves the asset class the right way.

allocation_band_direction

Fails if the trade moves the asset class away from the IPS target band. A sell in an under-allocated asset class fails; a buy in an over-allocated asset class fails. Uses primitives/portfolio_analysis.py::calculate_drift semantics to determine current-vs-target position of the asset class.

ips_version_current

Fails if proposed_action.ips_version_referenced does not match the currently active IPS version for the user. Guards against a stale IPS being used to justify a proposal after the user updated their policy.

Output: ReviewerVerdict

{
  "verdict_id": "<uuid>",
  "action_id": "<from proposed_action.action_id>",
  "ips_version_checked_against": {"ips_id": "...", "version": N},
  "rule_results": [
    {"rule_id": "excluded_ticker", "description": "...", "passed": true, "detail": null},
    ...
  ],
  "overall_pass": true|false,
  "requires_human_approval": true|false,
  "reviewer_skill_version": {"skill_name": "private-reviewer", "skill_version": "0.1.0"},
  "reviewed_at": "<ISO-8601 timestamp>"
}

overall_pass is true iff every rule_result.passed is true.

requires_human_approval — set to true when either (a) overall_pass=false (a violation must be surfaced to the human), or (b) the action's estimated_value_usd exceeds active_ips.approval_required_above_usd, or (c) the action's value as a fraction of total portfolio exceeds active_ips.approval_required_above_percent. Per the spec, requires_human_approval can be true even when overall_pass=true — high-stakes actions always go to a human regardless of policy compliance.

Tools / permissions required

  • Managed Agent sandbox: reasons over the orchestrator's pre-computed IPS + holdings + ProposedAction context. Produces the typed verdict.
  • Orchestrator (outside sandbox): pre-fetches state, invokes the MA, re-runs the same rules in deterministic Python code, writes the audit entry with both verdicts.
  • No Firestore, no BigQuery, no trade-execution tools. The reviewer has no way to change state — its output is the verdict.

Registry metadata

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

Acceptance criteria

  1. Every rule produces a RuleResult with passed=true or passed=false — no rule is silently skipped; overall_pass is the AND of every passed field.
  2. On a happy-path action (no violations), overall_pass=true.
  3. On any single-rule violation, overall_pass=false and the offending rule's passed=false with a detail string.
  4. requires_human_approval is independently true on high-stakes actions even when overall_pass=true.
  5. ips_version_checked_against matches the IPS the orchestrator preloaded, not a version the LLM invented.
  6. The orchestrator's deterministic re-check produces the same rule_results (for the currently-implemented rule set) — any divergence is captured in the audit log's detail field.

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.