diff --git a/the-matrix/index.html b/the-matrix/index.html
index afffbc5..ba274f9 100644
--- a/the-matrix/index.html
+++ b/the-matrix/index.html
@@ -330,6 +330,14 @@
.panel-btn.muted { border-color: #0e2318; color: #226644; }
.panel-btn.muted:hover:not(:disabled) { background: #0e2318; color: #44dd88; }
+ .session-link-btn {
+ background: none; border: none; color: #557755; font-size: 10px;
+ font-family: inherit; cursor: pointer; margin-top: 10px; padding: 4px 0;
+ letter-spacing: 1px; display: block;
+ }
+ .session-link-btn:hover:not(:disabled) { color: #44dd88; text-decoration: underline; }
+ .session-link-btn:disabled { opacity: 0.35; cursor: not-allowed; }
+
#job-status { font-size: 11px; margin-top: 8px; color: #5577aa; min-height: 16px; }
#job-error { font-size: 11px; margin-top: 4px; min-height: 16px; color: #994444; }
@@ -622,6 +630,7 @@
TYPE IN THE INPUT BAR TO ASK TIMMY.
EACH REQUEST DEDUCTS FROM YOUR BALANCE.
+
diff --git a/the-matrix/js/session.js b/the-matrix/js/session.js
index bfaedf7..b505770 100644
--- a/the-matrix/js/session.js
+++ b/the-matrix/js/session.js
@@ -51,6 +51,7 @@ export function initSessionPanel() {
_on('session-back-btn', 'click', () => _setStep('active'));
_on('topup-quick-btn', 'click', () => { _openPanel(); _setStep('topup'); });
_on('session-hud-topup', 'click', (e) => { e.preventDefault(); _openPanel(); _setStep('topup'); });
+ _on('session-clear-history-btn', 'click', _clearHistory);
// Amount preset buttons — deposit (quick-fill the number input)
_panel.querySelectorAll('[data-session-step="fund"] .session-amount-btn').forEach(btn => {
@@ -419,6 +420,30 @@ function _startTopupPolling() {
_pollTimer = setTimeout(poll, POLL_MS);
}
+// ── Clear history ─────────────────────────────────────────────────────────────
+
+async function _clearHistory() {
+ if (!_sessionId || !_macaroon) return;
+ const btn = document.getElementById('session-clear-history-btn');
+ if (btn) btn.disabled = true;
+ try {
+ const res = await fetch(`${API}/sessions/${_sessionId}/history`, {
+ method: 'DELETE',
+ headers: { 'Authorization': `Bearer ${_macaroon}` },
+ });
+ if (res.ok) {
+ _setStatus('active', '✓ History cleared', '#44dd88');
+ setTimeout(() => _setStatus('active', '', ''), 2500);
+ } else {
+ _setStatus('active', 'Failed to clear history', '#ff6644');
+ }
+ } catch (err) {
+ _setStatus('active', 'Error: ' + err.message, '#ff6644');
+ } finally {
+ if (btn) btn.disabled = false;
+ }
+}
+
// ── Restore from localStorage ─────────────────────────────────────────────────
async function _tryRestore() {