@creator-notes/cnotes 0.124.2 → 0.125.0

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.0",
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.0",
4
4
  "description": "CLI for CreatorNotes — create notes, build canvases, search knowledge from the terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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,7 +32,7 @@ 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
 
@@ -48,7 +48,7 @@ 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
 
@@ -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