Skip to content

feat: make trust score persistence the default — crash-resilient trust state #86

@imran-siddique

Description

@imran-siddique

Problem

AgentMesh trust scores are in-memory by default (Python dict in TrustBridge.peers). If an agent process restarts — deliberately or due to a crash — it re-enters at neutral trust, wiping earned reputation or accumulated violations. A misbehaving agent can effectively reset its trust score by crashing.

What Exists

  • RedisTrustStore in storage/redis_backend.py provides persistent storage
  • MemoryProvider in storage/memory_provider.py for dev/testing
  • But the default is in-memory with no persistence

Proposed Solution

  1. Add a FileTrustStore backend that persists to JSON/SQLite — zero external dependencies
  2. Make TrustBridge accept a configurable storage backend (default: file-based)
  3. On startup, load previous trust scores; on crash recovery, restore last known state
  4. Add a trust_persistence config key to YAML policies
  5. Document Redis backend as the production recommendation

Acceptance Criteria

  • FileTrustStore backend persists scores to disk
  • TrustBridge defaults to persistent storage (file-backed)
  • Scores survive process restart without Redis
  • Crash recovery loads last-known scores
  • Unit tests for persistence lifecycle

/cc @imran-siddique

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions