DEV Community

AiTraceDev
AiTraceDev

Posted on

How I built tamper-proof audit trails for AI decisions in .NET

Every time your app calls an LLM, a question hangs in the air: if something goes wrong, can you prove exactly what happened?

Not a log file. Not a database record someone could edit. Actual cryptographic proof.

That is the problem I built AiTrace.NET to solve.

The problem with regular logging

Application logs are great until they become evidence. A log file can be edited, deleted, or backdated. When a client disputes an AI-generated output, a timestamp in a database means nothing without proof of integrity.

What AiTrace does differently

Each decision record gets SHA-256 hashed. The hash of the previous record is embedded in the next one, creating a chain. Break the chain by modifying or removing any record, and verification fails immediately.

// 1. Register in ASP.NET Core
builder.Services.AddAiTrace(o =>
{
    o.StoreContent = true;
    o.BasicRedaction = true;
});

// 2. Inject and log a decision
public class DecisionService(IAuditStore store)
{
    public async Task LogAsync()
    {
        await store.LogDecisionAsync(new AiDecision
        {
            Prompt = "Summarize the contract.",
            Output = "The contract covers...",
            Model = "gpt-4o",
            UserId = "user-42"
        });
    }
}
Enter fullscreen mode Exit fullscreen mode

One NuGet package. No external service. No database required. Records are plain JSON files in a local folder you control.

dotnet add package AiTrace --prerelease

Who this is for

Any .NET team using LLMs in a context where auditability matters: legal tech, fintech, healthcare, insurance, or any regulated space where "the AI said so" is not an acceptable answer.

What is next

The Pro tier adds RSA-SHA256 signatures per record, compliance reports, and sealed evidence bundles ready for legal review.

The core package is MIT, open source, and free forever.

GitHub: https://github.com/aitrace-dotnet/AiTrace.NET
NuGet: https://www.nuget.org/packages/AiTrace/0.1.0-preview.10
Docs: https://aitrace-dotnet.github.io/AiTrace.NET/

Top comments (0)