Skip to main content

Module path_promotion

Module path_promotion 

Source
Expand description

Path promotion: auto-create Mounts for frequently-used paths (RFC-025 Phase 5).

Unlike runtime detection (which only matches existing Mounts), this module scans session history to find paths the agent has actually worked on (via tool calls) or the user has explicitly mentioned, counts them, and promotes paths that cross a frequency threshold into Mounts.

§Pipeline

  1. Extract raw paths from session trajectories (tool_args) and user messages.
  2. Normalize each path to its project root by walking up the directory tree until a marker file (Cargo.toml, package.json, .git, …) is found. This collapses /proj/src/main.rs and /proj/Cargo.toml into the single root /proj.
  3. Count normalized roots over a sliding window.
  4. Promote roots that cross the threshold into Mounts (unless one already covers that root).

§Why background, not realtime

Every extraction requires walking the filesystem (to find markers), so we run this on a cadence (alongside Dream consolidation) rather than on every message. The threshold naturally debounces one-off mentions.

Structs§

PathFrequency
A path’s frequency tally within the promotion window.
PromotionConfig
Configuration for path promotion (mirrors MountsConfig).

Functions§

extract_paths
Extract raw path strings from a single session.
normalize_to_root
Find the project root for path by walking up until a marker is found.
tally_frequencies
Normalize a raw path to its project root, then tally frequencies.