Skip to content

fix: add missing metadata fields to HTTP POST /remember #682

Closed

Description

@ajianaz

Problem

HTTP POST /remember is missing fields that exist in CLI uteke remember:

Field CLI HTTP POST /remember
entity --entity ❌ MISSING
category --category ❌ MISSING
metadata (custom key:value) --meta k:v ❌ MISSING
source --source ❌ MISSING
source_type --source-type ❌ MISSING

This makes /recall entity/category filters unusable via HTTP — no way to populate the data through the API.

CLI already maps these to metadata JSON:

  • --entity my-app → metadata.entity = "my-app"
  • --category frontend → metadata.category = "frontend"
  • --meta key:value → metadata.key = "value"
  • --source → metadata.source = "..."
  • --source-type → metadata.source_type = "..."

Fix

Add to RememberRequest in crates/uteke-server/src/types.rs:

pub struct RememberRequest {
    pub content: String,
    pub tags: Vec<String>,
    pub namespace: Option<String>,
    pub r#type: Option<String>,
    pub valid_from: Option<String>,
    pub valid_until: Option<String>,
    pub detect_contradiction: bool,
    // New fields — parity with CLI
    #[serde(default)]
    pub entity: Option<String>,
    #[serde(default)]
    pub category: Option<String>,
    #[serde(default)]
    pub metadata: Option<serde_json::Value>,
    #[serde(default)]
    pub source: Option<String>,
    #[serde(default)]
    pub source_type: Option<String>,
}

In crates/uteke-server/src/handlers.rs, merge these into the metadata map before calling remember():

if let Some(entity) = &req_data.entity {
    meta.insert("entity".into(), serde_json::Value::String(entity.clone()));
}
if let Some(category) = &req_data.category {
    meta.insert("category".into(), serde_json::Value::String(category.clone()));
}
if let Some(source) = &req_data.source {
    meta.insert("source".into(), serde_json::Value::String(source.clone()));
}
if let Some(source_type) = &req_data.source_type {
    meta.insert("source_type".into(), serde_json::Value::String(source_type.clone()));
}
// Merge custom metadata
if let Some(custom) = &req_data.metadata {
    if let Some(map) = custom.as_object() {
        for (k, v) in map {
            meta.insert(k.clone(), v.clone());
        }
    }
}

Verification

  1. POST /remember { content: "...", entity: "my-app", category: "frontend", metadata: {"key": "value"} } → stores correctly
  2. POST /recall { query: "...", entity: "my-app" } → filters correctly
  3. POST /recall { query: "...", category: "frontend" } → filters correctly
  4. Existing tests pass — fields are Option with #[serde(default)], fully backward compatible
  5. PUT /memory already has metadata field — no conflict

Acceptance Criteria

  1. RememberRequest has all 5 new fields
  2. Handler merges them into metadata map before remember() call
  3. /recall entity/category filters work with HTTP-created memories
  4. All existing tests pass
  5. cargo fmt --all clean

Activity

  1. added
    bug
    on Jul 14, 2026
  2. added 2 commits that reference this issue on Jul 14, 2026
  3. added 4 commits that reference this issue on Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions