polymath-society 0.2.4 → 0.2.5

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.
@@ -135,7 +135,7 @@ var require_secure_json_parse = __commonJS({
135
135
 
136
136
  // ../../scripts/coding-grade.mts
137
137
  import { promises as fs6 } from "fs";
138
- import path10 from "path";
138
+ import path11 from "path";
139
139
 
140
140
  // ../../lib/agents/coding/grade.ts
141
141
  import { promises as fs5 } from "fs";
@@ -2155,8 +2155,8 @@ function getErrorMap() {
2155
2155
 
2156
2156
  // ../../node_modules/zod/v3/helpers/parseUtil.js
2157
2157
  var makeIssue = (params) => {
2158
- const { data, path: path11, errorMaps, issueData } = params;
2159
- const fullPath = [...path11, ...issueData.path || []];
2158
+ const { data, path: path12, errorMaps, issueData } = params;
2159
+ const fullPath = [...path12, ...issueData.path || []];
2160
2160
  const fullIssue = {
2161
2161
  ...issueData,
2162
2162
  path: fullPath
@@ -2272,11 +2272,11 @@ var errorUtil;
2272
2272
 
2273
2273
  // ../../node_modules/zod/v3/types.js
2274
2274
  var ParseInputLazyPath = class {
2275
- constructor(parent, value, path11, key) {
2275
+ constructor(parent, value, path12, key) {
2276
2276
  this._cachedPath = [];
2277
2277
  this.parent = parent;
2278
2278
  this.data = value;
2279
- this._path = path11;
2279
+ this._path = path12;
2280
2280
  this._key = key;
2281
2281
  }
2282
2282
  get path() {
@@ -15063,39 +15063,39 @@ function createOpenAI(options = {}) {
15063
15063
  });
15064
15064
  const createChatModel = (modelId, settings = {}) => new OpenAIChatLanguageModel(modelId, settings, {
15065
15065
  provider: `${providerName}.chat`,
15066
- url: ({ path: path11 }) => `${baseURL}${path11}`,
15066
+ url: ({ path: path12 }) => `${baseURL}${path12}`,
15067
15067
  headers: getHeaders,
15068
15068
  compatibility,
15069
15069
  fetch: options.fetch
15070
15070
  });
15071
15071
  const createCompletionModel = (modelId, settings = {}) => new OpenAICompletionLanguageModel(modelId, settings, {
15072
15072
  provider: `${providerName}.completion`,
15073
- url: ({ path: path11 }) => `${baseURL}${path11}`,
15073
+ url: ({ path: path12 }) => `${baseURL}${path12}`,
15074
15074
  headers: getHeaders,
15075
15075
  compatibility,
15076
15076
  fetch: options.fetch
15077
15077
  });
15078
15078
  const createEmbeddingModel = (modelId, settings = {}) => new OpenAIEmbeddingModel(modelId, settings, {
15079
15079
  provider: `${providerName}.embedding`,
15080
- url: ({ path: path11 }) => `${baseURL}${path11}`,
15080
+ url: ({ path: path12 }) => `${baseURL}${path12}`,
15081
15081
  headers: getHeaders,
15082
15082
  fetch: options.fetch
15083
15083
  });
15084
15084
  const createImageModel = (modelId, settings = {}) => new OpenAIImageModel(modelId, settings, {
15085
15085
  provider: `${providerName}.image`,
15086
- url: ({ path: path11 }) => `${baseURL}${path11}`,
15086
+ url: ({ path: path12 }) => `${baseURL}${path12}`,
15087
15087
  headers: getHeaders,
15088
15088
  fetch: options.fetch
15089
15089
  });
15090
15090
  const createTranscriptionModel = (modelId) => new OpenAITranscriptionModel(modelId, {
15091
15091
  provider: `${providerName}.transcription`,
15092
- url: ({ path: path11 }) => `${baseURL}${path11}`,
15092
+ url: ({ path: path12 }) => `${baseURL}${path12}`,
15093
15093
  headers: getHeaders,
15094
15094
  fetch: options.fetch
15095
15095
  });
15096
15096
  const createSpeechModel = (modelId) => new OpenAISpeechModel(modelId, {
15097
15097
  provider: `${providerName}.speech`,
15098
- url: ({ path: path11 }) => `${baseURL}${path11}`,
15098
+ url: ({ path: path12 }) => `${baseURL}${path12}`,
15099
15099
  headers: getHeaders,
15100
15100
  fetch: options.fetch
15101
15101
  });
@@ -15116,7 +15116,7 @@ function createOpenAI(options = {}) {
15116
15116
  const createResponsesModel = (modelId) => {
15117
15117
  return new OpenAIResponsesLanguageModel(modelId, {
15118
15118
  provider: `${providerName}.responses`,
15119
- url: ({ path: path11 }) => `${baseURL}${path11}`,
15119
+ url: ({ path: path12 }) => `${baseURL}${path12}`,
15120
15120
  headers: getHeaders,
15121
15121
  fetch: options.fetch
15122
15122
  });
@@ -16116,6 +16116,165 @@ function partition(sessions) {
16116
16116
  return { gradable, thin, trivial };
16117
16117
  }
16118
16118
 
16119
+ // ../../lib/agents/coding/profile.ts
16120
+ import path10 from "path";
16121
+
16122
+ // ../../lib/agents/coding/walkthrough.ts
16123
+ var IDLE_CAP_MS = 12 * 6e4;
16124
+
16125
+ // ../coding-core/dist/words.js
16126
+ var NOTE = "((ran|created|edited|read|wrote|searched) (a|an|\\d+) [a-z]+|updated todos)";
16127
+ var TRANSCRIPT_LINE_RE = new RegExp(`^\\s*(${NOTE})((,| and) ${NOTE})*\\s*$|^\\s*thought for .{1,30}$`, "im");
16128
+
16129
+ // ../../lib/calibration/index.ts
16130
+ var DEFAULT_CALIBRATION = {
16131
+ version: "2026-07-12.2",
16132
+ // = RUBRIC_FINGERPRINT of the shipped npm rubric (packages/coding-analyzer/
16133
+ // src/grade/criteria.ts). A unit test fails loud when the rubric changes
16134
+ // without this being updated (and re-pushed to the server).
16135
+ rubricVersion: "f51b3a93a3",
16136
+ // Canonical scale = the one the product owner set for the public report
16137
+ // (11=0.01% … 8=2%), extended downward from the old report ladder. The old
16138
+ // CodeAnalysisView / npm-viewer maps (7→10%/15%, 6→25%/30%) were drift, not
16139
+ // intent.
16140
+ scoreBands: [
16141
+ { score: 11, label: "Top 0.01%" },
16142
+ { score: 10, label: "Top 0.1%" },
16143
+ { score: 9, label: "Top 0.5%" },
16144
+ { score: 8, label: "Top 2%" },
16145
+ { score: 7, label: "Top 5%" },
16146
+ { score: 6, label: "Top 15%" },
16147
+ { score: 5, label: "Top 50%" },
16148
+ { score: 4, label: "Top 65%" },
16149
+ { score: 3, label: "Top 80%" },
16150
+ { score: 2, label: "Top 90%" },
16151
+ { score: 1, label: "Top 97%" }
16152
+ ],
16153
+ minRankedScore: 6,
16154
+ benchmarkBands: [
16155
+ {
16156
+ level: "11",
16157
+ name: "Superhuman",
16158
+ rank: "Top 0.01%",
16159
+ oneIn: "1 in 10,000+",
16160
+ meaning: "Beyond the normal human ceiling for the trait \u2014 the genuine power-law outlier. Almost no one earns this; when the evidence shows it, it is scored, not rounded down.",
16161
+ foundIn: [
16162
+ "Fields Medal and Nobel-track researchers",
16163
+ "Founders of generational companies",
16164
+ "The handful of people a frontier field is named after"
16165
+ ],
16166
+ maxTopPct: 0.01
16167
+ },
16168
+ {
16169
+ level: "10",
16170
+ name: "World-class",
16171
+ rank: "Top 0.1%",
16172
+ oneIn: "1 in 1,000",
16173
+ meaning: "Among the best alive at this trait \u2014 the level entire institutions are built to find.",
16174
+ foundIn: [
16175
+ "Researchers at frontier AI labs",
16176
+ "Faculty at top-5 research universities",
16177
+ "IMO / IOI medalists",
16178
+ "Founders backed by the top decile of venture firms"
16179
+ ],
16180
+ maxTopPct: 0.1
16181
+ },
16182
+ {
16183
+ level: "9",
16184
+ name: "Exceptional",
16185
+ rank: "Top 1%",
16186
+ oneIn: "1 in 100",
16187
+ meaning: "Clearly exceptional \u2014 the strongest person on most strong teams.",
16188
+ foundIn: [
16189
+ "PhD students at top programs",
16190
+ "Early engineers at breakout startups",
16191
+ "YC-class founders",
16192
+ "National olympiad finalists"
16193
+ ],
16194
+ maxTopPct: 1
16195
+ },
16196
+ {
16197
+ level: "8",
16198
+ name: "Strong",
16199
+ rank: "Top 10%",
16200
+ oneIn: "1 in 10",
16201
+ meaning: "Strong against the whole population \u2014 the best person in most rooms, not every room.",
16202
+ foundIn: [
16203
+ "Senior engineers at selective tech companies",
16204
+ "Graduates of demanding technical programs",
16205
+ "Operators who get promoted everywhere they go"
16206
+ ],
16207
+ maxTopPct: 10
16208
+ },
16209
+ {
16210
+ level: "5",
16211
+ name: "Median",
16212
+ rank: "50th percentile",
16213
+ oneIn: "1 in 2",
16214
+ meaning: 'The middle of the general population. The reference class is all ~8 billion humans \u2014 so even "strong" above already means top 10% of everyone.',
16215
+ foundIn: ["The general population \u2014 most people, most places"],
16216
+ maxTopPct: 100
16217
+ }
16218
+ ],
16219
+ codingTiers: {
16220
+ push: { median: 300, sigma: 1.121, tag: "estimated \u2014 log-normal fit", source: "Anthropic 2026 Claude Code study (400k sessions): median engaged user ~8 prompts/day at ~35 words \u2014 ~300 directed words/day; tail shape from its actions-per-prompt distribution. AVERAGE over substantial days, cumulative not spiky." },
16221
+ focus: { median: 0.08, sigma: 0.559, tag: "estimated \u2014 proxy-anchored", source: "median: Anthropic 20h/week engaged-user figure implies ~1h/day of true rapid exchange against an 8h working day; ceiling anchored to the ~4h/day deep-work limit (45% share = 1-in-1,000). AVERAGE share, cumulative not spiky." },
16222
+ orchestration: { tag: "estimated \u2014 behavior bands", source: "no published concurrency distribution exists; ceiling anchored to the Claude Code lead's documented 10-15 parallel sessions" }
16223
+ },
16224
+ codingBenchmarks: {
16225
+ flow: {
16226
+ // typical knowledge worker ≈ 35% of an 8h day focused; ~4h/day is the
16227
+ // recognized deep-work ceiling (Newport) ≈ 50% — most sit far below it.
16228
+ typicalPctOfDay: 0.35,
16229
+ topPctOfDay: 0.5,
16230
+ tag: "measured",
16231
+ source: "RescueTime 2019 (~2h48m focused/day) \xB7 Cal Newport, Deep Work (~4h/day deep-work ceiling)",
16232
+ line: "the best spend ~half the workday in true deep flow; ~4h/day is the human ceiling"
16233
+ },
16234
+ longestRun: {
16235
+ typicalHours: 0.67,
16236
+ // ~40 min before the average worker is interrupted
16237
+ topHours: 4,
16238
+ tag: "measured",
16239
+ source: "RescueTime (avg max ~40 min focus before interruption) \xB7 deep-work single-block ceiling ~3\u20134h",
16240
+ line: "a top performer can hold a single ~3\u20134h uninterrupted block; the average worker breaks at ~40 min"
16241
+ },
16242
+ parallelism: {
16243
+ topMaxConcurrent: 12,
16244
+ // Boris Cherny ~10–15 interactive sessions
16245
+ topAvgConcurrent: 6,
16246
+ // time-weighted average while active (anecdotal, same source)
16247
+ worktreesTip: "3\u20135 git worktrees at once",
16248
+ tag: "anecdotal",
16249
+ source: "Boris Cherny (Claude Code lead, Anthropic): ~10\u201315 concurrent sessions, 'dozens of Claudes running at all times'; 3\u20135 worktrees = 'the single biggest productivity unlock'",
16250
+ line: "the Claude Code lead runs 10\u201315 sessions at once; his #1 tip is 3\u20135 git worktrees in parallel"
16251
+ },
16252
+ throughput: {
16253
+ // Top-0.1% words/day reference lines, anchored to the throughput ladder
16254
+ // (THROUGHPUT_LADDER in throughput.ts): score 10 "world-class sustained" =
16255
+ // 9k/day, score 11 "superhuman ceiling" = 12k/day. Calibrated to the person's
16256
+ // own anchors, not a wild guess — but still a target, not a measured population.
16257
+ topAvgWordsPerDay: 9e3,
16258
+ topPeakWordsPerDay: 12e3,
16259
+ benchLabel: "top 0.1%",
16260
+ // No published "words typed/day" for heavy users — the real story is OUTPUT.
16261
+ loopsHeadline: ">1,000,000 lines of Rust at 99.8% tests passing",
16262
+ loopsDetail: "the Bun runtime was ported Zig\u2192Rust largely autonomously \u2014 hundreds of parallel subagents, two AI reviewers per file",
16263
+ tag: "measured",
16264
+ source: "The Register, May 2026 (Bun Zig\u2192Rust rewrite)",
16265
+ line: "autonomous fleets ported >1M lines of Rust at 99.8% tests passing; a while-loop agent delivered a $50k contract for $297 of compute"
16266
+ }
16267
+ }
16268
+ };
16269
+
16270
+ // ../../lib/agents/coding/benchmarks.ts
16271
+ var BEST = DEFAULT_CALIBRATION.codingBenchmarks;
16272
+
16273
+ // ../../lib/agents/coding/profile.ts
16274
+ var ROOT = process.cwd();
16275
+ var CODING_DIR = process.env.POLYMATH_DATA_DIR ? path10.join(process.env.POLYMATH_DATA_DIR, "coding") : path10.join(ROOT, ".data", "coding");
16276
+ var GRADES = path10.join(CODING_DIR, "grades");
16277
+
16119
16278
  // ../../scripts/coding-grade.mts
16120
16279
  var argv = process.argv.slice(2);
16121
16280
  var flag = (n, d) => {
@@ -16141,11 +16300,11 @@ function makeLimiter(max) {
16141
16300
  }
16142
16301
  };
16143
16302
  }
16144
- var CODING = path10.join(process.cwd(), ".data", "coding");
16145
- var GRADES = path10.join(CODING, "grades");
16146
- var LOGS = path10.join(GRADES, "logs");
16303
+ var CODING = CODING_DIR;
16304
+ var GRADES2 = path11.join(CODING, "grades");
16305
+ var LOGS = path11.join(GRADES2, "logs");
16147
16306
  async function main() {
16148
- const sessions = JSON.parse(await fs6.readFile(path10.join(CODING, "sessions.json"), "utf8"));
16307
+ const sessions = JSON.parse(await fs6.readFile(path11.join(CODING, "sessions.json"), "utf8"));
16149
16308
  const { gradable, thin, trivial } = partition(sessions.filter((s) => !s.duplicateOf));
16150
16309
  const ranked = gradable.slice().sort((a, b) => b.humanChars * Math.log1p(b.humanTurns) - a.humanChars * Math.log1p(a.humanTurns));
16151
16310
  console.log(`[coding-grade] ${sessions.length} sessions \u2192 ${gradable.length} gradable \xB7 ${thin.length} thin \xB7 ${trivial.length} trivial (skipped)`);
@@ -16155,12 +16314,13 @@ async function main() {
16155
16314
  for (const s of ranked) {
16156
16315
  if (picked.length >= limit) break;
16157
16316
  if (!REGRADE) {
16158
- const done = await fs6.readFile(path10.join(GRADES, `${s.sessionId}.json`), "utf8").catch(() => null);
16317
+ const done = await fs6.readFile(path11.join(GRADES2, `${s.sessionId}.json`), "utf8").catch(() => null);
16159
16318
  if (done) continue;
16160
16319
  }
16161
16320
  picked.push(s);
16162
16321
  }
16163
16322
  console.log(`[coding-grade] grading ${picked.length}${ALL ? " (ALL gradable, resuming)" : ""} on ${MODEL}, conc ${CONC}\u2026`);
16323
+ console.log(` (each session below is a single small ${MODEL} call \u2014 a long run is many tiny calls, not a huge one)`);
16164
16324
  const lim = makeLimiter(CONC);
16165
16325
  startRun("coding-grade", picked.length);
16166
16326
  let doneN = 0, sumUsd = 0, sumCalls = 0;
@@ -16168,19 +16328,19 @@ async function main() {
16168
16328
  await Promise.all(picked.map((s) => lim(async () => {
16169
16329
  const t0 = Date.now();
16170
16330
  try {
16171
- const g = await gradeSession(s, { model: MODEL, outDir: GRADES, logDir: LOGS });
16331
+ const g = await gradeSession(s, { model: MODEL, outDir: GRADES2, logDir: LOGS });
16172
16332
  tick(!!g);
16173
16333
  if (!g) {
16174
16334
  console.log(` \u2022 "${s.title.slice(0, 48)}" \u2014 skipped (no usable grade)`);
16175
16335
  return;
16176
16336
  }
16177
16337
  const scored = g.criteria.filter((c) => c.score != null).map((c) => `${c.key}=${c.score}`).join(" ");
16178
- console.log(` \u2022 "${s.title.slice(0, 48)}" done ${(Date.now() - t0) / 1e3 | 0}s $${g.meta.costUsd?.toFixed(2) ?? "?"} \xB7 ${g.meta.calls ?? "?"} call(s) \u2192 ${scored || "(all null)"}`);
16338
+ console.log(` \u2022 "${s.title.slice(0, 48)}" done ${(Date.now() - t0) / 1e3 | 0}s \u2192 ${scored || "(all null)"}`);
16179
16339
  doneN++;
16180
16340
  sumUsd += g.meta.costUsd ?? 0;
16181
16341
  sumCalls += g.meta.calls ?? 0;
16182
16342
  const elapsedMin = (Date.now() - runT0) / 6e4;
16183
- console.log(` \u03A3 ${doneN}/${picked.length} \xB7 $${sumUsd.toFixed(2)} \xB7 ${sumCalls} calls \xB7 ${elapsedMin.toFixed(0)}m \u2192 projected $${(sumUsd / doneN * picked.length).toFixed(0)} / ${(elapsedMin / doneN * picked.length / 60).toFixed(1)}h for this run`);
16343
+ console.log(` \u03A3 ${doneN}/${picked.length} \xB7 ${elapsedMin.toFixed(0)}m elapsed \u2192 ~${(elapsedMin / doneN * picked.length / 60).toFixed(1)}h total for this run (small ${MODEL} calls)`);
16184
16344
  } catch (e) {
16185
16345
  tick(false);
16186
16346
  console.log(` \u2022 "${s.title.slice(0, 48)}" ERROR ${e.message.slice(0, 60)}`);