Skip to content

feat: add /memory/pin and /memory/importance endpoints #660

Description

@ajianaz

Summary

No API endpoints for pinning or setting importance. These exist in CLI but not HTTP server.

Proposed

POST /memory/pin    {"id": "uuid", "pinned": true/false}
POST /memory/importance {"id": "uuid", "importance": 0.9}

Acceptance Criteria

Functional

  • POST /memory/pin — pin or unpin a memory
  • POST /memory/importance — set importance (0.0-1.0)
  • Validation: importance must be 0.0-1.0

Verification (CMO can run without reading code)

  • curl POST /memory/pin {"id":"<existing>","pinned":true} → 200, memory now pinned
  • curl POST /memory/pin {"id":"<existing>","pinned":false} → 200, memory unpinned
  • curl POST /memory/pin {"id":"<existing>"} (omit pinned) → 200, defaults to pin (toggle on)
  • curl POST /memory/importance {"id":"<existing>","importance":0.85} → 200, importance = 0.85
  • curl POST /memory/importance {"id":"<existing>","importance":1.5} → 400 validation error
  • curl POST /memory/importance {"id":"<existing>","importance":-0.1} → 400 validation error
  • curl POST /memory/pin {"id":"nonexistent"} → 404
  • Both endpoints return the full updated memory object

Tests

  • Unit: pin → verify pinned column = 1
  • Unit: importance → verify column = exact value
  • Unit: importance out of range → 400

Priority

Low — could be superseded by PUT /memory (#658).

Dependencies

Could be superseded by #658 (PUT /memory).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority:lowFix when convenientscope:apiHTTP server / API layer

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions