@creator-notes/cnotes 0.135.0 → 0.136.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.
- package/.claude-plugin/plugin.json +1 -1
- package/dist/commands/brief.js +5 -2
- package/dist/commands/catchup.js +10 -7
- package/dist/lib/done-line.js +88 -0
- package/dist/lib/mcp-spec.js +2 -2
- package/dist/lib/session-brief.js +28 -6
- package/package.json +1 -1
- package/skills/cnotes/references/canvas.md +5 -1
- package/skills/cnotes/references/operations.md +4 -4
package/dist/commands/brief.js
CHANGED
|
@@ -21,8 +21,11 @@ export function registerBriefCommand(program) {
|
|
|
21
21
|
Read-only and free of credits. \`operations begin --prompt\` includes the same
|
|
22
22
|
brief, so you only need this when you are not opening a run. It opens with
|
|
23
23
|
the workspace's conventions, one title each (conventions.rules in --json): the
|
|
24
|
-
title is the rule, and \`cnotes notes get <id>\` has the why.
|
|
25
|
-
|
|
24
|
+
title is the rule, and \`cnotes notes get <id>\` has the why. A canvas whose
|
|
25
|
+
goal has been judged carries a "done:" line (canvases[].done in --json): met,
|
|
26
|
+
partly met or not met, and each part of its Done when that is not true yet. The
|
|
27
|
+
brief ends on one line, beforeWriting in --json: name the kind of request
|
|
28
|
+
before you write.
|
|
26
29
|
|
|
27
30
|
Examples:
|
|
28
31
|
$ cnotes brief "set the Amplitude API key in production"
|
package/dist/commands/catchup.js
CHANGED
|
@@ -29,8 +29,8 @@ export function catchupNoteIds(pack) {
|
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* `cnotes catchup --since 7d`: what changed in the workspace over a window,
|
|
32
|
-
* as evidence for the agent's own model to narrate.
|
|
33
|
-
*
|
|
32
|
+
* as evidence for the agent's own model to narrate. Nothing is summarised at
|
|
33
|
+
* read time: every line was recorded when the change was made.
|
|
34
34
|
*/
|
|
35
35
|
export function registerCatchupCommand(program) {
|
|
36
36
|
program
|
|
@@ -46,7 +46,7 @@ export function registerCatchupCommand(program) {
|
|
|
46
46
|
.option("--type <types>", "Only these note types (comma-separated), plus notes that gained a link to one")
|
|
47
47
|
.option("--canvas <id>", "Only one canvas: its id or display id (CANVAS-12)")
|
|
48
48
|
.option("--topic <words>", "Only changes about a topic, matched by meaning over the change log")
|
|
49
|
-
.option("--text", "Print the pack as text even when piped: the same evidence
|
|
49
|
+
.option("--text", "Print the pack as text even when piped: the same evidence at about half the size of the JSON")
|
|
50
50
|
.addHelpText("after", `
|
|
51
51
|
Read-only and free of credits. The window is always yours to name: there is no
|
|
52
52
|
"since I last looked". Scopes combine, so "what has Ana done on pricing since
|
|
@@ -54,13 +54,16 @@ Tuesday" is --person, --topic and --since on one call.
|
|
|
54
54
|
|
|
55
55
|
The pack is evidence, not a summary. Tell the person what moved as a few
|
|
56
56
|
threads of work, say which closed and which are still open, and name each note
|
|
57
|
-
by its id. Every line was
|
|
57
|
+
by its id. Every line was recorded when the change was made, so add no cause
|
|
58
58
|
the lines do not state. "Did any questions get answered?" is
|
|
59
59
|
--type Question: a note that gained a link to a Question is in the pack.
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
A pack lists about 80 notes in full, then names older threads by headline
|
|
62
|
+
only. coverage.detailedBackTo is where the detail stops and
|
|
63
|
+
coverage.coveredBackTo where the pack stops: run the command again with
|
|
64
|
+
--until set to either for what came before. Two members of one name are told
|
|
65
|
+
apart by email, which --person also takes.
|
|
66
|
+
-q prints the display id of every note the pack lists.
|
|
64
67
|
|
|
65
68
|
Examples:
|
|
66
69
|
$ cnotes catchup --since 7d
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A board's done verdict as one sentence, for the places an agent already
|
|
3
|
+
* reads before it acts: the head of `cnotes canvas read` and each canvas a
|
|
4
|
+
* brief names (`cnotes brief`, `cnotes operations begin`).
|
|
5
|
+
*
|
|
6
|
+
* The verdict was stored and judged for weeks while only `cnotes canvas done`
|
|
7
|
+
* printed it, a command nothing told an agent to run. So an agent adding to a
|
|
8
|
+
* board read its goal and never learned which part of the Done when was still
|
|
9
|
+
* missing. The sentence leads with the level and then names what is not yet
|
|
10
|
+
* true, because that is what the next piece of work should aim at.
|
|
11
|
+
*
|
|
12
|
+
* Lives in the CLI package because the CLI cannot import from lib/; the web
|
|
13
|
+
* app's routes take it through lib/canvas/done-line.ts.
|
|
14
|
+
*/
|
|
15
|
+
const LEVEL_LABEL = {
|
|
16
|
+
0: "not met",
|
|
17
|
+
1: "partly met",
|
|
18
|
+
2: "met",
|
|
19
|
+
};
|
|
20
|
+
const flat = (s) => s.replace(/\s+/g, " ").trim();
|
|
21
|
+
const unstopped = (s) => flat(s).replace(/[.;]+$/, "");
|
|
22
|
+
/**
|
|
23
|
+
* The reading inside a stored score (a `canvasDone.latest` row, or `score` in
|
|
24
|
+
* GET /api/canvas/<id>/done), or null when there is nothing to say: the board
|
|
25
|
+
* was never judged, or the goal was reworded since, so the verdict is about a
|
|
26
|
+
* sentence the canvas no longer has.
|
|
27
|
+
*/
|
|
28
|
+
export function doneReadingFrom(score) {
|
|
29
|
+
if (!score || typeof score !== "object")
|
|
30
|
+
return null;
|
|
31
|
+
const s = score;
|
|
32
|
+
if (s.fresh === false)
|
|
33
|
+
return null;
|
|
34
|
+
if (s.level !== 0 && s.level !== 1 && s.level !== 2)
|
|
35
|
+
return null;
|
|
36
|
+
if (typeof s.scoredAt !== "number")
|
|
37
|
+
return null;
|
|
38
|
+
const parts = [];
|
|
39
|
+
for (const p of Array.isArray(s.parts) ? s.parts : []) {
|
|
40
|
+
if (!p || typeof p.part !== "string" || typeof p.holds !== "boolean")
|
|
41
|
+
continue;
|
|
42
|
+
parts.push({ part: p.part, holds: p.holds, why: typeof p.why === "string" && p.why.trim() ? p.why : null });
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
level: s.level,
|
|
46
|
+
scoredAt: s.scoredAt,
|
|
47
|
+
evidence: typeof s.evidence === "string" && s.evidence.trim() ? s.evidence : null,
|
|
48
|
+
parts: parts.length > 0 ? parts : null,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* "partly met, 2 of 3 parts hold. Not yet: Deniss's answer is on the Question
|
|
53
|
+
* card (QUESTION-12 has no answer). Judged 2d ago."
|
|
54
|
+
*
|
|
55
|
+
* `judged` is the verdict's age in the caller's own words, so it agrees with
|
|
56
|
+
* the other ages that caller prints. `why: false` drops each part's reason,
|
|
57
|
+
* for a brief, where the canvas read that follows carries it.
|
|
58
|
+
*/
|
|
59
|
+
export function doneVerdictLine(done, opts = {}) {
|
|
60
|
+
const label = LEVEL_LABEL[done.level];
|
|
61
|
+
const sentences = [];
|
|
62
|
+
const parts = done.parts ?? [];
|
|
63
|
+
if (parts.length > 0) {
|
|
64
|
+
const held = parts.filter((p) => p.holds).length;
|
|
65
|
+
if (parts.length === 1)
|
|
66
|
+
sentences.push(label);
|
|
67
|
+
else if (held === parts.length)
|
|
68
|
+
sentences.push(`${label}, all ${parts.length} parts hold`);
|
|
69
|
+
else
|
|
70
|
+
sentences.push(`${label}, ${held} of ${parts.length} parts hold`);
|
|
71
|
+
const missing = parts
|
|
72
|
+
.filter((p) => !p.holds)
|
|
73
|
+
.map((p) => {
|
|
74
|
+
const why = opts.why !== false && p.why ? ` (${unstopped(p.why)})` : "";
|
|
75
|
+
return `${unstopped(p.part)}${why}`;
|
|
76
|
+
});
|
|
77
|
+
if (missing.length > 0)
|
|
78
|
+
sentences.push(`Not yet: ${missing.join("; ")}`);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
sentences.push(label);
|
|
82
|
+
if (done.evidence)
|
|
83
|
+
sentences.push(unstopped(done.evidence));
|
|
84
|
+
}
|
|
85
|
+
if (opts.judged)
|
|
86
|
+
sentences.push(`Judged ${opts.judged}`);
|
|
87
|
+
return `${sentences.join(". ")}.`;
|
|
88
|
+
}
|
package/dist/lib/mcp-spec.js
CHANGED
|
@@ -475,7 +475,7 @@ export function buildMcpSpec(z, opts) {
|
|
|
475
475
|
},
|
|
476
476
|
},
|
|
477
477
|
cnotes_catch_up: {
|
|
478
|
-
description: "Catch the user up: what changed in the workspace over a window they name, as evidence for YOU to narrate. Returns threads of work, newest first (agent runs, edits, milestones, approved proposals), each with the notes it touched, what changed
|
|
478
|
+
description: "Catch the user up: what changed in the workspace over a window they name, as evidence for YOU to narrate. Returns threads of work, newest first (agent runs, edits, milestones, approved proposals), each with the notes it touched, what changed as it was recorded at the time, and the links each note gained: a line `+ answers QUESTION-12` is a question getting its answer. Use it for \"catch me up\", \"what did Ana do this week\", \"any decisions since Tuesday\", and \"did my questions get answered\" (types: [\"Question\"]). The window is required and has no default: when the user gives none, ask how far back, or offer the last 7 days. Tell them what moved as a few threads of work, say which closed and which are still open, and name each note by its id; every line was recorded when the change was made, so add no cause the lines do not state. A busy window lists its newest threads in full and older ones as headlines: when the Coverage line says where the detail or the pack stops, call again with `until` set to the instant it names.",
|
|
479
479
|
shape: {
|
|
480
480
|
since: z
|
|
481
481
|
.string()
|
|
@@ -484,7 +484,7 @@ export function buildMcpSpec(z, opts) {
|
|
|
484
484
|
person: z
|
|
485
485
|
.string()
|
|
486
486
|
.optional()
|
|
487
|
-
.describe("Only changes by one member: a name, part of one, or \"me\". Agents acting for them count as them. A name that fits two members is refused with the names to pick from"),
|
|
487
|
+
.describe("Only changes by one member: a name, part of one, an email, or \"me\". Agents acting for them count as them. A name that fits two members is refused with the names to pick from"),
|
|
488
488
|
humansOnly: z.boolean().optional().describe("true = leave out agent runs and CLI, MCP and import writes"),
|
|
489
489
|
types: z
|
|
490
490
|
.array(z.string())
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describeLesson, fetchLessons } from "./lessons.js";
|
|
2
|
+
import { doneReadingFrom, doneVerdictLine } from "./done-line.js";
|
|
2
3
|
export const BRIEF_LIMIT = 8;
|
|
3
4
|
export const BRIEF_CANVAS_LIMIT = 3;
|
|
4
5
|
export const BRIEF_CHANGE_LIMIT = 5;
|
|
@@ -91,16 +92,35 @@ export async function loadSessionBrief(api, workspaceId, prompt) {
|
|
|
91
92
|
if (search === null && timeline === null)
|
|
92
93
|
return null;
|
|
93
94
|
const found = briefFromSearch(query, search);
|
|
94
|
-
// After the search, since the lessons are looked up on the notes it found
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
// After the search, since the lessons are looked up on the notes it found
|
|
96
|
+
// and the verdicts on the canvases it found. Reading a verdict is free and
|
|
97
|
+
// never runs the judge.
|
|
98
|
+
const [lessons, canvases] = await Promise.all([
|
|
99
|
+
fetchLessons(api, workspaceId, found.notes.map((n) => n.displayId))
|
|
100
|
+
.then(lessonsFromResponse)
|
|
101
|
+
.catch(() => null),
|
|
102
|
+
Promise.all(found.canvases.map((c) => withDoneReading(api, workspaceId, c))),
|
|
103
|
+
]);
|
|
98
104
|
return {
|
|
99
105
|
...found,
|
|
106
|
+
canvases,
|
|
100
107
|
changes: changesFromTimeline(timeline),
|
|
101
108
|
...(lessons ? { lessons } : {}),
|
|
102
109
|
};
|
|
103
110
|
}
|
|
111
|
+
/** The canvas with its done verdict, or as it was when it has none or the lookup fails. */
|
|
112
|
+
async function withDoneReading(api, workspaceId, canvas) {
|
|
113
|
+
const done = await api
|
|
114
|
+
.get(`/api/canvas/${encodeURIComponent(canvas.ref)}/done`, { workspaceId })
|
|
115
|
+
.then((r) => doneReadingFrom(r?.score))
|
|
116
|
+
.catch(() => null);
|
|
117
|
+
return done ? { ...canvas, done } : canvas;
|
|
118
|
+
}
|
|
119
|
+
/** "today" or "3d ago": the age every dated line of a brief uses. */
|
|
120
|
+
function daysAgo(at, now) {
|
|
121
|
+
const days = Math.max(0, Math.round((now - at) / 86_400_000));
|
|
122
|
+
return days === 0 ? "today" : `${days}d ago`;
|
|
123
|
+
}
|
|
104
124
|
/** Pull the lessons overlay out of a `/api/lessons` response. */
|
|
105
125
|
export function lessonsFromResponse(data) {
|
|
106
126
|
const d = data;
|
|
@@ -160,13 +180,15 @@ export function renderBrief(brief, now = Date.now()) {
|
|
|
160
180
|
lines.push(` ${c.ref} ${c.title}`);
|
|
161
181
|
if (c.about)
|
|
162
182
|
lines.push(` ${clip(c.about, 140)}`);
|
|
183
|
+
// Never clipped: the part that is not yet true is the reason to print it.
|
|
184
|
+
if (c.done)
|
|
185
|
+
lines.push(` done: ${doneVerdictLine(c.done, { judged: daysAgo(c.done.scoredAt, now), why: false })}`);
|
|
163
186
|
}
|
|
164
187
|
}
|
|
165
188
|
if (brief.changes.length > 0) {
|
|
166
189
|
lines.push("Recent changes on this:");
|
|
167
190
|
for (const c of brief.changes) {
|
|
168
|
-
const
|
|
169
|
-
const when = days === null ? "" : days === 0 ? "today" : `${days}d ago`;
|
|
191
|
+
const when = c.createdAt ? daysAgo(c.createdAt, now) : "";
|
|
170
192
|
lines.push(` ${c.displayId} v${c.versionNumber} ${clip(c.headline, 90)}${when ? ` (${when})` : ""}`);
|
|
171
193
|
}
|
|
172
194
|
}
|
package/package.json
CHANGED
|
@@ -97,7 +97,11 @@ cnotes canvas create "<name>" --goal "<text>" --audience "<text>" --spec spec.js
|
|
|
97
97
|
# Tufte"), the situation and its date (banner line 1) and the audience (--audience). "Track X" / "Explore X" are briefs
|
|
98
98
|
# to yourself, not results; give them an exit ("Decide which X ship next. Done when ...").
|
|
99
99
|
# `canvas read` prints the goal under the title, so re-read it before adding to a board and keep
|
|
100
|
-
# the board inside it; fix a stale goal with `canvas update --goal`.
|
|
100
|
+
# the board inside it; fix a stale goal with `canvas update --goal`. Under the goal a judged board
|
|
101
|
+
# prints one `*Done: …*` line: met, partly met or not met, then "Not yet:" with each part of the
|
|
102
|
+
# Done when that is not true yet. Aim the work at those parts. When a part waits on a person's
|
|
103
|
+
# answer, ask them that question instead of adding more to the board. `cnotes brief` prints the
|
|
104
|
+
# same verdict under each canvas it names. No line means the board has not been judged. The banner restates the goal
|
|
101
105
|
# in reader's words (canvas-elements.md, hard rule 7).
|
|
102
106
|
cnotes canvas update <canvasId> [--title "<text>"] [--goal "<text>"] [--audience "<text>"]
|
|
103
107
|
# Is the board done? The judge's last reading of whether the goal's "Done when" is true of
|
|
@@ -216,9 +216,9 @@ cnotes catchup --since 7d --topic "pricing" --canvas CANVAS-12
|
|
|
216
216
|
```
|
|
217
217
|
|
|
218
218
|
- **The window is required.** There is no "since I last looked": when the person names none, ask how far back, or offer the last 7 days. `--since` and `--until` take a span back from now (36h, 7d, 2w), a date or a date and time.
|
|
219
|
-
- **Scopes combine.** `--person` (a name, part of one, or "me"; a name that fits two members is refused with the names to pick from), `--humans-only`, `--type`, `--canvas`, `--topic`.
|
|
220
|
-
- **The pack is evidence, not a summary.** It holds threads of work, newest first: agent runs, edits, milestones and approved proposals, each with the notes it touched, the change
|
|
219
|
+
- **Scopes combine.** `--person` (a name, part of one, an email, or "me"; a name that fits two members is refused with the names to pick from), `--humans-only`, `--type`, `--canvas`, `--topic`.
|
|
220
|
+
- **The pack is evidence, not a summary.** It holds threads of work, newest first: agent runs, edits, milestones and approved proposals, each with the notes it touched, the change as it was recorded when it was made, and the links each note gained (`+ answers QUESTION-12` is a question getting its answer). Nothing in it summarises the window, so you narrate: say what moved as a few threads, which closed and which are still open, and name each note by its id. Add no cause or motive the lines do not state.
|
|
221
221
|
- **"Did my questions get answered?"** is `--type Question`: a note of another type that gained a link to a Question is in the pack, marked with why.
|
|
222
|
-
- **A pack says where it stops.** `coverage.
|
|
223
|
-
- `--text` prints the same pack as text
|
|
222
|
+
- **A pack says where it stops.** It lists about 80 notes in full, then names older threads by headline only. `coverage.detailedBackTo` is where the detail stops and `coverage.coveredBackTo` where the pack stops (both on the `Coverage:` line in text): run it again with `--until` set to either for what came before, and say so if you stop early.
|
|
223
|
+
- `--text` prints the same pack as text at about half the size of the JSON, which is what to read when you only narrate. `-q` prints the display id of every note the pack lists; open one with `cnotes notes get <id> --expand`.
|
|
224
224
|
|