contextd export

Export your project context to a format that AI tools can consume.

Usage

contextd export [options]

Options

FlagDescriptionDefault
--format <format>Output format: claude-md, cursorrules, rawclaude-md
--output <path>Output file path (defaults to format standard)
--files <files>Comma-separated list of files to get context for

Formats

claude-md (default)

Exports to CLAUDE.md at your project root. This file is automatically read by Claude Code and other Anthropic-powered tools.

contextd export
# Writes to CLAUDE.md

cursorrules

Exports to .cursorrules at your project root. Cursor reads this file to understand your project conventions.

contextd export --format cursorrules
# Writes to .cursorrules

raw

Prints all context to stdout. Useful for piping into other commands or manual inspection.

contextd export --format raw

How it works

  1. Finds the project root (directory containing .context/)
  2. Auto-refreshes stale remote sources (>24 hours old) non-blocking
  3. Warns if any remote source hasn’t synced in >7 days
  4. Loads remote contexts from .context/remote/
  5. If --files is provided, uses relevance matching (project + conventions + matching modules + tagged decisions)
  6. Merges local and remote contexts (local takes precedence on slug conflicts)
  7. Builds output ordered: project → architecture → conventions → modules → decisions
  8. Writes to file with a metadata header showing generation timestamp

Targeting specific files

When you pass --files, contextd exports only the context relevant to those files:

contextd export --files src/api/routes.ts,src/db/schema.ts

Relevance matching includes:

  • project.md and conventions.md (always)
  • architecture.md (if files specified)
  • Modules whose scope matches the file paths
  • Decisions tagged with relevant keywords