Skip to content

fix: make depth meter meaningful with dynamic rlm_query call counter#16

Open
ratacat wants to merge 1 commit into
rawwerks:masterfrom
ratacat:fix/depth-meter-dynamic-read
Open

fix: make depth meter meaningful with dynamic rlm_query call counter#16
ratacat wants to merge 1 commit into
rawwerks:masterfrom
ratacat:fix/depth-meter-dynamic-read

Conversation

@ratacat

@ratacat ratacat commented May 1, 2026

Copy link
Copy Markdown

Problem

The depth meter showed ∞ depth 0/3 at all times during interactive use. Since children run headless (pi -p), the user never sees depth > 0. The status bar was effectively a static label.

Fix

  1. Read RLM_DEPTH dynamically — replaced module-level constants with getDepth()/getMaxDepth() that re-read process.env on every update
  2. Track rlm_query calls — hooked into tool_result to detect bash commands containing rlm_query and increment a counter
  3. Show call counter in status — the bar now shows ypi ∞ d0/3 · 3 calls so the human gets visual feedback that recursion is happening
  4. Refresh on turn_end — status bar updates after every agent turn (previously only on session start/switch)
  5. Depth in terminal titleypi d0 instead of just ypi

Behavior

ypi  ∞ d0/3              ← fresh session
ypi  ∞ d0/3 · 1 call     ← after first rlm_query returns
ypi  ∞ d0/3 · 3 calls    ← after three recursive calls

If ypi is ever run at depth > 0 with a visible TUI, the depth number updates accordingly — but the main interaction is the call counter ticking up as rlm_query calls complete.

The depth meter was reading RLM_DEPTH once at module init — always
showed 'depth 0/3' during interactive use since children run headless.

Changes:
- Read RLM_DEPTH/RLM_MAX_DEPTH dynamically on every status update
- Track rlm_query invocations via tool_result hook (parse bash commands)
- Show call counter: 'ypi  ∞ d0/3 · 3 calls'
- Include depth in terminal title
- Add turn_end handler for post-turn refresh
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.

1 participant