feat(brain): surface an aging review queue in brain_context (#82)
brain_pending existed the whole time four real items sat unreviewed from 2026-04-23 to 2026-07-15. The tool was never the gap — nothing ever prompted anyone to call it. The system should be what remembers the queue exists. Option 2 from the issue: ride along with brain_context, which sessions already call, so noticing an aging note costs nobody a decision to go looking. No scheduled job, no ntfy wiring, nothing new to keep running. Threshold-gated at 14 days, and silent below it — a notice on every context call is one people learn to skip, which reproduces the original failure with extra steps. It reports the whole queue once it speaks: the threshold decides whether to talk, not what to count. It never promotes, rejects or reorders. Age is a reason to ask a human, not a verdict; an old note may be exactly right to promote once someone looks. A test asserts the queue is untouched and that the payload carries a hint rather than an action. An unreadable raw/ dir degrades to silence — brain_context is a hot path and must not fail because the review queue is broken. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BeAp5LTscnz2W7Ubt4eJ6m
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/mathiasbq/hyperguild/ingestion/internal/search"
|
||||
)
|
||||
@@ -155,7 +156,14 @@ func (s *Server) brainContext(ctx context.Context, args json.RawMessage) (json.R
|
||||
entries = entries[:limit]
|
||||
}
|
||||
|
||||
return json.Marshal(map[string]any{"entries": entries})
|
||||
out := map[string]any{"entries": entries}
|
||||
// The queue nudge rides along with a call the session already makes, so
|
||||
// noticing an aging note costs nobody a decision to go looking (#82).
|
||||
// Advisory only, and absent entirely when there is nothing to say.
|
||||
if n := pendingNudge(s.brainDir, time.Now(), pendingNudgeThreshold); n != nil {
|
||||
out["pending_review"] = n
|
||||
}
|
||||
return json.Marshal(out)
|
||||
}
|
||||
|
||||
// truncateExcerpt clamps an already-stripped excerpt to maxLen characters
|
||||
|
||||
Reference in New Issue
Block a user