A format specification for describing a codebase’s structural truth to coding agents.
CODE.md gives agents a persistent, structured understanding of how the codebase actually works.
CODE.md is a self-contained, plain-text representation of a codebase’s structure and behavior.
It defines the execution flow, dependencies, API surface, data writes, external integrations, security boundaries, UI interactions, and change history of a project—so that these realities can be followed consistently across coding sessions and between different AI agents and tools.
A CODE.md file contains two parts:
The YAML front matter contains code tokens: structured facts about the codebase.
The markdown body provides rationale: how to interpret those facts and how agents should use them when generating or editing code.
/codeval/CODE.md.Agents scanning the repo should treat /codeval/CODE.md as the code truth layer for the project.
CODE.md may embed code tokens in a structured format. These tokens describe:
Code tokens are embedded as YAML front matter at the beginning of the file.
---
version: 1
generated_by: codeval
generated_at: 2026-06-29T01:18:00Z
entry_points:
- path: src/main.py
symbol: main
api_endpoints:
- method: GET
path: /users
handler: api/users.getUsers
core_system_files:
- path: src/lib/database.ts
dependents: 42
high_risk_areas:
- path: src/lib/auth.ts
reason: "Used by many critical flows"
complex_areas:
- path: src/lib/workflows.ts
reason: "Calls many other modules"
unused_code:
- path: src/legacy/old_report.py
reason: "No callers in callgraph"
data_write_locations:
- path: src/lib/database.ts
operations: ["insert", "update"]
third_party_calls:
- path: src/lib/payments.ts
services: ["Stripe", "PayPal"]
security_checkpoints:
- path: src/lib/auth.ts
checks: ["isAuthenticated", "hasRole"]
ui_behavior_map:
- component: UserList
triggers: ["fetchUsers", "deleteUser"]
change_history:
recently_changed:
- path: src/lib/database.ts
last_commit: 2026-06-28
high_churn:
- path: src/lib/auth.ts
commits_last_90_days: 37
stable_files:
- path: src/lib/logger.ts
last_changed: 2024-01-10
---
The schema below defines the structure of all CODE.md tokens.
version:generated_by: generated_at: entry_points: - path: symbol: api_endpoints: - method: path: handler: core_system_files: - path: dependents: high_risk_areas: - path: reason: complex_areas: - path: reason: unused_code: - path: reason: data_write_locations: - path: operations: third_party_calls: - path: services: security_checkpoints: - path: checks: ui_behavior_map: - component: triggers: change_history: recently_changed: - path: last_commit: high_churn: - path: commits_last_90_days: stable_files: - path: last_changed:
Agents should treat the front matter as normative: it is the source of truth for how the codebase is structured.
The markdown body that follows should:
CODE.md is updated automatically as the codebase evolves. Agents can rely on it to reduce hallucinations and reason accurately across the entire repo.