npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

anatrace-core

v0.4.1

Published

Pure cross-harness session parsing and deterministic policy verification for AI agents

Downloads

950

Readme

anatrace-core

Pure, deterministic primitives for working with AI-agent session evidence:

  1. Parse Claude Code and Codex transcripts into one NormalizedSession.
  2. Derive timeline, provenance, cost, metadata, and scrubbed content.
  3. Compile .anatrace.yaml into the framework-neutral Mandate IR.
  4. Resolve deterministic satisfied | violated | unverifiable policy verdicts.

The core has no filesystem, network, clock, randomness, or LLM dependency.

npm install anatrace-core

Parse a session

import { parseSession } from 'anatrace-core';

const session = parseSession([
  { name: 'parent', bytes: transcriptBytes },
]);

if (!session) throw new Error('Unsupported transcript');
console.log(session.harness, session.events, session.counts);

Load and verify a policy

import {
  loadPolicyYaml,
  verdictsForMandate,
} from 'anatrace-core';

const loaded = loadPolicyYaml(`
version: 1
rules:
  - id: no-destructive-command
    subject: this-agent
    never_run: rm -rf
`);

if (!loaded.ok) throw new Error(loaded.errors.join('\n'));

const verdicts = verdictsForMandate(
  loaded.mandate,
  session,
  undefined,
  undefined,
  '',
  { thisAgent: { kind: 'root' } },
);

Delegate-inclusive negative conclusions require reconciled CaptureCoverage: observed lineage from transcripts/sidecars/hooks plus the caller's expected launch boundary. Without complete recursive coverage they return unverifiable: delegate-coverage-incomplete. Detected violations remain provable without completeness.

Callers that have raw launcher intent can use coverageFromExpectedLaunchBoundary(boundary, lineage) to produce deterministic coverage. Expected records alone do not prove capture; a lane is marked captured only when the supplied lineage says its transcript bytes were checked. The generated coverage is itself marked incomplete when reconciliation lineage is partial or has gaps.

never_read covers structured reads and recognized shell readers. never_egress covers shell network commands, network tools, and MCP calls. Unknown tools and unsupported commands produce unverifiable: channel-coverage-incomplete, with typed details in Report.verificationCoverage and Dossier.verificationCoverage.

Session facts for downstream consumers

Beyond the verdict, anatrace-core exposes a deterministic, facts-only projection layer for tools that consume it for parsing + session facts (no LLM, no verdict, no identity/score):

import { buildSessionMeta, gitOpsTimeline, runnerOutcomes } from 'anatrace-core';

const meta = buildSessionMeta(session);          // per-session aggregate facts (git/context/flow/…)
const gitOps = gitOpsTimeline(session.events);   // positioned mutating git ops (when/order/lane)
const tests = runnerOutcomes(session.events);    // structured pass/fail/unknown, runner-gated

runnerOutcomes classifies only on a runner-specific banner (vitest/jest, the ana verdict line) and abstains otherwise — pytest/cargo/go are a deliberate blind spot, never a guessed pass. gitOpsTimeline shares the verdict path's quote-aware segmentation, so quoted/data git tokens are never phantom ops. Full reference, including the honesty floor and the known blind spots: docs/reference/session-facts.md.

See the repository README for CLI usage and the full honesty contract.