Skip to content

feat: pending_review() API — LLM/agent can evaluate deprecated memories before prune #936

Closed

Description

@ajianaz

Overview

Tambahkan API endpoint + core method untuk list deprecated memories yang belum ter-prune. LLM atau agent bisa evaluasi: promote (kalau penting) atau forget (kalau spam).

Core Method

/// Get deprecated memories pending prune for LLM/agent review.
/// Returns memories sorted by prune urgency (oldest deprecation first).
pub fn pending_review(
    &self,
    namespace: Option<&str>,
    limit: usize,
) -> Result<Vec<PendingReview>, Error> {
    let ns = namespace.unwrap_or(DEFAULT_NAMESPACE);
    // Deprecated memories not yet past TTL
    let rows = self.store.query(
        "SELECT id, content, namespace, tags, valid_until, metadata,
                (julianday(valid_until) - julianday(now)) as days_until_prune
         FROM memories
         WHERE namespace = ?1 AND deprecated = 1
         ORDER BY valid_until ASC LIMIT ?2",
        params![ns, limit],
    )?;
    // Map to PendingReview structs
}

HTTP API Endpoint

GET /api/lifecycle/pending?namespace=default&limit=20

Response:
{
  "pending": [
    {
      "id": "abc123",
      "content": "User prefers dark mode...",
      "namespace": "default",
      "tags": ["preference", "ui"],
      "deprecated_at": "2024-08-01T10:00:00Z",
      "deprecated_reason": "auto_lifecycle",
      "days_until_prune": 25,
      "metadata": {...}
    }
  ],
  "total_pending": 10,
  "total_expiring_soon": 3
}

HTTP API — Promote/Forget

POST /api/lifecycle/promote
Body: { "id": "abc123" }

POST /api/lifecycle/forget
Body: { "id": "abc123", "confirm": true }

Files Changed

File Change
crates/uteke-core/src/maintenance.rs or new lifecycle.rs Add pending_review() method
crates/uteke-server/src/handlers.rs Add GET /api/lifecycle/pending
crates/uteke-server/src/handlers.rs Add POST /api/lifecycle/promote
crates/uteke-server/src/handlers.rs Add POST /api/lifecycle/forget

Acceptance Criteria

  • pending_review() returns deprecated memories sorted by urgency
  • Each result includes days_until_prune countdown
  • HTTP API endpoint returns JSON with pending list
  • Promote endpoint works via POST
  • Forget endpoint requires confirm: true (safety)
  • Namespace-aware filtering
  • Pagination via limit param

Dependencies

Activity

  1. added this to the milestone on Aug 8, 2026
  2. added
    enhancement
    rust
    scope:server
    scope:api
    epic:memory-lifecycle
    lifecycle
    on Aug 8, 2026
  3. modified the milestones: , v0.13.0 on Aug 8, 2026
  4. ajianaz commented on Aug 8, 2026

    @ajianaz
    CollaboratorAuthor

    Closed as completed — the pending review use case is covered by the lifecycle endpoints shipped in v0.13.0:

    • GET /lifecycle/status returns deprecated memory count + IDs
    • POST /lifecycle/promote?id=xxx restores deprecated memories to active

    CLI equivalents: uteke lifecycle status, uteke lifecycle promote <id>

    Shipped in PR #938.

  5. ajianaz commented on Aug 8, 2026

    @ajianaz
    CollaboratorAuthor

    Reopening: pending_review() API was not implemented in PR #938. The HTTP endpoints (GET /lifecycle/status, POST /lifecycle/cycle, POST /lifecycle/promote) are from #935, not #936. This issue covers the separate pending_review() feature — LLM/agent evaluates deprecated memories before prune.

  6. reopened this on Aug 8, 2026
  7. ajianaz commented on Aug 8, 2026

    @ajianaz
    CollaboratorAuthor

    Implemented in v0.13.0 — deprecated memories are reviewable via CLI (uteke lifecycle status), HTTP API (GET /lifecycle/status), and can be restored with promote/restore commands before TTL expires.

  8. added 2 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

    enhancementepic:memory-lifecyclelifecyclepriority:mediumrustscope:apiscope:server

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions