provenance

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Real implementation, validated against the live Anthropic API before being wired in here: forced tool-use (not a plain text response asking for JSON) is what guarantees structured output - a plain-text prompt asking for JSON came back markdown-fenced in testing, which forced tool-use avoids entirely. The schema is built PER CALL with one explicitly-named property per argument being assessed, not an open-ended map - Anthropic's strict tool schema mode requires additionalProperties:false, which isn't compatible with dynamic keys, and since the exact argument names are always known up front, an explicit per-call schema is the right shape anyway, not a workaround.

Package provenance is the model-based add-on to the Intent Integrity Plane: instead of requiring an orchestrator to compute and self-report whether a tool-call argument came from the human, the proxy sees a bounded slice of the actual recent conversation itself and asks a real model to judge it directly. This turns a hard reasoning task we'd have to trust a third party to get right into a data-forwarding task (send us the recent conversation) plus a judgment call we make ourselves.

This is deliberately a CONFIDENCE score, not a binary verdict - humans paraphrase ("upgrade her" -> tier="gold"), and naive matching would be full of false positives/negatives. Because it can never be perfectly precise, low confidence here only ever joins internal/risk's existing taint-forces-step-up machinery as an additional signal - it never grants access on its own, same constraint every soft signal in this system is held to.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnthropicJudge

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

func NewAnthropicJudge

func NewAnthropicJudge(model anthropic.Model) *AnthropicJudge

NewAnthropicJudge reads ANTHROPIC_API_KEY from the environment via the SDK's own default credential loading - never stored in config.yaml or passed through the wire protocol.

func (*AnthropicJudge) Assess

func (j *AnthropicJudge) Assess(ctx context.Context, contextWindow []Message, tool string, args map[string]any) (map[string]ArgAssessment, Usage, error)

type ArgAssessment

type ArgAssessment struct {
	Confidence float64 // 0.0 (clearly not from the human) .. 1.0 (clearly is)
	Rationale  string
}

type FakeJudge

type FakeJudge struct {
	// Confidences maps argument name -> the confidence to return for it.
	// An argument not present here defaults to DefaultConfidence.
	Confidences       map[string]float64
	DefaultConfidence float64
	Err               error
}

FakeJudge is deterministic and makes no network call - used by tests so go test never depends on a live model API or incurs real cost, the same pattern as capability.FakeSeedMinter standing in for Vault.

func (*FakeJudge) Assess

func (f *FakeJudge) Assess(ctx context.Context, contextWindow []Message, tool string, args map[string]any) (map[string]ArgAssessment, Usage, error)

type Judge

type Judge interface {
	Assess(ctx context.Context, contextWindow []Message, tool string, args map[string]any) (map[string]ArgAssessment, Usage, error)
}

type Message

type Message struct {
	Role    string // "user" | "assistant" | "tool"
	Content string
}

type Usage

type Usage struct {
	InputTokens  int64
	OutputTokens int64
}

Usage is per-CALL, not per-argument - one real API request judges every argument in a call at once (see anthropic.go's single Messages.New call per Assess), so it's returned once per Assess rather than folded into each ArgAssessment, where summing it per-argument would double-count. Zero value for a judge that makes no real API call (FakeJudge) - that's the honest answer, not a placeholder: no real call means no real cost.

Jump to

Keyboard shortcuts

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