Docs

context.config.ts

The single source of truth for all your AI context files.

Create a context.config.ts at your project root using the defineContext() helper exported from contextai. The config is type-safe and validated at runtime with Zod.

Full example

typescript
import { defineContext } from 'contextai';

export default defineContext({
  project: {
    name: 'my-app',
    stack: ['TypeScript', 'React', 'Node.js'],
    architecture: 'Monorepo with shared packages',
  },
  conventions: {
    code: [
      {
        title: 'Naming',
        items: ['camelCase for variables', 'PascalCase for components'],
      },
    ],
    security: [
      {
        title: 'Auth',
        items: ['Use JWT tokens', 'Rotate secrets quarterly'],
        scope: 'agent-only',
      },
    ],
  },
  outputs: {
    'AGENTS.md': true,
    'CLAUDE.md': true,
    '.cursorrules': true,
    '.github/copilot-instructions.md': true,
    'llms.txt': true,
    '.kiro/steering': true,
    '.windsurf/rules': true,
    'GEMINI.md': true,
  },
  templates: ['nextjs'],
});

project

  • name — your project name
  • stack — array of technologies
  • architecture — free-form description of your architecture

outputs

Set each output target to true to enable it. Disabled targets are simply skipped during generate.