@drakulavich/cogload 0.10.0 → 0.12.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/CHANGELOG.md CHANGED
@@ -5,6 +5,78 @@ All notable changes to this project are documented here. The format follows
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.12.0] - 2026-10-06
9
+
10
+ ### Fixed
11
+ - `--verbose` says how many unreadable transcripts or project directories
12
+ the scan skipped (`2 unreadable skipped`), so a light day has a reason.
13
+ - After `card --out <path>`, the `wrote` line names the file only
14
+ (`wrote card.png`), not the folders around it.
15
+ - `card --out .png` (an extension with no file name) is a usage error instead
16
+ of a hidden file named `.png`.
17
+ - A date after today, as the day or in `--to` or `--from`, is a usage error
18
+ (`2099-01-01 is in the future`, exit 2) instead of an empty day.
19
+ - A day with no activity prints `no activity on <date>` instead of a bare
20
+ table header.
21
+ - When `cogload` keeps failing, the `cognitive-load` band goes blank once its
22
+ reading is five minutes old, instead of showing that reading for hours.
23
+ - During a rest, `Override:` and `OVERRIDE:` lift it like `override:`. A
24
+ phone keyboard capitalises the first letter, so over Remote Control the
25
+ override was held as an ordinary prompt.
26
+ - JSON and tables written to a pipe arrive whole. They stopped at 64 KiB, so
27
+ `cogload | jq` failed on an ordinary week; a 90-day grid now comes through
28
+ in full.
29
+
30
+ ### Added
31
+ - When `cogload` is not on Claude Code's `PATH`, the `cognitive-load` plugin
32
+ starts `~/.bun/bin/cogload`, so a Homebrew Bun or the Desktop app opened
33
+ from the Dock no longer meets the missing-`cogload` toast.
34
+
35
+ ### Changed
36
+ - When `cogload` is missing, the `cognitive-load` toast and `/cogload` say
37
+ `cogload is not on Claude Code's PATH: bun add -g @drakulavich/cogload`;
38
+ Claude Code already prefixes the plugin's name, so the old text read
39
+ `cognitive-load: cognitive-load needs cogload…`.
40
+ - The card draws heating orange and fried red, as the CLI and the band do,
41
+ instead of violet and pink.
42
+ - The `cognitive-load` band draws while Calm too, `● Calm · streak 7m`, so
43
+ the plugin no longer looks switched off in a quiet hour; it still stays away
44
+ when the last hour holds no session. The welcome toast reads
45
+ `Keep your head cold. The dot above the prompt shows how hot this hour runs.`
46
+
47
+ ## [0.11.0] - 2026-10-05
48
+
49
+ ### Added
50
+ - `/cogload` in the `cognitive-load` plugin says what drives the hour's load,
51
+ in counts: `Heating 80 this hour, at the cap: 16 decisions and 13 context
52
+ switches, 32 prompts, a 57m streak.`, then the week's rests and overrides
53
+ with the newest reason. It replaces `/overrides`, and the plugin now keeps
54
+ overrides 7 days instead of 14.
55
+
56
+ ### Changed
57
+ - The `cognitive-load` band draws Calm and Warming in Claude Code's theme
58
+ colours `success` and `warning`, which stay readable on a light theme,
59
+ instead of plain green and yellow.
60
+ - The `cognitive-load` band no longer counts the week's overrides; `/cogload`
61
+ does.
62
+ - The `cognitive-load` band starts with a dot in the level's colour,
63
+ `● Heating`, in the terminal and the Desktop Code tab, whose proportional
64
+ font drew `▓` as a dotted block.
65
+ - The `cognitive-load` band shows the level and the streak,
66
+ `● Heating · streak 20m`; the index, peak and active time stay in
67
+ `cogload`. The plugin greets a new install with one toast, says once when
68
+ `cogload` is not on Claude Code's `PATH`, and answers an override with
69
+ a reason under three words with
70
+ `An override needs a reason of three words or more.`
71
+ - The `cognitive-load` band warns before a rest: from a 35-minute streak it
72
+ says `rest in 5 min` and counts down. A held prompt says
73
+ `Rest until 14:32. Your prompt is saved.` (from Remote
74
+ Control, `Rest until 14:32.`), and only the first one after install says how to
75
+ override.
76
+ - The `cognitive-load` band colours only the level, `● Heating`, and
77
+ dims the rest of the line. Heating is orange in the band and in the CLI's
78
+ week grid and legend.
79
+
8
80
  ## [0.10.0] - 2026-10-05
9
81
 
10
82
  ### Added
package/README.md CHANGED
@@ -127,7 +127,7 @@ If your card told you something about your week, star [the repository](https://g
127
127
  | `cogload 2026-09-14 --explain` | One day, with the six weighted components behind each index. |
128
128
  | `cogload card` | The last 14 days as one shareable picture, `cogload-card.png` in `~/Downloads`. |
129
129
  | `cogload card --days 30 --out me.webp` | Any window from 1 to 90 days; `.png`, `.webp` or `.html` by extension. `--json` prints the card's data instead. |
130
- | `cogload status` | Writes today's load to `~/.claude/cogload/status.json` for a status line to read, and prints the same line. See [Status line](#status-line). |
130
+ | `cogload status` | Writes today's load to `~/.claude/cogload/status.json` for a status line to read, and prints the same line. The file's fields are in [the status file spec](docs/superpowers/specs/2026-09-19-zapara-status-file-design.md), written when cogload was zapara and kept its files in `~/.claude/zapara/`. |
131
131
 
132
132
  | Flag | What it does |
133
133
  |---|---|
@@ -146,38 +146,27 @@ Levels: calm 0–29, warming 30–59, heating 60–84, fried 85–100.
146
146
 
147
147
  The grid and the day print a text table when stdout is a terminal and JSON otherwise, so `cogload | cat` prints JSON; no flag forces text in a pipe yet. `card` and `status` write their file and print their lines whether piped or not. `card` asks to open the picture only when stdin and stdout are both a terminal, and never on Windows. While the browser engine draws a picture, a terminal's stderr shows `drawing the card…`, cleared before the result. `card --json` is the exception: it prints the card's data and writes no file, so `--out` with it is a usage error. `--json` changes nothing for `status`, whose line is already JSON and whose file is written either way.
148
148
 
149
- A run that works exits 0, and so does a window with no data, which prints an empty grid. Exit 1 is a failure cogload can name, printed as one line to stderr that never contains a path: the projects directory missing or unreadable, `status` unable to write its file, `card` unable to write its picture or to find a browser engine, `card` without `--out` on a machine with no `~/Downloads` folder, `card` over a window with no activity (`card --json` prints `null` and exits 0 instead), and whatever else goes wrong below the command line. Exit 2 is a usage error, such as a bad date, an unknown flag or a value flag given twice; it prints one line and a hint to `--help`.
149
+ A run that works exits 0, and so does a window with no data, which prints an empty grid, or `no activity on <date>` for one day. Exit 1 is a failure cogload can name, printed as one line to stderr that never contains a path: the projects directory missing or unreadable, `status` unable to write its file, `card` unable to write its picture or to find a browser engine, `card` without `--out` on a machine with no `~/Downloads` folder, `card` over a window with no activity (`card --json` prints `null` and exits 0 instead), and whatever else goes wrong below the command line. Exit 2 is a usage error, such as a bad date, an unknown flag or a value flag given twice; it prints one line and a hint to `--help`.
150
150
 
151
- ## Status line
151
+ ## Inside Claude Code
152
152
 
153
- A status line wants one number every thirty seconds and cannot wait half a second for a transcript scan, so cogload writes the number down and the status line reads it back. `cogload status` computes today exactly as `cogload today` does, writes it as one line of JSON to `~/.claude/cogload/status.json`, and prints the same line. Only `--projects`, `--no-cache` and `--verbose` apply, `--json` and `--no-color` change nothing, and the window flags, `--explain` and `--out` are usage errors. There is one file per user, whatever `--projects` said, created with mode `0600` in a directory with mode `0700`; the write goes to a temporary file and is renamed into place, so a reader sees the old line or the new one and never half of one. The file holds the nine values below and nothing else: no path, no project, no session count, no text.
153
+ The `cognitive-load` plugin draws the level of the last hour and your current streak above the Claude Code prompt:
154
154
 
155
- ```json
156
- {"schema":1,"asOf":"2026-09-19T12:30:38.300Z","date":"2026-09-19","hour":15,"index":36,"level":"Warming","peak":41,"activeMin":555,"streakMin":166}
155
+ ```
156
+ ● Heating · streak 20m
157
157
  ```
158
158
 
159
- | Field | Meaning |
160
- |---|---|
161
- | `schema` | The shape of this file: `1`. A reader that sees a number it does not know shows nothing. It changes only when a field changes meaning or goes away; adding a field does not bump it. A field that keeps its name, unit and range but is measured differently (the presence rule of 2026-09-19 for `activeMin` and `streakMin`) does not bump it either: a reader shows the corrected number, and the change is a CHANGELOG entry. |
162
- | `asOf` | When the snapshot was taken, ISO 8601 UTC: the `Day.asOf` of the base spec, the `now` of this run. A reader decides staleness from this field, never from the file's mtime. |
163
- | `date` | The local calendar day the numbers describe, `YYYY-MM-DD`. |
164
- | `hour` | The local hour that contains `asOf`, `0`..`23`. |
165
- | `index` | The load index of the sixty minutes ending at `asOf`, `0`..`100`, or `null` when they hold no session. It does not reset at an hour boundary: the hour buckets of `cogload today` are calendar hours, this one is the clock's last hour. |
166
- | `level` | That index's level, `Calm`, `Warming`, `Heating` or `Fried`, or `null` with `index`. A reader colors by this field so it never needs the thresholds. |
167
- | `peak` | The day's peak index so far, including the last sixty minutes, so it is never below `index`; `null` on a day with no activity. |
168
- | `activeMin` | Minutes of your presence in the day so far: the 5-minute slots covered by your actions and the gaps of at most 10 minutes between them; `0` on a day with no action of yours. |
169
- | `streakMin` | Minutes of your live presence streak as of `asOf`: from the streak's first action to `asOf`, when your last action is no more than 10 minutes before `asOf`; `0` once you have been away longer. It keeps growing while you sit there, and it does not reset at an hour boundary. |
170
-
171
- Refreshing is the reader's job, and cogload adds no hook, no timer and no daemon. A reader that finds the file stale or missing starts `cogload status` detached and draws what it has, which is also how the file first comes to exist on a machine that never ran cogload. The rest of the contract, from strict decoding to concurrent runs, is in [the status file spec](docs/superpowers/specs/2026-09-19-zapara-status-file-design.md). The `cognitive-load` plugin below reads it another way: it runs `cogload status` itself, after every turn and once a minute, and reads the line it prints.
172
-
173
- ## Inside Claude Code
174
-
175
- The `cognitive-load` plugin draws the same number above the Claude Code prompt:
159
+ When the band turns Heating and you want to know why, type `/cogload`. It runs `cogload today --json` and names what drives the last sixty minutes in counts:
176
160
 
177
161
  ```
178
- ▓ Heating 68 · peak 81 · streak 2h40 · active 6h15
162
+ Heating 80 this hour, at the cap: 16 decisions and 13 context switches, 32 prompts, a 57m streak.
163
+ This week: 2 rests, 1 override ("prod is down, fixing it").
179
164
  ```
180
165
 
166
+ The first line names every part of the score at its cap, heaviest weight first, or, with none at its cap, the one closest to it: `Warming 45 this hour, mostly 3 sessions at once.` With no scored hour it says `Nothing scored this hour.` The second line counts the rests and overrides of the last seven days and quotes the newest override's reason; with neither, it is left out. When `cogload` cannot start it prints the missing-`cogload` text below, and any other failure prints `cogload gave no reading.`
167
+
168
+ The index, the day's peak and the active time stay in `cogload` in a terminal. The first session after install shows one toast, `Keep your head cold. The dot above the prompt shows how hot this hour runs.`
169
+
181
170
  Install it from this repository's marketplace, in Claude Code:
182
171
 
183
172
  ```
@@ -185,17 +174,17 @@ Install it from this repository's marketplace, in Claude Code:
185
174
  /plugin install cognitive-load@cogload
186
175
  ```
187
176
 
188
- Coming from the `zapara` marketplace, remove it first (`/plugin marketplace remove zapara`). The plugin's own store starts over with the new marketplace, so a rest in progress ends and `/overrides` lists nothing until the next override.
177
+ Coming from the `zapara` marketplace, remove it first (`/plugin marketplace remove zapara`). The plugin's own store starts over with the new marketplace, so a rest in progress ends and the week's counts in `/cogload` start over.
189
178
 
190
- The plugin runs `cogload status` when a session starts and after every turn, and reads the load again every minute: from the reading another session of the plugin took less than a minute ago, or from a new run. So `cogload` has to be on the `PATH` Claude Code was started with; a Homebrew Bun leaves `~/.bun/bin` off it. The band is coloured by level, keeps only `▓ Heating 68` when it is under 50 columns wide, and is not drawn when the last sixty minutes are calm or hold no session. When a run fails, the band keeps the last good reading, or stays away if there is none, and the reason goes to Claude Code's debug log (`claude --debug`) as one of `not found`, `exit <code>`, `timeout` or `bad line`. The plugin is not part of the npm package; [its spec](docs/superpowers/specs/2026-10-03-zapara-cognitive-load-plugin-design.md) has the rest.
179
+ The plugin runs `cogload status` when a session starts and after every turn, and reads the load again every minute: from the reading another session of the plugin took less than a minute ago, or from a new run. It starts `cogload` from the `PATH` Claude Code was started with, and when that fails, `~/.bun/bin/cogload`: a Homebrew Bun, or the Desktop app opened from the Dock, can leave that directory off the `PATH`. The first time neither can start, a toast says `cogload is not on Claude Code's PATH: bun add -g @drakulavich/cogload`, once per install. The band starts with a dot in the level's colour, leaves out a zero streak, keeps only `● Heating` when it is under 50 columns wide, and is not drawn when the last sixty minutes hold no session. When a run fails, the band keeps the last good reading, or stays away if there is none, and the reason goes to Claude Code's debug log (`claude --debug`) as one of `not found`, `exit <code>`, `timeout` or `bad line`. The plugin is not part of the npm package; [its spec](docs/superpowers/specs/2026-10-03-zapara-cognitive-load-plugin-design.md) has the rest.
191
180
 
192
- The plugin also makes you rest. When a reading shows a presence streak of 40 minutes or a Fried hour, it holds every prompt you send, typed, queued or from a link in the transcript, in every session that runs it, for ten minutes: `Rest until 14:32 (7 min). Start with "override: <reason>" to go on.` The rest can start while you read, and the band counts it down, `rest until 14:32 (7 min)`. Ten minutes without a prompt is the gap that ends a streak in cogload, so the next one starts at zero. A streak makes you rest once. A first line `override: <reason>`, the reason at least three words, lifts it until that streak ends and sends what follows it; the band then counts `overrides this week`, and `/overrides` lists the last 14 days with their reasons, for the week's review. Answers to Claude's questions, slash commands, a running turn, and prompts from notifications, other sessions or scheduled tasks are never held. [The rest's spec](docs/superpowers/specs/2026-10-04-zapara-forced-rest-design.md) has the details.
181
+ The plugin also makes you rest. When a reading shows a presence streak of 40 minutes or a Fried hour, it holds every prompt you send, typed, queued or from a link in the transcript, in every session that runs it, for ten minutes. From the 35th minute of a streak that would start a rest, the band warns in place of the streak, `● Heating · rest in 5 min`, and counts down each minute. A held prompt you typed goes back into the box with `Rest until 14:32. Your prompt is saved.`; one from Remote Control gets `Rest until 14:32.` The first held prompt after install also adds `To go on now, start the prompt with "override: <reason>".` The rest can start while you read, and the band counts it down, `rest until 14:32 (7 min)`. Ten minutes without a prompt is the gap that ends a streak in cogload, so the next one starts at zero. A streak makes you rest once. A first line `override: <reason>`, the reason at least three words, lifts it until that streak ends and sends what follows it. A shorter reason, or none, gets `An override needs a reason of three words or more.`, and a typed prompt goes back into the box as a held one does. The band does not count overrides; `/cogload` counts the week's and quotes the newest reason. Answers to Claude's questions, slash commands, a running turn, and prompts from notifications, other sessions or scheduled tasks are never held. [The rest's spec](docs/superpowers/specs/2026-10-04-zapara-forced-rest-design.md) has the details.
193
182
 
194
183
  ## Privacy
195
184
 
196
185
  cogload reads `~/.claude/projects/**/*.jsonl`, skipping subagent transcripts under `subagents/`. It follows no symlink inside that directory, so a project directory that is a symlink is not read; `--projects` itself may be one. It picks files by modification time first, and opens one whose modification time is older than the window only to read the last timestamp in its final 64 KB; nothing from that tail is kept or printed. It compares message text against a few fixed markers, for interrupts, tool rejections and inbound agent messages, then discards it. What survives into an event is a timestamp, a session id, an event kind and a token count.
197
186
 
198
- cogload keeps, writes and prints no message text, prompt length, file path or session title. The CLI never prints a path it derived or read, not even the projects root when it cannot open it. It sends nothing anywhere, installs nothing into Claude Code, and writes no file except the card, the status file and the cache below. The optional `cognitive-load` plugin runs `cogload status` and keeps the nine values of its line in the session's state; it reads no transcript or tool call and never keeps or logs what the command printed. It reads the prompts you type only to hold them during a rest and to find an `override:` line. Its own store, a JSON file under Claude Code's configuration directory, keeps when the current rest ends, when the last resting streak began, and the time and reason of each override for 14 days; the reason is the only text it keeps. While it draws a PNG or WebP, the card's page also sits in the temporary directory as a `0600` file, removed when the render ends.
187
+ cogload keeps, writes and prints no message text, prompt length, file path or session title. The CLI never prints a path it derived or read, not even the projects root when it cannot open it. It sends nothing anywhere, installs nothing into Claude Code, and writes no file except the card, the status file and the cache below. The optional `cognitive-load` plugin runs `cogload status` and keeps the nine values of its line in the session's state; `/cogload` runs `cogload today --json` and prints only counts from it. The plugin reads no transcript or tool call and never keeps or logs what a command printed. It reads the prompts you type only to hold them during a rest and to find an `override:` line. Its own store, a JSON file under Claude Code's configuration directory, keeps when the current rest ends, when the last resting streak began, the start of each rest for 7 days, whether it has shown the override hint, the welcome and the missing-`cogload` toast (`taught`, `welcomed`, `missingShown`), and the time and reason of each override for 7 days; the reason is the only text it keeps. While it draws a PNG or WebP, the card's page also sits in the temporary directory as a `0600` file, removed when the render ends or is interrupted. A process killed outright (`kill -9`) leaves it there until the system clears the temporary directory.
199
188
 
200
189
  Between runs, cogload caches each transcript's parsed events in `~/.claude/cogload/cache.db`. A hit still reads the last 4 KiB of the file to confirm it matches the cached row, then skips reading and parsing the rest. So a changed file is recognised by its size, modification time and last 4 KiB: an edit earlier in the file that keeps its size and modification time is not seen, and `--no-cache` parses everything again. A row is keyed by the transcript's device and inode, never by its path or a hash of it. Besides the device and inode, a row stores a fingerprint of the parser that wrote it, the file's size and modification time, a hash of its last 4 KiB, the cutoff its events were parsed with, when the row was last used, and the parsed events themselves. No message text, prompt length, path or title is stored. `--no-cache` runs without reading or writing it.
201
190
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@drakulavich/cogload",
3
- "version": "0.10.0",
4
- "description": "Cognitive load index for people driving Claude Code, computed locally from transcripts",
3
+ "version": "0.12.0",
4
+ "description": "Keep your head cold. A thermometer for your Claude Code days: every hour scored 0 to 100 from the transcripts already on your disk. Nothing leaves your machine.",
5
5
  "license": "MIT",
6
6
  "author": "Anton Yakutovich",
7
7
  "repository": { "type": "git", "url": "git+https://github.com/drakulavich/cogload.git" },
package/src/cli/args.ts CHANGED
@@ -55,6 +55,7 @@ function resolveDate(what: string, s: string, now: Date): string {
55
55
  if (s === "today") return localDate(now);
56
56
  if (s === "yesterday") return localDate(new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1));
57
57
  if (!validDate(s)) throw new UsageError(`${what} must be YYYY-MM-DD, today or yesterday${got(s)}`);
58
+ if (s > localDate(now)) throw new UsageError(`${s} is in the future`);
58
59
  return s;
59
60
  }
60
61
 
@@ -147,9 +148,11 @@ export function parseArgs(argv: string[], now: Date, env: Record<string, string
147
148
  if (a.command !== "card" && a.out !== null) throw new UsageError("--out applies to card only");
148
149
  if (a.json && a.out !== null) throw new UsageError("--json writes no file; drop --out");
149
150
  if (a.out !== null) {
150
- // Printed back verbatim in `wrote \u2026`, so it must be one plain line.
151
+ // Its file name is printed back in `wrote \u2026`, so it must be one plain line.
151
152
  if (/[\x00-\x1f\x7f]/.test(a.out)) throw new UsageError("--out must not contain control characters");
152
153
  if (!/\.(png|webp|html)$/i.test(a.out)) throw new UsageError("--out must end in .png, .webp or .html");
154
+ const bare = /(?:^|[/\\])\.(png|webp|html)$/i.exec(a.out);
155
+ if (bare) throw new UsageError(`--out needs a file name before .${bare[1]}`);
153
156
  }
154
157
  return a;
155
158
  }
@@ -1,6 +1,6 @@
1
1
  import { statSync } from "node:fs";
2
2
  import { homedir } from "node:os";
3
- import { join } from "node:path";
3
+ import { basename, join } from "node:path";
4
4
  import { CardWriteError, cardData, cardHtml, loadAssets, openCard, renderCard, sentenceText } from "../lib/card/index.ts";
5
5
  import { report, type Timing } from "../lib/report/index.ts";
6
6
  import { renderStatus, statusOf, streakFrom, writeStatus } from "../lib/status/index.ts";
@@ -12,9 +12,9 @@ import type { Args } from "./args.ts";
12
12
  export async function table(a: Args, now: Date, cache: TranscriptCache | null, timing?: Timing): Promise<number> {
13
13
  const days: Day[] = await report({ projects: a.projects, to: a.to, days: a.days, now }, timing, cache);
14
14
  const data = a.command === "day" ? days[0] : days;
15
- if (a.json) console.log(renderJson(data!));
16
- else if (a.command === "day") console.log(renderDay(days[0]!, { explain: a.explain, color: a.color }));
17
- else console.log(renderWeek(days, a.color));
15
+ const text = a.json ? renderJson(data!) : a.command === "day" ? renderDay(days[0]!, { explain: a.explain, color: a.color }) : renderWeek(days, a.color);
16
+ // Not console.log: in Bun 1.4.2, once process.stdout is touched (isTTY in parseArgs), console.log into a pipe stops at 64 KiB.
17
+ process.stdout.write(`${text}\n`);
18
18
  return 0;
19
19
  }
20
20
 
@@ -29,9 +29,9 @@ export async function status(a: Args, now: Date, cache: TranscriptCache | null,
29
29
  return 0;
30
30
  }
31
31
 
32
- // The label names the folder, not the path: the CLI never prints a derived path.
32
+ // The label names a file or folder, never a path: the CLI prints no path, not even one typed in.
33
33
  function cardTarget(out: string | null): { path: string; label: string; unwritable?: string } {
34
- if (out !== null) return { path: out, label: out };
34
+ if (out !== null) return { path: out, label: basename(out) };
35
35
  const dir = join(homedir(), "Downloads");
36
36
  let isDir = false;
37
37
  try { isDir = statSync(dir).isDirectory(); } catch {}
package/src/cli/index.ts CHANGED
@@ -42,7 +42,8 @@ async function main(): Promise<number> {
42
42
  }
43
43
 
44
44
  export function start(): void {
45
- main().then((code) => process.exit(code), (e: unknown) => {
45
+ // exitCode, not exit(): exit() drops output still queued for a pipe.
46
+ main().then((code) => { process.exitCode = code; }, (e: unknown) => {
46
47
  if (e instanceof HelpRequested) { console.log(USAGE); process.exit(0); }
47
48
  if (e instanceof VersionRequested) {
48
49
  try { console.log(version()); process.exit(0); }
package/src/cli/timing.ts CHANGED
@@ -7,7 +7,7 @@ export function timingLines(t: Timing, env: { version: string; bun: string; plat
7
7
  return `cogload ${env.version} · bun ${env.bun} · ${env.platform} ${env.arch} · ${env.cpus} cpus\n`
8
8
  + row("start", "bun, modules, arguments", t.startMs ?? 0)
9
9
  + (t.openMs !== undefined ? row("open", "cache", t.openMs) : "")
10
- + row("scan", `${plural(t.files, "file")}, ${t.inWindow} in window, ${plural(t.tailChecks, "tail check")}`, t.scanMs)
10
+ + row("scan", `${plural(t.files, "file")}, ${t.inWindow} in window, ${plural(t.tailChecks, "tail check")}${t.skipped ? `, ${t.skipped} unreadable skipped` : ""}`, t.scanMs)
11
11
  + (t.cache ? row("cache", `${plural(t.cache.hits, "hit")}, ${plural(t.cache.misses, "miss", "misses")}`, t.lookupMs) : `${"cache".padEnd(8)}off\n`)
12
12
  + row("read", `${plural(t.read, "file")}, ${(t.bytes / 1e6).toFixed(1)} MB, ${READERS} at a time`, t.readMs)
13
13
  + row("analyze", "", t.analyzeMs)
@@ -65,7 +65,7 @@ ${fontFace("Inter", 400, assets.fonts.inter400)}
65
65
  ${fontFace("Inter", 700, assets.fonts.inter700)}
66
66
  ${fontFace("Inter", 800, assets.fonts.inter800)}
67
67
  ${fontFace("JetBrains Mono", 500, assets.fonts.mono500)}
68
- :root{--ink:#f5f5f7;--muted:#a1a1aa;--dim:#6b6b76;--line:rgba(255,255,255,.10);--accent:${accent.main};--accent2:${accent.light};--accent-rgb:${accent.rgb};--calm:#7ee2a3;--warm:#fbd77a;--heat:#c4a0ff;--fried:#ff6b8f}
68
+ :root{--ink:#f5f5f7;--muted:#a1a1aa;--dim:#6b6b76;--line:rgba(255,255,255,.10);--accent:${accent.main};--accent2:${accent.light};--accent-rgb:${accent.rgb};--calm:#7ee2a3;--warm:#fbd77a;--heat:#ff8700;--fried:#ff4d4d}
69
69
  html{zoom:2}
70
70
  html,body{margin:0;background:#000}
71
71
  .card{position:relative;width:1200px;height:630px;overflow:hidden;font-family:Inter,-apple-system,system-ui,sans-serif;color:var(--ink);-webkit-font-smoothing:antialiased;background:#07070a}
@@ -36,7 +36,7 @@ async function readWhole(entry: ScanEntry): Promise<Read> {
36
36
  export async function report(o: ReportOptions, timing?: Timing, cache?: TranscriptCache | null): Promise<Day[]> {
37
37
  const window = { to: o.to, days: o.days, now: o.now, streakFrom: o.streakFrom };
38
38
  const { cutoffMs } = windowBounds(window);
39
- const stats: ScanStats = { files: 0, tailChecks: 0 };
39
+ const stats: ScanStats = { files: 0, tailChecks: 0, skipped: 0 };
40
40
  let t = performance.now();
41
41
  const entries = await scan(o.projects, cutoffMs, stats);
42
42
  const scanMs = performance.now() - t;
@@ -56,7 +56,7 @@ export async function report(o: ReportOptions, timing?: Timing, cache?: Transcri
56
56
  const r = await readWhole(entry);
57
57
  bytes += r.bytes.length;
58
58
  reads.set(entry.path, r);
59
- } catch { /* vanished or unreadable: skip */ }
59
+ } catch { stats.skipped++; }
60
60
  }
61
61
  };
62
62
  await Promise.all(Array.from({ length: Math.min(READERS, misses.length) }, reader));
@@ -3,7 +3,7 @@ import { levelOf } from "../metrics/index.ts";
3
3
  import type { Day, HourBucket, Level } from "../types.ts";
4
4
 
5
5
  const GLYPH: Record<Level, string> = { Calm: "░", Warming: "▒", Heating: "▓", Fried: "█" };
6
- const ANSI: Record<Level, string> = { Calm: "32", Warming: "33", Heating: "35", Fried: "31" };
6
+ const ANSI: Record<Level, string> = { Calm: "32", Warming: "33", Heating: "38;5;208", Fried: "31" };
7
7
  const LEVEL_NAME: Record<Level, string> = { Calm: "calm", Warming: "warming", Heating: "heating", Fried: "fried" };
8
8
  const LEVELS: Level[] = ["Calm", "Warming", "Heating", "Fried"];
9
9
  const WEEKDAY = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
@@ -94,7 +94,7 @@ export function renderDay(day: Day, opts: { explain: boolean; color: boolean }):
94
94
  const active = day.buckets.filter((b) => b.score !== null);
95
95
  // The snapshot line still shows on an empty open day, or a run at 09:00 and
96
96
  // one at 18:00 would print the identical line.
97
- if (active.length === 0) return [line(cols, cols.map(([name]) => name)), ...snapshotLine(day, opts.color)].join("\n");
97
+ if (active.length === 0) return [`no activity on ${day.date}`, ...snapshotLine(day, opts.color)].join("\n");
98
98
 
99
99
  const visible = cols.filter(([name, , f]) => !EVENT_COLS.has(name) || active.some((b) => f(b) !== "0"));
100
100
  const leftOut = cols.filter((col) => EVENT_COLS.has(col[0]) && !visible.includes(col));
@@ -2,13 +2,14 @@ import { constants, type Dirent } from "node:fs";
2
2
  import { access, open, readdir, stat } from "node:fs/promises";
3
3
  import { join } from "node:path";
4
4
 
5
- // What --verbose reports about the walk: transcripts seen, and how many of them
6
- // were opened only to read the tail of a file older than the window by mtime.
7
- export type ScanStats = { files: number; tailChecks: number };
5
+ // What --verbose reports about the walk: transcripts seen, how many of them
6
+ // were opened only to read the tail of a file older than the window by mtime,
7
+ // and how many files or directories could not be read.
8
+ export type ScanStats = { files: number; tailChecks: number; skipped: number };
8
9
  export type ScanEntry = { path: string; dev: number; ino: number; size: number; mtimeMs: number };
9
10
 
10
11
  // A `subagents` directory holds the parent agent's conversation, not the human's.
11
- export async function scan(projects: string, cutoffMs: number, stats: ScanStats = { files: 0, tailChecks: 0 }): Promise<ScanEntry[]> {
12
+ export async function scan(projects: string, cutoffMs: number, stats: ScanStats = { files: 0, tailChecks: 0, skipped: 0 }): Promise<ScanEntry[]> {
12
13
  // No path in any message: the CLI never prints one. A directory that can be
13
14
  // listed but not entered (mode 444) would otherwise read as one with no activity.
14
15
  let root;
@@ -36,7 +37,7 @@ async function collect(dir: string, entries: Dirent[], cutoffMs: number, out: Sc
36
37
  if (entry.name === "subagents") continue;
37
38
  try {
38
39
  await collect(full, await readdir(full, { withFileTypes: true }), cutoffMs, out, stats);
39
- } catch {}
40
+ } catch { stats.skipped++; }
40
41
  } else if (entry.isFile() && entry.name.endsWith(".jsonl")) {
41
42
  stats.files++;
42
43
  try {
@@ -46,7 +47,7 @@ async function collect(dir: string, entries: Dirent[], cutoffMs: number, out: Sc
46
47
  if ((await lastTimestampMs(full)) < cutoffMs) continue;
47
48
  }
48
49
  out.push({ path: full, dev: st.dev, ino: st.ino, size: st.size, mtimeMs: st.mtimeMs });
49
- } catch {}
50
+ } catch { stats.skipped++; }
50
51
  }
51
52
  }
52
53
  }