personal-eval 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +26 -2
- package/bin/personal-eval.js +10 -0
- package/fonts/GeistMono-Medium.ttf +0 -0
- package/fonts/GeistMono-Regular.ttf +0 -0
- package/fonts/OFL.txt +92 -0
- package/package.json +42 -4
- package/src/classify.js +90 -0
- package/src/cli.js +219 -0
- package/src/judge.js +177 -0
- package/src/lines.js +89 -0
- package/src/metrics.js +203 -0
- package/src/models.js +42 -0
- package/src/pipeline.js +93 -0
- package/src/readers/claude.js +138 -0
- package/src/readers/codex.js +246 -0
- package/src/readers/fs.js +30 -0
- package/src/readers/fx.js +171 -0
- package/src/readers/gemini.js +191 -0
- package/src/readers/index.js +13 -0
- package/src/readers/opencode.js +243 -0
- package/src/render.js +110 -0
- package/src/text.js +204 -0
- package/src/turns.js +157 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Agnost AI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# personal-eval
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Which model works best for *you*? Scores your models from your own coding-agent sessions.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npx personal-eval
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
Reads local sessions from Claude Code, Codex, Gemini CLI, opencode and fx. Nothing leaves your machine.
|
|
12
|
+
|
|
13
|
+
## Options
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
--models a,b pick models (default: your two most used)
|
|
17
|
+
--since 30d recent sessions only
|
|
18
|
+
--project x sessions in matching folders only
|
|
19
|
+
--strict tie unless the gap is statistically significant
|
|
20
|
+
--judge label follow-ups with Claude (sends short snippets)
|
|
21
|
+
--list show models found
|
|
22
|
+
--json raw numbers
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Every row is lower-is-better. If your models ran in different agents, harness differences are part of the result.
|
|
26
|
+
|
|
27
|
+
Inspired by [@rauchg](https://x.com/rauchg/status/2124880074168242369). Built by [Agnost AI](https://agnost.ai).
|
|
Binary file
|
|
Binary file
|
package/fonts/OFL.txt
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Copyright (c) 2023 Vercel, in collaboration with basement.studio
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
-----------------------------------------------------------
|
|
8
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
9
|
+
-----------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
PREAMBLE
|
|
12
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
13
|
+
development of collaborative font projects, to support the font creation
|
|
14
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
15
|
+
open framework in which fonts may be shared and improved in partnership
|
|
16
|
+
with others.
|
|
17
|
+
|
|
18
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
19
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
20
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
21
|
+
redistributed and/or sold with any software provided that any reserved
|
|
22
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
23
|
+
however, cannot be released under any other type of license. The
|
|
24
|
+
requirement for fonts to remain under this license does not apply
|
|
25
|
+
to any document created using the fonts or their derivatives.
|
|
26
|
+
|
|
27
|
+
DEFINITIONS
|
|
28
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
29
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
30
|
+
include source files, build scripts and documentation.
|
|
31
|
+
|
|
32
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
33
|
+
copyright statement(s).
|
|
34
|
+
|
|
35
|
+
"Original Version" refers to the collection of Font Software components as
|
|
36
|
+
distributed by the Copyright Holder(s).
|
|
37
|
+
|
|
38
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
39
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
40
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
41
|
+
new environment.
|
|
42
|
+
|
|
43
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
44
|
+
writer or other person who contributed to the Font Software.
|
|
45
|
+
|
|
46
|
+
PERMISSION AND CONDITIONS
|
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
48
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
49
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
50
|
+
Software, subject to the following conditions:
|
|
51
|
+
|
|
52
|
+
1) Neither the Font Software nor any of its individual components,
|
|
53
|
+
in Original or Modified Versions, may be sold by itself.
|
|
54
|
+
|
|
55
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
56
|
+
redistributed and/or sold with any software, provided that each copy
|
|
57
|
+
contains the above copyright notice and this license. These can be
|
|
58
|
+
included either as stand-alone text files, human-readable headers or
|
|
59
|
+
in the appropriate machine-readable metadata fields within text or
|
|
60
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
61
|
+
|
|
62
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
63
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
64
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
65
|
+
presented to the users.
|
|
66
|
+
|
|
67
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
68
|
+
Software shall not be used to promote, endorse or advertise any
|
|
69
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
70
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
71
|
+
permission.
|
|
72
|
+
|
|
73
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
74
|
+
must be distributed entirely under this license, and must not be
|
|
75
|
+
distributed under any other license. The requirement for fonts to
|
|
76
|
+
remain under this license does not apply to any document created
|
|
77
|
+
using the Font Software.
|
|
78
|
+
|
|
79
|
+
TERMINATION
|
|
80
|
+
This license becomes null and void if any of the above conditions are
|
|
81
|
+
not met.
|
|
82
|
+
|
|
83
|
+
DISCLAIMER
|
|
84
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
85
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
86
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
87
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
88
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
89
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
90
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
91
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
92
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "personal-eval",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Which model actually works best for you? One command reads your local coding-agent sessions and scores your models on how often you had to correct them.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"personal-eval": "bin/personal-eval.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"src",
|
|
12
|
+
"fonts"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=20"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"start": "node bin/personal-eval.js",
|
|
19
|
+
"test": "node --test test/"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@resvg/resvg-js": "2.6.2"
|
|
23
|
+
},
|
|
24
|
+
"optionalDependencies": {
|
|
25
|
+
"@anthropic-ai/sdk": "^1.12.0"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"eval",
|
|
29
|
+
"llm",
|
|
30
|
+
"claude-code",
|
|
31
|
+
"codex",
|
|
32
|
+
"gemini-cli",
|
|
33
|
+
"opencode",
|
|
34
|
+
"coding-agent",
|
|
35
|
+
"model-comparison"
|
|
36
|
+
],
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"author": "Agnost AI (https://agnost.ai)",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "git+https://github.com/AgnostAI/personal-eval.git"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/AgnostAI/personal-eval#readme"
|
|
44
|
+
}
|
package/src/classify.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Fast, free, local labeling of the user's next message after a turn.
|
|
2
|
+
// Labels: not_meant | undo | redo | broken | nudge | none
|
|
3
|
+
// `--judge` replaces these with an LLM's labels (see judge.js).
|
|
4
|
+
|
|
5
|
+
export const LABELS = ['not_meant', 'undo', 'redo', 'broken', 'nudge', 'none'];
|
|
6
|
+
|
|
7
|
+
const NOT_MEANT = [
|
|
8
|
+
/\bnot what i (meant|asked|wanted|said|was asking)\b/,
|
|
9
|
+
/\bthat'?s not (what|it|right|correct|the (one|thing|file|issue|problem))\b/,
|
|
10
|
+
/\bthat is not (what|it|right)\b/,
|
|
11
|
+
/\bno,? i (meant|mean|asked|said|wanted)\b/,
|
|
12
|
+
/\bi (meant|was asking|was talking about)\b/,
|
|
13
|
+
/\bwhat i meant\b/,
|
|
14
|
+
/\byou (misunderstood|misread|got it wrong|missed the point)\b/,
|
|
15
|
+
/\bmisunderstood\b/,
|
|
16
|
+
/\bi didn'?t (ask|say|mean|want) (you )?(to|for|that)\b/,
|
|
17
|
+
/\b(re-?read|read) (my|the) (message|prompt|question|request)\b/,
|
|
18
|
+
/\bwrong (file|thing|place|one|page|component|function|repo|branch|direction)\b/,
|
|
19
|
+
/\bthat'?s the wrong\b/,
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
const UNDO = [
|
|
23
|
+
/\bundo\b/,
|
|
24
|
+
/\brevert\b/,
|
|
25
|
+
/\broll ?back\b/,
|
|
26
|
+
/\bput (it|that|them) back\b/,
|
|
27
|
+
/\brestore (it|that|the (old|original|previous))\b/,
|
|
28
|
+
/\bgo back to (the )?(previous|original|old|earlier)\b/,
|
|
29
|
+
/\b(remove|delete|drop|get rid of) (that|this|it|those|these|what you (just )?(added|did|changed|wrote))\b/,
|
|
30
|
+
/\bwhy did you (change|add|remove|delete|touch|modify|rename)\b/,
|
|
31
|
+
/\b(don'?t|do not|never) (change|touch|modify|add|delete|remove) (that|this|it|those|the)\b/,
|
|
32
|
+
/\bi didn'?t ask (you )?to (change|add|remove|delete|touch)\b/,
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
const REDO = [
|
|
36
|
+
/\bredo\b/,
|
|
37
|
+
/\bdo it again\b/,
|
|
38
|
+
/\btry again\b/,
|
|
39
|
+
/\bstart over\b/,
|
|
40
|
+
/\bfrom scratch\b/,
|
|
41
|
+
/\bi (don'?t|do not) like (it|this|that|the)\b/,
|
|
42
|
+
/\bdon'?t like (it|this|that)\b/,
|
|
43
|
+
/\bnot (good|great|right) enough\b/,
|
|
44
|
+
/\b(this|that|it) (looks|is|feels) (bad|off|wrong|terrible|awful|ugly|weird|worse|meh|generic)\b/,
|
|
45
|
+
/\b(ugly|terrible|awful|horrible)\b/,
|
|
46
|
+
/\bmake it (better|nicer|cleaner)\b/,
|
|
47
|
+
/\b(rewrite|rework|redesign) (it|this|that)\b/,
|
|
48
|
+
/\b(different|another|better) approach\b/,
|
|
49
|
+
/\bscrap (it|this|that)\b/,
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
const BROKEN = [
|
|
53
|
+
/\bstill (broken|failing|fails|not working|doesn'?t work|wrong|the same|happening|getting|seeing|an issue|there|crash|error|throw|shows?|blank|empty|missing)\b/,
|
|
54
|
+
/\b(it|this|that)('?s| is) (broken|not working|failing|wrong)\b/,
|
|
55
|
+
/\b(doesn'?t|does not|didn'?t|did not|isn'?t|is not|won'?t|not) (work|working)\b/,
|
|
56
|
+
/\b(it|this|that|which|still) (doesn'?t|does not|didn'?t|did not|won'?t) (fix|load|compile|build|render|start|run|show)\b/,
|
|
57
|
+
/\b(didn'?t|did not|doesn'?t|does not) fix (it|the|anything)\b/,
|
|
58
|
+
/\bnothing (happens|happened|changed|works)\b/,
|
|
59
|
+
/\bsame (error|issue|problem|bug|result|thing)\b/,
|
|
60
|
+
/\b(getting|got|seeing|throws?|throwing|see) (an? |the |this |that )?(error|exception|traceback|stack ?trace|500|404|crash)\b/,
|
|
61
|
+
/\b(it|this|that|build|test|tests|page|app) (crash(es|ed)?|fails?|failed|errors?|broke)\b/,
|
|
62
|
+
/\bbroke (it|the|everything|something)\b/,
|
|
63
|
+
/\b(blank|white|empty) (page|screen)\b/,
|
|
64
|
+
/^(error|traceback|exception|typeerror|referenceerror|syntaxerror)\b/,
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
const NUDGE = /^(continue|go on|keep going|carry on|resume|and\?|so\?|well\?|hello\?*|hey\?+|you there\??|are you there\??|status\?|any update\??|\?+|\.\.+)[\s.!?]*$/;
|
|
68
|
+
|
|
69
|
+
/** Normalize a follow-up for matching: drop code blocks/quotes, cap length, lowercase. */
|
|
70
|
+
export function normalize(text) {
|
|
71
|
+
return String(text || '')
|
|
72
|
+
.replace(/```[\s\S]*?```/g, ' ')
|
|
73
|
+
.replace(/^>.*$/gm, ' ')
|
|
74
|
+
.replace(/[’‘]/g, "'")
|
|
75
|
+
.slice(0, 500)
|
|
76
|
+
.toLowerCase()
|
|
77
|
+
.replace(/\s+/g, ' ')
|
|
78
|
+
.trim();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function classifyFollowUp(text) {
|
|
82
|
+
const t = normalize(text);
|
|
83
|
+
if (!t) return 'none';
|
|
84
|
+
if (NUDGE.test(t)) return 'nudge';
|
|
85
|
+
if (UNDO.some((r) => r.test(t))) return 'undo';
|
|
86
|
+
if (NOT_MEANT.some((r) => r.test(t))) return 'not_meant';
|
|
87
|
+
if (BROKEN.some((r) => r.test(t))) return 'broken';
|
|
88
|
+
if (REDO.some((r) => r.test(t))) return 'redo';
|
|
89
|
+
return 'none';
|
|
90
|
+
}
|
package/src/cli.js
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
5
|
+
import { READERS } from './readers/index.js';
|
|
6
|
+
import { discoverAll, parseAll } from './pipeline.js';
|
|
7
|
+
import { groupByModel, scorecard } from './metrics.js';
|
|
8
|
+
import { renderTerminal, writeImage } from './render.js';
|
|
9
|
+
|
|
10
|
+
const pkg = createRequire(import.meta.url)('../package.json');
|
|
11
|
+
|
|
12
|
+
const HELP = `personal-eval ${pkg.version}
|
|
13
|
+
Which model actually works best for you? Reads the coding-agent sessions already
|
|
14
|
+
on your machine and scores each model on how often you had to correct it.
|
|
15
|
+
Nothing leaves your machine unless you pass --judge.
|
|
16
|
+
|
|
17
|
+
Usage: npx personal-eval [options]
|
|
18
|
+
|
|
19
|
+
--models <a,b> models to compare (substring of name or id, e.g. "opus,gpt-6")
|
|
20
|
+
default: your two most-used models
|
|
21
|
+
--all compare every model with enough turns (up to 6)
|
|
22
|
+
--list list the models found and exit
|
|
23
|
+
--since <when> only sessions after a date (2026-10-01) or age (30d, 12w)
|
|
24
|
+
--agent <ids> limit to agents: ${Object.keys(READERS).join(', ')}
|
|
25
|
+
--project <text> only sessions whose working directory contains <text>
|
|
26
|
+
--min-turns <n> minimum turns for a model to be eligible (default 30)
|
|
27
|
+
--strict call a row a tie unless the gap is statistically significant
|
|
28
|
+
--judge label follow-ups with Claude instead of keyword rules (more
|
|
29
|
+
accurate; sends follow-up snippets to Claude via your
|
|
30
|
+
ANTHROPIC_API_KEY or the local \`claude\` CLI)
|
|
31
|
+
--judge-model <m> model for --judge (default claude-opus-5-5 via API)
|
|
32
|
+
--out <file> image path (default ~/Downloads/personal-eval.png)
|
|
33
|
+
--no-image skip the image
|
|
34
|
+
--json print raw numbers as JSON
|
|
35
|
+
-h, --help show this help
|
|
36
|
+
-v, --version show version
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
export function parseArgs(argv) {
|
|
40
|
+
const o = { minTurns: 30, image: true };
|
|
41
|
+
for (let i = 0; i < argv.length; i++) {
|
|
42
|
+
const a = argv[i];
|
|
43
|
+
const val = () => {
|
|
44
|
+
const v = a.includes('=') ? a.slice(a.indexOf('=') + 1) : argv[++i];
|
|
45
|
+
if (v == null) throw new Error(`${a} needs a value`);
|
|
46
|
+
return v;
|
|
47
|
+
};
|
|
48
|
+
const flag = a.split('=')[0];
|
|
49
|
+
switch (flag) {
|
|
50
|
+
case '-h': case '--help': o.help = true; break;
|
|
51
|
+
case '-v': case '--version': o.version = true; break;
|
|
52
|
+
case '--models': o.models = val().split(',').map((s) => s.trim()).filter(Boolean); break;
|
|
53
|
+
case '--all': o.all = true; break;
|
|
54
|
+
case '--list': o.list = true; break;
|
|
55
|
+
case '--since': o.since = parseSince(val()); break;
|
|
56
|
+
case '--agent': case '--agents': o.agents = val().split(',').map((s) => s.trim().toLowerCase()); break;
|
|
57
|
+
case '--project': o.project = val(); break;
|
|
58
|
+
case '--min-turns': o.minTurns = Number(val()); break;
|
|
59
|
+
case '--strict': o.strict = true; break;
|
|
60
|
+
case '--judge': o.judge = true; break;
|
|
61
|
+
case '--judge-model': o.judgeModel = val(); break;
|
|
62
|
+
case '--out': o.out = val(); break;
|
|
63
|
+
case '--no-image': o.image = false; break;
|
|
64
|
+
case '--json': o.json = true; break;
|
|
65
|
+
default: throw new Error(`unknown option ${a} (see --help)`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return o;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function parseSince(v) {
|
|
72
|
+
const m = String(v).match(/^(\d+)\s*([dwmh])$/i);
|
|
73
|
+
if (m) {
|
|
74
|
+
const unit = { h: 3600e3, d: 86400e3, w: 7 * 86400e3, m: 30 * 86400e3 }[m[2].toLowerCase()];
|
|
75
|
+
return Date.now() - Number(m[1]) * unit;
|
|
76
|
+
}
|
|
77
|
+
const t = Date.parse(v);
|
|
78
|
+
if (!Number.isFinite(t)) throw new Error(`can't read --since ${v}`);
|
|
79
|
+
return t;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function defaultOut() {
|
|
83
|
+
const dl = path.join(os.homedir(), 'Downloads');
|
|
84
|
+
return path.join(fs.existsSync(dl) ? dl : process.cwd(), 'personal-eval.png');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const fmtDate = (ms) => new Date(ms).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' });
|
|
88
|
+
|
|
89
|
+
export async function main(argv) {
|
|
90
|
+
const opts = parseArgs(argv);
|
|
91
|
+
if (opts.help) return void process.stdout.write(HELP);
|
|
92
|
+
if (opts.version) return void process.stdout.write(`${pkg.version}\n`);
|
|
93
|
+
|
|
94
|
+
const tty = process.stderr.isTTY;
|
|
95
|
+
const color = process.stdout.isTTY && !process.env.NO_COLOR;
|
|
96
|
+
const status = (s) => tty && process.stderr.write(`\r\x1b[2K${s}`);
|
|
97
|
+
const log = (s = '') => process.stderr.write(`${s}\n`);
|
|
98
|
+
|
|
99
|
+
const agents = opts.agents || Object.keys(READERS);
|
|
100
|
+
for (const a of agents) if (!READERS[a]) throw new Error(`unknown agent "${a}" (have: ${Object.keys(READERS).join(', ')})`);
|
|
101
|
+
|
|
102
|
+
status('Looking for sessions…');
|
|
103
|
+
const units = await discoverAll(agents);
|
|
104
|
+
if (!units.length) {
|
|
105
|
+
status('');
|
|
106
|
+
log('No coding-agent sessions found. Looked in:');
|
|
107
|
+
for (const a of agents) for (const r of READERS[a].roots()) log(` ${READERS[a].label.padEnd(12)} ${r}`);
|
|
108
|
+
return 1;
|
|
109
|
+
}
|
|
110
|
+
const gb = units.reduce((s, u) => s + u.size, 0) / 1e9;
|
|
111
|
+
const t0 = Date.now();
|
|
112
|
+
const { turns: raw, errors } = await parseAll(units, (done, total) =>
|
|
113
|
+
status(`Reading ${total} session files (${gb.toFixed(1)} GB)… ${Math.round((100 * done) / total)}%`),
|
|
114
|
+
);
|
|
115
|
+
status('');
|
|
116
|
+
const readMs = Date.now() - t0;
|
|
117
|
+
|
|
118
|
+
// Resumed/forked sessions copy history into new files: keep each prompt once.
|
|
119
|
+
const seen = new Set();
|
|
120
|
+
let turns = raw.filter((t) => {
|
|
121
|
+
if (!t.key) return true;
|
|
122
|
+
if (seen.has(t.key)) return false;
|
|
123
|
+
seen.add(t.key);
|
|
124
|
+
return true;
|
|
125
|
+
});
|
|
126
|
+
if (opts.since) turns = turns.filter((t) => t.start != null && t.start >= opts.since);
|
|
127
|
+
if (opts.project) turns = turns.filter((t) => (t.cwd || '').includes(opts.project));
|
|
128
|
+
|
|
129
|
+
const groups = groupByModel(turns);
|
|
130
|
+
const ranked = [...groups.values()].sort((a, b) => b.turns.length - a.turns.length);
|
|
131
|
+
|
|
132
|
+
if (opts.list) {
|
|
133
|
+
log(`${'model'.padEnd(26)} ${'turns'.padStart(7)} ${'sessions'.padStart(8)} agents / ids`);
|
|
134
|
+
for (const g of ranked) {
|
|
135
|
+
const sessions = new Set(g.turns.map((t) => `${t.agent}:${t.session}`)).size;
|
|
136
|
+
const agentLabels = [...g.agents].map((a) => READERS[a].label).join(', ');
|
|
137
|
+
log(`${g.name.padEnd(26)} ${String(g.turns.length).padStart(7)} ${String(sessions).padStart(8)} ${agentLabels} · ${[...g.ids].join(', ')}`);
|
|
138
|
+
}
|
|
139
|
+
return 0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
let names;
|
|
143
|
+
if (opts.models) {
|
|
144
|
+
names = [];
|
|
145
|
+
for (const q of opts.models) {
|
|
146
|
+
const ql = q.toLowerCase();
|
|
147
|
+
const hit = ranked.find((g) => !names.includes(g.name) && (g.name.toLowerCase().includes(ql) || [...g.ids].some((id) => id.toLowerCase().includes(ql))));
|
|
148
|
+
if (!hit) throw new Error(`no model matching "${q}". Run with --list to see what was found.`);
|
|
149
|
+
names.push(hit.name);
|
|
150
|
+
}
|
|
151
|
+
} else {
|
|
152
|
+
const eligible = ranked.filter((g) => g.turns.length >= opts.minTurns);
|
|
153
|
+
names = eligible.slice(0, opts.all ? 6 : 2).map((g) => g.name);
|
|
154
|
+
if (!names.length && ranked.length) names = [ranked[0].name];
|
|
155
|
+
}
|
|
156
|
+
if (!names.length) {
|
|
157
|
+
log('Found session files but no model turns in them.');
|
|
158
|
+
return 1;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (opts.judge) {
|
|
162
|
+
const { judgeTurns } = await import('./judge.js');
|
|
163
|
+
const chosen = turns.filter((t) => t.followUp != null && names.includes(groupName(t, groups)));
|
|
164
|
+
await judgeTurns(chosen, { model: opts.judgeModel, log, status });
|
|
165
|
+
status('');
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const card = scorecard(groups, names, { strict: opts.strict });
|
|
169
|
+
|
|
170
|
+
if (opts.json) {
|
|
171
|
+
process.stdout.write(`${JSON.stringify(card, null, 2)}\n`);
|
|
172
|
+
return 0;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const metaLine = summaryLine(card, units, errors, readMs);
|
|
176
|
+
process.stdout.write(`\n${metaLine}\n\n${renderTerminal(card, { color })}\n`);
|
|
177
|
+
|
|
178
|
+
const notes = [];
|
|
179
|
+
if (card.single) {
|
|
180
|
+
notes.push(`Only one model has ${opts.minTurns}+ turns, so there's nothing to compare yet. Try --min-turns 10, --all, or --list.`);
|
|
181
|
+
}
|
|
182
|
+
const agentSets = card.meta.map((m) => m.agents.join('+'));
|
|
183
|
+
if (!card.single && new Set(agentSets).size > 1) {
|
|
184
|
+
notes.push(`These models ran in different agents (${card.meta.map((m) => `${m.name}: ${m.agents.map((a) => READERS[a].label).join(', ')}`).join('; ')}), so harness differences are part of the comparison.`);
|
|
185
|
+
}
|
|
186
|
+
const small = card.meta.filter((m) => m.followUps < 100);
|
|
187
|
+
if (small.length) notes.push(`Small sample for ${small.map((m) => `${m.name} (${m.followUps} follow-ups)`).join(', ')}. Treat close rows as noise${opts.strict ? '' : ', or rerun with --strict'}.`);
|
|
188
|
+
if (!opts.judge) notes.push('Follow-ups were labeled with keyword rules. Add --judge to have Claude label them.');
|
|
189
|
+
if (errors.length) {
|
|
190
|
+
const byReason = new Map();
|
|
191
|
+
for (const e of errors) byReason.set(e.error, (byReason.get(e.error) || 0) + 1);
|
|
192
|
+
const reasons = [...byReason].sort((a, b) => b[1] - a[1]).slice(0, 3).map(([r, n]) => `${n}× ${r.slice(0, 120)}`);
|
|
193
|
+
notes.push(`${errors.length} file(s) couldn't be read and were skipped: ${reasons.join('; ')}`);
|
|
194
|
+
}
|
|
195
|
+
for (const n of notes) process.stdout.write(`\n${color ? '\x1b[2m' : ''}• ${n}${color ? '\x1b[22m' : ''}`);
|
|
196
|
+
process.stdout.write('\n');
|
|
197
|
+
|
|
198
|
+
if (opts.image) {
|
|
199
|
+
const out = path.resolve(opts.out || defaultOut());
|
|
200
|
+
const written = writeImage(card, out);
|
|
201
|
+
process.stdout.write(`\nSaved ${written}\n`);
|
|
202
|
+
}
|
|
203
|
+
return 0;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function groupName(turn, groups) {
|
|
207
|
+
for (const g of groups.values()) if (g.ids.has(turn.model)) return g.name;
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function summaryLine(card, units, errors, ms) {
|
|
212
|
+
const sessions = card.meta.reduce((s, m) => s + m.sessions, 0);
|
|
213
|
+
const turns = card.meta.reduce((s, m) => s + m.turns, 0);
|
|
214
|
+
const firsts = card.meta.map((m) => m.first).filter(Boolean);
|
|
215
|
+
const lasts = card.meta.map((m) => m.last).filter(Boolean);
|
|
216
|
+
const range = firsts.length ? `${fmtDate(Math.min(...firsts))} – ${fmtDate(Math.max(...lasts))}` : '';
|
|
217
|
+
const agents = [...new Set(card.meta.flatMap((m) => m.agents))].map((a) => READERS[a].label).join(', ');
|
|
218
|
+
return `personal-eval · ${turns.toLocaleString()} turns across ${sessions.toLocaleString()} sessions · ${range} · ${agents} · read ${units.length} files in ${(ms / 1000).toFixed(1)}s`;
|
|
219
|
+
}
|