code_annotate
code_annotate attaches a note directly to a named function in the graph. Annotations appear in future code_signature calls and in any context view of that function. They are institutional memory without polluting source code.
code_annotate(name="processPayment", note="Always call with a valid idempotency key. See ADR-012.")code_annotate(name="db.migrate", note="DANGER: irreversible. Must be reviewed by a senior engineer.")code_annotate(name="processPayment", delete=true)Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
name | string | required | Function or symbol name |
note | string | — | Annotation text to attach; omit to read existing annotation |
delete | boolean | false | Remove the annotation instead of adding one |
Output (reading an annotation)
Section titled “Output (reading an annotation)”processPayment [annotation] Always call with a valid idempotency key. See ADR-012.When to use
Section titled “When to use”- Mark a function with a warning that every future reader should see
- Link a function to a decision record or incident post-mortem
- Note a known gotcha that is not safe to put in a code comment
- Document invariants that are not obvious from the implementation
Difference from code_knowledge
Section titled “Difference from code_knowledge”code_annotate | code_knowledge | |
|---|---|---|
| Scope | One specific function | Broad subject, linked to multiple symbols |
| Appears in | code_signature calls | code_related, code_context, code_impact |
| Best for | Warnings, invariants | Architecture notes, patterns, decisions |