Twenty Agent Rules

An open-source CRM with a React frontend, NestJS backend, and application SDK.

Overview

Twenty's AGENTS.md links to a compact CLAUDE.md for its multi-package CRM. The guide tells contributors to follow nearby code, names mistakes agents keep making, and records test and migration traps hidden behind ordinary commands.

Documents

├── 
├──  · symlink → CLAUDE.md
└── packages
    ├── create-twenty-app
    │   └── src
    │       └── constants
    │           └── template
    │               └── 
    ├── twenty-agent-skills
    │   └── 
    ├── twenty-apps
    │   ├── examples
    │   │   └── postcard
    │   │       └── 
    │   ├── internal
    │   │   └── twenty-partners
    │   │       ├── 
    │   │       └──  · imports AGENTS.md
    │   └── public
    │       ├── call-recorder
    │       │   ├── 
    │       │   └──  · same content as packages/twenty-apps/public/call-recorder/AGENTS.md
    │       ├── companion
    │       │   ├──  · same content as packages/create-twenty-app/src/constants/template/AGENTS.md
    │       │   └──  · same content as packages/create-twenty-app/src/constants/template/AGENTS.md
    │       ├── fathom
    │       │   ├──  · same content as packages/create-twenty-app/src/constants/template/AGENTS.md
    │       │   └──  · same content as packages/create-twenty-app/src/constants/template/AGENTS.md
    │       ├── granola
    │       │   ├── 
    │       │   └──  · same content as packages/twenty-apps/public/granola/AGENTS.md
    │       ├── last-contact
    │       │   ├── 
    │       │   └──  · same content as packages/twenty-apps/public/last-contact/AGENTS.md
    │       └── linear
    │           └── 
    ├── twenty-server
    │   └── docs
    │       └── 
    └── twenty-ui
        └── src
            └── icon
                └── 

Techniques in this file

01 / Behavioral framing

Give surrounding code precedence over written defaults

The opening instruction makes adjacent files the authority when local conventions differ. It explicitly includes file naming, which varies across this monorepo.

Source excerpt starting at line 5.
Match the surrounding code — the adjacent files in the directory you are editing beat any written rule, including for file naming, which varies by area.

02 / Verification by change type

Identify stale artifacts before diagnosing failures

The guide treats the shared package output as branch-specific state. It requires rebuilding without Nx cache after branch switches or shared-package edits before trusting dependent test results.

Source excerpt starting at line 43.
- **`twenty-shared/dist` is per-branch state nothing tracks.** After switching branches or editing `twenty-shared`, run `npx nx build twenty-shared --skip-nx-cache` before trusting any typecheck or test failure in a dependent package.

03 / Verification by change type

Bypass cached success when verifying a fix

A separate gotcha warns that the task runner can return an old passing result. It names a direct compiler invocation for checking whether a change actually fixes the problem.

Source excerpt starting at line 44.
- **Nx caching can serve a stale pass.** To verify a fix, run `npx tsgo -p tsconfig.json --noEmit` in the package directly rather than `nx typecheck`.

04 / Generated file guards

Keep incidental generated changes out of a patch

Translation extraction can rewrite large catalogs as a side effect of editing a message. The guide reserves those files for translation work and leaves their routine maintenance to the translation pipeline.

Source excerpt starting at line 45.
- **Do not commit translation catalogs unless translations are the task.** `lingui extract`/`compile` regenerate `packages/twenty-server/src/engine/core-modules/i18n/locales/*.po` and `locales/generated/*` with thousands of lines of churn as a side effect of touching any `msg` string. The i18n pipeline maintains them; leave them out of your commit.

05 / Behavioral framing

Name an observed agent failure

The house rules point to existing guard packages before allowing new helpers. They identify redundant utilities as a recurring agent-authored defect, giving the lookup step a concrete reason.

Source excerpt starting at line 16.
- Use existing guards and helpers before writing your own: `isDefined`, `isNonEmptyArray`, `isPlainObject`, … from `twenty-shared/utils`; `isNonEmptyString`, `isString`, `isNull`, `isObject`, … from `@sniptt/guards`. Reimplementing an existing util is the most common AI-authored defect here.

Ideas for your repo

  1. State when local examples override repository-wide defaults.
  2. Document build artifacts that survive branch switches.
  3. Name a verification command that bypasses task caches.
  4. Exclude incidental generated files from unrelated patches.
Sponsored byModem

Give your agents the whole story.

These instructions explain how to work in Twenty. Modem shows your agents what customers said, who is affected, and what changed.

See how Modem works