Skip to content

feat: trust scoring with feedback API#725

Merged
ajianaz merged 5 commits into
developfrom
feat/trust-scoring-feedback
Jul 17, 2026
Merged

feat: trust scoring with feedback API#725
ajianaz merged 5 commits into
developfrom
feat/trust-scoring-feedback

Conversation

@ajianaz

@ajianaz ajianaz commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add helpful/unhelpful feedback mechanism for trust scoring (#718).

Problem

Uteke memories have an importance field (0.0–1.0, default 0.5) used by salience boost and orphan detection. Currently importance can only be set directly or recomputed globally — there's no way to signal that a specific memory was useful or not in a given context. Hermes solves this with a feedback loop: +0.05 for helpful, -0.10 for unhelpful (asymmetric — penalizing bad memories more than rewarding good ones).

Changes

uteke-core/src/lib.rs

  • Uteke::feedback_helpful(id) → importance += 0.05, returns new value
  • Uteke::feedback_unhelpful(id) → importance -= 0.10, returns new value
  • Internal feedback_adjust(id, delta) with clamp to [0.0, 1.0]

uteke-cli/src/cli.rs

  • uteke feedback <id> {helpful|unhelpful} subcommand
  • FeedbackAction enum

uteke-cli/src/commands/mod.rs

  • Handler with JSON (--json) and human-readable output

uteke-server/src/{handlers.rs, types.rs, main.rs}

  • POST /memory/feedback{ id, feedback: "helpful"|"unhelpful" }
  • Returns { id, feedback, delta, importance }
  • UUID validation, 400 for invalid feedback value

Usage

CLI:

uteke feedback <uuid> helpful     # importance += 0.05
uteke feedback <uuid> unhelpful   # importance -= 0.10
uteke --json feedback <uuid> helpful

API:

curl -X POST http://localhost:8767/memory/feedback \
  -H 'Content-Type: application/json' \
  -d '{"id": "uuid", "feedback": "helpful"}'
# → {"id": "...", "feedback": "helpful", "delta": 0.05, "importance": 0.55}

Design Decisions

Decision Rationale
Asymmetric delta (±0.05 vs -0.10) Adopted from Hermes. Bad memories should be demoted faster than good ones are promoted.
Clamp to [0.0, 1.0] Prevents out-of-range importance from repeated feedback.
Separate helpful/unhelpful (not a generic delta) Clearer API contract. Future: per-namespace delta config.
Returns new importance Caller can track trust trajectory without a separate GET.

Closes #718

Add helpful/unhelpful feedback mechanism to adjust memory importance:

Core (uteke-core):
- Uteke::feedback_helpful() → importance += 0.05
- Uteke::feedback_unhelpful() → importance -= 0.10
- Asymmetric: penalty > reward (adopted from Hermes trust scoring)
- Clamped to [0.0, 1.0], returns new importance value

CLI:
- uteke feedback <id> helpful|unhelpful
- JSON and human-readable output
- FeedbackAction enum (Helpful, Unhelpful)

Server API:
- POST /memory/feedback { id, feedback }
- Validates UUID, returns { id, feedback, delta, importance }

Closes #718
@ajianaz ajianaz added scope:core Core engine work type:feature New feature rust Pull requests that update rust code labels Jul 17, 2026
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

Blocked — critical issues found.

🔴 Error (1)

  • crates/uteke-core/src/lib.rs:676 — In feedback_adjust, query_row returns Err(QueryReturnedNoRows) when the memory ID doesn't exist. This is mapped to Error::db("feedback_adjust read", e) which is a generic database error. In the server handler this surfaces as a 500 Internal Server Error rather than a 404, and in the CLI it shows "Feedback failed: ..." with no indication the ID was not found. The handler validates UUID format but never checks existence, so a well-formed but non-existent UUID produces a misleading error.

Review powered by cora-cli · BYOK · MIT

Comment thread crates/uteke-core/src/lib.rs Fixed
Comment thread crates/uteke-core/src/lib.rs Fixed
Comment thread crates/uteke-server/src/handlers.rs Fixed
.store
.conn
.query_row(
"SELECT importance FROM memories WHERE id = ?1",
@ajianaz
ajianaz merged commit 7fabc8c into develop Jul 17, 2026
8 of 9 checks passed
@ajianaz
ajianaz deleted the feat/trust-scoring-feedback branch July 17, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update rust code scope:core Core engine work type:feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Trust scoring with feedback API (importance adjustment via helpful/unhelpful)

2 participants