Shield

SQLite Store

Lightweight SQLite store for development, testing, and single-node deployments.

The store/sqlite package implements Shield's store.Store interface using the grove ORM with the SQLite driver. It requires no external database process, making it ideal for development, integration tests, and single-node deployments.

Usage

import (
    "context"
    "log"

    "github.com/xraph/grove"
    "github.com/xraph/grove/drivers/sqlitedriver"
    "github.com/xraph/shield/store/sqlite"
)

db, err := grove.Open(sqlitedriver.Open("shield.db"))
if err != nil {
    log.Fatal(err)
}

s := sqlite.New(db)
if err := s.Migrate(context.Background()); err != nil {
    log.Fatal(err)
}

Pass ":memory:" for a fully in-process, zero-persistence store useful in tests:

db, err := grove.Open(sqlitedriver.Open(":memory:"))

Tables

TableSubsystemPurpose
shield_instinctsinstinctBuilt-in safety rules and threat patterns
shield_awarenessawarenessContext-aware detection configurations
shield_boundariesboundaryInput/output boundary enforcement rules
shield_valuesvaluesValue-alignment rule definitions
shield_judgmentsjudgmentContent evaluation and scoring rules
shield_reflexesreflexAutomatic response and action triggers
shield_profilesprofileComposite safety profile configurations
shield_scansscanContent scan results and audit log
shield_policiespolicyOrganizational safety policy definitions
shield_policy_tenantspolicyPolicy-to-tenant assignment mappings
shield_pii_tokenspiiTokenized PII storage for redaction/recovery
shield_compliance_reportscomplianceGenerated compliance audit reports

Internals

AspectDetail
Drivergrove ORM + sqlitedriver
Migrationsgrove orchestrator with programmatic migrations
TransactionsSQLite-level transactions
ConcurrencyMultiple readers, single writer (WAL mode)

When to use

  • Development and local testing without external dependencies.
  • Single-process or embedded deployments.
  • CI pipelines where spinning up PostgreSQL is impractical.

On this page