context_audit: Audit context inclusion and token costs

View source: R/context_audit.R

context_auditR Documentation

Audit context inclusion and token costs

Description

Reports metadata, exact duplicate sources, native overlap, missing or unreadable files, audience exclusions, explicit truncation, and size thresholds. Does not print or retain source bodies in its result, execute snippets, or infer semantic contradictions from arbitrary text.

Usage

context_audit(manifest, layer_tokens = 2000L, total_tokens = 8000L)

Arguments

manifest

A manifest returned by context_manifest.

layer_tokens

Estimated-token warning threshold for one source.

total_tokens

Estimated-token warning threshold for rendered context.

Value

A saber_context_audit list with metadata-only sources, findings (source_id, code, severity, related_id), total emitted sizes, and the estimator label. Native tokens are not part of the emitted total.

Examples

m <- context_manifest("corteza", discover = FALSE,
    extra_sources = list(list(id = "note", kind = "memory", text = "A note.")))
context_audit(m, layer_tokens = 1)

saber documentation built on Nov. 10, 2026, 9:06 a.m.