Skip to content

feat(mcp): cache last-good decision packs for offline fallback #100

Description

@JSONbored

Parent roadmap: #82

Background

Local agent workflows should still give useful stale context when the API or network is temporarily unavailable.

Goal

Cache last-good decision packs locally and use them as explicitly stale fallback.

Current Behavior

MCP depends on live API responses for most intelligence.

Desired Behavior

If API access fails, MCP can show last-good guidance marked stale with cached timestamp and rerun guidance.

Implementation Requirements

  • Store bounded cache by login/repo/API version.
  • Encrypt or minimize sensitive fields where practical.
  • Mark stale and source as local cache.
  • Refuse cache when schema/API version is incompatible.
  • Provide cache clear command or doctor guidance.

Public/Private Output Boundaries

MCP may return private scoreability and risk context to authenticated users. It must never upload source contents by default, and public-safe packet output must exclude private score/reward/trust/reviewability details.

Acceptance Criteria

  • Offline fallback works for last-good decision pack.
  • Stale marker is visible.
  • Incompatible cache is ignored.
  • Cache never includes source contents.

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

  • API unavailable fixture.
  • Stale cache fixture.
  • Incompatible schema fixture.
  • Cache clear fixture.
  • Secret/source guard.

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