Skip to main content

Request

GET https://api.spectralmemory.com/context?user_id=alice
Authorization: Bearer YOUR_API_KEY

Query parameters

ParameterTypeRequiredDescription
user_idstringYour user identifier

Response

{
  "user_id": "alice",
  "fdm_block": "[MEM]magistrate yi GOP unprotected...[/MEM]",
  "channel_count": 3,
  "channel_labels": ["USER.gpu", "TASK.current", "PROJ.token_budget"],
  "plain_index": "USER.gpu=5090\nTASK.current=train\nPROJ.token_budget=1024"
}
FieldDescription
fdm_block512-token [MEM]...[/MEM] signal for system prompt injection. Empty string if no facts encoded.
channel_countNumber of facts currently encoded
channel_labelsList of encoded label names
plain_indexHuman-readable key=value summary (for debugging or non-Hermes fallback)

Usage

Inject fdm_block at the start of your system prompt:
ctx = client.get("/context", params={"user_id": "alice"})
system_prompt = f"{ctx['fdm_block']}\n\n{base_prompt}"

Notes

  • If fdm_block is missing and facts exist in state, the block is regenerated automatically.
  • The block is always exactly 512 tokens.
  • Does not count against your monthly encode limit.