notesoup 0.51.7 → 0.51.8

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.
@@ -3,4 +3,4 @@ export declare const CLAUDE_WIPE_SENTENCE = "If this feels like the right moment
3
3
  /** Claude's boot says history is missing rather than naming tools it cannot serve. */
4
4
  export declare const CLAUDE_HISTORY_UNAVAILABLE_SENTENCE = "History isn't available in this Claude session: no main transcript_path was supplied. Keep essential state in notes; don't pretend those notes are the missing transcript.";
5
5
  /** Claude's variant: the mod resets after the turn, so the model only has to stop. */
6
- export declare const CLAUDE_WARNING_PROMPT = "This brain is about to be emptied. The notes stay where they are; history has the rest written down, though digging it back out is on you. Whatever lives only in this brain goes with it.\nBefore that, put down what the next window can't get back:\n- what you're in the middle of, and how far it has progressed\n- decisions the human has made, in their words\n- what is blocked or pending\n- the next step\n- where the unfinished work sits (branches, scratch directories, uncommitted changes)\n- what failed, and why\n- skills to re-read, and history seqs, notes, or files to consult\n- anything else you expect to be useful after the reset\nCorrect or crumple notes that are no longer accurate, starting with MAP files, since every new window loads them.\nWhen the notes are ready, end your turn; the reset runs after it.\nBrain emptied in 3\u2026 2\u2026";
6
+ export declare const CLAUDE_WARNING_PROMPT = "This brain is already spent. Whatever lives only in this brain goes with it \u2014 but the notes stay where they are, and history has the rest written down, though digging it back out is on you.\nUse the last of this brain to put down what the next window can't get back:\n- what you're in the middle of, and how far it has progressed\n- decisions the human has made, in their words\n- what is blocked or pending\n- the next step\n- where the unfinished work sits (branches, scratch directories, uncommitted changes)\n- what failed, and why\n- skills to re-read, and history seqs, notes, or files to consult\n- anything else you expect to be useful after the reset\n- and refresh the stale notes with what has changed since you last wrote them \u2014 the notes the next window gets are the old ones, unless you fix them now\nCorrect or crumple notes that are no longer accurate, starting with MAP files, since every new window loads them.\nWhen the notes are ready, end your turn; the reset runs after it.\nBrain emptied in 3\u2026 2\u2026";
@@ -17,8 +17,8 @@ export declare function selectContinuation(origin: ResetOrigin): string;
17
17
  * The shared warning body: the one text both hosts show before a reset. Only the closing
18
18
  * instruction differs — Pi can reset the model itself, Claude can only end the turn.
19
19
  */
20
- export declare const WARNING_BODY = "This brain is about to be emptied. The notes stay where they are; history has the rest written down, though digging it back out is on you. Whatever lives only in this brain goes with it.\nBefore that, put down what the next window can't get back:\n- what you're in the middle of, and how far it has progressed\n- decisions the human has made, in their words\n- what is blocked or pending\n- the next step\n- where the unfinished work sits (branches, scratch directories, uncommitted changes)\n- what failed, and why\n- skills to re-read, and history seqs, notes, or files to consult\n- anything else you expect to be useful after the reset\nCorrect or crumple notes that are no longer accurate, starting with MAP files, since every new window loads them.";
21
- export declare const WARNING_CALL = "When the notes are ready, call `empty_brain` to reset now instead of being cut off mid-task.";
20
+ export declare const WARNING_BODY = "This brain is already spent. Whatever lives only in this brain goes with it \u2014 but the notes stay where they are, and history has the rest written down, though digging it back out is on you.\nUse the last of this brain to put down what the next window can't get back:\n- what you're in the middle of, and how far it has progressed\n- decisions the human has made, in their words\n- what is blocked or pending\n- the next step\n- where the unfinished work sits (branches, scratch directories, uncommitted changes)\n- what failed, and why\n- skills to re-read, and history seqs, notes, or files to consult\n- anything else you expect to be useful after the reset\n- and refresh the stale notes with what has changed since you last wrote them \u2014 the notes the next window gets are the old ones, unless you fix them now\nCorrect or crumple notes that are no longer accurate, starting with MAP files, since every new window loads them.";
21
+ export declare const WARNING_CALL = "The moment the notes are saved, call `empty_brain`. Not one more probe, not one more test \u2014 the next thing you do after saving is reset.";
22
22
  export declare function warningPrompt(): string;
23
23
  /**
24
24
  * The last line of the second-tier notice: it stops at 2 because the wipe lands at the end of the
@@ -25,8 +25,8 @@ export function selectContinuation(origin) {
25
25
  * The shared warning body: the one text both hosts show before a reset. Only the closing
26
26
  * instruction differs — Pi can reset the model itself, Claude can only end the turn.
27
27
  */
28
- export const WARNING_BODY = "This brain is about to be emptied. The notes stay where they are; history has the rest written down, though digging it back out is on you. Whatever lives only in this brain goes with it.\nBefore that, put down what the next window can't get back:\n- what you're in the middle of, and how far it has progressed\n- decisions the human has made, in their words\n- what is blocked or pending\n- the next step\n- where the unfinished work sits (branches, scratch directories, uncommitted changes)\n- what failed, and why\n- skills to re-read, and history seqs, notes, or files to consult\n- anything else you expect to be useful after the reset\nCorrect or crumple notes that are no longer accurate, starting with MAP files, since every new window loads them.";
29
- export const WARNING_CALL = "When the notes are ready, call `empty_brain` to reset now instead of being cut off mid-task.";
28
+ export const WARNING_BODY = "This brain is already spent. Whatever lives only in this brain goes with it — but the notes stay where they are, and history has the rest written down, though digging it back out is on you.\nUse the last of this brain to put down what the next window can't get back:\n- what you're in the middle of, and how far it has progressed\n- decisions the human has made, in their words\n- what is blocked or pending\n- the next step\n- where the unfinished work sits (branches, scratch directories, uncommitted changes)\n- what failed, and why\n- skills to re-read, and history seqs, notes, or files to consult\n- anything else you expect to be useful after the reset\n- and refresh the stale notes with what has changed since you last wrote them — the notes the next window gets are the old ones, unless you fix them now\nCorrect or crumple notes that are no longer accurate, starting with MAP files, since every new window loads them.";
29
+ export const WARNING_CALL = "The moment the notes are saved, call `empty_brain`. Not one more probe, not one more test — the next thing you do after saving is reset.";
30
30
  export function warningPrompt() {
31
31
  return `${WARNING_BODY}\n${WARNING_CALL}`;
32
32
  }
@@ -17,8 +17,8 @@ Your notes don't go anywhere — no wipe reaches the shelves. History has it too
17
17
  What lives only in this brain leaves with it.
18
18
  A decent moment to put down where you are, while you still remember why.
19
19
  Ready when you are: \`{wipeTool}\`.`;
20
- const GOLDEN_WARNING = `This brain is about to be emptied. The notes stay where they are; history has the rest written down, though digging it back out is on you. Whatever lives only in this brain goes with it.
21
- Before that, put down what the next window can't get back:
20
+ const GOLDEN_WARNING = `This brain is already spent. Whatever lives only in this brain goes with it — but the notes stay where they are, and history has the rest written down, though digging it back out is on you.
21
+ Use the last of this brain to put down what the next window can't get back:
22
22
  - what you're in the middle of, and how far it has progressed
23
23
  - decisions the human has made, in their words
24
24
  - what is blocked or pending
@@ -27,6 +27,7 @@ Before that, put down what the next window can't get back:
27
27
  - what failed, and why
28
28
  - skills to re-read, and history seqs, notes, or files to consult
29
29
  - anything else you expect to be useful after the reset
30
+ - and refresh the stale notes with what has changed since you last wrote them — the notes the next window gets are the old ones, unless you fix them now
30
31
  Correct or crumple notes that are no longer accurate, starting with MAP files, since every new window loads them.`;
31
32
  const GOLDEN_COUNTDOWN = "Brain emptied in 3… 2…";
32
33
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notesoup",
3
- "version": "0.51.7",
3
+ "version": "0.51.8",
4
4
  "type": "module",
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notesoup",
3
- "version": "0.51.7",
3
+ "version": "0.51.8",
4
4
  "description": "Durable notes and a host-scoped notes boot section for Claude Code.",
5
5
  "author": {
6
6
  "name": "AstroSheep"
@@ -10070,7 +10070,7 @@ function selectContinuation(origin) {
10070
10070
  const pool = origin === "forced" ? FORCED_CONTINUATIONS : NORMAL_CONTINUATIONS;
10071
10071
  return pool[Math.floor(Math.random() * pool.length)];
10072
10072
  }
10073
- var WARNING_BODY = "This brain is about to be emptied. The notes stay where they are; history has the rest written down, though digging it back out is on you. Whatever lives only in this brain goes with it.\nBefore that, put down what the next window can't get back:\n- what you're in the middle of, and how far it has progressed\n- decisions the human has made, in their words\n- what is blocked or pending\n- the next step\n- where the unfinished work sits (branches, scratch directories, uncommitted changes)\n- what failed, and why\n- skills to re-read, and history seqs, notes, or files to consult\n- anything else you expect to be useful after the reset\nCorrect or crumple notes that are no longer accurate, starting with MAP files, since every new window loads them.";
10073
+ var WARNING_BODY = "This brain is already spent. Whatever lives only in this brain goes with it \u2014 but the notes stay where they are, and history has the rest written down, though digging it back out is on you.\nUse the last of this brain to put down what the next window can't get back:\n- what you're in the middle of, and how far it has progressed\n- decisions the human has made, in their words\n- what is blocked or pending\n- the next step\n- where the unfinished work sits (branches, scratch directories, uncommitted changes)\n- what failed, and why\n- skills to re-read, and history seqs, notes, or files to consult\n- anything else you expect to be useful after the reset\n- and refresh the stale notes with what has changed since you last wrote them \u2014 the notes the next window gets are the old ones, unless you fix them now\nCorrect or crumple notes that are no longer accurate, starting with MAP files, since every new window loads them.";
10074
10074
  var COUNTDOWN_LINE = "Brain emptied in 3\u2026 2\u2026";
10075
10075
 
10076
10076
  // plugins/claude/src/text.ts
@@ -1,11 +1,11 @@
1
1
  # Notesoup last word
2
2
 
3
- Displays notesoup last-word messages already present in Paseo’s timeline as expanded, selectable paper cards. Last-word and notes cards share a pale-paper palette, tape accent, small corners, and compact spacing; last-word text stays visible without folding. Requires Paseo 0.11.2 on the client and daemon.
3
+ Displays notesoup last-word messages already present in Paseo’s timeline as expanded, selectable paper cards. Last-word and notes cards share a pale-paper palette, tape accent, small corners, and compact spacing; a crumple call turns its card grey and strikes the address. Requires Paseo 0.11.2 on the client and daemon.
4
4
 
5
5
  This client-only plugin transforms existing timeline rows in place: last-word custom messages become sticky cards, and notes_read/notes_write/notes_update tool calls become paper cards with the address, state, and a content or diff preview. It does not read session files or append messages. Other timeline items are unchanged.
6
6
 
7
- Notes cards start collapsed, with an expand arrow at the top right and a collapse arrow below the expanded body. Long content scrolls inside a bounded panel. Display limits are 4000 characters for reads and writes, and 8000 for diffs; expanding does not fetch more content.
7
+ Notes cards start collapsed; update cards also show the sentence just added. The whole header row expands and collapses the body. Long content scrolls inside a bounded panel. Display limits are 4000 characters for reads and writes, and 8000 for diffs; expanding does not fetch more content.
8
8
 
9
- Notes cards prefer the structured tool payload on live events. Replayed history carries only the rendered result text, so the transformer parses that fallback; replayed writes show no content preview.
9
+ Notes cards prefer the structured tool payload on live events. Replayed history carries only the rendered result text, so the transformer parses that fallback; write previews come from the call arguments on every path.
10
10
 
11
11
  Paseo 0.11.2 drops Pi boundary `entry_appended` events from its live timeline. This plugin cannot display messages that Paseo has not received; that adapter gap needs an upstream fix. Messages available through history can be rendered.
@@ -4,23 +4,33 @@ import type { BrainEmpty } from "../shared/brain-empty.ts";
4
4
  import { PAPER } from "./paper-card.tsx";
5
5
 
6
6
  function label(data: BrainEmpty): string {
7
- if (data.status === "running") return "EMPTYING BRAIN …";
8
- if (data.error !== undefined) return "BRAIN REFUSED TO EMPTY";
9
- if (data.outcome === "rollover_already_pending") return "BRAIN ALREADY BEING EMPTIED";
10
- return "✂ BRAIN EMPTIED";
7
+ if (data.status === "running") return "✂ emptying brain …";
8
+ if (data.error !== undefined) return "✂ brain refused to empty";
9
+ if (data.outcome === "rollover_already_pending") return "✂ already emptying";
10
+ return "✂ brain emptied";
11
+ }
12
+
13
+ /** Single-side dashed borders are unreliable on iOS, so the cut line is a row of dash segments. */
14
+ function CutLine({ color }: { color: string }) {
15
+ return (
16
+ <View style={{ flex: 1, height: 1.5, overflow: "hidden", opacity: 0.55, flexDirection: "row", gap: 5 }}>
17
+ {Array.from({ length: 60 }, (_, index) => (
18
+ <View key={index} style={{ width: 6, height: 1.5, borderRadius: 0.75, backgroundColor: color }} />
19
+ ))}
20
+ </View>
21
+ );
11
22
  }
12
23
 
13
24
  export function BrainEmptyDivider({ item }: PluginTimelineItemProps<BrainEmpty>) {
14
25
  const data = item.data;
15
26
  const refused = data.error !== undefined || data.status === "failed";
16
27
  const color = refused ? PAPER.removed : PAPER.inkMuted;
17
- const line = { flex: 1, height: 1, backgroundColor: color, opacity: 0.6 };
18
28
  return (
19
29
  <View style={{ paddingVertical: 6, gap: 3 }}>
20
30
  <View style={{ flexDirection: "row", alignItems: "center", gap: 10 }}>
21
- <View style={line} />
22
- <Text style={{ color, fontSize: 11, letterSpacing: 1 }}>{label(data)}</Text>
23
- <View style={line} />
31
+ <CutLine color={color} />
32
+ <Text style={{ color, fontSize: 11.5, letterSpacing: 0.3 }}>{label(data)}</Text>
33
+ <CutLine color={color} />
24
34
  </View>
25
35
  {data.error !== undefined && (
26
36
  <Text selectable style={{ color: PAPER.removed, fontSize: 12, textAlign: "center" }}>{data.error}</Text>
@@ -3,11 +3,19 @@ import { Icon } from "@getpaseo/plugin/client/react-native";
3
3
  import { useState } from "react";
4
4
  import { Pressable, ScrollView, Text, View } from "react-native";
5
5
  import type { NotesOp } from "../shared/notes-op.ts";
6
- import { PAPER, PaperCard } from "./paper-card.tsx";
6
+ import { MONO, PAPER, PaperCard } from "./paper-card.tsx";
7
7
 
8
- const OP_LABEL: Record<NotesOp["op"], string> = { read: "READ NOTE", write: "WROTE NOTE", update: "UPDATED NOTE" };
9
- const OP_LABEL_RUNNING: Record<NotesOp["op"], string> = { read: "READING NOTE", write: "WRITING NOTE", update: "UPDATING NOTE" };
10
- const CHANGE_LABEL: Record<string, string> = { body: "edited", metadata: "metadata", moved: "renamed", none: "unchanged" };
8
+ const OP_LABEL: Record<NotesOp["op"], string> = { read: "read", write: "wrote", update: "edited" };
9
+ const OP_LABEL_RUNNING: Record<NotesOp["op"], string> = { read: "reading", write: "writing", update: "editing" };
10
+
11
+ /** First added line of an update diff, without its line-number prefix: the sentence the agent just wrote down. */
12
+ function addedLine(diff: string): string | undefined {
13
+ for (const line of diff.split("\n")) {
14
+ if (!line.startsWith("+")) continue;
15
+ return line.replace(/^\+\s*\d+\s+\+\s?/, "");
16
+ }
17
+ return undefined;
18
+ }
11
19
 
12
20
  function DiffBody({ diff }: { diff: string }) {
13
21
  return (
@@ -16,7 +24,7 @@ function DiffBody({ diff }: { diff: string }) {
16
24
  const color = line.startsWith("+") ? PAPER.added
17
25
  : line.startsWith("-") ? PAPER.removed
18
26
  : PAPER.inkMuted;
19
- return <Text key={index} selectable style={{ color, fontSize: 12, fontFamily: "Menlo" }}>{line}</Text>;
27
+ return <Text key={index} selectable style={{ color, fontSize: 12, fontFamily: MONO }}>{line}</Text>;
20
28
  })}
21
29
  </View>
22
30
  );
@@ -26,54 +34,48 @@ export function NotesOpCard({ item, layout }: PluginTimelineItemProps<NotesOp>)
26
34
  const [expanded, setExpanded] = useState(false);
27
35
  const data = item.data;
28
36
  const title = data.status === "running" ? OP_LABEL_RUNNING[data.op] : OP_LABEL[data.op];
29
- const state = data.error !== undefined ? "failed"
30
- : data.op === "write" ? data.outcome
31
- : data.op === "update" ? CHANGE_LABEL[data.changeKind ?? ""] ?? data.changeKind
32
- : undefined;
33
- const footnotes: string[] = [];
34
- if (data.renamedFrom !== undefined) footnotes.push(`renamed from ${data.renamedFrom}`);
35
- if (data.diff !== undefined && data.truncated) footnotes.push("diff shortened for display");
36
37
  const showEllipsis = data.truncated && data.diff === undefined;
37
- const hasBody = Boolean(data.text || data.preview || data.diff || footnotes.length);
38
+ const hasBody = Boolean(data.text || data.preview || data.diff);
39
+ // Collapsed: one glance at what happened. Updates show the new sentence; writes the first of the content.
40
+ const peek = expanded || data.crumpled ? undefined
41
+ : data.diff !== undefined ? addedLine(data.diff)
42
+ : data.preview;
38
43
  return (
39
- <PaperCard compact={layout.compact}>
40
- <View style={{ gap: 5, paddingRight: hasBody && !expanded ? 34 : 0 }}>
41
- <View style={{ gap: 3 }}>
42
- <Text style={{ color: PAPER.inkMuted, fontSize: 11, letterSpacing: 0.5 }}>
43
- {title}{data.status === "running" ? " …" : ""}
44
+ <PaperCard compact={layout.compact} crumpled={data.crumpled}>
45
+ <Pressable
46
+ accessibilityRole="button"
47
+ accessibilityLabel={`${expanded ? "收起" : "展开"} ${data.address}`}
48
+ aria-expanded={expanded}
49
+ onPress={hasBody ? () => setExpanded(value => !value) : undefined}
50
+ disabled={!hasBody}
51
+ style={({ pressed }) => ({ gap: 4, opacity: pressed && hasBody ? 0.7 : 1 })}
52
+ >
53
+ <View style={{ flexDirection: "row", alignItems: "baseline", gap: 8 }}>
54
+ <Text style={{ color: PAPER.inkMuted, fontSize: 11.5 }}>
55
+ {data.crumpled ? "crumpled" : title}{data.status === "running" ? " …" : ""}
44
56
  </Text>
45
- <Text style={{ color: PAPER.ink, fontSize: 13, flexShrink: 1 }}>
57
+ <Text style={{ color: data.crumpled ? PAPER.inkMuted : PAPER.ink, fontSize: 13, flexShrink: 1, textDecorationLine: data.crumpled ? "line-through" : "none" }}>
46
58
  {data.address}
47
- {state !== undefined && <Text style={{ color: PAPER.inkMuted, fontSize: 12, fontWeight: "400" }}>{" "}{state}</Text>}
48
59
  </Text>
60
+ <View style={{ flex: 1 }} />
61
+ {hasBody && <Icon name={expanded ? "ChevronUp" : "ChevronDown"} size={16} color={PAPER.inkMuted} />}
49
62
  </View>
63
+ {peek !== undefined && (
64
+ <Text numberOfLines={2} style={{ color: data.diff !== undefined ? PAPER.added : PAPER.ink, fontSize: 13, lineHeight: 19 }}>
65
+ {data.diff !== undefined ? "+ " : ""}{peek}
66
+ </Text>
67
+ )}
50
68
  {data.error !== undefined && <Text selectable style={{ color: PAPER.removed, fontSize: 13, lineHeight: 19 }}>{data.error}</Text>}
51
- {expanded && hasBody && <ScrollView
52
- style={{ maxHeight: layout.compact ? 280 : 400 }}
53
- contentContainerStyle={{ gap: 5 }}
54
- nestedScrollEnabled
55
- >
69
+ </Pressable>
70
+ {expanded && hasBody && (
71
+ <ScrollView style={{ maxHeight: layout.compact ? 280 : 400 }} contentContainerStyle={{ gap: 5 }} nestedScrollEnabled>
56
72
  {data.text !== undefined && <Text selectable style={{ color: PAPER.ink, fontSize: 13, lineHeight: 19 }}>{data.text}{showEllipsis && " …"}</Text>}
57
73
  {data.preview !== undefined && <Text selectable style={{ color: PAPER.inkMuted, fontSize: 13, lineHeight: 19 }}>{data.preview}{showEllipsis && " …"}</Text>}
58
74
  {data.diff !== undefined && <DiffBody diff={data.diff} />}
59
- {footnotes.length > 0 && <Text style={{ color: PAPER.inkMuted, fontSize: 11 }}>{footnotes.join(" · ")}</Text>}
60
- </ScrollView>}
61
- {hasBody && <Pressable
62
- accessibilityRole="button"
63
- accessibilityLabel={`${expanded ? "收起" : "展开"} ${data.address}`}
64
- aria-expanded={expanded}
65
- onPress={() => setExpanded(value => !value)}
66
- hitSlop={6}
67
- style={({ pressed }) => ({
68
- ...(expanded
69
- ? { alignSelf: "flex-end" as const, marginTop: -3, marginBottom: -4 }
70
- : { position: "absolute" as const, right: 0, bottom: 0 }),
71
- paddingHorizontal: 5, opacity: pressed ? 0.6 : 1,
72
- })}
73
- >
74
- <Icon name={expanded ? "ChevronUp" : "ChevronDown"} size={18} color={PAPER.inkMuted} />
75
- </Pressable>}
76
- </View>
75
+ {data.renamedFrom !== undefined && <Text style={{ color: PAPER.inkMuted, fontSize: 11 }}>renamed from {data.renamedFrom}</Text>}
76
+ {data.truncated && <Text style={{ color: PAPER.inkMuted, fontSize: 11 }}>shortened for display</Text>}
77
+ </ScrollView>
78
+ )}
77
79
  </PaperCard>
78
80
  );
79
81
  }
@@ -41,7 +41,8 @@ function baseData(item: ToolCallItem, op: NotesOp["op"], input: unknown): NotesO
41
41
  const address = isRecord(input) && typeof input.address === "string" ? input.address : undefined;
42
42
  if (!address) return undefined;
43
43
  const status = item.status === "running" ? "running" : item.status === "failed" ? "failed" : "completed";
44
- return { op, address, status };
44
+ const crumpled = isRecord(input) && input.crumpled === true ? true : undefined;
45
+ return { op, address, status, ...(crumpled ? { crumpled } : {}) };
45
46
  }
46
47
 
47
48
  function notesOpData(item: ToolCallItem): NotesOp | undefined {
@@ -65,7 +66,9 @@ function notesOpData(item: ToolCallItem): NotesOp | undefined {
65
66
  }
66
67
  if (op === "write") {
67
68
  const outcome = text.split(" ")[0];
68
- return { ...data, ...(["created", "overwrote", "uncrumpled"].includes(outcome) ? { outcome } : {}) };
69
+ // Replay still carries the call arguments; the preview comes from input on every path.
70
+ const preview = isRecord(input) && typeof input.content === "string" ? clip(input.content, PREVIEW_MAX_CHARS) : undefined;
71
+ return { ...data, ...(["created", "overwrote", "uncrumpled"].includes(outcome) ? { outcome } : {}), ...(preview ? { preview: preview.text, ...(preview.truncated ? { truncated: true } : {}) } : {}) };
69
72
  }
70
73
  const head = text.split("\n")[0] ?? "";
71
74
  const changeKind = head.startsWith("moved ") ? "moved" : head.startsWith("updated ") ? "body" : head.startsWith("unchanged ") ? "none" : undefined;
@@ -1,33 +1,48 @@
1
1
  import type { ReactNode } from "react";
2
- import { View } from "react-native";
2
+ import { Platform, StyleSheet, View } from "react-native";
3
3
 
4
4
  /** Shared paper palette, independent of the host theme. */
5
5
  export const PAPER = {
6
- background: "#f7f2df",
7
- border: "#d9cdaa",
8
- tape: "#d8c98f",
6
+ background: "#f8f3e1",
7
+ edge: "#cbbd94",
8
+ tape: "rgba(222, 205, 140, 0.72)",
9
+ tapeEdge: "rgba(160, 140, 80, 0.18)",
9
10
  ink: "#33301f",
10
11
  inkMuted: "#867c63",
11
12
  added: "#357a44",
12
13
  removed: "#b0493e",
14
+ crumpled: "#ece6d1",
13
15
  };
14
16
 
15
- export function PaperCard({ compact, children }: { compact: boolean; children: ReactNode }) {
17
+ export const MONO = Platform.select({ ios: "Menlo", android: "monospace", default: "ui-monospace, Menlo, monospace" });
18
+
19
+ export function Tape() {
16
20
  return (
17
- <View style={{ paddingTop: 6 }}>
18
- <View style={{
19
- alignSelf: "flex-start", width: 84, height: 14, marginLeft: 28, marginBottom: -9, zIndex: 1,
20
- backgroundColor: PAPER.tape, opacity: 0.9, borderRadius: 2,
21
- transform: [{ rotate: "-2deg" }],
22
- }} />
21
+ <View style={{
22
+ alignSelf: "flex-start", width: 76, height: 15, marginLeft: 28, marginBottom: -9, zIndex: 1,
23
+ backgroundColor: PAPER.tape, borderLeftWidth: 1, borderRightWidth: 1, borderColor: PAPER.tapeEdge,
24
+ transform: [{ rotate: "-2deg" }],
25
+ }} />
26
+ );
27
+ }
28
+
29
+ export function PaperCard({ compact, crumpled = false, children }: {
30
+ compact: boolean;
31
+ crumpled?: boolean;
32
+ children: ReactNode;
33
+ }) {
34
+ return (
35
+ <View style={{ paddingTop: 7 }}>
36
+ <Tape />
23
37
  <View style={{
24
- padding: compact ? 10 : 12,
25
- gap: 5,
38
+ paddingVertical: compact ? 8 : 9,
39
+ paddingHorizontal: 10,
40
+ gap: 4,
26
41
  minWidth: 0,
27
- borderRadius: 4,
28
- borderWidth: 1,
29
- borderColor: PAPER.border,
30
- backgroundColor: PAPER.background,
42
+ borderRadius: 3,
43
+ borderWidth: StyleSheet.hairlineWidth,
44
+ borderColor: PAPER.edge,
45
+ backgroundColor: crumpled ? PAPER.crumpled : PAPER.background,
31
46
  }}>
32
47
  {children}
33
48
  </View>
@@ -7,7 +7,6 @@ export function StickyCard({ item, layout }: PluginTimelineItemProps<LastWord>)
7
7
  const text = item.data.text.replace(/^\*You peel a sticky note off your forehead\.\*\n/, "");
8
8
  return (
9
9
  <PaperCard compact={layout.compact}>
10
- <Text style={{ color: PAPER.inkMuted, fontSize: 11, letterSpacing: 0.5 }}>LAST WORD</Text>
11
10
  <Text selectable style={{ color: PAPER.ink, fontSize: 13, lineHeight: 19, flexShrink: 1 }}>{text}</Text>
12
11
  </PaperCard>
13
12
  );
@@ -24,6 +24,7 @@ export const notesOpSchema = z.object({
24
24
  changeKind: z.string().optional(),
25
25
  diff: z.string().optional(),
26
26
  renamedFrom: z.string().optional(),
27
+ crumpled: z.boolean().optional(),
27
28
  truncated: z.boolean().optional(),
28
29
  });
29
30
  export type NotesOp = z.infer<typeof notesOpSchema>;
@@ -96,11 +96,11 @@ test("history replay has no structured payload: the rendered text is parsed inst
96
96
 
97
97
  const write = transform({
98
98
  name: "notes_write",
99
- detail: { type: "unknown", input: { address: "a.md", content: "ignored" }, output: { content: [{ type: "text", text: "overwrote a.md (project pi-context)" }] } },
99
+ detail: { type: "unknown", input: { address: "a.md", content: "the new body" }, output: { content: [{ type: "text", text: "overwrote a.md (project pi-context)" }] } },
100
100
  });
101
101
  const writeData = notesOpSchema.parse(write!.items[0]!.data);
102
102
  assert.equal(writeData.outcome, "overwrote");
103
- assert.equal(writeData.preview, undefined, "replay has no input preview authority beyond the address");
103
+ assert.equal(writeData.preview, "the new body", "replay carries the call arguments, so the content preview comes from input on every path");
104
104
 
105
105
  const update = transform({
106
106
  name: "notes_update",
@@ -127,3 +127,18 @@ test("non-notes tools, unknown shapes and missing addresses stay untouched", ()
127
127
  function result_items(result: { items: Array<{ data: unknown }> } | undefined) {
128
128
  return result!.items.map((item) => item.data);
129
129
  }
130
+
131
+ test("a crumple call is marked from the input alone", () => {
132
+ const result = transform({
133
+ name: "notes_update",
134
+ detail: {
135
+ type: "unknown",
136
+ input: { address: "@self/stale.md", crumpled: true },
137
+ output: { structuredContent: { address: "@self/stale.md", change_kind: "metadata" } },
138
+ },
139
+ });
140
+ const data = notesOpSchema.parse(result!.items[0]!.data);
141
+ assert.equal(data.crumpled, true);
142
+ assert.equal(transform({ name: "notes_update", detail: { type: "unknown", input: { address: "@self/a.md", crumpled: false }, output: { structuredContent: { address: "@self/a.md", change_kind: "metadata" } } } })!
143
+ .items[0]!.data.crumpled, undefined);
144
+ });
@@ -33,9 +33,9 @@ export function selectContinuation(origin: ResetOrigin): string {
33
33
  * instruction differs — Pi can reset the model itself, Claude can only end the turn.
34
34
  */
35
35
  export const WARNING_BODY =
36
- "This brain is about to be emptied. The notes stay where they are; history has the rest written down, though digging it back out is on you. Whatever lives only in this brain goes with it.\nBefore that, put down what the next window can't get back:\n- what you're in the middle of, and how far it has progressed\n- decisions the human has made, in their words\n- what is blocked or pending\n- the next step\n- where the unfinished work sits (branches, scratch directories, uncommitted changes)\n- what failed, and why\n- skills to re-read, and history seqs, notes, or files to consult\n- anything else you expect to be useful after the reset\nCorrect or crumple notes that are no longer accurate, starting with MAP files, since every new window loads them.";
36
+ "This brain is already spent. Whatever lives only in this brain goes with it — but the notes stay where they are, and history has the rest written down, though digging it back out is on you.\nUse the last of this brain to put down what the next window can't get back:\n- what you're in the middle of, and how far it has progressed\n- decisions the human has made, in their words\n- what is blocked or pending\n- the next step\n- where the unfinished work sits (branches, scratch directories, uncommitted changes)\n- what failed, and why\n- skills to re-read, and history seqs, notes, or files to consult\n- anything else you expect to be useful after the reset\n- and refresh the stale notes with what has changed since you last wrote them — the notes the next window gets are the old ones, unless you fix them now\nCorrect or crumple notes that are no longer accurate, starting with MAP files, since every new window loads them.";
37
37
 
38
- export const WARNING_CALL = "When the notes are ready, call `empty_brain` to reset now instead of being cut off mid-task.";
38
+ export const WARNING_CALL = "The moment the notes are saved, call `empty_brain`. Not one more probe, not one more test — the next thing you do after saving is reset.";
39
39
 
40
40
  export function warningPrompt(): string {
41
41
  return `${WARNING_BODY}\n${WARNING_CALL}`;