Overview
contox_add_link creates a directed link between two contexts identified by their schemaKeys. Links form a knowledge graph that helps the AI understand how different parts of the project relate to each other.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
from | string | Yes | — | Source schemaKey (e.g., "root/frontend/hooks") |
to | string | Yes | — | Target schemaKey (e.g., "root/api/auth") |
linkType | enum | Yes | — | Relationship type: "see-also", "depends-on", "child-of", or "related" |
reason | string | No | — | Why this link exists |
confidence | number | No | — | Confidence score from 0 to 1 (e.g., 0.9 = very confident) |
Link types
| Type | Meaning |
|---|---|
see-also | Cross-reference — related information in another context |
depends-on | Dependency — this context depends on the target |
child-of | Hierarchical — this context is a child of the target |
related | General relationship — loosely connected contexts |
Return value
Returns a confirmation message:
Link created: root/frontend/hooks -> root/api/auth [depends-on]
Usage examples
Linking a hook to its API dependency
Claude calls: contox_add_link({
from: "root/frontend/hooks",
to: "root/api/auth",
linkType: "depends-on",
reason: "useAuth hook calls the auth API endpoints for login and token refresh",
confidence: 0.9
})
Cross-referencing related contexts
Claude calls: contox_add_link({
from: "root/bugs",
to: "root/implementation",
linkType: "see-also",
reason: "Bug fixes reference implementation details for context"
})
Notes
- Links are directed: creating a link from A to B does not automatically create a link from B to A. Create both directions explicitly if needed.
- Both the
fromandtoschemaKeys must reference existing contexts. - Use
contox_get_linksto view existing links for a context. - The knowledge graph is used by the AI to understand how project components relate, enabling better context retrieval and more informed responses.