@phren/cli 0.2.3 → 0.2.4

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.
@@ -102,6 +102,13 @@ export declare class GraphController {
102
102
  readonly mascot: GraphMascot;
103
103
  /** Space opens the selected node's full text in a bubble on the canvas. */
104
104
  reader: boolean;
105
+ private knowsCache;
106
+ /**
107
+ * The "What phren knows" paragraph for a project, written by
108
+ * `phren maintain summarize`; null until it has run. Read once per project
109
+ * per data load, so the pane can show it on every frame.
110
+ */
111
+ knowsFor(project: string): string | null;
105
112
  /**
106
113
  * v: the same graph as a sphere. Selection, search, watch mode and the
107
114
  * neighbour numbers all keep working; the camera orbits instead of panning.
@@ -18,6 +18,7 @@ import { GraphWatch } from "./watch.js";
18
18
  import { GraphAgents } from "./agents.js";
19
19
  import { GraphMascot } from "./mascot.js";
20
20
  import { LIVE_BUBBLE_MS } from "./bubble.js";
21
+ import { readKnowsBlock } from "../../content/summarize.js";
21
22
  import { DEFAULT_ORBIT, PITCH_LIMIT, buildOrbitLayout, parseMouse, projectOrbit, yawDelta, yawToFace } from "./orbit.js";
22
23
  /** Left alone in orbit for this long, the sphere starts turning on its own. */
23
24
  const IDLE_SPIN_MS = 6000;
@@ -103,6 +104,25 @@ export class GraphController {
103
104
  mascot = new GraphMascot();
104
105
  /** Space opens the selected node's full text in a bubble on the canvas. */
105
106
  reader = false;
107
+ knowsCache = new Map();
108
+ /**
109
+ * The "What phren knows" paragraph for a project, written by
110
+ * `phren maintain summarize`; null until it has run. Read once per project
111
+ * per data load, so the pane can show it on every frame.
112
+ */
113
+ knowsFor(project) {
114
+ if (!this.knowsCache.has(project)) {
115
+ let text = null;
116
+ try {
117
+ text = readKnowsBlock(this.phrenPath, project)?.text.replace(/^## What phren knows\s*/m, "").trim() ?? null;
118
+ }
119
+ catch {
120
+ text = null;
121
+ }
122
+ this.knowsCache.set(project, text);
123
+ }
124
+ return this.knowsCache.get(project) ?? null;
125
+ }
106
126
  /**
107
127
  * v: the same graph as a sphere. Selection, search, watch mode and the
108
128
  * neighbour numbers all keep working; the camera orbits instead of panning.
@@ -334,6 +354,7 @@ export class GraphController {
334
354
  if (warm && this.lastPositions.size)
335
355
  this.sim.warmStart(this.lastPositions);
336
356
  this.mascot.reset();
357
+ this.knowsCache.clear();
337
358
  // Settle before anyone sees it. Animating the relaxation instead — ticking
338
359
  // a few steps, framing the half-settled positions, then letting the rest
339
360
  // play out under a fixed camera — read as the whole cluster bouncing for a
@@ -356,7 +356,8 @@ function planBubbles(controller, cols, rows, selected) {
356
356
  const at = controller.projectNode(selected.id);
357
357
  if (!at)
358
358
  return [];
359
- const text = selected.fullLabel || selected.label;
359
+ const knows = selected.kind === "project" && selected.project ? controller.knowsFor(selected.project) : null;
360
+ const text = knows ? knows.replace(/\*\*/g, "").replace(/^- /gm, "• ") : (selected.fullLabel || selected.label);
360
361
  const anchor = toCell(at);
361
362
  const maxInner = Math.min(64, cols - BUBBLE_CHROME_COLS - 2);
362
363
  const maxRows = rows - BUBBLE_CHROME_ROWS - 1;
@@ -496,6 +497,23 @@ function renderPane(controller, selected, width, height) {
496
497
  if (selected.kind === "project") {
497
498
  row("findings", String(selected.findingCount ?? 0));
498
499
  row("tasks", String(selected.taskCount ?? 0));
500
+ const knows = selected.project ? controller.knowsFor(selected.project) : null;
501
+ if (knows) {
502
+ push();
503
+ push(style.dim("what phren knows"));
504
+ const bullets = knows.split("\n").filter((l) => l.startsWith("- ")).map((l) => l.slice(2).replace(/\*\*/g, ""));
505
+ const budget = Math.max(3, Math.floor(height * 0.28));
506
+ let used = 0;
507
+ for (const b of bullets) {
508
+ const lines = wrapText(b, inner - 2, 3);
509
+ if (used + lines.length > budget)
510
+ break;
511
+ lines.forEach((l, i) => push(`${i === 0 ? "· " : " "}${l}`));
512
+ used += lines.length;
513
+ }
514
+ if (bullets.length > 1)
515
+ push(`${style.boldCyan("␣")} ${style.dim("read all of it")}`);
516
+ }
499
517
  if (selected.store && selected.store !== "primary")
500
518
  row("store", selected.store);
501
519
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Knowledge layer for AI agents — CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {