AiTrace 0.1.0-preview.10

This is a prerelease version of AiTrace.
dotnet add package AiTrace --version 0.1.0-preview.10
                    
NuGet\Install-Package AiTrace -Version 0.1.0-preview.10
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AiTrace" Version="0.1.0-preview.10" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AiTrace" Version="0.1.0-preview.10" />
                    
Directory.Packages.props
<PackageReference Include="AiTrace" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AiTrace --version 0.1.0-preview.10
                    
#r "nuget: AiTrace, 0.1.0-preview.10"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AiTrace@0.1.0-preview.10
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AiTrace&version=0.1.0-preview.10&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=AiTrace&version=0.1.0-preview.10&prerelease
                    
Install as a Cake Tool

⚠️ Status: Experimental

AiTrace.NET is under active development.
APIs may change. Not production-ready yet.

AiTrace.NET

Audit & Proof Layer for AI Decisions in .NET

NuGet NuGet Pro Website

Know exactly what your AI did, when, and why.


Install

dotnet add package AiTrace --prerelease

# Pro features (signatures, compliance reports, evidence bundles)
dotnet add package AiTrace.Pro --prerelease

Quickstart

// Program.cs
builder.Services.AddAiTrace(o =>
{
    o.StoreContent = true;
    o.BasicRedaction = true;
});

Then inject IAuditStore wherever you need it, or use AiTrace.AiTrace.LogDecisionAsync() directly.

Option 2 — Static configuration (console apps, workers)

By default, audit files are written to a local ./aitrace folder next to your application's executable.

using AiTrace;

AiTrace.AiTrace.Configure(o =>
{
    o.StoreContent = true;
    o.BasicRedaction = true;
});

await AiTrace.AiTrace.LogDecisionAsync(new AiDecision
{
    Prompt = "Summarize: The quick brown fox jumps over the lazy dog.",
    Output = "A fox jumps over a dog.",
    Model = "demo-model",
    UserId = "user-123",
    Metadata = new Dictionary<string, object?>
    {
        ["Feature"] = "Demo",
        ["CorrelationId"] = Guid.NewGuid().ToString("n")
    }
});

Console.WriteLine("Audit file created in ./aitrace next to your app.");

This creates an immutable JSON audit record containing:

  • timestamp (UTC)
  • cryptographic hash
  • model identifier
  • user identifier
  • prompt and output (optional)
  • structured metadata

What's new in 0.1.0-preview.9

  • ASP.NET Core DI supportAddAiTrace() extension method for IServiceCollection
  • AiTrace.Pro now on NuGet — install separately with dotnet add package AiTrace.Pro
  • Thread-safe storesJsonAuditStore and SignedJsonAuditStore are now safe under concurrent writes
  • VerificationScope fixUserId and Model filters now correctly applied during chain verification
  • FailOnMissingFiles policy — now enforced when a manifest.txt is present in the audit directory
  • Improved error messagesDecisionDto returns proper 400 responses for missing required fields

API (Local)

A minimal API is included in the solution (AiTrace.Api) for testing audit logging and verification via HTTP.

Configure

Set your keys and audit folder in AiTrace.Api/appsettings.json:

{
  "AiTraceApi": {
    "AuditRoot": "aitrace",
    "PrivateKeyPath": "C:\\temp\\aitrace_private.pem",
    "PublicKeyPath": "C:\\temp\\aitrace_public.pem"
  }
}

Run

cd AiTrace.Api
dotnet run

Then open Swagger:

  • https://localhost:7266/swagger
  • or http://localhost:5095/swagger

Endpoints

  • POST /api/decisions — log an audit record
  • POST /api/verify — verify integrity/signatures and optionally export reports
  • GET /api/reports/text — get latest text report
  • GET /api/reports/json — get latest JSON report

Verification & Integrity

AiTrace audit records are designed to be verifiable after the fact.

Each record includes:

  • a cryptographic hash
  • an optional hash chain (PrevHashSha256)
  • optional cryptographic signatures (Pro)

Audit trails can be verified programmatically to detect:

  • record tampering
  • missing or altered files
  • broken chains
  • invalid signatures

Verification produces:

  • a structured machine-readable result
  • a human-readable compliance report summarizing integrity and authenticity

🔍 Audit Diffing & Evidence Comparison (Pro)

AiTrace Pro includes audit-only diffing capabilities designed for forensic verification, regulatory review, and CI compliance gates.

Diff audit trails between two evidence bundles

The diff-audit command compares only audit/*.json records between two sealed evidence bundles.

dotnet run -- diff-audit "<bundleA>" "<bundleB>"

It detects:

  • added audit records
  • removed audit records
  • modified audit records

Other files (reports, metadata, manifests) are ignored.


Semantic audit classification

Each comparison is classified as:

  • IDENTICAL — audit trails are byte-for-byte equivalent
  • EXTENDED — new audit records were appended (append-only)
  • ALTERED — records were removed or modified

This distinction is critical for legal and compliance scenarios.


Append-only & integrity assertions

Assertions allow enforcement in CI pipelines or compliance checks:

# Fail unless audit trails are identical
dotnet run -- diff-audit --assert-identical "<bundleA>" "<bundleB>"

# Fail unless audit trail is append-only
dotnet run -- diff-audit --assert-append-only "<bundleA>" "<bundleB>"

Exit codes are deterministic and machine-actionable.


Deterministic audit hash

Each audit trail produces a stable SHA-256 audit hash, computed from ordered (path, sha256) pairs of audit/*.json.

This allows fingerprinting the audit history independently of:

  • reports
  • bundle metadata
  • export timestamps

JSON output & file export

For automation and archiving:

dotnet run -- diff-audit --json --out diff_audit.json "<bundleA>" "<bundleB>"

The JSON output includes:

  • bundle paths
  • bundle hashes
  • audit hashes
  • added / removed / modified records
  • semantic status
  • exit code
  • assertion results (if any)

This makes audit evolution scriptable, auditable, and suitable for regulatory review.

CI / Automation Example

The diff-audit command is designed to be CI-friendly and can be used as a compliance gate in automated pipelines.

Example: fail CI if audit trail was altered
dotnet run -- diff-audit --assert-append-only --quiet "<previous_bundle>" "<current_bundle>"

if [ $? -ne 0 ]; then
  echo "Audit trail integrity violation detected"
  exit 1
fi

Cryptographic Signatures (Pro)

AiTrace Pro supports cryptographic signing of audit records.

When enabled:

  • the final audit record hash is signed (RSA-SHA256)
  • signatures provide non-repudiation
  • records can be independently verified using a public key

Signatures are applied after all record data is finalized.


Compliance Reports (Pro)

AiTrace Pro can generate compliance-ready audit reports from an audit directory.

Supported formats:

  • compliance_report.txt
  • compliance_report.json

Reports summarize:

  • verification status
  • record and chain integrity
  • signature requirements and validity
  • number of files verified
  • time range covered

Evidence Bundles (Pro)

AiTrace Pro can export a portable, regulator-grade evidence bundle from an audit directory.

An evidence bundle is a self-contained, immutable snapshot of an AI audit trail.

Evidence Bundle Structure

evidence_YYYYMMDD_HHMMSS/ ├── audit/ │ ├── 20260121_185311116_xxxxx.json │
└── ... ├── compliance_report.txt ├── compliance_report.json ├── README.txt ├── manifest.txt ├── public_key.pem (optional) └── seal.json


Evidence Bundle Sealing (Pro)

AiTrace Pro supports cryptographic sealing of evidence bundles.

After an evidence bundle is exported, the entire folder can be sealed using a deterministic SHA-256 process.

What is seal.json?

seal.json contains:

  • a SHA-256 hash for every file in the bundle
  • a deterministic global bundle hash
  • timestamp and algorithm metadata

Any modification to the bundle will be detected.

This allows the bundle to serve as a point-in-time cryptographic evidence snapshot.

Seal an Evidence Bundle

using AiTrace.Pro.Verification.Evidence;

var sealPath = EvidenceBundleSealer.WriteSeal(evidenceBundleDirectory);
Console.WriteLine($"Seal written to: {sealPath}");

Verify a Sealed Bundle (Independent Check)

var (ok, reason) = EvidenceBundleSealer.VerifySeal(evidenceBundleDirectory);

Console.WriteLine(ok
    ? "Seal OK: bundle is intact"
    : $"Seal FAIL: {reason}");

This enables:

  • offline verification
  • third-party audits
  • regulator review
  • long-term evidence archiving

AiTrace provides a cryptographic proof layer for automated decisions.

It enables organizations to prove, after the fact, that:

  • a specific decision occurred
  • at a specific time
  • with specific inputs and outputs
  • without later alteration

AiTrace does not explain decisions — it proves what happened.


Licensing & Usage

AiTrace.NET is released under the MIT License.

You may:

  • use the source code freely
  • modify and fork the project
  • use AiTrace.NET for internal or experimental use

AiTrace.Pro (Compliance & Production Usage)

AiTrace.Pro includes:

  • cryptographic signatures
  • strict verification policies
  • compliance reports
  • evidence bundles
  • bundle sealing and verification

While source code is visible, production or compliance-grade usage requires a valid license.

Forking or reimplementing AiTrace.Pro:

  • does not grant compliance guarantees
  • does not provide legal assurance

Philosophy

AI explanations can change.
Facts cannot.

AiTrace.NET records what actually happened —
so you can prove it later.


License

MIT License

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on AiTrace:

Package Downloads
AiTrace.Pro

Pro add-on for AiTrace: RSA signing, chain verification, compliance reports, evidence bundles and regulator-grade audit trails for AI decisions in .NET.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-preview.10 36 8/12/2026
0.1.0-preview.9 56 7/15/2026
0.1.0-preview.8 109 1/29/2026
0.1.0-preview.7 80 1/21/2026
0.1.0-preview.6 91 1/16/2026
0.1.0-preview.5 79 1/15/2026
0.1.0-preview.4 86 1/9/2026
0.1.0-preview.3 91 1/8/2026
0.1.0-preview.2 90 1/6/2026
0.1.0-preview.1 92 1/5/2026