Memory Namespaces

Namespaces partition memories within an organization into isolated collections. They enable data separation by team, project, sensitivity level, or any logical boundary.

What Namespaces Do

  • Isolate data -- memories in namespace A are invisible to queries scoped to namespace B
  • Control access -- policies can allow/deny access per namespace
  • Set retention -- each namespace can have its own retention period
  • Classify sensitivity -- mark namespaces as normal, sensitive, or restricted

Creating a Namespace

curl -X POST https://api.hippocortex.dev/v1/organizations/org_abc123/namespaces \
  -H "Authorization: Bearer <JWT_TOKEN>" \
  -H "X-Organization-ID: org_abc123" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Customer Data",
    "slug": "customer-data",
    "teamId": "team_789",
    "description": "All customer-facing memory data",
    "defaultAccess": "team",
    "sensitivity": "sensitive",
    "retentionDays": 365
  }'

Fields

FieldTypeDefaultDescription
namestringrequiredHuman-readable name
slugstringautoURL-safe identifier
teamIdstringnullOwning team (optional)
descriptionstringnullWhat this namespace is for
defaultAccessstringteamDefault access level: public, org, team, private
sensitivitystringnormalData sensitivity: normal, sensitive, restricted
retentionDaysnumbernullAuto-delete after N days (null = no auto-delete)
metadataobject{}Arbitrary key-value data

Assigning Memories to a Namespace

When capturing events, include namespace_id in the request body:

curl -X POST https://api.hippocortex.dev/v1/capture \
  -H "Authorization: Bearer hx_live_..." \
  -H "X-Organization-ID: org_abc123" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "user_interaction",
    "sessionId": "sess_123",
    "payload": { "message": "Hello" },
    "namespace_id": "ns_456"
  }'

The API validates that the namespace belongs to the specified organization.

Scoping Rules

How Namespace Scoping Works in Retrieval

When POST /v1/synthesize is called with an X-Organization-ID header:

  1. The policy engine evaluates which namespaces the principal can access
  2. Only memories from allowed namespaces are returned
  3. If a specific namespaceId is provided in the body, results are restricted to that namespace

Without X-Organization-ID, the standard tenant-scoped retrieval is used (backward compatible).

Default Access Levels

LevelWho Can Access
publicAnyone in the organization
orgAll org members (same as public currently)
teamOnly members of the owning team
privateOnly the namespace creator + admins

Access policies override these defaults. See Policies.

Listing Namespaces

curl "https://api.hippocortex.dev/v1/organizations/org_abc123/namespaces?sensitivity=sensitive" \
  -H "Authorization: Bearer <JWT_TOKEN>" \
  -H "X-Organization-ID: org_abc123"

Filter by teamId or sensitivity.

Updating a Namespace

curl -X PATCH https://api.hippocortex.dev/v1/organizations/org_abc123/namespaces/ns_456 \
  -H "Authorization: Bearer <JWT_TOKEN>" \
  -H "X-Organization-ID: org_abc123" \
  -H "Content-Type: application/json" \
  -d '{ "retentionDays": 180 }'

Deleting a Namespace

curl -X DELETE https://api.hippocortex.dev/v1/organizations/org_abc123/namespaces/ns_456 \
  -H "Authorization: Bearer <JWT_TOKEN>" \
  -H "X-Organization-ID: org_abc123"

Deleting a namespace removes the namespace record. Memories that were assigned to it retain their namespace_id but will no longer be retrievable through namespace-scoped queries.