diff --git a/src/config.ts b/src/config.ts
index cc67ce1..55e8120 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -7,7 +7,7 @@
/** Defaults written into cordis.patch.yml; also the fallback for missing keys. */
export const DEFAULT_SETTINGS: Settings = {
enabled: true,
- baseUrl: 'https://mem.qyhhh.top/api/longmemory',
+ baseUrl: 'https://your-memory-host/api/longmemory',
clientId: 'dsh-desktop',
requestTimeoutMs: 5000,
defaultK: 10,
diff --git a/src/page.ts b/src/page.ts
index 5a223ca..8d050a7 100644
--- a/src/page.ts
+++ b/src/page.ts
@@ -120,7 +120,7 @@ code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size
diff --git a/verify-concurrency.mjs b/verify-concurrency.mjs
new file mode 100644
index 0000000..9362762
--- /dev/null
+++ b/verify-concurrency.mjs
@@ -0,0 +1,70 @@
+// P5 concurrency / mutex verification.
+//
+// Every mutating skill path must refuse to run while a sync pass is running:
+// install staging, install commit, toggle, remove, update apply and rollback.
+// The refusal is a typed 409 at the route layer, never a silent partial write.
+import http from 'node:http'
+import { mkdirSync, mkdtempSync, writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+
+process.env.DSH_HOME = mkdtempSync(join(tmpdir(), 'brain-conc-'))
+
+const results = []
+function check(name, ok, detail) {
+ results.push({ name, ok })
+ console.log(`${ok ? 'PASS' : 'FAIL'} ${name}${detail === undefined ? '' : ` :: ${detail}`}`)
+}
+
+const { SkillAdmin } = await import('./lib/skill-admin.js')
+const { SkillUpdater } = await import('./lib/skill-update.js')
+const { SettingsStore } = await import('./lib/store.js')
+const { Reporter } = await import('./lib/reporter.js')
+const { createRoutes } = await import('./lib/routes.js')
+
+const root = join(process.env.DSH_HOME, 'skills')
+const holding = join(process.env.DSH_HOME, 'skills-disabled')
+mkdirSync(join(root, 'alpha'), { recursive: true })
+writeFileSync(join(root, 'alpha', 'SKILL.md'), '# alpha\n')
+
+let running = true
+const admin = new SkillAdmin({ skillsRoot: () => root, holdingDir: () => holding, syncStatePath: () => join(process.env.DSH_HOME, 'cloud-memory-skills.json'), syncRunning: () => running, log: () => {} })
+const updater = new SkillUpdater({ admin, skillsRoot: () => root, holdingDir: () => holding, syncRunning: () => running, log: () => {} })
+
+async function expectCode(fn, code) {
+ try { await fn(); return false } catch (error) { return error.code === code || error.message === code }
+}
+check('prepareInstall refuses while sync runs', await expectCode(() => admin.prepareInstall('https://example.org/x.git'), 'sync_running'))
+check('commitInstall refuses while sync runs', await expectCode(() => admin.commitInstall({ planId: 'x', folders: [] }), 'sync_running'))
+check('setEnabled refuses while sync runs', await expectCode(() => admin.setEnabled('alpha', false), 'sync_running'))
+check('remove refuses while sync runs', await expectCode(() => admin.remove('alpha'), 'sync_running'))
+check('applyUpdate refuses while sync runs', await expectCode(() => updater.applyUpdate('alpha', 'deadbeef'), 'sync_running'))
+check('rollback refuses while sync runs', await expectCode(() => updater.rollback('alpha'), 'sync_running'))
+
+// Route layer maps the refusal to 409.
+const store = new SettingsStore({ clientId: 't' }, join(process.env.DSH_HOME, 'c.json'))
+const reporter = new Reporter({ client: () => ({ reportTurn: async () => ({ ok: true, status: 200, data: {} }), submitSummary: async () => ({ ok: true, status: 200, data: {} }) }), settings: () => ({ enabled: true, clientId: 't' }), activityToken: () => '', summary: () => ({ enabled: false, maxChars: 1 }), summaryToken: () => '', log: () => {} })
+const routes = createRoutes({ version: '0.6.0', store, reporter, client: () => ({ reach: async () => ({ ok: false, status: 0, message: 'x' }), listSkills: async () => ({ ok: true, status: 200, data: { items: [] } }) }), admin, updates: updater })
+const server = http.createServer((req, res) => {
+ const path = (req.url ?? '/').split('?')[0]
+ for (const route of routes) {
+ if (route.kind === 'exact' && path === route.path) return route.handler(req, res)
+ if (route.kind === 'prefix' && (path === route.path || path.startsWith(`${route.path}/`))) return route.handler(req, res)
+ }
+ res.writeHead(404); res.end('{"ok":false}')
+})
+await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve))
+const origin = `http://127.0.0.1:${server.address().port}`
+const response = await fetch(`${origin}/cloud-memory/skills/toggle`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ folder: 'alpha', enabled: false }) })
+const body = await response.json()
+check('route answers 409 sync_running during a sync', response.status === 409 && body.code === 'sync_running', JSON.stringify(body))
+await new Promise((resolve) => server.close(resolve))
+
+// After the sync ends, the same toggle succeeds.
+running = false
+const enabled = await admin.setEnabled('alpha', false)
+check('after the sync ends the mutation is allowed', enabled.folder === 'alpha' && enabled.enabled === false)
+
+const passed = results.filter((r) => r.ok).length
+console.log(`\n${passed}/${results.length} passed`)
+process.exit(passed === results.length ? 0 : 1)
diff --git a/verify-theme.mjs b/verify-theme.mjs
new file mode 100644
index 0000000..33177ec
--- /dev/null
+++ b/verify-theme.mjs
@@ -0,0 +1,34 @@
+// P5 theme / narrow-panel structural guard.
+//
+// This is a static guard, not a screenshot: it fails if the hand-written card
+// reintroduces a hard-coded light-only colour or drops the wrapping that keeps
+// a narrow settings panel from scrolling sideways. It also asserts the tab bar
+// and the two long action rows declare flexWrap.
+import { readFileSync } from 'node:fs'
+
+const results = []
+function check(name, ok, detail) {
+ results.push({ name, ok })
+ console.log(`${ok ? 'PASS' : 'FAIL'} ${name}${detail === undefined ? '' : ` :: ${detail}`}`)
+}
+
+const source = readFileSync('./client/index.js', 'utf8')
+
+const hardcoded = source.match(/(?:background|color|borderColor)\s*:\s*['"]#(?:fff(?:fff)?|000(?:000)?)['"]/gi)
+check('no hard-coded pure white/black colours', hardcoded === null, hardcoded === null ? '' : hardcoded.join(','))
+
+const neutralTokens = (source.match(/rgba\(127,127,127/gi) ?? []).length
+check('theme-neutral colour tokens are used throughout', neutralTokens >= 5, `${neutralTokens} uses`)
+
+const accentTokens = (source.match(/rgba\(37,99,235/gi) ?? []).length
+check('accent colour is the shared blue token', accentTokens >= 2, `${accentTokens} uses`)
+
+const wrapCount = (source.match(/flexWrap\s*:\s*['"]wrap['"]/g) ?? []).length
+check('long rows wrap instead of scrolling sideways', wrapCount >= 4, `${wrapCount} wrapping rows`)
+
+check('tabs and actions declare wrapping', /tabBar[\s\S]{0,400}?flexWrap/.test(source) || /styles\.tabs/.test(source))
+check('no fixed 375px-only width is pinned', !/minWidth\s*:\s*['"]?375/.test(source))
+
+const passed = results.filter((r) => r.ok).length
+console.log(`\n${passed}/${results.length} passed`)
+process.exit(passed === results.length ? 0 : 1)
diff --git a/verify-upgrade.mjs b/verify-upgrade.mjs
new file mode 100644
index 0000000..97efec6
--- /dev/null
+++ b/verify-upgrade.mjs
@@ -0,0 +1,81 @@
+// P5 upgrade / migration verification.
+//
+// A 0.4.1 sidecar must survive an in-place upgrade: the schema is unchanged, so
+// base URL, tokens, client id and numeric overrides are read back verbatim and
+// survive a second "restart". Unknown keys are ignored rather than fatal. The
+// packaged default must be a neutral placeholder, and no personal domain may
+// remain in the shipped lib/.
+import { mkdtempSync, readFileSync, writeFileSync, readdirSync, statSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+
+process.env.DSH_HOME = mkdtempSync(join(tmpdir(), 'brain-upgrade-'))
+
+const results = []
+function check(name, ok, detail) {
+ results.push({ name, ok })
+ console.log(`${ok ? 'PASS' : 'FAIL'} ${name}${detail === undefined ? '' : ` :: ${detail}`}`)
+}
+
+const { SettingsStore } = await import('./lib/store.js')
+const { DEFAULT_SETTINGS } = await import('./lib/config.js')
+
+// ── 1. A 0.4.1-shaped sidecar survives the upgrade ──────────────────────
+const file = join(process.env.DSH_HOME, 'cloud-memory.json')
+const old = {
+ version: 1,
+ enabled: true,
+ baseUrl: 'https://memory.example.org/api/longmemory',
+ clientId: 'dsh-desktop',
+ requestTimeoutMs: 5000,
+ defaultK: 12,
+ activityToken: 'cmt_old_activity_0123456789abcdef',
+ memoryToken: 'cmt_old_memory_0123456789abcdef',
+ summaryEnabled: true,
+ summaryMaxChars: 6000,
+ summaryToken: 'cmt_old_summary_0123456789abcdef',
+ someFutureField: 'ignore-me',
+}
+writeFileSync(file, JSON.stringify(old, null, 2))
+
+const store = new SettingsStore(null, file)
+const s = store.settings()
+check('base URL survives the upgrade', s.baseUrl === old.baseUrl, s.baseUrl)
+check('client id survives the upgrade', s.clientId === 'dsh-desktop')
+check('numeric overrides survive', s.requestTimeoutMs === 5000 && s.defaultK === 12)
+check('all three tokens survive', store.activityToken() === old.activityToken && store.memoryToken() === old.memoryToken && store.summaryToken() === old.summaryToken)
+check('an unknown future key is ignored, not fatal', store.describe().baseUrlConfigured === true)
+
+// A second construction models a restart over the same file.
+const reopened = new SettingsStore(null, file)
+check('a restart reads the same values back', reopened.settings().baseUrl === old.baseUrl && reopened.activityToken() === old.activityToken)
+
+// ── 2. Fresh installs default to a neutral placeholder ──────────────────
+const emptyFile = join(process.env.DSH_HOME, 'empty.json')
+const fresh = new SettingsStore(null, emptyFile)
+check('fresh install uses the packaged placeholder', DEFAULT_SETTINGS.baseUrl === 'https://your-memory-host/api/longmemory', DEFAULT_SETTINGS.baseUrl)
+check('a placeholder is reported as unconfigured', fresh.describe().baseUrlConfigured === false)
+
+// ── 3. A corrupt file degrades to defaults instead of breaking boot ─────
+const corrupt = join(process.env.DSH_HOME, 'corrupt.json')
+writeFileSync(corrupt, '{not json')
+let survived = true
+try { new SettingsStore(null, corrupt) } catch { survived = false }
+check('a torn sidecar does not break activation', survived)
+
+// ── 4. Artifact hygiene: no personal domain in shipped lib/ ─────────────
+const libDir = join(process.cwd(), 'lib')
+let leaked = []
+for (const name of readdirSync(libDir)) {
+ const full = join(libDir, name)
+ if (!statSync(full).isFile() || !name.endsWith('.js')) continue
+ const text = readFileSync(full, 'utf8')
+ if (/qyhhh/i.test(text)) leaked.push(name)
+}
+check('no personal domain remains in shipped lib/', leaked.length === 0, leaked.join(','))
+const pkg = JSON.parse(readFileSync(join(process.cwd(), 'package.json'), 'utf8'))
+check('package version is the delivery version', pkg.version === '0.6.0', pkg.version)
+
+const passed = results.filter((r) => r.ok).length
+console.log(`\n${passed}/${results.length} passed`)
+process.exit(passed === results.length ? 0 : 1)