Skip to content

feat(agent): add risk-adjusted opportunity portfolio planning #94

Description

@JSONbored

Parent roadmap: #82

Background

Miners need more than one top recommendation. They need a portfolio of actions: clean up, wait, pursue, avoid, or prepare.

Goal

Return a ranked action portfolio that balances scoreability upside, risk, queue pressure, credibility, maintainer friction, and pending PR state.

Current Behavior

Planning can rank actions, but output can still feel too generic or single-action focused.

Desired Behavior

MCP/API returns grouped actions with clear why-now reasoning and risk-adjusted priority.

Implementation Requirements

  • Generate action buckets: cleanup, wait, direct PR, issue-discovery, avoid, maintainer-lane.
  • Include scoreability impact, risk impact, maintainer impact, blockedBy, and rerunWhen.
  • Use deterministic ranking and stable tie-breaks.
  • Use scenario projections when available.

Public/Private Output Boundaries

Private MCP/API may include scoreability, risk, and confidence. Public GitHub output must use sanitized summaries only and must not expose private scoring, reward/risk, raw trust, wallet/hotkey, or reviewability internals.

Acceptance Criteria

  • Portfolio includes at least cleanup/wait/pursue/avoid where applicable.
  • Open PR pressure can rank cleanup above new work.
  • Issue-discovery-only repos do not recommend direct PR scoreability.
  • Maintainer-lane repos are separated.

Testing Requirements

  • npm run test:ci must pass.
  • Global coverage must remain at or above 97% for lines, statements, functions, and branches.
  • Aim for 98%+ branch coverage locally to avoid CI variance.
  • Add tests for every new branch, fallback path, sanitizer rule, and regression.
  • Add invariant/property-style tests when behavior depends on sorting, gating, scoring, queue pressure, source-upload safety, public/private boundaries, or upstream drift.
  • Public GitHub output must be tested against forbidden language: wallet, hotkey, raw trust score, payout, reward estimate, farming, private reviewability, and public score estimate.
  • MCP/local tooling must prove source contents are not uploaded.

Additional Test Scenarios

  • Cleanup-first fixture.
  • Direct PR fixture.
  • Issue-discovery fixture.
  • Maintainer-lane fixture.
  • Deterministic ranking property test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions