Skip to content

AI 0.27.0: Journal retention, narrower AI permissions and PhoenixKit 3 support

AI 0.27.0 lets a site decide how long its AI request journal is kept, splits seeing usage and managing endpoints into their own permissions, and makes the module ready for PhoenixKit 3, which no longer builds the AI tables itself.

Journal retention

The Usage tab gets a Journal retention card with three periods: Content of journal entries (prompts, answers and reasoning are removed, the entry with its cost and tokens stays), Journal entries (the whole entry is deleted) and Guard events (the guard’s flags, blocks and forgiven limits). Each can be kept forever or set in days, months or years. Nothing is deleted by default.

A nightly cleanup applies the periods, no earlier than a day after they are saved, and Clean up now counts what would go before you confirm. Rows that the spend limits still read, from two days before the current month began, are never deleted, and content of the last 24 hours is never removed. An entry whose content was cleared says so in its details. Changing the periods needs ai.manage or the Owner role; others see the card as Read only.

The guard’s events are no longer deleted after a fixed 180 days. They follow their own period, which keeps them forever until you set one.

Narrower permissions

Two new sub-permissions: See AI usage, for the Usage tab with every request’s prompt and response, and Manage AI endpoints, for creating, editing, enabling, reordering and deleting endpoints. Without the second, the endpoint list is read only. On first boot every role that already holds the AI permission is granted both once, so nobody loses access. A role given AI later gets only the narrow meaning.

Smaller changes

An endpoint that still keeps an API key from before the Integrations system shows a notice on its form; picking an Integration and saving removes the stored key. The Tasks page warns when an AI task is declared twice, and says when a task’s module is switched off.

Upgrading

Run mix phoenix_kit.update: it puts the new PhoenixKitAI.JournalPruneWorker into Oban’s crontab in place of the old guard-events worker, which now only hands over to it. The module’s migration chain moves to V5 and takes over the three tables core created before. On an existing site this changes nothing in the database. AI 0.27 needs PhoenixKit 2.65 or later and works with 3.x. mix phoenix_kit.doctor and mix phoenix_kit.repair check the module’s eight tables again with cores newer than 2.64.1.

Full release notes: AI 0.27.0

0.27.0 · 27 October 2026

Added

  • The module supplies the manifest of its 8 tables (expected_schema/0, PhoenixKitAI.ExpectedSchema), so mix phoenix_kit.repair and mix phoenix_kit.doctor check and repair them again, now from the module’s own chain instead of core’s manifest. Generated from PhoenixKitAI.Migrations by core’s dev_docs/squash/generate_module_manifest.exs, never edited by hand. Core uses it from the first release after 2.64.1; before that nothing reads it. Repair is additive (it creates what is missing and reports the rest) and checks the tables only while the database is at the chain’s current version. No migration.

Changed

  • Core pin widened to >= 2.65.0 and < 4.0.0: works with core 3.x (core 3.0 stops creating the module tables; this module’s own chain builds its tables). The floor is the first core with the file_references/0 and expected_schema/0 callbacks, which now carry @impl PhoenixKit.Module.

  • The migration chain is now V5 and adopts phoenix_kit_ai_endpoints, phoenix_kit_ai_prompts and phoenix_kit_ai_requests, which core’s chain created before the module had one (core’s V135 baseline plus V164, V169, V193 and V223). CREATE TABLE IF NOT EXISTS, guarded constraints and indexes, identical to what a fresh core builds: a no-op on every existing install. The adoption runs ahead of V2’s statements, because V2 and V4 touch those tables. down/1 never drops them. With it the chain builds all eight tables without core (test/integration/migrations_build_alone_test.exs, core’s ModuleChainCheck). A change to these tables is now a version here, never a core migration. See core’s dev_docs/plans/2026-10-25-module-table-ownership.md.


AI 0.27.0. Install or update: {:phoenix_kit_ai, "~> 0.27"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.