The Code-to-Docs Bridge
Code and documentation are maintained by separate teams. The
@code-change tag in API documentation (Doxygen annotations or Python
docstrings) is the bridge.
Tag Format
@code-change YYYY-MM-DD "free-text description of what changed and why"
- Date: mandatory, ISO 8601 date only
- Description: mandatory, double-quoted, one line
Placement
C/C++ (Doxygen)
Modified function
Add inside the existing Doxygen block:
/** @brief One-line purpose.
* @param[in] x Input value.
* @see related_function [card-ID]
*
* @code-change 2026-03-28 "Rewritten loop to use BLAS dcopy for stride-1 case"
*/
New function (no Doxygen block yet)
Create a stub:
/** @brief (new, undocumented)
* @code-change 2026-03-28 "New function: computes adaptive relaxation"
*/
Deleted function
Add to a calling function's block or file-level comment:
/* @code-change 2026-03-28 "Removed old_function -- replaced by new_function" */
Multiple changes accumulate
/** @brief ...
* @code-change 2026-03-20 "Changed threshold from 1e-20 to 1e-16"
* @code-change 2026-03-28 "Added early exit for zero-row case"
*/
Python (Sphinx reST docstrings)
Modified function
Add at the end of the existing docstring:
def solve(A, b):
"""Forward solve Ax = b.
:param A: Coefficient matrix.
:type A: scipy.sparse.csc_matrix
:param b: Right-hand side.
:type b: numpy.ndarray
@code-change 2026-03-28 "Rewritten loop to use vectorized operations"
"""
New function (no docstring yet)
Create a stub docstring:
def new_function(x):
"""(new, undocumented)
@code-change 2026-03-28 "New function: compute adaptive relaxation"
"""
Deleted function
Add to a calling function's docstring:
def caller(x):
"""...existing docstring...
@code-change 2026-03-28 "Removed old_function -- replaced by new_function"
"""
Multiple changes accumulate
def solve(A, b):
"""Forward solve Ax = b.
:param A: Coefficient matrix.
:type A: scipy.sparse.csc_matrix
@code-change 2026-03-20 "Changed threshold from 1e-20 to 1e-16"
@code-change 2026-03-28 "Added early exit for zero-row case"
"""
Rules for code-developer (writer)
- Always add a tag when modifying function logic, signatures, constants, or control flow. Cosmetic changes (whitespace, comments) do not need a tag.
- One tag per logical change.
- For new source files, add a row to INDEX.md (Card =
---) and a file-level tag. - For deleted source files, add tags to any file that called the deleted functions.
Rules for kb-developer (consumer)
- Read the
@code-changedescription. - Read the current source code.
- Update card, API docs (Doxygen or docstrings), and math doc as needed.
- Remove the
@code-changeline from the source file. - Add a SYNCLOG entry (UPDATED or VERIFIED).
- Process all accumulated tags in one pass — update to current state.
Rules for kb-reviewer (detector)
- Scan source files for
@code-changetags. - Each pending tag lowers the Freshness score.
- Report pending tags in the board.
Git-Based Fallback
If code-developer forgets to add a tag, kb-reviewer detects via git:
- Compare source file's last commit date vs last SYNCLOG date.
- If source modified 7+ days after last doc sync with no tag: flag as SILENT-STALE.
- Report with git diff summary so kb-developer can update without the tag.