Skip to main content

init_user_context

Function init_user_context 

Source
pub fn init_user_context(pubkey: &str) -> UserContext
Expand description

DynamoDB table schema

Primary Key: pk = “USER#{pubkey}” Sort Key: sk = “CONTEXT”

GSI1: For batch queries by last update GSI1PK: “ACTIVE” GSI1SK: updated_at

Example item:

{
  "pk": "USER#5A7E...YKTZ",
  "sk": "CONTEXT",
  "pubkey": "5A7E...YKTZ",
  "vault": { ... },
  "preferences": { ... },
  "recent_events": [ ... ],
  "agent_memory": { ... },
  "updated_at": 1711468800,
  "version": 42
}

Helper to create initial context for new user