polymath-society 0.2.19 → 0.2.20

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.
@@ -15687,6 +15687,160 @@ function selfImageReference(si, opts = {}) {
15687
15687
  ${parts.join("\n\n")}`;
15688
15688
  }
15689
15689
 
15690
+ // ../../lib/calibration/index.ts
15691
+ var DEFAULT_CALIBRATION = {
15692
+ version: "2026-07-16.2",
15693
+ // = RUBRIC_FINGERPRINT of the shipped npm rubric (packages/coding-analyzer/
15694
+ // src/grade/criteria.ts). A unit test fails loud when the rubric changes
15695
+ // without this being updated (and re-pushed to the server).
15696
+ rubricVersion: "7983c01d53",
15697
+ // Canonical scale = the one the product owner set for the public report
15698
+ // (11=0.01% … 8=2%), extended downward from the old report ladder. The old
15699
+ // CodeAnalysisView / npm-viewer maps (7→10%/15%, 6→25%/30%) were drift, not
15700
+ // intent.
15701
+ scoreBands: [
15702
+ { score: 11, label: "Top 0.01%" },
15703
+ { score: 10, label: "Top 0.1%" },
15704
+ { score: 9, label: "Top 0.5%" },
15705
+ { score: 8, label: "Top 2%" },
15706
+ { score: 7, label: "Top 5%" },
15707
+ { score: 6, label: "Top 15%" },
15708
+ { score: 5, label: "Top 50%" },
15709
+ { score: 4, label: "Top 65%" },
15710
+ { score: 3, label: "Top 80%" },
15711
+ { score: 2, label: "Top 90%" },
15712
+ { score: 1, label: "Top 97%" }
15713
+ ],
15714
+ minRankedScore: 6,
15715
+ benchmarkBands: [
15716
+ {
15717
+ level: "11",
15718
+ name: "Superhuman",
15719
+ rank: "Top 0.01%",
15720
+ oneIn: "1 in 10,000+",
15721
+ 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.",
15722
+ foundIn: [
15723
+ "Fields Medal and Nobel-track researchers",
15724
+ "Founders of generational companies",
15725
+ "The handful of people a frontier field is named after"
15726
+ ],
15727
+ maxTopPct: 0.01
15728
+ },
15729
+ {
15730
+ level: "10",
15731
+ name: "World-class",
15732
+ rank: "Top 0.1%",
15733
+ oneIn: "1 in 1,000",
15734
+ meaning: "Among the best alive at this trait \u2014 the level entire institutions are built to find.",
15735
+ foundIn: [
15736
+ "Researchers at frontier AI labs",
15737
+ "Faculty at top-5 research universities",
15738
+ "IMO / IOI medalists",
15739
+ "Founders backed by the top decile of venture firms"
15740
+ ],
15741
+ maxTopPct: 0.1
15742
+ },
15743
+ {
15744
+ level: "9",
15745
+ name: "Exceptional",
15746
+ rank: "Top 1%",
15747
+ oneIn: "1 in 100",
15748
+ meaning: "Clearly exceptional \u2014 the strongest person on most strong teams.",
15749
+ foundIn: [
15750
+ "PhD students at top programs",
15751
+ "Early engineers at breakout startups",
15752
+ "YC-class founders",
15753
+ "National olympiad finalists"
15754
+ ],
15755
+ maxTopPct: 1
15756
+ },
15757
+ {
15758
+ level: "8",
15759
+ name: "Strong",
15760
+ rank: "Top 10%",
15761
+ oneIn: "1 in 10",
15762
+ meaning: "Strong against the whole population \u2014 the best person in most rooms, not every room.",
15763
+ foundIn: [
15764
+ "Senior engineers at selective tech companies",
15765
+ "Graduates of demanding technical programs",
15766
+ "Operators who get promoted everywhere they go"
15767
+ ],
15768
+ maxTopPct: 10
15769
+ },
15770
+ {
15771
+ level: "5",
15772
+ name: "Median",
15773
+ rank: "50th percentile",
15774
+ oneIn: "1 in 2",
15775
+ 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.',
15776
+ foundIn: ["The general population \u2014 most people, most places"],
15777
+ maxTopPct: 100
15778
+ }
15779
+ ],
15780
+ codingTiers: {
15781
+ push: { median: 300, sigma: 0.91, 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: a 1-in-1,000 user AVERAGES ~5k directed words/day (near-daily heavy dictation, clearly below the ~10k single-day record). AVERAGE over substantial days, cumulative not spiky." },
15782
+ 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." },
15783
+ hours: { median: 3, sigma: 0.4, tag: "estimated \u2014 proxy-anchored", source: "median: RescueTime-measured ~2h48m of real productive time/day (same source as the flow benchmark) \u2248 3h of active building; shape: sustaining ~7.5h/day \u2248 top 1%, a ~12h/day average \u2248 1-in-3,000. AVERAGE work-day length, cumulative not spiky." },
15784
+ 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" }
15785
+ },
15786
+ codingBenchmarks: {
15787
+ flow: {
15788
+ // typical knowledge worker ≈ 35% of an 8h day focused; ~4h/day is the
15789
+ // recognized deep-work ceiling (Newport) ≈ 50% — most sit far below it.
15790
+ typicalPctOfDay: 0.35,
15791
+ topPctOfDay: 0.5,
15792
+ tag: "measured",
15793
+ source: "RescueTime 2019 (~2h48m focused/day) \xB7 Cal Newport, Deep Work (~4h/day deep-work ceiling)",
15794
+ line: "the best spend ~half the workday in true deep flow; ~4h/day is the human ceiling"
15795
+ },
15796
+ longestRun: {
15797
+ typicalHours: 0.67,
15798
+ // ~40 min before the average worker is interrupted
15799
+ topHours: 4,
15800
+ tag: "measured",
15801
+ source: "RescueTime (avg max ~40 min focus before interruption) \xB7 deep-work single-block ceiling ~3\u20134h",
15802
+ line: "a top performer can hold a single ~3\u20134h uninterrupted block; the average worker breaks at ~40 min"
15803
+ },
15804
+ parallelism: {
15805
+ topMaxConcurrent: 12,
15806
+ // Boris Cherny ~10–15 interactive sessions
15807
+ topAvgConcurrent: 6,
15808
+ // time-weighted average while active (anecdotal, same source)
15809
+ worktreesTip: "3\u20135 git worktrees at once",
15810
+ tag: "anecdotal",
15811
+ 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'",
15812
+ line: "the Claude Code lead runs 10\u201315 sessions at once; his #1 tip is 3\u20135 git worktrees in parallel"
15813
+ },
15814
+ throughput: {
15815
+ // Two DIFFERENT kinds of line (2026-07-14.2): topAvg is a PERCENTILE
15816
+ // claim — what a 1-in-1,000 user AVERAGES over substantial days (5k/day:
15817
+ // near-daily heavy dictation; a measured top dictating power user
15818
+ // averages ~3.9k). topPeak is NOT a percentile — it is the CEILING
15819
+ // reference, the wildest single days on record (~10k: a 14-16h
15820
+ // launch-day marathon), rendered as "wildest single days", never
15821
+ // "top X% peak". An avg-percentile and a peak-percentile can't both be
15822
+ // shown at a same-ish value (avg≈peak reads broken — user call), and a
15823
+ // peak PERCENTILE line is unknowable anyway; the record framing is
15824
+ // honest and keeps the visual gap.
15825
+ topAvgWordsPerDay: 5e3,
15826
+ topPeakWordsPerDay: 1e4,
15827
+ benchLabel: "top 0.1%",
15828
+ // No published "words typed/day" for heavy users — the real story is OUTPUT.
15829
+ loopsHeadline: ">1,000,000 lines of Rust at 99.8% tests passing",
15830
+ loopsDetail: "the Bun runtime was ported Zig\u2192Rust largely autonomously \u2014 hundreds of parallel subagents, two AI reviewers per file",
15831
+ tag: "measured",
15832
+ source: "The Register, May 2026 (Bun Zig\u2192Rust rewrite)",
15833
+ 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"
15834
+ }
15835
+ }
15836
+ };
15837
+ function bandLabel(score, doc = DEFAULT_CALIBRATION) {
15838
+ const s = Math.max(1, Math.min(11, Math.round(score)));
15839
+ let best = null;
15840
+ for (const b of doc.scoreBands) if (b.score <= s && (!best || b.score > best.score)) best = b;
15841
+ return (best ?? doc.scoreBands[0]).label;
15842
+ }
15843
+
15690
15844
  // ../../lib/agents/coding/profile.ts
15691
15845
  import path11 from "path";
15692
15846
 
@@ -15840,154 +15994,6 @@ var IDLE_CAP_MS = 12 * 6e4;
15840
15994
  var NOTE = "((ran|created|edited|read|wrote|searched) (a|an|\\d+) [a-z]+|updated todos)";
15841
15995
  var TRANSCRIPT_LINE_RE = new RegExp(`^\\s*(${NOTE})((,| and) ${NOTE})*\\s*$|^\\s*thought for .{1,30}$`, "im");
15842
15996
 
15843
- // ../../lib/calibration/index.ts
15844
- var DEFAULT_CALIBRATION = {
15845
- version: "2026-07-16.2",
15846
- // = RUBRIC_FINGERPRINT of the shipped npm rubric (packages/coding-analyzer/
15847
- // src/grade/criteria.ts). A unit test fails loud when the rubric changes
15848
- // without this being updated (and re-pushed to the server).
15849
- rubricVersion: "7983c01d53",
15850
- // Canonical scale = the one the product owner set for the public report
15851
- // (11=0.01% … 8=2%), extended downward from the old report ladder. The old
15852
- // CodeAnalysisView / npm-viewer maps (7→10%/15%, 6→25%/30%) were drift, not
15853
- // intent.
15854
- scoreBands: [
15855
- { score: 11, label: "Top 0.01%" },
15856
- { score: 10, label: "Top 0.1%" },
15857
- { score: 9, label: "Top 0.5%" },
15858
- { score: 8, label: "Top 2%" },
15859
- { score: 7, label: "Top 5%" },
15860
- { score: 6, label: "Top 15%" },
15861
- { score: 5, label: "Top 50%" },
15862
- { score: 4, label: "Top 65%" },
15863
- { score: 3, label: "Top 80%" },
15864
- { score: 2, label: "Top 90%" },
15865
- { score: 1, label: "Top 97%" }
15866
- ],
15867
- minRankedScore: 6,
15868
- benchmarkBands: [
15869
- {
15870
- level: "11",
15871
- name: "Superhuman",
15872
- rank: "Top 0.01%",
15873
- oneIn: "1 in 10,000+",
15874
- 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.",
15875
- foundIn: [
15876
- "Fields Medal and Nobel-track researchers",
15877
- "Founders of generational companies",
15878
- "The handful of people a frontier field is named after"
15879
- ],
15880
- maxTopPct: 0.01
15881
- },
15882
- {
15883
- level: "10",
15884
- name: "World-class",
15885
- rank: "Top 0.1%",
15886
- oneIn: "1 in 1,000",
15887
- meaning: "Among the best alive at this trait \u2014 the level entire institutions are built to find.",
15888
- foundIn: [
15889
- "Researchers at frontier AI labs",
15890
- "Faculty at top-5 research universities",
15891
- "IMO / IOI medalists",
15892
- "Founders backed by the top decile of venture firms"
15893
- ],
15894
- maxTopPct: 0.1
15895
- },
15896
- {
15897
- level: "9",
15898
- name: "Exceptional",
15899
- rank: "Top 1%",
15900
- oneIn: "1 in 100",
15901
- meaning: "Clearly exceptional \u2014 the strongest person on most strong teams.",
15902
- foundIn: [
15903
- "PhD students at top programs",
15904
- "Early engineers at breakout startups",
15905
- "YC-class founders",
15906
- "National olympiad finalists"
15907
- ],
15908
- maxTopPct: 1
15909
- },
15910
- {
15911
- level: "8",
15912
- name: "Strong",
15913
- rank: "Top 10%",
15914
- oneIn: "1 in 10",
15915
- meaning: "Strong against the whole population \u2014 the best person in most rooms, not every room.",
15916
- foundIn: [
15917
- "Senior engineers at selective tech companies",
15918
- "Graduates of demanding technical programs",
15919
- "Operators who get promoted everywhere they go"
15920
- ],
15921
- maxTopPct: 10
15922
- },
15923
- {
15924
- level: "5",
15925
- name: "Median",
15926
- rank: "50th percentile",
15927
- oneIn: "1 in 2",
15928
- 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.',
15929
- foundIn: ["The general population \u2014 most people, most places"],
15930
- maxTopPct: 100
15931
- }
15932
- ],
15933
- codingTiers: {
15934
- push: { median: 300, sigma: 0.91, 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: a 1-in-1,000 user AVERAGES ~5k directed words/day (near-daily heavy dictation, clearly below the ~10k single-day record). AVERAGE over substantial days, cumulative not spiky." },
15935
- 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." },
15936
- hours: { median: 3, sigma: 0.4, tag: "estimated \u2014 proxy-anchored", source: "median: RescueTime-measured ~2h48m of real productive time/day (same source as the flow benchmark) \u2248 3h of active building; shape: sustaining ~7.5h/day \u2248 top 1%, a ~12h/day average \u2248 1-in-3,000. AVERAGE work-day length, cumulative not spiky." },
15937
- 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" }
15938
- },
15939
- codingBenchmarks: {
15940
- flow: {
15941
- // typical knowledge worker ≈ 35% of an 8h day focused; ~4h/day is the
15942
- // recognized deep-work ceiling (Newport) ≈ 50% — most sit far below it.
15943
- typicalPctOfDay: 0.35,
15944
- topPctOfDay: 0.5,
15945
- tag: "measured",
15946
- source: "RescueTime 2019 (~2h48m focused/day) \xB7 Cal Newport, Deep Work (~4h/day deep-work ceiling)",
15947
- line: "the best spend ~half the workday in true deep flow; ~4h/day is the human ceiling"
15948
- },
15949
- longestRun: {
15950
- typicalHours: 0.67,
15951
- // ~40 min before the average worker is interrupted
15952
- topHours: 4,
15953
- tag: "measured",
15954
- source: "RescueTime (avg max ~40 min focus before interruption) \xB7 deep-work single-block ceiling ~3\u20134h",
15955
- line: "a top performer can hold a single ~3\u20134h uninterrupted block; the average worker breaks at ~40 min"
15956
- },
15957
- parallelism: {
15958
- topMaxConcurrent: 12,
15959
- // Boris Cherny ~10–15 interactive sessions
15960
- topAvgConcurrent: 6,
15961
- // time-weighted average while active (anecdotal, same source)
15962
- worktreesTip: "3\u20135 git worktrees at once",
15963
- tag: "anecdotal",
15964
- 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'",
15965
- line: "the Claude Code lead runs 10\u201315 sessions at once; his #1 tip is 3\u20135 git worktrees in parallel"
15966
- },
15967
- throughput: {
15968
- // Two DIFFERENT kinds of line (2026-07-14.2): topAvg is a PERCENTILE
15969
- // claim — what a 1-in-1,000 user AVERAGES over substantial days (5k/day:
15970
- // near-daily heavy dictation; a measured top dictating power user
15971
- // averages ~3.9k). topPeak is NOT a percentile — it is the CEILING
15972
- // reference, the wildest single days on record (~10k: a 14-16h
15973
- // launch-day marathon), rendered as "wildest single days", never
15974
- // "top X% peak". An avg-percentile and a peak-percentile can't both be
15975
- // shown at a same-ish value (avg≈peak reads broken — user call), and a
15976
- // peak PERCENTILE line is unknowable anyway; the record framing is
15977
- // honest and keeps the visual gap.
15978
- topAvgWordsPerDay: 5e3,
15979
- topPeakWordsPerDay: 1e4,
15980
- benchLabel: "top 0.1%",
15981
- // No published "words typed/day" for heavy users — the real story is OUTPUT.
15982
- loopsHeadline: ">1,000,000 lines of Rust at 99.8% tests passing",
15983
- loopsDetail: "the Bun runtime was ported Zig\u2192Rust largely autonomously \u2014 hundreds of parallel subagents, two AI reviewers per file",
15984
- tag: "measured",
15985
- source: "The Register, May 2026 (Bun Zig\u2192Rust rewrite)",
15986
- 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"
15987
- }
15988
- }
15989
- };
15990
-
15991
15997
  // ../../lib/agents/coding/benchmarks.ts
15992
15998
  var BEST = DEFAULT_CALIBRATION.codingBenchmarks;
15993
15999
 
@@ -16005,7 +16011,7 @@ var readJson = async (f, d) => {
16005
16011
  return d;
16006
16012
  }
16007
16013
  };
16008
- var SYS = "Write a SHORT, punchy 'In a nutshell' \u2014 TWO LINES, 2-3 sentences MAX, no more. Structure: (1) what they BUILT in plain terms and why it is genuinely RARE, with a CONCRETE percentile ('top X% of builders/people'); (2) the single clearest place to improve. BE GENEROUS AND EMPHATIC ABOUT REAL ACHIEVEMENT \u2014 do not undersell or hedge a top-tier result. When a score is genuinely top-tier (\u2248 top 2% or rarer), say so plainly and make them FEEL it: name that this is NOT ordinary, that very few people can do it, that it is exceptional. A top-2% abstraction ceiling, for instance, means they can hold an entire system in their head without a blueprint \u2014 that is rare; say it like it is rare. Earned praise should land HARD. Voice: confident, warm, human, like 'you built X end-to-end and barely needed help, which very few people can do', then 'the one place to level up: Y'. NO clinical hedging, NO run-on clauses, NO laundry lists of features. The praise must be EARNED and SPECIFIC, tied to the concrete thing they actually pulled off, never generic horoscope or empty flattery. STYLE (hard rules): NO EM DASHES (\u2014), they are the clearest AI-slop tell; use a period, comma, or colon instead (target zero). No jargon, no fluff. Never invent a feature, number, or outcome that isn't in the evidence. This is the FIRST thing they read; make them feel genuinely seen AND genuinely impressed in two clean lines.";
16014
+ var SYS = "Write a SHORT, punchy 'In a nutshell' \u2014 TWO LINES, 2-3 sentences MAX, no more. Structure: (1) what they BUILT in plain terms and why it is genuinely RARE, with a CONCRETE percentile ('top X% of builders/people') when the KEY READS provide one; (2) the single clearest place to improve. PLACEMENT LAW (hard rule): a percentile or 'top X%' placement may ONLY RESTATE a placement already present in the KEY READS input \u2014 never invent, estimate, or extrapolate one. If the input says 0 sessions have been graded, quality is UNMEASURED: make NO quality or placement claim at all (no 'top X%', no rarity claim about their skill), speak only to the measured activity (hours, output volume, cadence), and say plainly that the quality read fills in once grading has run. BE GENEROUS AND EMPHATIC ABOUT REAL ACHIEVEMENT \u2014 do not undersell or hedge a top-tier result. When a score is genuinely top-tier (\u2248 top 2% or rarer), say so plainly and make them FEEL it: name that this is NOT ordinary, that very few people can do it, that it is exceptional. A top-2% abstraction ceiling, for instance, means they can hold an entire system in their head without a blueprint \u2014 that is rare; say it like it is rare. Earned praise should land HARD. Voice: confident, warm, human, like 'you built X end-to-end and barely needed help, which very few people can do', then 'the one place to level up: Y'. NO clinical hedging, NO run-on clauses, NO laundry lists of features. The praise must be EARNED and SPECIFIC, tied to the concrete thing they actually pulled off, never generic horoscope or empty flattery. STYLE (hard rules): NO EM DASHES (\u2014), they are the clearest AI-slop tell; use a period, comma, or colon instead (target zero). No jargon, no fluff. Never invent a feature, number, or outcome that isn't in the evidence. This is the FIRST thing they read; make them feel genuinely seen AND genuinely impressed in two clean lines.";
16009
16015
  function prompt(days, metrics, siRef) {
16010
16016
  return `WHAT THEY DID, DAY BY DAY (newest first):
16011
16017
  ${days}
@@ -16027,8 +16033,11 @@ async function main() {
16027
16033
  const a = agg.ability, t = agg.throughput, f = agg.flow;
16028
16034
  const exp = await readJson("expertise.json", {});
16029
16035
  const del = await readJson("delegation-rollup.json", {});
16036
+ const gradedN = (await fs5.readdir(path12.join(CODING, "grades")).catch(() => [])).filter((f2) => f2.endsWith(".json")).length;
16037
+ const band = (sc) => typeof sc === "number" ? ` (~${bandLabel(sc, DEFAULT_CALIBRATION)})` : "";
16030
16038
  const metrics = [
16031
- `Abstraction ceiling ${a?.abstraction?.score}/11 (~Top 2%), Taste ${a?.taste?.score}/11`,
16039
+ `Graded sessions: ${gradedN}${gradedN === 0 ? " \u2014 ZERO sessions have been graded; every quality score is absent and quality is UNMEASURED" : ""}`,
16040
+ `Abstraction ceiling ${a?.abstraction?.score != null ? `${a.abstraction.score}/11${band(a.abstraction.score)}` : "not graded"}, Taste ${a?.taste?.score != null ? `${a.taste.score}/11${band(a.taste.score)}` : "not graded"}`,
16032
16041
  `Throughput avg ${t?.score}/11 (~${t?.avgWordsPerDay} words/day on real coding days), peak ${t?.ceiling}`,
16033
16042
  `Flow ${f?.flow?.pctOfWorkDay != null ? Math.round(f.flow.pctOfWorkDay * 100) + "% of the work day" : "?"}, deepest solo`,
16034
16043
  `Genuine domain expertise (deep): ${(exp.domains || []).filter((d) => d.depth === "deep").map((d) => d.domain).join(", ") || "\u2014"}`,
@@ -15694,6 +15694,97 @@ function isHarnessEntry(e) {
15694
15694
  return e.isMeta === true || e.isCompactSummary === true;
15695
15695
  }
15696
15696
 
15697
+ // ../coding-core/dist/codex.js
15698
+ var SYSTEM_REMINDER_RE2 = /<system-reminder>[\s\S]*?<\/system-reminder>/g;
15699
+ var CODEX_INJECTED_TEXT_RE = /^\s*(<(environment_context|user_instructions|ENVIRONMENT_CONTEXT|turn_aborted)\b|#\s*AGENTS\.md instructions\b)/;
15700
+ function isCodexInjectedUserText(text2) {
15701
+ return CODEX_INJECTED_TEXT_RE.test(text2);
15702
+ }
15703
+ function codexContentText(content) {
15704
+ if (typeof content === "string")
15705
+ return content;
15706
+ if (!Array.isArray(content))
15707
+ return "";
15708
+ const parts = [];
15709
+ for (const item of content) {
15710
+ if (typeof item === "string") {
15711
+ parts.push(item);
15712
+ continue;
15713
+ }
15714
+ if (item && typeof item === "object") {
15715
+ const it = item;
15716
+ if (it.type === "input_text" || it.type === "output_text" || it.type === "text")
15717
+ parts.push(it.text || "");
15718
+ }
15719
+ }
15720
+ return parts.join("\n");
15721
+ }
15722
+ function sniffCodexRaw(raw) {
15723
+ let checked = 0;
15724
+ for (const lineRaw of raw.split("\n")) {
15725
+ const line = lineRaw.trim();
15726
+ if (!line)
15727
+ continue;
15728
+ if (checked++ >= 5)
15729
+ break;
15730
+ try {
15731
+ const e = JSON.parse(line);
15732
+ if (e.type === "session_meta" || e.type === "response_item" || e.type === "turn_context")
15733
+ return true;
15734
+ if (e.type === "user" || e.type === "assistant" || e.type === "summary" || e.type === "queue-operation")
15735
+ return false;
15736
+ } catch {
15737
+ }
15738
+ }
15739
+ return false;
15740
+ }
15741
+ var EXIT_CODE_RE = /(?:Process exited with code|Exit code:)\s+(\d+)/;
15742
+ function extractCodexEvents(raw) {
15743
+ const out = [];
15744
+ for (const lineRaw of raw.split("\n")) {
15745
+ const line = lineRaw.trim();
15746
+ if (!line)
15747
+ continue;
15748
+ let e;
15749
+ try {
15750
+ e = JSON.parse(line);
15751
+ } catch {
15752
+ continue;
15753
+ }
15754
+ if (e.type !== "response_item")
15755
+ continue;
15756
+ const p = e.payload ?? {};
15757
+ const t = typeof e.timestamp === "string" ? Date.parse(e.timestamp) : NaN;
15758
+ const ptype = p.type;
15759
+ if (ptype === "message") {
15760
+ const role = p.role;
15761
+ const text2 = codexContentText(p.content).replace(SYSTEM_REMINDER_RE2, "").trim();
15762
+ if (!text2)
15763
+ continue;
15764
+ if (role === "user") {
15765
+ if (isCodexInjectedUserText(text2))
15766
+ continue;
15767
+ out.push({ kind: "user", t, text: text2 });
15768
+ } else if (role === "assistant") {
15769
+ out.push({ kind: "assistant", t, text: text2 });
15770
+ }
15771
+ continue;
15772
+ }
15773
+ if (ptype === "function_call" || ptype === "custom_tool_call" || ptype === "local_shell_call") {
15774
+ const name17 = typeof p.name === "string" && p.name ? p.name : ptype === "local_shell_call" ? "shell" : String(ptype);
15775
+ const input = typeof p.arguments === "string" ? p.arguments : typeof p.input === "string" ? p.input : "";
15776
+ out.push({ kind: "tool", t, name: name17, input });
15777
+ continue;
15778
+ }
15779
+ if (ptype === "function_call_output" || ptype === "custom_tool_call_output") {
15780
+ const output = typeof p.output === "string" ? p.output : "";
15781
+ const m = EXIT_CODE_RE.exec(output.slice(0, 200));
15782
+ out.push({ kind: "tool_output", t, output, isError: !!m && m[1] !== "0" });
15783
+ }
15784
+ }
15785
+ return out;
15786
+ }
15787
+
15697
15788
  // ../coding-core/dist/messages.js
15698
15789
  function extractText(content) {
15699
15790
  if (typeof content === "string")
@@ -15705,6 +15796,49 @@ function extractText(content) {
15705
15796
  function isToolResultOnly(content) {
15706
15797
  return Array.isArray(content) && content.length > 0 && content.every((c) => c && typeof c === "object" && c.type === "tool_result");
15707
15798
  }
15799
+ function extractMessagesCodex(raw) {
15800
+ const out = [];
15801
+ let aiProse = [];
15802
+ let aiTools = {};
15803
+ let aiStart = 0;
15804
+ const flushAI = () => {
15805
+ if (!aiProse.length && Object.keys(aiTools).length === 0)
15806
+ return;
15807
+ const toolStr = Object.entries(aiTools).map(([n, c]) => c > 1 ? `${n}\xD7${c}` : n).join(", ");
15808
+ let prose = aiProse.join(" ").replace(/\s+/g, " ").trim();
15809
+ if (prose.length > 2200)
15810
+ prose = prose.slice(0, 2200) + "\u2026";
15811
+ let text2 = prose;
15812
+ if (toolStr)
15813
+ text2 = (text2 ? text2 + " " : "") + `[ran ${toolStr}]`;
15814
+ if (text2)
15815
+ out.push({ t: aiStart, role: "ai", text: text2 });
15816
+ aiProse = [];
15817
+ aiTools = {};
15818
+ };
15819
+ for (const ev of extractCodexEvents(raw)) {
15820
+ if (!Number.isFinite(ev.t))
15821
+ continue;
15822
+ if (ev.kind === "user") {
15823
+ const text2 = humanTypedText(ev.text);
15824
+ if (text2) {
15825
+ flushAI();
15826
+ out.push({ t: ev.t, role: "user", text: text2 });
15827
+ }
15828
+ } else if (ev.kind === "assistant") {
15829
+ if (!aiProse.length && Object.keys(aiTools).length === 0)
15830
+ aiStart = ev.t;
15831
+ if (ev.text)
15832
+ aiProse.push(ev.text);
15833
+ } else if (ev.kind === "tool") {
15834
+ if (!aiProse.length && Object.keys(aiTools).length === 0)
15835
+ aiStart = ev.t;
15836
+ aiTools[ev.name] = (aiTools[ev.name] ?? 0) + 1;
15837
+ }
15838
+ }
15839
+ flushAI();
15840
+ return out.sort((a, b) => a.t - b.t);
15841
+ }
15708
15842
  async function extractMessages(file2) {
15709
15843
  let raw;
15710
15844
  try {
@@ -15712,6 +15846,8 @@ async function extractMessages(file2) {
15712
15846
  } catch {
15713
15847
  return [];
15714
15848
  }
15849
+ if (sniffCodexRaw(raw))
15850
+ return extractMessagesCodex(raw);
15715
15851
  const out = [];
15716
15852
  const userTexts = /* @__PURE__ */ new Set();
15717
15853
  const seenUuids = /* @__PURE__ */ new Set();
@@ -16298,10 +16434,12 @@ async function main() {
16298
16434
  if (todo.length < eligible.length) console.log(`[walkthrough] cap: the ${todo.length} richest of ${eligible.length} eligible sessions (POLYMATH_MAX_GRADED; 0 = uncapped)`);
16299
16435
  const lim = limiter(CONC);
16300
16436
  startRun("walkthrough", pending.length);
16437
+ let doneN = 0;
16301
16438
  await Promise.all(pending.map((s) => lim(async () => {
16302
16439
  try {
16303
16440
  const w = await buildWalkthrough(s, { model: MODEL, outDir: DIR });
16304
16441
  tick(!!w);
16442
+ if (w) doneN++;
16305
16443
  console.log(` \u2022 ${s.title.slice(0, 46)} \u2192 ${w ? w.phases.length + " phases" : "skip"}`);
16306
16444
  } catch (e) {
16307
16445
  tick(false);
@@ -16309,6 +16447,12 @@ async function main() {
16309
16447
  }
16310
16448
  })));
16311
16449
  endRun();
16450
+ if (pending.length > 0 && doneN === 0) {
16451
+ console.error(`
16452
+ [walkthrough] FATAL: 0 of ${pending.length} attempted sessions produced a walkthrough \u2014 every attempt failed.`);
16453
+ console.error(`[walkthrough] Likely cause: unreadable or unsupported transcript files (a log format the reader cannot parse). Fix ingestion, then re-run this stage.`);
16454
+ process.exit(1);
16455
+ }
16312
16456
  console.log(`[walkthrough] done \u2192 ${path11.relative(process.cwd(), DIR)}/`);
16313
16457
  }
16314
16458
  main().catch((e) => {
package/dist/web/app.js CHANGED
@@ -8561,6 +8561,10 @@ function bandLabel(score, doc = DEFAULT_CALIBRATION) {
8561
8561
  for (const b of doc.scoreBands) if (b.score <= s && (!best || b.score > best.score)) best = b;
8562
8562
  return (best ?? doc.scoreBands[0]).label;
8563
8563
  }
8564
+ function topShare(percentile) {
8565
+ const t = Math.max(0.1, 100 - percentile);
8566
+ return t < 1 ? String(+t.toFixed(2)) : String(Math.round(t));
8567
+ }
8564
8568
  function validateCalibration(raw) {
8565
8569
  const fail = (msg) => {
8566
8570
  throw new Error(`invalid calibration doc: ${msg}`);
@@ -10239,10 +10243,6 @@ function FeelSeenConclusionPanel({ data }) {
10239
10243
  };
10240
10244
  const rows = (data.stackUp ?? []).map((r) => ({ ...r, percentile: livePctl(r) })).filter((r) => r.percentile != null && r.score != null);
10241
10245
  if (!rows.length) return null;
10242
- const topPct2 = (p) => {
10243
- const t = 100 - p;
10244
- return t < 1 ? +t.toFixed(2) : Math.round(t);
10245
- };
10246
10246
  const ranked = rows.slice().sort((a, b) => b.percentile - a.percentile);
10247
10247
  const standout = ranked.filter((r) => r.percentile >= 90);
10248
10248
  const lead = (standout.length ? standout : ranked.slice(0, 2)).slice(0, 4);
@@ -10262,7 +10262,7 @@ function FeelSeenConclusionPanel({ data }) {
10262
10262
  " \u2014 drop you into any small startup and you\u2019d independently own the outcome and just get the thing done, relentlessly. That\u2019s the rarest, most load-bearing thing here, and it\u2019s real: ",
10263
10263
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "font-semibold text-accent", children: [
10264
10264
  "top ",
10265
- topPct2(agencyRow.percentile),
10265
+ topShare(agencyRow.percentile),
10266
10266
  "%"
10267
10267
  ] }),
10268
10268
  " on agency",
@@ -10270,7 +10270,7 @@ function FeelSeenConclusionPanel({ data }) {
10270
10270
  ", and ",
10271
10271
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "font-semibold text-accent", children: [
10272
10272
  "top ",
10273
- topPct2(best.percentile),
10273
+ topShare(best.percentile),
10274
10274
  "%"
10275
10275
  ] }),
10276
10276
  " on ",
@@ -10281,7 +10281,7 @@ function FeelSeenConclusionPanel({ data }) {
10281
10281
  "The honest, generous read: you\u2019re genuinely ",
10282
10282
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "font-semibold text-accent", children: [
10283
10283
  "top ",
10284
- topPct2(best.percentile),
10284
+ topShare(best.percentile),
10285
10285
  "%"
10286
10286
  ] }),
10287
10287
  " at ",
@@ -10292,7 +10292,7 @@ function FeelSeenConclusionPanel({ data }) {
10292
10292
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "font-semibold text-ink", children: r.label }),
10293
10293
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "font-semibold text-accent", children: [
10294
10294
  "top ",
10295
- topPct2(r.percentile),
10295
+ topShare(r.percentile),
10296
10296
  "%"
10297
10297
  ] })
10298
10298
  ] }, r.label)) }),
@@ -10337,8 +10337,7 @@ function StackUpPanel({ rows }) {
10337
10337
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mt-0.5 text-[12.5px] text-faint", children: "where you land against everyone who works in coding agents" }),
10338
10338
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { className: "mt-3 space-y-3.5", children: shown.map((r, i) => {
10339
10339
  const pct = r.percentile;
10340
- const top = pct == null ? null : 100 - pct;
10341
- const topStr = top == null ? null : top < 1 ? String(+top.toFixed(2)) : String(Math.round(top));
10340
+ const topStr = pct == null ? null : topShare(pct);
10342
10341
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("li", { className: "flex gap-2.5", children: [
10343
10342
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mt-[8px] h-1.5 w-1.5 flex-none rounded-full bg-ink" }),
10344
10343
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "min-w-0 flex-1", children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polymath-society",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
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",