RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/AGENTS.md/n8n-io/n8n

AGENTS.md

packages/@n8n/engine/AGENTS.md
AGENTS.md

Quality

59/100

Scores the file, not the repository.

Length

596 words

7 headings · 0 code blocks

Repository

199k

— · pushed 0 days ago

Last changed

3 days ago

First indexed 3 days ago.
n8n-io/n8n/packages/@n8n/engine/AGENTS.mdRawGitHub
1# @n8n/engine — structure & modularity intent
2 
3## The blueprint we're following
4 
5We structure this package after the **Durable Scheduler modularity blueprint**
6([Notion](https://app.notion.com/p/n8n/The-Durable-Scheduler-a-modularity-blueprint-39f5b6e0c94f8193a5fecca8306c4424),
7worked example: `packages/@n8n/scheduler`, enforced by its
8`src/__tests__/dependency-purity.test.ts`). The core idea: a **pure core that
9decides, with every effect handed in as an injected interface**. Dependency
10arrows point one way — consumers depend on the engine; the engine core reaches
11for nothing.
12 
13## Reality now: loose, but seam-aware
14 
15We are deliberately **loose about composition at this stage**. This one package
16currently holds the engine core *and* its serving/persistence infrastructure.
17We expect things to shuffle, so we're not paying the full ports-and-adapters
18tax yet. What we **do** commit to is keeping the internal boundaries clean, so
19serving infra and persistence can later be lifted into their own packages (e.g.
20a deployable engine worker) without touching core logic.
21 
22## Layers (today, all in this package)
23 
24- **Core (decides)** — `graph/`, `execution/`, `admittance/`. Pure
25 orchestration/policy. Must not open connections, bind an HTTP server, or read
26 the environment. Everything external arrives via constructor args / a deps bag
27 (the `createScheduler(deps)` pattern).
28- **Core interfaces** — interfaces the core depends on, each defined in its own
29 core module beside a default/reference use: `AdmittanceService` (`admittance/`),
30 `WorkQueue` (`queue/`), `ExecutionStore` (`execution/`). Adapters implement
31 them; the core never imports the interface from an adapter. Handed in at
32 construction.
33- **Adapters (do)** — effectful implementations: `database/` (TypeORM entities,
34 migrations, the Postgres `DataSource`, and `TypeOrmExecutionStore`), `queue/`
35 (in-memory default). The Postgres/ORM coupling lives *here only*.
36- **Serving infra** — `server/` (express), `serve.ts` (standalone entrypoint),
37 Dockerfile. First candidate to be extracted later.
38- **Composition roots** — `serve.ts` (standalone) and, in integrated mode,
39 `packages/cli`. These construct the concrete adapters (the `DataSource`, etc.)
40 and hand them in. **Construction lives here, not in the core.**
41 
42## Rules that keep the seams extractable
43 
44- Core modules (`graph`, `execution`, `admittance`) don't import `express`,
45 `pg`, or `@n8n/typeorm`, don't construct a `DataSource`, and never import from
46 `database/`. Persistence, queue, and HTTP are injected. The dependency arrow
47 is one-way: `database/` imports the interface + domain types from the core, not
48 the reverse.
49- `@n8n/typeorm` / `pg` stay confined to `database/`.
50- `@n8n/config` + `@n8n/di` are used only at the serving/composition layer (for
51 `EngineConfig`), never in core logic. (The blueprint flags `@n8n/config` as
52 debatable precisely because it pulls the DI runtime in — keep it out of core.)
53- We go one step stricter than the scheduler's allowlist: **no `n8n-workflow`
54 dependency at all, not even type-only** (per the Engine 2.0 design — the core
55 must stay free of v1 concepts). Shared JSON types are redefined locally in
56 `common/`.
57- Arrows point inward: `cli`/`serve` depend on the engine; the engine never
58 imports `cli`.
59- When serving infra is extracted, add a `dependency-purity.test.ts` (as
60 `@n8n/scheduler` does) to enforce the allowlist. Until then, this doc is the
61 intent.
62 
63## Crash recovery: reconciliation, not transactions
64 
65Handlers advance an execution through several separate writes — claim the
66execution, insert step rows, publish the next message — and we deliberately do
67**not** make that sequence atomic. Crashing partway through can leave partial
68state, such as an execution stuck `running` with no queued step.
69 
70The intended answer is a reconciliation layer that detects crashed or stalled
71executions and drives recovery (CAT-2938), not transactions spanning stores and
72queues. So when you find a partial-write window: make the resulting state
73legible to reconciliation, and don't reach for a cross-store transaction. It's a
74recurring review question — this is the standing answer.
75 
76## Known deviations — the seams to clean up on decomposition
77 
78- `DataSource` construction currently lives in `database/`; it is really a
79 composition-root concern.
80 

Sections

  • @n8n/engine — structure & modularity intent
  • The blueprint we're following
  • Reality now: loose, but seam-aware
  • Layers (today, all in this package)
  • Rules that keep the seams extractable
  • Crash recovery: reconciliation, not transactions
  • Known deviations — the seams to clean up on decomposition

What it covers

architecturedo-not

Stack — with the evidence

typescript

(1.00)

langchain

(1.00)

turborepo

(1.00)

vitest

(1.00)

eslint

(1.00)

biome

(1.00)

node

(0.70)

supabase

(0.70)

postgres

(0.70)

vite

(0.70)

pytest

(0.70)

ruff

(0.70)

javascript

(0.60)

monorepo

(0.60)

pnpm

(0.60)

terraform

(0.60)

github-actions

(0.60)

python

(0.50)

Format

AGENTS.md

A plain-markdown README for coding agents, deliberately unopinionated: no frontmatter, no globs, no vendor keys. That minimalism is why it became the one file a dozen different agents will read, and why it carries the least per-file targeting power of any format here.

What the corpus says about it

Repository

Owner
n8n-io
Language
—
License
—
Archived
no

All configs in this repo

Also in n8n-io/n8n

Diff this repo’s formats

One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
n8n-io/n8n.agents/skills/AGENTS.md · 199kAGENTS.mdtypescriptlangchain+16setuparchagent-behaviour58/1003 days ago
n8n-io/n8n.github/CLAUDE.md · 199kCLAUDE.mdtypescriptlangchain+17styleagent-behaviour48/1003 days ago
n8n-io/n8nAGENTS.md · 199kAGENTS.mdtypescriptlangchain+16setupbuildtestlint-format+896/1003 days ago
n8n-io/n8npackages/@n8n/ai-workflow-builder.ee/AGENTS.md · 199kAGENTS.mdtypescriptlangchain+16agent-behaviour53/1003 days ago
n8n-io/n8npackages/@n8n/db/AGENTS.md · 199kAGENTS.mdtypescriptlangchain+16database39/1003 days ago
n8n-io/n8npackages/@n8n/instance-ai/CLAUDE.md · 199kCLAUDE.mdtypescriptlangchain+16buildteststyletesting-strategy+189/1003 days ago
n8n-io/n8npackages/cli/AGENTS.md · 199kAGENTS.mdtypescriptlangchain+16lint-format55/1003 days ago
n8n-io/n8npackages/cli/src/modules/n8n-packages/CLAUDE.md · 199kCLAUDE.mdtypescriptlangchain+16stylearchdependenciesmonorepo+269/1003 days ago
n8n-io/n8npackages/frontend/AGENTS.md · 199kAGENTS.mdtypescriptlangchain+16style40/1003 days ago
n8n-io/n8npackages/frontend/editor-ui/src/app/stores/workflowDocument/CLAUDE.md · 199kCLAUDE.mdtypescriptlangchain+16styleagent-behaviour58/1003 days ago
n8n-io/n8npackages/nodes-base/AGENTS.md · 199kAGENTS.mdtypescriptlangchain+16teststylearchtypes+589/1003 days ago
n8n-io/n8npackages/testing/playwright/AGENTS.md · 199kAGENTS.mdtypescriptlangchain+17setupbuildtestlint-format+896/1003 days ago
n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199kAGENTS.mdtypescriptlangchain+16buildteststylearch+3100/1003 days ago
n8n-io/n8nscripts/instance-seeding/AGENTS.md · 199kAGENTS.mdtypescriptlangchain+16setupstyledo-not65/1003 days ago
Diff against .agents/skills/AGENTS.md Diff against .github/CLAUDE.md Diff against AGENTS.md Diff against packages/@n8n/ai-workflow-builder.ee/AGENTS.md Diff against packages/@n8n/db/AGENTS.md Diff against packages/@n8n/instance-ai/CLAUDE.md Diff against packages/cli/AGENTS.md Diff against packages/cli/src/modules/n8n-packages/CLAUDE.md Diff against packages/frontend/AGENTS.md Diff against packages/frontend/editor-ui/src/app/stores/workflowDocument/CLAUDE.md Diff against packages/nodes-base/AGENTS.md Diff against packages/testing/playwright/AGENTS.md Diff against packages/@n8n/agents/AGENTS.md Diff against scripts/instance-seeding/AGENTS.md

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
TryGhost/Ghoste2e/AGENTS.md · 55kAGENTS.mdtypescriptjavascript+12setupteststylearch+2100/1003 days ago
elastic/elasticsearchx-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/AGENTS.md · 78kAGENTS.mdjavanode+4buildtestlint-formatstyle+2100/1003 days ago
mui/material-uiAGENTS.md · 99kAGENTS.mdtypescriptjavascript+13setupbuildtestlint-format+9100/1003 days ago
n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199kAGENTS.mdtypescriptlangchain+16buildteststylearch+3100/1003 days ago
code-yeongyu/oh-my-openagentpackages/web/AGENTS.md · 67kAGENTS.mdtypescriptbun+10setupbuildtestlint-format+6100/1002 days ago
duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70AGENTS.mdtypescriptjavascript+5buildteststylearch+3100/1003 days ago
aaif-goose/gooseAGENTS.md · 52kAGENTS.mdrusttypescript+2setupbuildtestlint-format+6100/1003 days ago
elastic/elasticsearchx-pack/plugin/inference/AGENTS.md · 78kAGENTS.mdjavanode+4buildtestlint-formatstyle+3100/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack