getEntityContext
Assemble a token-budgeted markdown dossier for one entity, combining relations, scalar facts, and mentions into one card to replace multiple small reads.
Instructions
Assemble a single token-budgeted markdown dossier for ONE entity, collapsing what otherwise takes five calls (get + relations + neighbors + recall + facts) into one card. The dossier carries a header (name, kind, entities/{uid}, resolution status), Connections (the entity's typed relations as direction-aware predicate fragments), What I know (its scalar facts), Mentioned in (recall hits naming it), and a counts footer. Pass entity as an entities/{uid} resource name, a bare uid, a display name (resolved case-insensitively), or self. Use at (RFC 3339) to time-slice the relations + facts to a past instant; the header is unchanged. The card never exceeds tokenBudget; lower-priority bullets are dropped behind a marker. An unknown entity returns E_NOT_FOUND; an ambiguous display name returns E_VALIDATION naming the candidates. Prefer this over many small reads when you need the full picture of one entity.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| at | No | Valid-time anchor (RFC 3339 UTC): return the Connections and What-I-know rows as they were live at this instant. Defaults to now. Per ADR-0001 the anchor binds the relation + fact sub-queries only; the entity header (identity) is unchanged. | |
| entity | Yes | Which entity to profile: an entities/{uid} resource name (feed one straight from a recall hit's entities[] / name), a bare uid, a human display name (resolved case-insensitively), or 'self'. An ambiguous name returns E_VALIDATION naming the candidates; an unknown one returns E_NOT_FOUND. | |
| scopes | No | Scopes to read from: project, personal, team. Defaults to project+personal. Unknown values are rejected. | |
| include | No | Optional section filter. Omit for all three sections; pass a subset (e.g. ["facts"]) to narrow the card. The entity header and footer always render. | |
| tokenBudget | No | Token budget for the dossier (default 4000). The card never exceeds it; the lowest-priority bullets are dropped behind a marker, then a counts footer is appended. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| budget | Yes | The token budget that was applied. | |
| tokens | Yes | Estimated token count of the dossier (always <= budget). | |
| dropped | No | How many lower-priority bullets were omitted to fit the budget. | |
| markdown | Yes | The entity dossier as markdown: a header (name · kind · entities/{uid} · resolution), Connections (typed relations as direction-aware predicate fragments), What I know (the entity's scalar facts), Mentioned in (recall hits naming it), and a counts footer '_N relations, M facts · budget X · used Y_'. Load this verbatim instead of issuing get + relations + neighbors + recall + facts separately. | |
| sections | No | Per-section counts of what made it into the dossier. |