Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Memories: one-row header — the switch beside search, no "live" (#1138)

Deecc4983e18934
diff --git a/store/agents/memories/test/deliver.test.mjs b/store/agents/memories/test/deliver.test.mjs
index 1270d91fa..a5a101674 100644
--- a/store/agents/memories/test/deliver.test.mjs
+++ b/store/agents/memories/test/deliver.test.mjs
@@ -144,7 +144,8 @@ test('review: About You never cites its own copies as something the person wrote
const rows = collect({ env, home: dir }).memories
const told = rows.filter((row) => row.kind === 'instructions')
assert.ok(told.every((row) => !row.body.includes('Harness Memories')), 'no delivered copy is read back as an instruction')
- assert.deepEqual(told.map((row) => row.body.trim()), ['# My rules\n\nUse pnpm.', '## Gemini Added Memories\n- Prefers tabs'])
+ // Rows come newest first, and delivery writes both files in the same instant: compare them as a set.
+ assert.deepEqual(told.map((row) => row.body.trim()).sort(), ['# My rules\n\nUse pnpm.', '## Gemini Added Memories\n- Prefers tabs'])
assert.deepEqual(rows.filter((row) => row.agent === 'gemini' && row.kind === 'you').map((row) => row.body), ['Prefers tabs'], 'nor as something Gemini saved')
})
diff --git a/store/agents/memories/viewer/app.css b/store/agents/memories/viewer/app.css
index a49865a2d..c04cd7127 100644
--- a/store/agents/memories/viewer/app.css
+++ b/store/agents/memories/viewer/app.css
@@ -31,10 +31,8 @@ kbd { font: inherit; color: var(--text); }
.brand { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.brand h1 { font: inherit; font-weight: 700; margin: 0; letter-spacing: .02em; }
.mark { color: var(--accent); }
-.live { color: var(--faint); font-size: 11px; }
-.live::before { content: "● "; color: var(--faint); }
-.live.on::before { color: #3fae8c; }
-.live.on { color: var(--muted); }
+.live { color: var(--accent); font-size: 11px; }
+.live:empty { display: none; }
.prompt { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 10px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); }
.prompt:focus-within { border-color: var(--muted); }
.caret { color: var(--accent); font-weight: 700; }
@@ -44,16 +42,18 @@ kbd { font: inherit; color: var(--text); }
.count { color: var(--faint); white-space: nowrap; }
/* ── the switch: About You in every agent, on or off, and what it costs ─────────────────────── */
-.switch { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
-.switch-name { font-weight: 700; white-space: nowrap; }
+.top { flex-wrap: wrap; }
+.switch { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
+.switch-name { color: var(--muted); }
.switch button { display: inline-flex; align-items: center; gap: 7px; padding: 2px 10px 2px 3px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); cursor: pointer; font-weight: 700; min-width: 72px; }
.switch button .knob { width: 14px; height: 14px; border-radius: 2px; background: var(--faint); }
.switch button[aria-checked="true"] { border-color: #3fae8c; color: #3fae8c; }
.switch button[aria-checked="true"] .knob { background: #3fae8c; }
.switch button:disabled { cursor: default; opacity: .55; }
.switch button:focus-visible { outline: 1px solid var(--muted); outline-offset: 1px; }
-.switch-detail { color: var(--muted); min-width: 0; }
-.switch-detail .warn { color: var(--accent); }
+.switch-detail { color: var(--faint); }
+.switch-detail:empty { display: none; }
+.switch-problem { padding: 6px 14px; border-bottom: 1px solid var(--line); color: var(--accent); }
/* ── band: your year with agents ────────────────────────────────────────────────────────────── */
.band { display: flex; gap: 22px; align-items: flex-start; padding: 14px 14px 12px; border-bottom: 1px solid var(--line); overflow: hidden; }
diff --git a/store/agents/memories/viewer/app.js b/store/agents/memories/viewer/app.js
index 5b100f288..9244b8f6e 100644
--- a/store/agents/memories/viewer/app.js
+++ b/store/agents/memories/viewer/app.js
@@ -90,23 +90,26 @@ function drawSwitch() {
button.setAttribute('aria-checked', String(on))
$('switch-word').textContent = switching ? '…' : on ? 'ON' : 'OFF'
button.disabled = switching || !delivery.built
- detail.replaceChildren()
+ // One row: the switch and, beside it, only what explains its state. Which agents get it and what it
+ // costs are in About You's own panel; machines that need an update are in the machines list.
const machines = (snap.machines ?? [])
- const needUpdate = machines.filter((machine) => !machine.current && machine.online && !machine.ok).length
- if (!delivery.built) {
- detail.append(document.createTextNode('Not built yet. Ask the agent on the right: build my About You.'))
- } else if (on) {
- const names = (delivery.agents ?? []).filter((row) => row.delivered).map((row) => agent(row.agent).name)
- const onMachines = 1 + machines.filter((machine) => !machine.current && machine.ok && machine.deliveryOn).length
- const parts = [names.join(', ') || 'no agent installed here', `on ${onMachines} ${onMachines === 1 ? 'machine' : 'machines'}`, `~${number(delivery.tokens)} tokens per new session`]
- detail.append(document.createTextNode(parts.join(' · ')))
- } else {
- detail.append(document.createTextNode('Your agents don\'t get About You.'))
- }
- if (needUpdate) detail.append(document.createTextNode(' · '), el('span', 'warn', `${needUpdate} ${needUpdate === 1 ? 'machine needs' : 'machines need'} the newest Harness`))
- if (switchError) detail.append(document.createTextNode(' · '), el('span', 'warn', switchError))
- const failed = (delivery.agents ?? []).filter((row) => row.error)
- if (failed.length) detail.append(document.createTextNode(' · '), el('span', 'warn', failed.map((row) => `${agent(row.agent).name}: ${row.error}`).join('; ')))
+ const names = (delivery.agents ?? []).filter((row) => row.delivered).map((row) => agent(row.agent).name)
+ const onMachines = 1 + machines.filter((machine) => !machine.current && machine.ok && machine.deliveryOn).length
+ detail.textContent = !delivery.built ? 'not built yet' : !on && delivery.choseOff && delivery.choiceAt > 2 ? `off since ${since(delivery.choiceAt)}` : ''
+ button.title = !delivery.built ? 'Ask the agent on the right: build my About You.'
+ : on ? `Every new ${names.join(', ') || 'agent'} session starts with About You (~${number(delivery.tokens)} tokens), on ${onMachines} ${onMachines === 1 ? 'machine' : 'machines'}.`
+ : 'New sessions start without About You.'
+ const failed = (delivery.agents ?? []).filter((row) => row.error).map((row) => `${agent(row.agent).name}: ${row.error}`)
+ const problem = $('switch-problem')
+ problem.textContent = [switchError, ...failed].filter(Boolean).join(' · ')
+ problem.hidden = !problem.textContent
+}
+
+/** When a choice was made, the way a person says it: a time today, else a date. */
+function since(at) {
+ const date = new Date(at)
+ const today = new Date().toDateString() === date.toDateString()
+ return today ? date.toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' }) : date.toLocaleDateString(undefined, { month: 'short', day: 'numeric' })
}
$('switch-button').addEventListener('click', async () => {
@@ -739,11 +742,12 @@ function receive(snap) {
function connect() {
const live = $('live')
const source = new EventSource('/events')
+ // Connected is the normal state and says nothing; only a lost connection is worth words.
source.addEventListener('snapshot', (event) => {
- live.textContent = 'live'; live.classList.add('on')
+ live.textContent = ''; live.classList.remove('lost')
try { receive(JSON.parse(event.data)) } catch { /* a malformed frame is skipped; the next one replaces it */ }
})
- source.addEventListener('error', () => { live.textContent = 'reconnecting'; live.classList.remove('on') })
+ source.addEventListener('error', () => { live.textContent = 'reconnecting…'; live.classList.add('lost') })
}
let resizeTimer = null
diff --git a/store/agents/memories/viewer/index.html b/store/agents/memories/viewer/index.html
index 27b4e3d1d..c721a4966 100644
--- a/store/agents/memories/viewer/index.html
+++ b/store/agents/memories/viewer/index.html
@@ -10,17 +10,18 @@
</head>
<body>
<header class="top">
- <div class="brand"><span class="mark" aria-hidden="true">◉</span><h1>memories</h1><span id="live" class="live" role="status">connecting</span></div>
+ <div class="brand"><span class="mark" aria-hidden="true">◉</span><h1>memories</h1><span id="live" class="live" role="status"></span></div>
<label class="prompt"><span class="caret" aria-hidden="true">❯</span>
<input id="q" type="search" placeholder="search memories and sessions" aria-label="Search memories and sessions" autocomplete="off" spellcheck="false" autofocus>
<span id="count" class="count"></span>
</label>
+ <div id="switch" class="switch" hidden>
+ <span class="switch-name" id="switch-name">About You in your agents</span>
+ <button id="switch-button" type="button" role="switch" aria-checked="false" aria-labelledby="switch-name"><span class="knob"></span><span id="switch-word">OFF</span></button>
+ <span id="switch-detail" class="switch-detail"></span>
+ </div>
</header>
- <section id="switch" class="switch" aria-label="About You in your agents" hidden>
- <span class="switch-name">About You in your agents</span>
- <button id="switch-button" type="button" role="switch" aria-checked="false"><span class="knob"></span><span id="switch-word">OFF</span></button>
- <span id="switch-detail" class="switch-detail"></span>
- </section>
+ <div id="switch-problem" class="switch-problem" role="alert" hidden></div>
<section id="band" class="band" aria-label="Your work with agents" hidden>
<div class="heat">
<svg id="heat" role="img" aria-label="Your messages per day, colored by agent"></svg>