n8n/docs/generated
Arvin Ansari 840805a730
feat(core): Record recent instance activity for agent context (no-changelog)
Adds an append-only `activity_event` table fed from the event bus, so the
instance agent can be handed what the user has been doing instead of spending
a turn discovering it. Entries are pointers — category, verb, and the ids
needed to fetch the full record — not copies of the resource.

Two decisions worth flagging:

`resourceId` carries no foreign key, unlike every other reference in the
schema. An entry has to outlive what it describes; a workflow deletion is the
entry most worth keeping, and a cascade would erase it exactly when it became
interesting. `workflow_review_activity.workflowId` made and undid this same
mistake. Neither vocabulary column gets a CHECK, for the reason that table
dropped its own: a feed covers more kinds with every feature, and each
widening is another SQLite table recreation.

The relay registers in `BaseCommand` rather than the instance-ai module.
`workflow-post-execute` is emitted wherever the execution ran, which in
scaling mode is the worker, and that module loads on main only — registering
there would silently lose every execution entry under scaling.

Off by default behind `N8N_INSTANCE_AI_ACTIVITY_LOG_ENABLED`; the flag is
read once at init, so a disabled instance carries no listeners. Pruning runs
on the leader main only, by age with an entry-count backstop.

Postgres schema docs are not regenerated — that leg needs Docker, which is
unavailable here. The sqlite docs are current.
2026-08-26 13:13:21 +02:00
..
postgres-schema feat(core): Loosen the workflow review activity schema for cause events (no-changelog) (#36376) 2026-08-19 08:47:02 +00:00
sqlite-schema feat(core): Record recent instance activity for agent context (no-changelog) 2026-08-26 13:13:21 +02:00