Allows managing and consuming structured content within Astro web projects.
Provides a framework-agnostic way to manage and deliver content to Expo applications.
Supports content delivery and management for Flutter mobile and web apps.
Enforces a mandatory Git-based workflow for content versioning, branch-backed reviews, and auditability.
Enables Kotlin applications to consume governed content stored within the repository.
Utilizes Markdown for content storage and platform-independent delivery.
Supports consuming governed content within Node.js environments.
Facilitates structured content management and consumption for Nuxt applications.
Allows Python applications to directly consume governed content as plain JSON or Markdown.
Provides tools for managing and querying content within React-based applications.
Enables Rust applications to consume repository-native content.
Supports delivering governed content to Swift applications on any platform.
Generates a type-safe SDK for querying governed content within TypeScript projects.
Contentrain AI
AI-generated content governance infrastructure.
Contentrain is for teams that want to use AI agents to produce content without giving up structure, reviewability, or runtime safety.
Instead of treating content generation as a loose prompt workflow, Contentrain turns it into a governed system:
the agent decides what content should exist
MCP and CLI enforce deterministic writes, validation, and git workflow
humans review the result
content is delivered as plain JSON/Markdown to any platform (optional TypeScript SDK for convenience)
In one sentence:
Agent produces. Human approves. System standardizes.
โจ Why This Exists
AI is very good at producing copy, labels, docs, translations, and structured content.
AI is not good at protecting your repository from drift.
Without a governance layer, AI-assisted content work usually turns into one or more of these problems:
hardcoded strings spread through source files
schema drift between teams and environments
inconsistent locales and missing translations
direct edits with no review branch or audit trail
content that is easy to generate but hard to consume safely at runtime
IDE agents that each invent their own workflow
Contentrain exists to solve that gap.
It is not just "AI for content".
It is a system for AI-assisted content operations:
content modeling
content storage
validation
normalization
review workflow
runtime consumption
agent guidance
๐งฉ What Contentrain Is
Published packages:
Contentrain is a monorepo containing the open-source building blocks of the ecosystem:
Package | Name | Role |
|
| local-first MCP server and deterministic content operations |
|
| CLI, local review UI, stdio MCP entrypoint |
|
| shared domain contracts |
|
| agent policy, quality rules, IDE bundles |
|
| workflow procedures and framework guides |
|
| generated query SDK and runtime |
Together, these packages form a single workflow:
detect or model content
write it into a governed
.contentrain/structurevalidate it
review it through branches and UI
deliver content as plain JSON/Markdown to any platform
๐ Core Workflow
1. Initialize a project
contentrain init creates the .contentrain/ workspace, project config, vocabulary, context file, git-safe defaults, and project-level agent rules.
npx contentrain init2. Model and write content
Content is stored in a deterministic JSON and markdown structure inside .contentrain/.
The MCP layer handles:
config
models
entries
metadata
validation
branch lifecycle
The agent decides what to write. The system decides how it is stored and reviewed.
3. Validate and review
contentrain validate
contentrain diff
contentrain serveWrite operations can flow through review branches instead of mutating the base branch directly.
That gives you:
auditability
safer collaboration with agents
cleaner merge flow
branch-pressure awareness
4. Use your content
Content is plain JSON and Markdown โ any platform that reads files can consume it directly.
For TypeScript projects, optionally generate a typed SDK client:
contentrain generateimport { query, singleton, dictionary, document } from '#contentrain'
const hero = singleton('hero').locale('en').get()
const posts = query('blog-post').locale('en').all()โ๏ธ How It Works
MCP is deterministic infrastructure
@contentrain/mcp is the execution engine.
It manages:
filesystem writes
canonical serialization
schema-aware validation
git-backed branch workflow
normalize scan and apply flows
context tracking
It does not decide content semantics for you.
That boundary is deliberate.
The agent is the intelligence layer
The agent decides:
whether a string is user-facing
how to model content
what key or entry should be created
which replacement expression is correct for the current framework
This split matters.
Contentrain is designed around:
MCP = deterministic infra
Agent = intelligence
That is the reason the system stays predictable even when the content work itself is AI-assisted.
Rules and skills are first-class
Most tools stop at APIs.
Contentrain also packages how agents should behave:
@contentrain/rulesdefines policy and constraints@contentrain/skillsdefines workflow playbooks and framework-specific guidance
This makes agent behavior part of the product surface instead of leaving it implicit.
๐ง Key Design Principles
JSON only
Contentrain uses JSON and markdown. No YAML storage layer.Git is mandatory
Content work is part of the repository lifecycle, not a side channel.Review is a product feature
Branch-backed review is not an afterthought; it is part of the core workflow.Platform-independent output Content is plain JSON and Markdown. Any language (Go, Python, Swift, Kotlin, Rust) can consume it. The TypeScript SDK is optional convenience, not a requirement.
Framework-agnostic core Stack-specific decisions belong to the agent and framework guides, not to the MCP engine.
Local-first
The MCP layer works locally and does not depend on a hosted Git provider API.
๐ What Makes Contentrain Different
Contentrain is not best described as a CMS.
It is closer to a content governance operating layer for codebase-native teams.
It combines traits from several categories:
headless CMS: models, entries, locales
GitOps: review branches, merge flow, auditability
MCP tooling: agent-native local execution
code generation: typed runtime client
agent operations: rules and workflow skills
That combination is the point.
The problem Contentrain solves is not just "where should content live?"
It is:
How do we let AI agents work on content inside a real codebase without turning the repository into chaos?
๐ Quick Start
Requirements:
Node.js 22+
pnpm 9+
Git in
PATH
Install dependencies:
pnpm installInitialize a project:
contentrain initInspect state:
contentrain status
contentrain doctorGenerate the SDK:
contentrain generateOpen the local UI:
contentrain serveUse MCP over stdio for IDE agents:
contentrain serve --stdio๐ Example Use Cases
Normalize hardcoded strings
Scan a product codebase, extract user-facing strings into governed content, and patch source files through a two-phase normalize workflow.
Run AI-assisted docs or marketing workflows
Let an agent propose docs, landing page copy, or UI labels while keeping schema, locale coverage, and review flow intact.
Build app-facing content without a separate CMS
Store content in the repo as plain JSON. Consume from any platform โ Vue, React, Next, Nuxt, Astro, Node, Go, Python, Swift, Flutter, Expo, or React Native. Optionally use the TypeScript SDK for type-safe queries.
Standardize agent behavior across IDEs
Ship the same behavioral rules to Claude Code, Cursor, Windsurf, and generic agent setups.
๐ฆ Package Guide
If you want to go deeper package by package:
๐ Documentation
ai.contentrain.io โ full documentation site
Package READMEs for public package contracts
RELEASING.mdfor versioning and publish flowpackages/rules/andpackages/skills/for agent-facing operational guidance
๐ Contentrain Studio
For team collaboration, visual content review, and content CDN for non-web platforms โ Contentrain Studio extends the open-source tools with a hosted governance UI.
๐งช Development
From the monorepo root:
pnpm build
pnpm test
pnpm lint
pnpm typecheck๐ข Release
Contentrain uses Changesets for package-specific versioning, changelogs, tags, and npm publishing.
pnpm changeset
pnpm version-packages
pnpm release:check
pnpm releaseFor the full release workflow, see RELEASING.md.
๐ License
MIT