polymath-society 0.2.28 → 0.2.29

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.
Files changed (2) hide show
  1. package/dist/cli.js +30 -21
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -22884,11 +22884,11 @@ function stages(o) {
22884
22884
  // so they run WHILE grading runs (grading is the wall-clock giant; these
22885
22885
  // finish inside its shadow). Budget: grade 8 + digest 3 + walkthrough 3 +
22886
22886
  // two single-call stages ≈ 16 peak subprocesses (measured-safe envelope).
22887
- { script: "coding-grade.mts", label: "AI-grade every substantial session", llm: true, weight: 30, args: gradeArgs, batch: "heavy" },
22888
- { script: "coding-day-digest.mts", label: "Day-by-day digests", llm: true, weight: 17, args: ["--model", narrativeModel, "--conc", String(h.digest)], out: "coding/day-digest.json", batch: "heavy" },
22889
- // walkthrough weight 28 = was 55 at 2 workers, ~28 at the rebalanced 4
22890
- { script: "coding-walkthrough.mts", label: "Per-session walkthroughs", llm: true, weight: 28, args: ["--model", narrativeModel, "--conc", String(h.walkthrough)], batch: "heavy" },
22891
- { script: "coding-frontier-detail.mts", label: "What you're doing at the frontier", llm: true, weight: 3, args: [], out: "coding/frontier-detail.json", batch: "heavy" },
22887
+ { script: "coding-grade.mts", label: "AI-grade every substantial session", llm: true, weight: 32, args: gradeArgs, batch: "heavy" },
22888
+ { script: "coding-day-digest.mts", label: "Day-by-day digests", llm: true, weight: 19, args: ["--model", narrativeModel, "--conc", String(h.digest)], out: "coding/day-digest.json", batch: "heavy" },
22889
+ // walkthrough weight 38 = MEASURED on the rebalanced 4 workers (2026-07-23 clean run; the 2→4 speedup was 1.5x, not 2x)
22890
+ { script: "coding-walkthrough.mts", label: "Per-session walkthroughs", llm: true, weight: 38, args: ["--model", narrativeModel, "--conc", String(h.walkthrough)], batch: "heavy" },
22891
+ { script: "coding-frontier-detail.mts", label: "What you're doing at the frontier", llm: true, weight: 2, args: [], out: "coding/frontier-detail.json", batch: "heavy" },
22892
22892
  { script: "coding-delegation.mts", label: "Delegation patterns", llm: true, weight: 2, args: ["--model", model, "--conc", String(h.delegation)], out: "coding/delegation-rollup.json", batch: "heavy" },
22893
22893
  // The FULL focus stage: flow-rule judgment + the paste-into-CLAUDE.md block.
22894
22894
  // The deterministic --skip-llm run above keeps the numbers current every
@@ -22925,7 +22925,7 @@ function stages(o) {
22925
22925
  // calls — it deliberately ignores the AI recency window and covers the full
22926
22926
  // history); disjoint output, so it rides the synthesis batch. Like
22927
22927
  // agglomerate it defaults itself to Opus; an explicit model choice wins.
22928
- { script: "coding-growth.mts", label: "Growth arcs + learning rate", llm: true, weight: 5, args: o.model ? ["--model", o.model] : [], out: "coding/growth.json", batch: "synthesis" },
22928
+ { script: "coding-growth.mts", label: "Growth arcs + learning rate", llm: true, weight: 3, args: o.model ? ["--model", o.model] : [], out: "coding/growth.json", batch: "synthesis" },
22929
22929
  // nutshell stays LAST + alone: it merges INTO aggregate.json while the two
22930
22930
  // above read the compiled profile — racing them re-reads mid-write.
22931
22931
  { script: "coding-nutshell.mts", label: "Big-picture nutshell", llm: true, weight: 1, args: [], out: "coding/aggregate.json" }
@@ -23103,6 +23103,10 @@ async function runPipeline(o) {
23103
23103
  }
23104
23104
  const dataRoot = codingDataRoot(o.repoRoot);
23105
23105
  const env = { ...process.env, POLYMATH_RESILIENT: "1", POLYMATH_DATA_DIR: dataRoot };
23106
+ if (!/max-old-space-size/.test(env.NODE_OPTIONS ?? "")) {
23107
+ const headroomMb = Math.min(12288, Math.max(4096, Math.round(os8.totalmem() / 2 ** 20 * 0.6)));
23108
+ env.NODE_OPTIONS = `${env.NODE_OPTIONS ?? ""} --max-old-space-size=${headroomMb}`.trim();
23109
+ }
23106
23110
  if (!o.overnight) env.POLYMATH_RESILIENT_NO_WINDOW = "1";
23107
23111
  const stopKeepAwake = o.overnight ? startKeepAwake() : () => {
23108
23112
  };
@@ -23220,6 +23224,7 @@ __export(chatPipeline_exports, {
23220
23224
  runChatPipeline: () => runChatPipeline
23221
23225
  });
23222
23226
  import { spawn as spawn8 } from "child_process";
23227
+ import os9 from "os";
23223
23228
  import path39 from "path";
23224
23229
  import { existsSync as existsSync6, promises as fs33 } from "fs";
23225
23230
  import { fileURLToPath as fileURLToPath4 } from "url";
@@ -23323,6 +23328,10 @@ async function runChatPipeline(o) {
23323
23328
  AGENT_MODEL: o.model ?? process.env.AGENT_MODEL ?? "sonnet"
23324
23329
  };
23325
23330
  if (!o.overnight) env.POLYMATH_RESILIENT_NO_WINDOW = "1";
23331
+ if (!/max-old-space-size/.test(env.NODE_OPTIONS ?? "")) {
23332
+ const headroomMb = Math.min(12288, Math.max(4096, Math.round(os9.totalmem() / 2 ** 20 * 0.6)));
23333
+ env.NODE_OPTIONS = `${env.NODE_OPTIONS ?? ""} --max-old-space-size=${headroomMb}`.trim();
23334
+ }
23326
23335
  const failed = [];
23327
23336
  const ingested = [];
23328
23337
  const notIngestable = [];
@@ -24047,7 +24056,7 @@ __export(plan_exports, {
24047
24056
  tierFromStrings: () => tierFromStrings
24048
24057
  });
24049
24058
  import { promises as fs36 } from "fs";
24050
- import os9 from "os";
24059
+ import os10 from "os";
24051
24060
  import path42 from "path";
24052
24061
  function supportsFullAnalysis(tier) {
24053
24062
  if (process.env.POLYMATH_FORCE_FULL === "1") return true;
@@ -24072,7 +24081,7 @@ function tierFromChatgptPlan(planType) {
24072
24081
  if (s === "free") return "gpt_free";
24073
24082
  return "unknown";
24074
24083
  }
24075
- async function detectCodexPlan(home = os9.homedir()) {
24084
+ async function detectCodexPlan(home = os10.homedir()) {
24076
24085
  try {
24077
24086
  const raw = JSON.parse(await fs36.readFile(path42.join(home, ".codex", "auth.json"), "utf8"));
24078
24087
  for (const tok of [raw.tokens?.id_token, raw.tokens?.access_token]) {
@@ -24088,7 +24097,7 @@ async function detectCodexPlan(home = os9.homedir()) {
24088
24097
  }
24089
24098
  return "unknown";
24090
24099
  }
24091
- async function detectPlan(home = os9.homedir()) {
24100
+ async function detectPlan(home = os10.homedir()) {
24092
24101
  let tier = "unknown";
24093
24102
  try {
24094
24103
  const raw = JSON.parse(await fs36.readFile(path42.join(home, ".claude.json"), "utf8"));
@@ -24200,7 +24209,7 @@ __export(wizard_exports, {
24200
24209
  scanJsonlDir: () => scanJsonlDir
24201
24210
  });
24202
24211
  import { promises as fs37 } from "fs";
24203
- import os10 from "os";
24212
+ import os11 from "os";
24204
24213
  import path43 from "path";
24205
24214
  import * as readline from "node:readline/promises";
24206
24215
  async function scanJsonlDir(label, dir, maxDepth = 1) {
@@ -24393,7 +24402,7 @@ async function runWizard() {
24393
24402
  for (let i = 0; i < agentScans.length; i++) {
24394
24403
  const s = agentScans[i];
24395
24404
  const idx = present.indexOf(agentIds[i]);
24396
- say(s.files > 0 ? ` ${idx + 1}. ${green("\u2713")} ${bold(s.label)} \u2014 ${s.files.toLocaleString()} log files \xB7 newest ${s.newest} ${dim(s.dir.replace(os10.homedir(), "~"))}` : ` ${dim("\xB7")} ${dim(`${s.label} \u2014 none found`)} ${dim(s.dir.replace(os10.homedir(), "~"))}`);
24405
+ say(s.files > 0 ? ` ${idx + 1}. ${green("\u2713")} ${bold(s.label)} \u2014 ${s.files.toLocaleString()} log files \xB7 newest ${s.newest} ${dim(s.dir.replace(os11.homedir(), "~"))}` : ` ${dim("\xB7")} ${dim(`${s.label} \u2014 none found`)} ${dim(s.dir.replace(os11.homedir(), "~"))}`);
24397
24406
  }
24398
24407
  say(dim(" (log files include forks and agent runs \u2014 the report separates your real sessions out)"));
24399
24408
  if (present.length === 0) {
@@ -24476,9 +24485,9 @@ async function runWizard() {
24476
24485
  }
24477
24486
  };
24478
24487
  say(dim(" Scanning for known export formats (Spotlight + the usual folders, a few seconds)..."));
24479
- for (const c of await deterministicDiscover(os10.homedir())) add(await identifyPath(c));
24480
- for (const f of await scanForExports(path43.join(os10.homedir(), "Downloads"))) add(f);
24481
- for (const f of await scanForObsidianVaults(os10.homedir())) add(f);
24488
+ for (const c of await deterministicDiscover(os11.homedir())) add(await identifyPath(c));
24489
+ for (const f of await scanForExports(path43.join(os11.homedir(), "Downloads"))) add(f);
24490
+ for (const f of await scanForObsidianVaults(os11.homedir())) add(f);
24482
24491
  for (const f of [...previous?.exports.included ?? [], ...previous?.exports.excluded ?? []]) add(f);
24483
24492
  let linksShown = false;
24484
24493
  if (!found.length) {
@@ -24489,7 +24498,7 @@ async function runWizard() {
24489
24498
  try {
24490
24499
  const { invokeAgent: invokeAgent3 } = await Promise.resolve().then(() => (init_agent(), agent_exports));
24491
24500
  say(dim(" Searching (your agent writes its own filesystem searches; nothing leaves this machine; 90s max)..."));
24492
- const candidates = await agentDiscoverCandidates((inv) => invokeAgent3(inv), os10.homedir(), []);
24501
+ const candidates = await agentDiscoverCandidates((inv) => invokeAgent3(inv), os11.homedir(), []);
24493
24502
  for (const c of candidates) add(await identifyPath(c));
24494
24503
  } catch (e) {
24495
24504
  say(dim(` Agent search unavailable (${e instanceof Error ? e.message.slice(0, 80) : "failed"}).`));
@@ -24497,7 +24506,7 @@ async function runWizard() {
24497
24506
  }
24498
24507
  if (!found.length) {
24499
24508
  const folder = await ask(` Got them in a specific folder? ${dim("(path, or Enter to skip)")}: `);
24500
- if (folder) for (const f of await scanForExports(folder.replace(/^~(?=$|\/)/, os10.homedir()))) add(f);
24509
+ if (folder) for (const f of await scanForExports(folder.replace(/^~(?=$|\/)/, os11.homedir()))) add(f);
24501
24510
  }
24502
24511
  }
24503
24512
  if (found.length) {
@@ -24522,7 +24531,7 @@ async function runWizard() {
24522
24531
  approvedExports = manifest.exports.included;
24523
24532
  await writeManifest(dataDir, manifest);
24524
24533
  const nIn = manifest.exports.included.length;
24525
- say(` ${green("\u2713")} Saved to ${path43.join(dataDir, "exports-manifest.json").replace(os10.homedir(), "~")} \u2014 ${nIn} source${nIn === 1 ? "" : "s"} approved, ${manifest.exports.excluded.length} excluded (re-run anytime to change).`);
24534
+ say(` ${green("\u2713")} Saved to ${path43.join(dataDir, "exports-manifest.json").replace(os11.homedir(), "~")} \u2014 ${nIn} source${nIn === 1 ? "" : "s"} approved, ${manifest.exports.excluded.length} excluded (re-run anytime to change).`);
24526
24535
  for (const f of manifest.exports.excluded) say(` ${dim(`\u2717 ${path43.basename(f.path)} \u2014 excluded, never read past identification.`)}`);
24527
24536
  if (manifest.exports.included.some((f) => f.kind !== "unknown")) {
24528
24537
  say(` ${dim("These are ingested and analyzed locally when you pick the full analysis below.")}`);
@@ -24731,9 +24740,9 @@ async function addSourcesFlow(dataDir, say, rl) {
24731
24740
  found.push(f);
24732
24741
  }
24733
24742
  };
24734
- for (const c of await deterministicDiscover(os10.homedir())) add(await identifyPath(c));
24735
- for (const f of await scanForExports(path43.join(os10.homedir(), "Downloads"))) add(f);
24736
- for (const f of await scanForObsidianVaults(os10.homedir())) add(f);
24743
+ for (const c of await deterministicDiscover(os11.homedir())) add(await identifyPath(c));
24744
+ for (const f of await scanForExports(path43.join(os11.homedir(), "Downloads"))) add(f);
24745
+ for (const f of await scanForObsidianVaults(os11.homedir())) add(f);
24737
24746
  for (const f of [...previous?.exports.included ?? [], ...previous?.exports.excluded ?? []]) {
24738
24747
  if (await fs37.stat(f.path).then(() => true, () => false)) add(f);
24739
24748
  }
@@ -28540,7 +28549,7 @@ Running the full analysis on ${backend.name === "cli" ? "Claude Code" : "Codex"}
28540
28549
  codingLane.stageDone(key2);
28541
28550
  const f = codingFrac();
28542
28551
  codingLane.setFrac(f);
28543
- progress.coding = { ...progress.coding, i: Math.min(aiDone.coding + 1, aiCount.coding), total: aiCount.coding, done: false, frac: f, withinFrac: Math.round(sumFracs("coding") * 1e3) / 1e3 };
28552
+ progress.coding = { ...progress.coding, label: progress.coding?.label ?? label, i: Math.min(aiDone.coding + 1, aiCount.coding), total: aiCount.coding, done: false, frac: f, withinFrac: Math.round(sumFracs("coding") * 1e3) / 1e3 };
28544
28553
  earlyHandle.setProgress(progress);
28545
28554
  },
28546
28555
  // While pinned, the scrolling stage output stays quiet ("prints hella
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polymath-society",
3
- "version": "0.2.28",
3
+ "version": "0.2.29",
4
4
  "description": "Deterministic metrics from your local Claude Code / Codex agent logs — parallelism, flow, throughput, projects. Zero LLM, zero server, on-device.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",