Saltearse al contenido

Configuration Reference

Esta página aún no está disponible en tu idioma.

The .contextia/config.yaml file controls how Contextia scans, validates, and assembles context for your project. It is created by contextia init with sensible defaults and can be customized as needed.

project:
name: string
languages: list[string]
source_paths: list[string]
check:
strict_bidirectional: boolean
ignore_patterns: list[string]
required_fields:
spec: list[string]
decision: list[string]
norm: list[string]
task: list[string]
approval:
require_review: boolean
reviewers: list[string]
context:
max_tokens: integer
default_depth: string
include_norms: boolean
include_decisions: boolean
annotations:
prefix: string
comment_syntax: map[string, string]
parser: string
mcp:
enabled: boolean
expose_resources: list[string]
expose_prompts: list[string]
commits:
require_task_id: boolean
task_id_pattern: string
baseline:
path: string

Project-level metadata and scanning configuration.

FieldTypeDefaultDescription
namestring(required)Project name. Used in identity resource and index.
languageslist[string][]Programming languages present in the project. Determines comment syntax defaults. Supported: python, typescript, javascript, rust, go, java, kotlin, swift, ruby, c, cpp, csharp.
source_pathslist[string]["src/"]Directories containing source code to scan for annotations. Paths are relative to project root. Supports glob patterns.
project:
name: my-app
languages:
- python
- typescript
source_paths:
- backend/src/
- frontend/src/
- packages/shared/src/

Controls the behavior of contextia check and CI validation.

FieldTypeDefaultDescription
strict_bidirectionalbooleanfalseWhen true, bidirectional consistency warnings (spec lists a path but file has no matching annotation) become errors that cause non-zero exit.
ignore_patternslist[string][]Glob patterns for files and directories to skip during annotation scanning. Relative to project root.
required_fieldsmap(see below)Extra frontmatter fields that must be present per artifact type, beyond the always-required id and title.

By default, only id and title are required for all artifact types. You can add additional required fields:

check:
strict_bidirectional: true
ignore_patterns:
- "tests/**"
- "scripts/**"
- "vendor/**"
- "**/*.generated.*"
required_fields:
spec:
- description
- status
- paths
decision:
- date
- status
norm:
- status
task:
- status
- kind

Controls the spec change proposal and review workflow.

FieldTypeDefaultDescription
require_reviewbooleanfalseWhen true, contextia spec promote requires at least one reviewer approval before merging a proposal into the spec.
reviewerslist[string][]List of GitHub usernames or team handles authorized to approve spec changes. Only used when require_review is true.
approval:
require_review: true
reviewers:
- "@platform-team"
- "alice"
- "bob"

Controls how contextia context and the MCP load_context tool assemble context.

FieldTypeDefaultDescription
max_tokensinteger12000Approximate maximum token count for assembled context. Context assembly stops adding artifacts when this budget would be exceeded. Uses a simple word-count heuristic (1 token ~ 0.75 words).
default_depthstring"full"Default depth level when no --depth flag is provided. Options: meta, summary, full.
include_normsbooleantrueWhether to include linked norms in assembled context. Set to false to reduce context size if norms are well-known to the team.
include_decisionsbooleantrueWhether to include linked decisions in assembled context. Set to false if decision rationale is not needed during implementation.
context:
max_tokens: 8000
default_depth: full
include_norms: true
include_decisions: true
DepthContent loadedApproximate size
metaYAML frontmatter only (id, title, status, links)~50 tokens per artifact
summaryFrontmatter + first section of the Markdown body~200 tokens per artifact
fullEntire Markdown documentVaries, typically 200-800 tokens

Controls how Contextia scans source code for @spec, @decision, and @test annotations.

FieldTypeDefaultDescription
prefixstring"@"The prefix used before annotation types. With prefix @, annotations look like @spec SPEC-001. With prefix @ctx:, they look like @ctx:spec SPEC-001.
comment_syntaxmap[string, string](auto-detected)Maps language names to their single-line comment character(s). Used by the scanner to find annotations inside comments.
parserstring"regex"Parsing strategy for annotations. Options: regex (default, fast, no dependencies) or tree-sitter (precise AST-aware parsing, requires optional dependency).

When comment_syntax is not specified, defaults are derived from project.languages:

LanguageDefault comment syntax
python#
typescript//
javascript//
rust//
go//
java//
kotlin//
swift//
ruby#
c//
cpp//
csharp//

You can override defaults or add unlisted languages:

annotations:
prefix: "@ctx:"
comment_syntax:
python: "#"
typescript: "//"
sql: "--"
lua: "--"
haskell: "--"
parser: regex

Controls the MCP server behavior.

FieldTypeDefaultDescription
enabledbooleantrueWhether the MCP server exposes tools for this project. Set to false to disable MCP without removing the server configuration.
expose_resourceslist[string]["identity", "index"]Which MCP resources to expose. Options: identity (project identity document), index (navigation map of all artifacts).
expose_promptslist[string]["start_feature_task", "start_bug_fix", "end_session"]Which workflow prompt templates to expose via MCP.
mcp:
enabled: true
expose_resources:
- identity
- index
expose_prompts:
- start_feature_task
- start_bug_fix
- end_session

Controls integration with version control workflows.

FieldTypeDefaultDescription
require_task_idbooleanfalseWhen true, commit messages must reference a task ID. Enforced by contextia check --commits.
task_id_patternstring"TASK-\\d+"Regex pattern for task IDs in commit messages. Used when require_task_id is true.
commits:
require_task_id: true
task_id_pattern: "TASK-\\d+"

Controls the baseline file location.

FieldTypeDefaultDescription
pathstring".contextia/.baseline.json"Path to the baseline file, relative to project root. The baseline stores fingerprints of known violations to support incremental adoption.
baseline:
path: ".contextia/.baseline.json"
project:
name: platform
languages:
- python
- typescript
source_paths:
- packages/api/src/
- packages/web/src/
- packages/shared/src/
check:
strict_bidirectional: false
ignore_patterns:
- "tests/**"
- "**/node_modules/**"
- "**/*.generated.*"
required_fields:
spec:
- description
- paths
approval:
require_review: false
context:
max_tokens: 10000
default_depth: full
include_norms: true
include_decisions: true
annotations:
prefix: "@"
comment_syntax:
python: "#"
typescript: "//"
parser: regex
mcp:
enabled: true
expose_resources:
- identity
- index
expose_prompts:
- start_feature_task
- start_bug_fix
- end_session
commits:
require_task_id: false
baseline:
path: ".contextia/.baseline.json"