Skip to content

Learning model: repetition signals (confidence per node) #80

@smorchj

Description

@smorchj

Context

Second beat of the contextualizer learning model (#77). Repetition is the boring, accumulative signal — it's how Klonode learns over time which parts of the codebase actually matter to Claude, independent of any dramatic event. It just accumulates from the observation log.

Signal sources

Reads over time from `.klonode/observations.jsonl` (#79):

  1. Same file read 3+ times across distinct sessions → load-bearing, promote in routing.
  2. Folder consistently missed by routing → Claude had to grep/glob to find it → routing gap, suggest adding it.
  3. Same bash command repeated across sessions → likely a tool worth documenting in CONTEXT.md.
  4. Same grep pattern across sessions → missing cross-reference.

Scoring

Each folder node gets a `confidence` score in [0, 1]:

  • Base: fraction of recent sessions that touched this folder
  • Boost: average edit frequency (edits weight more than reads)
  • Penalty: high cost-per-use (many tool calls needed before Claude landed here)

Implementation: pure function `computeConfidence(log: Observation[], node: RoutingNode): number`. No ML, no weighting magic — just counted signals with published formulas in the docstring so the score is interpretable.

Storage

  • Scores live in `.klonode/learning.json` next to `graph.json`.
  • Recomputed on-demand (new CLI command `klonode learn`) and after each session end (requires session-end detection, filed separately).
  • Not stored in the graph itself so rebuilds don't clobber them.

UI

  • Graph nodes get a subtle opacity/size boost proportional to confidence. Left for a separate "visualize learning scores" issue so this one stays focused on the model.

Out of scope

  • Emotion signals — that's a separate issue.
  • Auto-updating CONTEXT.md based on confidence. Suggestions only, approved by the user via the suggestions panel.

Dependencies

Blocked by #79 (persistent observation log).

Part of the #77 pivot roadmap.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions