Skip to content

Sub-Domain Blueprint: Unified Audit

Domain: Unified (audit, communications, identity, library, notifications, search, signals, vault, workflow) Logical Sub-Domain: Audit (Forensics) Physical Packages: @sd/mod-unified-audit Related Documents: Data Definition Context: This document defines the Mandate for immutable system logging. Status: Stable (v2.5)

1. Mandate

The Audit Sub-Domain provides the Forensic Memory of the platform. It is a passive, write-only system that records Who did What, When, and How (Diffs). It is critical for financial compliance and security investigations.

2. Capabilities

Capability Description Component
Mutation Logging Recording Create/Update/Delete events with actors. BaseRepository (Consumer)
Diff Capture Storing prev vs next states for granular change tracking. AuditLog
Forensic Association Linking logs to specific Resources (e.g. finance_journal_entries). AuditLog.resourceId

3. Process Models

A. The Write Path

Every Repository write action triggers an Audit Log.

sequenceDiagram
    participant User
    participant Repo as BaseRepository
    participant DB as Firestore (Audit)

    User->>Repo: update(docId, { status: "approved" })
    Repo->>Repo: Validates Data

    par Write Data
        Repo->>DB: collections.doc(id).update()
    and Write Audit
        Repo->>DB: audit_logs.add({ actor: User, mutation: "update", diff: {...} })
    end

6. Changelog

Date Author Description Reference
2026-01-24 Antigravity Initial creation Implementation Plan