Repository navigation
feat(explorer): add a Recent read sort — last deliberate agent read first - #718
Merged
Merged
Conversation
…d lessons last 00115 replaces the list RPC's body (same signature) so p_sort => 'last_opened_at' orders by the last deliberate agent read, desc NULLS LAST with id as the tie-break. The keyset reuses p_cursor_ts/p_cursor_id: a NULL timestamp with a set id means the previous page ended inside the never-opened tail. migrations.test.sql gains section 115. Co-authored-by: dash0-dev[bot] <257284812+dash0-dev[bot]@users.noreply.github.com>
GET /memories and POST /memories/list take the new order. It pages through
last-opened-cursor.ts ({ id, last_opened_at }, the timestamp nullable so a
page can end inside the never-opened tail), mirrored into the edge tree and
drift-checked like count-cursor.ts. Each cursor decoder rejects the other
formats, so flipping sort mid-pagination still restarts at page one.
Co-authored-by: dash0-dev[bot] <257284812+dash0-dev[bot]@users.noreply.github.com>
The Sort control offers Newest / Most chosen / Recent read. Recent read is ?sort=last_opened_at: the lessons an agent deliberately read most recently first, never-read lessons last. The option list, its labels and the URL handling stay in lib/explorer-sort.ts; the control and the list query are generic over it. Co-authored-by: dash0-dev[bot] <257284812+dash0-dev[bot]@users.noreply.github.com>
Grooming and self-improving-workflows pages, the llms.txt template (and the regenerated llms.txt), the memories function's CLAUDE.md, the key-files index and the regenerated BYOD bootstrap. Co-authored-by: dash0-dev[bot] <257284812+dash0-dev[bot]@users.noreply.github.com>
Contributor
|
The dashboard preview for this PR — redeployed on each push that changes the web app.
Preview always points at this PR's latest commit; Deployment is the immutable build of |
mthines
approved these changes
Oct 21, 2026
mthines
marked this pull request as ready for review
October 21, 2026 17:34
Contributor
Author
|
Darkplane Automerge did not approve this pull request. It scored 56.62 of 100, and 75 was required.
The other criterion
An AI evaluator produced these scores from the diff, the repository history, and the pull request text. The pull request text is author-controlled, so treat the scores as signals rather than proof. Reviewed for commit 3bd5f86. |
Merged
This was referenced Oct 21, 2026
mthines
added a commit
that referenced
this pull request
Oct 22, 2026
* fix(web): write useUrlState changes with window.history so a reload keeps them useUrlState's setter wrote the URL with router.replace, which commits the address bar only once the route's server render returns. On PR #718's preview that render took 4.3 s, and a reload inside that window brought the Explorer back to Newest (aw-verify F-1). The setter now writes with window.history.replaceState (pushState in push mode, deduped like router.push). Next.js syncs both into useSearchParams without a server render, so the URL holds the choice as soon as setState returns. The write builds from the live location, so two keys set in one tick both land. The clean-up effects keep using the router. Co-authored-by: dash0-dev[bot] <257284812+dash0-dev[bot]@users.noreply.github.com> * test(web): a sort choice is in the address bar the moment it is made Interaction story on the Explorer: choosing Recent read must put sort=%22last_opened_at%22 in window.location in the same step, and Newest must remove it. Fails against the router.replace setter (sort reads null), passes with the window.history write. Co-authored-by: dash0-dev[bot] <257284812+dash0-dev[bot]@users.noreply.github.com> * fix(web): one Back step for a handler that sets two push-mode keys FilterBar's Clear all sets filters and then retention, both push-mode, in one click. Writing each with pushState left two Back steps, the first landing on a state the reader never saw. Within one task only the first URL-changing push-mode write pushes; later ones replace that entry, as the router used to collapse same-tick navigations. Co-authored-by: dash0-dev[bot] <257284812+dash0-dev[bot]@users.noreply.github.com> * chore(web): simplify pass — one-line docblocks, WHY comments at the lines they explain Co-authored-by: dash0-dev[bot] <257284812+dash0-dev[bot]@users.noreply.github.com> * docs(web): URL-state comments no longer describe router.replace as the write path url-state-optimistic's header and the two MemorySidebarProvider guards explained a router round trip and a same-tick clobber that the window.history write from the live URL no longer has. The guards stay; their reasons now read in the past tense. Co-authored-by: dash0-dev[bot] <257284812+dash0-dev[bot]@users.noreply.github.com> * fix(web): defer useUrlState's history write by a microtask Next.js installs its window.history patch in an App Router effect. On a hard load a child's mount effect in the same commit runs first, so a setter called there (OrganizationManager clearing a stale ?org=) would hit the raw History API and Next's router would never see the write. React runs a commit's mount effects in one synchronous flush, so one microtask later the patch is in; still before any paint or reload. Co-authored-by: dash0-dev[bot] <257284812+dash0-dev[bot]@users.noreply.github.com> * docs(web): the setter's URL write is a microtask later, not synchronous Co-authored-by: dash0-dev[bot] <257284812+dash0-dev[bot]@users.noreply.github.com> --------- Co-authored-by: mads.thines <[email protected]> Co-authored-by: dash0-dev[bot] <257284812+dash0-dev[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The Lore Explorer could sort by Newest or Most chosen, but not by what agents are reading now: a lifetime count cannot tell a lesson fetched forty times last spring from one fetched this morning.
What changed
?sort=last_opened_at): the last deliberate agent read first — a targetedmemory.read/ CLIread, never a bulk list/search page or a human opening the dashboard (00099's column).lorekit_memory_listorder by itdesc NULLS LAST(same signature); never-read lessons trail as a tail, sototalis unchanged.last-opened-cursor.ts(edge-mirrored, drift-checked), carries a nullable timestamp so paging continues inside that tail; both list routes accept the new value.llms.txtand BYOD bootstrap.How to verify
supabase/tests/migrations.test.sqlpins the order, the total and a 4-page walk across a tie and the read → never-read boundary (Integration smoke runs it)./lore; the URL gainssort=%22last_opened_at%22and survives a reload.Notes for reviewers
Under this sort a NULL
p_cursor_tswith a setp_cursor_idmeans "inside the never-read tail", so the handler passes the id whenever a cursor decodes. The list route has no handler-level test, so that wiring is covered by review and §115's RPC-level walk only.🧪 UI verification spec — run against the preview deployment
Target: preview
Format: intent
Spec 1: AC-1 — A reader sorts the Explorer by Recent read and the order survives a reload
Changed: the Sort control in the Lore Explorer toolbar (new "Recent read" option)
Start: /lore
Preconditions:
Steps:
Expected:
POST /functions/v1/memories/listreturns 200sort=%22last_opened_at%22.sortparameter.Hints:
EXPLORER_SORT_LABELS)encodeURIComponent(JSON.stringify(value))) — packages/cli/src/shared/deeplink-pure.mjs:111Out of scope: