Documentation
¶
Overview ¶
Package writing builds explicit, local-only prose snapshots and keeps a content-free index of reviewed answers. References are caller-approved data, not model training, implicit memory, or permission to reuse changed facts.
Index ¶
Constants ¶
const ConfigName = "writing-workflow.json"
const MaxEvidenceBytes = 32 << 10
const MaxIndexBytes = 128 << 10
const MaxIndexEntries = 128
const MaxReferenceBytes = 16 << 10
Variables ¶
var ErrIndexFull = errors.New("writing_review_index_full")
var ErrInvalid = errors.New("writing_snapshot_invalid")
var ErrUnconfirmed = errors.New("writing_answer_unconfirmed")
Functions ¶
func Record ¶
func Record(ctx context.Context, broker inference.Broker, plan Plan, result delegation.Result, review string) (protocol.PublishResult, error)
Record indexes a confirmed answer after explicit caller review. An index is a historical reference, never a cache hit or an assertion of human acceptance. Use outcomes feedback for an actual person's acceptance, rewrite and effort.
func ValidatePlan ¶
Types ¶
type Config ¶
type Config struct {
Schema int `json:"schema"`
ReferencePath string `json:"reference_path"`
ReferenceSHA256 string `json:"reference_sha256"`
Recipe Recipe `json:"recipe"`
}
Config pins an explicitly selected local reference. Changing its bytes requires a deliberately updated config; no chat or home directory is scanned.
type Entry ¶
type Entry struct {
Schema int `json:"schema"`
RequestSHA256 string `json:"request_sha256"`
ReferenceID string `json:"reference_id"`
ReferenceRevision string `json:"reference_revision"`
ReferenceSHA256 string `json:"reference_sha256"`
EvidenceID string `json:"evidence_id"`
EvidenceRevision string `json:"evidence_revision"`
EvidenceSHA256 string `json:"evidence_sha256"`
AnswerKey string `json:"answer_key"`
AnswerVersion int64 `json:"answer_version"`
AnswerSHA256 string `json:"answer_sha256"`
ReviewStatus string `json:"review_status"`
HumanAcceptance string `json:"human_acceptance"`
}
Entry stores no prompt, profile, evidence or answer content. The broker artifact version identifies the historical answer; expiry is left unchanged.
func ReadEntries ¶
ReadEntries resolves only the immutable metadata referenced by ReadIndex. It verifies each pointer's version, bytes and reference binding. Answer content and profile/evidence documents are never fetched by this function.
type EntryRef ¶
type EntryRef struct {
Key string `json:"key"`
Version int64 `json:"version"`
SHA256 string `json:"sha256"`
}
EntryRef pins an immutable metadata entry, not the answer itself. Metadata entries contain source versions and review status, never profile or prose.
type Evidence ¶
type Evidence struct {
Schema int `json:"schema"`
ID string `json:"id"`
Revision string `json:"revision"`
Question string `json:"question"`
Facts []string `json:"facts"`
Sources []string `json:"sources"`
}
func DecodeEvidence ¶
type Plan ¶
type Plan struct {
Schema int `json:"schema"`
Recipe Recipe `json:"recipe"`
ReferenceID string `json:"reference_id"`
ReferenceRevision string `json:"reference_revision"`
ReferenceSHA256 string `json:"reference_sha256"`
EvidenceID string `json:"evidence_id"`
EvidenceRevision string `json:"evidence_revision"`
EvidenceSHA256 string `json:"evidence_sha256"`
RequestSHA256 string `json:"request_sha256"`
Request delegation.Request `json:"request"`
}
type Recipe ¶
type Recipe struct {
Model string `json:"model"`
MaxInputTokens int64 `json:"max_input_tokens"`
MaxOutputTokens int64 `json:"max_output_tokens"`
ReuseForSeconds int64 `json:"reuse_for_seconds"`
MinWords int `json:"min_words"`
MaxWords int `json:"max_words"`
Paragraphs int `json:"paragraphs"`
Forbidden []string `json:"forbidden"`
}
func DefaultRecipe ¶
type Reference ¶
type Reference struct {
Schema int `json:"schema"`
ID string `json:"id"`
Revision string `json:"revision"`
Facts []string `json:"facts"`
Style []string `json:"style"`
}
func DecodeReference ¶
type ReviewIndex ¶
type ReviewIndex struct {
Schema int `json:"schema"`
ReferenceID string `json:"reference_id"`
Entries []EntryRef `json:"entries"`
}
ReviewIndex persists bounded historical metadata references. It grants no cache eligibility, extends no inference TTL, and asserts no human acceptance.