Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:2akouwu Reverify Claim from dict

From Leeroopedia
Knowledge Sources
Domains Verification, Data_Structures
Last Updated 2026-10-24 12:00 GMT

Overview

Concrete tool for constructing Claim objects from JSON dicts provided by the Reverify library.

Description

The Claim.from_dict classmethod converts a JSON claim object (from CLI --claim, --claims-file, MCP re_verify_claim, or a model's proposal) into a typed Claim dataclass. It validates that the dict has a required kind field, supports a flat form (where everything except meta keys is treated as params), and normalizes depends_on from string to list.

Usage

Import this classmethod when you need to:

  • Convert JSON claim objects into Claim instances for Verifier.verify_all.
  • Parse claims from a CLI claims file or inline --claim argument.
  • Parse claims from a model's JSON response in the reconstruction loop.

Code Reference

Source Location

  • Repository: Reverify
  • File: reverify/verifier.py
  • Lines: L105-123

Signature

@dataclass
class Claim:
    kind: str
    params: Dict[str, Any] = field(default_factory=dict)
    note: str = ""
    id: Optional[str] = None
    depends_on: List[str] = field(default_factory=list)
    observe: bool = False

    @classmethod
    def from_dict(cls, data: Dict[str, Any]) -> "Claim":
        """Construct a Claim from a dict. Raises ClaimError if 'kind' is missing."""

Import

from reverify.verifier import Claim

I/O Contract

Inputs

Name Type Required Description
data Dict[str, Any] Yes Claim dict with required "kind" key. Optional: "params", "note", "id", "depends_on", "observe". Supports flat form (non-meta keys become params).

Outputs

Name Type Description
return Claim Typed claim dataclass with kind, params, note, id, depends_on, observe fields

Usage Examples

Standard Form

from reverify.verifier import Claim

# Explicit params
claim = Claim.from_dict({
    "kind": "bytes_at",
    "params": {"offset": 0x28, "expected": "554889e5"},
    "note": "frame pointer prologue",
    "id": "prologue_1"
})

Flat Form

# Non-meta keys become params automatically
claim = Claim.from_dict({
    "kind": "bytes_at",
    "offset": 0x28,
    "expected": "554889e5"
})
# claim.params == {"offset": 0x28, "expected": "554889e5"}

Observe Mode

# observe=True: ask the tools to read the value instead of asserting one
claim = Claim.from_dict({
    "kind": "u32_at",
    "params": {"offset": 0x3C},
    "observe": True
})

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment