Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/HypathStack/model-scribe/llms.txt

Use this file to discover all available pages before exploring further.

Audit logs grow without bound unless you have a deliberate strategy for pruning them. ModelScribe’s database driver ships with three retention modes that cover the most common operational needs: keep everything forever, discard records older than a configurable number of days, or maintain a fixed-size rolling window of the most recent records per table. Retention is declared in config/model-scribe.php and enforced on-demand when you run model-scribe:prune.

Retention modes

The default mode. ModelScribe never deletes records automatically — every audit entry is kept indefinitely. Use this when your compliance or legal requirements mandate a full immutable history, or when you manage archival and deletion outside of ModelScribe.
// config/model-scribe.php

'drivers' => [
    'database' => [
        'driver' => 'database',
        'table'  => 'model_scribe_logs',

        'retention' => [
            'type' => 'permanent',
        ],
    ],
],
Running model-scribe:prune while type is 'permanent' is a safe no-op — it returns 0 deleted records and touches no rows.

Retention is enforced at prune-time

ModelScribe does not delete records on insert. Entries accumulate in the database as they are written, and the configured policy is only enforced when you explicitly trigger a prune. This means your tables may grow beyond the retention threshold between prune runs — plan your schedule accordingly. Run the prune command manually at any time:
php artisan model-scribe:prune

# Prune a specific driver only
php artisan model-scribe:prune --driver=database
Schedule the prune command in routes/console.php so it runs automatically. Daily is a sensible default for most applications:
use Illuminate\Support\Facades\Schedule;

Schedule::command('model-scribe:prune')->daily();
For very high-write tables with rotating retention you may want to prune more frequently — for example ->hourly() — to keep table size tightly bounded.
The file driver’s prune() method is intentionally a no-op and always returns 0. Log file rotation for the file driver is handled entirely by Laravel’s built-in logging system. Configure it in config/logging.php using the daily channel’s days option or whichever channel you have pointed MODEL_SCRIBE_LOG_CHANNEL at.
The rotating retention mode counts records per table, not per subject model. If a table is shared by multiple model types — for instance, several models all using the default model_scribe_logs table — the keep limit applies to the combined total across all of them. A single high-frequency model can therefore push older entries for other models out of the window ahead of schedule. Use named stores to give each model type its own table before applying rotating retention.

Build docs developers (and LLMs) love