claims

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package claims defines storage-independent claim/evidence records and separate verification facets. No facet or combination of facets asserts scientific truth.

Code generated from Python unicodedata (Unicode 15.0.0); DO NOT EDIT. Canonical NFD decompositions and nonzero canonical combining classes only. Hangul decomposition is algorithmic in passage_match.go. No compatibility folding.

Index

Constants

View Source
const RelativePath = "data/claims.jsonl"

RelativePath is the append-only project claim ledger. Each line is a complete Claim snapshot; a later snapshot with the same ID supersedes, never edits, it.

View Source
const SchemaVersion = "0"

Variables

View Source
var (
	ErrLibraryRead = errors.New("claim library read failed")
	ErrParsedRead  = errors.New("claim parsed documents read failed")
)
View Source
var ErrNotFound = errors.New("claim not found")

Functions

func Append

func Append(projectPath string, record Claim) error

Append records a new snapshot without changing any existing ledger bytes. Facets refer to this exact text/evidence, so callers must not carry assessments across edits without reassessing them. Nothing here performs a facet check.

func ReferenceTargetsPaper

func ReferenceTargetsPaper(ref EvidenceReference, paperID string, records []library.PaperRecord) bool

ReferenceTargetsPaper binds a citation to a stored source without treating identity alone as a passed verification facet. All identifier aliases use the same matching rules as the deterministic checker.

Types

type Assessment

type Assessment struct {
	State     State     `json:"state"`
	Checker   Checker   `json:"checker"`
	Timestamp time.Time `json:"timestamp"`
}

Assessment records one facet's outcome at an explicit RFC3339 timestamp. Passed means only that the named property met the checker's criterion.

type CheckInput

type CheckInput struct {
	LibraryRecords  []library.PaperRecord
	ParsedDocuments []parsing.ParsedDocument
	Timestamp       time.Time
}

CheckInput supplies stored, offline evidence. Timestamp is the check time; callers supply it explicitly for deterministic replay. No source is fetched live.

type CheckResult

type CheckResult struct {
	Claim Claim `json:"claim"`
	// Evidence is in the same order as Claim.Evidence.
	Evidence []EvidenceCheck `json:"evidence"`
}

func Check

func Check(record Claim, input CheckInput) (CheckResult, error)

Check replaces only the three deterministic facets. Failed dominates inconclusive, which dominates passed; an empty evidence set is inconclusive. Semantic support and human approval are preserved, never inferred.

type Checker

type Checker struct {
	Kind    CheckerKind `json:"kind"`
	ID      string      `json:"id"`
	Version string      `json:"version,omitempty"`
	Model   string      `json:"model,omitempty"`
}

Checker identifies the actor, tool/agent version and, for semantic support, model identity (including its version in Model when available). Kind is attribution, not a computed provenance level or proof of an engine run.

type CheckerKind

type CheckerKind string
const (
	CheckerEngine CheckerKind = "engine"
	CheckerAgent  CheckerKind = "agent"
	CheckerHuman  CheckerKind = "human"
)

type Claim

type Claim struct {
	SchemaVersion  string              `json:"schemaVersion"`
	ID             string              `json:"id"`
	Text           string              `json:"text"`
	WorkflowStatus string              `json:"workflowStatus,omitempty"`
	Evidence       []EvidenceReference `json:"evidence"`
	Facets         VerificationFacets  `json:"facets"`
}

Claim is an assertion and its cited evidence, not a storage or transport envelope. WorkflowStatus preserves a legacy review state; it does not set any facet.

func List

func List(projectPath string) ([]Claim, error)

List returns the latest snapshot per ID in first-seen order. A missing ledger is empty; malformed or incomplete records are errors, not an empty result.

func Show

func Show(projectPath, id string) (Claim, error)

Show returns the latest snapshot of id, or ErrNotFound.

type EvidenceCheck

type EvidenceCheck struct {
	SourceIdentity   State        `json:"sourceIdentity"`
	ContentIntegrity State        `json:"contentIntegrity"`
	PassageMatch     PassageMatch `json:"passageMatch"`
}

type EvidenceReference

type EvidenceReference struct {
	Identifier     Identifier       `json:"identifier"`
	PassageID      string           `json:"passageId,omitempty"`
	Relation       EvidenceRelation `json:"relation"`
	ExactText      string           `json:"exactText,omitempty"`
	ContentHash    string           `json:"contentHash,omitempty"`
	Offsets        *TextOffsets     `json:"offsets,omitempty"`
	SourceMetadata *SourceMetadata  `json:"sourceMetadata,omitempty"`
}

EvidenceReference binds a quote to a source passage. ContentHash is the SHA-256 of the complete UTF-8 passage text, formatted as sha256:<lowercase hex>. Missing hashes/offsets mean unavailable, never a successful integrity check.

type EvidenceRelation

type EvidenceRelation string
const (
	RelationSupports    EvidenceRelation = "supports"
	RelationContradicts EvidenceRelation = "contradicts"
	RelationContext     EvidenceRelation = "context"
)

type HumanApproval

type HumanApproval struct {
	// contains filtered or unexported fields
}

HumanApproval records a named reviewer's decision, not an automated decision. The zero value is uninitialized; use nil for an unchecked facet.

func NewHumanApproval

func NewHumanApproval(value Assessment) (HumanApproval, error)

func (HumanApproval) Assessment

func (h HumanApproval) Assessment() Assessment

Assessment returns a copy of the reviewer's assessment.

func (HumanApproval) MarshalJSON

func (h HumanApproval) MarshalJSON() ([]byte, error)

func (*HumanApproval) UnmarshalJSON

func (h *HumanApproval) UnmarshalJSON(data []byte) error

type Identifier

type Identifier struct {
	Scheme string `json:"scheme"`
	Value  string `json:"value"`
}

Identifier names a source within a scheme (doi, arxiv, pmid, or local, for example). Local identifiers must remain scoped to their originating research project.

type PassageMatch

type PassageMatch struct {
	State   State        `json:"state"`
	Method  string       `json:"method,omitempty"`
	Start   int          `json:"start"`
	End     int          `json:"end"`
	Offsets *TextOffsets `json:"offsets,omitempty"`
}

PassageMatch is a half-open UTF-8 byte range in the original passage, not normalized text. Exact matching is preferred; normalized means canonical Unicode equivalence (NFD, Unicode 15.0) and collapsed Unicode whitespace. Neither matching mode checks semantic support.

func MatchPassage

func MatchPassage(text, quote string) PassageMatch

type ProjectCheckOptions

type ProjectCheckOptions struct {
	Project   string
	ID        string
	Timestamp time.Time
	// Only agent-reported semantic support can be submitted by a host.
	// Human approval is preserved from storage, never set by this operation.
	SemanticSupport *SemanticSupport
}

type ProjectCheckResult

type ProjectCheckResult struct {
	Claim    View            `json:"claim"`
	Evidence []EvidenceCheck `json:"evidence"`
}

func CheckProject

func CheckProject(opts ProjectCheckOptions) (ProjectCheckResult, error)

CheckProject checks stored offline evidence and appends one complete snapshot. CLI and MCP share this operation, including persistence and attribution.

type SemanticSupport

type SemanticSupport struct {
	// contains filtered or unexported fields
}

SemanticSupport is always agent-reported. Its private value prevents a Go literal, assignment, or JSON decode from installing an engine checker. The zero value is uninitialized; use nil for an unchecked facet.

func NewSemanticSupport

func NewSemanticSupport(value Assessment) (SemanticSupport, error)

func (SemanticSupport) Assessment

func (s SemanticSupport) Assessment() Assessment

Assessment returns a copy; changing it cannot change the recorded attribution.

func (SemanticSupport) MarshalJSON

func (s SemanticSupport) MarshalJSON() ([]byte, error)

func (*SemanticSupport) UnmarshalJSON

func (s *SemanticSupport) UnmarshalJSON(data []byte) error

type SourceMetadata

type SourceMetadata struct {
	Title string `json:"title,omitempty"`
	Year  int    `json:"year,omitempty"`
}

SourceMetadata contains optional expected bibliographic values. A resolved identifier alone cannot override a disagreement with these values.

type State

type State string
const (
	StatePassed       State = "passed"
	StateFailed       State = "failed"
	StateInconclusive State = "inconclusive"
)

type TextOffsets

type TextOffsets struct {
	Start         int    `json:"start"`
	End           int    `json:"end"`
	ParserName    string `json:"parserName"`
	ParserVersion string `json:"parserVersion"`
}

TextOffsets is a half-open UTF-8 byte range [Start, End) in the parser's document text stream, not in a PDF or an independently normalized quote. Parser name/version and the passage hash must accompany a reusable location.

type VerificationFacets

type VerificationFacets struct {
	SourceIdentity   *Assessment      `json:"sourceIdentity"`
	ContentIntegrity *Assessment      `json:"contentIntegrity"`
	PassageMatch     *Assessment      `json:"passageMatch"`
	SemanticSupport  *SemanticSupport `json:"semanticSupport"`
	HumanApproval    *HumanApproval   `json:"humanApproval"`
}

VerificationFacets never collapses the five properties into an overall state. A nil assessment means not checked; it has no invented checker or timestamp. Each non-nil assessment covers the claim and all of its evidence references.

type View

type View struct {
	Claim
	SemanticSupportLevel string `json:"semanticSupportLevel,omitempty"`
}

View adds computed attribution, never a truth judgment or a caller-set level.

func ViewClaim

func ViewClaim(record Claim) View

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL