status: baselines with exception reporting, growth as baseline shift, pick for random fields

This commit is contained in:
2026-11-11 19:02:11 +00:00
parent 25469b934c
commit 6ad729683c
9 changed files with 132 additions and 62 deletions
+25 -14
View File
@@ -57,12 +57,20 @@ Two interleaved stories calibrate the memory system against itself:
state — never touches the rings, never decays, always in the bundle. state — never touches the rings, never decays, always in the bundle.
The housekeeper is instructed to keep it out of the rings. The housekeeper is instructed to keep it out of the rings.
2. **Character** — write `runs/<story>/character.md`: starting identity. 2. **Character** — write `runs/<story>/character.md`: starting identity.
Blanks are the player's to invent through play (their past is their The sheet is a reduction of choice surface — a ledger of decisions
purview); the GM ratifies notable inventions into the card afterward. already made; "what would make sense" does the cutting. Three kinds of
That's the freeform version of a random roll — no tables. field:
- **provided** — write it in;
- **random** — draft a few candidates, `node tool/memory.mjs pick "one"
"two" "three"`, write the winner. A roll is a decision made by nobody
that the player must honor — that's its whole value;
- **free** — leave blank; the player invents it through play, the GM
ratifies notable inventions afterward.
3. **Seed** — write `runs/<story>/seed.json` and run 3. **Seed** — write `runs/<story>/seed.json` and run
`node tool/memory.mjs seed`. A one-time, all-or-nothing migration: `node tool/memory.mjs seed`. A one-time, all-or-nothing migration:
`entries` → the rings (initial memories), `status` → starting values, `entries` → the rings (initial memories), `status` → starting values
(a string is shorthand for `{normal, value}` — the starting state is
her normal; use the object form for an excursion in medias res),
`records` → pre-existing files (gated by `settings.json`). Refuses if `records` → pre-existing files (gated by `settings.json`). Refuses if
the run has any history; `--force` only on a disposable db. Everything the run has any history; `--force` only on a disposable db. Everything
is journaled under window `seed`. is journaled under window `seed`.
@@ -79,10 +87,11 @@ Two interleaved stories calibrate the memory system against itself:
3. **In play:** `((double parentheses))` is the out-of-character channel — 3. **In play:** `((double parentheses))` is the out-of-character channel —
points of order, canon questions, proposals, vetoes. Both sides use it. points of order, canon questions, proposals, vetoes. Both sides use it.
Entries carry stable ids (`[e17]`); citing one is the precise way to Entries carry stable ids (`[e17]`); citing one is the precise way to
reference a memory. Status declarations (`((status key: value))`) are reference a memory. Status declarations (`((status key: value))`,
relayed to `set`/`unset`; record work (`((q:))`, `((file:))`, `((status norm key: value))`, `((status clear key))`,
`((amend:))`, `((discard:))`) to `search`/`file`/`amend`/`discard` — `((status drop key))`) are relayed to `set`/`norm`/`clear`/`unset`;
`--gm` marks GM-authorized writes. record work (`((q:))`, `((file:))`, `((amend:))`, `((discard:))`) to
`search`/`file`/`amend`/`discard` — `--gm` marks GM-authorized writes.
4. **Close a window:** just stop. No in-band ritual; the player-model has no 4. **Close a window:** just stop. No in-band ritual; the player-model has no
end-of-session duties. end-of-session duties.
5. **Housekeep (fresh model, new context):** send `housekeeper.md`, then 5. **Housekeep (fresh model, new context):** send `housekeeper.md`, then
@@ -108,7 +117,7 @@ Memory is **six tiers**:
|---|---|---|---| |---|---|---|---|
| **backdrop** | the world as everyone knows it — public knowledge, the general setting; never memory, never forgotten | always | GM, rarely (retcons) | | **backdrop** | the world as everyone knows it — public knowledge, the general setting; never memory, never forgotten | always | GM, rarely (retcons) |
| **identity** | the character sheet — concept, drives, skills, voice; changes rarely | always | GM, rarely; housekeeper may propose via open questions; blanks are the player's to invent | | **identity** | the character sheet — concept, drives, skills, voice; changes rarely | always | GM, rarely; housekeeper may propose via open questions; blanks are the player's to invent |
| **status** | her current self — mood, outfit, condition, stances toward people. State, not memory: no history, no decay, updated in place | always | **the player** (`((status key: value))`); GM override exceptional and journaled | | **status** | her own piece of paper — baselines (defaults she plays to) plus declared excursions; exception reporting keeps the chatter down | always | **the player** (`set`/`norm`/`clear`/`unset`); GM override exceptional and journaled |
| **rings A/B** | salient memory — facts, on her mind, MRU-evicted | always | housekeeper manifest | | **rings A/B** | salient memory — facts, on her mind, MRU-evicted | always | housekeeper manifest |
| **records** | her files — the card index, the ledger. Narrow query only, hard cap 10 (in the tool, not the prompt), never bulk-loaded | never — on demand | **the player** (`file`/`amend`/`discard` at her desk); GM seeds; housekeeper only `archive`s | | **records** | her files — the card index, the ledger. Narrow query only, hard cap 10 (in the tool, not the prompt), never bulk-loaded | never — on demand | **the player** (`file`/`amend`/`discard` at her desk); GM seeds; housekeeper only `archive`s |
| **cold** | forgotten or vetoed | never — not even queryable | GM only (`revive`) | | **cold** | forgotten or vetoed | never — not even queryable | GM only (`revive`) |
@@ -203,8 +212,9 @@ After N windows, grade against:
10. **Query discipline** — narrow queries; zero retry-on-miss cascades. 10. **Query discipline** — narrow queries; zero retry-on-miss cascades.
11. **Archive classification** — on-her-mind (rings) vs in-her-files 11. **Archive classification** — on-her-mind (rings) vs in-her-files
(records): are customer cards filed, not memorized? (records): are customer cards filed, not memorized?
12. **Status maintenance** — does she update on real shifts (not per-turn 12. **Status maintenance** — excursions declared when leaving baseline and
chores), and does her declared status match the transcripts? cleared when returning; baseline shifts track character growth; her
paper stays small. Does her declared status match the transcripts?
13. **Filing discipline** — cards filed at natural desk moments and kept 13. **Filing discipline** — cards filed at natural desk moments and kept
current, or dumped and forgotten? current, or dumped and forgotten?
@@ -260,9 +270,10 @@ system.md system prompt for the player-model (play-side only, shared)
housekeeper.md system prompt for the post-session housekeeping model (shared) housekeeper.md system prompt for the post-session housekeeping model (shared)
config.json the default run config.json the default run
tool/ tool/
memory.mjs the clerk: runs, init, render, apply, insert, delete, revive, memory.mjs the clerk: runs, init, seed, render, apply, insert, delete,
file, amend, discard, search, unarchive, set, unset, revive, file, amend, discard, search, unarchive, set, norm,
dump, restore, status (--run <name>; --gm for GM writes) clear, unset, pick, dump, restore, status
(--run <name>; --gm for GM writes; --force for migrations)
db/ db/
schema.sql entries, records, status, events journal (shared) schema.sql entries, records, status, events journal (shared)
runs/ runs/
+5 -4
View File
@@ -27,12 +27,13 @@ CREATE TABLE IF NOT EXISTS records (
created TEXT NOT NULL created TEXT NOT NULL
); );
-- the player's own current state: mood, outfit, stances toward people. -- the player's own piece of paper: baselines (the "what would make sense"
-- state, not memory — no history, no decay, updated in place. -- default — a decision already made) plus excursions (declared only when a
-- written by the player (((status key: value))); GM overrides are rare and journaled. -- value leaves its baseline, cleared when it returns). exception reporting.
CREATE TABLE IF NOT EXISTS status ( CREATE TABLE IF NOT EXISTS status (
key TEXT PRIMARY KEY, key TEXT PRIMARY KEY,
value TEXT NOT NULL, normal TEXT NOT NULL DEFAULT '',
value TEXT NOT NULL DEFAULT '',
updated TEXT NOT NULL updated TEXT NOT NULL
); );
+3 -2
View File
@@ -120,8 +120,9 @@ date for you. Don't list an id twice across operations.
never silently absorbed, never silently retconned. never silently absorbed, never silently retconned.
- Rings hold **facts, never her feelings**. Stances ("Marta: trust - Rings hold **facts, never her feelings**. Stances ("Marta: trust
cracked") live in her status, which is entirely hers — you never write cracked") live in her status, which is entirely hers — you never write
it. If her declared status contradicts the session you just read, flag it. A baseline shift there is character growth; if you notice one the
it in open questions. sheet hasn't caught up with, that's an open question, never a write.
If her declared status contradicts the session you just read, flag it.
- `character.md` (identity) is the GM's too. If identity or drives have - `character.md` (identity) is the GM's too. If identity or drives have
shifted, propose an amendment in open questions; never edit the sheet shifted, propose an amendment in open questions; never edit the sheet
yourself. yourself.
+2 -2
View File
@@ -1,6 +1,6 @@
<!-- GENERATED by tool/memory.mjs render — do not edit by hand. --> <!-- GENERATED by tool/memory.mjs render — do not edit by hand. -->
<!-- The player's own current state, maintained via ((status key: value)) in OOC. --> <!-- The player's own piece of paper: baselines are the defaults she plays to; -->
<!-- Stances are feelings; facts live in the rings. GM overrides are rare and journaled. --> <!-- excursions are declared and cleared. Stances are feelings; facts live in the rings. -->
# Status # Status
+5 -4
View File
@@ -29,12 +29,13 @@ CREATE TABLE IF NOT EXISTS records (
created TEXT NOT NULL created TEXT NOT NULL
); );
-- the player's own current state: mood, outfit, stances toward people. -- the player's own piece of paper: baselines (the "what would make sense"
-- state, not memory — no history, no decay, updated in place. -- default — a decision already made) plus excursions (declared only when a
-- written by the player (((status key: value))); GM overrides are rare and journaled. -- value leaves its baseline, cleared when it returns). exception reporting.
CREATE TABLE IF NOT EXISTS status ( CREATE TABLE IF NOT EXISTS status (
key TEXT PRIMARY KEY, key TEXT PRIMARY KEY,
value TEXT NOT NULL, normal TEXT NOT NULL DEFAULT '',
value TEXT NOT NULL DEFAULT '',
updated TEXT NOT NULL updated TEXT NOT NULL
); );
+2 -2
View File
@@ -1,6 +1,6 @@
<!-- GENERATED by tool/memory.mjs render — do not edit by hand. --> <!-- GENERATED by tool/memory.mjs render — do not edit by hand. -->
<!-- The player's own current state, maintained via ((status key: value)) in OOC. --> <!-- The player's own piece of paper: baselines are the defaults she plays to; -->
<!-- Stances are feelings; facts live in the rings. GM overrides are rare and journaled. --> <!-- excursions are declared and cleared. Stances are feelings; facts live in the rings. -->
# Status # Status
+5 -4
View File
@@ -29,12 +29,13 @@ CREATE TABLE IF NOT EXISTS records (
created TEXT NOT NULL created TEXT NOT NULL
); );
-- the player's own current state: mood, outfit, stances toward people. -- the player's own piece of paper: baselines (the "what would make sense"
-- state, not memory — no history, no decay, updated in place. -- default — a decision already made) plus excursions (declared only when a
-- written by the player (((status key: value))); GM overrides are rare and journaled. -- value leaves its baseline, cleared when it returns). exception reporting.
CREATE TABLE IF NOT EXISTS status ( CREATE TABLE IF NOT EXISTS status (
key TEXT PRIMARY KEY, key TEXT PRIMARY KEY,
value TEXT NOT NULL, normal TEXT NOT NULL DEFAULT '',
value TEXT NOT NULL DEFAULT '',
updated TEXT NOT NULL updated TEXT NOT NULL
); );
+19 -14
View File
@@ -76,24 +76,29 @@ happen.
# Status # Status
The status view in your bundle is your own current state — mood, outfit, The status view in your bundle is **your own piece of paper**: your current
condition, your stance toward the people in your life. Nobody updates it state — mood, outfit, condition, your stance toward the people in your
for you; it is yours to keep. life. Nobody updates it for you. It is a record of decisions already made;
"what would make sense" does the rest of the cutting.
When something shifts and stays shifted, declare it in OOC: Most values have a **baseline** — the normal, the default you play to.
The baseline is a decision already made. You only declare when a value
*leaves* its baseline, and clear it when it returns:
((status mood: sea-sick and furious)) ((status mood: sea-sick and furious)) an excursion
((status Marta: trust cracked — she lied about the radio)) ((status clear mood)) back to normal
((status clear: outfit)) ((status norm mood: guarded)) a baseline shift — growth is this
((status drop mood)) remove the field
- Update when it changes, not every turn. Ride natural pauses — a scene - Declare excursions when they happen; clear them when they pass. Ride
ending, a quiet moment. For some characters this is a literal ritual natural pauses — a scene ending, a quiet moment. For some characters
(closing up the shop, evening entries in a diary). this is a literal ritual (closing up the shop, a diary).
- The paper is **yours**: add fields, rename them, prune them. But it is
small — a handful of values that decide turns. Don't record everything;
the baseline already covers the ordinary.
- **Stances are feelings, not facts.** "Marta: trust cracked" is yours to - **Stances are feelings, not facts.** "Marta: trust cracked" is yours to
declare; "Marta lied about the radio" is a fact — that belongs in memory, declare; "Marta lied about the radio" is a fact — that belongs in
and the housekeeper keeps it. memory, and the housekeeper keeps it.
- Keep the set small: what would decide your next turn. Update in place,
clear what no longer matters.
- The GM may override a value when it drifts from the shared narrative. - The GM may override a value when it drifts from the shared narrative.
That should be rare, and you take it without argument. That should be rare, and you take it without argument.
+66 -16
View File
@@ -21,8 +21,11 @@
// discard <rid> "reason" the PC discards a record (--gm likewise) // discard <rid> "reason" the PC discards a record (--gm likewise)
// search <terms...> query the records (max 10; a miss is a miss) // search <terms...> query the records (max 10; a miss is a miss)
// unarchive <rid> [a|b] GM pulls a record back into the rings // unarchive <rid> [a|b] GM pulls a record back into the rings
// set <key> "value" the PC updates her status (--gm to override) // set <key> "value" the PC declares an excursion (--gm to override)
// unset <key> the PC clears a status key // norm <key> "baseline" the PC adopts/shifts a baseline (growth)
// clear <key> excursion ends — back to baseline
// unset <key> the PC drops a field from her paper
// pick "a" "b" "c" ... dice for prose — uniform random choice
// dump canonical dump to dumps/memory.sql // dump canonical dump to dumps/memory.sql
// (also auto-written by every mutation) // (also auto-written by every mutation)
// restore --force rebuild the db from dumps/memory.sql // restore --force rebuild the db from dumps/memory.sql
@@ -73,8 +76,8 @@ function resolveRun() {
return null; return null;
} }
const RUN = cmd === 'runs' ? null : resolveRun(); const RUN = (cmd === 'runs' || cmd === 'pick') ? null : resolveRun();
if (cmd !== 'runs' && (!RUN || !/^[a-z0-9-]+$/.test(RUN))) { if (cmd !== 'runs' && cmd !== 'pick' && (!RUN || !/^[a-z0-9-]+$/.test(RUN))) {
fail('no run specified — use --run <name> or {"run":"name"} in config.json'); fail('no run specified — use --run <name> or {"run":"name"} in config.json');
} }
@@ -174,14 +177,18 @@ function renderStatus(db) {
const rows = db.prepare('SELECT * FROM status ORDER BY updated DESC, key').all(); const rows = db.prepare('SELECT * FROM status ORDER BY updated DESC, key').all();
const lines = [ const lines = [
'<!-- GENERATED by tool/memory.mjs render — do not edit by hand. -->', '<!-- GENERATED by tool/memory.mjs render — do not edit by hand. -->',
"<!-- The player's own current state, maintained via ((status key: value)) in OOC. -->", "<!-- The player's own piece of paper: baselines are the defaults she plays to; -->",
'<!-- Stances are feelings; facts live in the rings. GM overrides are rare and journaled. -->', '<!-- excursions are declared and cleared. Stances are feelings; facts live in the rings. -->',
'', '',
'# Status', '# Status',
'', '',
]; ];
if (!rows.length) lines.push('(nothing set — fresh start)'); if (!rows.length) lines.push('(nothing set — fresh start)');
for (const r of rows) lines.push(`- **${r.key}:** ${r.value}`); for (const r of rows) {
const shown = r.value || r.normal;
const ex = r.value && r.value !== r.normal && r.normal ? ` *(norm: ${r.normal})*` : '';
lines.push(`- **${r.key}:** ${shown}${ex}`);
}
lines.push(''); lines.push('');
const file = path.join(CANON_DIR, 'status.md'); const file = path.join(CANON_DIR, 'status.md');
fs.mkdirSync(CANON_DIR, { recursive: true }); fs.mkdirSync(CANON_DIR, { recursive: true });
@@ -216,7 +223,7 @@ function dumpDb(db) {
L.push(`INSERT INTO records VALUES (${r.id},${q(r.kind)},${q(r.label)},${q(r.detail)},${q(r.created)});`); L.push(`INSERT INTO records VALUES (${r.id},${q(r.kind)},${q(r.label)},${q(r.detail)},${q(r.created)});`);
} }
for (const r of db.prepare('SELECT * FROM status ORDER BY key').all()) { for (const r of db.prepare('SELECT * FROM status ORDER BY key').all()) {
L.push(`INSERT INTO status VALUES (${q(r.key)},${q(r.value)},${q(r.updated)});`); L.push(`INSERT INTO status VALUES (${q(r.key)},${q(r.normal)},${q(r.value)},${q(r.updated)});`);
} }
for (const r of db.prepare('SELECT * FROM events ORDER BY id').all()) { for (const r of db.prepare('SELECT * FROM events ORDER BY id').all()) {
L.push(`INSERT INTO events VALUES (${r.id},${q(r.window)},${q(r.op)},${q(r.target)},${q(r.reason)});`); L.push(`INSERT INTO events VALUES (${r.id},${q(r.window)},${q(r.op)},${q(r.target)},${q(r.reason)});`);
@@ -319,7 +326,12 @@ function cmdSeed(force, seedPathArg) {
} }
if (!Array.isArray(status) && status && typeof status === 'object') { if (!Array.isArray(status) && status && typeof status === 'object') {
for (const [k, v] of Object.entries(status)) { for (const [k, v] of Object.entries(status)) {
if (!k.trim() || typeof v !== 'string' || !v.trim()) errors.push(`status["${k}"] must be a non-empty string`); const okStr = typeof v === 'string' && v.trim();
const okObj = v && typeof v === 'object' && !Array.isArray(v)
&& (typeof v.normal === 'string' || typeof v.value === 'string');
if (!k.trim() || (!okStr && !okObj)) {
errors.push(`status["${k}"] must be a non-empty string (normal and starting value) or {"normal", "value"}`);
}
} }
} }
for (const [i, r] of (Array.isArray(records) ? records : []).entries()) { for (const [i, r] of (Array.isArray(records) ? records : []).entries()) {
@@ -343,8 +355,10 @@ function cmdSeed(force, seedPathArg) {
journal(db, 'seed', 'insert', `e${Number(res.lastInsertRowid)}`, 'seeded'); journal(db, 'seed', 'insert', `e${Number(res.lastInsertRowid)}`, 'seeded');
} }
for (const [k, v] of Object.entries(status)) { for (const [k, v] of Object.entries(status)) {
db.prepare('INSERT INTO status (key, value, updated) VALUES (?, ?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value, updated = excluded.updated') const n = typeof v === 'string' ? v : (v.normal ?? '');
.run(norm(k), norm(v), sf.date); const val = typeof v === 'string' ? v : (v.value ?? '');
db.prepare("INSERT INTO status (key, normal, value, updated) VALUES (?, ?, ?, ?) ON CONFLICT(key) DO UPDATE SET normal = excluded.normal, value = excluded.value, updated = excluded.updated")
.run(norm(k), norm(n), norm(val), sf.date);
journal(db, 'seed', 'status', `s:${norm(k)}`, 'seeded'); journal(db, 'seed', 'status', `s:${norm(k)}`, 'seeded');
} }
for (const r of records) { for (const r of records) {
@@ -664,25 +678,57 @@ function cmdDiscard(ridStr, reason) {
function cmdSet(key, value, reason) { function cmdSet(key, value, reason) {
const db = openDb(); const db = openDb();
if (!key?.trim() || !value?.trim()) fail('usage: set <key> "value" ["reason"]'); if (!key?.trim() || !value?.trim()) fail('usage: set <key> "value" ["reason"]');
db.prepare('INSERT INTO status (key, value, updated) VALUES (?, ?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value, updated = excluded.updated') db.prepare("INSERT INTO status (key, normal, value, updated) VALUES (?, '', ?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value, updated = excluded.updated")
.run(norm(key), norm(value), today()); .run(norm(key), norm(value), today());
journal(db, AS_GM ? 'gm' : 'pc', 'status', `s:${norm(key)}`, reason ?? (AS_GM ? 'GM override' : 'player declaration')); journal(db, AS_GM ? 'gm' : 'pc', 'status', `s:${norm(key)}`, reason ?? (AS_GM ? 'GM override' : 'excursion declared'));
console.log(`status ${norm(key)}: ${norm(value)}`); console.log(`status ${norm(key)}: ${norm(value)}`);
renderAll(db); renderAll(db);
dumpDb(db); dumpDb(db);
} }
function cmdNorm(key, baseline, reason) {
const db = openDb();
if (!key?.trim() || !baseline?.trim()) fail('usage: norm <key> "baseline" ["reason"]');
db.prepare("INSERT INTO status (key, normal, value, updated) VALUES (?, ?, '', ?) ON CONFLICT(key) DO UPDATE SET normal = excluded.normal, updated = excluded.updated")
.run(norm(key), norm(baseline), today());
journal(db, AS_GM ? 'gm' : 'pc', 'status', `s:${norm(key)}`, reason ?? (AS_GM ? 'GM override' : 'baseline set'));
console.log(`status ${norm(key)} — norm: ${norm(baseline)}`);
renderAll(db);
dumpDb(db);
}
function cmdClear(key) {
const db = openDb();
const row = db.prepare('SELECT * FROM status WHERE key = ?').get(norm(key ?? ''));
if (!row) fail(`no such status key: ${key}`);
if (!row.normal) {
db.prepare('DELETE FROM status WHERE key = ?').run(row.key);
} else {
db.prepare("UPDATE status SET value = '', updated = ? WHERE key = ?").run(today(), row.key);
}
journal(db, AS_GM ? 'gm' : 'pc', 'status', `s:${row.key}`, 'returned to baseline');
console.log(`status ${row.key}: back to ${row.normal || '—'}`);
renderAll(db);
dumpDb(db);
}
function cmdUnset(key) { function cmdUnset(key) {
const db = openDb(); const db = openDb();
const row = db.prepare('SELECT * FROM status WHERE key = ?').get(norm(key ?? '')); const row = db.prepare('SELECT * FROM status WHERE key = ?').get(norm(key ?? ''));
if (!row) fail(`no such status key: ${key}`); if (!row) fail(`no such status key: ${key}`);
db.prepare('DELETE FROM status WHERE key = ?').run(row.key); db.prepare('DELETE FROM status WHERE key = ?').run(row.key);
journal(db, AS_GM ? 'gm' : 'pc', 'status', `s:${row.key}`, 'cleared'); journal(db, AS_GM ? 'gm' : 'pc', 'status', `s:${row.key}`, 'field dropped');
console.log(`status ${row.key}: cleared`); console.log(`status ${row.key}: dropped`);
renderAll(db); renderAll(db);
dumpDb(db); dumpDb(db);
} }
function cmdPick(options) {
if (options.length < 2) fail('usage: pick "option one" "option two" [...]');
const choice = options[Math.floor(Math.random() * options.length)];
console.log(`picked: ${choice}`);
}
function cmdSearch(terms) { function cmdSearch(terms) {
const db = openDb(); const db = openDb();
if (!recordsEnabled()) fail('this character keeps no records — nothing to consult'); if (!recordsEnabled()) fail('this character keeps no records — nothing to consult');
@@ -718,7 +764,8 @@ function cmdStatus() {
console.log(`run: ${RUN}${recordsEnabled() ? '' : ' (no records)'}`); console.log(`run: ${RUN}${recordsEnabled() ? '' : ' (no records)'}`);
const nr = db.prepare('SELECT COUNT(*) AS n FROM records').get().n; const nr = db.prepare('SELECT COUNT(*) AS n FROM records').get().n;
console.log(`records: ${nr}`); console.log(`records: ${nr}`);
const sk = db.prepare('SELECT key FROM status ORDER BY updated DESC, key').all().map((r) => r.key); const sk = db.prepare('SELECT * FROM status ORDER BY updated DESC, key').all()
.map((r) => r.key + (r.value && r.value !== r.normal && r.normal ? '!' : ''));
console.log(`status: ${sk.length ? sk.join(', ') : '(nothing set)'}`); console.log(`status: ${sk.length ? sk.join(', ') : '(nothing set)'}`);
for (const ring of ['a', 'b', 'cold']) { for (const ring of ['a', 'b', 'cold']) {
const n = db.prepare('SELECT COUNT(*) AS n FROM entries WHERE ring = ?').get(ring).n; const n = db.prepare('SELECT COUNT(*) AS n FROM entries WHERE ring = ?').get(ring).n;
@@ -748,7 +795,10 @@ switch (cmd) {
case 'amend': (args.length >= 2) ? cmdAmend(args[0], args[1]) : fail('usage: amend <rid> "new detail"'); break; case 'amend': (args.length >= 2) ? cmdAmend(args[0], args[1]) : fail('usage: amend <rid> "new detail"'); break;
case 'discard': (args.length >= 1) ? cmdDiscard(args[0], args[1]) : fail('usage: discard <rid> "reason"'); break; case 'discard': (args.length >= 1) ? cmdDiscard(args[0], args[1]) : fail('usage: discard <rid> "reason"'); break;
case 'set': (args.length >= 2) ? cmdSet(args[0], args[1], args[2]) : fail('usage: set <key> "value" ["reason"]'); break; case 'set': (args.length >= 2) ? cmdSet(args[0], args[1], args[2]) : fail('usage: set <key> "value" ["reason"]'); break;
case 'norm': (args.length >= 2) ? cmdNorm(args[0], args[1], args[2]) : fail('usage: norm <key> "baseline" ["reason"]'); break;
case 'clear': (args.length >= 1) ? cmdClear(args[0]) : fail('usage: clear <key>'); break;
case 'unset': (args.length >= 1) ? cmdUnset(args[0]) : fail('usage: unset <key>'); break; case 'unset': (args.length >= 1) ? cmdUnset(args[0]) : fail('usage: unset <key>'); break;
case 'pick': cmdPick(args); break;
case 'search': cmdSearch(args); break; case 'search': cmdSearch(args); break;
case 'unarchive': (args.length >= 1) ? cmdUnarchive(args[0], args[1]) : fail('usage: unarchive <rid> [a|b]'); break; case 'unarchive': (args.length >= 1) ? cmdUnarchive(args[0], args[1]) : fail('usage: unarchive <rid> [a|b]'); break;
case 'status': cmdStatus(); break; case 'status': cmdStatus(); break;