Skip to content

API reference

Scope: the export surface. How to use it is Build on tracevals. Source of truth: src/tracevals/index.ts.

import { tracevals } from "@hawkeyexl/manni";
const trace = tracevals.parseTraceFile("session.jsonl");

The tool is a namespace export on the package root, beside docevals, cite and key. The metadata tool’s names are the package’s flat export. Every sibling tool sits under its own namespace, so two tools can both have a loadConfig without colliding. There is no subpath import for tracevals.

ESM-only, Node.js 24 or newer, types shipped. ★ marks an intended entry point. The rest is exported because the CLI is built from it and it is useful for tests. The starred ones are where to start.

ExportNotes
★ runEvalsRuns the whole pipeline, returns RunReport. Needs a judge unless deterministicOnly.
EngineOptionstracePath, projectDir?, env?, config, judge?, deterministicOnly?.

The CLI’s verbs, callable directly. Each pairs a runner with a renderer.

ExportNotes
runRun, RunCommandOptions, RunCommandResultrun, one trace. RunCommandOptions.judge injects a judge.
prepareRun, runOne, RunContext, RunSharedOptionsThe seams a batch reuses. Build the judge, config and plugins once, then evaluate one trace.
runBatch, resolveBatchTraces, parseNewerThan, keepNewerThan, BatchCommandOptions, BatchCommandResultrun over many traces. BatchCommandResult.outcomes pairs each file with its report, errors included.
runCalibrate, CalibrateCommandOptions, CalibrateCommandResultcalibrate. Accepts the same judge injection through RunSharedOptions.
runFill, renderFill, FillOptions, FillReport, FillArtifactResult, FillRun, FillStatus, SharpeningNotefill. FillOptions.providerInstance injects a provider.
runCapture, renderCapture, CaptureCommandOptions, CaptureCommandResultcapture.
runList, renderList, ListOptions, ListRunlist.

The command options spell each flag in camelCase:

OptionFlagNotes
newerThan--newer-thanA duration string such as "7d", on BatchCommandOptions, CalibrateCommandOptions and ListOptions. parseNewerThan turns one into milliseconds and throws on any other spelling.
allowExecution--allow-execution, --no-executionThe grants to keep, such as ["frontmatter-commands"]. Absent keeps every grant execution.allow holds, and [] runs no command eval. It never widens the config.
failOnReview--fail-on-review, --no-fail-on-reviewOverrides config.failOnReview. Absent defers to the config.
ExportNotes
★ parseTraceFileDetect the format and parse, returning Trace.
parseTraceContentThe same from a string.
detectFormat, detectContentFormatFormat sniffing on its own.
★ discoverTracesScan the session store. Returns TraceListing[], newest first.
configDirClaude Code’s config directory: CLAUDE_CONFIG_DIR when set, and ~/.claude otherwise.
slugForThe project-slug rule, which turns every non-alphanumeric character into a hyphen.
pickTrace, PickerChoice, PromptFnThe interactive picker. PromptFn makes it testable.
DiscoverOptions, TraceListing
availableAtFilter an availability list to the entries offered at that ordinal.
offeredNamesEvery distinct name that was offered at any point.
joinDescriptionsParse a listing’s - name: description lines onto its names. Handles plugin:skill and wrapped descriptions.
newAvailabilityAn empty roster, for a synthetic Trace.
Trace, TraceSource, TraceFormat, TraceEvent, TraceUsage, ToolCall, SkillInvocation, AgentSpawn, SubagentBranch, FileAccessThe trace model.
TraceAvailability, AvailabilityEntry, AvailabilityKind, McpServerStatusThe availability roster a trace records.
ExportNotes
★ resolveArtifactsTrace-driven resolution. Returns artifacts, coverage and warnings.
discoverArtifactsStatic, project-only scan. What fill uses.
PROJECT_RULES_FILENAMES["CLAUDE.md", "AGENTS.md", "GEMINI.md"].
coverAvailabilityClassify coverage rows as offered-and-used, offered-not-used, or not-offered, and count the roster.
ResolveOptions, DiscoverArtifactsOptions, DiscoveredArtifact, DiscoveryResult, AvailabilityCoverage, AvailabilityOptions
findGitRoot, findInTree, listInTree, safeRead, safeMtime, PRUNED_DIRSFilesystem helpers the resolvers share. All degrade to null or empty rather than throwing.
ResolvedArtifact, ResolvedArtifacts, ArtifactType, ArtifactOrigin, CoverageEntry, ArtifactAvailability, AvailabilityReport, AvailabilityCountsThe artifact model.
ExportNotes
extractEvalsRead and validate an artifact’s metadata.evals block.
appendArtifactEvalsAppend evals to frontmatter. The one write path.
ARTIFACT_EVALS_SCHEMA_IDmanni:artifact-evals:1.1.0, the id a finding about the block names as its schema.
EvalEntry, EvalType, ExtractedEvals, Severity, NewEvalEntry, EvalProvenanceSeverity is the family scale, error | warning | notice.
ExportNotes
planEvalsTurn artifacts into EvalPlan[]. The optional second argument returns each artifact’s SuppliedMetadata, its front matter merged with any manifest. Each plan’s location is the entry that declares the eval.
IMPLICIT_EVAL_NAME"adheres-to-artifact".
★ registerGraderAdd a kind at run time. See Custom graders.
graderFor, listGraderKinds
BUILTIN_GRADER_KINDSThe kinds this tool ships, frozen before anything can register over them.
loadGraderPluginsImport grader plugins the way run and fill do, with the same resolution and the same warnings. Throws TracevalsError on a specifier that will not load.
GraderPluginApi, GraderPluginRegister, LoadGraderPluginsOptions, LoadedGraderPlugins
EvalPlan, EvalLocation, SuppliedMetadataEvalLocation is { file, line? }. SuppliedMetadata is { extracted, locate? }, where locate names the manifest file and line behind a merged value.
TraceGrader, GradeResult, Finding, TraceGraderContextThe grader contract.
windowForThe slice of the trace that plan’s artifact governed. A custom grader that counts events should read this rather than the trace.
skippedWindowThe GradeResult for an empty window, which is a skip carrying its reason, never a pass.
TraceWindow
validateWhen, evaluateWhenThe conditional trigger contract, shared so a custom grader implements it identically.
matchesGlob, globToRegExpThe path glob when.file-access uses.
WHEN_CONDITIONS, WhenCondition, TriggerResult
ExportNotes
makeTraceJudgeBuild the ensemble judge.
makeJudgeProvider, providerSpecForProvider construction. providerSpecFor resolves identity without constructing, so a fully cached run needs no API key.
renderTraceThe transcript as the judge sees it, redacted. With a plan, only that artifact’s window.
makeRedactorThe scrubber renderTrace applies. Built-in shapes plus any extra sources, which add to them.
REDACTION_PATTERNS, CUSTOM_PLACEHOLDERThe built-in shapes with their labels, and the placeholder a configured pattern produces.
compileRedactPatternsCompile-check pattern sources up front. Throws TracevalsError on one that will not compile.
RedactionPattern, Redactor
JUDGE_SYSTEM_PROMPT, buildUserContentThe prompts.
PROMPT_VERSIONCache-key component. Bump on any prompt change.
cacheKey, sha256
TraceJudge, JudgedEval, TraceJudgeOptions, RenderOptions
MockResponseThe canned judge response this repository’s own tests inject. It is a test seam, not a provider you configure.
ExportNotes
★ loadConfigRead manni.config.yaml from a directory, take its tracevals section, validate, and fully populate defaults.
parseConfigThe same from an object. The argument is the section, not the whole file. Pass what sits under tracevals:.
DEFAULT_CONFIG_FILENAME"manni.config.yaml", the one config file the family shares.
CONFIG_SECTION_KEY"tracevals", the top-level key in that file holding this tool’s settings.
TracevalsConfig

Downstream code always receives a fully-populated config, so there is no need to re-apply defaults. Connection settings for inference live elsewhere. They are in the family’s top-level providers: map, shared with manni meta fill and manni docevals. See the configuration reference.

ExportNotes
★ renderOne report as "pretty", "json" or "markdown".
renderBatch, renderBatchHuman, renderBatchMarkdownThe aggregate shape.
renderCalibration, renderCalibrationHuman, renderCalibrationMarkdownThe calibration shape.
aggregate, BatchOutcomeFold per-trace reports into rates. Pure.
ReportFormat
appendHistory, loadHistory, compareToLast, entryFor
HistoryEntry, HistoryEval, HistoryComparison
TracevalsError, RunReport, EvalResult, RunSummary, Outcome, BatchReport, AggregateRow, AggregateCounts, BatchTraceEntry, BatchSummaryThe report model. Each EvalResult carries the location that declares its eval. See location. It also carries guidance, a Guidance object of id, rule, description and guide, typed by the package root’s Guidance export. See guidance.
CalibrationReport, CalibrationCounts, Disagreement, SweepCell, CalibrationGate, JudgeSetting, JoinKind, EvalLabel, LabelOutcomeThe calibration model.
loadLabels, parseLabels, labelKey, DEFAULT_LABELS_FILEThe labels sidecar. parseLabels resolves trace paths against the file’s own directory.
joinLabels, score, rescore, classifyPure calibration arithmetic. rescore re-applies zones and ensemble depth to a result’s cached runs, with no provider involved.
JoinedLabel, AmbiguousLabel, JoinResult, Rescored, ScoreInput, ScoreResult

TracevalsError is the operational-failure type, and it extends the family’s ToolError. The CLI maps it to exit 2. Catch it when you want to tell “the tool could not run” apart from “a check failed”.

The session manifest manni tracevals capture writes, so staleness is a fact rather than a guess.

ExportNotes
buildManifest, BuildManifestOptionsBuild a manifest from a finished session.
writeManifest, readManifest
findManifest, FindManifestOptions, FoundManifest, siblingManifestPath, manifestPathForLocating the manifest for a trace.
checkContent, hashFile, sha256HexCompare an artifact on disk against what the session read.
deviceId, readGit, redactDeep, relPosix, safeSessionId
parseHookPayload, readStdin, HookPayloadThe Claude Code hook contract capture reads on stdin.
SessionManifest, ManifestArtifact, ManifestGit, ManifestReport, ContentCheck, ContentCheckStatus
MANIFEST_VERSION, DEFAULT_CAPTURE_DIRDEFAULT_CAPTURE_DIR is .manni/tracevals/sessions.

Exported so the authoring path is testable and extensible. Most consumers will not need these.

ExportNotes
gateProposals, GateOptions, GateResultThe gate, in order.
ALLOWED_GRADERSPer-artifact-type grader allowlist.
ProposedEval, Rejection, RejectionReason, Vocabulary
PROPOSAL_SCHEMA, isValidProposalThe shape a proposal must match.
systemPromptFor, buildFillUser
FILL_PROMPT_VERSION, MAX_BODY_CHARSCache-key components.
FillCache, fillCacheKey, FillCacheKeyPartsSeparate from the judge cache.
artifactFacts, ArtifactFactsGrounding inputs, not evals.
buildVocabulary, BUILTIN_TOOLS
mockFillProposalThe canned proposal the test seam returns.