@creator-notes/cnotes 0.124.2 → 0.125.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "creator-notes-cli",
3
- "version": "0.124.2",
3
+ "version": "0.125.1",
4
4
  "description": "CreatorNotes CLI: create notes, build canvases, search knowledge from the terminal",
5
5
  "author": {
6
6
  "name": "CreatorNotes",
package/README.md CHANGED
@@ -53,6 +53,8 @@ cnotes search semantic "onboarding flow"
53
53
  | `cnotes query` | `cnotes q` | Filter, group or run a SELECT over every note's metadata from a local SQLite copy of the workspace, synced on each call |
54
54
  | `cnotes timeline` | `cnotes tl` | Recent activity feed |
55
55
  | `cnotes relationships list` | `cnotes rel` | Note relationships |
56
+ | `cnotes brief` | | What the workspace already knows about a task: the most relevant notes, canvases and recent changes, with what earlier runs made of each note |
57
+ | `cnotes lessons record\|list` | | Say whether the notes you read were useful, a dead end or corrected (also `operations end --useful`); the next run's brief starts from them |
56
58
  | `cnotes types list\|create\|update` | `cnotes t` | Manage note types (supertags) |
57
59
  | `cnotes workspace list\|select\|current` | | Workspace management |
58
60
  | `cnotes config get-server\|set-server` | | CLI configuration |
@@ -0,0 +1,113 @@
1
+ import { ApiClient } from "../lib/api-client.js";
2
+ import { resolveConfig } from "../lib/config.js";
3
+ import { handleError } from "../lib/errors.js";
4
+ import { outputJson } from "../lib/output.js";
5
+ import { LESSON_VERDICTS, describeAgo, describeLesson, fetchLessons, lessonsFromFlags, postLessons, renderRecorded, verdictLabel, } from "../lib/lessons.js";
6
+ /**
7
+ * `cnotes lessons`: say whether what you read helped, and read what earlier
8
+ * runs said. The brief folds the same answers in on its own; this is the
9
+ * command for marking outside a run and for looking at the record.
10
+ */
11
+ export function registerLessonsCommands(program) {
12
+ const lessons = program
13
+ .command("lessons")
14
+ .description("What earlier runs made of a note: useful, a dead end or corrected. Record yours at the end of a task; the brief starts the next run from them.");
15
+ lessons
16
+ .command("record")
17
+ .description("Record what the notes you read were worth for this task (one call, any mix of verdicts)")
18
+ .option("--useful <ids...>", "Notes that answered the task")
19
+ .option("--dead-end <ids...>", "Notes that led nowhere for this task")
20
+ .option("--corrected <ids...>", "Notes that were wrong; say what was right with --correction")
21
+ .option("--correction <text>", "What was right, in a sentence (goes with --corrected)")
22
+ .option("--task <text>", "What the verdicts are about; defaults to the open run's headline")
23
+ .addHelpText("after", `
24
+ Verdicts:
25
+ ${Object.entries(LESSON_VERDICTS)
26
+ .map(([k, d]) => ` ${k.replace("_", "-").padEnd(10)} ${d}`)
27
+ .join("\n")}
28
+
29
+ Inside a run the lesson attaches to it and the run's headline is the task;
30
+ \`cnotes operations end --useful ... --dead-end ...\` records the same thing as
31
+ the run closes. A note gets one verdict per run; saying it again replaces it.
32
+ When you know the right answer, fix the note too (\`cnotes versions create\`);
33
+ the correction here is the short form the next run reads first.
34
+
35
+ Examples:
36
+ $ cnotes lessons record --useful INSIGHT-12 DECISION-4 --dead-end PLAN-9
37
+ $ cnotes lessons record --corrected FACT-3 --correction "The Amplitude key is already set in prod" --task "set the Amplitude key"
38
+ `)
39
+ .action(async (opts) => {
40
+ const cfg = resolveConfig(program.opts());
41
+ const api = new ApiClient(cfg.serverUrl, cfg.token, cfg.workspaceId);
42
+ try {
43
+ const list = lessonsFromFlags(opts);
44
+ const result = await postLessons(api, cfg.workspaceId, list, { task: opts.task });
45
+ if (cfg.json) {
46
+ outputJson(result, cfg.fields);
47
+ return;
48
+ }
49
+ console.log(renderRecorded(result));
50
+ }
51
+ catch (error) {
52
+ handleError(error, cfg.json);
53
+ }
54
+ });
55
+ lessons
56
+ .command("list")
57
+ .description("What earlier runs made of notes: the workspace's preferred sources, the lessons on the ids you name, and the newest verdicts")
58
+ .argument("[ids...]", "Note display ids to look up (e.g. INSIGHT-12 DECISION-4)")
59
+ .option("--recent <n>", "How many of the newest lessons to show (default 10, max 20)", "10")
60
+ .addHelpText("after", `
61
+ Preferred sources are notes at least two runs marked useful with nothing
62
+ against them, newest marks weighing most. Open one with \`cnotes notes get <id>\`.
63
+
64
+ Examples:
65
+ $ cnotes lessons list
66
+ $ cnotes lessons list INSIGHT-12 DECISION-4 --json
67
+ `)
68
+ .action(async (ids, opts) => {
69
+ const cfg = resolveConfig(program.opts());
70
+ const api = new ApiClient(cfg.serverUrl, cfg.token, cfg.workspaceId);
71
+ try {
72
+ const recent = Math.max(0, Number.parseInt(String(opts.recent), 10) || 0);
73
+ const result = await fetchLessons(api, cfg.workspaceId, ids, { recent });
74
+ if (cfg.json) {
75
+ outputJson(result, cfg.fields);
76
+ return;
77
+ }
78
+ const now = Date.now();
79
+ const lines = [];
80
+ if (result.preferred.length > 0) {
81
+ lines.push("Preferred sources (useful in 2+ runs, nothing against):");
82
+ for (const n of result.preferred) {
83
+ lines.push(` ${n.displayId} [${n.type}] ${n.title} (${describeLesson(n, now)})`);
84
+ }
85
+ }
86
+ if (result.notes.length > 0) {
87
+ lines.push(lines.length ? "" : "", "Lessons on these notes:");
88
+ for (const n of result.notes) {
89
+ lines.push(` ${n.displayId} [${n.type}] ${n.title}`);
90
+ lines.push(` ${describeLesson(n, now)}`);
91
+ }
92
+ }
93
+ else if (ids.length > 0) {
94
+ lines.push(lines.length ? "" : "", `No lessons yet on ${ids.map((id) => id.toUpperCase()).join(", ")}.`);
95
+ }
96
+ if (result.recent.length > 0) {
97
+ lines.push(lines.length ? "" : "", "Newest:");
98
+ for (const r of result.recent) {
99
+ const about = r.task ? ` for "${r.task}"` : "";
100
+ const fix = r.correction ? ` -> ${r.correction}` : "";
101
+ lines.push(` ${describeAgo(r.at, now).padEnd(8)} ${verdictLabel(r.verdict).padEnd(9)} ${r.displayId} ${r.title}${about}${fix}`);
102
+ }
103
+ }
104
+ if (lines.length === 0) {
105
+ lines.push("No lessons recorded in this workspace yet. Record one with `cnotes lessons record --useful <id>`.");
106
+ }
107
+ console.log(lines.filter((l, i, all) => !(l === "" && (i === 0 || all[i - 1] === ""))).join("\n"));
108
+ }
109
+ catch (error) {
110
+ handleError(error, cfg.json);
111
+ }
112
+ });
113
+ }
@@ -9,6 +9,7 @@ import { loadConfig, setActiveAgentRunId, registerAgentRun, unregisterAgentRun,
9
9
  import { resolveHostAgentSession } from "../lib/claude-session.js";
10
10
  import { allWorkspaceRubrics, loadRubricMap } from "../lib/rubrics.js";
11
11
  import { briefIsEmpty, loadSessionBrief, renderBrief } from "../lib/session-brief.js";
12
+ import { hasLessonFlags, lessonsFromFlags, postLessons, renderRecorded } from "../lib/lessons.js";
12
13
  import { renderProposalsForCaller } from "../lib/waiting-proposals.js";
13
14
  /**
14
15
  * `cnotes operations` — workspace-scoped lifecycle for agentic batches.
@@ -223,10 +224,15 @@ start fresh, or --detached to open your own run alongside it.
223
224
  .option("--agent-run-id <uuid>", "The run to end (defaults to CNOTES_AGENT_RUN_ID, then the active run on this server)")
224
225
  .option("--force", "End the run even though this CLI did not open it (another machine or login)")
225
226
  .option("--unsure <text>", "Where your confidence ran out in this run, in a sentence: the call you made and the alternative. A proposal's review lists these runs first")
227
+ .option("--useful <ids...>", "Notes you read that answered this run's task; recorded as lessons on the run before it closes")
228
+ .option("--dead-end <ids...>", "Notes you read that led nowhere for this task")
229
+ .option("--corrected <ids...>", "Notes that were wrong; say what was right with --correction")
230
+ .option("--correction <text>", "What was right, in a sentence (goes with --corrected)")
226
231
  .addHelpText("after", `
227
232
  Examples:
228
233
  $ cnotes operations end # ends the active run on this server
229
234
  $ cnotes operations end --unsure "Kept the cap in Open; it could be its own Decision"
235
+ $ cnotes operations end --useful INSIGHT-12 DECISION-4 --dead-end PLAN-9 # what the notes you read were worth
230
236
  $ cnotes operations end --agent-run-id <uuid> --json
231
237
  $ CNOTES_AGENT_RUN_ID=<uuid> cnotes operations end # ends that run, leaves the active run alone
232
238
 
@@ -242,6 +248,12 @@ run that made the call. The person deciding the draft sees those runs as the
242
248
  ones to look at, and the milestone records them. Name the call and the
243
249
  alternative; leave it off when you were sure.
244
250
 
251
+ Say what the notes you read were worth: --useful for the ones that answered
252
+ the task, --dead-end for the ones that led nowhere, --corrected (with
253
+ --correction "<what was right>") for one that was wrong. They land as lessons
254
+ on this run, with its headline as their task, and the next run's brief starts
255
+ from them. Outside a run, \`cnotes lessons record\` takes the same flags.
256
+
245
257
  End only closes runs this CLI opened — a run id it has no record of
246
258
  (opened on another machine, or under another login) is refused with exit
247
259
  code 5. Pass --force to end such a run anyway.
@@ -274,6 +286,19 @@ code 5. Pass --force to end such a run anyway.
274
286
  if (owned === false && !opts.force && isStillOpen(await fetchRunStatus(api, agentRunId))) {
275
287
  throw new CliError(`This CLI has no record of opening run ${agentRunId} on ${cfg.serverUrl}; it was not started here.`, EXIT_CODES.CONFLICT, "Ending it could close another agent's run. If you are sure, pass --force.");
276
288
  }
289
+ // Lessons go first, while the run is still open on the server, so they
290
+ // attach to it and take its headline as their task. The run id travels
291
+ // in the body: the header carries only the active run, and a detached
292
+ // run named with --agent-run-id is not that.
293
+ const lessonFlags = {
294
+ useful: opts.useful,
295
+ deadEnd: opts.deadEnd,
296
+ corrected: opts.corrected,
297
+ correction: opts.correction,
298
+ };
299
+ const lessons = hasLessonFlags(lessonFlags)
300
+ ? await postLessons(api, cfg.workspaceId, lessonsFromFlags(lessonFlags), { agentRunId })
301
+ : null;
277
302
  const result = await api.post("/api/operations", {
278
303
  action: "end",
279
304
  agentRunId,
@@ -294,11 +319,13 @@ code 5. Pass --force to end such a run anyway.
294
319
  return;
295
320
  }
296
321
  if (cfg.json) {
297
- outputJson(result);
322
+ outputJson({ ...result, ...(lessons ? { lessons } : {}) });
298
323
  return;
299
324
  }
300
325
  if (result.idempotent) {
301
326
  console.log(`Operation ${result.agentRunId} already ended (status: ${result.status}).`);
327
+ if (lessons)
328
+ console.log(renderRecorded(lessons));
302
329
  return;
303
330
  }
304
331
  console.log(`Ended operation ${result.agentRunId}`);
@@ -309,6 +336,8 @@ code 5. Pass --force to end such a run anyway.
309
336
  if (result.canvasCheckpointsScheduled !== undefined) {
310
337
  console.log(` canvas after-checkpoints scheduled: ${result.canvasCheckpointsScheduled}`);
311
338
  }
339
+ if (lessons)
340
+ console.log(renderRecorded(lessons));
312
341
  }
313
342
  catch (error) {
314
343
  handleError(error, cfg.json);
@@ -0,0 +1,123 @@
1
+ import { ValidationError } from "./errors.js";
2
+ export const LESSON_VERDICTS = {
3
+ useful: "The note answered the task",
4
+ dead_end: "The note led nowhere for this task",
5
+ corrected: "The note was wrong; the correction says what was right",
6
+ };
7
+ export function hasLessonFlags(flags) {
8
+ return Boolean(flags.useful?.length || flags.deadEnd?.length || flags.corrected?.length || flags.correction);
9
+ }
10
+ /** Ids come space- or comma-separated; a display id compares upper-case. */
11
+ function splitIds(values) {
12
+ const out = [];
13
+ for (const value of values ?? []) {
14
+ for (const part of value.split(",")) {
15
+ const id = part.trim().toUpperCase();
16
+ if (id && !out.includes(id))
17
+ out.push(id);
18
+ }
19
+ }
20
+ return out;
21
+ }
22
+ /**
23
+ * The verdict flags as one list of lessons, or a ValidationError that names
24
+ * the mistake. A correction goes with --corrected and nothing else.
25
+ */
26
+ export function lessonsFromFlags(flags) {
27
+ const useful = splitIds(flags.useful);
28
+ const deadEnd = splitIds(flags.deadEnd);
29
+ const corrected = splitIds(flags.corrected);
30
+ const correction = flags.correction?.trim() || undefined;
31
+ if (correction && corrected.length === 0) {
32
+ throw new ValidationError("--correction goes with --corrected <id>: say which note was wrong.", 'cnotes lessons record --corrected FACT-3 --correction "The key is already set in prod."');
33
+ }
34
+ const lessons = [
35
+ ...useful.map((displayId) => ({ displayId, verdict: "useful" })),
36
+ ...deadEnd.map((displayId) => ({ displayId, verdict: "dead_end" })),
37
+ ...corrected.map((displayId) => ({ displayId, verdict: "corrected", ...(correction ? { correction } : {}) })),
38
+ ];
39
+ if (lessons.length === 0) {
40
+ throw new ValidationError("Name at least one note: --useful <ids...>, --dead-end <ids...> or --corrected <ids...>.", "cnotes lessons record --useful INSIGHT-12 DECISION-4 --dead-end PLAN-9");
41
+ }
42
+ const twice = lessons.map((l) => l.displayId).filter((id, i, all) => all.indexOf(id) !== i);
43
+ if (twice.length > 0) {
44
+ throw new ValidationError(`${[...new Set(twice)].join(", ")} given two verdicts; a note gets one.`, "A note is useful, a dead end or corrected for this task, not two of them.");
45
+ }
46
+ return lessons;
47
+ }
48
+ export async function postLessons(api, workspaceId, lessons, opts = {}) {
49
+ return await api.post("/api/lessons", {
50
+ workspaceId,
51
+ lessons,
52
+ ...(opts.task?.trim() ? { task: opts.task.trim() } : {}),
53
+ ...(opts.agentRunId ? { agentRunId: opts.agentRunId } : {}),
54
+ });
55
+ }
56
+ export async function fetchLessons(api, workspaceId, displayIds, opts = {}) {
57
+ const params = { workspaceId };
58
+ if (displayIds.length > 0)
59
+ params.ids = displayIds.join(",");
60
+ if (opts.recent !== undefined)
61
+ params.recent = String(opts.recent);
62
+ return await api.get("/api/lessons", params);
63
+ }
64
+ export function describeAgo(at, now) {
65
+ const days = Math.max(0, Math.round((now - at) / 86_400_000));
66
+ return days === 0 ? "today" : `${days}d ago`;
67
+ }
68
+ const quote = (s, n = 60) => `"${s.length > n ? s.slice(0, n - 3) + "..." : s}"`;
69
+ /**
70
+ * One line on what earlier runs made of a note, for the brief and the list.
71
+ * Says the verdicts and, for a dead end or a correction, what they were about.
72
+ */
73
+ export function describeLesson(tally, now) {
74
+ const runs = (n) => `${n} run${n === 1 ? "" : "s"}`;
75
+ switch (tally.status) {
76
+ case "preferred":
77
+ return `useful in ${runs(tally.useful)}`;
78
+ case "useful":
79
+ return "useful in 1 run";
80
+ case "dead_end": {
81
+ const last = tally.lastDeadEnd;
82
+ const what = last?.task ? ` for ${quote(last.task)}` : "";
83
+ const when = last ? ` (${describeAgo(last.at, now)})` : "";
84
+ return `dead end${tally.deadEnd > 1 ? ` in ${runs(tally.deadEnd)}` : ""}${what}${when}`;
85
+ }
86
+ case "corrected": {
87
+ const c = tally.lastCorrection;
88
+ return c
89
+ ? `corrected ${describeAgo(c.at, now)}: ${c.text}`
90
+ : `corrected${tally.corrected > 1 ? ` in ${runs(tally.corrected)}` : ""}`;
91
+ }
92
+ case "contested": {
93
+ const parts = [`useful x${tally.useful}`];
94
+ if (tally.deadEnd)
95
+ parts.push(`dead end x${tally.deadEnd}`);
96
+ if (tally.corrected)
97
+ parts.push(`corrected x${tally.corrected}`);
98
+ const lean = tally.score > 0 ? "leans useful" : tally.score < 0 ? "leans against" : "even";
99
+ const c = tally.lastCorrection ? `; last correction: ${tally.lastCorrection.text}` : "";
100
+ return `contested: ${parts.join(", ")}, ${lean}${c}`;
101
+ }
102
+ default:
103
+ return "";
104
+ }
105
+ }
106
+ /** The verdict word as the flags spell it. */
107
+ export function verdictLabel(verdict) {
108
+ return verdict === "dead_end" ? "dead end" : verdict;
109
+ }
110
+ /** Text for `lessons record` and `operations end`: what landed, on which run. */
111
+ export function renderRecorded(result) {
112
+ const groups = new Map();
113
+ for (const l of result.lessons) {
114
+ const ids = groups.get(l.verdict) ?? [];
115
+ ids.push(l.displayId);
116
+ groups.set(l.verdict, ids);
117
+ }
118
+ const parts = [...groups.entries()].map(([verdict, ids]) => `${verdictLabel(verdict)} ${ids.join(", ")}`);
119
+ const count = result.recorded + result.updated;
120
+ const where = result.agentRunId ? ` on run ${result.agentRunId}` : "";
121
+ const about = result.task ? ` for ${quote(result.task, 80)}` : "";
122
+ return `Recorded ${count} lesson${count === 1 ? "" : "s"}${where}${about}: ${parts.join("; ")}.`;
123
+ }
@@ -1,3 +1,4 @@
1
+ import { describeLesson, fetchLessons } from "./lessons.js";
1
2
  export const BRIEF_LIMIT = 8;
2
3
  export const BRIEF_CANVAS_LIMIT = 3;
3
4
  export const BRIEF_CHANGE_LIMIT = 5;
@@ -89,24 +90,56 @@ export async function loadSessionBrief(api, workspaceId, prompt) {
89
90
  ]);
90
91
  if (search === null && timeline === null)
91
92
  return null;
93
+ const found = briefFromSearch(query, search);
94
+ // After the search, since the lessons are looked up on the notes it found.
95
+ const lessons = await fetchLessons(api, workspaceId, found.notes.map((n) => n.displayId))
96
+ .then(lessonsFromResponse)
97
+ .catch(() => null);
92
98
  return {
93
- ...briefFromSearch(query, search),
99
+ ...found,
94
100
  changes: changesFromTimeline(timeline),
101
+ ...(lessons ? { lessons } : {}),
95
102
  };
96
103
  }
104
+ /** Pull the lessons overlay out of a `/api/lessons` response. */
105
+ export function lessonsFromResponse(data) {
106
+ const d = data;
107
+ const list = (x) => Array.isArray(x) ? x.filter((s) => s && typeof s.displayId === "string") : [];
108
+ const notes = {};
109
+ for (const s of list(d?.notes))
110
+ notes[s.displayId] = s;
111
+ return { notes, preferred: list(d?.preferred) };
112
+ }
97
113
  export function briefIsEmpty(brief) {
98
- return brief.notes.length === 0 && brief.canvases.length === 0 && brief.changes.length === 0;
114
+ return (brief.notes.length === 0 &&
115
+ brief.canvases.length === 0 &&
116
+ brief.changes.length === 0 &&
117
+ (brief.lessons?.preferred.length ?? 0) === 0);
99
118
  }
100
119
  /** Text form, shared by `operations begin` and `cnotes brief`. */
101
120
  export function renderBrief(brief, now = Date.now()) {
102
121
  const clip = (s, n) => (s.length > n ? s.slice(0, n - 3) + "..." : s);
103
122
  const lines = [];
123
+ // Preferred sources the search did not surface come first: the notes earlier
124
+ // runs kept finding useful are where a run should start, found or not.
125
+ const inNotes = new Set(brief.notes.map((n) => n.displayId));
126
+ const startHere = (brief.lessons?.preferred ?? []).filter((p) => !inNotes.has(p.displayId));
127
+ if (startHere.length > 0) {
128
+ lines.push("Start here (useful in earlier runs):");
129
+ for (const p of startHere) {
130
+ lines.push(` ${p.displayId} [${p.type}] ${clip(p.title, 90)} (${describeLesson(p, now)})`);
131
+ }
132
+ }
104
133
  if (brief.notes.length > 0) {
105
134
  lines.push("Notes:");
106
135
  for (const n of brief.notes) {
107
136
  lines.push(` ${n.displayId} [${n.type}] ${n.title}`);
108
137
  if (n.snippet)
109
138
  lines.push(` ${clip(n.snippet, 140)}`);
139
+ const lesson = brief.lessons?.notes[n.displayId];
140
+ const said = lesson ? describeLesson(lesson, now) : "";
141
+ if (said)
142
+ lines.push(` lesson: ${said}`);
110
143
  }
111
144
  }
112
145
  if (brief.canvases.length > 0) {
package/dist/program.js CHANGED
@@ -31,6 +31,7 @@ import { registerOperationsCommands } from "./commands/operations.js";
31
31
  import { registerFeedbackCommands } from "./commands/feedback.js";
32
32
  import { registerQualityCommands } from "./commands/quality.js";
33
33
  import { registerBriefCommand } from "./commands/brief.js";
34
+ import { registerLessonsCommands } from "./commands/lessons.js";
34
35
  import { registerSkillsCommands } from "./commands/skills.js";
35
36
  import { registerClaudeHookCommand } from "./commands/claude-hook.js";
36
37
  import { loadConfig, getServerConfig } from "./lib/auth-store.js";
@@ -144,6 +145,7 @@ Env vars:
144
145
  registerOperationsCommands(program);
145
146
  registerQualityCommands(program);
146
147
  registerBriefCommand(program);
148
+ registerLessonsCommands(program);
147
149
  registerFeedbackCommands(program);
148
150
  registerSkillsCommands(program);
149
151
  registerClaudeHookCommand(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@creator-notes/cnotes",
3
- "version": "0.124.2",
3
+ "version": "0.125.1",
4
4
  "description": "CLI for CreatorNotes — create notes, build canvases, search knowledge from the terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -71,7 +71,7 @@ then project it.
71
71
  { "placement": "exact", "origin": { "x": 100, "y": 100 },
72
72
  "root": { "kind": "stack", "axis": "vertical", "gap": "spacious", "items": [
73
73
  { "kind": "item", "type": "richtext", "size": "large", "content": "# <card title, under 50 characters>" },
74
- { "kind": "item", "type": "richtext", "size": "medium", "content": "<what happened>\n<what this board decides>\n<who answers, on the card>\n<Day HH:MM> · Read left to right; portals below." },
74
+ { "kind": "item", "type": "richtext", "size": "medium", "content": "<what happened>\n\n<what this board decides>\n\n<who answers, on the card>\n\n<Day HH:MM> · Read left to right; portals below." },
75
75
  { "kind": "stack", "axis": "horizontal", "gap": "spacious", "align": "start", "items": [
76
76
  { "kind": "section", "name": "1 · Came from", "child": { "kind": "stack", "axis": "vertical", "gap": "medium", "items": [
77
77
  { "kind": "item", "type": "note", "noteId": "<DIGEST>", "key": "src" },
@@ -17,7 +17,7 @@ Every note and canvas you write is context: what the next reader, a teammate or
17
17
 
18
18
  Each call costs the user a model round trip, so batch, and send independent calls together. Reads need no run.
19
19
 
20
- 1. **Read, in parallel.** `cnotes workspace current` names the workspace and its relationship types (`-w <id>` targets another for one command). `cnotes brief "<task>"` returns the notes, canvases and recent changes most relevant to the task; `cnotes search "<topic>"` finds notes, canvases and images in one call. `cnotes notes get <id> --expand` loads a note with the notes it rests on. Before changing a canvas, `cnotes canvas read <canvasId>` (or `read-section SECTION-n` when the request names a frame). `cnotes types show <Type>` for each type you will write: author to its rubric. A Decision or Guide you find may already settle what you were about to propose.
20
+ 1. **Read, in parallel.** `cnotes workspace current` names the workspace and its relationship types (`-w <id>` targets another for one command). `cnotes brief "<task>"` returns the notes, canvases and recent changes most relevant to the task, with what earlier runs made of each (`lesson:` under a note; `Start here` lists the notes runs keep finding useful): read a correction before relying on the note it sits on. `cnotes search "<topic>"` finds notes, canvases and images in one call. `cnotes notes get <id> --expand` loads a note with the notes it rests on. Before changing a canvas, `cnotes canvas read <canvasId>` (or `read-section SECTION-n` when the request names a frame). `cnotes types show <Type>` for each type you will write: author to its rubric. A Decision or Guide you find may already settle what you were about to propose.
21
21
  2. **Write once, with `--intent`.** `--intent "<headline>"` opens an agent run for that one command and closes it after, so the change lands on the timeline as one revertable run; a removal gets a before snapshot. When a run is already open, the write joins it. To add cards, create and place them together:
22
22
  ```json
23
23
  {"notes":[{"key":"A","type":"Insight","markdown":"# Reviews wait on one person\nFour features shipped a week late in October."},
@@ -32,13 +32,13 @@ Each call costs the user a model round trip, so batch, and send independent call
32
32
  The `notes` array is the `notes create` shape; a note leaf places one with `"noteId":"@<key>"`, a `quote` leaf gives it a face (its claim sentence, drawn as a quote inside the same frame), and edges say `@<key>` too. `--into SECTION-n` appends to an existing frame. Each note comes back under `notes`, graded where the workspace grades: revise only notes below 4.
33
33
  `cnotes canvas place <canvasId> --spec spec.json --intent "Added the reviewer bottleneck to the Q1 roadmap"`
34
34
  Every write takes the flag: `cnotes canvas arrange <canvasId> --section SECTION-7 --intent "Tidied the Risks section"`, `cnotes versions create DECISION-12 --markdown-file new.md --description "<what changed>" --intent "<headline>"`.
35
- 3. **Link the result.** End the reply with the canvas link from the `Link:` line ([Surfacing the canvas link](#surfacing-the-canvas-link)).
35
+ 3. **Say what the notes were worth, then link the result.** `cnotes lessons record --useful <ids> --dead-end <ids>` names the notes from the brief that settled the task and the ones that led nowhere; the next run's brief starts from them. End the reply with the canvas link from the `Link:` line ([Surfacing the canvas link](#surfacing-the-canvas-link)).
36
36
 
37
37
  ### A new canvas is one write too
38
38
 
39
39
  `cnotes canvas create "Q1 · Roadmap" --goal "<goal>" --audience "<who>" --spec spec.json --intent "Built the Q1 roadmap canvas"`
40
40
 
41
- The spec is the same document, `notes` included; the placement comes back under `layout`. Its root is a vertical stack that opens with the hero (`{"kind":"item","type":"richtext","size":"large","content":"# <the goal's result>"}`, under 50 characters, the only text legible at zoom-to-fit), then the `medium` four-line banner, then the board. Pick the shape first (canvas-elements.md, Board shapes): an Argument's spine is notes with quote faces joined by connectives and arrows, tiles on the shelf. The name follows the title rule (rule 2 below, `·` between its parts), the goal ends with a "Done when" sentence, and the server refuses either otherwise. The spec is checked before the canvas exists, and a refused layout removes the canvas again, so a bad file creates nothing: fix the spec and run the same command again. Read [references/canvas-elements.md](references/canvas-elements.md) (rules 4, 5, 7 and 9) before choosing elements and [references/canvas-layout.md](references/canvas-layout.md) before writing a spec with anchors, origins or several sections.
41
+ The spec is the same document, `notes` included; the placement comes back under `layout`. Its root is a vertical stack that opens with the hero (`{"kind":"item","type":"richtext","size":"large","content":"# <the goal's result>"}`, under 50 characters, the only text legible at zoom-to-fit), then the `medium` banner (four lines with a blank line between each, so each is its own paragraph), then the board. Pick the shape first (canvas-elements.md, Board shapes): an Argument's spine is notes with quote faces joined by connectives and arrows, tiles on the shelf. The name follows the title rule (rule 2 below, `·` between its parts), the goal ends with a "Done when" sentence, and the server refuses either otherwise. The spec is checked before the canvas exists, and a refused layout removes the canvas again, so a bad file creates nothing: fix the spec and run the same command again. Read [references/canvas-elements.md](references/canvas-elements.md) (rules 4, 5, 7 and 9) before choosing elements and [references/canvas-layout.md](references/canvas-layout.md) before writing a spec with anchors, origins or several sections.
42
42
 
43
43
  ## Longer work: one run
44
44
 
@@ -48,13 +48,13 @@ When the writes belong together but cannot be one command (several notes and new
48
48
  2. Write. Audience-facing prose (note bodies, banners, pre-reads) goes through [references/humanizer.md](references/humanizer.md) first; transcripts, quotes and other raw capture are stored verbatim.
49
49
  3. **Grade what you wrote.** `cnotes quality <displayIds...> --fail-below 4` hands back each note's rubric and body. Grade them all at once with `cnotes quality record --grades-file grades.json` (one `{displayId, level, criteria, nextStep?, gradedVersion?}` per note, one reason per rubric criterion), then revise only a note below 4 with `cnotes versions create`. A level 3 with `unsure: true` and nothing under `missing`, or a `needs_agent` answer, means the server grader abstained: read the note yourself.
50
50
  4. **Read it back.** `cnotes canvas read <canvasId>`: every claim appears in a note with a display ID, the spine reads at fit zoom as faces and connectives, the hero names the goal's result, and the banner makes sense to someone who was not in the session and never says who asked for the board. A write that touches no canvas gets the same test with `cnotes notes get <id> --expand`, read as the next session will.
51
- 5. `cnotes operations end`, then link the result.
51
+ 5. **Close with what the notes were worth.** `cnotes operations end --useful <ids> --dead-end <ids>` names the notes that answered the task and the ones that led nowhere; `--corrected <id> --correction "<what was right>"` marks one that was wrong (fix it with `versions create` too, when you can). The next run's brief starts from these. Then link the result.
52
52
 
53
53
  ## Rules that hold on every task
54
54
 
55
55
  1. **The exit code is the verdict.** `0` is success. Never decide success from the body. Never re-run a create because a key looked empty: inside the same run the same batch returns the notes it already made (`alreadyExists: true`), but after a reset or 5xx (`mayHaveCommitted: true`) re-run only with the printed `--idempotency-key`, and from another run a plain re-run duplicates it.
56
56
  2. **Titles are headlines.** Each note body starts with a `# h1`: at most 80 characters, naming the claim or the object, with no ", so…" / ", because…" clause, no display id and no em dash; the body's first sentence carries the why. A canvas name is the same, with `·` between its parts ("Path to Revenue · Funding strategy"), never a dash. The server refuses a note, version or canvas that breaks this and says what to change.
57
- 3. **Knowledge lives in typed notes.** Text cards, lists, section frames, edges and portals arrange and label; they are unversioned, unsearchable and uncitable. If a future reader needs to find, cite or trust it, it is a note. A text card holds at most three sentences (the banner: four short lines): furniture (hero, banner, heading, legend), a connective (the board's own sentence on what one card means for the next, true only here, arrows in and out) or a sticky to be promoted. A note on the spine wears a quote face; tiles are for the shelf.
57
+ 3. **Knowledge lives in typed notes.** Text cards, lists, section frames, edges and portals arrange and label; they are unversioned, unsearchable and uncitable. If a future reader needs to find, cite or trust it, it is a note. A text card holds at most three sentences (the banner: four short lines, each its own paragraph): furniture (hero, banner, heading, legend), a connective (the board's own sentence on what one card means for the next, true only here, arrows in and out) or a sticky to be promoted. A note on the spine wears a quote face; tiles are for the shelf.
58
58
  4. **Link notes with typed mentions, and show only what the sentence needs.** Three forms, one link: `[NOTE-12: Title](relationship:<verb>)` shows the title, `[[<verb>::NOTE-12]]` the id alone, `[[<verb>::NOTE-12|your words]]` your words. The verb is the one the sentence uses (`blocks`, `depends-on`, `answered-by`); `references` is for pure citation only. Show a title once, where the reader first meets the note; after that the id alone keeps the sentence moving. Two titled mentions in one sentence, or a run of them in a list, is a readability defect; a bare `NOTE-12` in prose creates no link and is a defect too, in bodies and on cards. Reuse the workspace's relationship types (`cnotes schema` ranks them by use; `cnotes rel types` lists all) before coining one.
59
59
  5. **Edges are local to one canvas.** When an edge connects two notes, write the same relationship as a mention in a note body, or it exists nowhere off that canvas.
60
60
  6. **Place declaratively, edit in place.** `canvas place` / `canvas arrange`, never hand-computed x/y. Add to a section with `place --into SECTION-n`; tidy one with `arrange --section SECTION-n`. Change a text card with `canvas update-text` and a frame with `canvas update-section`: deleting and re-adding mints new ids and drops edges and `[[SECTION-n]]` mentions.
@@ -83,12 +83,12 @@ A board is made of three kinds of words, and a board that holds only the first k
83
83
  - One hero per canvas. A section or band heading is never `large` (rule 9).
84
84
 
85
85
  **The banner** sits directly under the hero: one `medium` untinted text card, no heading (the hero is its heading).
86
- It describes the work, never the session that built the board. Write one line each, in this order, no paragraphs:
86
+ It describes the work, never the session that built the board. Write one line each, in this order, and give each line its own paragraph: a blank line between them, `\n\n` inside a spec string. A single `\n` keeps all four in one paragraph and the card paints them with no space between, a wall of nine wrapped lines (CANVAS-499, 8 Nov 2026, re-set by hand):
87
87
  1. **The situation.** What is true in the work that makes this board necessary, with the people and things named so a stranger can look them up: "Ten Clio workstreams are in play: five moved between 26 Oct and 2 Nov, five have no status newer than September." Date it only when it is an event the reader could look up (a meeting, a decision, a release): "On 2 Nov 2026 Settlement Financials adoption became the week's priority."
88
88
  2. **What it's for.** The decision or artifact the board produces, in the reader's words.
89
89
  3. **What is open, and where the answer goes.** Who decides or builds, and the card the outcome lands on (a mention chip, rule 2). Name a person only when the reader could not be sure it is them; a board one person works alone never tells them their own job.
90
90
  4. **How to read it.** The cue only: "Read left to right." Don't list each frame's contents; the frames say that.
91
- Keep each line under ~20 words. Break long lines; never merge them into a paragraph.
91
+ Keep each line under ~20 words. Break a long line into two short sentences inside its own paragraph; never run two lines together in one paragraph.
92
92
  Name things before you point at them: no "the ad", "the app", "the scope".
93
93
  Never narrate the request. "On 30 Oct 2026 Deniss asked to keep track of moving parts" says what the agent was told and nothing about the work, and the timeline already records who asked, when, and what was done under the run's headline. Cut "asked", "requested", "wanted", "this session" and any paraphrase of the prompt, then check the line still says something.
94
94
  Cut: frame counts ("in five moments"), method notes ("fat-marker sketches", "coral marks…"), and recaps of what the strip below says.
@@ -73,7 +73,7 @@ A `quote` leaf is a note's face (canvas-elements.md rules 4 and 8): `text` is th
73
73
 
74
74
  Leaf enums (exact values): richtext `size` = `small` | `medium` | `large`, `colorHex` = a saturated hex (omit for no background); list `viewMode` = `list` | `grid`, list `size` = `sm` | `md` | `lg` | `xl`.
75
75
 
76
- A richtext `size` is not a hint, it IS the width the card paints: `small` 560px, `medium` 1120px, `large` 1680px, with the height following the content. It sets the type too (headings 30, 56 and 128px; body 14, 24 and 48px), which is why the hero is `large` and an annotation `small` ([canvas-elements.md](canvas-elements.md) rules 7 and 9). A large hero under 50 characters is about 600px tall; a four-line `medium` banner without a heading about 375px. `place` measures that box for you, which is the whole reason to prefer it over hand-picked coordinates: pitch a row of columns for `small` and then send `medium` items and every card runs 460px into its neighbour.
76
+ A richtext `size` is not a hint, it IS the width the card paints: `small` 560px, `medium` 1120px, `large` 1680px, with the height following the content. It sets the type too (headings 30, 56 and 128px; body 14, 24 and 48px), which is why the hero is `large` and an annotation `small` ([canvas-elements.md](canvas-elements.md) rules 7 and 9). A large hero under 50 characters is about 600px tall; a four-line `medium` banner without a heading, each line its own paragraph, about 460px (the same four lines run into one paragraph measure about 375px, and read as a wall). `place` measures that box for you, which is the whole reason to prefer it over hand-picked coordinates: pitch a row of columns for `small` and then send `medium` items and every card runs 460px into its neighbour.
77
77
 
78
78
  ## Section container (frame WITH content: preferred)
79
79
 
@@ -192,7 +192,7 @@ Edges live at the top level alongside `root`. Each endpoint is resolved in this
192
192
  "items": [
193
193
  { "kind": "item", "type": "richtext", "size": "large", "content": "# Add a second reviewer" },
194
194
  { "kind": "item", "type": "richtext", "size": "medium",
195
- "content": "Every review waits on Ana; four features shipped a week late in October.\nThis board decides how reviews stop waiting on one person.\nAna picks; her answer lands on [QUESTION-12: Who else reviews?](relationship:answered-by).\nRead left to right." },
195
+ "content": "Every review waits on Ana; four features shipped a week late in October.\n\nThis board decides how reviews stop waiting on one person.\n\nAna picks; her answer lands on [QUESTION-12: Who else reviews?](relationship:answered-by).\n\nRead left to right." },
196
196
  { "kind": "stack", "axis": "horizontal", "gap": 140, "align": "start", "items": [
197
197
  { "kind": "stack", "axis": "vertical", "gap": 20, "items": [
198
198
  { "kind": "item", "type": "richtext", "content": "# 1 · What goes wrong" },
@@ -274,7 +274,7 @@ Edges live at the top level alongside `root`. Each endpoint is resolved in this
274
274
  { "kind": "item", "type": "richtext", "size": "large",
275
275
  "content": "# Four goals we will hit by March" },
276
276
  { "kind": "item", "type": "richtext", "size": "medium",
277
- "content": "On 3 Jan 2026 the team agreed four goals for Q1.\nThis board is what we commit to and who owns each goal.\nAna reviews progress weekly on each goal card.\nRead left to right." },
277
+ "content": "On 3 Jan 2026 the team agreed four goals for Q1.\n\nThis board is what we commit to and who owns each goal.\n\nAna reviews progress weekly on each goal card.\n\nRead left to right." },
278
278
  { "kind": "grid", "columns": 4,
279
279
  "items": [
280
280
  { "kind": "item", "type": "note", "noteId": "GOAL-1" },
@@ -62,8 +62,12 @@ cnotes quality INSIGHT-12 --fail-below 4 --json
62
62
  cnotes quality record INSIGHT-12 --graded-version 4 --level 3 --criteria '[{"criterion":"Evidence","reason":"Grounded in two tickets."}]' --feedback "The pattern is named." --next-step "Say what would falsify it."
63
63
  cnotes quality record --grades-file ./grades.json # every note of the run in one call (notes.md)
64
64
 
65
- # 4. Close the run when done.
66
- cnotes operations end
65
+ # 4. Close the run when done, saying what the notes you read were worth:
66
+ # --useful for the ones that answered the task, --dead-end for the ones that
67
+ # led nowhere, --corrected (with --correction "<what was right>") for one that
68
+ # was wrong. They land as lessons on this run; the next run's brief starts
69
+ # from them. Outside a run: `cnotes lessons record` with the same flags.
70
+ cnotes operations end --useful INSIGHT-12 DECISION-4 --dead-end GUIDE-88
67
71
  ```
68
72
 
69
73
  **Resume the chat that produced the run.** `operations begin` auto-stamps
@@ -30,7 +30,7 @@ commands.
30
30
  | Card | That note placed on the canvas at its timestamp. Shape in [references/card-format.md](references/card-format.md) |
31
31
  | Theme | A section frame spanning the full timeline width, one per theme, 3 to 6 per interview |
32
32
  | Canvas | `<Interviewee or company> · Interview timeline`, one per transcript |
33
- | Banner | Four short lines above row one. The last is a bare `Read left to right.` |
33
+ | Banner | Four short lines above row one, each its own paragraph. The last is a bare `Read left to right.` |
34
34
 
35
35
  ## Run
36
36
 
@@ -123,9 +123,10 @@ Only when asked ("resolve these", "who owns what"). Run it before step 9's
123
123
  mention. Never bare prose IDs.
124
124
  4. No caption or explainer slop. No "This card captures…", no "Key insight:",
125
125
  no recap text cards under rows. A row's frame name is its only label.
126
- 5. The banner is four short lines: the interview (who spoke, about what, on
127
- what date; never the request), what the board is for, who acts on it, then
128
- `Read left to right.` and nothing more.
126
+ 5. The banner is four short lines, each its own paragraph (a blank line between
127
+ them): the interview (who spoke, about what, on what date; never the request),
128
+ what the board is for, who acts on it, then `Read left to right.` and nothing
129
+ more.
129
130
  6. Run the humanizer from the cnotes skill on every title and the banner.
130
131
  7. End-user PII stays out. Name the interviewee by role and company unless
131
132
  the transcript note already names them in its title.
@@ -49,12 +49,17 @@ The hero: a large text element at `x = 0, y = 0`, no colour, one heading under
49
49
  ```
50
50
 
51
51
  The banner: a medium text element at `x = 0, y = HERO_H`. Four short lines, no
52
- colour, no heading (the hero is its heading), in the cnotes skill's banner order:
52
+ colour, no heading (the hero is its heading), in the cnotes skill's banner order,
53
+ each line its own paragraph (a blank line between them; a single newline runs
54
+ them into one unspaced block):
53
55
 
54
56
  ```
55
57
  <Interviewer> interviewed them on <date> for <N> minutes about <topic>.
58
+
56
59
  Rows are themes; each card quotes them at the moment they said it.
60
+
57
61
  <Who acts on it, and where the outcome lands>.
62
+
58
63
  Read left to right.
59
64
  ```
60
65