Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:ALwrity ALwrity Semantic Indexing Self Learning

From Leeroopedia
Knowledge Sources
Domains Semantic_Indexing, Memory, Self_Learning
Last Updated 2026-10-24 00:00 GMT

Overview

Mechanism that records task outcomes into a semantic embedding index so that future planning can retrieve similar past tasks, deduplicate proposals, and learn from which tasks were completed vs. dismissed.

Description

Semantic indexing for self-learning is the pattern of storing each task's outcome (completed, dismissed, rejected, skipped) as an embedding in a per-user vector index, alongside metadata (status, timestamp, pillar, feedback). When the daily planning pipeline generates a new task proposal, it can query the index for semantically similar past tasks and avoid re-proposing tasks that were previously dismissed (deduplication). Over time, the index becomes a memory of what worked and what did not, enabling self-learning: the planner biases toward tasks similar to past completed tasks and away from tasks similar to past dismissed ones.

The key engineering concern is write coalescing: upserting an embedding is fast (in-memory), but saving the index to disk is expensive. A debounced save — coalescing upserts and flushing at most once per batch size or time window — prevents a disk write per task while guaranteeing durability within a bounded delay.

Usage

Use this principle when:

  • A planning system should avoid re-proposing previously dismissed tasks.
  • Task outcomes (completed/dismissed) should bias future planning.
  • A per-user semantic index must be maintained without a disk write per item.
  • Deduplication is needed based on semantic similarity, not exact string match.

Theoretical Basis

Self-learning is an index-record-retrieve loop:

# Abstract self-learning loop (NOT a real implementation)
def on_task_complete(task, outcome):
    db.insert(TaskHistory(hash=sha256(task), status=outcome))
    index.upsert(id=uuid(), text=f"{task.title}. {task.description}",
                 metadata={"status": outcome, "timestamp": now()})
    debounce_save()                          # coalesce disk writes

def is_duplicate(proposed_task):
    similar = index.search(proposed_task.text, limit=5)
    return any(s.metadata["status"] == "dismissed" for s in similar)

The debounced save batches N upserts or T seconds into one disk write.

Practical Guide

  • Debounced saves.' Coalesce upserts and flush to disk at most once per batch or time window; a disk write per item is unsustainable at scale.
  • Hash + embedding.' Store both a SHA-256 hash (exact dedup) and an embedding (semantic dedup) so both exact and near-duplicate tasks are caught.
  • Per-user index.' Each user has their own index so one user's history does not pollute another's planning.
  • Outcome metadata.' Tag each embedding with status and feedback so retrieval can filter by outcome.

Related Pages

Implemented By

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment