legal_calendar: make "what's coming up" answerable

↗ view on GitHub · emileriksenkeev · 2026-08-05 · 6c8244ec

Activation against live production exposed three gaps in the obligations
tool that only appear with real data behind it.

The feed is ordered by due_date ascending across the whole corpus, and the
corpus holds many years of long-overdue extracted obligations. "What
renews in the next 60 days" therefore returned 100 items dated 2005-2022 -
every one of them already past due, presented as if upcoming. The endpoint
supports due_after; the tool never exposed it. It does now, along with
limit and cursor, and both the tool description and the guidance say
plainly that a question about the future needs due_after.

Syd's system prompt carries no current date, so the model could not compute
that window even when told to. CORTEX_GUIDANCE is now cortexGuidance(),
built per request with today's date in it. Per request rather than at
module load on purpose: this backend runs for days between restarts, and a
date baked in at startup goes stale silently.

Cortex caps `count` on the obligations query and flags the cap with
`at_least`, which the tool dropped - so the model saw the cap 10000 as an
exact figure. Now surfaced as count_is_lower_bound with guidance to say
"at least N".

Also names the junk the extractor leaves behind: rows carrying a
1970-01-01 placeholder (no real date extracted) and rows already overdue
are counted in the note, so an obligation with no date never gets reported
as a deadline. If every row came back overdue and due_after was not set,
the note says so outright and tells the model to call again.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Repository emileriksenkeev/sydOS
Author emileriksenkeev <emil@keev.co>
Authored
Parents 6fc550b0
Stats 5 files changed , +86 , -18
Part of Cortex - company-wide document corpus integration

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-6c8244ec.md from inside the repo you want the change in.

⬇ Download capture-commit-6c8244ec.md