AURA v0.1.0: Deterministic Trigger Extraction, Auditable Math & a Self-Healing Analytics Engine
DEV Community

AURA v0.1.0: Deterministic Trigger Extraction, Auditable Math & a Self-Healing Analytics Engine

AURA v0.1.0: Deterministic Trigger Extraction, Auditable Math & a Self-Healing Analytics Engine

If you follow AI safety, you know the uncomfortable truth: modern LLM guardrails are failing not because of complex zero-day exploits, but because of sloppy heuristics, brittle filters, and naive prompt-matching. We built AURA to be pragmatic: deterministic, testable, fully auditable, and completely immune to the hallucination of its own telemetry. Today, we're unpacking AURA v0.1.0 - explaining our architectural decisions, showing real code excerpts, diving into non-linear risk scoring math, and solving the silent problem of lost repository analytics on GitHub.

System Architecture at a Glance

Data flow in AURA is intentionally simple, pipeline-driven, and fully reproducible:

  • Source Cases (public_cases/*.json) → cleaned, validated, and normalized via scripts/normalize-percases.ts
  • Rule Extraction (scripts/extract-triggers.ts) → contextual regex and sliding-window token analysis
  • Weights & Signal Mapping → derived from config/signal-mapping.json and saved to config/trigger-weights.json
  • Scoring & Policy Enforcement (scripts/recalc_confidence.ts) → non-linear math transform + cross-check audit logic via scripts/policy/crossCheckAdapter.ts
  • Persisted Telemetry → automated daily snapshots written to analytics/traffic-history.json via GitHub Actions

Non-Linear Risk Normalization

Instead of simply summing things up, AURA computes a transparent raw evidence sum (confidence_raw) and converts it into a bounded score using a diminishing-returns exponential:

// computedRaw is the honest sum of trigger weights + cross-check contributions
const alpha = (typeof cfg.normAlpha === 'number') ? cfg.normAlpha : 1.0;
const normalized = 1 - Math.exp(-alpha * computedRaw);
let newVal = Math.round(normalized * 100) / 100;
if (newVal < minFloor) newVal = minFloor;

e.confidence_raw = Math.round(computedRaw * 100) / 100;
e.confidence = newVal;

This keeps scores in [0...1] and avoids noisy amplification from many weak cues.

Tuning Sensitivity (α)

  • Lower α (0.1 - 0.2): Conservative normalization; requires heavier evidence to push confidence toward 1.0
  • Higher α (0.5+): Aggressive sensitivity for high-security environments
  • AURA Baseline (α = 0.3): Striking a balance where confidence_raw = 3.0 yields ≈ 0.59, requiring compounding signals for a hard policy block

Hardening Trigger Extraction: Sliding Windows & Contextual Anchors

Keyword lists are a recipe for false positives. AURA v0.1.0 introduces ordered-within-window token matching to balance precision and recall.

Sliding Window Engine

function containsOrderedWithinWindow(haystack: string[], needle: string[], window = 5): boolean {
    if (needle.length === 0) return false;
    if (needle.length === 1) return haystack.indexOf(needle[0]) !== -1;

    for (let i = 0; i < haystack.length; i++) {
        if (haystack[i] !== needle[0]) continue;
        let idx = i + 1;
        let matched = 1;
        for (let k = 1; k < needle.length && idx < Math.min(haystack.length, i + window + 1); idx++) {
            if (haystack[idx] === needle[k]) {
                matched++;
                k++;
            }
        }
        if (matched === needle.length) return true;
    }
    return false;
}

Contextual Anchors vs. Co-Occurrence Cues

For specific triggers, AURA mandates either deception-target patterns or multi-token co-occurrence:

  • Non-consensual pattern generation: Matches patterns like \bgenerate\s+\d+\s+\d+\s+s+(?:deceptive\s+assets|phishing\s+emails|fake\s+documents|fake\s+profiles|fake\s+accounts|malicious\s+payloads|spam\s+emails|synthetic\s+attacks)\b
  • Unauthorized audit camouflage: Requires co-occurrence of "audit", "unauthorized", "independent", "bypass", and "without permission"

Solving the GitHub Traffic "Blind Spot"

GitHub silently wipes daily clone and view metrics after two weeks, leaving open-source maintainers blind to long-term adoption trends. AURA v0.1.0 includes an automated, self-healing snapshot pipeline defined in .github/workflows/traffic-history.yml:

  • Daily Ingestion: Executes a daily cron job via GitHub REST API
  • Deduplication: Merges metrics into analytics/traffic-history.json while purging duplicate artifacts
  • Self-Healing Merge Logic: If concurrent workflow updates cause a direct git push to main to fail, the workflow opens a temporary PR, squash-merges it via actions/github-script, and cleans up afterward
name: auto/traffic-report
uses: actions/github-script@v6
with:
  github-token: ${{ secrets.TRAFFIC_TOKEN }}
  script: |
    const head = `auto/traffic-report-${process.env.GITHUB_RUN_ID}`;
    const { data: prs } = await github.rest.pulls.list({
      owner: context.repo.owner,
      repo: context.repo.repo,
      head: `${context.repo.owner}:${head}`,
      state: 'open'
    });
    if (prs && prs.length > 0) {
      await github.rest.pulls.merge({
        owner: context.repo.owner,
        repo: context.repo.repo,
        pull_number: prs[0].number,
        merge_method: 'squash'
      });
      await github.rest.git.deleteRef({
        owner: context.repo.owner,
        repo: context.repo.repo,
        ref: `heads/${head}`
      });
    }

Community Spotlight: Catching a Subtle Async Race Condition

Contributor Amirhossein Agrest spotted a subtle async race condition in how case state is updated before disk serialization. The problematic pattern was fire-and-forget async invocation:

// โŒ Potential Race: Fire-and-forget async invocation
for (const entry of entries) {
  updateCase(entry);
}

The fix ensures all async mutations are awaited before serializing to disk:

// โœ… Fix Pattern: Await all async mutations before serializing to disk
const promises = entries.map(entry => updateCase(entry));
await Promise.all(promises);

This issue has been logged (shoutout to Amirhossein!) and is paired with artificial network-delay adapters in the test suite to guarantee filesystem persistence never outruns in-memory state in the upcoming patch.

Roadmap (What Realistically Comes Next)

  • v0.2: Programmatic prompt tokenization + TF-IDF experiments for ranking weak cues (automated test-corpus generation)
  • Tooling UI: Better cross-trigger clustering and a visual rule editor - manual inspection of hundreds of lines of raw JSON is a fast track to eye bleed
  • ML Augmentation: Replace some heuristics with small supervised models for cue disambiguation - but only where deterministic rules fall short (no ML for the sake of ML)

Closing Notes

AURA is not magic, and it doesn't pretend to be. It's a pragmatic stack: deterministic rules, auditable math, and CI that refuses to forget its history. If you're looking for a silver bullet, good luck! But if you want a system that is testable, inspectable, and built on sound software engineering principles, welcome aboard. Check out the repository, inspect the code, and give us a star: GitHub: kate8382/AURA. Open an issue, or even better - submit a PR with a failing unit test to help us catch edge cases faster.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.