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
- Variables
- func Append(projectPath string, record Claim) error
- func ReferenceTargetsPaper(ref EvidenceReference, paperID string, records []library.PaperRecord) bool
- type Assessment
- type CheckInput
- type CheckResult
- type Checker
- type CheckerKind
- type Claim
- type EvidenceCheck
- type EvidenceReference
- type EvidenceRelation
- type HumanApproval
- type Identifier
- type PassageMatch
- type ProjectCheckOptions
- type ProjectCheckResult
- type SemanticSupport
- type SourceMetadata
- type State
- type TextOffsets
- type VerificationFacets
- type View
Constants ¶
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.
const SchemaVersion = "0"
Variables ¶
var ( ErrLibraryRead = errors.New("claim library read failed") ErrParsedRead = errors.New("claim parsed documents read failed") )
var ErrNotFound = errors.New("claim not found")
Functions ¶
func Append ¶
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.
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 ¶
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 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.