@sanity/assist
AI-powered writing, translation, and image-description assistant for Sanity Studio
Repository Health
Technical Analysis
@sanity/assist (Sanity AI Assist) is an official plugin for Sanity Studio that attaches reusable, editor-authored AI instructions to individual fields and documents. Instead of hard-coding prompts, content teams write natural-language instructions once and let the plugin generate or refine text, translate full documents or single fields, and produce image descriptions on demand from inside the editing surface.
It ships as a monorepo package published from sanity-io/plugins, wiring into the Studio’s structure, presence, and form-component systems so instructions, translation actions, and generated content show up as native parts of the document editor rather than a bolted-on side panel.
What You Get
- A
assist()plugin export that registers AI Assist inspectors, presence indicators, and field actions into an existing Sanity Studio configuration - Per-field and per-document-type instruction authoring, with the ability to disable AI Assist for specific schema types, fields, or array items
- Full-document and field-level translation actions that respect a configurable translation style guide
- Automatic image description generation for image fields, plus AI-assisted image generation
- Custom field-action hooks (
useExampleFieldActions,useUserInput) for building bespoke AI-driven editing UI on top of the same primitives
Common Use Cases
- Letting non-technical editors generate first-draft copy for a field by writing a plain-language instruction once, instead of prompting an LLM manually outside the CMS
- Translating an entire localized document (or just the fields that changed) into other configured languages directly from the document editor
- Auto-generating alt-text/image descriptions for editorial images at upload time to improve accessibility and SEO without extra editor effort
- Building custom AI-assisted field actions (e.g. summarization, tone rewriting) on top of the plugin’s connector and instruction primitives
Under The Hood
Architecture @sanity/assist is a Sanity Studio plugin: src/plugin.tsx registers document/form-level extensions (inspectors, presence, field actions) into the Studio’s plugin system, while src/assistDocument, src/assistInspector, and src/assistConnectors implement the instruction-authoring UI, task-status presence indicators, and the visual “connector” overlays that link an instruction to the field it targets; src/translate layers full-document and field-level translation actions on top of the same instruction/task machinery, and src/_lib holds shared listening-query and form utilities reused across those modules.
Tech Stack It is a TypeScript React library built against the sanity and @sanity/ui peer dependencies, using @sanity/client for API access, rxjs (plus rxjs-exhaustmap-with-trailing) for the reactive task/presence streams, @sanity/mutator and @portabletext/types for document/content-model interop, and styled-components for styling; it is built with tsdown and lives in the pnpm/Turborepo-managed sanity-io/plugins monorepo alongside dozens of sibling Studio plugins sharing a common tooling catalog.
Code Quality The package includes unit tests colocated with source (src/index.test.ts, src/translate/paths.test.ts, src/assistInspector/isolatePathParams.test.ts) run via Vitest, strict TypeScript configuration via @sanity/tsconfig, and a modular directory-per-concern layout (translate, assistInspector, assistConnectors, assistLayout, fieldActions, onboarding) that keeps the instruction-authoring, presence, and translation feature areas independently testable; as a Sanity-maintained monorepo package it also inherits repo-wide linting, formatting, and pre-commit hooks.
API Design The public surface is a single assist() plugin factory dropped into a Studio’s plugins array, with schema-level configuration expressed through familiar Sanity schema option fields rather than a separate config file, and exported hooks (useExampleFieldActions, useUserInput) for extending it — keeping the day-to-day integration surface small while still exposing lower-level building blocks for teams that want custom AI field actions.