AGENTS.md
scripts/instance-seeding/AGENTS.mdAGENTS.md
Quality
65/100
Scores the file, not the repository.Length
1,205 words
10 headings · 4 code blocksRepository
199k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1# Seed n8n instance23`seedInstance.mjs` fills a local n8n instance with a realistic-looking spread of4projects, workflows, credentials, and data tables via the **public API**. The5resulting dependency graph is designed to render like a real org's automation6estate: dense intra-team clusters, sparse cross-team bridges through shared7utility projects, a few legacy "trenchcoat" projects sitting off to the side,8and one central data table that everything reaches through a proxy workflow.910Useful for demos, perf testing, visual QA of the workflow dependency graph, and11poking at the workflow-index module with non-trivial input.1213## Quick start1415```sh16N8N_API_KEY="<a public-api JWT for an owner/admin>" \17 node scripts/instance-seeding/seedInstance.mjs18```1920Targets `http://localhost:5678` by default. The script is **destructive by21default**: it deletes its own prior output (anything tagged `[seed]`) and any22team projects whose names match the current taxonomy plus orphans from older23runs. Personal-project entities that don't match the seed prefix are left24alone, as are the n8n-default `My project` team projects.2526### Environment variables2728| Var | Default | Purpose |29| --- | --- | --- |30| `N8N_API_KEY` | (required) | Public-API JWT. Must have owner or admin scopes. |31| `N8N_BASE_URL` | `http://localhost:5678` | n8n instance to seed. |32| `CLEAR` | `false` | Set to `true` to wipe data instead. |33| `PERSONAL_WORKFLOWS` | `50` | Amount of workflows to create in the personal project. |3435Runtime is ~30–45 s for a default run (~500 workflows, ~30 projects).3637## What it creates3839**Projects** (30 team projects + your existing personal):4041- **2 utility projects** — `Shared Platform` (technical plumbing: Audit42 Logger, Slack Alerts Dispatcher, Sentry Error Forwarder, …) and43 `Org Utilities` (business helpers: Tenant Resolver, Vault Reader, Feature44 Flag Resolver, …). These are the hub workflows the rest of the org calls45 into.46- **25 community projects** organised into 5 themed communities of 5 projects47 each: Revenue, Customer, Engineering, Operations, Knowledge.48- **3 trenchcoat projects** — Legacy Migrations, Skunkworks, Founder's49 Workflows. Smaller, internally split into 2-3 disjoint sub-systems (e.g.50 `[HR System]`, `[Old Billing]`, `[Acme Acquisition]`), and almost entirely51 detached from the rest of the org. They model accreted legacy state.5253**Credentials** (~110):54- Two per project max (random recipes: Notion, Slack, Postgres, GitHub, …).55- Plus **5 global credentials** living in the utility projects (Production56 Slack Webhook, Datadog API, GitHub platform bot, OpenAI production,57 Vault read-only).5859**Data tables** (~15–20):60- One per ~55% of projects, with 5–20 sample rows.61- Plus one **central data table** `seed_customers` in `Org Utilities` that62 the entire org reaches through a single proxy workflow.6364**Workflows** (~500), built in four phases:65- **Phase 0** — Utility lynchpin workflows in `Shared Platform` and66 `Org Utilities`, plus the Customers Proxy.67- **Phase 1** — Leaf workflows in every project, no sub-calls.68- **Phase 2** — Parent workflows with sub-workflow refs. Community projects69 pick own/sibling/lynchpin; trenchcoats pick within their internal group.70- **Phase 3** — Data-table consumer workflows (one per project DT).71- **Phase 4** — Cross-project data-table proxies for ~6 non-utility DTs.7273## Two non-obvious architectural rules74751. **`DataTable` nodes can only point at tables in their own project.** Cross-76 project access goes through a proxy workflow. The `customersProxy` in77 `Org Utilities` is the only workflow with a direct `DataTable` node on78 the central table; everyone else calls the proxy via `ExecuteWorkflow`.79 Phase 4 generalises this pattern to ~6 other data tables.80812. **Per-project external-ref budgets.** Each community project is capped at82 2–5 distinct external workflow refs and 5–10 external credential refs,83 tracked across all phases. About a third of community projects opt out of84 utility refs entirely (some of those go fully self-contained — no85 external refs of any kind). Trenchcoats and utility projects are exempt.8687## Tunable knobs8889All knobs live at the top of `seedInstance.mjs`. The ones that change the90shape of the graph the most:9192| Constant | Effect |93| --- | --- |94| `COMMUNITIES` | Project taxonomy. Add/remove communities or projects. |95| `TRENCHCOAT_PROJECTS` + `TRENCHCOAT_GROUPS` | Legacy projects and their internal subsystems. |96| `UTILITY_WORKFLOW_THEMES` | Lynchpin workflow names per utility project. |97| `LYNCHPIN_CRED_RECIPES` | The 5 global credentials. |98| `UTILITY_REF_PROB` (0.6) | Per-workflow probability of including a utility ref. |99| `CENTRAL_DT_REF_PROB` (0.08) | Per-workflow probability of calling the Customers Proxy (indirect central-DT use). |100| `ORG_UTIL_DIRECT_DT_PROB` (0.5) | Per-workflow probability that an Org Utilities phase-0 workflow gets a direct DataTable node on the central table. |101| `EXT_WF_REF_BUDGET` / `EXT_CRED_REF_BUDGET` | Per-project distinct-ref caps. |102| `NON_UTILITY_USING_TARGET` (9) | How many community projects opt out of utility refs. |103| `SELF_CONTAINED_PROJECT_PROB` | Subset of the opt-out projects that go fully siloed. |104| `sampleWorkflowCount()` | Power-law-ish size buckets per project kind. |105106`SUBWF_PROB_OWN`/`_SIBLING`/`_LYNCHPIN` (in `pickCommunitySubWf`) govern how107parent workflows route sub-calls.108109## Verifying a run110111The dependency-graph endpoint is the canonical view of what the seed112produced. It includes both the community structure and the central-DT proxy113pattern:114115```sh116curl -s "$N8N_BASE_URL/api/v1/workflows/dependency-graph?format=dot" \117 -H "X-N8N-API-KEY: $N8N_API_KEY" | sfdp -Tsvg -Goverlap=prism > graph.svg118```119120`sfdp`/`fdp` (Graphviz force-directed layouts) reveal the cluster topology121better than the default hierarchical `dot` layout.122123Counts via API:124125```sh126for path in workflows projects credentials data-tables; do127 echo -n "$path: "128 curl -s "$N8N_BASE_URL/api/v1/$path?limit=1" \129 -H "X-N8N-API-KEY: $N8N_API_KEY" | jq -r '.data | length'130done131```132133Key numbers a default run should land near:134- ~500 workflows, 30 team projects, ~110 credentials, ~15 data tables135- ~45% of workflows reference a utility workflow136- ~5–10% of workflows reach the central data table (2–4 direct refs from137 workflows inside Org Utilities — Customers Proxy plus a few service138 workflows like Region Router or Feature Flag Resolver — and the rest via139 `ExecuteWorkflow` into the proxy)140- 20 of 29 non-utility projects use utility workflows141- 0 direct cross-project DataTable references (architectural invariant)142143## Re-running and cleanup144145The clear step is greedy: any workflow / credential / data-table with the146`[seed]` (or `seed_` for data tables) prefix is deleted, plus any team147project owning a `[seed]`-prefixed entity, plus any orphan team project from148an earlier run that doesn't match the current `PROJECT_NAMES` list and is149empty and not named `My project`.150151To remove all seeded data without reseeding:152153```sh154N8N_API_KEY=… CLEAR=only node bin/seedInstance/seedInstance.mjs155```156157158## Adding new behaviour159160Adding a new shape of workflow usually means three places:1611621. A constant or recipe at the top of the file (theme name, cred type, …).1632. A change inside `workflowNodes()` if it needs a new node type.1643. A phase change (or new phase) inside `main()` that calls `createWf()`.165166`applyOrgUtilityRefs()` is the central hook for "every workflow should167sometimes touch X". Phase 4 (`/* cross-project data-table proxies */`) is168the template for "select a few entities, give each its own consumer169fan-out".170171## Known limitations172173- Trenchcoat phase-3 (data-table consumer) workflows don't carry an internal174 group label, so they show up as ungrouped within their trenchcoat project.175 Minor visual artifact only.176- The `[seed] X: [group] Y N` naming convention is what powers the177 group-aware visualisation. Renaming a workflow externally severs the178 link the analyser uses to group it.179- No protection against running against a non-local instance. **Don't point180 it at a shared/production n8n** — the clear step will delete everything181 prefixed `[seed]` regardless of who created it.182
Also in n8n-io/n8n
Diff this repo’s formatsOne 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?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| n8n-io/n8n.agents/skills/AGENTS.md · 199k | AGENTS.md | setuparchagent-behaviour | 58/100 | 3 days ago | |
| n8n-io/n8n.github/CLAUDE.md · 199k | CLAUDE.md | styleagent-behaviour | 48/100 | 3 days ago | |
| n8n-io/n8nAGENTS.md · 199k | AGENTS.md | setupbuildtestlint-format+8 | 96/100 | 3 days ago | |
| n8n-io/n8npackages/@n8n/ai-workflow-builder.ee/AGENTS.md · 199k | AGENTS.md | agent-behaviour | 53/100 | 3 days ago | |
| n8n-io/n8npackages/@n8n/db/AGENTS.md · 199k | AGENTS.md | database | 39/100 | 3 days ago | |
| n8n-io/n8npackages/@n8n/engine/AGENTS.md · 199k | AGENTS.md | archdo-not | 59/100 | 3 days ago | |
| n8n-io/n8npackages/@n8n/instance-ai/CLAUDE.md · 199k | CLAUDE.md | buildteststyletesting-strategy+1 | 89/100 | 3 days ago | |
| n8n-io/n8npackages/cli/AGENTS.md · 199k | AGENTS.md | lint-format | 55/100 | 3 days ago | |
| n8n-io/n8npackages/cli/src/modules/n8n-packages/CLAUDE.md · 199k | CLAUDE.md | stylearchdependenciesmonorepo+2 | 69/100 | 3 days ago | |
| n8n-io/n8npackages/frontend/AGENTS.md · 199k | AGENTS.md | style | 40/100 | 3 days ago | |
| n8n-io/n8npackages/frontend/editor-ui/src/app/stores/workflowDocument/CLAUDE.md · 199k | CLAUDE.md | styleagent-behaviour | 58/100 | 3 days ago | |
| n8n-io/n8npackages/nodes-base/AGENTS.md · 199k | AGENTS.md | teststylearchtypes+5 | 89/100 | 3 days ago | |
| n8n-io/n8npackages/testing/playwright/AGENTS.md · 199k | AGENTS.md | setupbuildtestlint-format+8 | 96/100 | 3 days ago | |
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199k | AGENTS.md | buildteststylearch+3 | 100/100 | 3 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/engine/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
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| TryGhost/Ghoste2e/AGENTS.md · 55k | AGENTS.md | setupteststylearch+2 | 100/100 | 3 days ago | |
| elastic/elasticsearchx-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/AGENTS.md · 78k | AGENTS.md | buildtestlint-formatstyle+2 | 100/100 | 3 days ago | |
| mui/material-uiAGENTS.md · 99k | AGENTS.md | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199k | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| code-yeongyu/oh-my-openagentpackages/web/AGENTS.md · 67k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 2 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| aaif-goose/gooseAGENTS.md · 52k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| elastic/elasticsearchx-pack/plugin/inference/AGENTS.md · 78k | AGENTS.md | buildtestlint-formatstyle+3 | 100/100 | 3 days ago |
