@dench.com/cli 3.11.33-staging.725 → 3.11.35-staging.803

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/crm.ts CHANGED
@@ -532,17 +532,31 @@ export function countResultStatuses(results: unknown[]): {
532
532
  created: number;
533
533
  alreadyExisted: number;
534
534
  updated: number;
535
+ errors: number;
535
536
  } {
536
537
  let created = 0;
537
538
  let alreadyExisted = 0;
538
539
  let updated = 0;
540
+ let errors = 0;
539
541
  for (const result of results) {
540
542
  const status = isJsonRecord(result) ? result.status : undefined;
541
543
  if (status === "already_existed") alreadyExisted += 1;
542
544
  else if (status === "updated") updated += 1;
545
+ else if (status === "error") errors += 1;
543
546
  else created += 1;
544
547
  }
545
- return { created, alreadyExisted, updated };
548
+ return { created, alreadyExisted, updated, errors };
549
+ }
550
+
551
+ /** "Row N: reason" for every row `batch.apply` skipped (DEN-349). */
552
+ export function importRowErrors(results: unknown[]): string[] {
553
+ return results.flatMap((result) =>
554
+ isJsonRecord(result) &&
555
+ result.status === "error" &&
556
+ typeof result.error === "string"
557
+ ? [result.error]
558
+ : [],
559
+ );
546
560
  }
547
561
 
548
562
  function parseUpdateManyRows(items: unknown[]): Array<{
@@ -672,6 +686,7 @@ export async function applyBatchOpsInChunks(
672
686
  allowUnknown = false,
673
687
  onConflict?: CrmOnConflictPolicy,
674
688
  withReferences = false,
689
+ collectRowErrors = false,
675
690
  ): Promise<{
676
691
  chunks: number;
677
692
  results: unknown[];
@@ -689,6 +704,7 @@ export async function applyBatchOpsInChunks(
689
704
  ...(chunkKey ? { idempotencyKey: chunkKey } : {}),
690
705
  ...(allowUnknown ? { allowUnknown: true } : {}),
691
706
  ...(onConflict ? { onConflict } : {}),
707
+ ...(collectRowErrors ? { collectRowErrors: true } : {}),
692
708
  })) as
693
709
  | { results?: unknown[]; references?: WorkspaceReference[] }
694
710
  | null
@@ -3893,21 +3909,27 @@ async function runImportCommand(ctx: CrmCliContext): Promise<void> {
3893
3909
  }));
3894
3910
  // batch.apply matches the selected CRM field when supplied; otherwise
3895
3911
  // seedKey protects exact reruns. The shared helper handles chunking.
3912
+ // A bad row is reported by its row number and skipped; the good rows are
3913
+ // still created (DEN-349).
3896
3914
  const { results } = await applyBatchOpsInChunks(
3897
3915
  ctx,
3898
3916
  ops,
3899
3917
  undefined,
3900
3918
  false,
3901
3919
  onConflict,
3920
+ false,
3921
+ true,
3902
3922
  );
3903
3923
  const counts = countResultStatuses(results);
3924
+ const rowErrors = importRowErrors(results);
3904
3925
  out(ctx, {
3905
3926
  objectName,
3906
3927
  sourceRowsParsed: rows.length,
3907
3928
  imported: counts.created,
3908
3929
  skipped: counts.alreadyExisted,
3909
3930
  updated: counts.updated,
3910
- errors: 0,
3931
+ errors: counts.errors,
3932
+ ...(rowErrors.length > 0 ? { rowErrors } : {}),
3911
3933
  onConflict,
3912
3934
  ...(dedupeColumn ? { dedupeKey: dedupeColumn } : {}),
3913
3935
  });
@@ -1,6 +1,6 @@
1
1
  {
2
- "revision": "033e8fe02475619c0191d7b8d1d5bd10232cbf9d08f18f5cc58d3e20a8afbce2",
3
- "builtinHash": "827e05a58826c28223d97d9c6812ff4a0ef4b1cdafa64ef618fa8844103a64c1",
2
+ "revision": "8325e72981fafbb2dfae8b833361c30df30f4d2b7a6627b0eb574a183a3628e8",
3
+ "builtinHash": "fd16877433880e078f82b6e257293be135d0ed481c23187ba6b94dd4c38f8102",
4
4
  "files": {
5
5
  "SKILL.md": {
6
6
  "sha256": "a70b1fef829d3a19243b4499f5b8ee7317714cea38cee5faab619f7bfeab4287",
@@ -43,8 +43,8 @@
43
43
  "content": "---\nname: crm-import\ndescription: \"The mandatory safe-import playbook for bulk CRM writes: staging uploaded source files, schema mapping, dedupe keys, --on-conflict semantics, post-import verification, relation resolution, safe re-runs, and convergent dedup jobs. Includes importing meetings (calls with transcripts, action items and attendees from Granola, Fireflies, a CSV or a connected tool) via `dench meetings import`. Read this BEFORE any bulk import, migration, or dedup/merge job.\"\n---\n\n# CRM Import Playbook (mandatory before bulk writes)\n\nEvery rule below exists because an agent skipping it caused real data\nloss for a real customer. Follow the steps in order. Do not improvise.\n\nNon-negotiables, up front:\n\n- **Never wipe-and-reimport.** Re-running an import with the same\n `--dedupe-key` is a safe upsert; deleting the object's rows first is\n how \"fix the duplicates\" becomes \"lost every manual edit\".\n- **Never fabricate data to make a relation resolve.** No placeholder\n \"Unknown\" accounts, no name-similarity linking.\n- **Verify counts after every bulk write.** Command exit 0 is not\n success; matching numbers are.\n\n## 1. Stage the source file\n\nChat attachments are stored in your workspace, not on the local disk. A path like\n`/uploads/chat/new/leads.csv` identifies the original in storage, not a\nlocal file. In chat, call `materialize_context_to_file` with\n`sourcePath: \"/uploads/chat/new/leads.csv\"` and `path: \"leads.csv\"`.\nThis fetches the full original directly into local `/tmp/work/<runId>/`\nscratch, independently of workspace sync. Use the **returned absolute path**\nin every command below: the staged filename includes a unique prefix, so\ndo not assume it is `leads.csv`. Paths from earlier turns work too. Do not\nuse `dench fs pull` to obtain chat attachments.\n\nFor a paperclip attachment without an upload path, select the original\nwith `source: \"message_id\"`, `messageId` and `attachment` instead. Never\nreconstruct an uploaded dataset from the inline preview — it may be clipped.\n\nThen verify the staged file BEFORE parsing:\n\n```bash\nsource_file='<returned absolute path>'\nwc -c \"$source_file\" # byte size — compare to what the user/upload reported\nwc -l \"$source_file\" # raw line count\n```\n\nParse it, and compare parsed row count to what the file suggests. **If a\nCSV parses to fewer rows than the raw line count implies (or vice\nversa), STOP.** That is the signature of multiline quoted cells /\nquoting issues — the parser is gluing or splitting rows, and importing\nnow writes garbage. Fix the source first (a real CSV parser like\n`csvkit`/`duckdb`, or re-export from the source system as JSONL). The\nimport result's `sourceRowsParsed` must match your expectation before\nyou trust anything else.\n\n## 2. Inspect the target schema\n\n```bash\ndench crm objects list --json\ndench crm fields list <object> --json\n```\n\n- Plan the **column → field mapping** explicitly (this becomes `--map`).\n- Map to the **user's intended business object**, not the source\n system's layout. A HubSpot \"contacts\" export destined for a `lead`\n pipeline goes into `lead`, not into a new `contacts` object that\n mirrors HubSpot.\n- Field names are case-sensitive and workspace-specific — never guess.\n Create missing fields first (`dench crm fields create <object>\n \"<Name>\" --type ...` — name is positional, no `--name` flag).\n- **Confirm every relation field now** (`type: relation`,\n `related_object_name`): decide how each will be resolved (step 6)\n before importing, not after.\n\n## 3. Choose dedupe keys\n\nPick the stable identity column for the object:\n\n| Object kind | Dedupe key |\n| --- | --- |\n| people / leads / contacts | `Email` |\n| companies / accounts | `Domain` |\n| anything with a source-system id | that row id (import it into its own field) |\n\nAlways pass `--dedupe-key <CRM field>`. If the source has a row id,\nprefer it — it survives email/domain changes and makes every re-run a\nclean upsert.\n\nThis matches the selected field on **all existing records**, including\nrecords created manually or through another CLI command. Use the CRM\nfield name after applying `--map`. Matching trims and lowercases values;\nit does not perform fuzzy matching or remove punctuation.\n\nThe field must be `text`, `email`, `phone`, `url`, a single-select `enum`,\nor `number`, and each source value must be a non-blank string or a finite\nnumber. Arrays, objects, booleans, multi-select enums, and relation fields\nare not supported as dedupe identifiers. If multiple existing records\nmatch the normalized value, the import fails as ambiguous rather than\npicking one. Number fields compare numeric values (`\"01\"` matches `1`).\n\nField matching must read the complete object (up to 200 fields), within a limit of 1,000\nrecords and 3 MB across match lookups in one batch. If that lookup cannot\nfinish, the batch fails without writing. Export and reconcile existing\nrecords explicitly; do not remove `--dedupe-key` to bypass the error.\nWithout the flag, the content-hash retry key only protects exact reimports\nand does not match ordinary existing records by field value.\n\n## 4. Import\n\n```bash\ndench crm import <object> \\\n --csv \"$source_file\" \\\n --map '{\"email_address\":\"Email\",\"company_name\":\"Company\"}' \\\n --dedupe-key \"Email\" \\\n --on-conflict skip \\\n --json\n```\n\n- `--map` direction is **CSV column → CRM field**\n (`{\"<source column>\": \"<CRM field>\"}`).\n- `--on-conflict skip` (default) leaves existing rows untouched;\n `update` merges the incoming fields onto the matched row (upsert);\n `error` aborts on the first conflict. Matching uses the `--dedupe-key`\n column.\n- Batches are atomic, but earlier batches may already be committed when\n a later batch fails. Retry keys remain in use; if a retry key points at\n one record and the field matches another, or the original record's\n selected field has since changed, the batch fails without choosing an\n unrelated record.\n- Start with `skip` unless the user explicitly wants source data to\n overwrite CRM edits.\n- `dench crm entries create-many` accepts the same dedupe and conflict\n flags. For that command, `--on-conflict` requires `--dedupe-key`.\n\n## 5. VERIFY (mandatory — do not report success without this)\n\n1. Read the result: `{imported, skipped, updated, errors, sourceRowsParsed}`.\n `imported + skipped + updated + errors` must equal `sourceRowsParsed`, and\n `sourceRowsParsed` must equal your step-1 row count. Any mismatch =\n investigate before touching anything else.\n2. Re-count the object:\n\n ```bash\n dench crm export <object> --format jsonl | wc -l\n # or: dench crm aggregate <object> --field <Status/Type> --json\n ```\n\n The delta from the pre-import count must equal `imported`.\n3. **Sample 5 rows end-to-end**: pick 5 source rows (including at least\n one with a relation and one with tricky characters), `dench crm query\n <object> --where '{\"Email\":\"<sample>\"}' --json`, and check every\n mapped field landed — including relation links.\n\n## 6. Relations\n\nResolve relation cells by **exact keys only** — domain for companies,\nemail for people, source-system id when present:\n\n```bash\n# Resolve the target id first, then write it.\ndench crm query company --where '{\"Domain\":\"acme.com\"}' --select Name --json\n```\n\n- Ambiguous or missing target → leave the relation empty, tag the row\n (e.g. `Tags: [\"Unresolved\"]` or an `Import Status` enum), and report\n the unresolved list to the user at the end.\n- **Never fabricate placeholder \"Unknown\" accounts** to give orphan rows\n a parent.\n- **Never fuzzy-link tasks/opportunities by name similarity alone.**\n \"Acme follow-up\" does not prove it belongs to \"Acme Corp\" — link only\n on an exact key or explicit user confirmation.\n\n## 7. Re-runs & fixing a bad import\n\n- Re-running the same import with the same `--dedupe-key` is **safe**\n (skip/update semantics = upsert). This is the correct fix for a\n partial or interrupted import.\n- **NEVER wipe-and-reimport as a fix for duplicates.** Deleting the\n object's rows destroys manual edits, relation links, history, and\n engagement data that the source file does not contain. Fix duplicates\n with a dedup job (step 8) instead.\n\n## 8. Dedup jobs (deleting duplicates safely)\n\nBefore ANY deletion:\n\n1. **Verify export integrity**: `dench crm export <object> --format\n jsonl`, then confirm unique ids == the object's total row count\n (`objects list` `entryCount`). If the export is short or has repeated\n ids, STOP — your duplicate analysis is built on missing data.\n2. Compute duplicate groups on the dedupe key locally. Record the\n predicted **loser count** (rows to delete).\n3. Prefer **merging into the richest record** — the one with the most\n populated fields, relation links, and engagement history — not the\n oldest. Copy any values the loser has that the survivor lacks before\n deleting the loser.\n4. Delete losers with `dench crm entries bulk-delete <object> --ids ...`\n (max 200/call). The snapshot is automatic — the output's\n `snapshotPath` is a JSONL copy of every deleted row; keep it in your\n report.\n5. **The process must converge.** Recompute duplicate groups after each\n pass. The group count must shrink every pass; if it doesn't, STOP and\n investigate (your grouping key is unstable or something is recreating\n rows) — do not keep deleting.\n6. **Never delete more rows than the predicted loser count.** If pass N\n wants to delete more than your step-2 prediction, the analysis is\n wrong.\n\n## 9. Concurrency\n\n**Never run enrichment subagents (or any other writer) concurrently with\nan in-flight import on the same object.** Enrichment mid-import writes\nonto half-imported rows and races the dedupe matching — finish and\nverify the import first, then enrich.\n\n## 10. Importing meetings (calls, notes, transcripts)\n\nA meeting is an ordinary CRM record on the protected `meeting` object —\n`dench crm entries create meeting`, `dench crm import meeting` and the\nCRM tools all work. What the CRM verbs cannot reach are the three things\nthat live beside the record: the **transcript**, the **action-item\nchecklist** and the **attendance roster**. `dench meetings import` writes\nall four in one pass; every rule above still applies.\n\n**Use `dench meetings import`, not `dench crm import meeting`, whenever\nthe source has transcripts, action items or attendees.** It runs the same\nbatch path with the same seed keys (so §3–§7 hold unchanged), then fills\nthe side tables for each created row.\n\n### Source shape\n\nOne row per call. Meeting fields plus three optional reserved columns:\n\n| Column | Meaning | Accepted shapes |\n| --- | --- | --- |\n| `Title` (required), `Started At` (required for the day view), `Ended At`, `Recording Duration` (seconds), `Playbook`, `Platform`, `Meeting URL` | the record | any CRM field on `meeting` — check with `dench crm fields list meeting --json` |\n| `Outcome`, `Overview`, `Outline`, `Decisions`, `Next Actions`, `Open Questions`, `Follow-up Draft` | the brief | text / markdown; this is what the Brief tab renders |\n| `transcript` | side table | plain text (`[00:01:05] Speaker: line`, timestamp and speaker both optional), a JSON array of `{speaker, email?, start|startMs, end|endMs, text}` (un-suffixed `start`/`end` are **seconds**), or that array as a JSON string in a CSV cell |\n| `actionItems` | side table | lines / markdown checklist (`- [x] Send deck (Hank)`) or JSON `[{text, owner?, done?}]` |\n| `attendees` | side table | `Hank <hank@globex.com>; ada@acme.com; Just A Name (host)` or JSON `[{name, email, isHost?}]` |\n\nReserved column names are matched loosely (`Action Items`, `action_items`,\n`Attendees`, `Speakers` all work). Use `attendees`, NOT `Participants`:\n`Participants` is the meeting's relation to `people` rows (entry ids) and\nis filled automatically from the attendees that match.\n\n`Status` defaults to `Completed` — an imported call already happened.\n`Ended At` is derived from `Started At` + `Recording Duration` when only\none is present. Nothing else is invented: a row with no `Started At` is\nimported but WARNED about, because the Meetings day view finds meetings\nby that field.\n\n### Identity and dedupe\n\nThe meeting object has no source-id column. Add one, and dedupe on it:\n\n```bash\ndench crm fields create meeting \"Granola ID\" --type text --indexed\ndench meetings import --jsonl calls.jsonl --dedupe-key \"Granola ID\" --on-conflict skip --json\n```\n\nWithout `--dedupe-key`, the seed key is a hash of the meeting FIELDS only\n(never the transcript), so a corrected transcript re-run upserts the same\nmeeting rather than minting a second one. `--on-conflict update` replaces\nthe transcript and action items and MERGES attendees; `skip` leaves the\nrow and its side tables entirely alone.\n\n### Rules specific to meetings\n\n- **Run it as a signed-in member.** `meeting` is an owner-scoped object\n (`owner_plus_members`): the importer becomes `Owner User ID` and an\n org-scoped API key is refused. If the whole team should see imported\n calls, `dench crm objects update meeting --visibility workspace`.\n- **Attendees are LINKED, never created.** A known member (verified email)\n becomes a colleague on the roster; an email that matches an existing\n `people` row links it and pulls its company into `Companies`; anything\n else stays a name on the roster. Do not pre-create people to make the\n roster resolve — that is the fabrication rule again.\n- **Timing is honoured, not invented.** Untimed transcript lines land at\n `0:00` and the UI hides the clocks. Do not spread lines evenly across\n the duration to make it look recorded.\n- **No analysis runs on import.** The brief is whatever the source gave.\n If the user wants Dench to summarise an imported transcript, read it\n back with `dench meetings transcript get <id>` and write the brief\n fields with `dench crm entries update meeting <id> --data …`, citing\n nothing you cannot point at.\n- **Verify like any import.** `imported + skipped + errors ==\n sourceRowsParsed`; then open two meetings' worth of side tables:\n `dench meetings transcript get <id> | head`, `dench meetings\n action-items list <id>`, `dench meetings participants list <id>`.\n\n### Worked example: a Granola / Fireflies export\n\n```bash\n# 1. Call materialize_context_to_file with sourcePath=\"/uploads/chat/new/granola-export.jsonl\"\n# and path=\"granola-export.jsonl\". In this shell use its returned /tmp path.\nsource_file='<returned absolute path>'\nwc -l \"$source_file\" # 37 lines → expect 37 rows\n\n# 2. Inspect the target, add the source id.\ndench crm fields list meeting --json\ndench crm fields create meeting \"Granola ID\" --type text --indexed\n\n# 3+4. Map the export's keys onto meeting fields; attach the side tables.\n# (id → Granola ID, title → Title, summary → Overview, notes → Outline,\n# created_at → Started At, transcript/action_items/attendees as-is)\ndench meetings import --jsonl \"$source_file\" \\\n --map '{\"id\":\"Granola ID\",\"title\":\"Title\",\"summary\":\"Overview\",\"notes\":\"Outline\",\"created_at\":\"Started At\"}' \\\n --dedupe-key \"Granola ID\" --on-conflict skip --json\n# → {\"imported\":37,\"skipped\":0,\"updated\":0,\"errors\":0,\"sourceRowsParsed\":37,\n# \"transcriptSegments\":4120,\"actionItems\":88,\"attendees\":97,\"linkedPeople\":41,\"rows\":[…]}\n\n# 5. Verify counts, then sample two meetings end-to-end.\ndench crm export meeting --format jsonl | wc -l\ndench meetings transcript get <id> | head -5\ndench meetings participants list <id> --json\n```\n\nA tool-connected source (a connected app reached through `dench\ntool run …`) is the same flow: write the fetched calls to a JSONL with\nthose keys, then import. Re-running with the same `--dedupe-key` picks up\nonly the new calls.\n\n## Worked example\n\nUser uploads `hubspot-leads.csv` (attachment) and says \"import my\nHubSpot leads\".\n\n```bash\n# 1. Call materialize_context_to_file with sourcePath=\"/uploads/chat/new/hubspot-leads.csv\"\n# and path=\"hubspot-leads.csv\". In this shell use its returned /tmp path.\nsource_file='<returned absolute path>'\nwc -c \"$source_file\" && wc -l \"$source_file\" # 48213 bytes, 501 lines → expect ~500 rows\n\n# 2. Inspect the target (user wants these as `lead` rows, not a new object).\ndench crm fields list lead --json # → Name, Email, Company (relation→company), Status, Notes\ndench crm fields create lead \"HubSpot ID\" --type text --indexed # source row id\n\n# 3+4. Import with dedupe key + skip.\ndench crm import lead \\\n --csv \"$source_file\" \\\n --map '{\"first_name\":\"Name\",\"email\":\"Email\",\"hs_object_id\":\"HubSpot ID\"}' \\\n --dedupe-key \"HubSpot ID\" \\\n --on-conflict skip \\\n --json\n# → {\"imported\":486,\"skipped\":12,\"errors\":2,\"sourceRowsParsed\":500,\"onConflict\":\"skip\"}\n\n# 5. Verify: 486+12+2 = 500 = parsed = source. Inspect the 2 errors,\n# re-count the object, sample 5 rows end-to-end.\ndench crm export lead --format jsonl | wc -l\n\n# 6. Resolve Company relations by exact domain; tag misses \"Unresolved\".\n# Report: imported 486, skipped 12 (already present), 2 error rows shown\n# to the user, 9 rows tagged Unresolved (no matching company domain).\n```\n"
44
44
  },
45
45
  "references/CRM.md": {
46
- "sha256": "b112cf4a63b8f390aaa6a12d7154ddeb4c7959ec7ff44f43981402003c34089a",
47
- "content": "---\nname: crm\ndescription: Use the Dench CRM (crmObjects/crmFields/crmEntries) for ALL structured workspace data - people, companies, deals, tasks, anything list-shaped. Covers object/field creation and editing, enum option management, relation-first modeling, batch entry writes, reads, queries with $-operators, aggregates, saved views, transactions, CSV/JSONL import-export, provider enrichment, reports, documents, curating the progressive-disclosure sidebar (Library rows vs the home Pinned strip; pin/reorder/remove/archive), and the canonical patterns for \"I have a list of X, put it in the CRM\" requests. CRM essentials are preloaded in Dench chat; load the relevant detailed section before unfamiliar operations.\n---\n\n# Dench CRM Playbook\n\nUse the Dench CRM for all structured workspace data. Lists of people,\ncompanies, leads, deals, tasks, events, properties, cases, invoices, or any\ntabular data belong in `crmObjects`, `crmFields`, and `crmEntries`, not in ad\nhoc files under `/workspace`.\n\nReusable scripts and package installations belong in saved environments, not CRM\nfields or memory. Read [ENVIRONMENTS.md](https://dench.com/references/ENVIRONMENTS.md)\nwhen the user asks to reuse custom setup across chats. Keep credentials in\n`dench secrets`, business rows in CRM, and report outputs in Dench files. A saved\nmemory saying a service is configured does not establish that its key exists.\n\n> **Doing sales work?** (lead gen, target account lists, prospect research,\n> enrichment, outreach prep, qualification, opportunities, pipeline,\n> forecasting, account research) — read `references/SALES.md` and run it\n> through the Sales Template's Leads → Opportunities → Customers flow.\n\n> **Doing a bulk import?** (a CSV/JSONL/attachment of rows, a migration\n> from another CRM, a dedup or merge job) — **STOP and load the\n> `crm-import` playbook BEFORE running any import.** This `crm` skill is\n> NOT sufficient for imports. In-workspace agents: call\n> `load_skill({ name: \"crm-import\" })`. External agents:\n> `curl -sL https://dench.com/references/CRM-IMPORT.md`. It is the\n> mandatory playbook for staging source files, choosing dedupe keys,\n> `--on-conflict`, verifying counts, resolving relations, and safe dedup\n> — every step exists because an agent skipping it caused real data\n> loss.\n>\n> ```bash\n> curl -sL https://dench.com/references/CRM-IMPORT.md\n> ```\n\nCSV files are only inputs to `dench crm import` or outputs from\n`dench crm export`. Do not default to writing a CSV just because the source\ndata looks tabular.\n\n<!-- dench:essentials:start -->\n## CRM Essentials\n\nObjects are tables, fields columns, entries rows. Do not rediscover a table already\nidentified by relevant context, including custom tables. Discover only missing schema:\n`dench crm objects list --compact --json` / `dench crm fields list <object>\n--compact --json`. CRM inventories start with objects/counts.\n\n- Lists/finds return names/links; add requested or known columns. Do not\n fetch schema or record details just to enrich the answer.\n - List/filter: `dench crm query <object> --page --select \"Name\" --limit 100\n --json`; add `--where '{\"Status\":\"Open\"}'` when that field/value is known.\n - Find: `dench crm search \"query\" --object <object> --select \"Name\" --json`.\n - Summarize a known record: `dench crm entries get <object> <id> --with-context\n --compact --json`. This includes saved brief, recent activity and notes. A\n stale/missing brief or clipped Notes alone needs no full reread: summarize\n available evidence with brief/clipping limits. Read deeper if missing/clipped\n evidence could change the answer.\n Query pages return projected `page[]` rows; search keeps `page[]._id` and\n `page[].data`. Preserve IDs and returned links. Repeat the same command with\n `--cursor '<continueCursor>'` until `isDone` when completeness is needed, even\n after an empty page. Select only needed columns to avoid large Notes bodies.\n- Reuse known schema and matched entries before writes; avoid duplicates. `people`,\n `company`, and `task` are protected objects. Use relations for entities, member IDs\n for `user` fields, and existing enum options.\n- Record prose belongs in protected `Notes`. Saved context usually answers history\n questions; use live integrations or sync diagnostics only for a relevant gap.\n An email-address lookup needs no unrelated brief/activity read.\n- Ordinary lists use projected pages, not export-and-parse scripts. Export for\n requested files or substantial processing. Empty/capped previews are not totals.\n Keep prospect lists separate until asked to add CRM records.\n- Load `crm-import` before bulk imports, migrations, deduplication or merges. Use\n stable dedupe keys, verify counts and protect existing human edits.\n- Use saved views/analytics for their requested scope. Answer lists and summaries\n normally with inline named record links; no table artifact or presentation call.\n\nFor unfamiliar operations, load `crm#queries-and-search`, `crm#field-types`,\n`crm#tasks`, `crm#saved-views`, or another exact section from the root `crm` index.\nThese routine recipes need no additional skill load.\n<!-- dench:essentials:end -->\n\n## Mental Model\n\n- `crmObjects` are tables: `people`, `company`, `lead`, `deal`, `task`.\n- `crmFields` are columns on an object: `Email`, `Stage`, `Company`.\n- `crmEntries` are rows.\n- Cells are field values on entries.\n- `crmEntryFields` is the indexed projection used for fast query/search.\n\nThe CLI talks to the Dench API and enforces org scoping, protected objects,\nvalidation, and idempotency server-side. Prefer `dench crm` over hand-rolled\nscripts that call the backend directly.\n\n## Canonical Names vs Display Labels\n\nEvery object has a **canonical `name`** (singular lowercase: `people`,\n`company`, `lead`, `case`) and may also carry a cosmetic **`displayName` /\n`displayNameSingular`** shown in the UI. Templates and users can relabel\nobjects — e.g. a law-firm workspace shows the protected `people` object as\n\"Clients\" — **without changing the canonical name**.\n\nRules:\n\n- Commands and API calls take the canonical `name`. Get it from\n `dench crm objects list --json` (each row includes `name` and, when set,\n `displayName`).\n- When a user says \"add a row to Clients\", they usually mean the object whose\n display label is \"Clients\" — resolve it via `objects list`, then use the\n canonical name.\n- The server is forgiving: display labels, different casing (\"People\"), and\n plural forms (\"leads\", \"cases\") resolve automatically **when unambiguous**, and\n a failed lookup returns the org's object catalog in the error message. Use\n that to self-correct in one step — but do not rely on it in scripts; pin\n canonical names.\n- `objects rename` changes the canonical name (blocked on protected\n objects). To relabel only what the UI shows, set the display name instead:\n\n```bash\n# Relabel the UI without breaking anything keyed by the canonical name.\ndench crm objects update people --display-name \"Clients\" --display-name-singular \"Client\"\n```\n\n## The Reserved `Notes` Field (write here for entry-level prose)\n\nEvery CRM object ships with a protected `Notes` (richtext) field. It is\nauto-created by `crm.objects.create` and cannot be renamed or deleted.\nThe UI dedicates the entry-detail editor on the right to this field, so\n**`Notes` does not appear in any list view (table, kanban, gallery,\nsidebar properties) — it is only visible when the entry is opened**.\n**On custom objects that right-side editor tab is labelled \"Overview\"\n(it only reads \"Notes\" on the built-in People/Companies objects) —\n\"Overview\" and `Notes` are the same reserved field.** The field key you\nwrite to is always `Notes` regardless of which label the tab shows.\n\nThis is your single canonical home for free-form, unstructured prose\nabout an entry: meeting notes, research summaries, status updates, the\n\"description\" of a task, prep for a call, follow-up history, etc.\nBias aggressively toward `Notes` for anything that reads like paragraph\ntext or Markdown.\n\nRules for agents:\n\n- **Any free-form information about an entry goes into `Notes`,\n written as Markdown.** Do not invent a parallel `Description`,\n `Details`, `Content`, `Body`, `Summary`, `Brief`, `Bio`, `Profile`,\n `Research`, `Background`, `About`, or similar text/richtext field for\n the same purpose — it will be redundant with `Notes` and clutter the\n table view.\n- **The big \"Overview\" editor on a custom object IS `Notes` — fill it.**\n This applies to task/bug/case objects too: the entry's body (summary,\n repro steps, details, the \"description\" of a task) goes into `Notes` so\n it fills that editor. Do NOT create a separate `Description` richtext\n field beside it unless the user explicitly needs a short, list-visible\n column (see the alias rule below). A task whose \"Overview\" shows only\n the title with an empty body while the real content sits in a sidebar\n `Description` field is exactly the mistake this rule prevents.\n- Treat field names like `Description`, `Details`, `Content`, `Notes`,\n `Summary`, `Body`, `Bio`, `Background`, `Context`, `Instructions`,\n `Prompt`, `Markdown`, `Writeup`, and `Long Description` as aliases for\n the default `Notes` field unless the user explicitly needs that value\n as a short, filterable/list-visible column.\n- If the value is multi-sentence, markdown-formatted, contains headings,\n bullets, links, pasted prose, transcripts, generated copy, requirements,\n or \"lots of text\", put it in `Notes` even if the incoming source column\n is named `Description`, `Details`, or `Content`.\n- Write `Notes` content as a complete Markdown document. The first H1\n is rendered as the page title in the editor; flow body text, lists,\n links, and headings under it.\n- `Notes` is **not indexed by default** (richtext default), so do not\n rely on it for filters or sorts. If a value should be filterable or\n sortable, model it as a typed field (`text`, `enum`, `date`, etc.)\n alongside `Notes`.\n- When a user pastes a long block of text or asks you to \"save what we\n just discussed\" on an entry, write it to `Notes`.\n- **Bias hard against empty/thin `Notes` on material records you\n CREATE.** When you create a substantive entry (a lead, contact,\n company/account, opportunity, deal, case), its `Notes` should hold a\n real, useful dossier — who/what it is, the key facts with sources, and\n the next action — not a blank field or a single line. Before you report\n a record created, re-read its `Notes`: if a teammate couldn't brief\n themselves from it, enrich it first.\n- **On a record that already exists, research you were asked for goes\n into a NEW note on the timeline** (`dench crm notes create … --title\n \"Research — <date>\"`), not into the `Notes` document — see \"Notes on\n the timeline\" below. The document is the human's; the timeline is the\n dated record of everything else.\n- Use a structured field (its own column) **only when** the value is a\n short, repeating, structured datum that the user will filter, sort,\n group, or aggregate by. Otherwise keep it in `Notes`.\n\nCLI examples:\n\n```bash\n# Write free-form notes to a person's entry. `jq -Rs` encodes the file as\n# the JSON string required by `cells set`. Existing markdown is replaced.\ndench crm cells set people <id> Notes \\\n \"$(jq -Rs . /tmp/work/<runId>/ada-research.md)\"\n\n# Common pattern: read existing notes, append a dated section, write\n# back atomically.\nprev=$(dench crm query people --where '{\"id\":\"<id>\"}' --json \\\n | jq -r '.[0].fields.Notes // \"\"')\nnext=$(printf '%s\\n\\n## %s\\n%s\\n' \\\n \"$prev\" \"$(date +%Y-%m-%d)\" \"$new_text\" | jq -Rs .)\ndench crm cells set people <id> Notes \"$next\"\n```\n\nDo not create a workspace file at `crm/<object>/<id>.md` for entry\nnotes — that path was a legacy accident and is now rejected by the\nfile-write API. The notes editor and the CLI both round-trip through\nthe entry's `Notes` field.\n\n### The account dossier (a generated section inside `Notes`)\n\nWhen Dench creates an account on its own (a prospect detected from email,\na calendar invitee's company, a Slack Connect channel, a LinkedIn\nconversation) it researches the company — a handful of web searches, one\nmodel pass, relative to what THIS workspace sells — and appends the\nresult to the company's `Notes` as a delimited section:\n\n```\n<!-- dench:dossier v1 2026-09-24 -->\n## Account dossier\n**Overview** — … **What they do** … **Stage** … **Recent signals** …\n**Why they might care** … **Pitch angles** … **Key people** …\n**Open questions** … **Sources**\n<!-- /dench:dossier -->\n\n<!-- dench:dossier-update 2026-10-12 -->\n### Update — 12 Oct 2026\n- Raised a $14M Series A (source) …\n<!-- /dench:dossier-update -->\n```\n\nRules:\n\n- **It is append-only.** Dench never rewrites text already in the\n document — a human may have edited any line. A later refresh appends a\n dated `dossier-update` block only when something material changed (a\n new signal, a stage fact, a new key person); rewording never writes.\n- **Read it before your own research; add findings BELOW it; never\n duplicate or edit it.** The markers are how Dench (and the Brief) tell\n its research from yours — leave them in place. If a member deletes the\n section, Dench does not put it back until someone regenerates.\n- The Brief treats the dossier as machine research: below human notes and\n meetings, above digests and field values.\n- Only accounts with a Website/Domain get one (a bare name would research\n the wrong company). Capped at 50 per workspace per day; the workspace's\n Sync → \"Research dossier\" switch turns it off.\n\n```bash\ndench crm entries dossier <entryId> --json # status, generatedAt, updatesAppended, error\ndench crm entries dossier <entryId> --regenerate # research again → a fresh full section appended\n```\n\nAPI: `GET /crm/entries/{entryId}/dossier`, `POST /crm/entries/{entryId}/dossier/regenerate`.\n\n### Accounts detected from email (why a company is — or isn't — in the CRM)\n\nWhen someone emails the workspace from a domain the CRM does not know,\nDench does not create a record on the first message. It waits ten minutes\nfor the burst to settle, then classifies the conversation against\n`ORGANISATION.md` (Jev, the evaluation model) and creates an **account +\ncontacts only for potential customers and existing customers**\n(`Type: Prospect` / `Type: Customer` when the column exists). Vendors,\nrecruiters, investors, partners, personal mail and automation get a\n`skipped` verdict and never become records — and that verdict also stops\nthe older promotion rules from creating them later. A prospect writing\nfrom gmail.com becomes a **contact with no account**. The verdict row is\nthe audit trail; `Source` stays `Gmail`.\n\nVerdicts: `created`, `skipped` (with the counterparty type), `pending` (a\nrun in flight), `no_org_context` (the workspace had no `ORGANISATION.md`\nyet — asked again when it is written), `failed` (model or budget error;\nasked again on the next email), `rolled_back` (undone by an admin; never\nre-created). A `skipped` domain is re-asked once when new mail arrives\nafter 30 days, so a vendor that turns into a prospect is not lost.\n\n```bash\ndench crm detections list [--verdict created|skipped|no_org_context|failed|pending|rolled_back] [--kind detections|linkedin|all] [--since 30d] [--limit N] [--json]\ndench crm detections undo --since 2026-09-24 --dry-run # what would be removed, every kind\ndench crm detections undo --since 2026-09-24 # admin: delete machine-only rows, mark rolled_back\ndench crm detections undo --since 2026-09-24 --kind linkedin --dry-run # only what the LinkedIn resolver created\ndench crm detections undo --since 2026-09-24 --kind email-tasks # only the auto-created tasks / cases\n```\n\nThe LinkedIn resolver files its rows on the same table (`evidenceKind:\nlinkedin`, key = the account's domain or `li:<slug>`), so `list --kind\nlinkedin` shows what LinkedIn created and tagged; `--kind detections` is\nthe email detector plus the retro sweep; `all` (default) is both.\n\n`undo` is the **one rollback for everything the ingestion jobs created**\nsince `--since`, in three kinds (`--kind`, default `all`):\n\n- `detections` — the accounts and contacts the email detector and the\n sweep created;\n- `linkedin` — the contacts and accounts the LinkedIn resolver created;\n their conversations are unlinked and parked so the next message does not\n recreate them (a human can still link one by hand);\n- `email-tasks` — the tasks and cases \"Tasks from email\" created; the\n decision row becomes `rolled_back`, so the same thread never yields that\n task again.\n\nIt removes only rows **that no human has touched** (no member/agent write\nin their history, no comment, no subtasks) — a task someone completed or renamed stays,\na contact someone edited stays with its `created` verdict. It never\ntouches records created by hand, by import, or by the calendar path.\nVerdicts whose rows all went are marked `rolled_back`, and the removed\nrecords' identities are tombstoned like any human delete — the next email\nor message from those addresses creates nothing; only a human creating the\nrecord again (or linking the conversation from the Inbox) brings them back.\nBounded per call; the output (and `remaining`, overall and per kind) says\nwhen to run it again. The Sync → \"Accounts from email\" / \"Contacts from\nLinkedIn\" / \"Tasks from email\" switches turn the creators off for the\nworkspace.\n\nAPI: `GET /crm/detections` (`kind`), `POST /crm/detections/undo`\n(`since`, `kind`, `dryRun`, `limit` → totals plus per-kind\n`kinds.{detections,linkedin,emailTasks}.{scanned,deleted,kept,rolledBack,remaining}`).\n\n## Records Dench creates on its own (email, calendar, Slack Connect, LinkedIn)\n\nDench files people and companies from the workspace's own channels without\nbeing asked. Before you create a person or company by hand, **search\nfirst** — the resolver has very likely filed them already, and a hand-made\ntwin is exactly what it exists to prevent.\n\n| Source | What appears | Gate |\n| --- | --- | --- |\n| Email (Gmail / Outlook) | account (`Type: Prospect` / `Customer`) + contacts for potential and existing customers; a prospect on gmail.com is a contact with no account | classified against `ORGANISATION.md`; vendors / recruiters / investors / partners / automation never become records (see \"Accounts detected from email\") |\n| Calendar | external invitees of **upcoming** meetings → contact + company | none |\n| Slack Connect | a shared channel binds to the company on the other side; its messages land on the account's Activity as `slack_message`; external members become contacts filed under that account | resolution-gated: Dench never creates a company whose name it cannot state (unresolved channels wait for a human pick in Marketplace → Integrations → Slack) |\n| LinkedIn | **every** 1:1 conversation → contact + account, `Source: LinkedIn`, paced at ≤ 80 profile views per connected account per day, newest chats first | none; the counterparty type (recruiter, vendor, …) is tagged for filtering — `dench crm detections list --kind linkedin` |\n| Lead conversion | a lead who books a meeting flips to `Status: Qualified` and the template's convert automation opens Account / Contact / Opportunity (history: \"Meeting booked: <title>\") | live calendar events only, forward-only, once per event series |\n\n**One resolver, never a duplicate.** Every one of these matches before it\ncreates: a contact by email → LinkedIn URL → name + company domain; an\naccount by domain → LinkedIn company URL → canonical name. A match only\nfills empty fields (`Email`, `LinkedIn URL`, `Job Title`, `Avatar URL`,\n`Company`) — a human-set `Name` or `Company` is never replaced. Leads are\nmatched but never turned into a second `people` row; role addresses\n(`info@`, `support@`, …) resolve the account and create no person.\n\n**Deleted means deleted.** Deleting a contact or company tombstones its\nidentities: the next email, LinkedIn message or Slack post from that person\ndoes **not** recreate them. To bring someone back, create the record again\n(or link the conversation from the Inbox) — the identity relinks on the\nnext touch.\n\n**Tasks from email.** After a live email lands on a thread that already\ntouches a record, Dench may create at most two tasks (a reply owed, a\npromised follow-up, material to send, agreed next steps) on the most direct\nrecord — opportunity, else lead, else the contact's company. Only\ncommitments **our side** owes become tasks: every commitment is checked\nagainst who is actually on the thread (a counterparty's name is theirs\nwhatever the model said; a member's name is ours; an unnamed \"us\" counts\nonly when we wrote last). A commitment **they** owe never lands on our\nboard — it becomes a deferred chase instead: nothing is created until two\nbusiness days after the date they gave (else four business days after our\nlast message), and then only if they have not written back, as ONE task\n\"Follow up with <First name> on <what they owe>\". At most one chase per\nthread at a time, and it holds one of the thread's two auto-task slots.\nThe assignee is the member the commitment names, else the mailbox owner\nwhen they are on the thread, else the record's Owner, else nobody. `Notes`\nread like a colleague wrote them — the thread subject and who was on it,\nthe digest summary, the latest message quoted without its signature, and\nan \"Open the conversation\" link — never a thread key or an account id; the\nledger thread key lives in the hidden `_Source Thread` text field on the\ntask (`dench crm query task --where '{\"_Source Thread\": \"<key>\"}'`). A support\nissue opens a **Case** when the workspace has a `case` object. They are\nwritten as `system:email-tasks`; when you propose tasks yourself, read the\nrecord's open tasks first so you do not duplicate one Dench already made.\n\n**Switches.** Everything above is per-workspace and admin-controlled:\n\n```bash\ndench settings sync --json # the eight switches\ndench settings sync set linkedinContacts off # detectAccounts | linkedinContacts | slackConnectAccounts |\n # calendarContacts | dossier | emailTasks | leadAutoQualify | intelligence\n```\n\nOff stops new work; nothing already created is removed. To remove what a\njob created, use `dench crm detections undo` (above) — it is the one\nrollback for the email detector, the sweep, the LinkedIn resolver and\ntasks-from-email, and it never touches rows a human has edited.\n\n## Workspace Members & `user` Fields\n\n`user`-typed cells (`Owner`, `Assignee`, `Account Manager`, etc.)\nstore one member `userId` or an array of member `userId`s. The UI resolves\nthose ids against the org roster and renders every assigned member. A name\nor email is accepted only as a best-effort compatibility input.\n\n**Preserve every assignee.** If source data says `Kumar + Mark`, “shared,”\n“joint owners,” or otherwise names multiple people, resolve every person and\nwrite a JSON array. Never silently choose the first person, invent a combined\nliteral user, or move the second person into an unrelated text field.\n\nTo assign a `user` field correctly, look up the roster first:\n\n```bash\n# Top-level alias (recommended in scripts):\ndench members list --json\n\n# Same data, scoped under the CRM namespace:\ndench crm members list --json\n```\n\nThe response shape (both surfaces):\n\n```json\n{\n \"members\": [\n { \"userId\": \"k57…\", \"name\": \"Ada Lovelace\", \"email\": \"ada@acme.com\",\n \"role\": \"ADMIN\", \"image\": \"https://…\", \"tagline\": \"Head of Ops\",\n \"timezone\": \"Europe/London\", \"presence\": \"online\",\n \"lastActiveAt\": 1715000000000, \"joinedAt\": 1715000000000 }\n ],\n \"organizationId\": \"…\",\n \"organizationSlug\": \"acme\",\n \"organizationName\": \"Acme\"\n}\n```\n\n### Member profiles: who is around, and what they are doing\n\nEvery member has a profile (the panel that opens when a name is clicked in\nthe app). Read it before assigning or scheduling for someone — it tells you\ntheir local time, whether they are online, and what they already have open.\n`<userId|email>` accepts either; `presence` is `online` (<3 min), `away`\n(<30 min), or `offline`. Only the web app heartbeats: your own CLI/API calls\nnever make a person look online.\n\n```bash\ndench members get <userId|email> --json # tagline, timezone, presence, openTaskCount\ndench members activity <userId|email> --json # their comments + record changes, newest first\ndench members tasks <userId|email> --json # open tasks assigned to them\ndench members presence --json # online / away / offline for everyone\ndench members me --tagline \"Ops @ Acme\" --timezone America/New_York # your own profile\n```\n\nActivity is what the person did themself — edits you (Dench) make on their\nbehalf are attributed to you in history and excluded here. Never claim a\nmember is \"not doing anything\" because their activity is empty; they may work\nin tools that do not write to the CRM.\n\nThen assign by `userId`:\n\n```bash\n# Single cell. The default `task` object's user field is `Assignee`,\n# NOT `Owner` — verify with `dench crm fields list task` first.\ndench crm cells set task <entryId> Assignee '\"<userId>\"'\n\n# Multiple assignees: pass a JSON array of member ids.\ndench crm cells set task <entryId> Assignee \\\n '[\"<kumarUserId>\",\"<markUserId>\"]'\n\n# Inside a create / create-many. The default `task` uses `Name` for the\n# task name and `Assignee` (NOT `Owner`) for the user field; `people`\n# uses `Name` + `Owner`. Some workspaces rename these (e.g. `task` →\n# `Title`), so always confirm with `dench crm fields list <object>`.\ndench crm entries create task \\\n --data '{\"Name\":\"Ship CRM\",\"Assignee\":\"<userId>\"}' --json\n# Response includes entryId plus url/href deep links — paste url for the user.\n\ndench crm entries create task \\\n --data '{\"Name\":\"Joint review\",\"Assignee\":[\"<kumarUserId>\",\"<markUserId>\"]}' --json\n\ndench crm entries create-many people \\\n --data '[{\"Name\":\"Jane\",\"Email\":\"jane@example.com\",\"Owner\":\"<userId>\"}]' --json\n# create-many returns results[].url / results[].href per created row. If it\n# reports linksUnavailable, the rows it could not link have no id in the\n# response: run `entries list <object> --json` for their `id`, then\n# `entries get <object> <id> --json` for the url. Never hand-build one.\n```\n\nAssigning members to a `user`-typed field (e.g. `Assignee`, `Owner`)\nsends each newly assigned member a `mention` notification (in-app bell +\nemail; same kind as an `@` mention, titled \"Assigned to you\"). Marking a\n`task` row's `Status` to a done value notifies every assignee\n(`task_completed`). Self-assignment is not notified.\n\nThe server best-effort-resolves a name or email passed to a `user`\nfield when it matches exactly one member of the org (case-insensitive),\nso positional values such as `'\"Ada Lovelace\"'` or `'\"ada@acme.com\"'`\nwill land on the right `userId` **when the match is unambiguous**. Arrays\nof names/emails are resolved member by member. Treat that resolver as a\nsafety net, not the primary path — always run\n`dench members list` first when you have any ambiguity (shared first\nnames, missing email, deactivated users), because on a non-match the\nvalue is stored as a plain string and the UI cannot link it to a real\nmember.\n\nIf the user-type field is on a CRM object that is going to be filtered\nor grouped by owner, the field should also be `--indexed` so the table\nview's \"Owned by\" filter and the kanban-by-owner board pick it up.\n\n### Personal scope: \"assigned to me\" (not a view filter)\n\nEvery object view in the app has an avatar pill next to Filter / Sort:\n**Show only assigned to me**. It narrows the table, kanban columns, the\nhero count, column sums and the analytics strip to rows whose people\nfield includes the viewer — and it is **personal**: remembered per\nmember + workspace + object in the browser, never written into the saved\nview. A view filter would change the view for every teammate; this only\nchanges what *you* see. The dropdown on the pill also offers any other\nmember, **Unassigned** (the field is empty) and **Everyone** (off).\n\nThe CLI and API take the same scope on every read that lists rows:\n\n```bash\ndench crm views entries task \"Board\" --mine --with-meta --json # my rows in that view\ndench crm entries list deal --assigned-to priya@acme.com --json # a teammate's\ndench crm query lead --where '{\"Status\":\"New\"}' --mine --json # AND-ed onto --where\ndench crm entries list deal --assigned-to unassigned --json # nobody's\ndench crm analytics compute deal --mine --json # my numbers\n```\n\n- `--assigned-to me|unassigned|<userId|email>` (`--mine` = `--assigned-to me`).\n API: `?assignedTo=` on `GET /crm/objects/{object}/entries` and\n `/views/{view}/entries`, body `assignedTo` on `POST /crm/query` and\n `/analytics/compute`.\n- `--assignee-field <Field>` picks which `user` field counts when an\n object has several (`Owner` vs `Reviewer`). Default order: the\n analytics `owner` role → the task default `Assignee` → a user field\n named like *assignee / owner / rep* → the first user field. The\n response echoes what was used as `assigneeScope: { field, target }`.\n- `me` needs a member behind the call: a browser session, a per-member\n API key, or a `dench signin` agent session (it resolves to the human\n who signed in). An org-wide API key must pass a userId / email instead.\n- An object with no `user` field cannot be scoped; the pill is hidden\n there and the CLI / API say so.\n- Deep link: `/{slug}?path=task&assignee=me` (or `unassigned`, a userId;\n add `&assigneeField=`) switches the scope on for that visit and\n remembers it. `dench crm analytics compute --mine` prints one.\n- Counts and sums stay exact under the scope at any table size; the one\n bound is **Unassigned** on very large objects, where the result may be\n flagged `truncated` (there is no index for \"field is empty\").\n\n## Field Types\n\nSupported field types, verbatim:\n\n`text`, `email`, `phone`, `url`, `number`, `boolean`, `date`, `richtext`,\n`file`, `user`, `enum`, `relation`, `tags`, `action`.\n\nExamples:\n\n```bash\ndench crm fields create people \"Name\" --type text --required\ndench crm fields create people \"Email\" --type email --indexed\ndench crm fields create people \"Phone\" --type phone\ndench crm fields create company \"Website\" --type url\ndench crm fields create deal \"Amount\" --type number\ndench crm fields create task \"Done\" --type boolean\ndench crm fields create deal \"Close Date\" --type date\ndench crm fields create deal \"Attachment\" --type file\ndench crm fields create task \"Owner\" --type user\ndench crm fields create lead \"Status\" --type enum \\\n --enum-values '[\"New\",\"Working\",\"Qualified\",\"Lost\"]' \\\n --enum-colors '[\"#94a3b8\",\"#3b82f6\",\"#22c55e\",\"#ef4444\"]'\ndench crm fields create people \"Company\" --type relation --related-object company --relationship many_to_one --indexed\ndench crm fields create company \"Tags\" --type tags\ndench crm fields create lead \"Run Outreach\" --type action\n```\n\n**The field name is POSITIONAL — there is no `--name` flag on\n`fields create`.** The exact shape is\n`dench crm fields create <object> \"<Field Name>\" --type <type> [...]`:\n\n```bash\n# ✅ Correct — name is the second positional argument.\ndench crm fields create lead \"Fit Score\" --type number\n\n# ❌ Wrong — `--name` is not a flag here; this is rejected.\ndench crm fields create lead --name \"Fit Score\" --type number\n```\n\nThe command also **rejects any field name that starts with `--`** (a\nmissing/shifted positional would otherwise swallow the next flag as the\nfield's name and create a column literally called `--type`). If you see\nthat rejection, your arguments are off by one — fix the invocation, do\nnot quote-escape the dashes.\n\nUse `--enum-multiple` only when an enum is genuinely multi-select. Use\n`--no-indexed` only when a field should not participate in filters/search.\n\nFields can be edited, reordered, and enrichment-bound (auto-filled from a data\nprovider) after creation — see \"Editing Fields & Enum Options\" and\n\"Enrichment\" below.\n\nDo **not** create your own text/richtext columns called `Notes`,\n`Description`, `Details`, `Content`, `Summary`, `Body`, `About`, or\nsimilar for long-form entry prose. Every object already has a protected\n`Notes` (richtext) field — write descriptions, details, markdown, and\nlarge text blobs there. See the \"Reserved `Notes` Field\" section above.\n\n## Campaign Activity Columns (read-only)\n\nAdd a yes/no column showing whether a person opened an email, clicked an email\nlink, replied, or connected on LinkedIn through a multichannel campaign:\n\n```bash\n# One campaign: use its multichannel campaign ID, not its CRM entry ID.\ndench crm fields create people \"Email opened\" --calculation email_opened --campaign CAMPAIGN_ID\n\n# Any campaign the viewer can access:\ndench crm fields create people \"Replied to a campaign\" --calculation replied\n\n# Change an existing calculation's metric/source:\ndench crm fields update people \"Email opened\" --calculation email_clicked --campaign CAMPAIGN_ID\n\n# Remove the calculation explicitly; this becomes an editable boolean.\ndench crm fields update people \"Email opened\" --clear-calculation\n```\n\nMetrics: `email_opened`, `email_clicked`, `replied`, `linkedin_connected`.\nAvailable on the canonical `people` and `lead` objects only; a Lead reads its\nperson's campaign activity through `Contact`.\nThese are guided campaign signals, not formulas or expression strings. The type\ndefaults to `boolean`; an explicit type must also be `boolean`. A calculation\ncannot be required, indexed, enriched, or have a default value. A selected\ncampaign must exist in the current workspace and be readable by the viewer.\nOmitting `--campaign` means any accessible multichannel campaign, not legacy\nemail/LinkedIn sequences or newsletters.\n\n`fields list --json` returns the `calculation` metadata. Field create/update API\nbodies use `calculation: {\"kind\":\"campaign_activity\",\"metric\":\"email_opened\",\n\"campaignId\":\"CAMPAIGN_ID\"}` (`campaignId` is optional). Update uses\n`clearCalculation: true` to detach it; do not send that alongside `calculation`.\nExisting stored fields cannot be converted in place: create a new calculation\ncolumn. Clearing does not snapshot calculated results into stored values.\n\nEntry/cell writes, imports, batches, and transactions must omit calculated\ncolumns. Even `--allow-unknown` cannot overwrite or clear their values. Normal\ncolumns remain editable. Remove calculation columns from an export before\nimporting it as writable data.\n\n## Writes Validate Field Names (no more silent drops)\n\nEntry writes are checked against the object's real field schema. A field\nname that doesn't exist on the object is **rejected** with a `did you\nmean …?` hint plus the full valid-field list — it is no longer silently\nspread into the row's JSON and dropped from every view. On `create`, the\nobject's `required` fields must also be present. This applies to\n`entries create`, `entries create-many`, `entries update`, `cells set`,\n`cells set-many`, `crm batch`, and `crm transaction commit`.\n\nTwo consequences:\n\n- **Verify field names before writing.** Run\n `dench crm fields list <object> --json` first. Field names vary per\n workspace — a customized `task` object may use `Title` (not `Name`).\n Writes resolve common aliases server-side (CLI, API and MCP alike): any\n case or separator (`due_date` → `Due Date`), `name` / `title` /\n `subject` → the object's title field, and `owner` / `assignee` /\n `assigned to` → its assignee field (a task's `Assignee`). A task row's\n read keys (`title`, `status`, `priority`, `dueDateKey`, `assignee`)\n write back as they are. Two keys for one field, and anything else\n unknown, are still rejected.\n- **Escape hatch:** pass `--allow-unknown` (CLI) / `allowUnknown: true`\n (API) to write the raw data without the schema check — for loose\n imports that intentionally carry extra columns. Use sparingly; the\n default strictness is what catches typos before they create blank rows.\n\n```bash\n# Accepted — `title` and `Owner` resolve to the task's Name and Assignee:\ndench crm entries create task --data '{\"title\":\"Ship X\",\"Owner\":\"<id>\"}'\n\n# Rejected — a name that is no field and no alias:\ndench crm entries create task --data '{\"Name\":\"Ship X\",\"Budget\":5}'\n# → Unknown field for object \"task\": \"Budget\".\n# Valid fields: Name, Status, Priority, Assignee, Due Date, Notes.\n\n# Best — names verified against `fields list`:\ndench crm entries create task --data '{\"Name\":\"Ship X\",\"Assignee\":\"<id>\"}'\n```\n\n## The Brief (read this FIRST when asked about a record)\n\nEvery record with any history carries a generated **Brief**: what it means\nright now — relationship status, who owes the next move, open threads,\ncommitments, risks, key contacts, the suggested next step — rebuilt from the\ntimeline below it. Ingestion prepares the context and Brief in the cloud,\nincluding records nobody has opened. Opening a prepared record reads the saved\nresult; it does not fetch providers or wait for a model. It is read-only: humans correct it by writing the truth\nin Notes or a comment, which the generator treats as authoritative.\n\n```bash\ndench crm brief company <entryId> --json # headline, body, facets, stale?\ndench crm brief company <entryId> --with-context --json # stored evidence, one operation; no model call\ndench crm brief company <entryId> --regenerate # rebuild now from the current timeline\ndench crm context company <entryId> --json # inspect accessible sources, last Brief inputs and sync queue\ndench crm context company <entryId> --cursor '<nextCursor>' --json\n```\n\n- `facets.health` ∈ healthy | watch | at_risk | dormant;\n `facets.awaitingReplyFrom` ∈ us | them | none; `facets.openCommitments`.\n- `stale: true` means newer activity exists than the Brief has seen; say so\n when you quote it, or `--regenerate` first if the question is about now.\n- `crm context` is read-only. It returns source IDs/links, direct or related\n record association reasons, and `usedByLastBrief` for permitted sources.\n Its `manifest.activityIds` covers only that source page, not the whole\n generation. An ID match records past inclusion; it does not prove that\n the current source content is unchanged. `generation` reports queued,\n running, stored, failed, disabled, or empty. Stored means a previous\n Brief was generated; the Brief card checks current freshness. `mailboxes` describes only\n your own connections (up to ten), not coworkers' private accounts.\n Follow `nextCursor` through empty pages. `coverage: \"bounded_snapshot\"`\n never certifies complete history, and `scopeLimited` means related-record\n expansion reached its cap.\n- `status: \"generating\"` with no body means cloud preparation has not finished\n (for example, initial backfill or a generation-budget retry). CLI/API evidence\n reads do not wait for inference. The web Brief card starts or joins a direct\n streamed generation on a miss, with a timeout and Retry action; it bypasses\n background debounce, scheduler delays and the bulk daily budget.\n An existing permitted Brief stays visible during refresh. Revoked or edited\n source evidence is withheld until its replacement is prepared.\n- `--with-context` returns stored facts, Notes, comments and conversation evidence.\n Missing/invalid packets are assembled directly and saved without waiting for\n a scheduler, digest, Brief inference or provider fetch. The response includes\n `assembledAt`, `stale` and source coverage. Email, LinkedIn, Slack and\n meetings each get representation when present; the packet is bounded, not a\n complete transcript export. `truncated` means more history exists or a read\n budget was reached. Date-only packet refreshes do not spend a model call.\n `relatedRecords` carries attributed facts, Notes and comments from explicit\n business relations, including linked contacts, opportunities, tasks and custom\n objects. Companies also include one further relation hop through those records.\n A person does not inherit an employer's entire history, and an opportunity\n does not inherit sibling opportunities. Relations are checked against current\n records and access rules; unlinking or making a source private retracts it.\n Scheduled events carry their start/end dates, cancellation and RSVP state;\n a past calendar slot alone does not establish attendance. Recorded meetings\n include their Overview (or legacy Summary), outcomes and next actions.\n Compact CLI and chat packets retain representative sources and related record\n types within their byte limits. `evidenceOmissions`, when present, describes\n what that response omitted; fetch the referenced source for more detail.\n- In web chat, an attached record's saved evidence arrives before the first\n model call, within the existing workspace-context read. Use it directly when\n relevant; do not refetch providers or rediscover that record just to summarize\n it. Clearing the context chip clears the next request's automatic attachment.\n- **Never write the Brief.** If it is wrong, put the correct fact in a note\n or comment and regenerate.\n- Background Briefs use workspace-visible sources. The web card and on-demand\n `crm brief` use a private Brief for the signed-in member, including meetings\n and communications that member can access. It is labelled **Only you**;\n another member receives their own Brief. Organization-scoped credentials use\n the workspace Brief. Source sharing settings are unchanged.\n `audience: \"viewer\"` identifies a private response; the legacy `shared` key\n contains the selected Brief and does not override that audience. Never copy\n a viewer response into workspace-shared context. Source or access changes\n invalidate both stored evidence and generated prose before they are served.\n- A member's `entries get --with-context` and attached-record chat context\n include that member's accessible evidence without writing it to shared\n caches. The packet has `audience: \"viewer\"`. Organization-scoped reads\n remain workspace-only. These evidence reads do not run a model.\n\n## The Activity Ledger (read this before the live tools)\n\nEvery record has one timeline — the **Activity** tab in the app and\n`dench crm activity` on the CLI. It holds, in one ordering: the pinned\n`Notes` document, titled **notes**, **comments**, **field changes**, and\nevery external touch the workspace has ingested — **emails** (Gmail /\nOutlook), **calendar events**, **recorded meetings**, **Slack** and\n**LinkedIn** messages. It is the cheapest, most complete answer to\n\"what is going on with Acme?\", \"when did we last talk to Diana?\", \"did\nthey reply?\", \"what did we promise?\".\n\n```bash\n# Newest first. Ends with the record's Notes document.\ndench crm activity company <entryId> --json\n\n# Only emails and meetings from the last two weeks.\ndench crm activity people <entryId> --kind email,meetings --since 2w --json\n\n# Page: continue from the timestamp the previous page ended on.\ndench crm activity company <entryId> --limit 50 --json # → nextBoundary\ndench crm activity company <entryId> --limit 50 --before <nextBoundary> --json\n\n# One bounded read for a summary: fields, existing Brief, newest activity, notes.\ndench crm entries get company <entryId> --with-context --compact --json\n```\n\nRules for agents:\n\n- **Use the attached saved packet first.** Otherwise, `brief --with-context --json`\n reads or assembles the packet in one backend operation without inference. For more detailed ledger evidence,\n `entries get --with-context\n --compact` includes the existing Brief, recent activity and notes in one client request. The API supports `?withContext=true` on entry reads.\n Answer from it when supported. Read a specific activity page/source when needed\n evidence is missing or clipped; use live tools only for a relevant unsynced gap.\n Do not automatically chain brief, activity, sync diagnostics and live search.\n- **Comments and notes are context by default.** They are on the same\n timeline as emails; do not treat only the `Notes` document as \"the\n notes\" — the dated entries below it are where most of the story lives.\n- **You only see what you may see — and that is most things.** Everything\n a member connects (emails with bodies and recipients, calendar events,\n LinkedIn messages) syncs to the workspace by default. Privacy is an\n opt-out, per owner: the whole connection (\"Private\" on its card) or one\n record (below). Rows marked `visibility: owner_only` belong to their\n owner and never appear for anyone else. An empty email history is not\n proof nothing happened — say \"nothing shared with the workspace\".\n- **Hiding your own emails with one record** (`dench crm privacy hide\n <object> <entryId>`; `show` undoes it; `status` reads it) keeps YOUR\n connections' threads that involve the record to yourself, for other\n members. An account covers every contact and opportunity linked to it\n through `Company` / `Account` (a contact then reads `Hidden with\n <Account>` and is shown again from the account). Colleagues' threads\n about the same record are untouched. Existing rows are restamped, new\n ones land hidden at ingest, and the Inbox tab agrees with the ledger.\n Only a member who owns a connection has anything to hide; API keys and\n agents cannot toggle it.\n- Every row carries `at`, a `type` (`comment` | `change` | `activity`),\n and for external touches a `kind` (`email_in`, `email_out`,\n `calendar_event`, `calendar_notice`, `meeting`, `slack_message`,\n `linkedin_in`, `linkedin_out`, `linkedin_connection` — a connection\n request sent / received / accepted), `title`, `snippet`,\n `participants[]`, `direction` and\n a `sourceEntryId` you can open with `dench crm entries get\n <sourceObjectName> <sourceEntryId>` for the full body.\n- The list is ordered by time, newest first for you (`--order asc` gives\n the human's reading order). Cite rows by `at` + `kind` when you answer.\n\n## Notes on the timeline (titled entries — research goes HERE)\n\nA **note** is a comment with `kind: \"note\"` and a `title`: a titled,\ndocument-style entry on the record's timeline. Humans add them from the\n\"+ Note\" button; you add them with `dench crm notes create`.\n\n```bash\ndench crm notes list company <entryId> --json\ndench crm notes create company <entryId> \\\n --title \"Research — $(date +%Y-%m-%d)\" --body-file /tmp/work/<runId>/acme.md\ndench crm notes update <noteId> --body-file … [--title \"…\"]\n```\n\nRules for agents:\n\n- **Research, dossiers, call prep, summaries you were asked to produce →\n a NEW note.** Do not rewrite the record's `Notes` document to hold them;\n the document is the human's. A dated note keeps the history readable\n and never overwrites what a person wrote.\n- Edit the `Notes` document only when the user asks you to change *that\n document* (\"update the notes\", \"fix the description\").\n- Notes take no replies (comment on the record instead) and appear both\n in the timeline and in the Details \"Notes\" list.\n\n## Entry History / Audit Trail\n\nEvery entry has an append-only audit trail. Use it whenever the user asks\n\"what changed\", \"who changed this\", \"when did this field change\", \"was this\ndone manually or by an agent/automation\", or when you need to understand prior\nedits before making another change.\n\n```bash\n# Newest-first audit trail for one entry.\ndench crm history <object> <entryId> --json\n\n# Include sync/import/system writes that are hidden by default in the UI.\ndench crm history <object> <entryId> --include-system --json\n```\n\nHistory rows include:\n\n- `changeKind`: `create`, `update`, or `delete`.\n- `at`: when the change happened.\n- `actor`: source + identity (`user`, CLI agent session, Dench chat-turn\n harness, automation, gateway enrichment, or system sync/import).\n- `changes`: per-field `before` / `after` values.\n\nDo **not** scrape the visible Activity feed in the browser to answer audit\nquestions. Use `dench crm history ... --json` (or the API endpoint documented\nin `references/API.md`) so you get the complete structured row data and cursor\npagination. If the user specifically asks about system/sync/import behavior,\nadd `--include-system`; otherwise leave it off to match the default UI.\n\n## Comments (the record's conversation)\n\nEvery entry also has a threaded comment feed, shown under Notes in the app\nmerged with the change history. Read it before acting on a record someone\nhas discussed; write to it to leave findings, questions, or a summary for the\nteam — everyone with access to the record sees comments and followers are\nnotified. Bodies are markdown (same renderer as Notes).\n\n```bash\n# Roots newest first, each with its first replies; --replies 0 for roots only.\ndench crm comments list <object> <entryId> --json\ndench crm comments replies <commentId> --json # a whole thread, oldest first\n\n# Comment; mention a member inline so they get notified.\ndench crm comments create <object> <entryId> \\\n --body \"Kickoff went well — [@Bob](/?member=<userId>) can you send the proposal?\"\n\n# Reply in a thread (any depth).\ndench crm comments create <object> <entryId> --reply-to <commentId> --body \"Sent.\"\n\n# Summon Dench into the thread (fire-and-forget; the reply lands as a comment).\ndench crm comments create <object> <entryId> --dench --body \"what's the ARR here?\"\n\ndench crm comments update <commentId> --body \"…\"\ndench crm comments delete <commentId>\ndench crm comments react <commentId> 👍 # toggles your reaction\ndench crm watch <object> <entryId> [--off] # follow / unfollow activity\n```\n\nRules:\n\n- Mentions are markdown links: `[@Name](/?member=<userId>)` (ids from\n `dench members list`). `[@Dench](/?member=dench)` addresses the agent.\n Plain `@Bob` text notifies nobody.\n- When you were summoned from a comment, answer **in that thread**\n (`--reply-to <commentId>`), short, then do the work. Field changes you make\n already show in the same feed — summarize, don't narrate.\n- Commenting or being mentioned auto-follows the record; assignees and\n creators follow too. Followers get `entry_activity` notifications for\n comments and field changes by others (coalesced per actor per 10 min).\n- `[@Dench]` inside a comment authored by Dench never re-summons Dench.\n\n## Tasks\n\nTasks are entries on the protected `task` object, so everything above works\non them (`dench crm entries create task …`, `cells set task <id> Status\n'\"Done\"'`). These shortcuts wrap the same functions the app uses:\n\n```bash\ndench crm tasks mine --json # my open tasks (+ done today)\ndench crm tasks mine --priority high --json # only one priority level\ndench crm tasks list <object> <entryId> --json # tasks linked to a record\ndench crm tasks prepare # start/resume ordered task indexes\ndench crm tasks mine --page --limit 25 --json # cursor page (all open tasks reachable)\ndench crm tasks mine --page --done --json # completed tasks; separate cursor\ndench crm tasks list <object> <entryId> --page --json # record tasks, including parked tasks\ndench crm tasks subtasks <taskId> --page --json # all subtasks, with continuation\ndench members tasks <userId> --page --json # assigned tasks for a member\ndench crm tasks create <object> <entryId> --name \"Send proposal\" \\\n --assignee <userId> --due 2026-09-05 --priority high # creates + links + notifies\ndench crm tasks priority <taskEntryId> medium # or --none to clear\ndench crm tasks complete <taskEntryId>\ndench crm tasks reopen <taskEntryId>\n```\n\nTask list commands without `--page` return a bounded preview (at most 50 open\nand 50 completed rows). For complete traversal, `--page` returns\n`{ page, continueCursor, isDone, preparing }`: pass `--cursor <continueCursor>`\nuntil `isDone`, even after an empty page. Open and `--done` lists have separate\ncursors. `preparing` means ordering is still being built; `tasks prepare`\nstarts or resumes it (the UI does this automatically). API/SDK equivalents are\n`crm.tasks.pageAssigned`, `crm.tasks.pageForEntry`, and `crm.tasks.prepare`.\n\n**Priority.** The default `task` has a `Priority` enum (`Low` | `Medium` |\n`High`, no default). Set it whenever the user says urgent / important /\nASAP / low-key (\"high\" in any casing works; unknown values are rejected with\nthe valid options). Every task list sorts by priority first, so an unset\npriority means \"sorts last\", not \"medium\". Enum sorts follow option order\n(`--sort Priority:desc` = High → Medium → Low), not alphabetical.\n\n**Subtasks.** When the user breaks work down (\"split this into steps\",\n\"add subtasks for X\"), create subtasks — ordinary task rows whose\n`Parent Task` relation points at the parent (one level deep; the field is\ncreated on first use). Don't invent a separate object or a checklist in\nNotes.\n\n```bash\ndench crm tasks subtasks <taskId> --json # list\ndench crm tasks create-subtask <taskId> --name \"Write runbook\" \\\n [--assignee <userId>] [--due YYYY-MM-DD] [--priority low] # inherits the parent's record links\ndench crm tasks parent <taskId> <parentTaskId> # nest an existing task\ndench crm tasks parent <taskId> --none # promote to a top-level task\ndench crm tasks delete <taskId> [--keep-subtasks] # subtasks go with it unless kept\ndench crm query task --where '{\"Parent Task\": \"<parentTaskId>\"}' # the same rows via the generic query\n```\n\nA subtask inherits the parent's record relations (Account / Contact / …),\nnever its Assignee, Due Date, Priority or Notes. Completing every subtask\ndoes NOT complete the parent — mark the parent done explicitly when the user\nasks. \"Subtasks can't have subtasks\" and \"has subtasks of its own\" are the\ntwo errors you'll hit nesting too deep; flatten instead.\n\nDeleting a task processes all its subtasks in bounded batches before removing\nthe parent. If interrupted, earlier batches remain committed; retry the same\ncommand to finish. The returned `deleted`/`promoted` counts cover that invocation.\nDirect callers use the `crm.tasks.deleteTaskComplete` action; the CLI,\nHTTP API and App SDK keep the same command and arguments. The legacy\n`crm.tasks.deleteTask` mutation remains available for bounded atomic work;\nlarger requests fail with upgrade guidance and roll back that mutation.\n\n**Repeating tasks.** When a HUMAN must do something on a cadence (\"every\nMonday send the pipeline report\", \"check in with Ramp quarterly\", \"renew the\ncontract every year\"), make the task repeat. Do NOT build a `dench cron`\nautomation whose only action is creating a task — cron is for work Dench\nitself does on a schedule. The repeat is anchored on the task's due date —\nan undated task gets one automatically (the first day the rule matches from\ntoday; the response says `anchored: true` + `dueDateKey`). The next\noccurrence is a NEW task (the done one keeps its history), created when the\ncurrent one is completed (default) or `--on-schedule` regardless.\n\n```bash\ndench crm tasks repeat <taskId> # show (null = doesn't repeat)\ndench crm tasks repeat <taskId> weekly --on mon,wed [--every 2] # daily | weekdays | weekly | monthly | yearly\ndench crm tasks repeat <taskId> monthly --day last [--ends-after 6 | --until 2026-12-31]\ndench crm tasks repeat <taskId> monthly --nth 2 --on tue --on-schedule\ndench crm tasks repeat <taskId> --rrule \"FREQ=WEEKLY;INTERVAL=2;BYDAY=MO;COUNT=10\" # RFC 5545 subset\ndench crm tasks repeat <taskId> --skip | --pause | --resume | --off\ndench crm tasks create <object> <entryId> --name \"Send report\" --due 2026-09-17 --repeat weekly\ndench crm tasks series [--status active] # every series in the workspace\ndench crm tasks series <seriesId> --occurrences # every task in one series\ndench crm query task --where '{\"_Series\": \"<seriesId>\"}' # same rows via the generic query\n```\n\nRRULE supports FREQ, INTERVAL, BYDAY (with an ordinal for MONTHLY: `2TU`,\n`-1FR`), BYMONTHDAY (-1 = last day), BYMONTH, COUNT, UNTIL; anything else\nis rejected naming the token. A late completion never creates overdue\nwork — the next due date skips forward to today or later. Subtasks can't\nrepeat; put the repeat on the parent and its subtasks copy along.\n\nNotifications you (the run's owner) received are readable too:\n`dench notifications list --filter mentions --json`, `dench notifications read <id>`.\nAssignment is a `mention` (same as an `@`).\n\n## Editing Fields & Enum Options\n\nInspect and change existing fields without recreating them:\n\n```bash\n# List columns (verify names/types before writing).\ndench crm fields list lead --json\n\n# Update a field: description, required, indexed, rename, or replace options.\ndench crm fields update lead \"Status\" --description \"Pipeline stage\" --indexed\ndench crm fields update lead \"Status\" --enum-values '[\"New\",\"Working\",\"Won\",\"Lost\"]'\n\n# Reorder the columns shown in the table view.\ndench crm fields reorder lead Name Email Company Status\n\n# Delete a field (its cells are dropped).\ndench crm fields delete lead \"Legacy Score\"\n```\n\nManage individual options on an existing `enum` field. Prefer these granular\nverbs over resending the whole `--enum-values` array — they preserve colors,\nrow history, and kanban column order:\n\n```bash\n# Add an option (optional hex color + 0-based insert position). For a\n# board-backed Status/Stage field this also creates the matching kanban\n# column in one call — you do NOT need a separate `statuses set`.\ndench crm fields enum-add lead Status \"Nurturing\" --color \"#eab308\" --position 2\n\n# Recolor an option.\ndench crm fields enum-set-color lead Status \"Won\" \"#22c55e\"\n\n# Rename an option — also migrates every entry holding the old value\n# (complete for indexed enums, the default) and renames any matching kanban\n# status. Saved views whose filters pin the OLD label are NOT rewritten —\n# update those view filters after a rename or they silently go empty.\ndench crm fields enum-rename lead Status \"Working\" \"In Progress\"\n\n# Renaming onto an EXISTING option (matched case-insensitively) MERGES:\n# entries migrate onto the surviving option's canonical casing and the\n# duplicate is dropped. This is the canonical way to dedupe/merge two\n# options that mean the same thing.\ndench crm fields enum-rename lead Status \"In Review\" \"Pending\"\n\n# Remove an option. Every entry holding the value has it UNSET (complete for\n# indexed enums, the default) and the matching kanban column is removed —\n# a deleted option never lingers on rows. Rename/merge first if entries\n# should migrate to another option instead of losing the value.\ndench crm fields enum-remove lead Status \"Lost\"\n\n# Set the exact option order (must be a permutation of current values). This\n# is the canonical way to order kanban columns / picker options and keeps any\n# matching crmStatuses rows in sync.\ndench crm fields enum-reorder lead Status \"New\" \"In Progress\" \"Won\"\n```\n\n**Enum values on entry writes.** Cell writes (`entries create/update`,\n`cells set`, imports) canonicalize enum values case-insensitively against the\noption list — writing `\"won\"` stores `\"Won\"` when that option exists. A\ngenuinely NEW value auto-creates the option (auto-colored, see below) and, for\nboard-backed Status/Stage fields, its kanban column — so prefer an existing\noption when one fits: a typo becomes a real option, not an error.\n\n**Enum colors.** An option's color renders as the colored badge on that cell\nin table/list/gallery views. Any option created WITHOUT an explicit color is\nauto-colored server-side: semantic keyword match first (success words like\nDone/Won/Active → green, in-progress words like Working/Contacted → blue,\nrisk words like At Risk/Pending/On Hold → yellow, danger words like\nChurned/Lost/Failed → red, neutral words like Todo/Backlog/New → gray), else\na rotating palette by position so options stay visually distinct. So you can\nusually omit colors entirely. To control them yourself, pass an\n`--enum-colors` array aligned 1:1 with `--enum-values` at create time (see\nField Types above), or change them later with `enum-set-color` (or\n`enum-add --color`). Note that `fields update --enum-values` replaces the\noption list but keeps existing options' colors (matched by label); new\noptions get the auto-color; use `enum-set-color` for explicit changes.\n\nKanban columns are backed by a per-object `crmStatuses` record\n(`dench crm statuses list/set <object>`) that carries its own name + color and\nis the source of truth for board-backed `Status` / `Stage` fields. You almost\nnever edit it directly: the `enum-*` verbs are the single surface and keep the\ncolumns in sync automatically. `enum-add` creates the matching column (and\n`enum-remove` deletes it), `enum-set-color` recolors it, `enum-rename` renames\nit, and `enum-reorder` reorders it — so the table badge and kanban column stay\nin sync from one call. `statuses set` (which updates matching enum\nvalues/colors) is only needed for bulk column edits or to seed a board on a\nfield that has no columns yet.\n\n## Relation-First Modeling\n\nEvery time you create an object or add fields, ask whether another object\nshould be linked. Relation fields are the default foreign-link primitive. Do\nnot store foreign references as bare strings when the target object exists or\nclearly should exist.\n\nAuto-linking defaults:\n\n| If creating or editing | And this object exists | Create this relation field |\n| --- | --- | --- |\n| `people` or `contact` | `company` | `Company` on people -> company (`many_to_one`) |\n| `lead` | `company` | `Account` or `Company` on lead -> company (`many_to_one`) |\n| `deal` or `opportunity` | `people` | `Primary Contact` on deal -> people (`many_to_one`) |\n| `deal` or `opportunity` | `company` | `Account` or `Company` on deal -> company (`many_to_one`) |\n| `task` | `people` | `Assigned Contact` or `Owner` on task -> people/user |\n| `task` | `project` or `deal` | `Related To` on task -> parent (`many_to_one`) |\n| `case` | `people` and `company` | `Contact` and `Account` on case -> people/company (`many_to_one`) |\n| `invoice` or `payment` | `company` | `Company` on invoice/payment -> company (`many_to_one`) |\n| `invoice` or `payment` | `deal` | `Deal` on invoice/payment -> deal (`many_to_one`) |\n| `property` or `listing` | `people` | `Agent` on property -> people (`many_to_one`) |\n| any child concept | its parent concept | relation to parent (`many_to_one`) |\n\nAggressive defaults:\n\n- If the user says \"connect\", \"link\", \"reference\", \"relate\", \"belong to\",\n \"map to\", \"pick from\", or \"tied to\", create a `relation` field.\n- If a field name matches or aliases an existing object, use `relation`.\n- Never model `Company Name`, `Client Name`, `Project Name`, `Deal Name`, or\n `Owner Name` as text if a real target exists.\n- If a field refers to a workspace member, use `user`, not `text`.\n- If a target object does not exist but is central to the workflow, create it\n and link it instead of flattening the data.\n\n## Object Creation Flow\n\n1. Inspect existing objects:\n\n```bash\ndench crm objects list --json\n```\n\n2. Create the object. Always assign a Hugeicons name with `--icon`; pick\n a concrete icon that matches the object's purpose rather than leaving the UI\n to fall back to a generic table icon.\n\n```bash\ndench crm objects create lead --description \"Sales leads\" --default-view kanban --icon target-01 --json\n```\n\n3. Create fields:\n\n```bash\ndench crm fields create lead \"Name\" --type text --required\ndench crm fields create lead \"Email\" --type email --indexed\ndench crm fields create lead \"Company\" --type relation --related-object company --relationship many_to_one --indexed\ndench crm fields create lead \"Status\" --type enum --enum-values '[\"New\",\"Working\",\"Qualified\",\"Lost\"]'\n```\n\n4. Optional kanban statuses (named board columns, each with a color):\n\n```bash\ndench crm statuses list lead --json\ndench crm statuses set lead --statuses '[{\"name\":\"New\",\"color\":\"#94a3b8\"},{\"name\":\"Working\",\"color\":\"#3b82f6\"},{\"name\":\"Qualified\",\"color\":\"#22c55e\"},{\"name\":\"Lost\",\"color\":\"#ef4444\"}]' --json\n```\n\nObject names are usually singular lowercase (`lead`, `deal`, `task`). Protected\nobjects such as `people` and `company` are pre-seeded and cannot be deleted.\n\n`--default-view` accepts `table`, `kanban`, `calendar`, `timeline`, `gallery`,\nor `list`. Pick `kanban` for pipeline-shaped objects with a status enum,\n`table` for dense data, `gallery` for image-forward records.\n\nInspect, rename, and delete objects after creation:\n\n```bash\ndench crm objects get lead --json\ndench crm objects rename lead opportunity\ndench crm objects delete opportunity # protected objects are rejected\n```\n\n## Batch Entry Creation\n\nFor three or more writes, use a batch command. Do not issue dozens of\nsequential `dench crm entries create` calls.\n\nSmall batches (up to 50 rows):\n\n```bash\ndench crm entries create-many people --data '[{\"Name\":\"Jane\",\"Email\":\"jane@example.com\"},{\"Name\":\"Bob\",\"Email\":\"bob@example.com\"}]' --json\n```\n\nMedium batches (50 to 10k rows): write JSON to `/tmp/work/<runId>/`, then call\nthe CLI once.\n\n```bash\ndench crm entries create-many people --file /tmp/work/<runId>/people.json --json\n```\n\nLarge batches (more than 10k rows) or mixed operation types: emit JSONL ops and\nuse the low-level batch endpoint with an idempotency key.\n\n```bash\ndench crm batch --file /tmp/work/<runId>/ops.jsonl --idempotency-key import-people-2026-05-07 --json\n```\n\nEach JSONL line is an operation, for example:\n\n```json\n{\"type\":\"entries.create\",\"objectName\":\"people\",\"data\":{\"Name\":\"Jane\",\"Email\":\"jane@example.com\"}}\n```\n\n## Import & Export\n\n> **Before any bulk import, read\n> [`references/CRM-IMPORT.md`](https://dench.com/references/CRM-IMPORT.md).**\n> This section is only the command reference; the playbook covers staging\n> source files, schema mapping, dedupe keys, verification, and relations.\n\nIf the user provides CSV or JSONL data, import it into CRM. The file is an\ninput, not the final artifact.\n\nCSV cells are strings, so preprocess composite owner labels such as\n`Kumar + Mark` into JSON/JSONL arrays of roster userIds before importing.\nDo not let a flat CSV import collapse shared ownership to one person.\n\n```bash\n# CSV, with a header remap. --map direction is CSV column -> CRM field:\n# {\"<source CSV column>\": \"<CRM field name>\"}.\ndench crm import people --csv input.csv --map '{\"Email\":\"Email Address\"}' --json\n\n# JSONL (one object per line).\ndench crm import people --jsonl rows.jsonl --json\n\n# Conflict policy + dedupe key. --on-conflict is skip (default) | update |\n# error. --dedupe-key <CRM field> matches existing field values, including\n# records created manually or through another CLI command. Pick email for\n# people/leads, domain for companies, or a source-system row id.\ndench crm import people --csv input.csv \\\n --dedupe-key \"Email\" --on-conflict skip --json\ndench crm import people --csv input.csv \\\n --dedupe-key \"Email\" --on-conflict update --json # upsert\n```\n\n`--on-conflict` semantics, per matched row:\n\n- `skip` (default) — leave the existing entry untouched, count it in\n `skipped`.\n- `update` — merge the incoming row's fields onto the existing entry\n (upsert). Re-running the same import with the same `--dedupe-key` is\n therefore safe and idempotent.\n- `error` — abort loudly on the first conflict.\n\n`--dedupe-key` names the CRM field **after `--map`**. Matching trims and\nlowercases string values; it does not perform fuzzy matching or remove\npunctuation. Choose a scalar identifier field: `text`, `email`, `phone`,\n`url`, a single-select `enum`, or `number`. Incoming values must be\nnon-blank strings or finite numbers; arrays, objects, and booleans are\nrejected. Multiple records with the same normalized value cause an\nambiguity error instead of picking a row. Number fields compare numeric\nvalues, so a source string `\"01\"` matches stored number `1`.\n\nMatching reads the complete object (up to 200 fields), bounded to 1,000 records and 3 MB\nacross match lookups in one batch. If the lookup cannot finish within\nthose bounds, the batch fails without writing. Do not retry without the\ndedupe key: export and reconcile the records explicitly instead. Each\nbatch is atomic; earlier batches may already have committed when a later\nbatch fails. Retry keys are retained, and a retry key pointing at a\ndifferent row from the field match, or a row whose selected field has\nsince changed, is an error.\n\nWithout `--dedupe-key`, imports use a stable content-hash retry key. That\nprotects an exact reimport, but **does not match existing records by a\nCRM field** or merge a changed source row into its earlier version.\n\nThe import result reports\n`{imported, skipped, updated, errors, sourceRowsParsed}`; the four outcome\ncounts must add up to `sourceRowsParsed`.\n**Always compare those numbers to the source file's row count** — a\n`sourceRowsParsed` lower than the file's line count means the CSV has\nmultiline quoted cells the parser collapsed; stop and fix the source (see\nCRM-IMPORT.md step 1).\n\n`entries create-many` accepts the same `--dedupe-key <field>` and\n`--on-conflict skip|update|error` flags, with the same matching rules.\n`--on-conflict` requires `--dedupe-key` for this command. Its result keeps\n`results[].entryId` and reports `created`, `alreadyExisted`, and `updated`\ncounts when dedupe is enabled.\n\nExport an object when the user wants a file (a report, hand-off or backup), or\nsubstantial offline processing needs one. Ordinary complete lists use projected\ncursor pages (see \"Caps & bulk reads\" below):\n\n```bash\ndench crm export deal --format csv > deals.csv\ndench crm export deal --format jsonl > deals.jsonl\n```\n\n`export` pages through the object with real cursor pagination and\nguarantees the **unique-id invariant**: every exported entry id appears\nonce. Catalog counts (`entryCount` / `entries list --with-meta`'s\n`totalCount`) cover the whole object, including records you cannot read;\nthey are not a readable total. Before a destructive decision (dedup,\ndelete, migrate), verify unique ids and read completeness. A scoped export\ncan be truncated; do not proceed on its cap warning or infer missing rows\nfrom a larger catalog count.\n\nDo not write a new CSV to `/workspace` as the answer to \"put this list in the\nCRM\" — import it as rows instead.\n\n## Updating, Appending & Deleting Rows\n\nSingle-row writes:\n\n```bash\n# Update one row (>=1 field required; an empty --data is rejected).\ndench crm entries update people <entryId> --data '{\"Status\":\"Working\"}' --json\n\n# Delete one row, or many rows by id.\ndench crm entries delete people <entryId> --json\ndench crm entries bulk-delete people --ids id1,id2,id3 --json\n```\n\n`bulk-delete` automatically writes a JSONL **snapshot of every deleted\nrow** to a local file before deleting and reports the path as\n`snapshotPath` in its output. Keep that path in your report — it is the\nonly recovery artifact if the deletion turns out to be wrong. Bulk\ndeletes are capped at 200 ids per call; for dedup/merge jobs follow the\nconvergence rules in\n[`references/CRM-IMPORT.md`](https://dench.com/references/CRM-IMPORT.md)\nbefore deleting anything.\n\nUpdate many rows at once:\n\n```bash\ndench crm entries update-many people --updates '[{\"id\":\"entry_1\",\"data\":{\"Status\":\"Working\"}},{\"id\":\"entry_2\",\"data\":{\"Status\":\"Qualified\"}}]' --json\n```\n\nSet many individual cells:\n\n```bash\ndench crm cells set-many people --updates '[{\"entryId\":\"entry_1\",\"field\":\"Email\",\"value\":\"jane@example.com\"},{\"entryId\":\"entry_1\",\"field\":\"Phone\",\"value\":\"+15551234567\"}]' --json\n```\n\n`cells set-many` groups multiple cell edits for the same `entryId` into one\n`entries.update` operation.\n\nAppend to array-shaped cells (`tags`, multi-select `enum`, `relation`) without\nclobbering existing values — `cells set` overwrites, `cells append` adds:\n\n```bash\ndench crm cells append company <entryId> Tags '\"enterprise\"' --json\n```\n\n`entries create-many`, `entries update-many`, and `cells set-many` all accept\n`--file <path.json>` (instead of inline JSON) and `--idempotency-key <key>` so\na retried command never double-writes. The CLI auto-chunks large inputs into\n200-op batches under the hood.\n\n## Write a Script and Execute It\n\nFor transformations, do the looping locally in `/tmp/work/<runId>/` and call a\nbatch surface in chunks.\n\n```bash\ncat > /tmp/work/<runId>/normalize-people.mjs <<'EOF'\nimport { execFileSync } from \"node:child_process\";\nimport { writeFileSync } from \"node:fs\";\n\nconst raw = execFileSync(\"dench\", [\n \"crm\",\n \"query\",\n \"people\",\n \"--limit\",\n \"1000\",\n \"--json\",\n], { encoding: \"utf8\" });\n\nconst rows = JSON.parse(raw);\nconst updates = rows\n .filter((row) => row.fields?.Email)\n .map((row) => ({\n id: row.id,\n data: { Email: String(row.fields.Email).trim().toLowerCase() },\n }));\n\nwriteFileSync(\"/tmp/work/<runId>/people-updates.json\", JSON.stringify(updates));\nexecFileSync(\"dench\", [\n \"crm\",\n \"entries\",\n \"update-many\",\n \"people\",\n \"--file\",\n \"/tmp/work/<runId>/people-updates.json\",\n \"--json\",\n], { stdio: \"inherit\" });\nEOF\nnode /tmp/work/<runId>/normalize-people.mjs\n```\n\nFor mixed create/update/delete operations, emit `ops.jsonl` and run:\n\n```bash\ndench crm batch --file /tmp/work/<runId>/ops.jsonl --idempotency-key <key> --json\n```\n\n## Reading Rows & Cells\n\nReach for the lightweight read surfaces before building a full query:\n\n```bash\n# List rows (default 100). --with-meta includes readable pagination.\ndench crm entries list people --limit 200 --with-meta --json\n# Continue only with an actual returned cursor; keep the same filters.\ndench crm entries list people --limit 200 --with-meta --cursor '<continueCursor>' --json\n\n# Fetch one row by id (all cells + resolved relations).\ndench crm entries get people <entryId> --json\n\n# Read a single cell value.\ndench crm cells get people <entryId> Email --json\n```\n\n`entries list` is a flat read capped at 1000 rows. For filters, projections,\nor sorting use `query` (below); for grouped counts use `aggregate`.\n\n## Who can see a record\n\nEvery object has a `visibility` (`dench crm objects get <name> --json` reports\nit) that decides who can read its records. The same rule applies everywhere a\nrecord can appear — `entries list|get`, `query`, `search`, `aggregate`,\n`reports`, views, the picker and your own tools — so a record you cannot see\nin one place is not reachable from another.\n\n| `visibility` | Who reads a record |\n|---|---|\n| `workspace` (default) | Everyone in the workspace. |\n| `owner_only` | Only the member in the record's `Owner User ID`. |\n| `owner_plus_members` | The owner plus the members listed in `Access Members`. |\n\n- **CRM records are always shared with the workspace.** Companies, people,\n deals, leads, opportunities, cases and custom objects are `workspace`, and\n cannot be made private. Only things from someone's own account can be:\n `meeting` ships as `owner_plus_members` (the recorder plus everyone who was\n on the invite), `calendar_event` as `owner_only`, and `email_thread` has a\n per-thread sharing chip.\n- **One record can be opened without opening the object.** A `Shared With\n Workspace` checkbox on the entry makes that row read exactly like a\n `workspace` row — for every member, and for a caller with no signed-in\n person. On meetings it is `dench meetings share <id> --workspace`; the\n owner or a workspace admin sets it, nobody else.\n- Writes stay owner-only on a scoped object: a member on the invite can read a\n colleague's meeting, never edit or delete it (`Only the owner can edit this\n record.`). Creating a record on a scoped object requires a signed-in member.\n- An org-scoped API key or a run with no signed-in person (a shared Slack\n channel) reads `workspace` objects plus any individually shared record, and\n nothing else. If `entries list meeting` comes back empty for you, that is\n why — ask your user to run it or to share the call, do not retry.\n- **Activity is the other grain.** A record everyone can open still carries\n ledger rows (emails, LinkedIn messages, calendar events) that belong to the\n member whose connection produced them. Those are shared with the workspace\n by default; the owner opts out per connection (Outreach → the inbox row's\n Workspace / Private menu) or per record (`dench crm privacy hide|show|status\n <object> <entryId>` — an account covers its contacts and opportunities).\n See \"The Activity Ledger\" above.\n- Only a signed-in workspace admin can change it, and only on `meeting`,\n `calendar_event` or `email_thread` (any other object is refused):\n\n```bash\ndench crm objects update meeting --visibility workspace --json # workspace|owner_only|owner_plus_members\n```\n\nRecords created before a switch to `owner_only`/`owner_plus_members` have no\nowner and are hidden from everyone until one is set; switching back to\n`workspace` shows them again. Say so before running it on an object with rows.\n\n### Meetings are ordinary records\n\n`meeting` rows can be created, updated and deleted like any other entry\n(`dench crm entries create meeting --data '{\"Title\":\"…\",\"Started At\":\"…\"}'`),\nwhether Dench recorded the call or not. Only the recording-specific parts —\ntranscript, action-item checklist, attendance roster — live in side tables,\nreached through `dench meetings …`:\n\n```bash\ndench meetings transcript set <meetingId> --text notes.txt # or --jsonl segments.jsonl\ndench meetings action-items set <meetingId> --items '- [x] Send deck (Hank)'\ndench meetings participants set <meetingId> --people 'Hank <hank@globex.com>; ada@acme.com'\ndench meetings import --jsonl calls.jsonl --dedupe-key \"Granola ID\" # many calls at once\n```\n\n**Meetings are private by default, and that is not a bug to work around.**\nThe `meeting` object is `owner_plus_members`: you see a call if you own it,\nif you were on the invite, or if it has been shared with the workspace. The\nsame rule gates the record, its transcript, its action items and its roster,\nso an empty `dench meetings list` usually means \"none of these are yours\",\nnot \"the query failed\".\n\n```bash\ndench meetings list --shared # calls the whole team can read\ndench meetings share <meetingId> # who can read this one today\ndench meetings share <meetingId> --workspace # open it to every member\n```\n\nOnly the meeting's owner or a workspace admin can share or unshare one, and\nan organization-scoped API key (the sandbox credential) can do neither — it\ncan READ anything shared with the workspace, and nothing personal. If you\nneed a colleague's call, ask them to share it rather than trying to widen\nthe object.\n\nBefore a bulk import of calls, read `CRM-IMPORT.md` §10 — same seed-key and\n`--on-conflict` rules as any import, plus the meeting-specific ones (run as a\nsigned-in member, attendees are linked never created, timing is not invented).\n\n## Caps & Bulk Reads (read this before \"get me all the rows\")\n\nEvery read surface has a hard server-side cap, and **a `--limit` above the\ncap is clamped, not honored**:\n\n| Surface | Cap | On over-limit |\n| --- | --- | --- |\n| `entries list` | **1000** | clamped — output includes a `limitClamped` warning |\n| `query` preview | **1000** | clamped — output includes a `limitClamped` warning |\n| `query --page` | **100 per page** | continue with `--cursor` through `isDone` |\n| `search` preview | **100** | clamped |\n| `search --select` | **100 per page** | continue with `--cursor` through `isDone` |\n| `export` | none | real cursor pagination through the whole object |\n\nRules:\n\n- **Never assume `--limit N` returned N rows** (or that fewer-than-N rows\n means you have everything). `entries list people --limit 5000` returns at\n most 1000 rows. Check for the `limitClamped` info in the response before\n reasoning about completeness.\n- **Ordinary lists use projected cursor reads:** `query --page --select` or\n `search --select`, repeating the same scope with `--cursor` until `isDone`.\n Empty pages can have continuation. Use aggregates for supported counts and\n grouped summaries. Export for requested files or substantial processing such\n as migrations and dedup jobs; scoped exports may still report a cap warning.\n- `entries list --with-meta` labels catalog `totalCountScope: \"object\"`\n separately from readable `returnedCount`. `visibility` is the object's\n effective policy. Follow `continueCursor` with `--cursor`, preserving\n assignment filters, even after an empty page. `hasMore: false` means the\n readable scan completed; `hasMore: null` with `truncated: true` means a\n capped scoped read has no continuation. Repeating it will not advance.\n Assigned metadata pages cap at 100 rows; unfiltered pages cap at 1000.\n- Legacy `search` previews are capped and never prove completeness. Projected\n search pages explicitly report coverage; use query pages for a whole object.\n\n```bash\n# ❌ Silent data loss: only the first 1000 rows come back.\ndench crm entries list people --limit 999999 --json\n\n# ✅ Ordinary list: project needed fields and follow continueCursor to isDone.\ndench crm query people --page --select Name,Email --limit 100 --json\n\n# ✅ Requested export or substantial processing: complete file, unique IDs.\ndench crm export people --format jsonl > /tmp/work/<runId>/people.jsonl\n```\n\n## Response Shapes (read the right key)\n\nWrite/read envelopes differ per verb. Parse these exact keys — guessing is\nhow \"null entryId\" retry loops create duplicate rows:\n\n| Command | Shape | Read this |\n| --- | --- | --- |\n| `entries list` / `query` | array of rows: `{id, entry_id, objectId, fields: {...}, createdAt, updatedAt}` | `row.id` (alias `row.entry_id`) for the id, `row.fields.<Field>` for cell values |\n| `entries create` | `{entryId, id, objectName, url, href, ...}` | `entryId` (aliased as `id`) |\n| `entries create-many` | `{created, chunks, results: [{entryId, url, href, ...}]}` | **`results[].entryId`** — there is NO top-level `entryId` |\n| `entries update` | `{entryId, ...}` | `entryId` |\n| `entries bulk-delete` | `{count, snapshotPath}` | `snapshotPath` is the recovery snapshot |\n| `import` | `{imported, skipped, errors, sourceRowsParsed, onConflict}` | compare all counts to the source file |\n\n**Retry discipline for `create`:** the response always carries `entryId`\n(and the `id` alias). If your parser got `null`, you almost certainly read\nthe wrong key while **the create itself SUCCEEDED** — do not blindly\nre-run the command. Re-query by name first\n(`dench crm query <object> --where '{\"Name\":\"...\"}' --json`) and only\nretry if the row genuinely does not exist. (This exact blind-retry loop\nonce created a stack of duplicate tasks.) For retryable scripts, pass\n`--idempotency-key <key>` on `entries create` — a retried create with the\nsame key returns the original row instead of writing a second one.\n\n## ID-First Writes (search is discovery-only)\n\nNever write to a row you found by fuzzy search. `crm search` is ranked\nfull-text matching — the top hit for \"Acme\" can be \"Acme Staffing LLC\"\nwhile the user meant \"Acme Corp\", and updating it corrupts a real record.\n\nThe discipline:\n\n1. **Discover** with `search` / `entries list` / `query`.\n2. **Capture the exact `entryId`** (`row.id`) from that read — after\n confirming the row's fields identify the right record (exact email,\n exact domain, exact name).\n3. **Write by `entryId`** — `entries update <object> <entryId>`,\n `cells set <object> <entryId> ...`.\n\nIf discovery is ambiguous (multiple plausible hits, partial name match),\nstop and ask the user or narrow with `query --where` on an exact key —\nnever pick the first search hit and write to it.\n\n## Queries and Search\n\nUse `dench crm query` for structured reads. `--where` is a JSON filter,\n`--select` projects columns, `--sort` takes comma-separated fields (`-` =\ndescending), and `--limit` caps rows:\n\n```bash\ndench crm query lead --where '{\"Status\":\"Qualified\"}' --select Name,Email,Score --sort '-Score' --limit 100 --json\n```\n\nOne-shot queries return an array of up to `--limit` rows (maximum 1,000).\nThey read bounded server pages; a requested sort considers every matching\ncandidate. For complete lists, use `--page` (maximum 100 rows per response) and pass\nthe returned `continueCursor` to the same query with `--cursor`. The JSON\nresponse is `{ page, isDone, continueCursor }`. Keep going until `isDone`,\neven if a filtered page is empty. Cursor scans use index order: omit `--sort`.\nUse `--select` to avoid transferring large Notes or rich-text fields.\n\nFor scoped searches, `dench crm search \"query\" --object people --select\n\"Name,Email\" --selection-mode compact --json` can recover an unknown selected\nname in the same request. It returns a bounded preview using real column names,\nplus `selectionFallback` with the requested and unresolved names, available\nschema, omitted column count, and any clipped values. `selectedFields` describes\nthe columns actually returned. It never guesses that `Title` means `Headline`\nor `Job Title`, or represents an unknown column as an empty cell. A clipped\nvalue is only a preview; read the exact record for its full value.\n\nHarness agents receive a bounded live field catalog before each model step,\nand their scoped `search --select` commands enable this recovery automatically.\nOrdinary CLI/API calls remain strict by default. Use `--selection-mode strict`\nto require exact projections inside an agent-run script as well. Explicit CLI\nselection mode requires both `--object` and `--select`; unscoped searches and\nlegacy full-row reads keep their existing behavior. The paged search API accepts\nthe equivalent `selectionMode: \"compact\" | \"strict\"`, requiring `objectName` and\n`select` when supplied.\n\n```bash\ndench crm query lead --page --select Name,Email --limit 100 --json\ndench crm query lead --page --select Name,Email --limit 100 --cursor '<continueCursor>' --json\n```\n\nAPI/Apps: `crm.queryPage` (`POST /v1/crm/query/page`) accepts `objectName`,\n`dsl` or `dslJson`, and `paginationOpts: { cursor: null, numItems: 100 }`.\n`dench.api.call(\"crm.queryPage\", args)` exposes the same cursor envelope.\nChanging the filter, selection, object, or viewer requires a fresh cursor.\n\n`--where` supports operators, not just bare equality. Available operators:\n`$eq`, `$ne`, `$in`, `$nin`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists`,\n`$startsWith`, `$endsWith`, `$contains`, plus the logical combinators `$and`\nand `$or`:\n\n```bash\n# Numeric range + set membership.\ndench crm query lead --where '{\"Score\":{\"$gte\":50},\"Status\":{\"$in\":[\"New\",\"Working\"]}}' --json\n\n# Array membership. Use this for `tags`, multi-select `enum` fields,\n# multi-user fields, and many-to-many relation ids.\ndench crm query task --where '{\"Tags\":{\"$contains\":\"bug\"}}' --json\ndench crm query task --where '{\"Assignee\":{\"$contains\":\"<userId>\"}}' --json\n\n# OR across clauses.\ndench crm query deal --where '{\"$or\":[{\"Stage\":\"Won\"},{\"Amount\":{\"$gt\":100000}}]}' --json\n\n# Substring match + field presence.\ndench crm query people --where '{\"Email\":{\"$endsWith\":\"@acme.com\"},\"Phone\":{\"$exists\":true}}' --json\n```\n\nDate fields — and the system timestamps `created_at` / `updated_at`, which\nevery entry has — support three dedicated operators:\n\n- `$datePreset` — a dynamic calendar-anchored range resolved at query time:\n `today`, `yesterday`, `tomorrow`, `this_week`, `last_week`, `next_week`,\n `this_month`, `last_month`, `next_month`, `this_quarter`, `last_quarter`,\n `this_year`, `last_year` (weeks start Monday).\n- `$inLast` — rolling window ending today. Value is a day count (`7`) or\n `{\"amount\": 2, \"unit\": \"weeks\"}` with unit one of\n `days|weeks|months|quarters|years`.\n- `$inNext` — the mirror-image rolling window starting today.\n\n```bash\n# Leads created in the last 7 days.\ndench crm query lead --where '{\"created_at\":{\"$inLast\":7}}' --json\n\n# Leads updated this month (calendar month, not last 30 days).\ndench crm query lead --where '{\"updated_at\":{\"$datePreset\":\"this_month\"}}' --json\n\n# Deals closing next quarter.\ndench crm query deal --where '{\"Close Date\":{\"$inNext\":{\"amount\":1,\"unit\":\"quarters\"}}}' --json\n\n# Combine with other clauses: stale open deals.\ndench crm query deal --where '{\"$and\":[{\"Stage\":{\"$nin\":[\"Won\",\"Lost\"]}},{\"updated_at\":{\"$datePreset\":\"last_month\"}}]}' --json\n```\n\n`created_at` / `updated_at` also work in `--select` and `--sort`\n(`--sort -created_at`).\n\n(The CLI auto-routes any `$`-operator filter through an internal JSON string\nbecause the backend's wire format rejects `$`-prefixed object keys — just pass the\nfilter; you don't have to do anything special.)\n\nThe in-chat `query_crm` tool is for quick inspection only. Once you need\nfilters, sorting, pagination, or writes, use `dench crm`.\n\nBefore filtering, inspect the field schema with\n`dench crm fields list <object> --json`. If the field type is `tags`, an\n`enum` with `enumMultiple: true`, a multi-user field, or a many-to-many\n`relation`, the cell value is an array. Query membership with `$contains` (or\n`$in` for any-of checks) instead of assuming scalar equality. Scalar\nenum/status fields can use direct equality such as `{\"Status\":\"Open\"}`.\n\nUse full-text search when you have a name or phrase:\n\n```bash\ndench crm search --object people 'jane' --json # omit --object to search org-wide\n```\n\nUse aggregates for grouped counts or summaries. They read pre-computed\nbuckets, so they are exact and instant at any table size; `--sum <number\nfield>` totals that field per bucket (Amount by Stage):\n\n```bash\ndench crm aggregate deal --field Stage --json\ndench crm aggregate deal --field Stage --sum Amount --json\n```\n\n## Transactions\n\nUse transactions when multiple operations must succeed or fail together.\n\n```bash\ndench crm transaction --file /tmp/work/<runId>/ops.json --commit --json\n```\n\nUse this for atomic schema/data changes where partial completion would leave an\nunusable CRM.\n\n## Saved Views\n\nObjects can have saved views — a named filter + sort + pinned rows that power\nthe UI's table/kanban tabs. Views are org-wide (every member sees the same\ndropdown), so give them self-descriptive names (\"Q4 outreach: SF founders\",\nnot \"my list 3\"). Read them from the CLI:\n\n```bash\n# List the views defined on an object.\ndench crm views list deal --json\n\n# Inspect one view's definition.\ndench crm views get deal \"Open pipeline\" --json\n\n# Materialize a view's rows (applies its filters + sort), paginated.\ndench crm views entries deal \"Open pipeline\" --page 1 --page-size 100 --with-meta --json\n```\n\nLarge saved views are completed across byte-bounded read transactions, including\nglobal sorting and filtering. `--with-meta` includes `continueCursor`, `isDone`,\n`startedAt`, and `completedAt`. Pass `--cursor '<continueCursor>'` with the next\n`--page` to avoid retaining a deep page's entire sort-key prefix. These are\nobservations across transactions, not an atomic snapshot. Unindexed views scan\nthe object; the web table shows completion/freshness and offers explicit Refresh.\nOversized responses or sort keys fail with a page-size/cursor instruction rather\nthan silently dropping rows. Older CLI builds should be updated for this path.\n\nCreate, update, and delete views from the CLI too:\n\n```bash\n# Create a view. --where is equality-map sugar: the operator per field is\n# picked from the schema (enum -> is, text -> equals, number -> eq,\n# boolean -> is_true/is_false, relation -> has_any, date -> on).\ndench crm views create lead \"Hot leads\" \\\n --where '{\"Status\":\"Hot\"}' \\\n --sort -created_at \\\n --json\n\n# Full AND/OR logic via --filters (a FilterGroup). --columns curates the\n# visible columns; --type switches the layout (table|kanban|calendar|\n# timeline|gallery|list); --settings carries view-type settings such as\n# the kanban grouping field.\ndench crm views create deal \"Big open deals\" \\\n --filters '{\"id\":\"g1\",\"conjunction\":\"and\",\"rules\":[\n {\"id\":\"r1\",\"field\":\"Stage\",\"operator\":\"is_none_of\",\"value\":[\"Won\",\"Lost\"]},\n {\"id\":\"r2\",\"field\":\"Amount\",\"operator\":\"gte\",\"value\":50000}]}' \\\n --sort '[{\"field\":\"Amount\",\"direction\":\"desc\"}]' \\\n --columns \"Name,Stage,Amount,Owner\" \\\n --type kanban --settings '{\"kanbanField\":\"Stage\"}' \\\n --set-active --json\n\n# Update merges the provided flags over the existing definition\n# (untouched keys survive). Creating over an existing name fails unless\n# you pass --replace.\ndench crm views update lead \"Hot leads\" --sort -Score --json\n\n# Rename keeps the whole definition (filters, pinned rows, sidebar slot,\n# active-view pointer) and just swaps the name. `update` can't do this —\n# it upserts BY name.\ndench crm views rename lead \"Hot leads\" \"Q4 hot leads\"\n\n# Delete is idempotent and clears the active-view pointer if it pointed\n# at the deleted view.\ndench crm views delete lead \"Hot leads\"\n```\n\nFilter-rule operators by field type: text/url `contains, not_contains,\nequals, not_equals, starts_with, ends_with, within` (`within` reads the\ncell as a place and matches when it lies inside the named country, state\nor city — `{ \"field\": \"HQ\", \"operator\": \"within\", \"value\": \"California\" }`\nmatches \"San Francisco, CA\" and \"Palo Alto\"); number `eq, neq, gt, gte, lt,\nlte, between`; date `date_preset, relative_past, relative_next, before,\nafter, on, date_between`; enum `is, is_not, is_any_of, is_none_of`; boolean\n`is_true, is_false`; relation `has_any, has_none, has_all`; universal\n`is_empty, is_not_empty`. Every rule and group needs a short unique `id`.\n\nDate rules can be dynamic:\n\n- `date_preset` takes a calendar-anchored `value` resolved every time the\n view materializes: `today`, `yesterday`, `tomorrow`, `this_week`,\n `last_week`, `next_week`, `this_month`, `last_month`, `next_month`,\n `this_quarter`, `last_quarter`, `this_year`, `last_year` (weeks start\n Monday).\n- `relative_past` / `relative_next` are rolling windows anchored to today,\n using `relativeAmount` + `relativeUnit`\n (`days|weeks|months|quarters|years`).\n- Rules may target the system timestamps `created_at` / `updated_at`\n (\"Created\" / \"Updated\" in the UI) like any date field.\n\n```bash\n# Leads created in the last 14 days, as a shared view.\ndench crm views create lead \"New this fortnight\" \\\n --filters '{\"id\":\"g1\",\"conjunction\":\"and\",\"rules\":[\n {\"id\":\"r1\",\"field\":\"created_at\",\"operator\":\"relative_past\",\"relativeAmount\":14,\"relativeUnit\":\"days\"}]}' \\\n --json\n\n# Deals updated this month.\ndench crm views create deal \"Touched this month\" \\\n --filters '{\"id\":\"g1\",\"conjunction\":\"and\",\"rules\":[\n {\"id\":\"r1\",\"field\":\"updated_at\",\"operator\":\"date_preset\",\"value\":\"this_month\"}]}' \\\n --json\n```\n\nUse a view when the user refers to a board/tab they already set up (\"the open\npipeline view\"); use `query` when you need an ad-hoc filter. `--set-active`\nlands the user on the new view next time they open the object — use it when\nthey asked to see the view now, skip it for background batch views.\n\n## The Sidebar (workspace app rail)\n\n**You can change the user's sidebar. Do it — never tell them to click the\n`⋯` menu themselves.** \"Add a tab on the left for Leads\", \"pin Deals to\nmy sidebar\", \"I can't see Tasks\", \"get this off my sidebar\", \"archive\nthat view\" are all requests you complete, not requests you explain.\n\nThe rail uses **progressive disclosure**. Home is a short fixed set —\nTo-Do(s), Automations, Meetings, Outreach (drill-in: Campaigns, Inbox,\nAccounts, Newsletters), Library (drill-in) — then a **Pinned** shortcut\nstrip, then recent chats.\nCRM objects, saved views, and installed apps live **inside Library**.\nThey are not on the home rail unless you pin them there.\n\n**\"Add a left-rail tab\" / \"I can't see X\" = home Pinned strip**, not\nLibrary order. `pin_sidebar_item({ pinnedToSidebar: true })` (or\n`dench crm sidebar pin <nav-id>`) is the call. Putting a row first in\nLibrary (`position: \"top\"` alone) does **not** make it visible on home.\nSettings is not a rail row — it lives in the org menu at the bottom of\nthe rail and in ⌘K.\n\nIn chat, use the structured tools (fastest, and the rail updates live):\n\n| Tool | Use for |\n| --- | --- |\n| `list_sidebar_items` | **Call this first.** Library rows in tree order, `sidebarPins` / `pinnedToSidebar` for the home strip, plus what's hidden and why |\n| `pin_sidebar_item` | Put a Library row on the rail. `pinnedToSidebar: true` adds it to the home Pinned strip. `position` (`\"top\"`, `\"bottom\"`, or `\"3\"`) reorders it **inside Library** |\n| `remove_sidebar_item` | Take a row out of Library — archives a CRM object/view, unpins an app. `pinnedToSidebar: false` only removes the home shortcut |\n\n`list_sidebar_items` first, every time. It gives you the exact `objectName` /\n`viewName` spellings, current Library positions, and whether the row is\nalready on the home strip, so you don't have to guess whether \"Deals\" is\nan object, a saved view, or already archived.\n\n`pin_sidebar_item` with only a `position` is how you **reorder** a row\nthat's already in Library — there's no separate move tool. That is not\nhow you add a home-level tab.\n\n### What backs each row\n\nThree different pieces of state, which is why \"pin this\" can touch more than\none:\n\n- **An object row** shows in Library unless the object is archived.\n- **A saved view row** shows in Library only when the view is `pinned` and\n not archived. Creating a view does NOT put it in Library; pinning does.\n- **Home Pinned strip** is a separate, workspace-shared list of Library\n nav ids (`sidebarPins`). A row can sit in Library without being on\n home.\n\n### Two scopes — say which one when you confirm\n\n- **Archiving, view/app pinning, and home-strip pins are TEAM-SHARED.**\n Archiving hides the Library row for every member. A home pin is a\n shortcut for the whole workspace. Worth stating plainly: *\"Pinned\n Leads to the left rail — everyone on the team will see it under\n Pinned.\"*\n- **Library row order is admin-only and workspace-shared.** Reordering\n moves the shared Library tree.\n\n### Archive is not delete\n\nArchiving is presentational and fully reversible: the table, its rows,\nsearch, relations and every direct link keep working. The row just moves into\nthe rail's **Archived** flyout, from which anyone can restore it (and\n`pin_sidebar_item` restores it too). Never describe it as deleting data.\n\nTo actually destroy things you need the CRM verbs, not the sidebar ones:\n`dench crm views delete` drops a saved view; `dench crm objects delete` drops\na table (and refuses when it still has rows).\n\n### What you can move\n\nLibrary rows: CRM object rows, pinned CRM view rows, installed Dench Apps.\nTo sort Library, call `pin_sidebar_item` once per row in the order you\nwant them (admin-only). To put one on the home rail, also pass\n`pinnedToSidebar: true`.\n\nTo-Do(s), Automations, Meetings, Outreach, and Library are\n**fixed home-level tabs**, and Inbox is a fixed row inside Outreach.\nThey are not Library rows and cannot be pinned, moved, or removed.\n\nRemoval differs by kind:\n\n- **object / view** → archived (reversible, restorable from the flyout).\n- **app** → unpinned from Library. It stays installed and reachable from\n Marketplace; nothing is uninstalled.\n- **home-strip pin** → `pinnedToSidebar: false`. The row stays in Library.\n\nApps are addressed by `appSlug`, which `list_sidebar_items` returns on each\napp row — not by their display name.\n\n### From a sandbox / script\n\n```bash\n# What's in Library, what's hidden, and what's on the home Pinned strip.\ndench crm sidebar list --json\n\n# Reposition one Library row. Nav ids come from `sidebar list`.\ndench crm sidebar move crm-object:task top\ndench crm sidebar move crm-people 3\n\n# Add / remove a home-level shortcut (the \"tab on the left\"). Does not\n# move the row inside Library.\ndench crm sidebar pin crm-object:lead\ndench crm sidebar unpin crm-object:lead\n\n# Library visibility (which rows show in the sidebar) — not record access;\n# for who can READ records see \"Who can see a record\".\ndench crm objects archive deal # off Library (team-shared)\ndench crm objects unarchive deal # back on\n\ndench crm views pin lead \"Hot leads\" # make the view a Library row\ndench crm views unpin lead \"Hot leads\"\ndench crm views archive lead \"Hot leads\"\n```\n\n## Enrichment\n\nFor bulk profile lookup or company research without writing CRM rows:\n\n```bash\ndench crm enrich profiles --kind companies --lookups '[{\"domain\":\"stripe.com\"}]' --json\ndench crm enrich profiles --kind people --file people-lookups.json --json\ndench companies related --domain stripe.com --kind founders --limit 10 --json\ndench companies related --domain stripe.com --kind funding --limit 10 --json\n```\n\nBulk input is an array of 1–100 identifiers: people use `linkedinUrl` or `email`;\ncompanies use `domain` or `linkedinUrl`. Each result retains `inputIndex`; a\ngenuine miss has `data: null`. This buys profiles, not email/phone discovery.\nCompany relations support `employees`, `founders`, `funding`, `investors`,\n`acquisitions`, and `investments`; continue with `--page-token` and the same\nfilters and limit. Provider selection and schemas stay behind Dench adapters.\nContact lookup, CRM import, and outreach remain separate explicit actions.\n\nDench can auto-fill people and company fields (contact details,\nfirmographics, profiles) through the enrichment gateway. There\nare two layers.\n\n1. **One-off enrichment** of a single cell, or of a whole column across rows:\n\n```bash\n# Fill one cell. --input-field is the identifier column to look up from\n# (e.g. Email or Domain); --category picks the provider family.\ndench crm enrich cell people <entryId> \"LinkedIn URL\" --input-field \"Email\" --category people --json\n\n# Fill a column for every row missing it (default). --all also re-enriches\n# populated cells; --overwrite replaces existing values; --limit caps work.\ndench crm enrich object people --field \"LinkedIn URL\" --input-field \"Email\" --category people --limit 100 --json\n```\n\nProvider selection is automatic. Contact cells (email/phone) and\nprofile fields go through the same Dench enrich waterfall. For a\nnon-standard response path, pass `--response-path <path>`.\n\n2. **Field-bound enrichment** so a column knows how to fill itself. Attach the\nbinding at field create/update time, then enrichment runs without re-specifying\nthe mapping:\n\n```bash\ndench crm fields create people \"Title\" --type text \\\n --enrichment-category people --response-path person.title --input-field \"Email\"\n\ndench crm fields update people \"Title\" --clear-enrichment # detach later\n```\n\nPeople/company shortcuts wrap the same machinery:\n\n```bash\ndench crm people search 'jane doe' --json\ndench crm people upsert --data '{\"Email Address\":\"jane@acme.com\",\"Name\":\"Jane\"}' --json\ndench crm people enrich <entryId> --field \"LinkedIn URL\" --input-field \"Email Address\" --json\n\ndench crm companies search 'acme' --json\ndench crm companies upsert --domain acme.com --name Acme --json\ndench crm companies enrich <entryId> --field \"Company Name\" --input-field Domain --json\n```\n\n## Reports\n\nGenerate chart-ready JSON (the same shape the dashboard widgets render):\n\n```bash\n# Count rows per Stage as a pie chart.\ndench crm reports generate \"Deals by stage\" --object deal --type pie --group-by Stage --json\n\n# Sum a numeric field per group as a bar chart.\ndench crm reports generate \"Revenue by stage\" --object deal --type bar \\\n --group-by Stage --metric sum --metric-field Amount --json\n```\n\n`--type` is `pie|bar|line|table`; `--metric` is `count` (default), `sum`,\n`avg`, `min`, or `max` (every non-`count` metric needs `--metric-field`).\n`sum` and `avg` of one field grouped by another (\"Amount by Stage\") read the\npre-computed per-bucket sums, so they are exact at any table size; the\nresponse's `truncated` is `true` only when a bounded row scan had to stand in\n(a scoped object, or an object whose buckets are still being built).\n\nReports are one-shot JSON for scripts. Anything a person will LOOK at —\nin chat or on the table — goes through **Analytics** below.\n\n## Analytics (the dashboard above every table)\n\nEvery CRM object carries a dashboard: KPI stats in the header row plus chart\ncards (gauge / donut, bar, funnel, leaderboard, trend line/area, forecast,\nworld map) on a 6-track grid. Everything the dashboard can do in the UI —\ncreate, edit, hide from / show on the dashboard, resize, reorder, delete a\nchart, and change the object's shared analytics setup — has a CLI verb, a\nREST path and an App SDK method with the same names, so an agent can do it\nfrom a chat as readily as a person can from the card's ⋮ menu. It is\ndeclarative — a panel names a metric, an optional group-by, an optional date\nbucketing and optional filters in the same `FilterGroup` shape saved views\nuse. No SQL. One query (`computePanels`) is the math for the UI, the CLI, the\nAPI, the in-chat chart card and the app bridge, so a number is the same\nnumber everywhere. The full set (including hidden charts) opens in a sheet:\nthe strip's ⤢ button, or `/?path=<object>&analytics=1`.\n\n**Read the dashboard**\n\n```bash\ndench crm analytics get deal --json # panels (with span/hidden), field roles, fields you may bucket on\ndench crm analytics get company --view Customers --json # + that view's own dashboard (viewAnalytics; null = inherits)\n```\n\n**Compute** — chart-ready buckets / series / values. This is how you answer\n\"how many\", \"by source\", \"pipeline\", \"who\", \"over time\", \"where\":\n\n```bash\n# The whole stored dashboard, scoped to this month (previousValue = last month)\ndench crm analytics compute deal --period this_month --json\n\n# One or two stored panels (ids from `analytics get`)\ndench crm analytics compute deal --panel tpl:sales:open-pipeline --panel tpl:sales:win-rate --json\n\n# A saved view's dashboard, following the view's filters\ndench crm analytics compute company --view Customers --period this_quarter --json\n\n# Ad-hoc panels when no stored panel answers the question (nothing is saved)\ndench crm analytics compute lead --panels '[\n {\"title\":\"New leads by source\",\"type\":\"donut\",\"groupBy\":\"Source\"},\n {\"title\":\"Leads per week\",\"type\":\"line\",\"dateField\":\"$createdAt\",\"dateBucket\":\"week\"},\n {\"title\":\"Where they are\",\"type\":\"map\",\"groupBy\":\"$location\"}\n]' --period this_quarter --json\n```\n\n`--period` is `this_week | this_month | last_month | this_quarter |\nlast_quarter | this_year`. It scopes every panel by a `date_preset` on the\nobject's `closeDate` role (else the synthetic `$createdAt`) and fills each\npanel's `previousValue` from the previous calendar interval — exactly what\nthe strip's period pill does. `--filters '<FilterGroup>'` adds a view's rules\nto both windows. Each panel carries `source`: `aggregate` (pre-computed\nbuckets — counts, sums, averages, group-bys, month-or-coarser series and\nevery derived metric; exact at any table size), `scan` (the newest rows) or\n`snapshot` (a background pass over every row). The response carries\n`truncated: true` only while some `scan` panel could not see every row; on\nsuch a table a snapshot is requested automatically (`snapshot.stale`) and the\nnext call is exact. `link` is the deep link that opens this dashboard in the\napp.\n\n### Panel definition — every setting the chart editor has\n\nUsed by `--panels`, `save --panel` and (any subset, `null` to clear) by\n`update --patch`:\n\n| key | values | in the editor |\n| --- | --- | --- |\n| `title` | text | Title |\n| `type` | `stat` `donut` (Gauge) `funnel` (Flow) `line` (Trend) `area` `map` `bar` (Bars) `leaderboard` (Ranking) `forecast` | Chart type |\n| `metric` | `count` (default) `sum` `avg` `min` `max`; `sum/avg/min/max` need `metricField` (a number field) | Metric + Number field |\n| `derived` | `conversion_rate` `win_rate` `won_amount` `lost_amount` `open_pipeline` `pipeline_forecast` `mrr` `arr` — computed from the object's field roles; `metric`/`metricField` are ignored when set | Metric (the \"derived\" group) |\n| `groupBy` | the breakdown: an enum / user / relation / boolean / text field. On a `map` it is the **place field** (`$location` = the object's `location` role). On `line` / `area` / `forecast` it **splits the series** into one line per value | Group by / Place field / Split lines by |\n| `dateField` + `dateBucket` | a date field or `$createdAt`; `day` `week` `month` `quarter` (default `month`). Required for `line` / `area` | Date field + bucket |\n| `filters` | panel-scoped `FilterGroup` (saved-view shape). The editor writes one rule (`is`, `is_not`, `date_preset`, `is_true`, `is_false`) and keeps any richer group you saved from here | Filter |\n| `span` | card width on the 6-track grid: `2` (⅓) `3` (½) `4` (⅔) `6` (full). Omit for the default by chart kind: funnel 4; map and leaderboard 2; bar/donut grouped on a user field or the owner role (\"by rep\") 2, on anything else (\"by source\") 4; trends 3 | Width |\n| `hidden` | `true` keeps the chart off the strip above the table; it stays in the full analytics view under \"Only here\", counted by the strip's \"+N more\" | Dashboard |\n| `sortOrder` | number; position in the dashboard (use `reorder` to set them all at once) | drag the caption |\n| `id` | stable id; template panels are `tpl:<template>:<slug>`. `save`'s positional `<panelId>` becomes it | — |\n| `size` | deprecated (`sm` `md` `lg`), ignored for layout — use `span` | — |\n\nA count `funnel` on the stage role also returns `amount` per stage (the sum\nof the `amount` role) so the flow reads \"how many\" and \"how much\" at once.\nBuckets keyed by a workspace member (`groupBy` on a user field) render with\nthat member's avatar.\n\nSynthetic fields work anywhere a field name goes: **`$createdAt`** (row\ncreation time — \"new leads this month\" needs no date column) and\n**`$location`** (the `location` role, resolved through one relation hop such\nas `Account.HQ Location`, so deals inherit their account's HQ).\n\n### Edit the dashboard — the card's ⋮ menu from the CLI\n\n```bash\n# Create (or replace) a chart — the whole definition\ndench crm analytics save deal open-pipeline --panel '{\"title\":\"Open pipeline\",\"type\":\"stat\",\"derived\":\"open_pipeline\"}'\ndench crm analytics save deal won-by-rep --panel '{\"title\":\"Won by rep\",\"type\":\"leaderboard\",\"derived\":\"won_amount\",\"groupBy\":\"Owner\",\"span\":2}'\ndench crm analytics save company by-hq --panel '{\"title\":\"Customers by HQ\",\"type\":\"map\",\"groupBy\":\"$location\"}' --view Customers\n\n# Edit part of a chart — only the keys given change, null clears one\ndench crm analytics update deal won-by-rep --patch '{\"title\":\"Won by owner\",\"filters\":null}'\ndench crm analytics update deal tpl:sales:arr --patch '{\"type\":\"line\",\"dateBucket\":\"quarter\"}'\n\n# Hide from / show on the dashboard (the chart stays in the full view)\ndench crm analytics hide deal tpl:sales:forecast\ndench crm analytics show deal tpl:sales:forecast\n\n# Resize — third | half | two-thirds | full, or default (drops the stored span)\ndench crm analytics resize deal tpl:sales:deal-flow full\ndench crm analytics resize deal tpl:sales:where-deals default\n\n# Order and removal\ndench crm analytics reorder deal open-pipeline win-rate won-by-rep tpl:sales:deal-flow # must list EVERY panel of that dashboard, stats included\ndench crm analytics delete deal tpl:sales:deals-by-stage # template panels are tombstoned, never resurrected\n\n# The strip itself (team-shared, like saved views)\ndench crm analytics collapse deal | expand deal\n```\n\nReordering is by full list because the UI persists a full order on every\ndrop; a dropped card also takes whatever width is left in the row it lands\nin (`fitDroppedSpan`) — set `span` explicitly when you want a fixed width.\n\n### The analytics setup shared by every chart and view\n\nField roles are the object-level mapping every derived metric, map and card\ndefault reads — the strip's ⚙ \"Analytics setup\" sheet. They are stored once\nper object, not per chart or per view:\n\n| role | meaning | editor label |\n| --- | --- | --- |\n| `stage` | enum field that tracks progress (\"Stage\", \"Status\") | Progress field |\n| `wonValues` / `lostValues` / `convertedValues` | `stage` options that count as won / lost / converted | Counts as won / lost / converted |\n| `stageProbabilities` | chance of closing per **open** stage, `0..1` (`{\"Discovery\":0.2,\"Proposal\":0.5}`), for the weighted forecast; unlisted stages are spaced evenly, won = 1, lost = 0 | Chance of closing |\n| `amount` | number field to add up (deal amount, contract value) | Value field |\n| `closeDate` | date field for forecasts, MRR/ARR and the period pill (else `$createdAt`) | Date field |\n| `recurrence` | `monthly` (Amount is MRR) `annual` (Amount is ARR) `one_time` (no MRR/ARR panels) | The value is… |\n| `owner` | user field naming who owns each record; rankings on it default to a narrow card and draw faces | Person field |\n| `location` | place-name field for the map; may be a relation path like `Account.HQ Location` | Place field |\n\n```bash\n# Replace the whole mapping\ndench crm analytics roles deal --roles '{\"amount\":\"Amount\",\"stage\":\"Stage\",\"wonValues\":[\"Closed Won\"],\"lostValues\":[\"Closed Lost\"],\"closeDate\":\"Close Date\",\"owner\":\"Owner\",\"location\":\"Account.HQ Location\",\"recurrence\":\"annual\",\"stageProbabilities\":{\"Discovery\":0.2,\"Proposal\":0.5,\"Negotiation\":0.75}}'\n\n# Change one role, keep the rest (null clears)\ndench crm analytics roles deal --roles '{\"recurrence\":\"monthly\"}' --merge\ndench crm analytics roles deal --roles '{\"location\":null}' --merge\n```\n\nTemplates set the roles at install; a derived panel whose roles are missing\nanswers `error: \"missing_field_roles\"` (`not_recurring` for MRR/ARR without a\nrecurrence) instead of a number — set the roles, don't guess.\n\n**Dashboards are per object OR per view.** Every view of an object shows the\nobject's shared dashboard until it gets its own:\n\n```bash\ndench crm analytics scope company Customers --mode own # starts as a copy of the object's panels\ndench crm analytics scope company Customers --mode shared # back to the object's\n```\n\n`--view <name>` on `save` / `update` / `hide` / `show` / `resize` / `delete` /\n`reorder` writes THAT view's dashboard (forking a copy on the first edit if it\nwas still inheriting) — so editing Customers never changes Accounts. Field\nroles have no `--view`: they belong to the object. Any active view follows\nits own filters by default, own dashboard or not.\n\n**Showing a chart in chat.** Do not paste numbers or a markdown table when a\nchart can say it. In the web chat, `present_artifact({ kind: \"analytics\",\nobjectName, viewName?, period?, panelIds? | panels? })` mounts the live\nchart card (the same `computePanels`); a `dench crm analytics compute …`\nbash run auto-renders the same card from its stdout. Ad-hoc `panels` get a\n\"Save to dashboard\" button — offer it. Off the web UI (Slack, iMessage, a\nCRM comment) give the headline number in text plus the deep link\n`/?path=<object>&analytics=1[&view=<view>][&analyticsPeriod=<period>]`.\nQuestions the panel model cannot express (joins across objects, custom\nformulas, cohorts, combo/scatter) become a small App SDK widget\n(`present_artifact({ kind: \"app\", html })`, see APPS.md) that calls\n`dench.analytics.compute` for its data — never a `.dench.app` for a donut.\n\n**In a Dench App** (`window.dench`, see APPS.md) the same operations are\n`dench.analytics.get(objectName, { viewName? })`,\n`compute(objectName, { viewName?, period?, panelIds? | panels?, extraFilters?,\ncompareFilters?, drillFilters?, fieldRolesOverride? })`,\n`save(objectName, panelId, panel, { viewName? })`,\n`update(objectName, panelId, patch, { viewName? })`,\n`hide(objectName, panelId, { viewName? })`, `show(…)`,\n`resize(objectName, panelId, span | null, { viewName? })`,\n`delete(objectName, panelId, { viewName? })`, `reorder(objectName, panelIds,\n{ viewName? })`, `roles(objectName, fieldRoles, { merge? })`,\n`collapse(objectName)`, `expand(objectName)`,\n`scope(objectName, viewName, \"own\" | \"shared\")`. `get` + `compute` need\n`crm:read`; the rest `crm:write`. Period expansion and `drillFilters` (the\nstrip's click-to-filter chips: each scopes every panel EXCEPT those whose\ndimensions include the chip's `dimension`) are server-side — apps never\nhand-build date filters. Map panels return place strings; place them with the\nhost-side `dench.geo` resolvers, never a geocoder.\n\nREST: `GET /v1/crm/objects/{object}/analytics`, `POST …/analytics/compute`,\n`PUT|PATCH|DELETE …/analytics/panels/{panelId}`,\n`POST …/analytics/panels/{panelId}/hide|show|resize`,\n`POST …/analytics/reorder`, `PUT …/analytics/roles` (`merge: true` to patch),\n`POST …/analytics/collapse|expand`, `POST …/views/{view}/analytics/scope`.\n\n## Documents\n\nLink workspace markdown files to the CRM as documents, optionally attached to\nan entry:\n\n```bash\ndench crm docs list --json\ndench crm docs create /workspace/notes/acme-brief.md --title \"Acme brief\" --icon file-text --link-entry <entryId> --json\ndench crm docs link /workspace/notes/acme-brief.md --object company --entry <entryId> --json\ndench crm docs delete <documentId> --json\n```\n\n`docs delete` takes the `id` that `docs create` returned (the `_id` in `docs\nlist`). It removes the document page only: the workspace file stays (delete it\nwith `dench files rm` if it should go too), and pages nested under it move up to\nits parent.\n\nFor free-form prose *about* a single entry, prefer that entry's `Notes` field\n(see above). Use documents for standalone files you want discoverable from the\nCRM and linked to a record.\n\n## Templates (one-click CRM setups)\n\nTemplates install a complete, opinionated CRM motion in one call: objects\nwith fields/relations/kanban statuses, extra fields on `company`/`people`,\npinned saved views, deterministic automations, a workspace rule describing\nthe motion, and a few cross-linked sample rows.\n\n```bash\ndench crm templates list --json # catalog + installed flags\ndench crm templates install sales\ndench crm templates remove-sample-data sales\n```\n\n- Installs are **idempotent** and **compose**: re-installing tops up missing\n pieces without duplicating anything, and overlapping templates merge\n (sales + fundraising share the company `Type` enum).\n- The `sales` template is Salesforce-style: it installs Leads,\n Opportunities, Cases, and display-labels the protected `company`/`people`\n spine as Accounts/Contacts. The `service` template can add the same Cases\n object later as a focused support motion.\n- **Sales pipeline work has its own playbook.** For ANYTHING sales-adjacent\n — lead generation, target account lists (TAL), prospect research,\n enrichment, outreach prep, qualification, opportunities, pipeline review,\n forecasting, account/contact research — read `references/SALES.md` (the\n in-workspace `sales` skill) and route the task through the Leads →\n Opportunities → Customers flow. Key rules it enforces: new prospects are\n raw `lead` rows (don't create Account/Contact until a lead is Qualified),\n leads are named `<Person> from <Company>`, qualifying a lead auto-creates\n the Account/Contact/Opportunity, and every lead/contact/account/\n opportunity carries a deep-research `Notes` dossier.\n- Sample rows are tagged `Sample` (in `Tags`) and use seed keys, so\n `remove-sample-data` deletes exactly them — schema, views, and automations\n stay. **Exclude rows tagged `Sample` from real outreach, reports, and\n counts unless the user asks otherwise.**\n- For managed outbound email from CRM rows — campaigns, automatic\n follow-up sequences, sender verification, and `--object/--email-field`\n add-from-object flows — read `references/EMAIL-CAMPAIGNS.md` before\n sending.\n- When a user asks for \"a sales CRM\", \"deal pipeline\", \"investor tracker\",\n or \"client intake\", check `templates list` FIRST and prefer installing a\n template over hand-building objects. For a sales/deal pipeline, install\n `sales` and follow `references/SALES.md`.\n\n## Automations (deterministic rules)\n\nWorkspaces can have deterministic CRM rules that fire **inside entry\nwrites** — e.g. the sales template installs \"lead Status → Qualified\ncreates an Opportunity\" and \"opportunity Stage → Closed Won sets the linked\naccount's Type to Customer\".\n\n```bash\ndench crm automations list --json # rules, fire counts, enabled flags\ndench crm automations disable <automationId>\ndench crm automations enable <automationId>\n```\n\nWhat this means for you:\n\n- A write can have **side effects on other rows**. Write responses include\n an `automationEffects` array describing what was created/updated (and\n rows written by rules carry `updatedBy: \"automation:<rule name>\"`). This\n is expected behavior, not an error or a bug.\n- **Check `automations list` before manually implementing a conversion.**\n If a rule already turns qualified leads into opportunities, just set\n the status and let it fire — creating the opportunity yourself duplicates\n work (rules dedupe, but don't rely on it).\n- Rules only fire on transitions. Bulk imports and template sample data do\n not retroactively fire rules.\n- If a user complains about rows \"appearing on their own\", show them\n `automations list` and offer to disable the rule rather than deleting the\n created rows blindly.\n\n## Actions\n\n`action`-typed fields expose per-entry buttons that run member logic — either a\nno-code recipe of CRM operations (Tier A) or a script/agent (Tier B). Define\nthem with the Basic Action Builder UI, the CLI, the API, or the agent. See the\nfull reference: [`references/ACTIONS.md`](https://dench.com/references/ACTIONS.md)\n(`load_skill actions`).\n\n```bash\n# Create (or upsert) an action — creates the `action` field if it's missing\ndench crm actions create <object> <fieldName> --label \"Mark Won\" \\\n --recipe '[{\"op\":\"update_entry\",\"assignments\":[{\"field\":\"Status\",\"value\":{\"from\":\"static\",\"value\":\"Won\"}}]}]'\ndench crm actions edit <object> <fieldName> <actionId> --label \"…\" # update\ndench crm actions delete <object> <actionId> --field <fieldName> # remove\n\n# List the actions available on an entry\ndench crm actions list <entryId> --json\n\n# Run an action (Tier-A recipes run inline; Tier-B scripts spawn a Dench agent)\ndench crm actions run <object> <fieldId> <actionId> <entryId> [<entryId> ...]\n```\n\nConfig is stored in the field's `default_value` as\n`{ \"actions\": [ { \"id\", \"label\", \"variant\", \"recipe\" | \"script\" } ] }`. The CLI,\nthe API (`/api/v1/crm/actions*`), and the agent all go through the same backend.\n\n## Deep Links (linking & citing CRM records)\n\nEvery CRM surface has a stable workspace URL, so you can send a user\nstraight to it or cite a record as a source. Use the object's **canonical\n`name`** (from `objects list`), not its display label.\n\n```text\nObject list: /<slug>?path=<object>\nSaved view: /<slug>?path=<object>&view=<View Name>\nDashboard: /<slug>?path=<object>&analytics=1[&view=<View Name>][&analyticsPeriod=this_month]\nA record: /<slug>?path=<object>&entry=<object>:<entryId>\nRecord + tab: …&entryTab=notes|history|emails|meetings|activity|outreach|team\nInbox: /<slug>?path=~crm/inbox\nCalendar: /<slug>?path=~crm/calendar\n```\n\n**Do not invent entry URLs.** After `dench crm entries create` /\n`create-many` / `get --json`, paste the returned `url` (absolute,\nshareable) or `href` (relative, in-app). Never invent `?object=…`, never\nuse a bare `entry=<id>` without the `<object>:` prefix, and never build\n`?path=` links by guessing. Optional UI chrome like `&view=…` or\n`&hidden=1` is not part of the canonical entry link — only add those when\nyou intentionally want to land on a specific saved view.\n\nInside the app (chat replies, app links) the slug-less relative form\n`/?path=<object>&entry=<object>:<id>` resolves against the current\nworkspace. To cite a record as the source of a claim, use the numeric\ncitation form: `Deal is in Negotiation [1](/?path=deal&entry=deal:j57xyz).`\nFor the full deep-link map (settings, App Store, apps, automations,\nchats, files), read\n[`references/NAVIGATION.md`](https://dench.com/references/NAVIGATION.md)\n(`load_skill navigation`).\n\n## SQL Escape Hatch\n\nFor quick reads, a flat `SELECT` subset is translated into the query DSL:\n`SELECT <cols> FROM <object> [ORDER BY ...] [LIMIT N]`. Quote field names that\ncontain spaces:\n\n```bash\ndench crm sql 'SELECT \"Full Name\",\"Email Address\" FROM lead ORDER BY _creationTime DESC LIMIT 10'\n```\n\nOnly `SELECT` / `FROM` / `ORDER BY` / `LIMIT` are honored — a `WHERE` clause is\n**not** applied. For any filtering use `query --where` (operators above), and\nfor real SQL run `duckdb` against an exported file.\n\n## Common Pitfalls\n\n- `fields create` takes the field name as a **positional** argument\n (`dench crm fields create lead \"Fit Score\" --type number`); `--name` is\n not a flag on it, and `--`-prefixed field names are rejected.\n- Preview reads are capped. Use projected `query --page` / `search --select`\n with their continuation cursors for ordinary complete answers; export when\n a file or substantial processing is needed. Never infer totals from a limit.\n- `create-many` puts the ids in `results[].entryId` — there is no\n top-level `entryId`. If a parsed `entryId` is null after `create`, the\n create almost certainly succeeded under a different key: re-query by\n name before retrying, or you will mint duplicates.\n- Search is discovery-only. Capture the exact `entryId` from list/query\n and write by id; never update a fuzzy-search hit.\n- Bulk imports go through the CRM-IMPORT.md playbook: stage the file,\n map the schema, pass `--dedupe-key` + `--on-conflict skip|update`, and\n verify `{imported, skipped, errors, sourceRowsParsed}` against the\n source. Never wipe-and-reimport to fix duplicates.\n- Never invent CRM entry URLs. `entries create` / `get` / `create-many`\n return `url` + `href` — paste those. Wrong forms like `?object=task` or\n bare `entry=<id>` (missing `task:`) do not open the record. Canonical:\n `/<slug>?path=<object>&entry=<object>:<entryId>` (see Deep Links /\n `NAVIGATION.md`). If a response has no `url`/`href`, run\n `entries get <object> <entryId> --json` for one. If `create-many` reports\n `linksUnavailable`, the unlinked rows have no id in that response either —\n start with `entries list <object> --json` to recover their `id`. Never fall\n back to guessing a url.\n- The link always uses the object's **canonical** name, which is what the\n server echoes back as `objectName` — not necessarily the name you typed.\n `entries create Tasks …` succeeds (names resolve tolerantly: case,\n plurals, display labels), but the workspace matches object names exactly,\n so only the canonical form opens the record.\n- The write flag is `--data`, not `--fields`. `--fields` is accepted as an\n alias, but use `--data` in new commands.\n- Field names are validated on write: an unknown field is **rejected** with\n a \"did you mean …\" hint (no longer silently dropped), and required fields\n are enforced on create. Run `dench crm fields list <object>` first; the\n default `task` uses `Name`/`Assignee`, and some workspaces rename fields\n (e.g. `Title`). Aliases (`name`/`title` → the title field, `owner` → the\n assignee field, any case) resolve server-side; `--allow-unknown` bypasses\n both the check and the aliases.\n- Never default to CSV-on-disk for structured data. Use CRM rows.\n- `people`, `company`, and `task` are protected objects and cannot be deleted.\n- Objects can carry a UI-only `displayName` (\"Clients\" for `people`). Use the\n **canonical name** from `objects list` in commands; don't conclude an\n object is missing just because the user's label isn't in the name column.\n- New rows appearing after a status change are usually a CRM automation\n firing (see `dench crm automations list`), not a bug — and not something\n to re-create by hand.\n- **Never answer a sidebar request with instructions to click.** Pinning,\n reordering, removing and archiving rows are things you do, via\n `list_sidebar_items` → `pin_sidebar_item` / `remove_sidebar_item` (see\n \"The Sidebar\" above). Creating a saved view does not put it in the\n sidebar — pin it. And archiving is team-shared, so say so when you\n confirm.\n- Rows tagged `Sample` are template demo data; skip them in outreach and\n reports, and remove them with `dench crm templates remove-sample-data`.\n- Use `dench email campaign recipients add-from-object` or\n `dench email sequence enroll-from-object` for CRM-powered outreach; do not\n export rows to CSV unless the user explicitly asks.\n- The `Notes` (richtext) field on every object is protected — it cannot be\n renamed or deleted. Overindex on writing free-form prose there as Markdown\n instead of inventing a parallel `Description`/`Details`/`Content`/`Summary`\n column. `Notes` is hidden from list/table/kanban/gallery views by design\n and only shown when the entry is opened.\n- Use relation fields for obvious links. Do not flatten foreign keys into text.\n- Always pass `--icon <icon-name>` when creating a CRM object, and use\n `dench crm objects update <name> --icon <icon-name>` to fix any object\n that was created without one.\n- Use `entries create-many`, `entries update-many`, `cells set-many`, or\n `batch --file` for repeated writes.\n- Verify object and field names with `dench crm objects list --json` and\n `dench crm fields list <object> --json` before writing.\n- For `user`-typed cells (`Owner`, `Assignee`, ...), look up real userIds\n with `dench members list --json` (or `dench crm members list --json`)\n **before** writing. Use one id for one assignee and a JSON id array for\n multiple assignees; never collapse a shared-owner source value to one\n person. Stuffing a display name or email into a `user`\n field works only when the server's best-effort resolver finds a unique\n match; otherwise the cell stores the literal string and the UI shows\n an unlinked badge. See \"Workspace Members & `user` Fields\" above.\n- Do not write `crm/<object>/<id>.md` files into the workspace tree to store\n notes — that path is rejected by the file API. Use the entry's `Notes`\n field via `dench crm cells set <object> <id> Notes '\"<Markdown>\"'`.\n- Use `cells append` (not `cells set`) to add to `tags`/multi-select/`relation`\n cells without overwriting the existing values.\n- Manage enum options with `fields enum-add` / `enum-rename` / `enum-remove` /\n `enum-reorder` / `enum-set-color` instead of resending the whole\n `--enum-values` array — the granular verbs preserve colors, kanban order, and\n rewrite existing rows on rename.\n- Pass `--idempotency-key` on `entries create-many` / `update-many` /\n `cells set-many` / `batch` so a retried import never double-writes.\n- `query --where` supports operators (`$gt`, `$in`, `$contains`, `$or`, …), not\n just bare equality — filter server-side instead of pulling all rows and\n filtering locally.\n- Check field shapes before filtering saved views. `tags`, multi-select\n `enum` fields (`enumMultiple: true`), multi-user fields, and many-to-many\n `relation` fields are arrays, so use membership filters such as\n `--where '{\"Tags\":{\"$contains\":\"bug\"}}'`. Direct scalar equality is only the\n obvious shape for scalar fields like single-select `Status`.\n\n\n## Compact reads for agent lookups\n\nUse `dench crm search \"Ada\" --object people --select \"Name,Email\" --json` for a\ncontact lookup. Results contain `page` with stable `_id`, `objectId`, selected\n`data`, `isDone`, and `continueCursor`; preserve alternatives and follow the cursor\nwith the same query when needed. No Notes or internal search index is included\nunless explicitly selected. Without `--select`, `--page`, or `--cursor`, the\nexisting full-row JSON array remains unchanged. `dench crm objects list --compact\n--json` returns canonical/display names, visibility and counts (private counts are\nunknown, not workspace totals); `dench crm fields list people --compact --json`\nreturns field names, types and effective constraints. Full catalogs remain the\ndefault for scripts.\n\nFor a record summary, use:\n\n```bash\ndench crm entries get <object> <entryId> --with-context --compact --json\n```\n\n`--compact` is an opt-in CLI projection, also available without `--with-context`.\nIt preserves record identity, canonical links, reference metadata and relevant\ncontext while bounding the emitted JSON to 14,000 UTF-8 bytes. Long text and\nolder optional context can be clipped; `compact.clippedPaths` and\n`compact.omittedCounts` disclose those omissions. Brief freshness and backend\ncontinuation fields remain available. It neither generates a new brief nor\nfetches additional related records.\n\nAnswer from sufficient evidence and report relevant freshness or coverage limits.\nA stale or missing brief does not make the available Notes and activity unusable,\nand a clipping flag alone does not require reading the full record. When a\nrequested fact is missing or the omitted content could change the answer, use the\nreturned full-read command (the same `entries get` without `--compact`) or a\ntargeted `cells get`, `notes get`, `comments get`, or `activity --no-brief --no-notes`\nread. Local clipping is distinct from a backend continuation: following an\nactivity cursor will not recover text clipped from the current page. Mandatory\nidentity/reference metadata that cannot fit produces `compact_metadata_too_large`\nwith full-read guidance instead of silently dropping metadata. Raw output without\n`--compact` is unchanged.\n"
46
+ "sha256": "6cde1f8ce6d873de09510856db0bc8bfabcb5591532328a7c63dfea3faec0e90",
47
+ "content": "---\nname: crm\ndescription: Use the Dench CRM (crmObjects/crmFields/crmEntries) for ALL structured workspace data - people, companies, deals, tasks, anything list-shaped. Covers object/field creation and editing, enum option management, relation-first modeling, batch entry writes, reads, queries with $-operators, aggregates, saved views, transactions, CSV/JSONL import-export, provider enrichment, reports, documents, curating the progressive-disclosure sidebar (Library rows vs the home Pinned strip; pin/reorder/remove/archive), and the canonical patterns for \"I have a list of X, put it in the CRM\" requests. CRM essentials are preloaded in Dench chat; load the relevant detailed section before unfamiliar operations.\n---\n\n# Dench CRM Playbook\n\nUse the Dench CRM for all structured workspace data. Lists of people,\ncompanies, leads, deals, tasks, events, properties, cases, invoices, or any\ntabular data belong in `crmObjects`, `crmFields`, and `crmEntries`, not in ad\nhoc files under `/workspace`.\n\nReusable scripts and package installations belong in saved environments, not CRM\nfields or memory. Read [ENVIRONMENTS.md](https://dench.com/references/ENVIRONMENTS.md)\nwhen the user asks to reuse custom setup across chats. Keep credentials in\n`dench secrets`, business rows in CRM, and report outputs in Dench files. A saved\nmemory saying a service is configured does not establish that its key exists.\n\n> **Doing sales work?** (lead gen, target account lists, prospect research,\n> enrichment, outreach prep, qualification, opportunities, pipeline,\n> forecasting, account research) — read `references/SALES.md` and run it\n> through the Sales Template's Leads → Opportunities → Customers flow.\n\n> **Doing a bulk import?** (a CSV/JSONL/attachment of rows, a migration\n> from another CRM, a dedup or merge job) — **STOP and load the\n> `crm-import` playbook BEFORE running any import.** This `crm` skill is\n> NOT sufficient for imports. In-workspace agents: call\n> `load_skill({ name: \"crm-import\" })`. External agents:\n> `curl -sL https://dench.com/references/CRM-IMPORT.md`. It is the\n> mandatory playbook for staging source files, choosing dedupe keys,\n> `--on-conflict`, verifying counts, resolving relations, and safe dedup\n> — every step exists because an agent skipping it caused real data\n> loss.\n>\n> ```bash\n> curl -sL https://dench.com/references/CRM-IMPORT.md\n> ```\n\nCSV files are only inputs to `dench crm import` or outputs from\n`dench crm export`. Do not default to writing a CSV just because the source\ndata looks tabular.\n\n<!-- dench:essentials:start -->\n## CRM Essentials\n\nObjects are tables, fields columns, entries rows. Do not rediscover a table already\nidentified by relevant context, including custom tables. Discover only missing schema:\n`dench crm objects list --compact --json` / `dench crm fields list <object>\n--compact --json`. CRM inventories start with objects/counts.\n\n- Lists/finds return names/links; add requested or known columns. Do not\n fetch schema or record details just to enrich the answer.\n - List/filter: `dench crm query <object> --page --select \"Name\" --limit 100\n --json`; add `--where '{\"Status\":\"Open\"}'` when that field/value is known.\n - Find: `dench crm search \"query\" --object <object> --select \"Name\" --json`.\n - Summarize a known record: `dench crm entries get <object> <id> --with-context\n --compact --json`. This includes saved brief, recent activity and notes. A\n stale/missing brief or clipped Notes alone needs no full reread: summarize\n available evidence with brief/clipping limits. Read deeper if missing/clipped\n evidence could change the answer.\n Query pages return projected `page[]` rows; search keeps `page[]._id` and\n `page[].data`. Preserve IDs and returned links. Repeat the same command with\n `--cursor '<continueCursor>'` until `isDone` when completeness is needed, even\n after an empty page. Select only needed columns to avoid large Notes bodies.\n- Reuse known schema and matched entries before writes; avoid duplicates. `people`,\n `company`, and `task` are protected objects. Use relations for entities, member IDs\n for `user` fields, and existing enum options.\n- Record prose belongs in protected `Notes`. Saved context usually answers history\n questions; use live integrations or sync diagnostics only for a relevant gap.\n An email-address lookup needs no unrelated brief/activity read.\n- Ordinary lists use projected pages, not export-and-parse scripts. Export for\n requested files or substantial processing. Empty/capped previews are not totals.\n Keep prospect lists separate until asked to add CRM records.\n- Load `crm-import` before bulk imports, migrations, deduplication or merges. Use\n stable dedupe keys, verify counts and protect existing human edits.\n- Use saved views/analytics for their requested scope. Answer lists and summaries\n normally with inline named record links; no table artifact or presentation call.\n\nFor unfamiliar operations, load `crm#queries-and-search`, `crm#field-types`,\n`crm#tasks`, `crm#saved-views`, or another exact section from the root `crm` index.\nThese routine recipes need no additional skill load.\n<!-- dench:essentials:end -->\n\n## Mental Model\n\n- `crmObjects` are tables: `people`, `company`, `lead`, `deal`, `task`.\n- `crmFields` are columns on an object: `Email`, `Stage`, `Company`.\n- `crmEntries` are rows.\n- Cells are field values on entries.\n- `crmEntryFields` is the indexed projection used for fast query/search.\n\nThe CLI talks to the Dench API and enforces org scoping, protected objects,\nvalidation, and idempotency server-side. Prefer `dench crm` over hand-rolled\nscripts that call the backend directly.\n\n## Canonical Names vs Display Labels\n\nEvery object has a **canonical `name`** (singular lowercase: `people`,\n`company`, `lead`, `case`) and may also carry a cosmetic **`displayName` /\n`displayNameSingular`** shown in the UI. Templates and users can relabel\nobjects — e.g. a law-firm workspace shows the protected `people` object as\n\"Clients\" — **without changing the canonical name**.\n\nRules:\n\n- Commands and API calls take the canonical `name`. Get it from\n `dench crm objects list --json` (each row includes `name` and, when set,\n `displayName`).\n- When a user says \"add a row to Clients\", they usually mean the object whose\n display label is \"Clients\" — resolve it via `objects list`, then use the\n canonical name.\n- The server is forgiving: display labels, different casing (\"People\"), and\n plural forms (\"leads\", \"cases\") resolve automatically **when unambiguous**, and\n a failed lookup returns the org's object catalog in the error message. Use\n that to self-correct in one step — but do not rely on it in scripts; pin\n canonical names.\n- `objects rename` changes the canonical name (blocked on protected\n objects). To relabel only what the UI shows, set the display name instead:\n\n```bash\n# Relabel the UI without breaking anything keyed by the canonical name.\ndench crm objects update people --display-name \"Clients\" --display-name-singular \"Client\"\n```\n\n## The Reserved `Notes` Field (write here for entry-level prose)\n\nEvery CRM object ships with a protected `Notes` (richtext) field. It is\nauto-created by `crm.objects.create` and cannot be renamed or deleted.\nThe UI dedicates the entry-detail editor on the right to this field, so\n**`Notes` does not appear in any list view (table, kanban, gallery,\nsidebar properties) — it is only visible when the entry is opened**.\n**On custom objects that right-side editor tab is labelled \"Overview\"\n(it only reads \"Notes\" on the built-in People/Companies objects) —\n\"Overview\" and `Notes` are the same reserved field.** The field key you\nwrite to is always `Notes` regardless of which label the tab shows.\n\nThis is your single canonical home for free-form, unstructured prose\nabout an entry: meeting notes, research summaries, status updates, the\n\"description\" of a task, prep for a call, follow-up history, etc.\nBias aggressively toward `Notes` for anything that reads like paragraph\ntext or Markdown.\n\nRules for agents:\n\n- **Any free-form information about an entry goes into `Notes`,\n written as Markdown.** Do not invent a parallel `Description`,\n `Details`, `Content`, `Body`, `Summary`, `Brief`, `Bio`, `Profile`,\n `Research`, `Background`, `About`, or similar text/richtext field for\n the same purpose — it will be redundant with `Notes` and clutter the\n table view.\n- **The big \"Overview\" editor on a custom object IS `Notes` — fill it.**\n This applies to task/bug/case objects too: the entry's body (summary,\n repro steps, details, the \"description\" of a task) goes into `Notes` so\n it fills that editor. Do NOT create a separate `Description` richtext\n field beside it unless the user explicitly needs a short, list-visible\n column (see the alias rule below). A task whose \"Overview\" shows only\n the title with an empty body while the real content sits in a sidebar\n `Description` field is exactly the mistake this rule prevents.\n- Treat field names like `Description`, `Details`, `Content`, `Notes`,\n `Summary`, `Body`, `Bio`, `Background`, `Context`, `Instructions`,\n `Prompt`, `Markdown`, `Writeup`, and `Long Description` as aliases for\n the default `Notes` field unless the user explicitly needs that value\n as a short, filterable/list-visible column.\n- If the value is multi-sentence, markdown-formatted, contains headings,\n bullets, links, pasted prose, transcripts, generated copy, requirements,\n or \"lots of text\", put it in `Notes` even if the incoming source column\n is named `Description`, `Details`, or `Content`.\n- Write `Notes` content as a complete Markdown document. The first H1\n is rendered as the page title in the editor; flow body text, lists,\n links, and headings under it.\n- `Notes` is **not indexed by default** (richtext default), so do not\n rely on it for filters or sorts. If a value should be filterable or\n sortable, model it as a typed field (`text`, `enum`, `date`, etc.)\n alongside `Notes`.\n- When a user pastes a long block of text or asks you to \"save what we\n just discussed\" on an entry, write it to `Notes`.\n- **Bias hard against empty/thin `Notes` on material records you\n CREATE.** When you create a substantive entry (a lead, contact,\n company/account, opportunity, deal, case), its `Notes` should hold a\n real, useful dossier — who/what it is, the key facts with sources, and\n the next action — not a blank field or a single line. Before you report\n a record created, re-read its `Notes`: if a teammate couldn't brief\n themselves from it, enrich it first.\n- **On a record that already exists, research you were asked for goes\n into a NEW note on the timeline** (`dench crm notes create … --title\n \"Research — <date>\"`), not into the `Notes` document — see \"Notes on\n the timeline\" below. The document is the human's; the timeline is the\n dated record of everything else.\n- Use a structured field (its own column) **only when** the value is a\n short, repeating, structured datum that the user will filter, sort,\n group, or aggregate by. Otherwise keep it in `Notes`.\n\nCLI examples:\n\n```bash\n# Write free-form notes to a person's entry. `jq -Rs` encodes the file as\n# the JSON string required by `cells set`. Existing markdown is replaced.\ndench crm cells set people <id> Notes \\\n \"$(jq -Rs . /tmp/work/<runId>/ada-research.md)\"\n\n# Common pattern: read existing notes, append a dated section, write\n# back atomically.\nprev=$(dench crm query people --where '{\"id\":\"<id>\"}' --json \\\n | jq -r '.[0].fields.Notes // \"\"')\nnext=$(printf '%s\\n\\n## %s\\n%s\\n' \\\n \"$prev\" \"$(date +%Y-%m-%d)\" \"$new_text\" | jq -Rs .)\ndench crm cells set people <id> Notes \"$next\"\n```\n\nDo not create a workspace file at `crm/<object>/<id>.md` for entry\nnotes — that path was a legacy accident and is now rejected by the\nfile-write API. The notes editor and the CLI both round-trip through\nthe entry's `Notes` field.\n\n### The account dossier (a generated section inside `Notes`)\n\nWhen Dench creates an account on its own (a prospect detected from email,\na calendar invitee's company, a Slack Connect channel, a LinkedIn\nconversation) it researches the company — a handful of web searches, one\nmodel pass, relative to what THIS workspace sells — and appends the\nresult to the company's `Notes` as a delimited section:\n\n```\n<!-- dench:dossier v1 2026-09-24 -->\n## Account dossier\n**Overview** — … **What they do** … **Stage** … **Recent signals** …\n**Why they might care** … **Pitch angles** … **Key people** …\n**Open questions** … **Sources**\n<!-- /dench:dossier -->\n\n<!-- dench:dossier-update 2026-10-12 -->\n### Update — 12 Oct 2026\n- Raised a $14M Series A (source) …\n<!-- /dench:dossier-update -->\n```\n\nRules:\n\n- **It is append-only.** Dench never rewrites text already in the\n document — a human may have edited any line. A later refresh appends a\n dated `dossier-update` block only when something material changed (a\n new signal, a stage fact, a new key person); rewording never writes.\n- **Read it before your own research; add findings BELOW it; never\n duplicate or edit it.** The markers are how Dench (and the Brief) tell\n its research from yours — leave them in place. If a member deletes the\n section, Dench does not put it back until someone regenerates.\n- The Brief treats the dossier as machine research: below human notes and\n meetings, above digests and field values.\n- Only accounts with a Website/Domain get one (a bare name would research\n the wrong company). Capped at 50 per workspace per day; the workspace's\n Sync → \"Research dossier\" switch turns it off.\n\n```bash\ndench crm entries dossier <entryId> --json # status, generatedAt, updatesAppended, error\ndench crm entries dossier <entryId> --regenerate # research again → a fresh full section appended\n```\n\nAPI: `GET /crm/entries/{entryId}/dossier`, `POST /crm/entries/{entryId}/dossier/regenerate`.\n\n### Accounts detected from email (why a company is — or isn't — in the CRM)\n\nWhen someone emails the workspace from a domain the CRM does not know,\nDench does not create a record on the first message. It waits ten minutes\nfor the burst to settle, then classifies the conversation against\n`ORGANISATION.md` (Jev, the evaluation model) and creates an **account +\ncontacts only for potential customers and existing customers**\n(`Type: Prospect` / `Type: Customer` when the column exists). Vendors,\nrecruiters, investors, partners, personal mail and automation get a\n`skipped` verdict and never become records — and that verdict also stops\nthe older promotion rules from creating them later. A prospect writing\nfrom gmail.com becomes a **contact with no account**. The verdict row is\nthe audit trail; `Source` stays `Gmail`.\n\nVerdicts: `created`, `skipped` (with the counterparty type), `pending` (a\nrun in flight), `no_org_context` (the workspace had no `ORGANISATION.md`\nyet — asked again when it is written), `failed` (model or budget error;\nasked again on the next email), `rolled_back` (undone by an admin; never\nre-created). A `skipped` domain is re-asked once when new mail arrives\nafter 30 days, so a vendor that turns into a prospect is not lost.\n\n```bash\ndench crm detections list [--verdict created|skipped|no_org_context|failed|pending|rolled_back] [--kind detections|linkedin|all] [--since 30d] [--limit N] [--json]\ndench crm detections undo --since 2026-09-24 --dry-run # what would be removed, every kind\ndench crm detections undo --since 2026-09-24 # admin: delete machine-only rows, mark rolled_back\ndench crm detections undo --since 2026-09-24 --kind linkedin --dry-run # only what the LinkedIn resolver created\ndench crm detections undo --since 2026-09-24 --kind email-tasks # only the auto-created tasks / cases\n```\n\nThe LinkedIn resolver files its rows on the same table (`evidenceKind:\nlinkedin`, key = the account's domain or `li:<slug>`), so `list --kind\nlinkedin` shows what LinkedIn created and tagged; `--kind detections` is\nthe email detector plus the retro sweep; `all` (default) is both.\n\n`undo` is the **one rollback for everything the ingestion jobs created**\nsince `--since`, in three kinds (`--kind`, default `all`):\n\n- `detections` — the accounts and contacts the email detector and the\n sweep created;\n- `linkedin` — the contacts and accounts the LinkedIn resolver created;\n their conversations are unlinked and parked so the next message does not\n recreate them (a human can still link one by hand);\n- `email-tasks` — the tasks and cases \"Tasks from email\" created; the\n decision row becomes `rolled_back`, so the same thread never yields that\n task again.\n\nIt removes only rows **that no human has touched** (no member/agent write\nin their history, no comment, no subtasks) — a task someone completed or renamed stays,\na contact someone edited stays with its `created` verdict. It never\ntouches records created by hand, by import, or by the calendar path.\nVerdicts whose rows all went are marked `rolled_back`, and the removed\nrecords' identities are tombstoned like any human delete — the next email\nor message from those addresses creates nothing; only a human creating the\nrecord again (or linking the conversation from the Inbox) brings them back.\nBounded per call; the output (and `remaining`, overall and per kind) says\nwhen to run it again. The Sync → \"Accounts from email\" / \"Contacts from\nLinkedIn\" / \"Tasks from email\" switches turn the creators off for the\nworkspace.\n\nAPI: `GET /crm/detections` (`kind`), `POST /crm/detections/undo`\n(`since`, `kind`, `dryRun`, `limit` → totals plus per-kind\n`kinds.{detections,linkedin,emailTasks}.{scanned,deleted,kept,rolledBack,remaining}`).\n\n## Records Dench creates on its own (email, calendar, Slack Connect, LinkedIn)\n\nDench files people and companies from the workspace's own channels without\nbeing asked. Before you create a person or company by hand, **search\nfirst** — the resolver has very likely filed them already, and a hand-made\ntwin is exactly what it exists to prevent.\n\n| Source | What appears | Gate |\n| --- | --- | --- |\n| Email (Gmail / Outlook) | account (`Type: Prospect` / `Customer`) + contacts for potential and existing customers; a prospect on gmail.com is a contact with no account | classified against `ORGANISATION.md`; vendors / recruiters / investors / partners / automation never become records (see \"Accounts detected from email\") |\n| Calendar | external invitees of **upcoming** meetings → contact + company | none |\n| Slack Connect | a shared channel binds to the company on the other side; its messages land on the account's Activity as `slack_message`; external members become contacts filed under that account | resolution-gated: Dench never creates a company whose name it cannot state (unresolved channels wait for a human pick in Marketplace → Integrations → Slack) |\n| LinkedIn | **every** 1:1 conversation → contact + account, `Source: LinkedIn`, paced at ≤ 80 profile views per connected account per day, newest chats first | none; the counterparty type (recruiter, vendor, …) is tagged for filtering — `dench crm detections list --kind linkedin` |\n| Lead conversion | a lead who books a meeting flips to `Status: Qualified` and the template's convert automation opens Account / Contact / Opportunity (history: \"Meeting booked: <title>\") | live calendar events only, forward-only, once per event series |\n\n**One resolver, never a duplicate.** Every one of these matches before it\ncreates: a contact by email → LinkedIn URL → name + company domain; an\naccount by domain → LinkedIn company URL → canonical name. A match only\nfills empty fields (`Email`, `LinkedIn URL`, `Job Title`, `Avatar URL`,\n`Company`) — a human-set `Name` or `Company` is never replaced. Leads are\nmatched but never turned into a second `people` row; role addresses\n(`info@`, `support@`, …) resolve the account and create no person.\n\n**Deleted means deleted.** Deleting a contact or company tombstones its\nidentities: the next email, LinkedIn message or Slack post from that person\ndoes **not** recreate them. To bring someone back, create the record again\n(or link the conversation from the Inbox) — the identity relinks on the\nnext touch.\n\n**Tasks from email.** After a live email lands on a thread that already\ntouches a record, Dench may create at most two tasks (a reply owed, a\npromised follow-up, material to send, agreed next steps) on the most direct\nrecord — opportunity, else lead, else the contact's company. Only\ncommitments **our side** owes become tasks: every commitment is checked\nagainst who is actually on the thread (a counterparty's name is theirs\nwhatever the model said; a member's name is ours; an unnamed \"us\" counts\nonly when we wrote last). A commitment **they** owe never lands on our\nboard — it becomes a deferred chase instead: nothing is created until two\nbusiness days after the date they gave (else four business days after our\nlast message), and then only if they have not written back, as ONE task\n\"Follow up with <First name> on <what they owe>\". At most one chase per\nthread at a time, and it holds one of the thread's two auto-task slots.\nThe assignee is the member the commitment names, else the mailbox owner\nwhen they are on the thread, else the record's Owner, else nobody. `Notes`\nread like a colleague wrote them — the thread subject and who was on it,\nthe digest summary, the latest message quoted without its signature, and\nan \"Open the conversation\" link — never a thread key or an account id; the\nledger thread key lives in the hidden `_Source Thread` text field on the\ntask (`dench crm query task --where '{\"_Source Thread\": \"<key>\"}'`). A support\nissue opens a **Case** when the workspace has a `case` object. They are\nwritten as `system:email-tasks`; when you propose tasks yourself, read the\nrecord's open tasks first so you do not duplicate one Dench already made.\n\n**Switches.** Everything above is per-workspace and admin-controlled:\n\n```bash\ndench settings sync --json # the eight switches\ndench settings sync set linkedinContacts off # detectAccounts | linkedinContacts | slackConnectAccounts |\n # calendarContacts | dossier | emailTasks | leadAutoQualify | intelligence\n```\n\nOff stops new work; nothing already created is removed. To remove what a\njob created, use `dench crm detections undo` (above) — it is the one\nrollback for the email detector, the sweep, the LinkedIn resolver and\ntasks-from-email, and it never touches rows a human has edited.\n\n## Workspace Members & `user` Fields\n\n`user`-typed cells (`Owner`, `Assignee`, `Account Manager`, etc.)\nstore one member `userId` or an array of member `userId`s. The UI resolves\nthose ids against the org roster and renders every assigned member. A name\nor email is accepted only as a best-effort compatibility input.\n\n**Preserve every assignee.** If source data says `Kumar + Mark`, “shared,”\n“joint owners,” or otherwise names multiple people, resolve every person and\nwrite a JSON array. Never silently choose the first person, invent a combined\nliteral user, or move the second person into an unrelated text field.\n\nTo assign a `user` field correctly, look up the roster first:\n\n```bash\n# Top-level alias (recommended in scripts):\ndench members list --json\n\n# Same data, scoped under the CRM namespace:\ndench crm members list --json\n```\n\nThe response shape (both surfaces):\n\n```json\n{\n \"members\": [\n { \"userId\": \"k57…\", \"name\": \"Ada Lovelace\", \"email\": \"ada@acme.com\",\n \"role\": \"ADMIN\", \"image\": \"https://…\", \"tagline\": \"Head of Ops\",\n \"timezone\": \"Europe/London\", \"presence\": \"online\",\n \"lastActiveAt\": 1715000000000, \"joinedAt\": 1715000000000 }\n ],\n \"organizationId\": \"…\",\n \"organizationSlug\": \"acme\",\n \"organizationName\": \"Acme\"\n}\n```\n\n### Member profiles: who is around, and what they are doing\n\nEvery member has a profile (the panel that opens when a name is clicked in\nthe app). Read it before assigning or scheduling for someone — it tells you\ntheir local time, whether they are online, and what they already have open.\n`<userId|email>` accepts either; `presence` is `online` (<3 min), `away`\n(<30 min), or `offline`. Only the web app heartbeats: your own CLI/API calls\nnever make a person look online.\n\n```bash\ndench members get <userId|email> --json # tagline, timezone, presence, openTaskCount\ndench members activity <userId|email> --json # their comments + record changes, newest first\ndench members tasks <userId|email> --json # open tasks assigned to them\ndench members presence --json # online / away / offline for everyone\ndench members me --tagline \"Ops @ Acme\" --timezone America/New_York # your own profile\n```\n\nActivity is what the person did themself — edits you (Dench) make on their\nbehalf are attributed to you in history and excluded here. Never claim a\nmember is \"not doing anything\" because their activity is empty; they may work\nin tools that do not write to the CRM.\n\nThen assign by `userId`:\n\n```bash\n# Single cell. The default `task` object's user field is `Assignee`,\n# NOT `Owner` — verify with `dench crm fields list task` first.\ndench crm cells set task <entryId> Assignee '\"<userId>\"'\n\n# Multiple assignees: pass a JSON array of member ids.\ndench crm cells set task <entryId> Assignee \\\n '[\"<kumarUserId>\",\"<markUserId>\"]'\n\n# Inside a create / create-many. The default `task` uses `Name` for the\n# task name and `Assignee` (NOT `Owner`) for the user field; `people`\n# uses `Name` + `Owner`. Some workspaces rename these (e.g. `task` →\n# `Title`), so always confirm with `dench crm fields list <object>`.\ndench crm entries create task \\\n --data '{\"Name\":\"Ship CRM\",\"Assignee\":\"<userId>\"}' --json\n# Response includes entryId plus url/href deep links — paste url for the user.\n\ndench crm entries create task \\\n --data '{\"Name\":\"Joint review\",\"Assignee\":[\"<kumarUserId>\",\"<markUserId>\"]}' --json\n\ndench crm entries create-many people \\\n --data '[{\"Name\":\"Jane\",\"Email\":\"jane@example.com\",\"Owner\":\"<userId>\"}]' --json\n# create-many returns results[].url / results[].href per created row. If it\n# reports linksUnavailable, the rows it could not link have no id in the\n# response: run `entries list <object> --json` for their `id`, then\n# `entries get <object> <id> --json` for the url. Never hand-build one.\n```\n\nAssigning members to a `user`-typed field (e.g. `Assignee`, `Owner`)\nsends each newly assigned member a `mention` notification (in-app bell +\nemail; same kind as an `@` mention, titled \"Assigned to you\"). Marking a\n`task` row's `Status` to a done value notifies every assignee\n(`task_completed`). Self-assignment is not notified.\n\nThe server best-effort-resolves a name or email passed to a `user`\nfield when it matches exactly one member of the org (case-insensitive),\nso positional values such as `'\"Ada Lovelace\"'` or `'\"ada@acme.com\"'`\nwill land on the right `userId` **when the match is unambiguous**. Arrays\nof names/emails are resolved member by member. Treat that resolver as a\nsafety net, not the primary path — always run\n`dench members list` first when you have any ambiguity (shared first\nnames, missing email, deactivated users), because on a non-match the\nvalue is stored as a plain string and the UI cannot link it to a real\nmember.\n\nIf the user-type field is on a CRM object that is going to be filtered\nor grouped by owner, the field should also be `--indexed` so the table\nview's \"Owned by\" filter and the kanban-by-owner board pick it up.\n\n### Personal scope: \"assigned to me\" (not a view filter)\n\nEvery object view in the app has an avatar pill next to Filter / Sort:\n**Show only assigned to me**. It narrows the table, kanban columns, the\nhero count, column sums and the analytics strip to rows whose people\nfield includes the viewer — and it is **personal**: remembered per\nmember + workspace + object in the browser, never written into the saved\nview. A view filter would change the view for every teammate; this only\nchanges what *you* see. The dropdown on the pill also offers any other\nmember, **Unassigned** (the field is empty) and **Everyone** (off).\n\nThe CLI and API take the same scope on every read that lists rows:\n\n```bash\ndench crm views entries task \"Board\" --mine --with-meta --json # my rows in that view\ndench crm entries list deal --assigned-to priya@acme.com --json # a teammate's\ndench crm query lead --where '{\"Status\":\"New\"}' --mine --json # AND-ed onto --where\ndench crm entries list deal --assigned-to unassigned --json # nobody's\ndench crm analytics compute deal --mine --json # my numbers\n```\n\n- `--assigned-to me|unassigned|<userId|email>` (`--mine` = `--assigned-to me`).\n API: `?assignedTo=` on `GET /crm/objects/{object}/entries` and\n `/views/{view}/entries`, body `assignedTo` on `POST /crm/query` and\n `/analytics/compute`.\n- `--assignee-field <Field>` picks which `user` field counts when an\n object has several (`Owner` vs `Reviewer`). Default order: the\n analytics `owner` role → the task default `Assignee` → a user field\n named like *assignee / owner / rep* → the first user field. The\n response echoes what was used as `assigneeScope: { field, target }`.\n- `me` needs a member behind the call: a browser session, a per-member\n API key, or a `dench signin` agent session (it resolves to the human\n who signed in). An org-wide API key must pass a userId / email instead.\n- An object with no `user` field cannot be scoped; the pill is hidden\n there and the CLI / API say so.\n- Deep link: `/{slug}?path=task&assignee=me` (or `unassigned`, a userId;\n add `&assigneeField=`) switches the scope on for that visit and\n remembers it. `dench crm analytics compute --mine` prints one.\n- Counts and sums stay exact under the scope at any table size; the one\n bound is **Unassigned** on very large objects, where the result may be\n flagged `truncated` (there is no index for \"field is empty\").\n\n## Field Types\n\nSupported field types, verbatim:\n\n`text`, `email`, `phone`, `url`, `number`, `boolean`, `date`, `richtext`,\n`file`, `user`, `enum`, `relation`, `tags`, `action`.\n\nExamples:\n\n```bash\ndench crm fields create people \"Name\" --type text --required\ndench crm fields create people \"Email\" --type email --indexed\ndench crm fields create people \"Phone\" --type phone\ndench crm fields create company \"Website\" --type url\ndench crm fields create deal \"Amount\" --type number\ndench crm fields create task \"Done\" --type boolean\ndench crm fields create deal \"Close Date\" --type date\ndench crm fields create deal \"Attachment\" --type file\ndench crm fields create task \"Owner\" --type user\ndench crm fields create lead \"Status\" --type enum \\\n --enum-values '[\"New\",\"Working\",\"Qualified\",\"Lost\"]' \\\n --enum-colors '[\"#94a3b8\",\"#3b82f6\",\"#22c55e\",\"#ef4444\"]'\ndench crm fields create people \"Company\" --type relation --related-object company --relationship many_to_one --indexed\ndench crm fields create company \"Tags\" --type tags\ndench crm fields create lead \"Run Outreach\" --type action\n```\n\n**The field name is POSITIONAL — there is no `--name` flag on\n`fields create`.** The exact shape is\n`dench crm fields create <object> \"<Field Name>\" --type <type> [...]`:\n\n```bash\n# ✅ Correct — name is the second positional argument.\ndench crm fields create lead \"Fit Score\" --type number\n\n# ❌ Wrong — `--name` is not a flag here; this is rejected.\ndench crm fields create lead --name \"Fit Score\" --type number\n```\n\nThe command also **rejects any field name that starts with `--`** (a\nmissing/shifted positional would otherwise swallow the next flag as the\nfield's name and create a column literally called `--type`). If you see\nthat rejection, your arguments are off by one — fix the invocation, do\nnot quote-escape the dashes.\n\nUse `--enum-multiple` only when an enum is genuinely multi-select. Use\n`--no-indexed` only when a field should not participate in filters/search.\n\nFields can be edited, reordered, and enrichment-bound (auto-filled from a data\nprovider) after creation — see \"Editing Fields & Enum Options\" and\n\"Enrichment\" below.\n\nDo **not** create your own text/richtext columns called `Notes`,\n`Description`, `Details`, `Content`, `Summary`, `Body`, `About`, or\nsimilar for long-form entry prose. Every object already has a protected\n`Notes` (richtext) field — write descriptions, details, markdown, and\nlarge text blobs there. See the \"Reserved `Notes` Field\" section above.\n\n## Campaign Activity Columns (read-only)\n\nAdd a yes/no column showing whether a person opened an email, clicked an email\nlink, replied, or connected on LinkedIn through a multichannel campaign:\n\n```bash\n# One campaign: use its multichannel campaign ID, not its CRM entry ID.\ndench crm fields create people \"Email opened\" --calculation email_opened --campaign CAMPAIGN_ID\n\n# Any campaign the viewer can access:\ndench crm fields create people \"Replied to a campaign\" --calculation replied\n\n# Change an existing calculation's metric/source:\ndench crm fields update people \"Email opened\" --calculation email_clicked --campaign CAMPAIGN_ID\n\n# Remove the calculation explicitly; this becomes an editable boolean.\ndench crm fields update people \"Email opened\" --clear-calculation\n```\n\nMetrics: `email_opened`, `email_clicked`, `replied`, `linkedin_connected`.\nAvailable on the canonical `people` and `lead` objects only; a Lead reads its\nperson's campaign activity through `Contact`.\nThese are guided campaign signals, not formulas or expression strings. The type\ndefaults to `boolean`; an explicit type must also be `boolean`. A calculation\ncannot be required, indexed, enriched, or have a default value. A selected\ncampaign must exist in the current workspace and be readable by the viewer.\nOmitting `--campaign` means any accessible multichannel campaign, not legacy\nemail/LinkedIn sequences or newsletters.\n\n`fields list --json` returns the `calculation` metadata. Field create/update API\nbodies use `calculation: {\"kind\":\"campaign_activity\",\"metric\":\"email_opened\",\n\"campaignId\":\"CAMPAIGN_ID\"}` (`campaignId` is optional). Update uses\n`clearCalculation: true` to detach it; do not send that alongside `calculation`.\nExisting stored fields cannot be converted in place: create a new calculation\ncolumn. Clearing does not snapshot calculated results into stored values.\n\nEntry/cell writes, imports, batches, and transactions must omit calculated\ncolumns. Even `--allow-unknown` cannot overwrite or clear their values. Normal\ncolumns remain editable. Remove calculation columns from an export before\nimporting it as writable data.\n\n## Writes Validate Field Names (no more silent drops)\n\nEntry writes are checked against the object's real field schema. A field\nname that doesn't exist on the object is **rejected** with a `did you\nmean …?` hint plus the full valid-field list — it is no longer silently\nspread into the row's JSON and dropped from every view. On `create`, the\nobject's `required` fields must also be present. This applies to\n`entries create`, `entries create-many`, `entries update`, `cells set`,\n`cells set-many`, `crm batch`, and `crm transaction commit`.\n\nTwo consequences:\n\n- **Verify field names before writing.** Run\n `dench crm fields list <object> --json` first. Field names vary per\n workspace — a customized `task` object may use `Title` (not `Name`).\n Writes resolve common aliases server-side (CLI, API and MCP alike): any\n case or separator (`due_date` → `Due Date`), `name` / `title` /\n `subject` → the object's title field, and `owner` / `assignee` /\n `assigned to` → its assignee field (a task's `Assignee`). A task row's\n read keys (`title`, `status`, `priority`, `dueDateKey`, `assignee`)\n write back as they are. Two keys for one field, and anything else\n unknown, are still rejected.\n- **Escape hatch:** pass `--allow-unknown` (CLI) / `allowUnknown: true`\n (API) to write the raw data without the schema check — for loose\n imports that intentionally carry extra columns. Use sparingly; the\n default strictness is what catches typos before they create blank rows.\n\n```bash\n# Accepted — `title` and `Owner` resolve to the task's Name and Assignee:\ndench crm entries create task --data '{\"title\":\"Ship X\",\"Owner\":\"<id>\"}'\n\n# Rejected — a name that is no field and no alias:\ndench crm entries create task --data '{\"Name\":\"Ship X\",\"Budget\":5}'\n# → Unknown field for object \"task\": \"Budget\".\n# Valid fields: Name, Status, Priority, Assignee, Due Date, Notes.\n\n# Best — names verified against `fields list`:\ndench crm entries create task --data '{\"Name\":\"Ship X\",\"Assignee\":\"<id>\"}'\n```\n\n## The Brief (read this FIRST when asked about a record)\n\nEvery record with any history carries a generated **Brief**: what it means\nright now — relationship status, who owes the next move, open threads,\ncommitments, risks, key contacts, the suggested next step — rebuilt from the\ntimeline below it. Ingestion prepares the context and Brief in the cloud,\nincluding records nobody has opened. Opening a prepared record reads the saved\nresult; it does not fetch providers or wait for a model. It is read-only: humans correct it by writing the truth\nin Notes or a comment, which the generator treats as authoritative.\n\n```bash\ndench crm brief company <entryId> --json # headline, body, facets, stale?\ndench crm brief company <entryId> --with-context --json # stored evidence, one operation; no model call\ndench crm brief company <entryId> --regenerate # rebuild now from the current timeline\ndench crm context company <entryId> --json # inspect accessible sources, last Brief inputs and sync queue\ndench crm context company <entryId> --cursor '<nextCursor>' --json\n```\n\n- `facets.health` ∈ healthy | watch | at_risk | dormant;\n `facets.awaitingReplyFrom` ∈ us | them | none; `facets.openCommitments`.\n- `stale: true` means newer activity exists than the Brief has seen; say so\n when you quote it, or `--regenerate` first if the question is about now.\n- `crm context` is read-only. It returns source IDs/links, direct or related\n record association reasons, and `usedByLastBrief` for permitted sources.\n Its `manifest.activityIds` covers only that source page, not the whole\n generation. An ID match records past inclusion; it does not prove that\n the current source content is unchanged. `generation` reports queued,\n running, stored, failed, disabled, or empty. Stored means a previous\n Brief was generated; the Brief card checks current freshness. `mailboxes` describes only\n your own connections (up to ten), not coworkers' private accounts.\n Follow `nextCursor` through empty pages. `coverage: \"bounded_snapshot\"`\n never certifies complete history, and `scopeLimited` means related-record\n expansion reached its cap.\n- `status: \"generating\"` with no body means cloud preparation has not finished\n (for example, initial backfill or a generation-budget retry). CLI/API evidence\n reads do not wait for inference. The web Brief card starts or joins a direct\n streamed generation on a miss, with a timeout and Retry action; it bypasses\n background debounce, scheduler delays and the bulk daily budget.\n An existing permitted Brief stays visible during refresh. Revoked or edited\n source evidence is withheld until its replacement is prepared.\n- `--with-context` returns stored facts, Notes, comments and conversation evidence.\n Missing/invalid packets are assembled directly and saved without waiting for\n a scheduler, digest, Brief inference or provider fetch. The response includes\n `assembledAt`, `stale` and source coverage. Email, LinkedIn, Slack and\n meetings each get representation when present; the packet is bounded, not a\n complete transcript export. `truncated` means more history exists or a read\n budget was reached. Date-only packet refreshes do not spend a model call.\n `relatedRecords` carries attributed facts, Notes and comments from explicit\n business relations, including linked contacts, opportunities, tasks and custom\n objects. Companies also include one further relation hop through those records.\n A person does not inherit an employer's entire history, and an opportunity\n does not inherit sibling opportunities. Relations are checked against current\n records and access rules; unlinking or making a source private retracts it.\n Scheduled events carry their start/end dates, cancellation and RSVP state;\n a past calendar slot alone does not establish attendance. Recorded meetings\n include their Overview (or legacy Summary), outcomes and next actions.\n Compact CLI and chat packets retain representative sources and related record\n types within their byte limits. `evidenceOmissions`, when present, describes\n what that response omitted; fetch the referenced source for more detail.\n- In web chat, an attached record's saved evidence arrives before the first\n model call, within the existing workspace-context read. Use it directly when\n relevant; do not refetch providers or rediscover that record just to summarize\n it. Clearing the context chip clears the next request's automatic attachment.\n- **Never write the Brief.** If it is wrong, put the correct fact in a note\n or comment and regenerate.\n- Background Briefs use workspace-visible sources. The web card and on-demand\n `crm brief` use a private Brief for the signed-in member, including meetings\n and communications that member can access. It is labelled **Only you**;\n another member receives their own Brief. Organization-scoped credentials use\n the workspace Brief. Source sharing settings are unchanged.\n `audience: \"viewer\"` identifies a private response; the legacy `shared` key\n contains the selected Brief and does not override that audience. Never copy\n a viewer response into workspace-shared context. Source or access changes\n invalidate both stored evidence and generated prose before they are served.\n- A member's `entries get --with-context` and attached-record chat context\n include that member's accessible evidence without writing it to shared\n caches. The packet has `audience: \"viewer\"`. Organization-scoped reads\n remain workspace-only. These evidence reads do not run a model.\n\n## The Activity Ledger (read this before the live tools)\n\nEvery record has one timeline — the **Activity** tab in the app and\n`dench crm activity` on the CLI. It holds, in one ordering: the pinned\n`Notes` document, titled **notes**, **comments**, **field changes**, and\nevery external touch the workspace has ingested — **emails** (Gmail /\nOutlook), **calendar events**, **recorded meetings**, **Slack** and\n**LinkedIn** messages. It is the cheapest, most complete answer to\n\"what is going on with Acme?\", \"when did we last talk to Diana?\", \"did\nthey reply?\", \"what did we promise?\".\n\n```bash\n# Newest first. Ends with the record's Notes document.\ndench crm activity company <entryId> --json\n\n# Only emails and meetings from the last two weeks.\ndench crm activity people <entryId> --kind email,meetings --since 2w --json\n\n# Page: continue from the timestamp the previous page ended on.\ndench crm activity company <entryId> --limit 50 --json # → nextBoundary\ndench crm activity company <entryId> --limit 50 --before <nextBoundary> --json\n\n# One bounded read for a summary: fields, existing Brief, newest activity, notes.\ndench crm entries get company <entryId> --with-context --compact --json\n```\n\nRules for agents:\n\n- **Use the attached saved packet first.** Otherwise, `brief --with-context --json`\n reads or assembles the packet in one backend operation without inference. For more detailed ledger evidence,\n `entries get --with-context\n --compact` includes the existing Brief, recent activity and notes in one client request. The API supports `?withContext=true` on entry reads.\n Answer from it when supported. Read a specific activity page/source when needed\n evidence is missing or clipped; use live tools only for a relevant unsynced gap.\n Do not automatically chain brief, activity, sync diagnostics and live search.\n- **Comments and notes are context by default.** They are on the same\n timeline as emails; do not treat only the `Notes` document as \"the\n notes\" — the dated entries below it are where most of the story lives.\n- **You only see what you may see — and that is most things.** Everything\n a member connects (emails with bodies and recipients, calendar events,\n LinkedIn messages) syncs to the workspace by default. Privacy is an\n opt-out, per owner: the whole connection (\"Private\" on its card) or one\n record (below). Rows marked `visibility: owner_only` belong to their\n owner and never appear for anyone else. An empty email history is not\n proof nothing happened — say \"nothing shared with the workspace\".\n- **Hiding your own emails with one record** (`dench crm privacy hide\n <object> <entryId>`; `show` undoes it; `status` reads it) keeps YOUR\n connections' threads that involve the record to yourself, for other\n members. An account covers every contact and opportunity linked to it\n through `Company` / `Account` (a contact then reads `Hidden with\n <Account>` and is shown again from the account). Colleagues' threads\n about the same record are untouched. Existing rows are restamped, new\n ones land hidden at ingest, and the Inbox tab agrees with the ledger.\n Only a member who owns a connection has anything to hide; API keys and\n agents cannot toggle it.\n- Every row carries `at`, a `type` (`comment` | `change` | `activity`),\n and for external touches a `kind` (`email_in`, `email_out`,\n `calendar_event`, `calendar_notice`, `meeting`, `slack_message`,\n `linkedin_in`, `linkedin_out`, `linkedin_connection` — a connection\n request sent / received / accepted), `title`, `snippet`,\n `participants[]`, `direction` and\n a `sourceEntryId` you can open with `dench crm entries get\n <sourceObjectName> <sourceEntryId>` for the full body.\n- The list is ordered by time, newest first for you (`--order asc` gives\n the human's reading order). Cite rows by `at` + `kind` when you answer.\n\n## Notes on the timeline (titled entries — research goes HERE)\n\nA **note** is a comment with `kind: \"note\"` and a `title`: a titled,\ndocument-style entry on the record's timeline. Humans add them from the\n\"+ Note\" button; you add them with `dench crm notes create`.\n\n```bash\ndench crm notes list company <entryId> --json\ndench crm notes create company <entryId> \\\n --title \"Research — $(date +%Y-%m-%d)\" --body-file /tmp/work/<runId>/acme.md\ndench crm notes update <noteId> --body-file … [--title \"…\"]\n```\n\nRules for agents:\n\n- **Research, dossiers, call prep, summaries you were asked to produce →\n a NEW note.** Do not rewrite the record's `Notes` document to hold them;\n the document is the human's. A dated note keeps the history readable\n and never overwrites what a person wrote.\n- Edit the `Notes` document only when the user asks you to change *that\n document* (\"update the notes\", \"fix the description\").\n- Notes take no replies (comment on the record instead) and appear both\n in the timeline and in the Details \"Notes\" list.\n\n## Entry History / Audit Trail\n\nEvery entry has an append-only audit trail. Use it whenever the user asks\n\"what changed\", \"who changed this\", \"when did this field change\", \"was this\ndone manually or by an agent/automation\", or when you need to understand prior\nedits before making another change.\n\n```bash\n# Newest-first audit trail for one entry.\ndench crm history <object> <entryId> --json\n\n# Include sync/import/system writes that are hidden by default in the UI.\ndench crm history <object> <entryId> --include-system --json\n```\n\nHistory rows include:\n\n- `changeKind`: `create`, `update`, or `delete`.\n- `at`: when the change happened.\n- `actor`: source + identity (`user`, CLI agent session, Dench chat-turn\n harness, automation, gateway enrichment, or system sync/import).\n- `changes`: per-field `before` / `after` values.\n\nDo **not** scrape the visible Activity feed in the browser to answer audit\nquestions. Use `dench crm history ... --json` (or the API endpoint documented\nin `references/API.md`) so you get the complete structured row data and cursor\npagination. If the user specifically asks about system/sync/import behavior,\nadd `--include-system`; otherwise leave it off to match the default UI.\n\n## Comments (the record's conversation)\n\nEvery entry also has a threaded comment feed, shown under Notes in the app\nmerged with the change history. Read it before acting on a record someone\nhas discussed; write to it to leave findings, questions, or a summary for the\nteam — everyone with access to the record sees comments and followers are\nnotified. Bodies are markdown (same renderer as Notes).\n\n```bash\n# Roots newest first, each with its first replies; --replies 0 for roots only.\ndench crm comments list <object> <entryId> --json\ndench crm comments replies <commentId> --json # a whole thread, oldest first\n\n# Comment; mention a member inline so they get notified.\ndench crm comments create <object> <entryId> \\\n --body \"Kickoff went well — [@Bob](/?member=<userId>) can you send the proposal?\"\n\n# Reply in a thread (any depth).\ndench crm comments create <object> <entryId> --reply-to <commentId> --body \"Sent.\"\n\n# Summon Dench into the thread (fire-and-forget; the reply lands as a comment).\ndench crm comments create <object> <entryId> --dench --body \"what's the ARR here?\"\n\ndench crm comments update <commentId> --body \"…\"\ndench crm comments delete <commentId>\ndench crm comments react <commentId> 👍 # toggles your reaction\ndench crm watch <object> <entryId> [--off] # follow / unfollow activity\n```\n\nRules:\n\n- Mentions are markdown links: `[@Name](/?member=<userId>)` (ids from\n `dench members list`). `[@Dench](/?member=dench)` addresses the agent.\n Plain `@Bob` text notifies nobody.\n- When you were summoned from a comment, answer **in that thread**\n (`--reply-to <commentId>`), short, then do the work. Field changes you make\n already show in the same feed — summarize, don't narrate.\n- Commenting or being mentioned auto-follows the record; assignees and\n creators follow too. Followers get `entry_activity` notifications for\n comments and field changes by others (coalesced per actor per 10 min).\n- `[@Dench]` inside a comment authored by Dench never re-summons Dench.\n\n## Tasks\n\nTasks are entries on the protected `task` object, so everything above works\non them (`dench crm entries create task …`, `cells set task <id> Status\n'\"Done\"'`). These shortcuts wrap the same functions the app uses:\n\n```bash\ndench crm tasks mine --json # my open tasks (+ done today)\ndench crm tasks mine --priority high --json # only one priority level\ndench crm tasks list <object> <entryId> --json # tasks linked to a record\ndench crm tasks prepare # start/resume ordered task indexes\ndench crm tasks mine --page --limit 25 --json # cursor page (all open tasks reachable)\ndench crm tasks mine --page --done --json # completed tasks; separate cursor\ndench crm tasks list <object> <entryId> --page --json # record tasks, including parked tasks\ndench crm tasks subtasks <taskId> --page --json # all subtasks, with continuation\ndench members tasks <userId> --page --json # assigned tasks for a member\ndench crm tasks create <object> <entryId> --name \"Send proposal\" \\\n --assignee <userId> --due 2026-09-05 --priority high # creates + links + notifies\ndench crm tasks priority <taskEntryId> medium # or --none to clear\ndench crm tasks complete <taskEntryId>\ndench crm tasks reopen <taskEntryId>\n```\n\nTask list commands without `--page` return a bounded preview (at most 50 open\nand 50 completed rows). For complete traversal, `--page` returns\n`{ page, continueCursor, isDone, preparing }`: pass `--cursor <continueCursor>`\nuntil `isDone`, even after an empty page. Open and `--done` lists have separate\ncursors. `preparing` means ordering is still being built; `tasks prepare`\nstarts or resumes it (the UI does this automatically). API/SDK equivalents are\n`crm.tasks.pageAssigned`, `crm.tasks.pageForEntry`, and `crm.tasks.prepare`.\n\n**Priority.** The default `task` has a `Priority` enum (`Low` | `Medium` |\n`High`, no default). Set it whenever the user says urgent / important /\nASAP / low-key (\"high\" in any casing works; unknown values are rejected with\nthe valid options). Every task list sorts by priority first, so an unset\npriority means \"sorts last\", not \"medium\". Enum sorts follow option order\n(`--sort Priority:desc` = High → Medium → Low), not alphabetical.\n\n**Subtasks.** When the user breaks work down (\"split this into steps\",\n\"add subtasks for X\"), create subtasks — ordinary task rows whose\n`Parent Task` relation points at the parent (one level deep; the field is\ncreated on first use). Don't invent a separate object or a checklist in\nNotes.\n\n```bash\ndench crm tasks subtasks <taskId> --json # list\ndench crm tasks create-subtask <taskId> --name \"Write runbook\" \\\n [--assignee <userId>] [--due YYYY-MM-DD] [--priority low] # inherits the parent's record links\ndench crm tasks parent <taskId> <parentTaskId> # nest an existing task\ndench crm tasks parent <taskId> --none # promote to a top-level task\ndench crm tasks delete <taskId> [--keep-subtasks] # subtasks go with it unless kept\ndench crm query task --where '{\"Parent Task\": \"<parentTaskId>\"}' # the same rows via the generic query\n```\n\nA subtask inherits the parent's record relations (Account / Contact / …),\nnever its Assignee, Due Date, Priority or Notes. Completing every subtask\ndoes NOT complete the parent — mark the parent done explicitly when the user\nasks. \"Subtasks can't have subtasks\" and \"has subtasks of its own\" are the\ntwo errors you'll hit nesting too deep; flatten instead.\n\nDeleting a task processes all its subtasks in bounded batches before removing\nthe parent. If interrupted, earlier batches remain committed; retry the same\ncommand to finish. The returned `deleted`/`promoted` counts cover that invocation.\nDirect callers use the `crm.tasks.deleteTaskComplete` action; the CLI,\nHTTP API and App SDK keep the same command and arguments. The legacy\n`crm.tasks.deleteTask` mutation remains available for bounded atomic work;\nlarger requests fail with upgrade guidance and roll back that mutation.\n\n**Repeating tasks.** When a HUMAN must do something on a cadence (\"every\nMonday send the pipeline report\", \"check in with Ramp quarterly\", \"renew the\ncontract every year\"), make the task repeat. Do NOT build a `dench cron`\nautomation whose only action is creating a task — cron is for work Dench\nitself does on a schedule. The repeat is anchored on the task's due date —\nan undated task gets one automatically (the first day the rule matches from\ntoday; the response says `anchored: true` + `dueDateKey`). The next\noccurrence is a NEW task (the done one keeps its history), created when the\ncurrent one is completed (default) or `--on-schedule` regardless.\n\n```bash\ndench crm tasks repeat <taskId> # show (null = doesn't repeat)\ndench crm tasks repeat <taskId> weekly --on mon,wed [--every 2] # daily | weekdays | weekly | monthly | yearly\ndench crm tasks repeat <taskId> monthly --day last [--ends-after 6 | --until 2026-12-31]\ndench crm tasks repeat <taskId> monthly --nth 2 --on tue --on-schedule\ndench crm tasks repeat <taskId> --rrule \"FREQ=WEEKLY;INTERVAL=2;BYDAY=MO;COUNT=10\" # RFC 5545 subset\ndench crm tasks repeat <taskId> --skip | --pause | --resume | --off\ndench crm tasks create <object> <entryId> --name \"Send report\" --due 2026-09-17 --repeat weekly\ndench crm tasks series [--status active] # every series in the workspace\ndench crm tasks series <seriesId> --occurrences # every task in one series\ndench crm query task --where '{\"_Series\": \"<seriesId>\"}' # same rows via the generic query\n```\n\nRRULE supports FREQ, INTERVAL, BYDAY (with an ordinal for MONTHLY: `2TU`,\n`-1FR`), BYMONTHDAY (-1 = last day), BYMONTH, COUNT, UNTIL; anything else\nis rejected naming the token. A late completion never creates overdue\nwork — the next due date skips forward to today or later. Subtasks can't\nrepeat; put the repeat on the parent and its subtasks copy along.\n\nNotifications you (the run's owner) received are readable too:\n`dench notifications list --filter mentions --json`, `dench notifications read <id>`.\nAssignment is a `mention` (same as an `@`).\n\n## Editing Fields & Enum Options\n\nInspect and change existing fields without recreating them:\n\n```bash\n# List columns (verify names/types before writing).\ndench crm fields list lead --json\n\n# Update a field: description, required, indexed, rename, or replace options.\ndench crm fields update lead \"Status\" --description \"Pipeline stage\" --indexed\ndench crm fields update lead \"Status\" --enum-values '[\"New\",\"Working\",\"Won\",\"Lost\"]'\n\n# Reorder the columns shown in the table view.\ndench crm fields reorder lead Name Email Company Status\n\n# Delete a field (its cells are dropped).\ndench crm fields delete lead \"Legacy Score\"\n```\n\nManage individual options on an existing `enum` field. Prefer these granular\nverbs over resending the whole `--enum-values` array — they preserve colors,\nrow history, and kanban column order:\n\n```bash\n# Add an option (optional hex color + 0-based insert position). For a\n# board-backed Status/Stage field this also creates the matching kanban\n# column in one call — you do NOT need a separate `statuses set`.\ndench crm fields enum-add lead Status \"Nurturing\" --color \"#eab308\" --position 2\n\n# Recolor an option.\ndench crm fields enum-set-color lead Status \"Won\" \"#22c55e\"\n\n# Rename an option — also migrates every entry holding the old value\n# (complete for indexed enums, the default) and renames any matching kanban\n# status. Saved views whose filters pin the OLD label are NOT rewritten —\n# update those view filters after a rename or they silently go empty.\ndench crm fields enum-rename lead Status \"Working\" \"In Progress\"\n\n# Renaming onto an EXISTING option (matched case-insensitively) MERGES:\n# entries migrate onto the surviving option's canonical casing and the\n# duplicate is dropped. This is the canonical way to dedupe/merge two\n# options that mean the same thing.\ndench crm fields enum-rename lead Status \"In Review\" \"Pending\"\n\n# Remove an option. Every entry holding the value has it UNSET (complete for\n# indexed enums, the default) and the matching kanban column is removed —\n# a deleted option never lingers on rows. Rename/merge first if entries\n# should migrate to another option instead of losing the value.\ndench crm fields enum-remove lead Status \"Lost\"\n\n# Set the exact option order (must be a permutation of current values). This\n# is the canonical way to order kanban columns / picker options and keeps any\n# matching crmStatuses rows in sync.\ndench crm fields enum-reorder lead Status \"New\" \"In Progress\" \"Won\"\n```\n\n**Enum values on entry writes.** Cell writes (`entries create/update`,\n`cells set`, imports) canonicalize enum values case-insensitively against the\noption list — writing `\"won\"` stores `\"Won\"` when that option exists. A\ngenuinely NEW value auto-creates the option (auto-colored, see below) and, for\nboard-backed Status/Stage fields, its kanban column — so prefer an existing\noption when one fits: a typo becomes a real option, not an error.\n\n**Enum colors.** An option's color renders as the colored badge on that cell\nin table/list/gallery views. Any option created WITHOUT an explicit color is\nauto-colored server-side: semantic keyword match first (success words like\nDone/Won/Active → green, in-progress words like Working/Contacted → blue,\nrisk words like At Risk/Pending/On Hold → yellow, danger words like\nChurned/Lost/Failed → red, neutral words like Todo/Backlog/New → gray), else\na rotating palette by position so options stay visually distinct. So you can\nusually omit colors entirely. To control them yourself, pass an\n`--enum-colors` array aligned 1:1 with `--enum-values` at create time (see\nField Types above), or change them later with `enum-set-color` (or\n`enum-add --color`). Note that `fields update --enum-values` replaces the\noption list but keeps existing options' colors (matched by label); new\noptions get the auto-color; use `enum-set-color` for explicit changes.\n\nKanban columns are backed by a per-object `crmStatuses` record\n(`dench crm statuses list/set <object>`) that carries its own name + color and\nis the source of truth for board-backed `Status` / `Stage` fields. You almost\nnever edit it directly: the `enum-*` verbs are the single surface and keep the\ncolumns in sync automatically. `enum-add` creates the matching column (and\n`enum-remove` deletes it), `enum-set-color` recolors it, `enum-rename` renames\nit, and `enum-reorder` reorders it — so the table badge and kanban column stay\nin sync from one call. `statuses set` (which updates matching enum\nvalues/colors) is only needed for bulk column edits or to seed a board on a\nfield that has no columns yet.\n\n## Relation-First Modeling\n\nEvery time you create an object or add fields, ask whether another object\nshould be linked. Relation fields are the default foreign-link primitive. Do\nnot store foreign references as bare strings when the target object exists or\nclearly should exist.\n\nAuto-linking defaults:\n\n| If creating or editing | And this object exists | Create this relation field |\n| --- | --- | --- |\n| `people` or `contact` | `company` | `Company` on people -> company (`many_to_one`) |\n| `lead` | `company` | `Account` or `Company` on lead -> company (`many_to_one`) |\n| `deal` or `opportunity` | `people` | `Primary Contact` on deal -> people (`many_to_one`) |\n| `deal` or `opportunity` | `company` | `Account` or `Company` on deal -> company (`many_to_one`) |\n| `task` | `people` | `Assigned Contact` or `Owner` on task -> people/user |\n| `task` | `project` or `deal` | `Related To` on task -> parent (`many_to_one`) |\n| `case` | `people` and `company` | `Contact` and `Account` on case -> people/company (`many_to_one`) |\n| `invoice` or `payment` | `company` | `Company` on invoice/payment -> company (`many_to_one`) |\n| `invoice` or `payment` | `deal` | `Deal` on invoice/payment -> deal (`many_to_one`) |\n| `property` or `listing` | `people` | `Agent` on property -> people (`many_to_one`) |\n| any child concept | its parent concept | relation to parent (`many_to_one`) |\n\nAggressive defaults:\n\n- If the user says \"connect\", \"link\", \"reference\", \"relate\", \"belong to\",\n \"map to\", \"pick from\", or \"tied to\", create a `relation` field.\n- If a field name matches or aliases an existing object, use `relation`.\n- Never model `Company Name`, `Client Name`, `Project Name`, `Deal Name`, or\n `Owner Name` as text if a real target exists.\n- If a field refers to a workspace member, use `user`, not `text`.\n- If a target object does not exist but is central to the workflow, create it\n and link it instead of flattening the data.\n\n## Object Creation Flow\n\n1. Inspect existing objects:\n\n```bash\ndench crm objects list --json\n```\n\n2. Create the object. Always assign a Hugeicons name with `--icon`; pick\n a concrete icon that matches the object's purpose rather than leaving the UI\n to fall back to a generic table icon.\n\n```bash\ndench crm objects create lead --description \"Sales leads\" --default-view kanban --icon target-01 --json\n```\n\n3. Create fields:\n\n```bash\ndench crm fields create lead \"Name\" --type text --required\ndench crm fields create lead \"Email\" --type email --indexed\ndench crm fields create lead \"Company\" --type relation --related-object company --relationship many_to_one --indexed\ndench crm fields create lead \"Status\" --type enum --enum-values '[\"New\",\"Working\",\"Qualified\",\"Lost\"]'\n```\n\n4. Optional kanban statuses (named board columns, each with a color):\n\n```bash\ndench crm statuses list lead --json\ndench crm statuses set lead --statuses '[{\"name\":\"New\",\"color\":\"#94a3b8\"},{\"name\":\"Working\",\"color\":\"#3b82f6\"},{\"name\":\"Qualified\",\"color\":\"#22c55e\"},{\"name\":\"Lost\",\"color\":\"#ef4444\"}]' --json\n```\n\nObject names are usually singular lowercase (`lead`, `deal`, `task`). Protected\nobjects such as `people` and `company` are pre-seeded and cannot be deleted.\n\n`--default-view` accepts `table`, `kanban`, `calendar`, `timeline`, `gallery`,\nor `list`. Pick `kanban` for pipeline-shaped objects with a status enum,\n`table` for dense data, `gallery` for image-forward records.\n\nInspect, rename, and delete objects after creation:\n\n```bash\ndench crm objects get lead --json\ndench crm objects rename lead opportunity\ndench crm objects delete opportunity # protected objects are rejected\n```\n\n## Batch Entry Creation\n\nFor three or more writes, use a batch command. Do not issue dozens of\nsequential `dench crm entries create` calls.\n\nSmall batches (up to 50 rows):\n\n```bash\ndench crm entries create-many people --data '[{\"Name\":\"Jane\",\"Email\":\"jane@example.com\"},{\"Name\":\"Bob\",\"Email\":\"bob@example.com\"}]' --json\n```\n\nMedium batches (50 to 10k rows): write JSON to `/tmp/work/<runId>/`, then call\nthe CLI once.\n\n```bash\ndench crm entries create-many people --file /tmp/work/<runId>/people.json --json\n```\n\nLarge batches (more than 10k rows) or mixed operation types: emit JSONL ops and\nuse the low-level batch endpoint with an idempotency key.\n\n```bash\ndench crm batch --file /tmp/work/<runId>/ops.jsonl --idempotency-key import-people-2026-05-07 --json\n```\n\nEach JSONL line is an operation, for example:\n\n```json\n{\"type\":\"entries.create\",\"objectName\":\"people\",\"data\":{\"Name\":\"Jane\",\"Email\":\"jane@example.com\"}}\n```\n\n## Import & Export\n\n> **Before any bulk import, read\n> [`references/CRM-IMPORT.md`](https://dench.com/references/CRM-IMPORT.md).**\n> This section is only the command reference; the playbook covers staging\n> source files, schema mapping, dedupe keys, verification, and relations.\n\nIf the user provides CSV or JSONL data, import it into CRM. The file is an\ninput, not the final artifact.\n\nCSV cells are strings, so preprocess composite owner labels such as\n`Kumar + Mark` into JSON/JSONL arrays of roster userIds before importing.\nDo not let a flat CSV import collapse shared ownership to one person.\n\n```bash\n# CSV, with a header remap. --map direction is CSV column -> CRM field:\n# {\"<source CSV column>\": \"<CRM field name>\"}.\ndench crm import people --csv input.csv --map '{\"Email\":\"Email Address\"}' --json\n\n# JSONL (one object per line).\ndench crm import people --jsonl rows.jsonl --json\n\n# Conflict policy + dedupe key. --on-conflict is skip (default) | update |\n# error. --dedupe-key <CRM field> matches existing field values, including\n# records created manually or through another CLI command. Pick email for\n# people/leads, domain for companies, or a source-system row id.\ndench crm import people --csv input.csv \\\n --dedupe-key \"Email\" --on-conflict skip --json\ndench crm import people --csv input.csv \\\n --dedupe-key \"Email\" --on-conflict update --json # upsert\n```\n\n`--on-conflict` semantics, per matched row:\n\n- `skip` (default) — leave the existing entry untouched, count it in\n `skipped`.\n- `update` — merge the incoming row's fields onto the existing entry\n (upsert). Re-running the same import with the same `--dedupe-key` is\n therefore safe and idempotent.\n- `error` — abort loudly on the first conflict.\n\n`--dedupe-key` names the CRM field **after `--map`**. Matching trims and\nlowercases string values; it does not perform fuzzy matching or remove\npunctuation. Choose a scalar identifier field: `text`, `email`, `phone`,\n`url`, a single-select `enum`, or `number`. Incoming values must be\nnon-blank strings or finite numbers; arrays, objects, and booleans are\nrejected. Multiple records with the same normalized value cause an\nambiguity error instead of picking a row. Number fields compare numeric\nvalues, so a source string `\"01\"` matches stored number `1`.\n\nMatching reads the complete object (up to 200 fields), bounded to 1,000 records and 3 MB\nacross match lookups in one batch. If the lookup cannot finish within\nthose bounds, the batch fails without writing. Do not retry without the\ndedupe key: export and reconcile the records explicitly instead. Each\nbatch is atomic; earlier batches may already have committed when a later\nbatch fails. Retry keys are retained, and a retry key pointing at a\ndifferent row from the field match, or a row whose selected field has\nsince changed, is an error.\n\nWithout `--dedupe-key`, imports use a stable content-hash retry key. That\nprotects an exact reimport, but **does not match existing records by a\nCRM field** or merge a changed source row into its earlier version.\n\nThe import result reports\n`{imported, skipped, updated, errors, sourceRowsParsed}`; the four outcome\ncounts must add up to `sourceRowsParsed`.\n**Always compare those numbers to the source file's row count** — a\n`sourceRowsParsed` lower than the file's line count means the CSV has\nmultiline quoted cells the parser collapsed; stop and fix the source (see\nCRM-IMPORT.md step 1).\n\n`entries create-many` accepts the same `--dedupe-key <field>` and\n`--on-conflict skip|update|error` flags, with the same matching rules.\n`--on-conflict` requires `--dedupe-key` for this command. Its result keeps\n`results[].entryId` and reports `created`, `alreadyExisted`, and `updated`\ncounts when dedupe is enabled.\n\nExport an object when the user wants a file (a report, hand-off or backup), or\nsubstantial offline processing needs one. Ordinary complete lists use projected\ncursor pages (see \"Caps & bulk reads\" below):\n\n```bash\ndench crm export deal --format csv > deals.csv\ndench crm export deal --format jsonl > deals.jsonl\n```\n\n`export` pages through the object with real cursor pagination and\nguarantees the **unique-id invariant**: every exported entry id appears\nonce. Catalog counts (`entryCount` / `entries list --with-meta`'s\n`totalCount`) cover the whole object, including records you cannot read;\nthey are not a readable total. Before a destructive decision (dedup,\ndelete, migrate), verify unique ids and read completeness. A scoped export\ncan be truncated; do not proceed on its cap warning or infer missing rows\nfrom a larger catalog count.\n\nDo not write a new CSV to `/workspace` as the answer to \"put this list in the\nCRM\" — import it as rows instead.\n\n## Updating, Appending & Deleting Rows\n\nSingle-row writes:\n\n```bash\n# Update one row (>=1 field required; an empty --data is rejected).\ndench crm entries update people <entryId> --data '{\"Status\":\"Working\"}' --json\n\n# Delete one row, or many rows by id.\ndench crm entries delete people <entryId> --json\ndench crm entries bulk-delete people --ids id1,id2,id3 --json\n```\n\n`bulk-delete` automatically writes a JSONL **snapshot of every deleted\nrow** to a local file before deleting and reports the path as\n`snapshotPath` in its output. Keep that path in your report — it is the\nonly recovery artifact if the deletion turns out to be wrong. Bulk\ndeletes are capped at 200 ids per call; for dedup/merge jobs follow the\nconvergence rules in\n[`references/CRM-IMPORT.md`](https://dench.com/references/CRM-IMPORT.md)\nbefore deleting anything.\n\nUpdate many rows at once:\n\n```bash\ndench crm entries update-many people --updates '[{\"id\":\"entry_1\",\"data\":{\"Status\":\"Working\"}},{\"id\":\"entry_2\",\"data\":{\"Status\":\"Qualified\"}}]' --json\n```\n\nSet many individual cells:\n\n```bash\ndench crm cells set-many people --updates '[{\"entryId\":\"entry_1\",\"field\":\"Email\",\"value\":\"jane@example.com\"},{\"entryId\":\"entry_1\",\"field\":\"Phone\",\"value\":\"+15551234567\"}]' --json\n```\n\n`cells set-many` groups multiple cell edits for the same `entryId` into one\n`entries.update` operation.\n\nAppend to array-shaped cells (`tags`, multi-select `enum`, `relation`) without\nclobbering existing values — `cells set` overwrites, `cells append` adds:\n\n```bash\ndench crm cells append company <entryId> Tags '\"enterprise\"' --json\n```\n\n`entries create-many`, `entries update-many`, and `cells set-many` all accept\n`--file <path.json>` (instead of inline JSON) and `--idempotency-key <key>` so\na retried command never double-writes. The CLI auto-chunks large inputs into\n200-op batches under the hood.\n\n## Write a Script and Execute It\n\nFor transformations, do the looping locally in `/tmp/work/<runId>/` and call a\nbatch surface in chunks.\n\n```bash\ncat > /tmp/work/<runId>/normalize-people.mjs <<'EOF'\nimport { execFileSync } from \"node:child_process\";\nimport { writeFileSync } from \"node:fs\";\n\nconst raw = execFileSync(\"dench\", [\n \"crm\",\n \"query\",\n \"people\",\n \"--limit\",\n \"1000\",\n \"--json\",\n], { encoding: \"utf8\" });\n\nconst rows = JSON.parse(raw);\nconst updates = rows\n .filter((row) => row.fields?.Email)\n .map((row) => ({\n id: row.id,\n data: { Email: String(row.fields.Email).trim().toLowerCase() },\n }));\n\nwriteFileSync(\"/tmp/work/<runId>/people-updates.json\", JSON.stringify(updates));\nexecFileSync(\"dench\", [\n \"crm\",\n \"entries\",\n \"update-many\",\n \"people\",\n \"--file\",\n \"/tmp/work/<runId>/people-updates.json\",\n \"--json\",\n], { stdio: \"inherit\" });\nEOF\nnode /tmp/work/<runId>/normalize-people.mjs\n```\n\nFor mixed create/update/delete operations, emit `ops.jsonl` and run:\n\n```bash\ndench crm batch --file /tmp/work/<runId>/ops.jsonl --idempotency-key <key> --json\n```\n\n## Reading Rows & Cells\n\nReach for the lightweight read surfaces before building a full query:\n\n```bash\n# List rows (default 100). --with-meta includes readable pagination.\ndench crm entries list people --limit 200 --with-meta --json\n# Continue only with an actual returned cursor; keep the same filters.\ndench crm entries list people --limit 200 --with-meta --cursor '<continueCursor>' --json\n\n# Fetch one row by id (all cells + resolved relations).\ndench crm entries get people <entryId> --json\n\n# Read a single cell value.\ndench crm cells get people <entryId> Email --json\n```\n\n`entries list` is a flat read capped at 1000 rows. For filters, projections,\nor sorting use `query` (below); for grouped counts use `aggregate`.\n\n## Who can see a record\n\nEvery object has a `visibility` (`dench crm objects get <name> --json` reports\nit) that decides who can read its records. The same rule applies everywhere a\nrecord can appear — `entries list|get`, `query`, `search`, `aggregate`,\n`reports`, views, the picker and your own tools — so a record you cannot see\nin one place is not reachable from another.\n\n| `visibility` | Who reads a record |\n|---|---|\n| `workspace` (default) | Everyone in the workspace. |\n| `owner_only` | Only the member in the record's `Owner User ID`. |\n| `owner_plus_members` | The owner plus the members listed in `Access Members`. |\n\n- **CRM records are always shared with the workspace.** Companies, people,\n deals, leads, opportunities, cases and custom objects are `workspace`, and\n cannot be made private. Only things from someone's own account can be:\n `meeting` ships as `owner_plus_members` (the recorder plus everyone who was\n on the invite), `calendar_event` as `owner_plus_members` (the calendar's\n owner plus the teammates on its guest list, by their Dench email), and\n `email_thread` has a per-thread sharing chip.\n- **One record can be opened without opening the object.** A `Shared With\n Workspace` checkbox on the entry makes that row read exactly like a\n `workspace` row — for every member, and for a caller with no signed-in\n person. On meetings it is `dench meetings share <id> --workspace`; only\n the owner may share it, and the owner or a workspace admin may make it\n private again (an admin can never open a teammate's meeting), nobody else.\n- Writes stay owner-only on a scoped object: a member on the invite can read a\n colleague's meeting, never edit or delete it (`Only the owner can edit this\n record.`). Creating a record on a scoped object requires a signed-in member.\n- An org-scoped API key or a run with no signed-in person (a shared Slack\n channel) reads `workspace` objects plus any individually shared record, and\n nothing else. If `entries list meeting` comes back empty for you, that is\n why — ask your user to run it or to share the call, do not retry.\n- **Activity is the other grain.** A record everyone can open still carries\n ledger rows (emails, LinkedIn messages, calendar events) that belong to the\n member whose connection produced them. Those are shared with the workspace\n by default; the owner opts out per connection (Outreach → the inbox row's\n Workspace / Private menu) or per record (`dench crm privacy hide|show|status\n <object> <entryId>` — an account covers its contacts and opportunities).\n See \"The Activity Ledger\" above.\n- Only a signed-in workspace admin can change it, and only on `meeting`,\n `calendar_event` or `email_thread` (any other object is refused):\n\n```bash\ndench crm objects update meeting --visibility workspace --json # workspace|owner_only|owner_plus_members\n```\n\nRecords created before a switch to `owner_only`/`owner_plus_members` have no\nowner and are hidden from everyone until one is set; switching back to\n`workspace` shows them again. Say so before running it on an object with rows.\n\n### Meetings are ordinary records\n\n`meeting` rows can be created, updated and deleted like any other entry\n(`dench crm entries create meeting --data '{\"Title\":\"…\",\"Started At\":\"…\"}'`),\nwhether Dench recorded the call or not. Only the recording-specific parts —\ntranscript, action-item checklist, attendance roster — live in side tables,\nreached through `dench meetings …`:\n\n```bash\ndench meetings transcript set <meetingId> --text notes.txt # or --jsonl segments.jsonl\ndench meetings action-items set <meetingId> --items '- [x] Send deck (Hank)'\ndench meetings participants set <meetingId> --people 'Hank <hank@globex.com>; ada@acme.com'\ndench meetings import --jsonl calls.jsonl --dedupe-key \"Granola ID\" # many calls at once\n```\n\n**Meetings are private by default, and that is not a bug to work around.**\nThe `meeting` object is `owner_plus_members`: you see a call if you own it,\nif you were on the invite, or if it has been shared with the workspace. The\nsame rule gates the record, its transcript, its action items and its roster,\nso an empty `dench meetings list` usually means \"none of these are yours\",\nnot \"the query failed\".\n\n```bash\ndench meetings list --shared # calls the whole team can read\ndench meetings share <meetingId> # who can read this one today\ndench meetings share <meetingId> --workspace # open it to every member\n```\n\nOnly the meeting's owner can share one with the workspace; the owner or a\nworkspace admin can make it private again (an admin can only ever make a\nteammate's meeting more private). An organization-scoped API key (the sandbox credential) can do neither — it\ncan READ anything shared with the workspace, and nothing personal. If you\nneed a colleague's call, ask them to share it rather than trying to widen\nthe object.\n\nBefore a bulk import of calls, read `CRM-IMPORT.md` §10 — same seed-key and\n`--on-conflict` rules as any import, plus the meeting-specific ones (run as a\nsigned-in member, attendees are linked never created, timing is not invented).\n\n## Caps & Bulk Reads (read this before \"get me all the rows\")\n\nEvery read surface has a hard server-side cap, and **a `--limit` above the\ncap is clamped, not honored**:\n\n| Surface | Cap | On over-limit |\n| --- | --- | --- |\n| `entries list` | **1000** | clamped — output includes a `limitClamped` warning |\n| `query` preview | **1000** | clamped — output includes a `limitClamped` warning |\n| `query --page` | **100 per page** | continue with `--cursor` through `isDone` |\n| `search` preview | **100** | clamped |\n| `search --select` | **100 per page** | continue with `--cursor` through `isDone` |\n| `export` | none | real cursor pagination through the whole object |\n\nRules:\n\n- **Never assume `--limit N` returned N rows** (or that fewer-than-N rows\n means you have everything). `entries list people --limit 5000` returns at\n most 1000 rows. Check for the `limitClamped` info in the response before\n reasoning about completeness.\n- **Ordinary lists use projected cursor reads:** `query --page --select` or\n `search --select`, repeating the same scope with `--cursor` until `isDone`.\n Empty pages can have continuation. Use aggregates for supported counts and\n grouped summaries. Export for requested files or substantial processing such\n as migrations and dedup jobs; scoped exports may still report a cap warning.\n- `entries list --with-meta` labels catalog `totalCountScope: \"object\"`\n separately from readable `returnedCount`. `visibility` is the object's\n effective policy. Follow `continueCursor` with `--cursor`, preserving\n assignment filters, even after an empty page. `hasMore: false` means the\n readable scan completed; `hasMore: null` with `truncated: true` means a\n capped scoped read has no continuation. Repeating it will not advance.\n Assigned metadata pages cap at 100 rows; unfiltered pages cap at 1000.\n- Legacy `search` previews are capped and never prove completeness. Projected\n search pages explicitly report coverage; use query pages for a whole object.\n\n```bash\n# ❌ Silent data loss: only the first 1000 rows come back.\ndench crm entries list people --limit 999999 --json\n\n# ✅ Ordinary list: project needed fields and follow continueCursor to isDone.\ndench crm query people --page --select Name,Email --limit 100 --json\n\n# ✅ Requested export or substantial processing: complete file, unique IDs.\ndench crm export people --format jsonl > /tmp/work/<runId>/people.jsonl\n```\n\n## Response Shapes (read the right key)\n\nWrite/read envelopes differ per verb. Parse these exact keys — guessing is\nhow \"null entryId\" retry loops create duplicate rows:\n\n| Command | Shape | Read this |\n| --- | --- | --- |\n| `entries list` / `query` | array of rows: `{id, entry_id, objectId, fields: {...}, createdAt, updatedAt}` | `row.id` (alias `row.entry_id`) for the id, `row.fields.<Field>` for cell values |\n| `entries create` | `{entryId, id, objectName, url, href, ...}` | `entryId` (aliased as `id`) |\n| `entries create-many` | `{created, chunks, results: [{entryId, url, href, ...}]}` | **`results[].entryId`** — there is NO top-level `entryId` |\n| `entries update` | `{entryId, ...}` | `entryId` |\n| `entries bulk-delete` | `{count, snapshotPath}` | `snapshotPath` is the recovery snapshot |\n| `import` | `{imported, skipped, errors, sourceRowsParsed, onConflict}` | compare all counts to the source file |\n\n**Retry discipline for `create`:** the response always carries `entryId`\n(and the `id` alias). If your parser got `null`, you almost certainly read\nthe wrong key while **the create itself SUCCEEDED** — do not blindly\nre-run the command. Re-query by name first\n(`dench crm query <object> --where '{\"Name\":\"...\"}' --json`) and only\nretry if the row genuinely does not exist. (This exact blind-retry loop\nonce created a stack of duplicate tasks.) For retryable scripts, pass\n`--idempotency-key <key>` on `entries create` — a retried create with the\nsame key returns the original row instead of writing a second one.\n\n## ID-First Writes (search is discovery-only)\n\nNever write to a row you found by fuzzy search. `crm search` is ranked\nfull-text matching — the top hit for \"Acme\" can be \"Acme Staffing LLC\"\nwhile the user meant \"Acme Corp\", and updating it corrupts a real record.\n\nThe discipline:\n\n1. **Discover** with `search` / `entries list` / `query`.\n2. **Capture the exact `entryId`** (`row.id`) from that read — after\n confirming the row's fields identify the right record (exact email,\n exact domain, exact name).\n3. **Write by `entryId`** — `entries update <object> <entryId>`,\n `cells set <object> <entryId> ...`.\n\nIf discovery is ambiguous (multiple plausible hits, partial name match),\nstop and ask the user or narrow with `query --where` on an exact key —\nnever pick the first search hit and write to it.\n\n## Queries and Search\n\nUse `dench crm query` for structured reads. `--where` is a JSON filter,\n`--select` projects columns, `--sort` takes comma-separated fields (`-` =\ndescending), and `--limit` caps rows:\n\n```bash\ndench crm query lead --where '{\"Status\":\"Qualified\"}' --select Name,Email,Score --sort '-Score' --limit 100 --json\n```\n\nOne-shot queries return an array of up to `--limit` rows (maximum 1,000).\nThey read bounded server pages; a requested sort considers every matching\ncandidate. For complete lists, use `--page` (maximum 100 rows per response) and pass\nthe returned `continueCursor` to the same query with `--cursor`. The JSON\nresponse is `{ page, isDone, continueCursor }`. Keep going until `isDone`,\neven if a filtered page is empty. Cursor scans use index order: omit `--sort`.\nUse `--select` to avoid transferring large Notes or rich-text fields.\n\nFor scoped searches, `dench crm search \"query\" --object people --select\n\"Name,Email\" --selection-mode compact --json` can recover an unknown selected\nname in the same request. It returns a bounded preview using real column names,\nplus `selectionFallback` with the requested and unresolved names, available\nschema, omitted column count, and any clipped values. `selectedFields` describes\nthe columns actually returned. It never guesses that `Title` means `Headline`\nor `Job Title`, or represents an unknown column as an empty cell. A clipped\nvalue is only a preview; read the exact record for its full value.\n\nHarness agents receive a bounded live field catalog before each model step,\nand their scoped `search --select` commands enable this recovery automatically.\nOrdinary CLI/API calls remain strict by default. Use `--selection-mode strict`\nto require exact projections inside an agent-run script as well. Explicit CLI\nselection mode requires both `--object` and `--select`; unscoped searches and\nlegacy full-row reads keep their existing behavior. The paged search API accepts\nthe equivalent `selectionMode: \"compact\" | \"strict\"`, requiring `objectName` and\n`select` when supplied.\n\n```bash\ndench crm query lead --page --select Name,Email --limit 100 --json\ndench crm query lead --page --select Name,Email --limit 100 --cursor '<continueCursor>' --json\n```\n\nAPI/Apps: `crm.queryPage` (`POST /v1/crm/query/page`) accepts `objectName`,\n`dsl` or `dslJson`, and `paginationOpts: { cursor: null, numItems: 100 }`.\n`dench.api.call(\"crm.queryPage\", args)` exposes the same cursor envelope.\nChanging the filter, selection, object, or viewer requires a fresh cursor.\n\n`--where` supports operators, not just bare equality. Available operators:\n`$eq`, `$ne`, `$in`, `$nin`, `$gt`, `$gte`, `$lt`, `$lte`, `$exists`,\n`$startsWith`, `$endsWith`, `$contains`, plus the logical combinators `$and`\nand `$or`:\n\n```bash\n# Numeric range + set membership.\ndench crm query lead --where '{\"Score\":{\"$gte\":50},\"Status\":{\"$in\":[\"New\",\"Working\"]}}' --json\n\n# Array membership. Use this for `tags`, multi-select `enum` fields,\n# multi-user fields, and many-to-many relation ids.\ndench crm query task --where '{\"Tags\":{\"$contains\":\"bug\"}}' --json\ndench crm query task --where '{\"Assignee\":{\"$contains\":\"<userId>\"}}' --json\n\n# OR across clauses.\ndench crm query deal --where '{\"$or\":[{\"Stage\":\"Won\"},{\"Amount\":{\"$gt\":100000}}]}' --json\n\n# Substring match + field presence.\ndench crm query people --where '{\"Email\":{\"$endsWith\":\"@acme.com\"},\"Phone\":{\"$exists\":true}}' --json\n```\n\nDate fields — and the system timestamps `created_at` / `updated_at`, which\nevery entry has — support three dedicated operators:\n\n- `$datePreset` — a dynamic calendar-anchored range resolved at query time:\n `today`, `yesterday`, `tomorrow`, `this_week`, `last_week`, `next_week`,\n `this_month`, `last_month`, `next_month`, `this_quarter`, `last_quarter`,\n `this_year`, `last_year` (weeks start Monday).\n- `$inLast` — rolling window ending today. Value is a day count (`7`) or\n `{\"amount\": 2, \"unit\": \"weeks\"}` with unit one of\n `days|weeks|months|quarters|years`.\n- `$inNext` — the mirror-image rolling window starting today.\n\n```bash\n# Leads created in the last 7 days.\ndench crm query lead --where '{\"created_at\":{\"$inLast\":7}}' --json\n\n# Leads updated this month (calendar month, not last 30 days).\ndench crm query lead --where '{\"updated_at\":{\"$datePreset\":\"this_month\"}}' --json\n\n# Deals closing next quarter.\ndench crm query deal --where '{\"Close Date\":{\"$inNext\":{\"amount\":1,\"unit\":\"quarters\"}}}' --json\n\n# Combine with other clauses: stale open deals.\ndench crm query deal --where '{\"$and\":[{\"Stage\":{\"$nin\":[\"Won\",\"Lost\"]}},{\"updated_at\":{\"$datePreset\":\"last_month\"}}]}' --json\n```\n\n`created_at` / `updated_at` also work in `--select` and `--sort`\n(`--sort -created_at`).\n\n(The CLI auto-routes any `$`-operator filter through an internal JSON string\nbecause the backend's wire format rejects `$`-prefixed object keys — just pass the\nfilter; you don't have to do anything special.)\n\nThe in-chat `query_crm` tool is for quick inspection only. Once you need\nfilters, sorting, pagination, or writes, use `dench crm`.\n\nBefore filtering, inspect the field schema with\n`dench crm fields list <object> --json`. If the field type is `tags`, an\n`enum` with `enumMultiple: true`, a multi-user field, or a many-to-many\n`relation`, the cell value is an array. Query membership with `$contains` (or\n`$in` for any-of checks) instead of assuming scalar equality. Scalar\nenum/status fields can use direct equality such as `{\"Status\":\"Open\"}`.\n\nUse full-text search when you have a name or phrase:\n\n```bash\ndench crm search --object people 'jane' --json # omit --object to search org-wide\n```\n\nUse aggregates for grouped counts or summaries. They read pre-computed\nbuckets, so they are exact and instant at any table size; `--sum <number\nfield>` totals that field per bucket (Amount by Stage):\n\n```bash\ndench crm aggregate deal --field Stage --json\ndench crm aggregate deal --field Stage --sum Amount --json\n```\n\n## Transactions\n\nUse transactions when multiple operations must succeed or fail together.\n\n```bash\ndench crm transaction --file /tmp/work/<runId>/ops.json --commit --json\n```\n\nUse this for atomic schema/data changes where partial completion would leave an\nunusable CRM.\n\n## Saved Views\n\nObjects can have saved views — a named filter + sort + pinned rows that power\nthe UI's table/kanban tabs. Views are org-wide (every member sees the same\ndropdown), so give them self-descriptive names (\"Q4 outreach: SF founders\",\nnot \"my list 3\"). Read them from the CLI:\n\n```bash\n# List the views defined on an object.\ndench crm views list deal --json\n\n# Inspect one view's definition.\ndench crm views get deal \"Open pipeline\" --json\n\n# Materialize a view's rows (applies its filters + sort), paginated.\ndench crm views entries deal \"Open pipeline\" --page 1 --page-size 100 --with-meta --json\n```\n\nLarge saved views are completed across byte-bounded read transactions, including\nglobal sorting and filtering. `--with-meta` includes `continueCursor`, `isDone`,\n`startedAt`, and `completedAt`. Pass `--cursor '<continueCursor>'` with the next\n`--page` to avoid retaining a deep page's entire sort-key prefix. These are\nobservations across transactions, not an atomic snapshot. Unindexed views scan\nthe object; the web table shows completion/freshness and offers explicit Refresh.\nOversized responses or sort keys fail with a page-size/cursor instruction rather\nthan silently dropping rows. Older CLI builds should be updated for this path.\n\nCreate, update, and delete views from the CLI too:\n\n```bash\n# Create a view. --where is equality-map sugar: the operator per field is\n# picked from the schema (enum -> is, text -> equals, number -> eq,\n# boolean -> is_true/is_false, relation -> has_any, date -> on).\ndench crm views create lead \"Hot leads\" \\\n --where '{\"Status\":\"Hot\"}' \\\n --sort -created_at \\\n --json\n\n# Full AND/OR logic via --filters (a FilterGroup). --columns curates the\n# visible columns; --type switches the layout (table|kanban|calendar|\n# timeline|gallery|list); --settings carries view-type settings such as\n# the kanban grouping field.\ndench crm views create deal \"Big open deals\" \\\n --filters '{\"id\":\"g1\",\"conjunction\":\"and\",\"rules\":[\n {\"id\":\"r1\",\"field\":\"Stage\",\"operator\":\"is_none_of\",\"value\":[\"Won\",\"Lost\"]},\n {\"id\":\"r2\",\"field\":\"Amount\",\"operator\":\"gte\",\"value\":50000}]}' \\\n --sort '[{\"field\":\"Amount\",\"direction\":\"desc\"}]' \\\n --columns \"Name,Stage,Amount,Owner\" \\\n --type kanban --settings '{\"kanbanField\":\"Stage\"}' \\\n --set-active --json\n\n# Update merges the provided flags over the existing definition\n# (untouched keys survive). Creating over an existing name fails unless\n# you pass --replace.\ndench crm views update lead \"Hot leads\" --sort -Score --json\n\n# Rename keeps the whole definition (filters, pinned rows, sidebar slot,\n# active-view pointer) and just swaps the name. `update` can't do this —\n# it upserts BY name.\ndench crm views rename lead \"Hot leads\" \"Q4 hot leads\"\n\n# Delete is idempotent and clears the active-view pointer if it pointed\n# at the deleted view.\ndench crm views delete lead \"Hot leads\"\n```\n\nFilter-rule operators by field type: text/url `contains, not_contains,\nequals, not_equals, starts_with, ends_with, within` (`within` reads the\ncell as a place and matches when it lies inside the named country, state\nor city — `{ \"field\": \"HQ\", \"operator\": \"within\", \"value\": \"California\" }`\nmatches \"San Francisco, CA\" and \"Palo Alto\"); number `eq, neq, gt, gte, lt,\nlte, between`; date `date_preset, relative_past, relative_next, before,\nafter, on, date_between`; enum `is, is_not, is_any_of, is_none_of`; boolean\n`is_true, is_false`; relation `has_any, has_none, has_all`; universal\n`is_empty, is_not_empty`. Every rule and group needs a short unique `id`.\n\nDate rules can be dynamic:\n\n- `date_preset` takes a calendar-anchored `value` resolved every time the\n view materializes: `today`, `yesterday`, `tomorrow`, `this_week`,\n `last_week`, `next_week`, `this_month`, `last_month`, `next_month`,\n `this_quarter`, `last_quarter`, `this_year`, `last_year` (weeks start\n Monday).\n- `relative_past` / `relative_next` are rolling windows anchored to today,\n using `relativeAmount` + `relativeUnit`\n (`days|weeks|months|quarters|years`).\n- Rules may target the system timestamps `created_at` / `updated_at`\n (\"Created\" / \"Updated\" in the UI) like any date field.\n\n```bash\n# Leads created in the last 14 days, as a shared view.\ndench crm views create lead \"New this fortnight\" \\\n --filters '{\"id\":\"g1\",\"conjunction\":\"and\",\"rules\":[\n {\"id\":\"r1\",\"field\":\"created_at\",\"operator\":\"relative_past\",\"relativeAmount\":14,\"relativeUnit\":\"days\"}]}' \\\n --json\n\n# Deals updated this month.\ndench crm views create deal \"Touched this month\" \\\n --filters '{\"id\":\"g1\",\"conjunction\":\"and\",\"rules\":[\n {\"id\":\"r1\",\"field\":\"updated_at\",\"operator\":\"date_preset\",\"value\":\"this_month\"}]}' \\\n --json\n```\n\nUse a view when the user refers to a board/tab they already set up (\"the open\npipeline view\"); use `query` when you need an ad-hoc filter. `--set-active`\nlands the user on the new view next time they open the object — use it when\nthey asked to see the view now, skip it for background batch views.\n\n## The Sidebar (workspace app rail)\n\n**You can change the user's sidebar. Do it — never tell them to click the\n`⋯` menu themselves.** \"Add a tab on the left for Leads\", \"pin Deals to\nmy sidebar\", \"I can't see Tasks\", \"get this off my sidebar\", \"archive\nthat view\" are all requests you complete, not requests you explain.\n\nThe rail uses **progressive disclosure**. Home is a short fixed set —\nTo-Do(s), Automations, Meetings, Outreach (drill-in: Campaigns, Inbox,\nAccounts, Newsletters), Library (drill-in) — then a **Pinned** shortcut\nstrip, then recent chats.\nCRM objects, saved views, and installed apps live **inside Library**.\nThey are not on the home rail unless you pin them there.\n\n**\"Add a left-rail tab\" / \"I can't see X\" = home Pinned strip**, not\nLibrary order. `pin_sidebar_item({ pinnedToSidebar: true })` (or\n`dench crm sidebar pin <nav-id>`) is the call. Putting a row first in\nLibrary (`position: \"top\"` alone) does **not** make it visible on home.\nSettings is not a rail row — it lives in the org menu at the bottom of\nthe rail and in ⌘K.\n\nIn chat, use the structured tools (fastest, and the rail updates live):\n\n| Tool | Use for |\n| --- | --- |\n| `list_sidebar_items` | **Call this first.** Library rows in tree order, `sidebarPins` / `pinnedToSidebar` for the home strip, plus what's hidden and why |\n| `pin_sidebar_item` | Put a Library row on the rail. `pinnedToSidebar: true` adds it to the home Pinned strip. `position` (`\"top\"`, `\"bottom\"`, or `\"3\"`) reorders it **inside Library** |\n| `remove_sidebar_item` | Take a row out of Library — archives a CRM object/view, unpins an app. `pinnedToSidebar: false` only removes the home shortcut |\n\n`list_sidebar_items` first, every time. It gives you the exact `objectName` /\n`viewName` spellings, current Library positions, and whether the row is\nalready on the home strip, so you don't have to guess whether \"Deals\" is\nan object, a saved view, or already archived.\n\n`pin_sidebar_item` with only a `position` is how you **reorder** a row\nthat's already in Library — there's no separate move tool. That is not\nhow you add a home-level tab.\n\n### What backs each row\n\nThree different pieces of state, which is why \"pin this\" can touch more than\none:\n\n- **An object row** shows in Library unless the object is archived.\n- **A saved view row** shows in Library only when the view is `pinned` and\n not archived. Creating a view does NOT put it in Library; pinning does.\n- **Home Pinned strip** is a separate, workspace-shared list of Library\n nav ids (`sidebarPins`). A row can sit in Library without being on\n home.\n\n### Two scopes — say which one when you confirm\n\n- **Archiving, view/app pinning, and home-strip pins are TEAM-SHARED.**\n Archiving hides the Library row for every member. A home pin is a\n shortcut for the whole workspace. Worth stating plainly: *\"Pinned\n Leads to the left rail — everyone on the team will see it under\n Pinned.\"*\n- **Library row order is admin-only and workspace-shared.** Reordering\n moves the shared Library tree.\n\n### Archive is not delete\n\nArchiving is presentational and fully reversible: the table, its rows,\nsearch, relations and every direct link keep working. The row just moves into\nthe rail's **Archived** flyout, from which anyone can restore it (and\n`pin_sidebar_item` restores it too). Never describe it as deleting data.\n\nTo actually destroy things you need the CRM verbs, not the sidebar ones:\n`dench crm views delete` drops a saved view; `dench crm objects delete` drops\na table (and refuses when it still has rows).\n\n### What you can move\n\nLibrary rows: CRM object rows, pinned CRM view rows, installed Dench Apps.\nTo sort Library, call `pin_sidebar_item` once per row in the order you\nwant them (admin-only). To put one on the home rail, also pass\n`pinnedToSidebar: true`.\n\nTo-Do(s), Automations, Meetings, Outreach, and Library are\n**fixed home-level tabs**, and Inbox is a fixed row inside Outreach.\nThey are not Library rows and cannot be pinned, moved, or removed.\n\nRemoval differs by kind:\n\n- **object / view** → archived (reversible, restorable from the flyout).\n- **app** → unpinned from Library. It stays installed and reachable from\n Marketplace; nothing is uninstalled.\n- **home-strip pin** → `pinnedToSidebar: false`. The row stays in Library.\n\nApps are addressed by `appSlug`, which `list_sidebar_items` returns on each\napp row — not by their display name.\n\n### From a sandbox / script\n\n```bash\n# What's in Library, what's hidden, and what's on the home Pinned strip.\ndench crm sidebar list --json\n\n# Reposition one Library row. Nav ids come from `sidebar list`.\ndench crm sidebar move crm-object:task top\ndench crm sidebar move crm-people 3\n\n# Add / remove a home-level shortcut (the \"tab on the left\"). Does not\n# move the row inside Library.\ndench crm sidebar pin crm-object:lead\ndench crm sidebar unpin crm-object:lead\n\n# Library visibility (which rows show in the sidebar) — not record access;\n# for who can READ records see \"Who can see a record\".\ndench crm objects archive deal # off Library (team-shared)\ndench crm objects unarchive deal # back on\n\ndench crm views pin lead \"Hot leads\" # make the view a Library row\ndench crm views unpin lead \"Hot leads\"\ndench crm views archive lead \"Hot leads\"\n```\n\n## Enrichment\n\nFor bulk profile lookup or company research without writing CRM rows:\n\n```bash\ndench crm enrich profiles --kind companies --lookups '[{\"domain\":\"stripe.com\"}]' --json\ndench crm enrich profiles --kind people --file people-lookups.json --json\ndench companies related --domain stripe.com --kind founders --limit 10 --json\ndench companies related --domain stripe.com --kind funding --limit 10 --json\n```\n\nBulk input is an array of 1–100 identifiers: people use `linkedinUrl` or `email`;\ncompanies use `domain` or `linkedinUrl`. Each result retains `inputIndex`; a\ngenuine miss has `data: null`. This buys profiles, not email/phone discovery.\nCompany relations support `employees`, `founders`, `funding`, `investors`,\n`acquisitions`, and `investments`; continue with `--page-token` and the same\nfilters and limit. Provider selection and schemas stay behind Dench adapters.\nContact lookup, CRM import, and outreach remain separate explicit actions.\n\nDench can auto-fill people and company fields (contact details,\nfirmographics, profiles) through the enrichment gateway. There\nare two layers.\n\n1. **One-off enrichment** of a single cell, or of a whole column across rows:\n\n```bash\n# Fill one cell. --input-field is the identifier column to look up from\n# (e.g. Email or Domain); --category picks the provider family.\ndench crm enrich cell people <entryId> \"LinkedIn URL\" --input-field \"Email\" --category people --json\n\n# Fill a column for every row missing it (default). --all also re-enriches\n# populated cells; --overwrite replaces existing values; --limit caps work.\ndench crm enrich object people --field \"LinkedIn URL\" --input-field \"Email\" --category people --limit 100 --json\n```\n\nProvider selection is automatic. Contact cells (email/phone) and\nprofile fields go through the same Dench enrich waterfall. For a\nnon-standard response path, pass `--response-path <path>`.\n\n2. **Field-bound enrichment** so a column knows how to fill itself. Attach the\nbinding at field create/update time, then enrichment runs without re-specifying\nthe mapping:\n\n```bash\ndench crm fields create people \"Title\" --type text \\\n --enrichment-category people --response-path person.title --input-field \"Email\"\n\ndench crm fields update people \"Title\" --clear-enrichment # detach later\n```\n\nPeople/company shortcuts wrap the same machinery:\n\n```bash\ndench crm people search 'jane doe' --json\ndench crm people upsert --data '{\"Email Address\":\"jane@acme.com\",\"Name\":\"Jane\"}' --json\ndench crm people enrich <entryId> --field \"LinkedIn URL\" --input-field \"Email Address\" --json\n\ndench crm companies search 'acme' --json\ndench crm companies upsert --domain acme.com --name Acme --json\ndench crm companies enrich <entryId> --field \"Company Name\" --input-field Domain --json\n```\n\n## Reports\n\nGenerate chart-ready JSON (the same shape the dashboard widgets render):\n\n```bash\n# Count rows per Stage as a pie chart.\ndench crm reports generate \"Deals by stage\" --object deal --type pie --group-by Stage --json\n\n# Sum a numeric field per group as a bar chart.\ndench crm reports generate \"Revenue by stage\" --object deal --type bar \\\n --group-by Stage --metric sum --metric-field Amount --json\n```\n\n`--type` is `pie|bar|line|table`; `--metric` is `count` (default), `sum`,\n`avg`, `min`, or `max` (every non-`count` metric needs `--metric-field`).\n`sum` and `avg` of one field grouped by another (\"Amount by Stage\") read the\npre-computed per-bucket sums, so they are exact at any table size; the\nresponse's `truncated` is `true` only when a bounded row scan had to stand in\n(a scoped object, or an object whose buckets are still being built).\n\nReports are one-shot JSON for scripts. Anything a person will LOOK at —\nin chat or on the table — goes through **Analytics** below.\n\n## Analytics (the dashboard above every table)\n\nEvery CRM object carries a dashboard: KPI stats in the header row plus chart\ncards (gauge / donut, bar, funnel, leaderboard, trend line/area, forecast,\nworld map) on a 6-track grid. Everything the dashboard can do in the UI —\ncreate, edit, hide from / show on the dashboard, resize, reorder, delete a\nchart, and change the object's shared analytics setup — has a CLI verb, a\nREST path and an App SDK method with the same names, so an agent can do it\nfrom a chat as readily as a person can from the card's ⋮ menu. It is\ndeclarative — a panel names a metric, an optional group-by, an optional date\nbucketing and optional filters in the same `FilterGroup` shape saved views\nuse. No SQL. One query (`computePanels`) is the math for the UI, the CLI, the\nAPI, the in-chat chart card and the app bridge, so a number is the same\nnumber everywhere. The full set (including hidden charts) opens in a sheet:\nthe strip's ⤢ button, or `/?path=<object>&analytics=1`.\n\n**Read the dashboard**\n\n```bash\ndench crm analytics get deal --json # panels (with span/hidden), field roles, fields you may bucket on\ndench crm analytics get company --view Customers --json # + that view's own dashboard (viewAnalytics; null = inherits)\n```\n\n**Compute** — chart-ready buckets / series / values. This is how you answer\n\"how many\", \"by source\", \"pipeline\", \"who\", \"over time\", \"where\":\n\n```bash\n# The whole stored dashboard, scoped to this month (previousValue = last month)\ndench crm analytics compute deal --period this_month --json\n\n# One or two stored panels (ids from `analytics get`)\ndench crm analytics compute deal --panel tpl:sales:open-pipeline --panel tpl:sales:win-rate --json\n\n# A saved view's dashboard, following the view's filters\ndench crm analytics compute company --view Customers --period this_quarter --json\n\n# Ad-hoc panels when no stored panel answers the question (nothing is saved)\ndench crm analytics compute lead --panels '[\n {\"title\":\"New leads by source\",\"type\":\"donut\",\"groupBy\":\"Source\"},\n {\"title\":\"Leads per week\",\"type\":\"line\",\"dateField\":\"$createdAt\",\"dateBucket\":\"week\"},\n {\"title\":\"Where they are\",\"type\":\"map\",\"groupBy\":\"$location\"}\n]' --period this_quarter --json\n```\n\n`--period` is `this_week | this_month | last_month | this_quarter |\nlast_quarter | this_year`. It scopes every panel by a `date_preset` on the\nobject's `closeDate` role (else the synthetic `$createdAt`) and fills each\npanel's `previousValue` from the previous calendar interval — exactly what\nthe strip's period pill does. `--filters '<FilterGroup>'` adds a view's rules\nto both windows. Each panel carries `source`: `aggregate` (pre-computed\nbuckets — counts, sums, averages, group-bys, month-or-coarser series and\nevery derived metric; exact at any table size), `scan` (the newest rows) or\n`snapshot` (a background pass over every row). The response carries\n`truncated: true` only while some `scan` panel could not see every row; on\nsuch a table a snapshot is requested automatically (`snapshot.stale`) and the\nnext call is exact. `link` is the deep link that opens this dashboard in the\napp.\n\n### Panel definition — every setting the chart editor has\n\nUsed by `--panels`, `save --panel` and (any subset, `null` to clear) by\n`update --patch`:\n\n| key | values | in the editor |\n| --- | --- | --- |\n| `title` | text | Title |\n| `type` | `stat` `donut` (Gauge) `funnel` (Flow) `line` (Trend) `area` `map` `bar` (Bars) `leaderboard` (Ranking) `forecast` | Chart type |\n| `metric` | `count` (default) `sum` `avg` `min` `max`; `sum/avg/min/max` need `metricField` (a number field) | Metric + Number field |\n| `derived` | `conversion_rate` `win_rate` `won_amount` `lost_amount` `open_pipeline` `pipeline_forecast` `mrr` `arr` — computed from the object's field roles; `metric`/`metricField` are ignored when set | Metric (the \"derived\" group) |\n| `groupBy` | the breakdown: an enum / user / relation / boolean / text field. On a `map` it is the **place field** (`$location` = the object's `location` role). On `line` / `area` / `forecast` it **splits the series** into one line per value | Group by / Place field / Split lines by |\n| `dateField` + `dateBucket` | a date field or `$createdAt`; `day` `week` `month` `quarter` (default `month`). Required for `line` / `area` | Date field + bucket |\n| `filters` | panel-scoped `FilterGroup` (saved-view shape). The editor writes one rule (`is`, `is_not`, `date_preset`, `is_true`, `is_false`) and keeps any richer group you saved from here | Filter |\n| `span` | card width on the 6-track grid: `2` (⅓) `3` (½) `4` (⅔) `6` (full). Omit for the default by chart kind: funnel 4; map and leaderboard 2; bar/donut grouped on a user field or the owner role (\"by rep\") 2, on anything else (\"by source\") 4; trends 3 | Width |\n| `hidden` | `true` keeps the chart off the strip above the table; it stays in the full analytics view under \"Only here\", counted by the strip's \"+N more\" | Dashboard |\n| `sortOrder` | number; position in the dashboard (use `reorder` to set them all at once) | drag the caption |\n| `id` | stable id; template panels are `tpl:<template>:<slug>`. `save`'s positional `<panelId>` becomes it | — |\n| `size` | deprecated (`sm` `md` `lg`), ignored for layout — use `span` | — |\n\nA count `funnel` on the stage role also returns `amount` per stage (the sum\nof the `amount` role) so the flow reads \"how many\" and \"how much\" at once.\nBuckets keyed by a workspace member (`groupBy` on a user field) render with\nthat member's avatar.\n\nSynthetic fields work anywhere a field name goes: **`$createdAt`** (row\ncreation time — \"new leads this month\" needs no date column) and\n**`$location`** (the `location` role, resolved through one relation hop such\nas `Account.HQ Location`, so deals inherit their account's HQ).\n\n### Edit the dashboard — the card's ⋮ menu from the CLI\n\n```bash\n# Create (or replace) a chart — the whole definition\ndench crm analytics save deal open-pipeline --panel '{\"title\":\"Open pipeline\",\"type\":\"stat\",\"derived\":\"open_pipeline\"}'\ndench crm analytics save deal won-by-rep --panel '{\"title\":\"Won by rep\",\"type\":\"leaderboard\",\"derived\":\"won_amount\",\"groupBy\":\"Owner\",\"span\":2}'\ndench crm analytics save company by-hq --panel '{\"title\":\"Customers by HQ\",\"type\":\"map\",\"groupBy\":\"$location\"}' --view Customers\n\n# Edit part of a chart — only the keys given change, null clears one\ndench crm analytics update deal won-by-rep --patch '{\"title\":\"Won by owner\",\"filters\":null}'\ndench crm analytics update deal tpl:sales:arr --patch '{\"type\":\"line\",\"dateBucket\":\"quarter\"}'\n\n# Hide from / show on the dashboard (the chart stays in the full view)\ndench crm analytics hide deal tpl:sales:forecast\ndench crm analytics show deal tpl:sales:forecast\n\n# Resize — third | half | two-thirds | full, or default (drops the stored span)\ndench crm analytics resize deal tpl:sales:deal-flow full\ndench crm analytics resize deal tpl:sales:where-deals default\n\n# Order and removal\ndench crm analytics reorder deal open-pipeline win-rate won-by-rep tpl:sales:deal-flow # must list EVERY panel of that dashboard, stats included\ndench crm analytics delete deal tpl:sales:deals-by-stage # template panels are tombstoned, never resurrected\n\n# The strip itself (team-shared, like saved views)\ndench crm analytics collapse deal | expand deal\n```\n\nReordering is by full list because the UI persists a full order on every\ndrop; a dropped card also takes whatever width is left in the row it lands\nin (`fitDroppedSpan`) — set `span` explicitly when you want a fixed width.\n\n### The analytics setup shared by every chart and view\n\nField roles are the object-level mapping every derived metric, map and card\ndefault reads — the strip's ⚙ \"Analytics setup\" sheet. They are stored once\nper object, not per chart or per view:\n\n| role | meaning | editor label |\n| --- | --- | --- |\n| `stage` | enum field that tracks progress (\"Stage\", \"Status\") | Progress field |\n| `wonValues` / `lostValues` / `convertedValues` | `stage` options that count as won / lost / converted | Counts as won / lost / converted |\n| `stageProbabilities` | chance of closing per **open** stage, `0..1` (`{\"Discovery\":0.2,\"Proposal\":0.5}`), for the weighted forecast; unlisted stages are spaced evenly, won = 1, lost = 0 | Chance of closing |\n| `amount` | number field to add up (deal amount, contract value) | Value field |\n| `closeDate` | date field for forecasts, MRR/ARR and the period pill (else `$createdAt`) | Date field |\n| `recurrence` | `monthly` (Amount is MRR) `annual` (Amount is ARR) `one_time` (no MRR/ARR panels) | The value is… |\n| `owner` | user field naming who owns each record; rankings on it default to a narrow card and draw faces | Person field |\n| `location` | place-name field for the map; may be a relation path like `Account.HQ Location` | Place field |\n\n```bash\n# Replace the whole mapping\ndench crm analytics roles deal --roles '{\"amount\":\"Amount\",\"stage\":\"Stage\",\"wonValues\":[\"Closed Won\"],\"lostValues\":[\"Closed Lost\"],\"closeDate\":\"Close Date\",\"owner\":\"Owner\",\"location\":\"Account.HQ Location\",\"recurrence\":\"annual\",\"stageProbabilities\":{\"Discovery\":0.2,\"Proposal\":0.5,\"Negotiation\":0.75}}'\n\n# Change one role, keep the rest (null clears)\ndench crm analytics roles deal --roles '{\"recurrence\":\"monthly\"}' --merge\ndench crm analytics roles deal --roles '{\"location\":null}' --merge\n```\n\nTemplates set the roles at install; a derived panel whose roles are missing\nanswers `error: \"missing_field_roles\"` (`not_recurring` for MRR/ARR without a\nrecurrence) instead of a number — set the roles, don't guess.\n\n**Dashboards are per object OR per view.** Every view of an object shows the\nobject's shared dashboard until it gets its own:\n\n```bash\ndench crm analytics scope company Customers --mode own # starts as a copy of the object's panels\ndench crm analytics scope company Customers --mode shared # back to the object's\n```\n\n`--view <name>` on `save` / `update` / `hide` / `show` / `resize` / `delete` /\n`reorder` writes THAT view's dashboard (forking a copy on the first edit if it\nwas still inheriting) — so editing Customers never changes Accounts. Field\nroles have no `--view`: they belong to the object. Any active view follows\nits own filters by default, own dashboard or not.\n\n**Showing a chart in chat.** Do not paste numbers or a markdown table when a\nchart can say it. In the web chat, `present_artifact({ kind: \"analytics\",\nobjectName, viewName?, period?, panelIds? | panels? })` mounts the live\nchart card (the same `computePanels`); a `dench crm analytics compute …`\nbash run auto-renders the same card from its stdout. Ad-hoc `panels` get a\n\"Save to dashboard\" button — offer it. Off the web UI (Slack, iMessage, a\nCRM comment) give the headline number in text plus the deep link\n`/?path=<object>&analytics=1[&view=<view>][&analyticsPeriod=<period>]`.\nQuestions the panel model cannot express (joins across objects, custom\nformulas, cohorts, combo/scatter) become a small App SDK widget\n(`present_artifact({ kind: \"app\", html })`, see APPS.md) that calls\n`dench.analytics.compute` for its data — never a `.dench.app` for a donut.\n\n**In a Dench App** (`window.dench`, see APPS.md) the same operations are\n`dench.analytics.get(objectName, { viewName? })`,\n`compute(objectName, { viewName?, period?, panelIds? | panels?, extraFilters?,\ncompareFilters?, drillFilters?, fieldRolesOverride? })`,\n`save(objectName, panelId, panel, { viewName? })`,\n`update(objectName, panelId, patch, { viewName? })`,\n`hide(objectName, panelId, { viewName? })`, `show(…)`,\n`resize(objectName, panelId, span | null, { viewName? })`,\n`delete(objectName, panelId, { viewName? })`, `reorder(objectName, panelIds,\n{ viewName? })`, `roles(objectName, fieldRoles, { merge? })`,\n`collapse(objectName)`, `expand(objectName)`,\n`scope(objectName, viewName, \"own\" | \"shared\")`. `get` + `compute` need\n`crm:read`; the rest `crm:write`. Period expansion and `drillFilters` (the\nstrip's click-to-filter chips: each scopes every panel EXCEPT those whose\ndimensions include the chip's `dimension`) are server-side — apps never\nhand-build date filters. Map panels return place strings; place them with the\nhost-side `dench.geo` resolvers, never a geocoder.\n\nREST: `GET /v1/crm/objects/{object}/analytics`, `POST …/analytics/compute`,\n`PUT|PATCH|DELETE …/analytics/panels/{panelId}`,\n`POST …/analytics/panels/{panelId}/hide|show|resize`,\n`POST …/analytics/reorder`, `PUT …/analytics/roles` (`merge: true` to patch),\n`POST …/analytics/collapse|expand`, `POST …/views/{view}/analytics/scope`.\n\n## Documents\n\nLink workspace markdown files to the CRM as documents, optionally attached to\nan entry:\n\n```bash\ndench crm docs list --json\ndench crm docs create /workspace/notes/acme-brief.md --title \"Acme brief\" --icon file-text --link-entry <entryId> --json\ndench crm docs link /workspace/notes/acme-brief.md --object company --entry <entryId> --json\ndench crm docs delete <documentId> --json\n```\n\n`docs delete` takes the `id` that `docs create` returned (the `_id` in `docs\nlist`). It removes the document page only: the workspace file stays (delete it\nwith `dench files rm` if it should go too), and pages nested under it move up to\nits parent.\n\nFor free-form prose *about* a single entry, prefer that entry's `Notes` field\n(see above). Use documents for standalone files you want discoverable from the\nCRM and linked to a record.\n\n## Templates (one-click CRM setups)\n\nTemplates install a complete, opinionated CRM motion in one call: objects\nwith fields/relations/kanban statuses, extra fields on `company`/`people`,\npinned saved views, deterministic automations, a workspace rule describing\nthe motion, and a few cross-linked sample rows.\n\n```bash\ndench crm templates list --json # catalog + installed flags\ndench crm templates install sales\ndench crm templates remove-sample-data sales\n```\n\n- Installs are **idempotent** and **compose**: re-installing tops up missing\n pieces without duplicating anything, and overlapping templates merge\n (sales + fundraising share the company `Type` enum).\n- The `sales` template is Salesforce-style: it installs Leads,\n Opportunities, Cases, and display-labels the protected `company`/`people`\n spine as Accounts/Contacts. The `service` template can add the same Cases\n object later as a focused support motion.\n- **Sales pipeline work has its own playbook.** For ANYTHING sales-adjacent\n — lead generation, target account lists (TAL), prospect research,\n enrichment, outreach prep, qualification, opportunities, pipeline review,\n forecasting, account/contact research — read `references/SALES.md` (the\n in-workspace `sales` skill) and route the task through the Leads →\n Opportunities → Customers flow. Key rules it enforces: new prospects are\n raw `lead` rows (don't create Account/Contact until a lead is Qualified),\n leads are named `<Person> from <Company>`, qualifying a lead auto-creates\n the Account/Contact/Opportunity, and every lead/contact/account/\n opportunity carries a deep-research `Notes` dossier.\n- Sample rows are tagged `Sample` (in `Tags`) and use seed keys, so\n `remove-sample-data` deletes exactly them — schema, views, and automations\n stay. **Exclude rows tagged `Sample` from real outreach, reports, and\n counts unless the user asks otherwise.**\n- For managed outbound email from CRM rows — campaigns, automatic\n follow-up sequences, sender verification, and `--object/--email-field`\n add-from-object flows — read `references/EMAIL-CAMPAIGNS.md` before\n sending.\n- When a user asks for \"a sales CRM\", \"deal pipeline\", \"investor tracker\",\n or \"client intake\", check `templates list` FIRST and prefer installing a\n template over hand-building objects. For a sales/deal pipeline, install\n `sales` and follow `references/SALES.md`.\n\n## Automations (deterministic rules)\n\nWorkspaces can have deterministic CRM rules that fire **inside entry\nwrites** — e.g. the sales template installs \"lead Status → Qualified\ncreates an Opportunity\" and \"opportunity Stage → Closed Won sets the linked\naccount's Type to Customer\".\n\n```bash\ndench crm automations list --json # rules, fire counts, enabled flags\ndench crm automations disable <automationId>\ndench crm automations enable <automationId>\n```\n\nWhat this means for you:\n\n- A write can have **side effects on other rows**. Write responses include\n an `automationEffects` array describing what was created/updated (and\n rows written by rules carry `updatedBy: \"automation:<rule name>\"`). This\n is expected behavior, not an error or a bug.\n- **Check `automations list` before manually implementing a conversion.**\n If a rule already turns qualified leads into opportunities, just set\n the status and let it fire — creating the opportunity yourself duplicates\n work (rules dedupe, but don't rely on it).\n- Rules only fire on transitions. Bulk imports and template sample data do\n not retroactively fire rules.\n- If a user complains about rows \"appearing on their own\", show them\n `automations list` and offer to disable the rule rather than deleting the\n created rows blindly.\n\n## Actions\n\n`action`-typed fields expose per-entry buttons that run member logic — either a\nno-code recipe of CRM operations (Tier A) or a script/agent (Tier B). Define\nthem with the Basic Action Builder UI, the CLI, the API, or the agent. See the\nfull reference: [`references/ACTIONS.md`](https://dench.com/references/ACTIONS.md)\n(`load_skill actions`).\n\n```bash\n# Create (or upsert) an action — creates the `action` field if it's missing\ndench crm actions create <object> <fieldName> --label \"Mark Won\" \\\n --recipe '[{\"op\":\"update_entry\",\"assignments\":[{\"field\":\"Status\",\"value\":{\"from\":\"static\",\"value\":\"Won\"}}]}]'\ndench crm actions edit <object> <fieldName> <actionId> --label \"…\" # update\ndench crm actions delete <object> <actionId> --field <fieldName> # remove\n\n# List the actions available on an entry\ndench crm actions list <entryId> --json\n\n# Run an action (Tier-A recipes run inline; Tier-B scripts spawn a Dench agent)\ndench crm actions run <object> <fieldId> <actionId> <entryId> [<entryId> ...]\n```\n\nConfig is stored in the field's `default_value` as\n`{ \"actions\": [ { \"id\", \"label\", \"variant\", \"recipe\" | \"script\" } ] }`. The CLI,\nthe API (`/api/v1/crm/actions*`), and the agent all go through the same backend.\n\n## Deep Links (linking & citing CRM records)\n\nEvery CRM surface has a stable workspace URL, so you can send a user\nstraight to it or cite a record as a source. Use the object's **canonical\n`name`** (from `objects list`), not its display label.\n\n```text\nObject list: /<slug>?path=<object>\nSaved view: /<slug>?path=<object>&view=<View Name>\nDashboard: /<slug>?path=<object>&analytics=1[&view=<View Name>][&analyticsPeriod=this_month]\nA record: /<slug>?path=<object>&entry=<object>:<entryId>\nRecord + tab: …&entryTab=notes|history|emails|meetings|activity|outreach|team\nInbox: /<slug>?path=~crm/inbox\nCalendar: /<slug>?path=~crm/calendar\n```\n\n**Do not invent entry URLs.** After `dench crm entries create` /\n`create-many` / `get --json`, paste the returned `url` (absolute,\nshareable) or `href` (relative, in-app). Never invent `?object=…`, never\nuse a bare `entry=<id>` without the `<object>:` prefix, and never build\n`?path=` links by guessing. Optional UI chrome like `&view=…` or\n`&hidden=1` is not part of the canonical entry link — only add those when\nyou intentionally want to land on a specific saved view.\n\nInside the app (chat replies, app links) the slug-less relative form\n`/?path=<object>&entry=<object>:<id>` resolves against the current\nworkspace. To cite a record as the source of a claim, use the numeric\ncitation form: `Deal is in Negotiation [1](/?path=deal&entry=deal:j57xyz).`\nFor the full deep-link map (settings, App Store, apps, automations,\nchats, files), read\n[`references/NAVIGATION.md`](https://dench.com/references/NAVIGATION.md)\n(`load_skill navigation`).\n\n## SQL Escape Hatch\n\nFor quick reads, a flat `SELECT` subset is translated into the query DSL:\n`SELECT <cols> FROM <object> [ORDER BY ...] [LIMIT N]`. Quote field names that\ncontain spaces:\n\n```bash\ndench crm sql 'SELECT \"Full Name\",\"Email Address\" FROM lead ORDER BY _creationTime DESC LIMIT 10'\n```\n\nOnly `SELECT` / `FROM` / `ORDER BY` / `LIMIT` are honored — a `WHERE` clause is\n**not** applied. For any filtering use `query --where` (operators above), and\nfor real SQL run `duckdb` against an exported file.\n\n## Common Pitfalls\n\n- `fields create` takes the field name as a **positional** argument\n (`dench crm fields create lead \"Fit Score\" --type number`); `--name` is\n not a flag on it, and `--`-prefixed field names are rejected.\n- Preview reads are capped. Use projected `query --page` / `search --select`\n with their continuation cursors for ordinary complete answers; export when\n a file or substantial processing is needed. Never infer totals from a limit.\n- `create-many` puts the ids in `results[].entryId` — there is no\n top-level `entryId`. If a parsed `entryId` is null after `create`, the\n create almost certainly succeeded under a different key: re-query by\n name before retrying, or you will mint duplicates.\n- Search is discovery-only. Capture the exact `entryId` from list/query\n and write by id; never update a fuzzy-search hit.\n- Bulk imports go through the CRM-IMPORT.md playbook: stage the file,\n map the schema, pass `--dedupe-key` + `--on-conflict skip|update`, and\n verify `{imported, skipped, errors, sourceRowsParsed}` against the\n source. Never wipe-and-reimport to fix duplicates.\n- Never invent CRM entry URLs. `entries create` / `get` / `create-many`\n return `url` + `href` — paste those. Wrong forms like `?object=task` or\n bare `entry=<id>` (missing `task:`) do not open the record. Canonical:\n `/<slug>?path=<object>&entry=<object>:<entryId>` (see Deep Links /\n `NAVIGATION.md`). If a response has no `url`/`href`, run\n `entries get <object> <entryId> --json` for one. If `create-many` reports\n `linksUnavailable`, the unlinked rows have no id in that response either —\n start with `entries list <object> --json` to recover their `id`. Never fall\n back to guessing a url.\n- The link always uses the object's **canonical** name, which is what the\n server echoes back as `objectName` — not necessarily the name you typed.\n `entries create Tasks …` succeeds (names resolve tolerantly: case,\n plurals, display labels), but the workspace matches object names exactly,\n so only the canonical form opens the record.\n- The write flag is `--data`, not `--fields`. `--fields` is accepted as an\n alias, but use `--data` in new commands.\n- Field names are validated on write: an unknown field is **rejected** with\n a \"did you mean …\" hint (no longer silently dropped), and required fields\n are enforced on create. Run `dench crm fields list <object>` first; the\n default `task` uses `Name`/`Assignee`, and some workspaces rename fields\n (e.g. `Title`). Aliases (`name`/`title` → the title field, `owner` → the\n assignee field, any case) resolve server-side; `--allow-unknown` bypasses\n both the check and the aliases.\n- Never default to CSV-on-disk for structured data. Use CRM rows.\n- `people`, `company`, and `task` are protected objects and cannot be deleted.\n- Objects can carry a UI-only `displayName` (\"Clients\" for `people`). Use the\n **canonical name** from `objects list` in commands; don't conclude an\n object is missing just because the user's label isn't in the name column.\n- New rows appearing after a status change are usually a CRM automation\n firing (see `dench crm automations list`), not a bug — and not something\n to re-create by hand.\n- **Never answer a sidebar request with instructions to click.** Pinning,\n reordering, removing and archiving rows are things you do, via\n `list_sidebar_items` → `pin_sidebar_item` / `remove_sidebar_item` (see\n \"The Sidebar\" above). Creating a saved view does not put it in the\n sidebar — pin it. And archiving is team-shared, so say so when you\n confirm.\n- Rows tagged `Sample` are template demo data; skip them in outreach and\n reports, and remove them with `dench crm templates remove-sample-data`.\n- Use `dench email campaign recipients add-from-object` or\n `dench email sequence enroll-from-object` for CRM-powered outreach; do not\n export rows to CSV unless the user explicitly asks.\n- The `Notes` (richtext) field on every object is protected — it cannot be\n renamed or deleted. Overindex on writing free-form prose there as Markdown\n instead of inventing a parallel `Description`/`Details`/`Content`/`Summary`\n column. `Notes` is hidden from list/table/kanban/gallery views by design\n and only shown when the entry is opened.\n- Use relation fields for obvious links. Do not flatten foreign keys into text.\n- Always pass `--icon <icon-name>` when creating a CRM object, and use\n `dench crm objects update <name> --icon <icon-name>` to fix any object\n that was created without one.\n- Use `entries create-many`, `entries update-many`, `cells set-many`, or\n `batch --file` for repeated writes.\n- Verify object and field names with `dench crm objects list --json` and\n `dench crm fields list <object> --json` before writing.\n- For `user`-typed cells (`Owner`, `Assignee`, ...), look up real userIds\n with `dench members list --json` (or `dench crm members list --json`)\n **before** writing. Use one id for one assignee and a JSON id array for\n multiple assignees; never collapse a shared-owner source value to one\n person. Stuffing a display name or email into a `user`\n field works only when the server's best-effort resolver finds a unique\n match; otherwise the cell stores the literal string and the UI shows\n an unlinked badge. See \"Workspace Members & `user` Fields\" above.\n- Do not write `crm/<object>/<id>.md` files into the workspace tree to store\n notes — that path is rejected by the file API. Use the entry's `Notes`\n field via `dench crm cells set <object> <id> Notes '\"<Markdown>\"'`.\n- Use `cells append` (not `cells set`) to add to `tags`/multi-select/`relation`\n cells without overwriting the existing values.\n- Manage enum options with `fields enum-add` / `enum-rename` / `enum-remove` /\n `enum-reorder` / `enum-set-color` instead of resending the whole\n `--enum-values` array — the granular verbs preserve colors, kanban order, and\n rewrite existing rows on rename.\n- Pass `--idempotency-key` on `entries create-many` / `update-many` /\n `cells set-many` / `batch` so a retried import never double-writes.\n- `query --where` supports operators (`$gt`, `$in`, `$contains`, `$or`, …), not\n just bare equality — filter server-side instead of pulling all rows and\n filtering locally.\n- Check field shapes before filtering saved views. `tags`, multi-select\n `enum` fields (`enumMultiple: true`), multi-user fields, and many-to-many\n `relation` fields are arrays, so use membership filters such as\n `--where '{\"Tags\":{\"$contains\":\"bug\"}}'`. Direct scalar equality is only the\n obvious shape for scalar fields like single-select `Status`.\n\n\n## Compact reads for agent lookups\n\nUse `dench crm search \"Ada\" --object people --select \"Name,Email\" --json` for a\ncontact lookup. Results contain `page` with stable `_id`, `objectId`, selected\n`data`, `isDone`, and `continueCursor`; preserve alternatives and follow the cursor\nwith the same query when needed. No Notes or internal search index is included\nunless explicitly selected. Without `--select`, `--page`, or `--cursor`, the\nexisting full-row JSON array remains unchanged. `dench crm objects list --compact\n--json` returns canonical/display names, visibility and counts (private counts are\nunknown, not workspace totals); `dench crm fields list people --compact --json`\nreturns field names, types and effective constraints. Full catalogs remain the\ndefault for scripts.\n\nFor a record summary, use:\n\n```bash\ndench crm entries get <object> <entryId> --with-context --compact --json\n```\n\n`--compact` is an opt-in CLI projection, also available without `--with-context`.\nIt preserves record identity, canonical links, reference metadata and relevant\ncontext while bounding the emitted JSON to 14,000 UTF-8 bytes. Long text and\nolder optional context can be clipped; `compact.clippedPaths` and\n`compact.omittedCounts` disclose those omissions. Brief freshness and backend\ncontinuation fields remain available. It neither generates a new brief nor\nfetches additional related records.\n\nAnswer from sufficient evidence and report relevant freshness or coverage limits.\nA stale or missing brief does not make the available Notes and activity unusable,\nand a clipping flag alone does not require reading the full record. When a\nrequested fact is missing or the omitted content could change the answer, use the\nreturned full-read command (the same `entries get` without `--compact`) or a\ntargeted `cells get`, `notes get`, `comments get`, or `activity --no-brief --no-notes`\nread. Local clipping is distinct from a backend continuation: following an\nactivity cursor will not recover text clipped from the current page. Mandatory\nidentity/reference metadata that cannot fit produces `compact_metadata_too_large`\nwith full-read guidance instead of silently dropping metadata. Raw output without\n`--compact` is unchanged.\n"
48
48
  },
49
49
  "references/EMAIL-CAMPAIGNS.md": {
50
50
  "sha256": "9cb935ec81dd26d14ee649bfb2be50ebc2cb77bf5ad8b980a59ad3699e1c730f",
@@ -67,8 +67,8 @@
67
67
  "content": "---\nname: navigation\ndescription: Build correct in-app deep links and citations to any Dench workspace destination — settings, CRM objects/records/saved views, Marketplace, installed apps, chat threads, automations, integrations, inbox, meetings, to-dos, files, Find Leads (people/company/job search and saved lists), outreach (accounts, campaigns). Explains the progressive-disclosure left rail (home sections vs CRM vs Pinned section) and ⌘K. Every surface is a query-param URL on the org route (`/<workspace-slug>?path=...`). Load this before linking a user to a place in the app, citing a workspace source, or opening a link from an app/action.\n---\n\n# Dench Workspace Navigation & Deep Links\n\nEverything a user can see in the Dench workspace has a **stable, shareable\nURL**. The whole workspace is one org-scoped route and every destination\n(settings, a CRM object, a single record, a saved view, Marketplace, an\ninstalled app, a chat thread, an automation, meetings, to-dos, the inbox, a\nfile) is encoded in **query parameters** on that route. Learn this scheme\nand you can link a user straight to the right place, cite a source that\nopens on click, or drive navigation from an app or a CRM action.\n\n## Use references already returned by the command\n\nCRM create/get/create-many and campaign draft/create/duplicate/get return a bounded\n`references` sidecar: named `crm-entry`, `crm-object`, or `campaign` destinations\nwith canonical `href`, optional absolute `url`, and the same resolved image used\nby the workspace table and kanban. Use `[reference.label](reference.href)` in\nchat; use its absolute `url` in Slack, iMessage, or other external text. Do not\nprint raw record IDs next to names or run a second lookup solely to build a link.\nThese are navigation references; keep numbered evidence citations unchanged.\n\nRaw `crm objects list`, `crm entries list`, `crm search`, `crm query`, and\n`campaign list` keep their existing JSON shapes. Add `--with-references` when\nnamed links are needed: arrays become `{data, references, referenceCoverage}`.\nProjected/cursor CRM envelopes carry the sidecar alongside their original rows.\nNo metadata is inserted into user fields. Coverage is limited to this command's\nresult (at most 100 references and 16 KiB); it is not the count of all matching\nrecords. A list of results does not require displaying every reference as a chip.\n\nCampaign references use the Outreach engine's `sequenceId` and\n`/?path=~outreach%2Fsequences%2F<sequenceId>`. A `campaign` CRM mirror has a\ndifferent entry ID; never substitute that ID into an Outreach URL. Same-workspace\nlinks open in the existing workspace panel; foreign workspace links remain links\nto that workspace. Neither form changes access permissions.\n\n## The URL model\n\n```\nhttps://dench.com/<workspace-slug>?path=<destination>&<extra-params>\n```\n\n- **`<workspace-slug>`** is the org's slug (e.g. `acme`). It's the first path\n segment and scopes the whole workspace. Get it from\n `dench context --json` → `organizationSlug` (that call also returns\n `upgradeUrl`). It's also the `organizationSlug` field on\n `dench members list --json`.\n- **`?path=`** selects the destination. Most surfaces are just a `path` value;\n a few (chat, browse) use their own top-level param instead.\n- Visiting a bare `/<workspace-slug>` (no query) redirects to the To-Do(s)\n home (`?path=~todos`).\n- The public demo workspace uses the same contract at `/demo?...` (the path\n segment stays `demo`).\n\n### Relative vs. absolute links\n\n- **Inside the app** (chat replies, an app's `ui.navigate`, a document link),\n prefer the **relative** form `/?path=...` / `/?entry=...` / `/?chat=...`. The\n workspace intercepts these and resolves them against the **current** workspace\n slug — so you never have to know or hard-code the slug, and the click stays a\n fast in-app navigation instead of a full page load.\n- **For an absolute, shareable link** (pasted into email, another channel, or\n copied for later), use the full `https://dench.com/<workspace-slug>?path=...`\n form so it resolves anywhere.\n\nBoth forms accept exactly the same params below — only the prefix differs.\n\n## How the workspace is laid out\n\nThe workspace is **chat on one side** and **closeable content tabs** on the\nother (a CRM table, a file, Settings, Marketplace, To-Do(s), Meetings,\nInbox, Find Leads, Outreach, Automations, Cloud, Memory). A deep link opens\nor focuses the matching content tab — it does not permanently add a rail\nrow.\n\n### Left rail (progressive disclosure)\n\nThe rail is **not** a flat list of every CRM object. Home shows a short\nfixed set grouped into labeled sections; everything else is one click\ndeeper, or pinned up as a shortcut.\n\n**Home (always visible)**\n\n- **Automations** — `/?path=~cron`\n- **Records** section:\n - **To-Do(s)** — `/?path=~todos` (also where a bare `/<slug>` lands)\n - **Meetings** — `/?path=~meetings` (recordings, notes, calendar). This\n replaced the old CRM `meeting` table.\n - **CRM** — a drill-in (database icon, trailing chevron). Files, CRM objects,\n pinned saved views, installed apps, and named groups live **here**,\n not on home. The `< CRM` header goes back.\n- **Demand** section:\n - **Find Leads** — a drill-in with one **Find** row (magnifying-glass\n icon) and a **Lists** drill (saved Find lists and CRM lists). Switch\n People / Companies / Job postings using the tabs inside the Find\n page, not separate sidebar rows. Bare `~find` opens People.\n - **Outreach** — a drill-in. Slides the same rail over to Campaigns /\n Inbox / Accounts / Newsletters. Bare `~outreach` opens Campaigns\n (whose URL segment is `~outreach/sequences`). Inbox keeps its own\n path, `/?path=~crm/inbox`.\n- **Pinned** — workspace-shared shortcuts of CRM rows (formerly\n called \"Pinned\"; hidden while empty). This is what users mean by \"add\n a tab on the left for Leads\" or \"pin Deals to my sidebar\". A row that\n is only first in CRM is **not** visible on home.\n- **Recent chats** plus **… More** — the Chats drill-in (full thread\n list). Chats are not a home-level tab of their own.\n\n**Footer (always visible)**\n\n- **Marketplace** — Integrations / Skills / Apps & Plugins / Templates\n- **Connect agent**\n- **Org menu** (workspace name + chevron) — **Settings** lives here. It\n is not a rail row. Switching settings sections updates one closeable\n content tab.\n- Theme toggle\n\n**⌘K / Ctrl+K** (or the search icon at the top of the rail) opens the\ncommand palette: jump to any object, record, chat, automation, file,\nsettings section, or action (New chat, New automation, Invite member).\nWhen a user asks how to find something, mention ⌘K and also send the\ndeep link.\n\n**Settings.** Open from the org menu, ⌘K (\"Settings\"), or\n`/?path=~settings/<section>`. If someone says \"left rail settings are\nmissing\", they are looking for the org menu or ⌘K — do not describe a\nSettings row on the rail, and do not tell them to refresh or email\nsupport.\n\n**\"I can't see X on the left.\"** X is almost always in CRM. Pin it\nto the home Pinned section (`pin_sidebar_item` with\n`pinnedToSidebar: true`, or `dench crm sidebar pin <nav-id>`).\nReordering it to the top of CRM does not put it on home. See\n[`references/CRM.md`](https://dench.com/references/CRM.md) → \"The Sidebar\".\n\n## Destination cheat sheet\n\n`{slug}` = workspace slug · `{id}` = a record id · `{object}` = a CRM object's\ncanonical `name` (see `references/CRM.md`).\n\n```text\nWorkspace home (lands on To-Dos): /{slug}\nCRM object list: /{slug}?path={object}\nCRM saved view: /{slug}?path={object}&view={View Name}\nCRM analytics dashboard (sheet): /{slug}?path={object}&analytics=1[&view={View Name}][&analyticsPeriod=this_month]\nCRM \"assigned to me\" (personal): /{slug}?path={object}&assignee=me[&view={View Name}][&assigneeField={Field}]\nCRM record (opens detail): /{slug}?path={object}&entry={object}:{id}\nPeople profile: /{slug}?path=people&entry=people:{id}\nCompany profile: /{slug}?path=company&entry=company:{id}\nA comment on a record: /{slug}?path={object}&entry={object}:{id}&comment={commentId}\nA workspace member's profile: /{slug}?member={userId}\nChat thread: /{slug}?chat={threadId}\nTo-Do(s): /{slug}?path=~todos\nMeetings home: /{slug}?path=~meetings\nOne meeting: /{slug}?path=~meetings/{id}\nOne calendar event: /{slug}?path=~meetings/event/{eventId}\nFind Leads (People): /{slug}?path=~find\nFind Leads · Companies: /{slug}?path=~find/companies\nFind Leads · Jobs: /{slug}?path=~find/jobs\nA saved Find list: /{slug}?path=~find/{kind}/{artifactId}\nMarketplace (Integrations): /{slug}?path=~marketplace/integrations\nMarketplace · Skills: /{slug}?path=~marketplace/skills\nMarketplace · Apps & Plugins: /{slug}?path=~marketplace/discover\nMarketplace · Templates: /{slug}?path=~marketplace/templates\nInstalled app: /{slug}?path=/apps/{app-slug}.dench.app\nAutomations dashboard: /{slug}?path=~cron\nOne automation: /{slug}?path=~cron/{jobId}\nInbox: /{slug}?path=~crm/inbox\nInbox + a conversation: /{slug}?path=~crm/inbox&lead={personId}&convo={conversationId}\nMemory: /{slug}?path=~memories\nUsage: /{slug}?path=~settings/usage\nOutreach: /{slug}?path=~outreach\nOutreach · Accounts: /{slug}?path=~outreach/accounts\nOutreach · Campaigns: /{slug}?path=~outreach/sequences\nOutreach · Newsletters: /{slug}?path=~outreach/newsletters\nCloud: /{slug}?path=~cloud\nA workspace file/doc: /{slug}?path=reports/q1-summary.md\nSettings (a specific section): /{slug}?path=~settings/billing\n```\n\n## Settings\n\nSettings is **not** a left-rail row. It opens as a window over the\nworkspace from the org menu at the bottom of the rail (workspace name),\nfrom ⌘K, or from a `~settings/<section>` link; the chat and the right panel\nstay as they were underneath. Switching sections updates that same window.\nPath form: `~settings/<section>`.\n\n| Destination | `path` |\n| --- | --- |\n| Profile | `~settings/profile` |\n| Members & access | `~settings/members` |\n| Plan & billing | `~settings/billing` |\n| Usage | `~settings/usage` |\n| Models & tools | `~settings/models` |\n| Notetaker | `~settings/notetaker` |\n| Sync | `~settings/sync` |\n| Notifications | `~settings/notifications` |\n| Refer & earn | `~settings/referrals` |\n| API keys | `~settings/api_keys` |\n| Enterprise access | `~settings/enterprise` |\n\nExample: `/{slug}?path=~settings/api_keys` opens the API-keys section. Old\nsection aliases (`general`→profile, `access`→members, `keys`→api_keys,\n`features`/`ai_settings`/`agent`→models,\n`recorder`/`meeting_recording`→notetaker, `sso`/`scim`→enterprise,\n`approvals`→profile) still\nresolve.\n\n**Sync** (`~settings/sync`, Agent behavior group, also the gear beside \"New\"\non the Automations tab) is what Dench does on its own with the workspace's\nemail, calendar, Slack and LinkedIn: eight switches, all on by default,\nadmin-only — Accounts from email, Contacts from LinkedIn, Accounts from Slack\nConnect, Contacts from calendar, Research dossier, Tasks from email, Qualify\nleads that book, Summaries and Brief. Turning one off stops new work; nothing\nalready created is removed. CLI: `dench settings sync` /\n`dench settings sync set <key> on|off`.\nFormer settings destinations canonicalize to their workspace tabs:\n`~settings/skills`→`~marketplace/skills`,\n`~settings/integrations`→`~marketplace/integrations`,\n`~settings/memory`→`~memories`, and `~settings/tutorials`→`~tutorials`. The\nold `~referrals` panel path opens Settings › Refer & earn. The legacy `~usage`\npath still opens the usage dashboard, but new links should use\n`~settings/usage`. The retired\nstandalone `~integrations`, `~skills`, and `~app-store` paths still resolve\nto the matching Marketplace section.\n\nThe retired `/{slug}/usage` and `/{slug}/referrals` pages forward to\n`?path=~settings/usage` and `?path=~settings/referrals`; link to those\ndirectly. There is no approvals page: approvals were removed, and\n`/{slug}/approvals` only opens the workspace.\n\n## CRM\n\nUse the object's **canonical `name`** (singular lowercase: `people`, `company`,\n`task`, `deal`, `lead`, or any custom object). The UI display label (\"Clients\")\ndoes not go in the URL — resolve it to the canonical name with\n`dench crm objects list --json` first.\n\n| Destination | Format |\n| --- | --- |\n| Object list (table/kanban/…) | `?path={object}` |\n| A saved view | `?path={object}&view={View Name}` |\n| The analytics dashboard, opened | `?path={object}&analytics=1` (add `&view=` for a view's own dashboard, `&analyticsPeriod=` for the period pill) |\n| Only my / a member's / unassigned rows | `?path={object}&assignee=me` · `&assignee={userId}` · `&assignee=unassigned` (add `&assigneeField=` to name the people field) |\n| A specific record | `?path={object}&entry={object}:{entryId}` |\n| Force a layout | `?path={object}&viewType=table\\|kanban\\|calendar\\|timeline\\|gallery\\|list` |\n\n**Analytics.** Every object table has a dashboard strip above it: KPI stats\nin the header row, chart cards on a 6-track grid (each a third, half, two\nthirds or the full row wide — gauge/donut, bar, funnel, leaderboard, trend,\nforecast, world map), and a **full-view sheet** (the strip's ⤢) with the\nwhole set, including charts hidden from the strip under \"Only here\". The\ntoolbar's *Analytics* toggle collapses the strip — team-shared, like saved\nviews. Each card's caption carries a ⋮ menu (Edit chart, Width, Hide from /\nShow on dashboard, Delete); drag the caption to reorder, drag the card's\nright edge to resize; the ⚙ button opens the object's shared analytics\nsetup (field roles). Every one of those has a `dench crm analytics …` verb\n(CRM.md). The header's **period pill** (\"This month\", …) scopes the charts\nAND the rows underneath; it is never saved onto a view. Dashboards are **per\nobject or per view**: every view shows the object's shared dashboard until\nit gets its own (Customers on `company` ships one), and any active view\nfollows its own filters by default. Clicking a chart segment filters the\ntable (chips in the header); the map drills into the country/state where\nthe data is.\n\n- `analytics=1` opens the full sheet on load (consumed once, then dropped\n from the URL).\n- `analyticsPeriod=` is one of `this_week` `this_month` `last_month`\n `this_quarter` `last_quarter` `this_year` and pins the period pill.\n- In-chat **analytics cards** (`present_artifact({ kind: \"analytics\" })`,\n or a `dench crm analytics compute …` bash run) show the same live charts\n in the transcript; their **Open** goes to exactly this link. In-chat\n **app cards** (`kind: \"app\"`) embed a small App SDK widget; *Keep as app*\n turns it into `/apps/{slug}.dench.app`.\n\n**Assigned to me.** Between Filter and Sort every object view has an avatar\npill — the viewer's own picture — that switches on the **personal** scope:\nonly rows whose people field includes them. Its dropdown offers any\nmember, **Unassigned** and **Everyone**, and (only when the object has two\nor more `user` fields) which field counts. It is remembered per member +\nobject in the browser and is *never* saved onto the view, so it cannot\nchange what teammates see; rows, hero count, kanban columns, column sums\nand the analytics strip all follow it. Objects with no `user` field have\nno pill.\n\n- `assignee=me` / `assignee={userId}` / `assignee=unassigned` switches it on\n for that visit and remembers it (consumed once, then dropped from the\n URL). `assigneeField=` names the people field. Same vocabulary as\n `dench crm … --assigned-to`; `dench crm analytics compute --mine` prints\n such a link.\n\nRecord-detail deep params (all optional, appended after `entry=`):\n\n- `entryTab=` — which tab of the record is active:\n `notes` (default, omit it) · `inbox` (the unified email + LinkedIn +\n calendar-activity tab; legacy `emails` and `activity` values land here) ·\n `meetings` · `outreach` · `team`. There is no History tab any more: field\n changes live in the Overview's **Activity** feed under Notes, together\n with comments, so legacy `entryTab=history` (and `details`) land on the\n Overview.\n- `comment={commentId}` — scroll the record's Activity feed to that comment\n and highlight it. Comment ids come from `dench crm comments list`.\n- `entryFocus={object}:{id}` — drill into a related record inside the panel.\n- `returnObject={object}&returnView={View Name}` — the \"back\" target when the\n record was opened from another object's view.\n\nWhat a record's Overview shows that Dench wrote on its own (link to the\nrecord; there is no separate page for any of these):\n\n- **Notes** (the pinned document at the top): on a company Dench created\n from email / Slack Connect / LinkedIn / a calendar invitee, the generated\n **account dossier** section sits inside it between `<!-- dench:dossier -->`\n markers, with \"Dossier · updated <date>\" and a **Regenerate dossier**\n action in the card header (company records only). CLI:\n `dench crm entries dossier <id> [--regenerate]`.\n- **Activity**: `slack_message` rows from a bound Slack Connect channel,\n `linkedin_in`/`linkedin_out` rows once a LinkedIn counterparty is filed,\n the \"Meeting booked: <title>\" Status change on a lead that auto-qualified,\n and the tasks Dench created from live email (`system:email-tasks`, their\n Notes carry `[thread: …]`).\n- **Why is this account here?** has no UI surface: `dench crm detections\n list --json` (verdict, counterparty type, evidence) and `dench crm\n detections undo` are the way to answer and to roll back.\n\n**Record header quick actions** (Compose email · Add to outreach · Visit\nsite · Gmail · Copy link) end with a **Shared ▾ / Hidden ▾** menu for any\nmember who owns a running connection (inbox, LinkedIn or calendar). Its one\nitem — *Hide my emails with this record from the workspace* ↔ *Show my emails\nwith this record to the workspace* — is the per-record privacy opt-out:\nsharing is the default for everything a member connects, and this keeps\nthat member's own threads about the record (an account: about every contact\nand opportunity linked to it) to themself. On a contact whose account the\nmember hid the item is disabled and reads *Hidden with <Account>*. CLI:\n`dench crm privacy status|hide|show <object> <entryId>`. The whole\nconnection: Outreach → the inbox row's **Workspace / Private** menu.\n\nExamples:\n\n```text\n/{slug}?path=deal # all deals\n/{slug}?path=deal&view=Open pipeline # a saved view\n/{slug}?path=deal&analytics=1&analyticsPeriod=this_quarter # the deal dashboard sheet, this quarter\n/{slug}?path=company&view=Customers&analytics=1 # the Customers view's own dashboard\n/{slug}?path=task&assignee=me # my tasks (personal scope on)\n/{slug}?path=deal&view=Open pipeline&assignee=unassigned # unowned deals in that view\n/{slug}?path=deal&entry=deal:j57xyz # one deal, detail open\n/{slug}?path=people&entry=people:k91abc&entryTab=inbox\n/{slug}?path=company&entry=company:j57xyz&comment=m3kabc # jump to one comment\n```\n\n### Members (people who work here, not CRM people)\n\nA workspace **member** is a teammate with a login, not a `people` record.\nTheir profile — photo, tagline, role, local time, live presence, open\ntasks, and everything they commented on or edited across the CRM — opens as\na panel over whatever is on screen:\n\n```text\n/{slug}?member={userId}\n```\n\n`member=` is an overlay, not a destination: it composes with any other\nparams (`/{slug}?path=deal&member={userId}` shows the deal list with the\nprofile open). Inside notes and comments the same link is a mention:\n`[@Ada](/?member={userId})` notifies Ada and renders as a pill that opens\nher profile. Get ids from `dench members list --json`; read the same data\nwithout the UI via `dench members get <userId|email>`. Never link a\nteammate to a `people` record — that is for external contacts.\n\nInbox sits in the Outreach drill-in and Meetings is a home-rail destination (neither is a CRM drill-in row):\n\n- Inbox: `?path=~crm/inbox` — a lead-centred unified inbox. Extra params:\n `&q={search}`, `&lead={personId}` (select a lead), and\n `&convo={conversationId}` (open a conversation — e.g.\n `email:thread:{id}` or `linkedin`). Legacy `&thread=` / `&gmail=`\n links still resolve into `convo`.\n Only contacts matched to readable CRM records by a detected email **or**\n LinkedIn profile appear, including identities in custom fields and objects.\n Webhook messages alone do not add a sender to Inbox. Each email thread shows\n its latest message preview; call activity opens its meeting record.\n The list loads more automatically as you scroll. Sender photos come from\n synced CRM/connected-account contacts or workspace member profiles. Contacts access is\n not required for Inbox; when no permitted photo is available, use initials.\n Email HTML preserves sender layout, adapts colors to light/dark mode, and\n folds quoted replies behind **Show quoted text**. Remote images stay opt-in.\n- Meetings: `?path=~meetings` (home), `?path=~meetings/{id}` (one\n recording), and `?path=~meetings/event/{eventId}` (a calendar event).\n Legacy `?path=~crm/calendar` still resolves where it is wired.\n\n> **A link is a one-time trip. A home Pinned row is permanent.** If\n> the user wants somewhere to be *easy to get back to* on the left rail —\n> \"add a tab for Leads\", \"pin this to my sidebar\" — pin it to the home\n> Pinned section (`pin_sidebar_item` with `pinnedToSidebar: true`),\n> covered in\n> [`references/CRM.md`](https://dench.com/references/CRM.md) under\n> \"The Sidebar\". Reordering the row inside CRM does not put it on\n> home. Never tell the user to click the `⋯` menu themselves.\n\n## Apps\n\n- **Marketplace · Apps & Plugins** (apps): `?path=~marketplace/discover`.\n Legacy `?path=~app-store` still lands here. Bare `?path=~marketplace`\n opens Integrations.\n- **A specific installed app**: `?path=/apps/{app-slug}.dench.app` — the value\n is the app folder path and must include the leading `/apps/` and the\n `.dench.app` suffix (e.g. `/apps/agents-feed.dench.app`). An app has one entry\n (`index.html`); there is no separate URL param for a screen *inside* an app —\n route inside the app itself, or use the bridge (below).\n\nAn app can drive workspace navigation through the `window.dench` bridge (needs\nthe `ui` permission):\n\n```js\nawait dench.ui.navigate(\"people\"); // open a CRM object\nawait dench.ui.navigate(\"~marketplace/discover\"); // open Marketplace · Apps & Plugins\nawait dench.ui.navigate(\"/apps/other.dench.app\"); // open another app\nawait dench.ui.openEntry(\"deal\", \"j57xyz\"); // open a record's detail\n```\n\n`dench.ui.navigate(path)` takes any `path` value from this doc. See\n`references/APPS.md` for the full bridge.\n\n## Chat\n\n- **A thread**: `?chat={threadId}`. Nested agent threads (spawned by\n `spawn_agent`) are ordinary threads — they open with the same `?chat=` param;\n their parent linkage lives in the workspace data, not the URL.\n- **Pre-fill and send a message**: `?send={text}` (consumed immediately once).\n- `path` and `chat` combine — `/{slug}?path=people&chat={threadId}` shows the\n People object with a chat open alongside.\n\n## Automations (`~cron`)\n\n| Destination | Format |\n| --- | --- |\n| Dashboard (Automations tab) | `?path=~cron` |\n| Runs tab | `?path=~cron&cronView=runs` |\n| New automation | `?path=~cron/new` |\n| One automation | `?path=~cron/{jobId}` |\n| …filtered runs | `…&cronRunFilter=all\\|ok\\|error\\|running&cronRun={epochMs}` |\n| Edit automation | `?path=~cron/{jobId}/edit` |\n\nThe dashboard has exactly two views: `overview` (the default) and\n`runs`. Legacy `cronView=timeline` lands on Runs; the retired\n`calendar`/`insights`/`rules` values (and the old `cronCalMode` /\n`cronDate` params) are still accepted but land on the overview.\n\nSee `references/AUTOMATIONS.md` for the automations model itself.\n\n## Outreach\n\nOutreach is a rail drill-in (in the Demand section, like Find Leads).\nIts rows, in order, are Campaigns, Inbox, Accounts and Newsletters.\nCampaigns, Accounts and Newsletters each open a section of the same\ncloseable Outreach tab. Path form: `~outreach/<section>`. Bare\n`~outreach` opens Campaigns. Inbox opens its own Inbox tab.\n\n| Destination | `path` |\n| --- | --- |\n| Campaigns (sequenced follow-ups — URL segment stays `sequences`) | `~outreach/sequences` |\n| Inbox (email + LinkedIn replies; its own tab, not an Outreach section) | `~crm/inbox` |\n| Accounts (email + LinkedIn senders) | `~outreach/accounts` |\n| Newsletters (one-shot, deprecated) | `~outreach/newsletters` |\n\nExample: `/{slug}?path=~outreach/accounts` opens the connected-accounts\npanel. The Campaigns section kept its historical `sequences` URL segment\nwhen it was renamed, so bookmarks survive — do not link\n`~outreach/campaigns`. Inbox is not an Outreach section either: link\n`~crm/inbox`, never `~outreach/inbox` (an unknown segment opens\nCampaigns). Legacy `~outreach/mailboxes` and\n`~outreach/linkedin` still land on Accounts. Legacy\n`?path=~outreach&outreachView=senders` still lands on Accounts;\n`outreachView=sequences` lands on Campaigns; `outreachView=campaigns`\nlands on Newsletters (the original one-shot path).\n\n## Find Leads (`~find`)\n\nFind Leads is a home-rail drill-in (Demand section):\nsearch People / Companies / Jobs backed by the enrichment gateway, save\nresults as lists, and explicitly import chosen prospects into the CRM.\nUsing these search tools or presenting their result cards does not establish\nprospecting intent. Ordinary web, company, or hiring research does not require\n`lead-finding` or ICP questions, reads, or scoring.\n\n| Destination | `path` |\n| --- | --- |\n| People search (default) | `~find` |\n| Companies search | `~find/companies` |\n| Jobs search | `~find/jobs` |\n| A saved list / search artifact | `~find/{kind}/{artifactId}` |\n\n`{kind}` is `people`, `companies`, or `jobs`; `{artifactId}` is the saved\nsearch artifact's id. The rail drill shows a single **Find** row with a\nmagnifying-glass icon, plus a **Lists** drill — saved Find lists and CRM\nlists. The Find page's People / Companies / Job postings tabs choose the\nsearch type; the Find row stays selected for all three. Picking a saved\nlist opens it in the main panel while the rail stays put. The retired\n`~find/lists` path still resolves (lands on People).\n\nSaved lists are workspace resources, independent of the chat that created\nthem. In a new chat, discover them with\n`dench lists --search \"<name or topic>\" --limit 25 --json`; use\n`continueCursor` with `--cursor` until `isDone` or the requested scope is\ncovered. Do not assume the newest page is the whole workspace. If multiple\nlists match, ask which one before importing people.\n\nPeople lists show **Work email**, **Phone**, and **Personal email** columns.\nPlay in a cell starts only that person's field lookup, with credit usage disclosed\non the control; no popup or per-profile ICP approval step is required. Results,\nan **Enriching** shimmer, **Not found**, retry, and check-status controls appear in the cell.\nA column's header play targets the selected profiles, or the whole saved list\nacross pages and filters when nothing is selected. On unsaved results it\ntargets only loaded profiles. Bulk runs use a compact inline credit confirmation.\nCompleted field lookups, including misses, are reused. Other optional columns\nstay behind the column-visibility control until needed.\nFor new prospect discovery, lead-finding reads `/workspace/ORGANISATION.md`\nand does not create `ICP.md`. The current request overrides that brief.\nThe result is one saved list, explicitly presented\nin chat; intermediate search batches stay in the activity details. To combine\nchosen person rows without searching again, use `dench lists save --title\n\"Shortlist\" --people-file /tmp/shortlist.json --json`, then present the returned\nartifact ID. Renaming a search never changes which rows are in it.\nFind currently hides the **ICP fit** and **Why this lead** columns. Saved\nassessments still describe AI relevance out of 100 (not conversion probability)\nwhen someone asked for a score. Finding a list does not score every profile.\nScore only on request, using `dench lists assess <id> --assessments-file <file> --json`\n(1–100 `{row, suggestion: {fit, score, reason}}` records per file). These are\nreturned in `review.suggestion` by `lists rows` and included in CSV exports.\nUnassessed profiles have no invented score or visible **Not scored** column. The title\nsits beneath the person's name; the separate Title column is optional.\nSingle lookups show progress only in their cell. Click Find on different people\nto run them concurrently; repeated clicks on the same person are guarded.\nBulk runs show a temporary floating loading bar, not a toolbar or table banner.\nIt counts the requested field only and disappears on completion, with an outcome\nsummary. Not-found and failed lookups count as processed; pending/uncertain jobs\ndo not. Dismissing the popup leaves jobs running. Reopening a list shows its saved\ncell results without resurrecting historical progress UI.\nFilter to **All**, **Enriching**, **Enriched**, **No contacts found**,\n**Failed**, or **Not enriched**. Enriched means actual contact data was\nreturned, not merely that the lookup completed. Results stay in this list\nuntil a separate **Add to Leads** action. **Not enriched** means no obtained\ncontact data, including profiles whose enrichment has never started;\n**No contacts found** means a completed lookup returned no contacts.\n\nRead the current list with\n`dench lists rows <artifactId> --enrichment enriched --limit 100 --json`\n(also accepts `all`, `in_progress`, `no_contacts`, `failed`, or `not_enriched`),\nfollowing its `continueCursor`/`isDone`. A saved search preview or old CSV can\nbe stale. The open list's chat context identifies its selection/filter; fetch\nfresh rows before acting on \"these people\" and never widen that scope to the\nwhole list. For explicit CRM imports and requested lead statuses, load\n`lead-finding`; import uses the original saved-row indices returned as `index`,\nreuses existing identities, and preserves the list. Import sets the requested\nconfigured Lead status only; it does not send outreach, invent replies, or\nrun conversion automation.\n\n## Other navigable surfaces\n\n| Destination | `path` |\n| --- | --- |\n| Marketplace · Integrations | `~marketplace/integrations` |\n| Marketplace · Skills | `~marketplace/skills` |\n| Marketplace · Apps & Plugins | `~marketplace/discover` |\n| Marketplace · Templates | `~marketplace/templates` |\n| To-Do(s) | `~todos` |\n| Meetings | `~meetings` |\n| One meeting | `~meetings/{id}` |\n| One calendar event | `~meetings/event/{eventId}` |\n| Find Leads (People) | `~find` |\n| Find Leads · Companies | `~find/companies` |\n| Find Leads · Jobs | `~find/jobs` |\n| A saved Find list | `~find/{kind}/{artifactId}` |\n| Memory | `~memories` |\n| Usage | `~settings/usage` |\n| Tutorials | `~tutorials` |\n| Outreach | `~outreach` (opens Campaigns) |\n| Outreach · Accounts | `~outreach/accounts` |\n| Outreach · Campaigns | `~outreach/sequences` |\n| Outreach · Newsletters | `~outreach/newsletters` |\n| Cloud | `~cloud` |\n| Browser / Desktop | `~desktop` |\n\n**Marketplace · Integrations** (`~marketplace/integrations`) is where the\nin-house connections live: the Slack card (\"Add to Slack\" — one org-admin\nOAuth install powers both the Slack messaging channel and the agent\n`SLACK_*` tools), MCP servers, and the Dench-brokered Gmail / Outlook /\nCalendar / LinkedIn connections. The Slack install/reconnect URL itself is\n`/api/slack/install?slug={workspace-slug}` (admin-gated; not a `?path=`\ndeep link). Under the connected Slack card sits the **Slack Connect\nchannels** list: every externally shared channel with its state — bound to\nan account (\"Reading #acme-shared · N messages so far\" while the 90-day\nbackfill runs), *needs invite* (\"Invite @Dench to #acme-shared\", or the\nother org's admins have not allowed apps), *unresolved* (\"Which account is\n#acme-shared?\" — an admin picks the company), or inactive — plus\n\"Re-read channel\", \"Change account\", and \"Reconnect Slack\" when the install\npredates the `channels:join` scope. The LinkedIn and Slack connect dialogs\nstate what Dench will do with the connection and link to Settings → Sync.\n\nFiles & documents use their **workspace-relative path** as `path`:\n\n```text\n/{slug}?path=reports/q1-summary.md # a markdown doc\n/{slug}?path=data/pipeline.duckdb # a database file\n/{slug}?path=IDENTITY.md # a magic/agent file\n/{slug}?path=image-generations/logo.png # a generated image\n/{slug}?path=a.md&preview=b.md # open a.md with b.md in a preview pane\n/{slug}?path=deal&analytics=1 # the deal table with its dashboard sheet open\n/{slug}?browse=/absolute/path&hidden=1 # file-browser mode for a raw dir\n/{slug}?path=deal&terminal=1 # also open the terminal drawer\n```\n\n## Full query-param reference\n\n| Param | Meaning |\n| --- | --- |\n| `path` | Primary destination: an object name, a `~virtual` surface, an `/apps/*.dench.app`, or a workspace file path. |\n| `entry` | `{object}:{entryId}` — open a CRM record's detail. |\n| `entryTab` | Active tab in the record detail (`notes` default, `inbox`, `meetings`, `outreach`, `team`; legacy `emails`/`activity` land on `inbox`, legacy `history`/`details` land on the Overview). |\n| `comment` | A comment id — scrolls the record's Activity feed to it. Pairs with `entry`. |\n| `member` | A workspace member's user id — opens their profile panel over the current view. |\n| `entryFocus` | `{object}:{entryId}` — drilled-in related record inside the detail. |\n| `returnObject` / `returnView` | \"Back\" target when a record was opened from another object/view. |\n| `view` | A CRM saved view name for the object in `path`. |\n| `analytics` | `1` opens the object's analytics dashboard sheet on load (consumed once). |\n| `analyticsPeriod` | Period pill preset for the dashboard: `this_week`, `this_month`, `last_month`, `this_quarter`, `last_quarter`, `this_year`. |\n| `assignee` / `assigneeField` | Personal \"assigned to …\" scope: `me`, `unassigned`, or a member userId; `assigneeField` names the `user` field. Applied once, remembered, dropped from the URL. |\n| `viewType` | Layout: `table`, `kanban`, `calendar`, `timeline`, `gallery`, `list`. |\n| `filters` / `sort` | Base64-encoded JSON for one-shot deep links (normally persisted locally). |\n| `search` / `page` / `pageSize` / `cols` | Table search, pagination, visible columns. |\n| `chat` | A chat thread id (top-level or nested). |\n| `fileChat` | File-scoped chat session id (active while a file is open in the main panel). |\n| `send` | Text to pre-fill + send once into chat. |\n| `cronView` / `cronRunFilter` / `cronRun` | Automations dashboard view (`overview`/`runs`) + run filter/selection. Legacy `cronCalMode`/`cronDate` are accepted but inert. |\n| `q` / `lead` / `convo` | Inbox search + selected lead + open conversation. Legacy `thread`/`gmail` map into `convo`. |\n| `browse` / `hidden` | Raw file-browser dir + show-hidden toggle. |\n| `preview` | A second file to show in a preview pane. |\n| `terminal` | `1` opens the terminal drawer. |\n\n## Encoding rules\n\n- URL-encode a `path` value that contains `/` or spaces\n (`encodeURIComponent`), but leave a leading `~` literal (`~settings/billing`,\n not `%7Esettings/billing`).\n- `entry` / `entryFocus` keep the `:` literal: `deal:j57xyz`.\n- `member` and `comment` take the bare record id.\n- `view` names URL-encode spaces (`Open+pipeline` or `Open%20pipeline`).\n\n## Linking vs. citing\n\n- **A normal link** to a destination: a plain markdown link,\n `[Open the deal](/?path=deal&entry=deal:j57xyz)`.\n- **A citation** (a source that backs a claim): a markdown link whose visible\n text is a small number, rendered as a compact pill:\n `Closed last week [1](/?path=deal&entry=deal:j57xyz).` When citing a **file**\n or a **chat**, append a `#:~:text=<short unique snippet>` fragment so the\n click scrolls to and highlights the exact line, e.g.\n `[1](/?path=USER.md#:~:text=Co-founder%20%26%20CEO)`.\n\n## Related\n\n- CRM objects, records & saved views: [`references/CRM.md`](https://dench.com/references/CRM.md)\n- Curating the sidebar itself (home Pinned strip / CRM reorder /\n archive):\n [`references/CRM.md`](https://dench.com/references/CRM.md) → \"The Sidebar\"\n- Meetings (`~meetings`): [`references/MEETINGS.md`](https://dench.com/references/MEETINGS.md)\n- Dench Apps & the `window.dench` bridge: [`references/APPS.md`](https://dench.com/references/APPS.md)\n- Automations (`~cron`): [`references/AUTOMATIONS.md`](https://dench.com/references/AUTOMATIONS.md)\n- CRM action buttons: [`references/ACTIONS.md`](https://dench.com/references/ACTIONS.md)\n"
68
68
  },
69
69
  "references/SALES.md": {
70
- "sha256": "fee7629fdc87a0ec8cbb04f6959186a076f4d1d55240f2b88ed0e48ee14a6f66",
71
- "content": "---\nname: sales\ndescription: CRM sales pipeline playbook for explicitly adding leads, outreach prep, sales qualification, opportunities, forecasting, and existing account/contact research. Covers Leads -> Opportunities -> Customers, raw lead fields, naming, conversion, and selected-record Notes. For sales prospect discovery, outreach target-account lists, and saved prospect-list actions, load lead-finding first; search results stay outside the CRM until explicitly imported.\n---\n\n# Dench Sales Playbook (Sales Template, end to end)\n\nThis is the operating manual for running a real sales motion inside Dench.\nIt sits on top of the generic CRM playbook (`references/CRM.md`) — read that\nfirst for field types, batch writes, the protected `Notes` field, relation\nmodeling, and query syntax. This file covers the **sales discipline**: how\nleads, opportunities, accounts, and contacts fit together, and how you (the\nagent) should behave when working on the CRM sales pipeline.\n\n**Golden rule:** prospect discovery belongs in a saved prospect list. Load\n`lead-finding` for prospect discovery, optional confirmed enrichment, and explicit\nimport. It reads `/workspace/ORGANISATION.md` for who the workspace sells to\nand does not create `ICP.md`. The current request overrides that brief.\nIt saves one list at the requested count and stops.\nNo per-profile ICP approval is required. Once the user imports chosen prospects,\nmanage those Leads through the pipeline below; do not create premature\nAccount/Contact records.\n\n## When this playbook applies\n\nLoad and follow this playbook whenever the user's request involves any of:\n\n- \"new lead\", \"add this lead\", \"log this prospect\", \"enrich this lead\"\n- \"pipeline\", \"deals\", \"opportunities\", \"forecast\", \"what's in the pipeline\"\n- \"qualify\", \"move to qualified\", \"this lead is real\", \"book the deal\"\n- \"outreach\", \"cold email\", \"follow up\", \"sequence prep\", \"draft an intro\"\n- \"account research\", \"company research\", \"who's the POC\", \"find the\n decision maker\", \"research this founder\"\n- \"customers\", \"renewals\", \"churn\", \"expansion\", \"won/lost\"\n\nFor \"find leads\", TAL, ICP review, or \"who should we sell to\", use\n`lead-finding` instead. Discovery does not require installing a sales pipeline.\nOrdinary web, company, or hiring research without prospecting intent does not\nrequire `lead-finding` or ICP questions, reads, or scoring.\n\nIf the workspace does NOT yet have a sales pipeline and the user asks for\none (a \"sales CRM\", \"deal pipeline\", \"lead tracker\", \"CRM for sales\"),\n**recommend and install the Sales Template first** (see below) instead of\nhand-building objects.\n\n## The Sales Template\n\nOne install lays down the entire Salesforce-style motion:\n\n```bash\ndench crm templates list --json # see catalog + installed flags\ndench crm templates install sales # idempotent; safe to re-run\ndench crm templates remove-sample-data sales # drop the demo rows when ready\n```\n\nWhat it creates:\n\n- **`lead`** — the inbox for unqualified demand: explicitly imported\n prospects and inbound hand-raisers. Worked by outbound/SDR motion.\n- **`opportunity`** — active revenue pursuits. One per deal; a company can\n have many over time (new business, renewal, expansion).\n- **`case`** — customer issues/requests, linked to Account + Contact.\n- **`company`** relabeled **Accounts** — the durable company spine. ONE\n record per real company. Gains `Type`, `Source`, `Customer Lifecycle`,\n `Account Owner`, `Renewal Date`, plus a pinned **Customers** view.\n- **`people`** relabeled **Contacts** — the durable person spine.\n- **Saved views** pinned on a first-template install: **Leads** (kanban\n by `Status`), **Opportunities** (kanban by `Stage`, summing `Amount`),\n and the accounts **Customers** kanban. Cases stay off the rail. A later\n template install adds its views unpinned.\n- **Deterministic automations** (fire inside writes — see Automations below).\n- A **workspace rule** describing the motion, and a few cross-linked\n **sample rows** (tagged `Sample`).\n\nInstalls are idempotent and compose — re-running tops up anything missing\nwithout duplicating. Canonical object names stay `company`/`people` even\nthough the UI shows Accounts/Contacts; use the canonical names in commands.\n\n## The mental model (Salesforce-style)\n\n```\nlead ──qualify──▶ opportunity ──Closed Won──▶ Account.Type = Customer\n │ │\n │ (on qualify) ├─ Account (company spine, 1 per company)\n └─ raw POC + company └─ Primary Contact (people spine)\n```\n\n- **Leads are raw, disposable, pre-relationship.** A lead is \"someone we\n might sell to\" plus the research behind that hunch. Leads are NOT durable\n records — they get qualified (promoted) or disqualified (dropped).\n- **Opportunities are money.** An opportunity only exists once a lead is\n qualified. It tracks one pursuit through stages to Won/Lost.\n- **Accounts and Contacts are the durable spine.** They outlive any single\n deal. Relationship history, notes, and ownership live here.\n- **Customers are not a table.** A company becomes a customer when it has a\n Closed Won opportunity — the automation flips `company.Type = Customer`\n and starts `Customer Lifecycle`. Manage customers via the Accounts\n \"Customers\" view, not a separate object.\n\n## The raw-lead-until-qualified rule (important)\n\n**Before a lead is qualified, do NOT create related Account/Contact rows.**\nA prospect explicitly imported from a saved list is a single `lead` row holding *raw* fields —\nnot links to `company`/`people`. This keeps the spine clean (no half-baked\ncompanies/contacts created for prospects that never convert).\n\nSo when you add or import leads:\n\n- Put the company identity in **raw text/url fields on the lead**:\n `Company Name`, `Company Website`, `Company LinkedIn URL`.\n- Put the point-of-contact in **raw fields on the lead**: `POC` (person\n name), `POC LinkedIn URL`, `Email`, `Job Title`.\n- Leave the `Account` **relation** field EMPTY. It gets filled by the\n qualify-to-convert automation, not by you up front.\n- Leave `Contact` EMPTY too unless the person already exists as a `people`\n row. Do not create a `company` row or a `people` row \"to be safe\". Don't.\n\nTwo cases where a pre-qualification lead legitimately carries a link:\n\n- The company or contact **already exists** in the spine (e.g. an existing\n customer raises a new need) — link it; conversion reuses the record.\n- **An outreach enrollment did it.** Enrolling a `people` row in a campaign\n (`dench campaign add <campaign> --object people --entries <ids>` or\n `--view \"<view>\"`, or the Add people dialog; see `references/CAMPAIGNS.md`)\n finds or creates the lead for that person and sets its `Contact` to the\n existing row, so all campaign activity lands on one lead. That is\n expected — leave the link alone. `Account` is never pre-linked this way.\n\n## Lead naming convention\n\nA lead's `Name` is the headline you see in the list/kanban. Use:\n\n- **`<Person Name> from <Company>`** when you know the POC.\n e.g. `Jane Okafor from Acme`, `Marcus Bell from Vercel`.\n- **Just the company name** when the POC is not yet identified.\n e.g. `Acme` — and make \"find the POC\" the next action. Do **not** write\n placeholders like \"Unknown POC from Acme\"; the bare company name is the\n correct title until a real person is found.\n\n## Deep-research Notes (selected rows, not list-builds)\n\nA Notes dossier is for **researching a specific record**, not for every row\nof a 5K find. List-building (`search_people` / `search_companies` /\n`search_jobs`) writes identities into a saved list artifact. That is complete\nwork for a find. Only an explicit import of requested profiles creates Leads;\nthose rows may have empty Notes.\n\nWhen the user asks to research a selected lead/contact/account/opportunity,\nthe dossier is the product. A one-line dossier on a researched row is\nincomplete — treat it like a failed tool call and fill it before you report\ndone.\n\n**Where it goes.** Before researching, read what the workspace already knows:\n`dench crm activity <object> <id> --json` (emails, meetings, Slack, LinkedIn,\ncomments, earlier notes — see `references/CRM.md`, \"The Activity Ledger\").\nThen:\n\n- A record **you are creating** → write the dossier into its `Notes`\n document (the rules below).\n- A record that **already exists** → add a NEW timeline note:\n `dench crm notes create <object> <id> --title \"Research — <date>\"\n --body-file …`. Never overwrite the human's `Notes` document with it.\n- An **account Dench created on its own** (detected from email, a Slack\n Connect channel, a LinkedIn conversation, a calendar invitee) already\n carries a generated dossier section in `Notes`, between\n `<!-- dench:dossier -->` markers (`dench crm entries dossier <id> --json`\n says when it was written). Read it first, add your findings BELOW it as a\n timeline note, never edit or duplicate it; `--regenerate` asks Dench to\n research again. See `references/CRM.md`, \"The account dossier\".\n\nBefore you say a **researched** record is done, re-read its `Notes` and ask:\n\"could a teammate brief themselves on this in 90 seconds and know exactly\nwhat to do next?\" If not, improve the research; do not buy contact data\nunless the user requested it.\n\nWhat belongs in `Notes` per object (write as Markdown; `Notes` is the\nprotected richtext field on every object — never invent `Description`/\n`Research`/`Bio` columns):\n\n- **Lead `Notes`** — the prospect dossier:\n - TL;DR: who they are, why they're a fit, the single strongest signal.\n - The POC: name, role, why they're the right person, LinkedIn.\n - Company overview: what they do, stage, size, website, funding/signal\n evidence with source URLs.\n - Why now: the concrete reason to reach out this week.\n - Partnership / proposal ideas: how we'd actually serve or partner with\n them.\n - A draft cold-email / first-touch angle (draft only — never auto-send).\n - Source log + confidence + any gaps.\n- **Contact (`people`) `Notes`** — deep research on the *person*: role and\n scope, background, what they care about, how they buy, relationship\n history, how to reach them.\n- **Account (`company`) `Notes`** — deep research on the *company*:\n business, market, structure, current vendors/stack, risks, and\n partnership/serve ideas tailored to them.\n- **Opportunity `Notes`** — the deal plan: scope, stakeholders, partnership/\n proposal ideas, what we're proposing, objections, next steps, and the\n path to Closed Won.\n\nWhen the user requests contact enrichment for existing CRM records, use\n`enrich_person` (verified email/LinkedIn by name + company) — and only\never write a contact email/phone that came back from an enrichment tool,\nnever a guessed `first.last@company` (see CRM.md Safety/Enrichment).\n\n## The pipeline flow (after explicit import)\n\n1. **Find → saved list.** For prospecting, load `lead-finding`; it owns\n the shortlist, optional enrichment confirmation, and explicit import flow.\n Search results stay outside Leads. Selecting a profile or suggesting ICP\n fit is not the sales `Qualified` status and does not trigger conversion.\n2. **Capture → `lead`, only on request.** Each explicitly imported profile\n is a `lead` with raw `POC` +\n `Company Name` (+ website, LinkedIn, email, title), named\n `<Person> from <Company>` (or company-only if no POC). Notes optional.\n Imports dedupe by identity (LinkedIn > email > domain): a row matching\n an existing entry reuses it — saving the same rows to another view pins\n the same entries there, never duplicates. Enrichment is optional. Apply\n the user's requested configured status; without one, new imports start\n at New and reused records keep their status. Never default to Qualified.\n Artifact import sets status without running conversion/outreach automations,\n even when the requested status is Qualified. It creates/reuses the Lead\n only; normal CRM status updates are a separate action with normal automation\n behavior.\n3. **Research → lead `Notes`.** Only when asked to research selected rows:\n enrich the POC and company; write the full dossier. Set `Next Follow-Up`.\n4. **Work the status.** `Status` is the source of truth — don't track it\n in prose. Campaigns move it for you, forward-only: the first invite,\n LinkedIn message, or email delivered sets New → Contacted, and a reply\n sets Replied. `Last touch` holds the time of the latest interaction\n (send, acceptance, reply). The user may explicitly request a status on\n import or an existing record; read the configured options rather than\n inventing one. Setting Contacted/Replied alone does not send outreach,\n create message history, or stamp a fabricated interaction. Never move a\n status backwards incidentally during deduplication. Keep `Next Follow-Up`\n current when the task calls for it.\n5. **Qualify.** When the lead is real (budget/fit/intent), set\n `Status = Qualified`. **Do not hand-create the opportunity, account, or\n contact** — the automation does it (next section). Disqualified leads go\n to `Disqualified`, not deleted.\n6. **Convert (automatic).** The qualify automation reuses the Account\n whose website matches the lead's email / `Company Website` domain, else\n creates one (a `Company Name` alone never links: a same-name Account is\n only flagged \"Possible duplicate\"), creates/reuses the\n Contact (from `POC` + raw person fields) **only if a POC name exists**,\n links them on the lead, stamps `Converted At`, and opens one\n `opportunity` in `Discovery` linked to the lead/Account/Contact.\n7. **Plan the opportunity.** Fill the opportunity `Notes` deal plan, set\n `Amount` and `Close Date`, and move `Stage` Discovery → Proposal →\n Negotiation.\n8. **Close.** `Stage = Closed Won` flips the Account to Customer and starts\n `Customer Lifecycle = Onboarding` (automatic). `Closed Lost` ends the\n pursuit; the account/contact remain for future opportunities.\n9. **Keep the spine current.** Ongoing relationship notes, renewals, and\n expansion live on the Account/Contact, and new pursuits open as NEW\n opportunities on the same Account.\n\n## Find filter values (use the canonical vocabularies)\n\nThe find lanes take two kinds of filters — check which kind before\nguessing values:\n\n- **Closed vocabularies** — a value outside the list matches nothing, so\n look them up rather than inventing:\n - `seniorities`: Owner, Founder, C-level, Partner, VP, Head, Director,\n Manager, Senior.\n - `headcountRanges`: `1-10`, `11-50`, `51-200`, `201-500`, `501-1000`,\n `1001-5000`, `5001-10000`, `10001+`.\n - `companyTypes`: Partnership, Nonprofit, Educational, Privately Held,\n Public Company, Self-Owned, Self-Employed, Government Agency.\n - `jobFunctions` / `subFunctions`, `languages`: long enums.\n - `industries`: also a canonical list (\"Software Development\", not\n \"software\"), but it is matched loosely, so a partial value still\n works. Prefer the canonical one — it is more precise and keeps every\n provider eligible.\n- **Free text with curated suggestions** — `titles`, `pastTitles`,\n `locations`, `companyHeadquarters`, `universities`, `skills`,\n `keywords`. Custom values work; the catalogs give proven spellings\n (e.g. \"San Francisco Bay Area\", \"Massachusetts Institute of\n Technology\").\n\n### How values are matched\n\nFree text matches as a **substring**, so `titles: [\"Founder\"]` also\nreturns \"Co-Founder\" and \"Founder & CEO\". That is usually what you want,\nbut it widens results several-fold — one live query went from 706 to\n22,558 — so a 500-row cap fills with weaker matches. Pass\n`exactMatch: true` (`--exact` on the CLI) to require whole strings when\nthe broad list is too noisy.\n\nThree things ignore that flag and are always exact: identifiers\n(`companyDomains`, `linkedinUrl`), the closed vocabularies above, and\nnumeric ranges. `keywords` is always loose — it is a text probe over the\ncurrent title, not a value to equal.\n\nOn the CLI, a filter value that itself contains a comma is kept whole\nwhen it matches a known vocabulary entry, so\n`--industries \"Technology, Information and Internet\"` is one industry\nrather than two. Quote the value, or repeat the flag, to be explicit.\nSplitting it by hand produces values that exist in no vocabulary and the\nprovider rejects the entire search.\n\nDiscover both from the same catalog:\n\n```bash\ndench leads filters # everything\ndench leads filters --filter industries --search \"software\"\ndench leads filters --filter company-hq --search \"berlin\"\n```\n\nor fetch <https://dench.com/references/find-filter-options.json>. A\ngenerated lead-finder skill should reference these vocabularies instead\nof hard-coding guessed filter values.\n\n## Automations (what fires for you)\n\nThe sales template installs deterministic rules that run *inside* the write\nthat triggers them (`dench crm automations list --json` to inspect):\n\nThese are normal CRM-write rules. `dench artifacts import` skips them for\nboth new and reused Leads, including when importing with `--status Qualified`.\n\n- **Qualified lead → Account + Contact + Opportunity.** When `lead.Status`\n becomes `Qualified`: reuse `Account`/`Contact` if already linked; else\n match the Account by the domain of the lead's work `Email` or `Company\n Website` (personal domains like gmail.com never count), then by `Company\n LinkedIn URL`, else create it from `Company Name` (carrying `Company\n Website` → `Website`, `Company LinkedIn URL` → `LinkedIn URL`). A\n `Company Name` alone never links to an existing Account: the new Account\n is flagged \"Possible duplicate of <Name> (<domain>)\" against same-name\n Accounts whose domain does not differ, for a human to check (there is no\n merge yet). The one exception is a POC who is already a Contact of a\n same-name Account: the lead converts onto that Account;\n if a `POC` name exists, find-or-create the Contact (carrying `Email`,\n `Job Title`, `POC LinkedIn URL`) and link it to the Account; **if no POC\n name, create only the Account** and leave the opportunity's Primary\n Contact empty. Then stamp `Converted At` on the lead and open one\n `opportunity` in `Discovery` (deduped by the `Lead` link).\n- **Closed Won → Customer.** When `opportunity.Stage` becomes `Closed Won`:\n the linked Account's `Type` flips to `Customer` and `Customer Lifecycle`\n starts at `Onboarding`, with the deal owner set as `Account Owner`.\n\nConsequences for you:\n\n- **Set the status / stage and let the rule fire.** Don't hand-create the\n opportunity, account, or contact on qualify — that duplicates work. Write\n responses include an `automationEffects` array describing what the rule\n created/updated; that's expected, not a bug.\n- The created Account/Contact/Opportunity start with thin notes. Research\n their dossiers when requested; conversion alone does not authorize\n additional paid enrichment.\n- Rules fire on transitions only. Bulk imports and sample data don't\n retroactively fire them.\n- Campaign writebacks (`Status` → Contacted/Replied, `Last touch`) run with\n rules enabled and appear in `dench crm history` as field changes by the\n actor `Campaign: <sequence name>`. The per-event feed (sent, accepted,\n replied, skipped) is the record's History tab in the web app. The\n template's own rules ignore these writebacks (convert fires on\n `Qualified` only); a custom rule on `Status` will fire.\n- Every multichannel campaign and newsletter is also a CRM record of the\n `campaign` object (`Name`, `Kind` Sequence/Newsletter, `Channel`,\n `Status`, `Owner`, `Started at`, `Enrolled`, `Replied`, `Bounced`,\n `Source ID`). `dench crm entries list campaign` lists them; the rows are\n written by Outreach and cannot be created by hand. Older email\n sequences and LinkedIn sequences have no `campaign` record, so never\n count campaigns from that object: `dench campaign list` plus\n `dench email sequence list` covers them all. Find a campaign's\n record with\n `dench crm query campaign --where '{\"Name\":\"<name>\"}' --select Name,\"Source ID\" --json`;\n its `Source ID` is the campaign id the outreach commands take\n (`dench email multichannel …`, `dench campaign …`). `Replied` counts\n people who replied at least once, whether or not the campaign stopped\n for them; `Bounced` counts people whose email bounced. Each lead carries\n a multi-valued `Campaign` relation naming every campaign it was enrolled\n in, appended at enrollment and never removed —\n `dench crm query lead --where '{\"Campaign\":{\"$contains\":\"<campaign entry id>\"}}' --json`\n answers \"who is in this campaign\". A newsletter's `Enrolled` and\n `Status` refresh at lifecycle moments (submit, pause, resume, cancel,\n archive, completion); its `Bounced` ticks as bounces arrive.\n\n## Lead fields (sales template)\n\nThe base template ships `lead` with: `Name`, `Status`\n(New/Contacted/Replied/Qualified/Disqualified), raw `POC`, `Company Name`,\n`Company Website`, `Company LinkedIn URL`, `Email`, `Job Title`,\n`POC LinkedIn URL`, the `Account`/`Contact` relations (filled on convert,\nor `Contact` pre-linked by an outreach enrollment), `Source`, `Owner`,\n`Next Follow-Up`, `Last touch` (stamped by campaigns), `LinkedIn connection`\n(Not connected / Invited / Connected — moved forward by campaigns when a\nconnection request is sent or accepted), `Campaign` (relation to every\ncampaign the lead was enrolled in, appended by outreach), `Converted At`,\n`Tags`, and `Notes`.\n\n### Optional TAL / scoring extensions\n\nFor target-account-list and lead-scoring motions, add these `lead` fields\n(create them once with `dench crm fields create lead ...`; they are\nrecommended extensions, not part of the base template):\n\n- `Fit Score` (number) — 0–100 ICP fit.\n- `Fit Reason` (text) — one-line why-fit summary.\n- `Signal` (enum) — strongest buying signal (e.g. Recent Funding, New Exec\n Hire, Headcount Growth, Market Expansion).\n- `Vertical` (enum) — target segment.\n- `Funding Date` (date), `Funding Amount` (text), `Funding Source URL`\n (url) — funding-signal evidence.\n- `Draft Outreach Angle` (text) — one-line first-touch hook (draft only).\n- `Confidence` (enum: High/Medium/Low/Review Required).\n- `TAL Run Date` (date) — when a scheduled TAL run last updated the row\n (distinct from `Last touch`, which is outreach activity).\n\nKeep the heavy prose (per-section research, evidence, partnership ideas,\ndraft cold email) in `Notes`; these fields are the short, filterable/\nsortable facets you build views and reports on.\n\n## Role recipes\n\n**Founder / seller building a target account list**\n\nLoad `lead-finding`: discover → saved shortlist → optional confirmed\nenrichment → explicit import. Do not create a Lead for every\ncompany or install a pipeline merely to select prospects. After import,\nadd requested TAL fields and follow-ups to the selected CRM records.\n\n**Returning to a saved list in a new chat**\n\n- Find the list with `dench lists list --search \"<name or topic>\" --json`\n and follow cursors, not only the most recent results. Read fresh saved rows\n with `dench lists rows <id> --enrichment enriched --json` (or the requested\n enrichment filter); do not rely on an old transcript or CSV.\n- \"Add those people as Replied\" means the exact requested selection/filter\n and the workspace's configured Replied status. Use the original zero-based\n `index` values from `lists rows` with `dench artifacts import <id> --to lead\n --rows 0,4,9 --status \"Replied\" --json`. Reuse existing CRM records, preserve\n the list, and do not imply any messages were sent or received.\n- Artifact import with Qualified sets the Lead status only; it does not run\n conversion automation or create Account, Contact, or Opportunity records.\n A normal CRM qualification/status change outside import retains the\n configured automation behavior described below.\n\n**SDR / AE adding a single lead**\n- One `lead` with raw `POC` + `Company Name` (+ website/LinkedIn/email/\n title), the requested configured status (otherwise New), and any requested\n research or follow-up date. Don't touch `company`/`people` before qualification.\n\n**Research agent enriching leads before outreach**\n- For each lead: `enrich_person` the POC, research the company, and write\n the full `Notes` dossier (TL;DR, POC profile, company overview, why-now,\n partnership ideas, draft cold email, sources). Fill the raw LinkedIn/\n email/title fields. Leave relations empty.\n\n**Qualifying an existing CRM lead outside artifact import**\n- When the user explicitly requests sales qualification (not ICP review),\n set `Status = Qualified` and let the automation create\n the Account, (optional) Contact, and Opportunity. Research the new\n Account/Contact/Opportunity `Notes` only when asked; a status change does\n not authorize additional paid enrichment.\n\n**Sales manager reviewing pipeline**\n- Read the opportunity **Opportunities** view (kanban by `Stage`, summed\n `Amount`). Surface stale `Next Follow-Up` leads, opportunities with no\n recent activity, and deals missing `Amount`/`Close Date`.\n- Numbers are answered with the dashboard, not prose: the sales template\n installs analytics on `lead` (total, by source, conversion) and\n `opportunity` (open pipeline, win rate, by stage, forecast, won $ over\n time, by owner, by account HQ). In the web chat, `present_artifact({\n kind: \"analytics\", objectName: \"opportunity\", period: \"this_quarter\" })`\n shows the live dashboard; add `panelIds` for one chart or `panels` for an\n ad-hoc one (\"won $ by owner this quarter\" → a `leaderboard`, `metric:\n \"sum\"`, `metricField: \"Amount\"`, `groupBy: \"Owner\"`, `filters` on\n `Stage = Closed Won`). From a script, `dench crm analytics compute\n opportunity --period this_quarter --json` is the same math (see\n `references/CRM.md` → Analytics). `dench crm aggregate` / `reports\n generate` are one-shot JSON for scripts, not for showing people.\n\n**Preparing an opportunity plan**\n- On the opportunity `Notes`: scope, stakeholders, partnership/proposal\n ideas, what we're proposing, objections + answers, and the next step to\n advance the stage. Draft outreach as drafts only.\n\n## Discipline checklist (bias hard toward these)\n\n- New search prospect → a saved list. Only explicitly requested profiles\n become Leads; enrichment and ICP assessment are not prerequisites. Do not\n create Account/Contact rows first.\n- Raw `POC` + `Company Name` on the lead; relations stay empty until\n qualified.\n- Lead named `<Person> from <Company>` (or company-only when no POC).\n- Selected CRM records researched at the user's request get a `Notes`\n dossier; discovery lists do not require one per profile.\n- Explicit sales qualification through a normal CRM update sets\n `Status = Qualified` and lets the automation convert; artifact import sets\n status only. Don't hand-create the opportunity/account/contact.\n- One Account per real company; many opportunities over time; never convert\n an opportunity into another object.\n- Exclude `Sample`-tagged rows from real outreach, counts, and reports.\n- A pipeline / forecast / win-rate question gets a live chart\n (`present_artifact` kind `analytics`), never a markdown table of rows.\n- Outreach is draft-only unless the user explicitly authorized sending (see\n `references/EMAIL-CAMPAIGNS.md` for managed sending).\n"
70
+ "sha256": "903d2d7ba4f9c7b91192ab9330492b83fcb3d0d46fff8ab30d24af4c50e18c21",
71
+ "content": "---\nname: sales\ndescription: CRM sales pipeline playbook for explicitly adding leads, outreach prep, sales qualification, opportunities, forecasting, and existing account/contact research. Covers Leads -> Opportunities -> Customers, raw lead fields, naming, conversion, and selected-record Notes. For sales prospect discovery, outreach target-account lists, and saved prospect-list actions, load lead-finding first; search results stay outside the CRM until explicitly imported.\n---\n\n# Dench Sales Playbook (Sales Template, end to end)\n\nThis is the operating manual for running a real sales motion inside Dench.\nIt sits on top of the generic CRM playbook (`references/CRM.md`) — read that\nfirst for field types, batch writes, the protected `Notes` field, relation\nmodeling, and query syntax. This file covers the **sales discipline**: how\nleads, opportunities, accounts, and contacts fit together, and how you (the\nagent) should behave when working on the CRM sales pipeline.\n\n**Golden rule:** prospect discovery belongs in a saved prospect list. Load\n`lead-finding` for prospect discovery, optional confirmed enrichment, and explicit\nimport. It reads `/workspace/ORGANISATION.md` for who the workspace sells to\nand does not create `ICP.md`. The current request overrides that brief.\nIt saves one list at the requested count and stops.\nNo per-profile ICP approval is required. Once the user imports chosen prospects,\nmanage those Leads through the pipeline below; do not create premature\nAccount/Contact records.\n\n## When this playbook applies\n\nLoad and follow this playbook whenever the user's request involves any of:\n\n- \"new lead\", \"add this lead\", \"log this prospect\", \"enrich this lead\"\n- \"pipeline\", \"deals\", \"opportunities\", \"forecast\", \"what's in the pipeline\"\n- \"qualify\", \"move to qualified\", \"this lead is real\", \"book the deal\"\n- \"outreach\", \"cold email\", \"follow up\", \"sequence prep\", \"draft an intro\"\n- \"account research\", \"company research\", \"who's the POC\", \"find the\n decision maker\", \"research this founder\"\n- \"customers\", \"renewals\", \"churn\", \"expansion\", \"won/lost\"\n\nFor \"find leads\", TAL, ICP review, or \"who should we sell to\", use\n`lead-finding` instead. Discovery does not require installing a sales pipeline.\nOrdinary web, company, or hiring research without prospecting intent does not\nrequire `lead-finding` or ICP questions, reads, or scoring.\n\nIf the workspace does NOT yet have a sales pipeline and the user asks for\none (a \"sales CRM\", \"deal pipeline\", \"lead tracker\", \"CRM for sales\"),\n**recommend and install the Sales Template first** (see below) instead of\nhand-building objects.\n\n## The Sales Template\n\nOne install lays down the entire Salesforce-style motion:\n\n```bash\ndench crm templates list --json # see catalog + installed flags\ndench crm templates install sales # idempotent; safe to re-run\ndench crm templates remove-sample-data sales # drop the demo rows when ready\n```\n\nWhat it creates:\n\n- **`lead`** — the inbox for unqualified demand: explicitly imported\n prospects and inbound hand-raisers. Worked by outbound/SDR motion.\n- **`opportunity`** — active revenue pursuits. One per deal; a company can\n have many over time (new business, renewal, expansion).\n- **`case`** — customer issues/requests, linked to Account + Contact.\n- **`company`** relabeled **Accounts** — the durable company spine. ONE\n record per real company. Gains `Type`, `Source`, `Customer Lifecycle`,\n `Account Owner`, `Renewal Date`, plus a pinned **Customers** view.\n- **`people`** relabeled **Contacts** — the durable person spine.\n- **Saved views** pinned on a first-template install: **Leads** (kanban\n by `Status`), **Opportunities** (kanban by `Stage`, summing `Amount`),\n and the accounts **Customers** kanban. Cases stay off the rail. A later\n template install adds its views unpinned.\n- **Deterministic automations** (fire inside writes — see Automations below).\n- A **workspace rule** describing the motion, and a few cross-linked\n **sample rows** (tagged `Sample`).\n\nInstalls are idempotent and compose — re-running tops up anything missing\nwithout duplicating. Canonical object names stay `company`/`people` even\nthough the UI shows Accounts/Contacts; use the canonical names in commands.\n\n## The mental model (Salesforce-style)\n\n```\nlead ──qualify──▶ opportunity ──Closed Won──▶ Account.Type = Customer\n │ │\n │ (on qualify) ├─ Account (company spine, 1 per company)\n └─ raw POC + company └─ Primary Contact (people spine)\n```\n\n- **Leads are raw, disposable, pre-relationship.** A lead is \"someone we\n might sell to\" plus the research behind that hunch. Leads are NOT durable\n records — they get qualified (promoted) or disqualified (dropped).\n- **Opportunities are money.** An opportunity only exists once a lead is\n qualified. It tracks one pursuit through stages to Won/Lost.\n- **Accounts and Contacts are the durable spine.** They outlive any single\n deal. Relationship history, notes, and ownership live here.\n- **Customers are not a table.** A company becomes a customer when it has a\n Closed Won opportunity — the automation flips `company.Type = Customer`\n and starts `Customer Lifecycle` on the first win (later wins leave it). Manage customers via the Accounts\n \"Customers\" view, not a separate object.\n\n## The raw-lead-until-qualified rule (important)\n\n**Before a lead is qualified, do NOT create related Account/Contact rows.**\nA prospect explicitly imported from a saved list is a single `lead` row holding *raw* fields —\nnot links to `company`/`people`. This keeps the spine clean (no half-baked\ncompanies/contacts created for prospects that never convert).\n\nSo when you add or import leads:\n\n- Put the company identity in **raw text/url fields on the lead**:\n `Company Name`, `Company Website`, `Company LinkedIn URL`.\n- Put the point-of-contact in **raw fields on the lead**: `POC` (person\n name), `POC LinkedIn URL`, `Email`, `Job Title`.\n- Leave the `Account` **relation** field EMPTY. It gets filled by the\n qualify-to-convert automation, not by you up front.\n- Leave `Contact` EMPTY too unless the person already exists as a `people`\n row. Do not create a `company` row or a `people` row \"to be safe\". Don't.\n\nTwo cases where a pre-qualification lead legitimately carries a link:\n\n- The company or contact **already exists** in the spine (e.g. an existing\n customer raises a new need) — link it; conversion reuses the record.\n- **An outreach enrollment did it.** Enrolling a `people` row in a campaign\n (`dench campaign add <campaign> --object people --entries <ids>` or\n `--view \"<view>\"`, or the Add people dialog; see `references/CAMPAIGNS.md`)\n finds or creates the lead for that person and sets its `Contact` to the\n existing row, so all campaign activity lands on one lead. That is\n expected — leave the link alone. `Account` is never pre-linked this way.\n\n## Lead naming convention\n\nA lead's `Name` is the headline you see in the list/kanban. Use:\n\n- **`<Person Name> from <Company>`** when you know the POC.\n e.g. `Jane Okafor from Acme`, `Marcus Bell from Vercel`.\n- **Just the company name** when the POC is not yet identified.\n e.g. `Acme` — and make \"find the POC\" the next action. Do **not** write\n placeholders like \"Unknown POC from Acme\"; the bare company name is the\n correct title until a real person is found.\n\n## Deep-research Notes (selected rows, not list-builds)\n\nA Notes dossier is for **researching a specific record**, not for every row\nof a 5K find. List-building (`search_people` / `search_companies` /\n`search_jobs`) writes identities into a saved list artifact. That is complete\nwork for a find. Only an explicit import of requested profiles creates Leads;\nthose rows may have empty Notes.\n\nWhen the user asks to research a selected lead/contact/account/opportunity,\nthe dossier is the product. A one-line dossier on a researched row is\nincomplete — treat it like a failed tool call and fill it before you report\ndone.\n\n**Where it goes.** Before researching, read what the workspace already knows:\n`dench crm activity <object> <id> --json` (emails, meetings, Slack, LinkedIn,\ncomments, earlier notes — see `references/CRM.md`, \"The Activity Ledger\").\nThen:\n\n- A record **you are creating** → write the dossier into its `Notes`\n document (the rules below).\n- A record that **already exists** → add a NEW timeline note:\n `dench crm notes create <object> <id> --title \"Research — <date>\"\n --body-file …`. Never overwrite the human's `Notes` document with it.\n- An **account Dench created on its own** (detected from email, a Slack\n Connect channel, a LinkedIn conversation, a calendar invitee) already\n carries a generated dossier section in `Notes`, between\n `<!-- dench:dossier -->` markers (`dench crm entries dossier <id> --json`\n says when it was written). Read it first, add your findings BELOW it as a\n timeline note, never edit or duplicate it; `--regenerate` asks Dench to\n research again. See `references/CRM.md`, \"The account dossier\".\n\nBefore you say a **researched** record is done, re-read its `Notes` and ask:\n\"could a teammate brief themselves on this in 90 seconds and know exactly\nwhat to do next?\" If not, improve the research; do not buy contact data\nunless the user requested it.\n\nWhat belongs in `Notes` per object (write as Markdown; `Notes` is the\nprotected richtext field on every object — never invent `Description`/\n`Research`/`Bio` columns):\n\n- **Lead `Notes`** — the prospect dossier:\n - TL;DR: who they are, why they're a fit, the single strongest signal.\n - The POC: name, role, why they're the right person, LinkedIn.\n - Company overview: what they do, stage, size, website, funding/signal\n evidence with source URLs.\n - Why now: the concrete reason to reach out this week.\n - Partnership / proposal ideas: how we'd actually serve or partner with\n them.\n - A draft cold-email / first-touch angle (draft only — never auto-send).\n - Source log + confidence + any gaps.\n- **Contact (`people`) `Notes`** — deep research on the *person*: role and\n scope, background, what they care about, how they buy, relationship\n history, how to reach them.\n- **Account (`company`) `Notes`** — deep research on the *company*:\n business, market, structure, current vendors/stack, risks, and\n partnership/serve ideas tailored to them.\n- **Opportunity `Notes`** — the deal plan: scope, stakeholders, partnership/\n proposal ideas, what we're proposing, objections, next steps, and the\n path to Closed Won.\n\nWhen the user requests contact enrichment for existing CRM records, use\n`enrich_person` (verified email/LinkedIn by name + company) — and only\never write a contact email/phone that came back from an enrichment tool,\nnever a guessed `first.last@company` (see CRM.md Safety/Enrichment).\n\n## The pipeline flow (after explicit import)\n\n1. **Find → saved list.** For prospecting, load `lead-finding`; it owns\n the shortlist, optional enrichment confirmation, and explicit import flow.\n Search results stay outside Leads. Selecting a profile or suggesting ICP\n fit is not the sales `Qualified` status and does not trigger conversion.\n2. **Capture → `lead`, only on request.** Each explicitly imported profile\n is a `lead` with raw `POC` +\n `Company Name` (+ website, LinkedIn, email, title), named\n `<Person> from <Company>` (or company-only if no POC). Notes optional.\n Imports dedupe by identity (LinkedIn > email > domain): a row matching\n an existing entry reuses it — saving the same rows to another view pins\n the same entries there, never duplicates. Enrichment is optional. Apply\n the user's requested configured status; without one, new imports start\n at New and reused records keep their status. Never default to Qualified.\n Artifact import sets status without running conversion/outreach automations,\n even when the requested status is Qualified. It creates/reuses the Lead\n only; normal CRM status updates are a separate action with normal automation\n behavior.\n3. **Research → lead `Notes`.** Only when asked to research selected rows:\n enrich the POC and company; write the full dossier. Set `Next Follow-Up`.\n4. **Work the status.** `Status` is the source of truth — don't track it\n in prose. Campaigns move it for you, forward-only: the first invite,\n LinkedIn message, or email delivered sets New → Contacted, and a reply\n sets Replied. `Last touch` holds the time of the latest interaction\n (send, acceptance, reply). The user may explicitly request a status on\n import or an existing record; read the configured options rather than\n inventing one. Setting Contacted/Replied alone does not send outreach,\n create message history, or stamp a fabricated interaction. Never move a\n status backwards incidentally during deduplication. Keep `Next Follow-Up`\n current when the task calls for it.\n5. **Qualify.** When the lead is real (budget/fit/intent), set\n `Status = Qualified`. **Do not hand-create the opportunity, account, or\n contact** — the automation does it (next section). Disqualified leads go\n to `Disqualified`, not deleted.\n6. **Convert (automatic).** The qualify automation reuses the Account\n whose website matches the lead's email / `Company Website` domain, else\n creates one (a `Company Name` alone never links: a same-name Account is\n only flagged \"Possible duplicate\"), creates/reuses the Contact by the\n lead's `Email`, then `POC LinkedIn URL`, then `POC` name (a lead with an\n `Email` and no POC name still gets a Contact for that email — it is the\n point of contact; keep it), links them on the lead, stamps `Converted\n At`, and opens one `opportunity` in `Discovery` linked to the\n lead/Account/Contact.\n7. **Plan the opportunity.** Fill the opportunity `Notes` deal plan, set\n `Amount` and `Close Date`, and move `Stage` Discovery → Proposal →\n Negotiation.\n8. **Close.** The first `Stage = Closed Won` on an Account flips it to\n Customer and starts `Customer Lifecycle = Onboarding` (automatic). A\n later win (renewal, expansion) on an Account that is already a Customer\n leaves its `Customer Lifecycle` and `Account Owner` alone; add a task on\n the Account for any setup work. `Closed Lost` ends the pursuit; the\n account/contact remain for future opportunities.\n9. **Keep the spine current.** Ongoing relationship notes, renewals, and\n expansion live on the Account/Contact, and new pursuits open as NEW\n opportunities on the same Account.\n\n## Find filter values (use the canonical vocabularies)\n\nThe find lanes take two kinds of filters — check which kind before\nguessing values:\n\n- **Closed vocabularies** — a value outside the list matches nothing, so\n look them up rather than inventing:\n - `seniorities`: Owner, Founder, C-level, Partner, VP, Head, Director,\n Manager, Senior.\n - `headcountRanges`: `1-10`, `11-50`, `51-200`, `201-500`, `501-1000`,\n `1001-5000`, `5001-10000`, `10001+`.\n - `companyTypes`: Partnership, Nonprofit, Educational, Privately Held,\n Public Company, Self-Owned, Self-Employed, Government Agency.\n - `jobFunctions` / `subFunctions`, `languages`: long enums.\n - `industries`: also a canonical list (\"Software Development\", not\n \"software\"), but it is matched loosely, so a partial value still\n works. Prefer the canonical one — it is more precise and keeps every\n provider eligible.\n- **Free text with curated suggestions** — `titles`, `pastTitles`,\n `locations`, `companyHeadquarters`, `universities`, `skills`,\n `keywords`. Custom values work; the catalogs give proven spellings\n (e.g. \"San Francisco Bay Area\", \"Massachusetts Institute of\n Technology\").\n\n### How values are matched\n\nFree text matches as a **substring**, so `titles: [\"Founder\"]` also\nreturns \"Co-Founder\" and \"Founder & CEO\". That is usually what you want,\nbut it widens results several-fold — one live query went from 706 to\n22,558 — so a 500-row cap fills with weaker matches. Pass\n`exactMatch: true` (`--exact` on the CLI) to require whole strings when\nthe broad list is too noisy.\n\nThree things ignore that flag and are always exact: identifiers\n(`companyDomains`, `linkedinUrl`), the closed vocabularies above, and\nnumeric ranges. `keywords` is always loose — it is a text probe over the\ncurrent title, not a value to equal.\n\nOn the CLI, a filter value that itself contains a comma is kept whole\nwhen it matches a known vocabulary entry, so\n`--industries \"Technology, Information and Internet\"` is one industry\nrather than two. Quote the value, or repeat the flag, to be explicit.\nSplitting it by hand produces values that exist in no vocabulary and the\nprovider rejects the entire search.\n\nDiscover both from the same catalog:\n\n```bash\ndench leads filters # everything\ndench leads filters --filter industries --search \"software\"\ndench leads filters --filter company-hq --search \"berlin\"\n```\n\nor fetch <https://dench.com/references/find-filter-options.json>. A\ngenerated lead-finder skill should reference these vocabularies instead\nof hard-coding guessed filter values.\n\n## Automations (what fires for you)\n\nThe sales template installs deterministic rules that run *inside* the write\nthat triggers them (`dench crm automations list --json` to inspect):\n\nThese are normal CRM-write rules. `dench artifacts import` skips them for\nboth new and reused Leads, including when importing with `--status Qualified`.\n\n- **Qualified lead → Account + Contact + Opportunity.** When `lead.Status`\n becomes `Qualified`: reuse `Account`/`Contact` if already linked; else\n match the Account by the domain of the lead's work `Email` or `Company\n Website` (personal domains like gmail.com never count), then by `Company\n LinkedIn URL`, else create it from `Company Name` (carrying `Company\n Website` → `Website`, `Company LinkedIn URL` → `LinkedIn URL`). A\n `Company Name` alone never links to an existing Account: the new Account\n is flagged \"Possible duplicate of <Name> (<domain>)\" against same-name\n Accounts whose domain does not differ, for a human to check (there is no\n merge yet). The one exception is a POC who is already a Contact of a\n same-name Account: the lead converts onto that Account.\n Find-or-create the Contact by the lead's `Email`, then `POC LinkedIn\n URL`, then `POC` name (carrying `Email`, `Job Title`, `POC LinkedIn URL`)\n and link it to the Account. **A lead with an `Email` but no POC name\n still gets a Contact for that email** (named from the address, or left\n blank) — it is the point of contact, so keep it and link it as the\n opportunity's Primary Contact. Only a lead with no email, no POC LinkedIn\n URL and no POC name converts Account-only. Then stamp `Converted At` on\n the lead and open one `opportunity` in `Discovery` (deduped by the\n `Lead` link).\n- **Closed Won → Customer (first win only).** When `opportunity.Stage`\n becomes `Closed Won` on an Account that is not yet a Customer: its\n `Type` flips to `Customer`, `Customer Lifecycle` starts at `Onboarding`,\n and the deal owner (if set) becomes `Account Owner`. A repeat win on an\n Account whose `Type` is already `Customer` changes nothing on the\n Account (its lifecycle and owner stay); no task is created\n automatically.\n\nConsequences for you:\n\n- **Set the status / stage and let the rule fire.** Don't hand-create the\n opportunity, account, or contact on qualify — that duplicates work. Write\n responses include an `automationEffects` array describing what the rule\n created/updated; that's expected, not a bug.\n- The created Account/Contact/Opportunity start with thin notes. Research\n their dossiers when requested; conversion alone does not authorize\n additional paid enrichment.\n- Rules fire on transitions only. Bulk imports and sample data don't\n retroactively fire them.\n- Campaign writebacks (`Status` → Contacted/Replied, `Last touch`) run with\n rules enabled and appear in `dench crm history` as field changes by the\n actor `Campaign: <sequence name>`. The per-event feed (sent, accepted,\n replied, skipped) is the record's History tab in the web app. The\n template's own rules ignore these writebacks (convert fires on\n `Qualified` only); a custom rule on `Status` will fire.\n- Every multichannel campaign and newsletter is also a CRM record of the\n `campaign` object (`Name`, `Kind` Sequence/Newsletter, `Channel`,\n `Status`, `Owner`, `Started at`, `Enrolled`, `Replied`, `Bounced`,\n `Source ID`). `dench crm entries list campaign` lists them; the rows are\n written by Outreach and cannot be created by hand. Older email\n sequences and LinkedIn sequences have no `campaign` record, so never\n count campaigns from that object: `dench campaign list` plus\n `dench email sequence list` covers them all. Find a campaign's\n record with\n `dench crm query campaign --where '{\"Name\":\"<name>\"}' --select Name,\"Source ID\" --json`;\n its `Source ID` is the campaign id the outreach commands take\n (`dench email multichannel …`, `dench campaign …`). `Replied` counts\n people who replied at least once, whether or not the campaign stopped\n for them; `Bounced` counts people whose email bounced. Each lead carries\n a multi-valued `Campaign` relation naming every campaign it was enrolled\n in, appended at enrollment and never removed —\n `dench crm query lead --where '{\"Campaign\":{\"$contains\":\"<campaign entry id>\"}}' --json`\n answers \"who is in this campaign\". A newsletter's `Enrolled` and\n `Status` refresh at lifecycle moments (submit, pause, resume, cancel,\n archive, completion); its `Bounced` ticks as bounces arrive.\n\n## Lead fields (sales template)\n\nThe base template ships `lead` with: `Name`, `Status`\n(New/Contacted/Replied/Qualified/Disqualified), raw `POC`, `Company Name`,\n`Company Website`, `Company LinkedIn URL`, `Email`, `Job Title`,\n`POC LinkedIn URL`, the `Account`/`Contact` relations (filled on convert,\nor `Contact` pre-linked by an outreach enrollment), `Source`, `Owner`,\n`Next Follow-Up`, `Last touch` (stamped by campaigns), `LinkedIn connection`\n(Not connected / Invited / Connected — moved forward by campaigns when a\nconnection request is sent or accepted), `Campaign` (relation to every\ncampaign the lead was enrolled in, appended by outreach), `Converted At`,\n`Tags`, and `Notes`.\n\n### Optional TAL / scoring extensions\n\nFor target-account-list and lead-scoring motions, add these `lead` fields\n(create them once with `dench crm fields create lead ...`; they are\nrecommended extensions, not part of the base template):\n\n- `Fit Score` (number) — 0–100 ICP fit.\n- `Fit Reason` (text) — one-line why-fit summary.\n- `Signal` (enum) — strongest buying signal (e.g. Recent Funding, New Exec\n Hire, Headcount Growth, Market Expansion).\n- `Vertical` (enum) — target segment.\n- `Funding Date` (date), `Funding Amount` (text), `Funding Source URL`\n (url) — funding-signal evidence.\n- `Draft Outreach Angle` (text) — one-line first-touch hook (draft only).\n- `Confidence` (enum: High/Medium/Low/Review Required).\n- `TAL Run Date` (date) — when a scheduled TAL run last updated the row\n (distinct from `Last touch`, which is outreach activity).\n\nKeep the heavy prose (per-section research, evidence, partnership ideas,\ndraft cold email) in `Notes`; these fields are the short, filterable/\nsortable facets you build views and reports on.\n\n## Role recipes\n\n**Founder / seller building a target account list**\n\nLoad `lead-finding`: discover → saved shortlist → optional confirmed\nenrichment → explicit import. Do not create a Lead for every\ncompany or install a pipeline merely to select prospects. After import,\nadd requested TAL fields and follow-ups to the selected CRM records.\n\n**Returning to a saved list in a new chat**\n\n- Find the list with `dench lists list --search \"<name or topic>\" --json`\n and follow cursors, not only the most recent results. Read fresh saved rows\n with `dench lists rows <id> --enrichment enriched --json` (or the requested\n enrichment filter); do not rely on an old transcript or CSV.\n- \"Add those people as Replied\" means the exact requested selection/filter\n and the workspace's configured Replied status. Use the original zero-based\n `index` values from `lists rows` with `dench artifacts import <id> --to lead\n --rows 0,4,9 --status \"Replied\" --json`. Reuse existing CRM records, preserve\n the list, and do not imply any messages were sent or received.\n- Artifact import with Qualified sets the Lead status only; it does not run\n conversion automation or create Account, Contact, or Opportunity records.\n A normal CRM qualification/status change outside import retains the\n configured automation behavior described below.\n\n**SDR / AE adding a single lead**\n- One `lead` with raw `POC` + `Company Name` (+ website/LinkedIn/email/\n title), the requested configured status (otherwise New), and any requested\n research or follow-up date. Don't touch `company`/`people` before qualification.\n\n**Research agent enriching leads before outreach**\n- For each lead: `enrich_person` the POC, research the company, and write\n the full `Notes` dossier (TL;DR, POC profile, company overview, why-now,\n partnership ideas, draft cold email, sources). Fill the raw LinkedIn/\n email/title fields. Leave relations empty.\n\n**Qualifying an existing CRM lead outside artifact import**\n- When the user explicitly requests sales qualification (not ICP review),\n set `Status = Qualified` and let the automation create\n the Account, (optional) Contact, and Opportunity. Research the new\n Account/Contact/Opportunity `Notes` only when asked; a status change does\n not authorize additional paid enrichment.\n\n**Sales manager reviewing pipeline**\n- Read the opportunity **Opportunities** view (kanban by `Stage`, summed\n `Amount`). Surface stale `Next Follow-Up` leads, opportunities with no\n recent activity, and deals missing `Amount`/`Close Date`.\n- Numbers are answered with the dashboard, not prose: the sales template\n installs analytics on `lead` (total, by source, conversion) and\n `opportunity` (open pipeline, win rate, by stage, forecast, won $ over\n time, by owner, by account HQ). In the web chat, `present_artifact({\n kind: \"analytics\", objectName: \"opportunity\", period: \"this_quarter\" })`\n shows the live dashboard; add `panelIds` for one chart or `panels` for an\n ad-hoc one (\"won $ by owner this quarter\" → a `leaderboard`, `metric:\n \"sum\"`, `metricField: \"Amount\"`, `groupBy: \"Owner\"`, `filters` on\n `Stage = Closed Won`). From a script, `dench crm analytics compute\n opportunity --period this_quarter --json` is the same math (see\n `references/CRM.md` → Analytics). `dench crm aggregate` / `reports\n generate` are one-shot JSON for scripts, not for showing people.\n\n**Preparing an opportunity plan**\n- On the opportunity `Notes`: scope, stakeholders, partnership/proposal\n ideas, what we're proposing, objections + answers, and the next step to\n advance the stage. Draft outreach as drafts only.\n\n## Discipline checklist (bias hard toward these)\n\n- New search prospect → a saved list. Only explicitly requested profiles\n become Leads; enrichment and ICP assessment are not prerequisites. Do not\n create Account/Contact rows first.\n- Raw `POC` + `Company Name` on the lead; relations stay empty until\n qualified.\n- Lead named `<Person> from <Company>` (or company-only when no POC).\n- Selected CRM records researched at the user's request get a `Notes`\n dossier; discovery lists do not require one per profile.\n- Explicit sales qualification through a normal CRM update sets\n `Status = Qualified` and lets the automation convert; artifact import sets\n status only. Don't hand-create the opportunity/account/contact.\n- One Account per real company; many opportunities over time; never convert\n an opportunity into another object.\n- Exclude `Sample`-tagged rows from real outreach, counts, and reports.\n- A pipeline / forecast / win-rate question gets a live chart\n (`present_artifact` kind `analytics`), never a markdown table of rows.\n- Outreach is draft-only unless the user explicitly authorized sending (see\n `references/EMAIL-CAMPAIGNS.md` for managed sending).\n"
72
72
  }
73
73
  }
74
74
  }
package/meetings.ts CHANGED
@@ -214,7 +214,7 @@ async function runShare(ctx: CrmCliContext): Promise<void> {
214
214
  );
215
215
  if (!current.canShare) {
216
216
  console.log(
217
- "You cannot change this: only the meeting's owner or a workspace admin can.",
217
+ "You cannot change this: only the meeting's owner can share it, and a workspace admin can only make it private.",
218
218
  );
219
219
  }
220
220
  return;
@@ -743,7 +743,8 @@ Sharing:
743
743
  dench meetings share <meetingId> print who can read it
744
744
  dench meetings share <meetingId> --workspace open it to every member
745
745
  dench meetings share <meetingId> --private back to owner + invitees
746
- Only the meeting's owner or a workspace admin can change this. To
746
+ Only the owner can share it; the owner or a workspace admin can make
747
+ it private (an admin can never open a teammate's meeting). To
747
748
  change the default for NEW recordings, use Settings › Meetings.
748
749
 
749
750
  Transcript (meetingTranscriptSegments):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dench.com/cli",
3
- "version": "3.11.33-staging.725",
3
+ "version": "3.11.35-staging.803",
4
4
  "description": "Dench agent workspace CLI.",
5
5
  "type": "module",
6
6
  "bin": {