Skip to content

feat: add sessions_since_eval signal and brain eval cadence rule#244

Merged
fazxes merged 3 commits intomainfrom
feat/sessions-since-eval-signal
Apr 9, 2026
Merged

feat: add sessions_since_eval signal and brain eval cadence rule#244
fazxes merged 3 commits intomainfrom
feat/sessions-since-eval-signal

Conversation

@fazxes
Copy link
Copy Markdown
Member

@fazxes fazxes commented Apr 9, 2026

Summary

  • Adds sessions_since_eval() to .recursive/engine/signals.py: reads the latest eval file, extracts its date/mtime, counts session rows after that timestamp. Returns a scalar int signal.
  • Surfaces the signal in the dashboard Health section (next to Eval score) with a [STALE -- rerun recommended] annotation when >= 5 sessions stale.
  • Adds an alert in the Alerts section when sessions_since_eval >= 5, directing the brain to delegate a Phractal eval run.
  • Adds eval cadence rule to .recursive/agents/brain.md Delegation Protocol: when the eval_staleness alert fires, the brain SHOULD include an eval run as one of its delegations.
  • Adds 14 unit tests across test_signals.py and test_dashboard.py covering all branches.
  • All 1156 tests pass (make check green).

Addresses

Task #242. Fixes the broken build-measure-build feedback loop: the brain now has a visible signal and alert when evals go stale, and a protocol for triggering a rerun.

Test plan

  • make check passes (1156 tests, all green)
  • Dashboard output includes Eval staleness: line in Health section
  • Dashboard Alerts section shows eval staleness warning when >= 5 sessions stale
  • brain.md Delegation Protocol contains the eval cadence rule
  • No nightshift/ files modified (framework-zone PR)

fazxes added 2 commits April 9, 2026 02:11
The previous cleanup_worktrees only removed worktrees marked 'prunable'
by git, but agent-* directories left by completed or crashed sessions are
never prunable (their directories still exist). Added Pass 1 that
enumerates all .claude/worktrees/agent-* entries via git worktree list
--porcelain and force-removes each, skipping the current executing
worktree as a safety guard. git worktree prune runs last to clear any
orphaned git metadata. This runs in both housekeeping (start of cycle,
catches crash remnants) and post-session cleanup (end of cycle).
- Add `sessions_since_eval()` to signals.py: reads the latest eval file
  from .recursive/evaluations/, extracts its date/mtime, then counts
  session index rows after that timestamp. Returns a scalar int.
- Surface the signal prominently in the dashboard Health section next to
  Eval score, with STALE annotation when >= 5 sessions.
- Add alert in the Alerts section when sessions_since_eval >= 5, pointing
  the brain to delegate a Phractal eval run.
- Add eval cadence rule to brain.md Delegation Protocol: when
  eval_staleness alert fires, brain SHOULD include eval run as a
  delegation.
- Add 8 unit tests in test_signals.py and 6 in test_dashboard.py covering
  all branches of the new signal and alert logic.
- All 1156 tests pass (make check green).

Closes task #242.
# sessions_since_eval tests (task #0242)
# ---------------------------------------------------------------------------

_VALID_EVAL_CONTENT = (
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 312c978493

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# Use file mtime for more precise timestamp (YYYY-MM-DD HH:MM)
from datetime import datetime as _dt

eval_ts = _dt.fromtimestamp(latest.stat().st_mtime).strftime("%Y-%m-%d %H:%M")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Base eval staleness on report date, not file mtime

Using latest.stat().st_mtime as the primary comparison timestamp makes sessions_since_eval return 0 after a fresh clone/reset, because Git sets file mtimes to checkout time rather than the report’s actual run date. In that common environment, an old eval report (with many newer session rows) appears “up to date,” so the new eval_staleness alert never fires and the cadence rule is bypassed. This regresses the core purpose of task #242 whenever the working tree is recreated or eval files are touched without a new eval run.

Useful? React with 👍 / 👎.

@fazxes fazxes merged commit 2b6a42c into main Apr 9, 2026
7 checks passed
@fazxes fazxes deleted the feat/sessions-since-eval-signal branch April 9, 2026 06:22
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