Validation
Context Nest defines validation rules for documents, source nodes, and cross-references. Run validation with:
ctx validate # Validate all documents
ctx validate nodes/api # Validate a specific document
ctx validate --json # JSON output for CIDocument rules
| Rule | Check |
|---|---|
| 1 | title is present and 1–200 characters |
| 2 | type is a recognized node type |
| 3 | tags are an array of strings starting with # |
| 4 | status is draft or published |
| 5 | version is a positive integer |
| 6 | created_at / updated_at are valid ISO 8601 timestamps |
| 7 | derived_from is a valid contextnest:// URI |
| 8 | Body contains valid GFM markdown |
Source node rules
| Rule | Check |
|---|---|
| 9 | source.transport is mcp, rest, cli, or file |
| 10 | source.server references a server in config.yaml |
| 11 | source.tools is an array of strings |
| 12 | source.depends_on URIs are valid contextnest:// URIs |
| 13 | source.cache_ttl is a non-negative integer |
| 14 | Each depends_on URI resolves to a type: source node |
| 15 | No circular dependencies in the source graph |
Cross-reference rules
| Rule | Check |
|---|---|
| 16 | All contextnest:// URIs in document bodies resolve to existing documents |
| 17 | Frontmatter depends_on and body-level references are consistent |
CI integration
# GitHub Actions
- name: Validate vault
run: ctx validate --jsonExit code is non-zero if any validation fails.
Last updated on