Date Shear: A New Term for a Common Programming Pain Point

One of the sneakiest, hardest to explain bugs. The process works fine any day you test it, but occasionally – and only occasionally it’s just… wrong. Test it again and it’s fine, no matter what day you test it.

This particular issue stems from a habit of grabbing a datetime whenever you need it, but coding as if you were getting the same value each time. It’s an easy to explain issue, but there’s not a term for it (as far as I can tell), so, I coined one: Date Shear.

What is Date Shear?

Date Shear (noun): Insidiously difficult to reproduce bugs that occur due to code fetching the “current time” multiple times, while the logic expects the same value. The result can be catastrophically incorrect behavior if the code is executed across a day, month or year boundary.

A Common Example

Imagine building a Quarterly report based on the current day:

  1. Just before midnight, a GetDate() or similar method gets the current datetime, and uses that to determine the start date for the “current” quarter.
  2. (Clock ticks midnight)
  3. Just after midnight, a GetDate() or similar method gets the current datetime, again (but it’s now in the next month) and uses that to determine the end date for the “current” quarter.

Now, you end up with the start of one quarter and – potentially – the end of the next quarter. This only happens if the request crosses into the next day, on the last day of the month, in the last month of a quarter.

Adding to the annoyance is that reports are often run by companies as part of an overnight batch process, increasing the likelihood of this occurring in a production environment… but testers are less likely to be testing functionality in the middle of the night – and daytime testing won’t reproduce the issue.

Why Naming This Matters

They say that “naming something gives it power”… but I would say that naming something gives you power over it. When we name a specific type of bug, we make it easier to communicate during code reviews and architectural planning. Instead of saying, “We need to double check the date handling to see if there’s something fishy in there,” you can simply say, “We need to guard against Date Shear here.”

The Solution for Date Shear

In simple single-script or single-method processes, the solution is simple. Grab a datetime at the beginning, store it in a variable and reuse it. In some cases, taking a parameter of the date in question is a good way to handle it.

For processes that call other processes (that may call further processes), taking the date in question in as a parameter allows them to all “be on the same page”.

What do you think? Have you encountered “Date Shear” in your own projects? Is there a better name for this that I’m somehow missing?

Avrupa Haber Ajansları Birliği Bahar Konferansı, Lahey'de yapıldı

Avrupa Haber Ajansları Birliği (EANA) Genel Kurulu ve Bahar Konferansı, Lahey’de ‘Dezenformasyon Dünyası: Haber Ajanslarının Karşılaştığı Zorluklar ve Çözüm Yolları’ temasıyla düzenlendi. AA Genel Müdürü Serdar Karagöz, dezenformasyonla mücadelede iş birliğinin önemini vurgularken, uzmanlar yalan haberin demokrasiye tehdit oluşturduğunu belirtti.

Erdoğan EFES-2026'da ASELSAN'ın oyun değiştirici sistemlerini inceledi

Cumhurbaşkanı Recep Tayyip Erdoğan, ASELSAN’ın ileri teknolojileriyle boy gösterdiği EFES-2026 Tatbikatı’nda oyun değiştirici sistemlerle ilgili bilgi aldı
– ASELSAN’ın sahada kullanılan çözümleri, birçok yabancı askeri heyet ve sektör temsilcisi tarafından yakından incelendi
– ASELSAN’ın sahada kendini kanıtlayan teknolojileri, Türk savunma sanayisinin küresel rekabetteki yükselişinin somut örneklerinden biri olarak dikkati çekti

Four Metrics That Actually Tell You Whether Your Enterprise RAG Is Working

enterprise-rag-evaluation

Enterprise RAG — A practitioner’s build log | Post 4 of 6

RAG evaluation in most implementations stops at one question: did the system retrieve the document that was supposed to be retrieved?

That is the right question for a consumer search product. It is an incomplete question for an enterprise knowledge system where some documents are accessible to all employees and others are restricted by role. In that environment, retrieval correctness is necessary but not sufficient. You also need to know whether restricted documents leaked into answers they should not have influenced.

Enterprise RAG implements four metrics. Each measures a different failure mode. Together they constitute a validation standard that is appropriate for internal knowledge systems handling mixed-sensitivity documents.

The four metrics and what each catches

Pass rate — the percentage of evaluation cases where expected documents were retrieved and forbidden documents were not.

This is the composite metric. A case passes only when both conditions hold simultaneously: the expected documents appear in the citation set and no forbidden documents appear. A system that retrieves all expected documents but also leaks one forbidden document does not pass that case. Pass rate does not reward partial correctness.

Restricted leakage count — the number of evaluation cases that returned at least one forbidden document in the citation set.

This is the most operationally critical metric for an enterprise deployment. A restricted leakage count of zero means the role filter is working correctly across every test case in the evaluation set. Any non-zero value indicates a specific failure to investigate — which case, which document, which role, which query.

Citation coverage — the average number of citations returned per evaluation case.

Low citation coverage indicates that the retrieval system is returning answers without grounding them in source documents. In an enterprise context, an answer without citations cannot be verified, audited, or traced back to a source document. Citation coverage is a proxy for answer auditability.

Average latency (ms) — the mean query execution time across all evaluation cases.

Latency is not a quality metric. It is an operational baseline. If latency increases after a retrieval configuration change — switching from local lexical to Azure AI Search, adding a reranking step, increasing chunk count — the evaluation run captures it. Latency regression during evaluation is a signal worth investigating before deploying the change.

What the evaluation output looks like

Running POST /eval/run returns all four metrics in a single response alongside the per-case results:

{
  "pass_rate": 1.0,
  "restricted_leak_count": 0,
  "citation_coverage": 2.4,
  "average_latency_ms": 38.2,
  "cases": [...]
}

Each case in the result array includes the question, the role used, the retrieved document IDs, and a pass/fail indicator. A failed case shows exactly which expected document was missing or which forbidden document leaked.

enterprise-rag-evaluation

The evaluation runner calls POST /query internally for each case, which means it exercises the entire pipeline: authentication, role filter, retrieval, generation, and citation assembly. The metrics reflect actual system behavior, not a mocked retrieval path.

Why the evaluation set structure matters as much as the metrics

The evaluation set (demo/evaluation_set.json) defines each case with three fields alongside the question and role:

  • Expected document IDs — documents that must appear in the citation set for the case to pass
  • Forbidden document IDs — documents that must not appear in the citation set

Both lists are required for every case. An evaluation case without forbidden document IDs cannot measure restricted leakage. An evaluation set without any cases involving restricted documents cannot validate access control at all.

Most RAG golden sets I have reviewed define expected documents only. They measure retrieval recall but provide no signal on access control correctness. Adding forbidden document IDs to every test case involving a restricted document is the minimum viable evaluation standard for an enterprise knowledge system.

enterprise-rag-citations

What the evaluation set does not yet cover

The current evaluation set is optimized for access-control validation and citation tracing. It does not yet cover:

  • Answer correctness — whether the generated answer is factually accurate relative to the cited documents. This requires human relevance labels or LLM-as-judge evaluation templates.
  • Semantic retrieval quality — the lexical retriever handles the current evaluation set well. A semantic retrieval configuration may return different ranked results that pass the access-control checks but rank differently by relevance.
  • Regression thresholds in CI — the evaluation runner is callable from CI. The current setup does not fail a CI run if pass rate drops below a threshold. Adding a threshold check (if restricted_leak_count > 0: fail) to the CI workflow is the practical next hardening step.

These are documented roadmap items, not silent gaps.

Current limits

  • Evaluation set size is small — calibrated for repeatable local validation, not production-scale coverage.
  • Answer correctness evaluation requires human labels or an LLM judge. Neither is implemented in the current evaluation runner.
  • Latency benchmarks reflect the local SQLite retrieval path. Azure AI Search latency profiles will differ.
  • The evaluation runner requires the ADMIN_TOKEN when management protection is enabled, which prevents accidental evaluation runs in shared environments.

Next engineering step

Review the evaluation cases in demo/evaluation_set.json and count how many include at least one forbidden document ID. If any cases have only expected documents, add a forbidden document ID for a restricted document that should not be retrievable by that role. Then re-run POST /eval/run and verify the leakage count remains zero.

One question for you

Does your current RAG evaluation set include forbidden document IDs alongside expected document IDs? If not, how do you validate that restricted documents are not influencing answers for unauthorized roles?

Next post: Security decisions in Enterprise RAG — how API keys, audit logs, and the order of role enforcement work together to make the system defensible.

Beyond the Stateless Prompt: Building an Auditable Product Intelligence Pipeline with Cascadeflow and Hindsight

Pasting a 10,000-line CSV of customer support reviews into a stateless LLM context window is lazy engineering, and the results show it. You get hallucinated aggregates, ignored edge cases, and zero traceability when a stakeholder asks why a critical bug was classified as low priority.

When building PulseIQ—an enterprise platform designed to synthesize unstructured customer feedback into prioritized engineering action items—we rejected the stateless “dump-everything-into-GPT” pattern. We needed a system that was deterministic where it mattered, semantic where it counted, and fully auditable. We also needed the system to understand time; a complaint about onboarding in version 2.2 has a completely different engineering context than the same complaint in version 1.8.

To solve this, we built a hybrid architecture that integrates Cascadeflow’s orchestration pipeline to process feedback through an explicit, 10-stage evaluation graph, paired with Hindsight’s contextual memory layer to track sentiment regressions and issue streaks over product version releases.

Gating the Pipeline: Cascadeflow Heuristics

A major pain point of building LLM pipelines is the lack of structural predictability. Raw customer reviews are messy—containing HTML tags, casing noise, and random casing symbols.

We used docs.cascadeflow.ai as our blueprint for constructing a 10-stage sequence. By enforcing strict TypeScript schemas for each step, we ensure that early stages normalize data deterministically before passing it to expensive semantic evaluation steps.

Here is how the pipeline is orchestrated in cascadeflow.ts:

export class CascadeflowEngine {
  private stages: PipelineStage[];

  constructor() {
    this.stages = CascadeflowEngine.getInitialStages();
  }

  public async executePipeline(
    inputText: string,
    onProgress: (stages: PipelineStage[], activeStageId: string | null, currentLog: string, result?: PipelineResult) => void,
    latencyMs: number = 400
  ): Promise<PipelineResult> {
    const activeStages = [...this.stages];
    onProgress(activeStages, 'stage-1', "[Ingest Engine] Raw payload received.");

    // Stage 1: Ingest
    activeStages[0].status = 'processing';
    await this.delay(latencyMs);
    activeStages[0].status = 'completed';

    // Stage 2: Data Cleaning
    activeStages[1].status = 'processing';
    const cleanedText = this.cleanText(inputText);
    onProgress(activeStages, 'stage-2', `[Sanitizer] Cleaned text: "${cleanedText.substring(0, 40)}..."`);
    await this.delay(latencyMs);
    activeStages[1].status = 'completed';

    // Stage 3: NLP Tokenization
    activeStages[2].status = 'processing';
    const tokens = this.extractTokens(cleanedText);
    onProgress(activeStages, 'stage-3', `[Tokenizer] Extracted ${tokens.length} semantic vectors.`);
    await this.delay(latencyMs);
    activeStages[2].status = 'completed';

    // ... subsequent stages evaluate sentiment, category and priorities

By decoupling these steps, we gain a massive advantage: independent debugging. If our tokenization logic fails on non-ASCII characters, we can fix Stage 3 in isolation without touching our downstream sentiment calculations or wasting LLM token costs.

Connecting the Timeline: Hindsight Contextual Memory

Once you have a structured pipeline output, the next challenge is placing it in the context of history. When engineering deploys a new release (say, v2.1), we need to immediately understand if customer satisfaction is rising or falling compared to v2.0 and v1.9.

To build this version-pinned memory matrix, we integrated Hindsight’s agent memory principles. Hindsight tracks persistent records of past feedback analyses and evaluates long-term customer friction trends. Instead of passing an infinitely growing list of past support tickets to the LLM, we use Hindsight’s memory store to maintain compiled statistical summaries pinned directly to specific release versions.

Here is the core logic from hindsight.ts that calculates version-to-version sentiment drift coefficients:

export class HindsightEngine {
  private storageKey = 'pulseiq_hindsight_memory';

  public getSentimentShifts(): Array<{
    previousVersion: string;
    currentVersion: string;
    percentageChange: number;
    shiftType: 'improvement' | 'regression' | 'stable';
    description: string;
  }> {
    const records = this.getRecords();
    const shifts: any[] = [];

    const versionRatings: Record<string, { sum: number; count: number }> = {};
    records.forEach(r => {
      if (!versionRatings[r.version]) {
        versionRatings[r.version] = { sum: 0, count: 0 };
      }
      versionRatings[r.version].sum += r.sentimentScore;
      versionRatings[r.version].count += 1;
    });

    const sortedVersions = Object.keys(versionRatings).sort();
    for (let i = 0; i < sortedVersions.length - 1; i++) {
      const prev = sortedVersions[i];
      const curr = sortedVersions[i + 1];

      const prevAvg = versionRatings[prev].sum / versionRatings[prev].count;
      const currAvg = versionRatings[curr].sum / versionRatings[curr].count;

      const diff = currAvg - prevAvg;
      const percentage = Math.round(Math.abs(diff) * 100);

      shifts.push({
        previousVersion: prev,
        currentVersion: curr,
        percentageChange: percentage,
        shiftType: diff < -0.15 ? 'regression' : diff > 0.15 ? 'improvement' : 'stable',
        description: diff < -0.15 
          ? `Sentiment dropped significantly after the release of ${curr}.` 
          : `Sentiment rose steadily after the release of ${curr}.`
      });
    }
    return shifts;
  }
}

This logic enables us to answer crucial business questions automatically. If a customer reports a bug, Hindsight scans the memory store, determines if this issue started in v2.2 or has been a recurring issue since v1.9, and triggers a warning if it detects a “streak” of unresolved complaints.

To learn more about implementing similar persistent contexts in your own microservice pipelines, check out the Hindsight documentation.

Tracing a Live Multi-Factor Authentication Lockout

To see the hybrid Cascadeflow-Hindsight system in action, trace what happens when we feed this support ticket into the platform:

“Ever since version 2.1 deployed, the MFA SMS token arrives 20 minutes late, leading to persistent verification lockouts from my corporate workspace! Fix this ASAP!”

  1. The Cascadeflow Run: The system normalizes the casing, extracts tokens, maps it to the category "Authentication" (Confidence: 0.94), and calculates a priority score of 92/100 (HIGH).
  2. The Hindsight Evaluation: Because the memory store already has a record of “MFA complaints spiking in v2.1” from last week, the system flags a 4-week recurring issue streak and automatically adjusts the layout’s dynamic suggestion:

    • Suggestion: “MFA anomalies have consistently spiked over the last 4 weeks. Twilio SMS OTP gateway is experiencing persistent routing timeouts on the v2.1 path. Immediately deploy fallback SMS-redundancy route or temporarily whitelist corporate workspace IPs.”

Lessons Learned

  1. Deterministic Gating is Your Shield: Never send raw user inputs directly to semantic LLM steps. Normalizing casings and filtering HTML tags in early pipeline stages saves token costs and prevents prompt-injection attacks.
  2. State Streams Save the User Experience: AI processing takes time. Streaming active logs through a terminal-style UI while Cascadeflow runs gives users visual feedback and increases platform confidence.
  3. Stateless Prompts are Useless for Regressions: To track regressions, you need a dedicated, version-aware agent memory layer. Pinning statistical metadata to release version tags in a persistent buffer like Vectorize agent memory is the only scalable way to detect regressions without inflating LLM context windows.

Conclusion

By moving away from stateless, single-pass prompts and building a hybrid architecture with Cascadeflow and Hindsight, we transformed customer complaints from a chaotic swamp of text into a clean, version-aware stream of business decisions.

Most Creators Are Building in Pieces. I’m Building the Entire System.

Most Creators Are Building in Pieces. I’m Building the Entire System.

Music. Tools. Code. Distribution. One ecosystem — not fragmented platforms.


TizWildin Entertainment HUB — Free Plugins, Sample Packs, Audio Lists & ARC Source Spine

Free audio plugins, producer kits, sample packs, public discovery lists, and ARC source-spine links from GareBear99 / TizWildin.

garebear99.github.io

Main Link: https://garebear99.github.io/TizWildinEntertainmentHUB/

TizWildin Entertainment is not a label.

It’s not just a dev project.

It’s a creator infrastructure system being built from the ground up.

The Problem with Modern Creation

Creators are forced into disconnected systems:

Music: Spotify / SoundCloud
Code: GitHub
Writing: blogs / Dev.to
Distribution: multiple platforms
Monetization: fragmented everywhere

Nothing connects.

Everything breaks context.

And every release becomes a dead endpoint instead of a system.

The Shift: From Content → Systems

TizWildin Entertainment is built around one idea:

Every creative output should be reusable infrastructure.

Not files.

Not posts.

Systems.

What TizWildin Entertainment Actually Is

A modular creative ecosystem spanning music, development, and media engineering.

🎧 Audio & Sound Design Layer
Advanced sample packs (808s, sub bass systems, warped drums)
Experimental synth architectures
Sound design frameworks (not just loops)

Example releases & audio ecosystem:

https://soundcloud.com/tizwildin
https://soundcloud.com/tizwildin/sets/album
🧠 Developer Tooling Layer
Audio generation scripts
Pack builders
Plugin concepts (VST/AU/standalone systems)
Experimental creative tooling

Open-source ecosystem entry point:

https://github.com/GareBear99
🎬 Media + Release Layer
Album systems (not just track lists)
Visual identity pipelines
Cover + branding generation systems
Structured multi-layer releases

Example project distribution:

https://dev.to/tizwildin
🌐 Distribution Layer (Unified Pipeline)

Instead of scattered uploads, everything flows through:

GitHub → tooling + systems
Dev.to → documentation + engineering posts
SoundCloud → audio output layer

This creates a full-stack creative pipeline instead of isolated uploads.

The Core Idea: Everything is Interoperable

A sample pack is not just audio.

It includes:

generation scripts
metadata systems
preview tools
structure logic
visual identity assets

A music release is not just tracks.

It includes:

production breakdowns
companion packs
sound system documentation
iterative variations

Each release becomes a living system, not a static upload.

Why This Matters (SEO: Creator Economy / Music Tech / Open Source Audio Tools)

The industry is shifting toward:

AI-assisted production
modular creative systems
open-source tooling
cross-platform ecosystems

But most creators are still stuck in:

“Make → Upload → Forget”

That model is collapsing.

What I’m Building Instead

TizWildin Entertainment is evolving into:

A creator infrastructure layer
A hybrid between label, dev lab, and tooling ecosystem
A system where music + code + design evolve together

Think:

GitHub + Ableton + Creative OS

Current Active Ecosystem

Core focus areas:

Sub-bass / 808 engineering systems
Sample pack architecture (not just libraries)
Audio generation tooling
Cross-platform publishing pipeline
Unified branding system across all outputs
Experimental sound design releases
Core Public Nodes
🎧 Music & releases: https://soundcloud.com/tizwildin
📦 Audio catalog / albums: https://soundcloud.com/tizwildin/sets/album
🧠 Dev + engineering posts: https://dev.to/tizwildin
⚙️ Open-source tooling: https://github.com/GareBear99
Final Thought

The future of creation won’t be split into:

musicians
developers
designers
marketers

It will be built by people treating all of them as one system.

That’s what TizWildin Entertainment is becoming.

Not content production.

Creative infrastructure engineering.


TizWildin Entertainment HUB — Free Plugins, Sample Packs, Audio Lists & ARC Source Spine

Free audio plugins, producer kits, sample packs, public discovery lists, and ARC source-spine links from GareBear99 / TizWildin.

garebear99.github.io

The Hidden Privacy Problem in Every AI App

Every AI Product Has the Same Hidden Privacy Problem

The more useful the assistant becomes, the more sensitive the user data becomes.

A user writes something like:

I need to move my appointment from Tuesday to Friday because I had surgery last month and I’m still on medical leave.

My policy number is INS-48291.

The task is simple: reschedule an appointment. But the prompt also includes sensitive medical, employment-related, and internal policy information that the model may not need to complete that task.

In many AI applications, that message is sent directly to a third-party LLM provider.

Why This Matters Now

In regulated environments, teams are expected to limit personal data processing, explain why data is needed, and apply privacy by design.

With LLMs, that becomes harder because users often paste sensitive information directly into prompts, even when that information is not required for the task.

The risk is not that every AI app will receive a massive fine.

The real risk is losing control over where sensitive data goes, how long it is stored, whether it appears in logs or traces, and whether the company can prove that the model actually needed that data in the first place.

Companies want to use LLMs in customer support, healthcare, finance, legal workflows, HR, internal tools, and enterprise automation.

But these are exactly the environments where sensitive data appears naturally in conversations.

So the question is not:

Can we remove all personal data?

The real question is:

Can we protect personal data while keeping the AI useful?

This is the problem I tried to solve with PII Firewall, an open-source privacy layer for AI applications.

PII Firewall behaves as a stateful proxy that sits between your application and any LLM provider. It detects sensitive information, replaces it with safe tokens before the model call, and restores the original values only inside your trusted environment.

It is model-agnostic by design, works across 55+ languages, and lets teams combine multiple PII detection techniques through a simple, unified framework.

The model still gets the context it needs. But it never needs to know who the user really is.

Redaction Is Not Enough

The most common approach to privacy is redaction.

Take this input:

My name is Maria Perez and my email is [email protected].

A simple redaction system might turn it into:

My name is [REDACTED] and my email is [REDACTED].

That protects the data, but it also destroys useful context.

If the model later responds with:

I have updated the record for [REDACTED].

The final answer is technically private, but not useful.The model does not know what was redacted. Was it a person, a company, an email address, or a case reference?

And in a multi-turn conversation, a stateless redaction layer cannot reliably preserve who or what each placeholder refers to across messages.

The Core Idea: Pseudonymize, Reason, Rehydrate

PII Firewall uses reversible pseudonymization.

Instead of deleting sensitive values, it replaces them with safe tokens:

John Doe         → PERSON_1
[email protected] → EMAIL_1

So the LLM receives:

Hi, I'm PERSON_1. My email is EMAIL_1.
Can you help me update my insurance claim?

The model can still understand that there is a person, an email address, and a task.

It can respond naturally:

Sure, PERSON_1. I can help you update the account linked to EMAIL_1.

Then PII Firewall rehydrates the response inside your trusted environment:

Sure, John Doe. I can help you update the account linked to [email protected].

The user gets a personalized answer, but the LLM provider never receives the raw personal data.

A Flexible Privacy Framework

PII Firewall is not the first attempt to protect LLM calls from sensitive data exposure.

Privacy proxies, PII redaction tools, anonymization layers, and AI security gateways are becoming part of the production LLM stack.

But in practice, privacy is rarely solved with a single detector, a single language, or a single rule.

Some applications need fast pattern matching for emails, phone numbers, credit cards, IBANs, or internal IDs. Others need language-aware models to detect names, locations, organizations, dates, or contextual references. Some teams need healthcare-specific detection, while others need finance, legal, HR, customer support, or internal enterprise rules.

PII Firewall lets teams:

  • Choose the LLM provider
  • Combine different PII detection techniques
  • Adapt detection to multiple languages
  • Define different actions per entity
  • Keep reversible mappings in a scoped vault

In other words, the goal is not to provide one fixed privacy policy, but a framework for defining the right privacy behavior for each application.

Model-Agnostic by Design

PII Firewall can sit in front of OpenAI, Anthropic, or any provider that accepts text input and returns text output.

This matters because AI infrastructure changes quickly. A team may start with one provider, later route workloads to another, or eventually move some models in-house.

Your privacy layer should not have to be rewritten every time your model strategy changes.

PII Firewall is designed as middleware: a thin privacy boundary between your application and whichever model you choose.

Detector-Agnostic Too

PII detection is not a solved problem with a single perfect technique.

Some sensitive data is structured and easy to detect:

[email protected]
+34 600 123 456
4242 4242 4242 4242

Rule-based patterns work very well for these cases.

Other data is contextual:

John lives near the hospital and spoke with Dr. Martinez last Friday.

Here, names, roles, dates, and locations may need language understanding.

PII Firewall supports multiple detection engines. You can use:

  • Simple rule-based patterns when you want speed and precision
  • NER-based detection when you need context
  • Transformer models for more specialized domains
  • Hybrid mode to combine several approaches

Built for More Than English

A lot of privacy tooling works well in English and then quietly breaks down elsewhere.

Real users write in Spanish, French, Italian, Portuguese, German, Arabic, Japanese, and many other languages. They use different name structures, address formats, national identifiers, phone formats, bank account formats, and local conventions.

PII Firewall includes language-aware routing, so detection can adapt to the language and region of the text.

This allows the system to apply the right patterns and models for the context instead of relying on a single English-centric detector.

For example, a privacy layer used in Europe should understand IBANs, local phone numbers, national identifiers, and multilingual names.

A global AI product cannot treat privacy as an English-only problem.

Different Domains Need Different Privacy Behavior

Different industries have different privacy needs.

A healthcare assistant should preserve clinical utility while protecting patient identity.

A finance assistant should protect payment data while keeping enough context for analysis.

A legal assistant may need to preserve case references while anonymizing party names and addresses.

PII Firewall includes domain-specific presets for common scenarios such as:

  • Healthcare
  • Finance
  • Legal
  • Generic

These presets are not meant to be rigid. They are starting points.

Teams can override specific behaviors, add their own entity types, or define new profiles for their own internal data.

For example, a company may want to detect:

  • Employee IDs
  • Customer IDs
  • Ticket numbers
  • Contract references
  • Internal project codes

Those identifiers may not be “standard PII”, but they can still be sensitive inside a business context.

The same applies to how different values are handled.

Not all sensitive data should be handled the same way:

  • A person’s name might need to be pseudonymized so the model can continue referencing that person.
  • A credit card number should usually be masked.
  • A precise date of birth might be generalized.
  • A value that should never be exposed may need to be fully redacted.

PII Firewall supports different actions depending on the type of data:

John Doe                   → PERSON_1
[email protected]            → EMAIL_1
4242 4242 4242 4242         → ************4242
17 March 1984               → 1980s
Highly sensitive value      → [REDACTED]

Privacy is not one-size-fits-all. The right behavior depends on the data type, the use case, and the risk profile.

Stateful Privacy

One of the most important parts of PII Firewall is that it is stateful.

A stateless filter can remove data, but it cannot easily remember that across a conversation:

PERSON_1 = John Doe
EMAIL_1  = [email protected]
CASE_1   = Insurance Claim 8821

PII Firewall keeps this mapping in a vault scoped to the right context.

That context can include things like:

  • Organization
  • User
  • Case
  • Thread

This makes it possible to track mappings safely and restore values only when appropriate.

It also makes compliance workflows easier.

For example, if a user invokes a right-to-forget request, the application can purge the mappings for that user, case, or session.

The goal is to manage sensitive data across its lifecycle, not just remove it from a single prompt.

Example

Here is the basic idea in code:

from privacy_firewall import PrivacyFirewallSDK

firewall = PrivacyFirewallSDK.create(
    domain="healthcare",
    detector_backend="hybrid",
)

context = {
    "tenant_id": "acme-corp",
    "case_id": "case-8821",
    "thread_id": "thread-001",
    "actor_id": "user-42",
}

sanitized = firewall.anonymize_text(
    text=user_prompt,
    context=context,
)

response = my_llm(
    sanitized.sanitized_text,
)

final = firewall.rehydrate_text(
    text=response,
    context=context,
)

Conclusion

As AI moves into production, privacy cannot remain an afterthought, especially as regulation becomes stricter in Europe.

The safest personal data to send to an LLM is the data it never receives.

PII Firewall is an open-source project. If you are building AI products in healthcare, finance, legal tech, customer support, internal automation, or enterprise SaaS, I would love feedback, issues, and contributions from people working on real-world systems.