You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 383b0d4
Browse filesBrowse the repository at this point in the historyBrowse files
feat(levelcode): auto-archive stale sessions at 30 days + a Pin toggle
The "keep the magic" pair from the sessions design (§4.9): the working set
fades on its own, and you protect what matters. Auto-archive quietly retires
sessions you haven't touched in 30 days; Pin exempts a session from that (and
floats it above the time buckets, past the 30-item cap).
- sessions.js: autoArchiveStale({ days, nowMs }) archives every active,
non-pinned, non-live session older than the cutoff — append-only (a label
event each), NEVER deletes, pinned exempt, idempotent. Exported alongside the
existing setPinned.
- extension.js: handleSessionAction gains 'pin' (toggles setPinned + refreshes
both surfaces); activate runs the sweep once on startup (deferred, guarded,
off when the setting is 0) and refreshes the list if anything faded.
- media/chat.html, media/sessionsView.html: a Pin/Unpin button in the card's
hover actions (byte-identical in the shared SESSIONS-PURE block — drift test
green); the star already marked pinned at rest.
- package.json: sessions.autoArchiveDays (default 30, 0 = off).
- tests: +1 sessions (sweep: stale faded, pinned/recent exempt, idempotent),
+1 sessionsUi (Pin toggle on the card + housekeeping wiring), and the rich/
rest card tests now assert Pin/Unpin. Full suite 30 files green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
if(days>0){constmgr=sessionsManager();if(mgr){constnArch=mgr.autoArchiveStale({ days });if(nArch){dbg('sessions.autoArchive',{archived: nArch, days });refreshSessions();}}}
2248
+
}catch(e){/* housekeeping is best-effort */}
2249
+
},1500);
2250
+
2240
2251
// AI-first: reveal the chat (in the secondary side bar) on EVERY launch until the user has actually
2241
2252
// engaged (sent their first message). This makes sure new users always see it, instead of it only
2242
2253
// showing once. Once they've sent a message (handleSend sets the flag) we stop forcing it and defer
Copy file name to clipboardExpand all lines: extensions/levelcode-ai/package.json
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -441,6 +441,12 @@
441
441
"description": "Folder to store session History in. Empty = ~/.levelcode/sessions. Each project gets its own subfolder; the files are append-only JSONL you can back up, diff, or delete by hand.",
442
442
"scope": "machine"
443
443
},
444
+
"levelcode.ai.sessions.autoArchiveDays": {
445
+
"type": "number",
446
+
"default": 30,
447
+
"minimum": 0,
448
+
"description": "Automatically archive sessions you haven't touched in this many days, to keep History focused on recent work. Archived sessions are hidden from the list but never deleted (the JSONL stays on disk), and pinned sessions are always kept. Set to 0 to turn auto-archiving off."
0 commit comments