Skip to content

feat: uteke_context + uteke_dream MCP tools + API endpoints + auto-dream - #451

Merged
ajianaz merged 1 commit into
developfrom
feat/context-and-dream-mcp
Jun 22, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/context-and-dream-mcp

Conversation

@ajianaz

@ajianaz ajianaz commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

New Features

uteke_context — Smart Project Summary

MCP tool + API endpoint that returns a structured overview ready for agent prompts:

Project memory: 15 memories in namespace corin
Types: 5 fact, 3 decision, 2 procedure, 5 note
Tags: tech, architecture, api, release
Recent memories:
  - Use parameterized SQL queries [procedure]
  - We chose Tauri 2 over Electron [decision]

uteke_dream — Agent-Triggered Maintenance

MCP tool + API endpoint: run dream cycle (lint → backlinks → dedup → orphans → compact → verify) from any agent.

Auto-Schedule (Server)

  • Auto-aging: every 6 hours (existing)
  • Auto-dream: every 3 days (new)

MCP Tools: 13 → 15

All API endpoints now have MCP equivalents:

  • uteke_context — POST /context
  • uteke_dream — POST /dream

Tests

2 new context tests. 300 total pass. Clippy clean.

pub fn build_context(&self, namespace: Option<&str>) -> Result<String, Error> {
let ns = namespace.unwrap_or(DEFAULT_NAMESPACE);
let stats = self.stats(Some(ns))?;
let recent = self.list(None, 5, 0, Some(ns))?;
Comment thread crates/uteke-core/src/lib.rs Fixed
Comment thread crates/uteke-server/src/main.rs Fixed
Comment thread crates/uteke-server/src/main.rs Fixed
@github-actions

github-actions Bot commented Jun 22, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

❌ Blocked — critical issues found.

🔴 Error (3)

  • crates/uteke-core/src/lib.rs:708 — In build_context, both self.store.memory_type_counts(ns).unwrap_or_default() and self.store.unique_tags(Some(ns)).unwrap_or_default() discard database errors and continue building a partial summary. If either query fails, callers receive a seemingly successful context string with missing sections instead of an error, which makes operational failures hard to detect and can mislead downstream agents.
  • crates/uteke-core/src/lib.rs:732 — The preview code truncates with &m.content[..77] after checking m.content.len() > 80. String::len() measures bytes, not character boundaries, so this byte slice will panic at runtime when the 77th byte lands in the middle of a UTF-8 character. Any stored memory containing multibyte text can trigger this when included in the recent list.
  • crates/uteke-server/src/main.rs:1657 — The background auto-dream worker acquires the global Mutex<Uteke> and then runs u.dream(None, false, &[]) while holding that lock. The same mutex guards request handling, so a full dream cycle can serialize or stall all concurrent API calls until maintenance completes. This is especially risky because the dream pipeline includes multiple maintenance phases and may be expensive on large stores.

Review powered by cora-cli · BYOK · MIT

New MCP tools (15 total):
- uteke_context: smart project summary for agent prompts
- uteke_dream: trigger dream cycle from agent

New API endpoints: POST /context, POST /dream
Auto-dream: server background thread every 3 days.

Core: build_context() + memory_type_counts().
2 new tests for context.
@ajianaz
ajianaz force-pushed the feat/context-and-dream-mcp branch from c28fe7f to 1a692c8 Compare June 22, 2026 13:03
lines.push(format!("Types: {}", type_str.join(", ")));
}
if !tag_names.is_empty() {
lines.push(format!("Tags: {}", tag_names.join(", ")));
let dream_uteke = Arc::clone(&uteke);
std::thread::spawn(move || {
let interval = std::time::Duration::from_secs(3 * 24 * 60 * 60); // 3 days
loop {
@ajianaz
ajianaz merged commit 0531664 into develop Jun 22, 2026
8 of 9 checks passed
@ajianaz
ajianaz deleted the feat/context-and-dream-mcp branch June 22, 2026 13:09
ajianaz added a commit that referenced this pull request Aug 13, 2026
…eam (#451)

New MCP tools (15 total):
- uteke_context: smart project summary for agent prompts
- uteke_dream: trigger dream cycle from agent

New API endpoints: POST /context, POST /dream
Auto-dream: server background thread every 3 days.

Core: build_context() + memory_type_counts().
2 new tests for context.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants