@letsrebase/verify 0.1.3 → 0.2.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/.claude/commands/rebase-verify.md +2 -1
- package/README.md +1 -1
- package/bin/rebase-verify.mjs +27 -2
- package/package.json +1 -1
- package/src/agents/run.mjs +2 -2
- package/src/groundedness.mjs +28 -6
- package/src/languages.mjs +250 -0
- package/src/profile-llm.mjs +15 -8
- package/src/profile.mjs +80 -89
|
@@ -16,6 +16,7 @@ The default is **save, don't submit**. Submitting is a separate, explicit action
|
|
|
16
16
|
```
|
|
17
17
|
node bin/rebase-verify.mjs prepare
|
|
18
18
|
```
|
|
19
|
+
The profile is written in Italian unless the candidate asks for another language: then append `--lang <code>` (`it` or `en`). `finalize` reads the language back from `out/narrative-input.json`.
|
|
19
20
|
If the candidate opted into a local timezone in step 1, append `--tz <zone>` here AND to the `finalize` call in step 6. `prepare` and `finalize` must use the same `--tz`: the sampled sessions in `out/practices-sample.json` and every day and month count are bucketed in that zone, and `finalize` re-reads the logs.
|
|
20
21
|
Show the candidate the line `… representative: …` from the output. This is the auto-selection of representative projects, 3 to 5, adaptive: flagships by significance, plus a 4th/5th slot only when a project adds a new primary type or comparable significance. `--top N` forces a fixed count if the candidate asks.
|
|
21
22
|
|
|
@@ -58,7 +59,7 @@ The default is **save, don't submit**. Submitting is a separate, explicit action
|
|
|
58
59
|
- **No proper names.** No companies, clients, people, products, brands, repositories. Describe each project ONLY by abstract domain and context.
|
|
59
60
|
- Use only the data provided in `out/narrative-input.json`. No invention, no hyperbole.
|
|
60
61
|
- Evidence-based: claims supported by signals (areas, stack, landing, prompts, commits).
|
|
61
|
-
-
|
|
62
|
+
- Write every text in the language `out/narrative-input.json` names in `languageName` (its `language` code is `it` for Italian, `en` for English; Italian unless the candidate passed `--lang`). Dry, readable. Technology, product, library and method names stay as written. Write numbers as plain digits exactly as they appear in the data, with no thousands separator. The JSON keys stay as shown. No emojis, no em dashes.
|
|
62
63
|
- Length: summary ≤ 60 words; cognitive narrative ≤ 130 words; learning summary ≤ 40 words; ai_relationship / intensity / distribution narratives ≤ 50 words each; per-project domain ≤ 60 words; per-project `did` ≤ 60 words.
|
|
63
64
|
- Domains rollup: 3-5 entries. Assign every product in `domainEvidence` to exactly one domain; the summed `products` and `sessions` across domains must not exceed the profile totals (groundedness checks this). Labels abstract, counts only, never names.
|
|
64
65
|
|
package/README.md
CHANGED
|
@@ -191,7 +191,7 @@ If you spot something we should change, [open an issue](https://github.com/letsr
|
|
|
191
191
|
| `submit --dry-run` | write the exact outgoing payload to `out/payload-preview.json`, send nothing |
|
|
192
192
|
| `submit --yes` | sign in to rebase in the browser, then send the profile; a person at rebase reviews it |
|
|
193
193
|
|
|
194
|
-
All commands run as `node bin/rebase-verify.mjs <sub>` or as `rebase-verify <sub>` after `npm link`. Common flags: `--top N` (force the project count; default is adaptive 3–5), `--root <dir>`, the per-source roots and opt-outs from the Sources table above, `--hub <url>` (where `submit` sends; default `https://letsrebase.com`, also settable with `REBASE_VERIFY_HUB_URL`; `--hub preview` means `https://preview.letsrebase.com`), `--tz <IANA zone>` (bucket the day and month counts (active days, streak, technology-usage months) in your timezone instead of the UTC default; the zone you choose is recorded in the profile, which is also why UTC is the default: a zone names a place, and nothing location-shaped should leave your machine unless you opt in). Without Claude Code, set `ANTHROPIC_API_KEY` and the narrative goes through the API instead of your subscription, note that on this path the narrative input (project labels, README/CLAUDE.md excerpts, dependency names, commit subjects, sampled prompts) is sent to api.anthropic.com under your own key, before any name-stripping; the tool warns when this happens, and an explicit `--narrative-file` always takes precedence over the key. The subscription and manual paths stay fully local until submit. Details in [PRIVACY.md](PRIVACY.md).
|
|
194
|
+
All commands run as `node bin/rebase-verify.mjs <sub>` or as `rebase-verify <sub>` after `npm link`. Common flags: `--top N` (force the project count; default is adaptive 3–5), `--root <dir>`, the per-source roots and opt-outs from the Sources table above, `--hub <url>` (where `submit` sends; default `https://letsrebase.com`, also settable with `REBASE_VERIFY_HUB_URL`; `--hub preview` means `https://preview.letsrebase.com`), `--lang <code>` (the language the profile is written in: `it` Italian, the default, or `en` English; it sets the language of the model-written prose and of `out/profile.md`, and is recorded as `language` in the profile; the enum codes in the payload stay English), `--tz <IANA zone>` (bucket the day and month counts (active days, streak, technology-usage months) in your timezone instead of the UTC default; the zone you choose is recorded in the profile, which is also why UTC is the default: a zone names a place, and nothing location-shaped should leave your machine unless you opt in). Without Claude Code, set `ANTHROPIC_API_KEY` and the narrative goes through the API instead of your subscription, note that on this path the narrative input (project labels, README/CLAUDE.md excerpts, dependency names, commit subjects, sampled prompts) is sent to api.anthropic.com under your own key, before any name-stripping; the tool warns when this happens, and an explicit `--narrative-file` always takes precedence over the key. The subscription and manual paths stay fully local until submit. Details in [PRIVACY.md](PRIVACY.md).
|
|
195
195
|
|
|
196
196
|
## Tests
|
|
197
197
|
|
package/bin/rebase-verify.mjs
CHANGED
|
@@ -53,6 +53,7 @@ import { selectRepresentatives, assembleProfile, renderMarkdown, summarizeSource
|
|
|
53
53
|
import { resolveHub } from "../src/hub.mjs";
|
|
54
54
|
import { submitProfile, buildPayload } from "../src/submit.mjs";
|
|
55
55
|
import { buildTrajectory } from "../src/trajectory.mjs";
|
|
56
|
+
import { DEFAULT_LANGUAGE, SUPPORTED_LANGUAGES, isSupportedLanguage } from "../src/languages.mjs";
|
|
56
57
|
import { assessGroundedness } from "../src/groundedness.mjs";
|
|
57
58
|
import { assessStructure, assessAgainstLogs, submitBlockers } from "../src/consistency.mjs";
|
|
58
59
|
import { computeAiRelationship } from "../src/ai-relationship.mjs";
|
|
@@ -123,6 +124,13 @@ try {
|
|
|
123
124
|
process.exit(2);
|
|
124
125
|
}
|
|
125
126
|
|
|
127
|
+
// Validate --lang the same way: the language is the profile's, so it is checked before anything is read.
|
|
128
|
+
const langFlag = flag("lang", DEFAULT_LANGUAGE);
|
|
129
|
+
if (!isSupportedLanguage(langFlag)) {
|
|
130
|
+
console.error(`Invalid --lang "${langFlag}". Expected one of: ${SUPPORTED_LANGUAGES.join(", ")}.`);
|
|
131
|
+
process.exit(2);
|
|
132
|
+
}
|
|
133
|
+
|
|
126
134
|
// Every generated file (narrative-input.json, narrative.json, practices-input.json,
|
|
127
135
|
// practices-sample.json, practices.json, practices-detail.json, agent-log.jsonl,
|
|
128
136
|
// candidate.json, profile.md) lands in ./out, never in the repo root.
|
|
@@ -330,6 +338,7 @@ const narrativeOptionsOf = (i) => ({
|
|
|
330
338
|
distribution: i.distribution,
|
|
331
339
|
allProjects: i.projects,
|
|
332
340
|
compactionSummaries: i.parsed.compactionSummaries,
|
|
341
|
+
language: langFlag,
|
|
333
342
|
});
|
|
334
343
|
|
|
335
344
|
// The model-classified practices: written only when some are published and
|
|
@@ -361,6 +370,7 @@ async function cmdGenerate() {
|
|
|
361
370
|
distribution,
|
|
362
371
|
allProjects: projects,
|
|
363
372
|
compactionSummaries: parsed.compactionSummaries,
|
|
373
|
+
language: langFlag,
|
|
364
374
|
};
|
|
365
375
|
let practices;
|
|
366
376
|
let narrative;
|
|
@@ -407,9 +417,10 @@ function assembleWithGroundedness(args) {
|
|
|
407
417
|
if (args.narrative && args.trajectory?.vocabularyCandidates?.length && !args.narrative.trajectory?.vocabulary_adopted?.length) {
|
|
408
418
|
warn(` note: the narrative has no trajectory.vocabulary_adopted, newVocabulary stays empty (raw candidates are never used; re-run the narrative step to fill it)`);
|
|
409
419
|
}
|
|
410
|
-
const
|
|
420
|
+
const withLanguage = { language: langFlag, ...args };
|
|
421
|
+
const draft = assembleProfile(withLanguage);
|
|
411
422
|
const groundedness = assessGroundedness(draft);
|
|
412
|
-
return assembleProfile({ ...
|
|
423
|
+
return assembleProfile({ ...withLanguage, groundedness });
|
|
413
424
|
}
|
|
414
425
|
|
|
415
426
|
async function cmdPrepare() {
|
|
@@ -424,6 +435,7 @@ async function cmdPrepare() {
|
|
|
424
435
|
distribution,
|
|
425
436
|
allProjects: projects,
|
|
426
437
|
compactionSummaries: parsed.compactionSummaries,
|
|
438
|
+
language: langFlag,
|
|
427
439
|
});
|
|
428
440
|
writeFileSync(join(out, "narrative-input.json"), JSON.stringify(input, null, 2));
|
|
429
441
|
console.log(`Wrote ${OUT_DIR}/narrative-input.json.`);
|
|
@@ -456,6 +468,15 @@ function mergePracticesAnswers(out, codeBlock, classifiedBy) {
|
|
|
456
468
|
}
|
|
457
469
|
}
|
|
458
470
|
|
|
471
|
+
function preparedLanguage(out) {
|
|
472
|
+
try {
|
|
473
|
+
const code = JSON.parse(readFileSync(join(out, "narrative-input.json"), "utf8")).language;
|
|
474
|
+
return isSupportedLanguage(code) ? code : null;
|
|
475
|
+
} catch {
|
|
476
|
+
return null;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
459
480
|
async function cmdFinalize() {
|
|
460
481
|
console.log(`\nrebase-verify finalize\n`);
|
|
461
482
|
const narrativeFile = flag("narrative-file", join(outPath(), "narrative.json"));
|
|
@@ -465,6 +486,8 @@ async function cmdFinalize() {
|
|
|
465
486
|
}
|
|
466
487
|
const { parsed, fingerprint, forensics, projects, selected, enrichments, trajectory, aiRelationship, agenticLiteracy, intensity, distribution, techUsage, practices, sources, out } = await loadProfileInputs();
|
|
467
488
|
const merged = mergePracticesAnswers(out, practices, SLASH_COMMAND);
|
|
489
|
+
// The narrative was written in the language `prepare` put in narrative-input.json; an explicit --lang wins.
|
|
490
|
+
const language = has("lang") ? langFlag : preparedLanguage(out) ?? langFlag;
|
|
468
491
|
const { narrative } = await generateNarrative(selected, enrichments, {
|
|
469
492
|
overrideFile: narrativeFile,
|
|
470
493
|
trajectory,
|
|
@@ -474,8 +497,10 @@ async function cmdFinalize() {
|
|
|
474
497
|
distribution,
|
|
475
498
|
allProjects: projects,
|
|
476
499
|
compactionSummaries: parsed.compactionSummaries,
|
|
500
|
+
language,
|
|
477
501
|
});
|
|
478
502
|
writeProfile(out, assembleWithGroundedness({
|
|
503
|
+
language,
|
|
479
504
|
projects, narrative, fingerprint, forensics, trajectory, aiRelationship, agenticLiteracy, intensity, distribution, techUsage, practices: merged, sources,
|
|
480
505
|
generatedBy: { narrative: SLASH_COMMAND },
|
|
481
506
|
manifestHash: fingerprint.manifest.bundleHash,
|
package/package.json
CHANGED
package/src/agents/run.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// before anything is used. The agent's transcript is removed afterwards.
|
|
5
5
|
import { appendFileSync } from "node:fs";
|
|
6
6
|
import { PRACTICES_WARN_WHAT, classifyPractices } from "../practices-llm.mjs";
|
|
7
|
-
import { MODEL,
|
|
7
|
+
import { MODEL, anthropicCall, narrativeSystem, validateNarrative, warnApiKey } from "../profile-llm.mjs";
|
|
8
8
|
import { AgentAuthError, AgentStartError, ModelNotOfferedError, ToolUseError, startAgent } from "./acp.mjs";
|
|
9
9
|
import { firstJsonObject } from "./json-answer.mjs";
|
|
10
10
|
|
|
@@ -50,7 +50,7 @@ export async function runWithAgent({ agent, model, narrativeInput, practicesInpu
|
|
|
50
50
|
let narrative;
|
|
51
51
|
for (let attempt = 0; !narrative; attempt++) {
|
|
52
52
|
onStatus({ step: "narrative", retry: attempt > 0 });
|
|
53
|
-
const text = await ask(
|
|
53
|
+
const text = await ask(narrativeSystem(narrativeInput.language), JSON.stringify(narrativeInput));
|
|
54
54
|
try {
|
|
55
55
|
narrative = validateNarrative(firstJsonObject(text), agent.id);
|
|
56
56
|
} catch (e) {
|
package/src/groundedness.mjs
CHANGED
|
@@ -63,20 +63,41 @@ const COGNITIVE_TAGS = [
|
|
|
63
63
|
"research-first","decomposer","orchestrator","verification-heavy","risk-calibrated",
|
|
64
64
|
];
|
|
65
65
|
|
|
66
|
+
// How a language writes numbers: the thousands separator and the decimal mark.
|
|
67
|
+
// A profile with no `language` predates the field and was written in English.
|
|
68
|
+
const NUMBER_FORMATS = {
|
|
69
|
+
it: { group: ".", decimal: "," },
|
|
70
|
+
en: { group: ",", decimal: "." },
|
|
71
|
+
};
|
|
72
|
+
const DEFAULT_NUMBER_LANGUAGE = "en";
|
|
73
|
+
|
|
74
|
+
// Read one numeric token ("1.168", "12,5") the way `language` writes it.
|
|
75
|
+
// Returns NaN for a token that is not a number in that language.
|
|
76
|
+
function parseNumber(raw, language) {
|
|
77
|
+
const { group, decimal } = NUMBER_FORMATS[language] ?? NUMBER_FORMATS[DEFAULT_NUMBER_LANGUAGE];
|
|
78
|
+
const esc = (c) => `\\${c}`;
|
|
79
|
+
const grouped = new RegExp(`^\\d{1,3}(?:${esc(group)}\\d{3})+(?:${esc(decimal)}\\d+)?$`);
|
|
80
|
+
let t = raw;
|
|
81
|
+
if (grouped.test(t)) t = t.split(group).join("");
|
|
82
|
+
t = t.replace(decimal, ".");
|
|
83
|
+
return /^\d+(?:\.\d+)?$/.test(t) ? Number(t) : NaN;
|
|
84
|
+
}
|
|
85
|
+
|
|
66
86
|
// Extract candidate ANCHORS from a chunk of prose.
|
|
67
|
-
function extractAnchors(text) {
|
|
87
|
+
function extractAnchors(text, language = DEFAULT_NUMBER_LANGUAGE) {
|
|
68
88
|
if (!text || typeof text !== "string") return [];
|
|
69
89
|
const anchors = [];
|
|
70
90
|
|
|
71
91
|
// Numbers that look meaningful (>1 digit OR followed by a unit/word).
|
|
72
|
-
for (const m of text.matchAll(/\b\d{1,5}(?:[.,]\d+)
|
|
73
|
-
const n =
|
|
92
|
+
for (const m of text.matchAll(/\b\d{1,5}(?:[.,]\d+)*\b/g)) {
|
|
93
|
+
const n = parseNumber(m[0], language);
|
|
74
94
|
if (Number.isFinite(n) && n >= 2) anchors.push({ kind: "number", value: n, raw: m[0] });
|
|
75
95
|
}
|
|
76
96
|
|
|
77
97
|
// Percentages.
|
|
78
|
-
for (const m of text.matchAll(/(\d{1,3})\s*%/g)) {
|
|
79
|
-
|
|
98
|
+
for (const m of text.matchAll(/(?<![\d.,])(\d{1,3}(?:[.,]\d+)?)\s*%/g)) {
|
|
99
|
+
const n = parseNumber(m[1], language);
|
|
100
|
+
if (Number.isFinite(n)) anchors.push({ kind: "percent", value: n / 100, raw: m[0] });
|
|
80
101
|
}
|
|
81
102
|
|
|
82
103
|
// Year-months (2026-03, 2026-Q1).
|
|
@@ -301,13 +322,14 @@ function classifyTextFields(profile) {
|
|
|
301
322
|
export function assessGroundedness(profile) {
|
|
302
323
|
const pool = collectSupportPool(profile);
|
|
303
324
|
const fields = classifyTextFields(profile);
|
|
325
|
+
const language = profile?.language ?? DEFAULT_NUMBER_LANGUAGE;
|
|
304
326
|
|
|
305
327
|
let total = 0;
|
|
306
328
|
let supported = 0;
|
|
307
329
|
const anomalies = [];
|
|
308
330
|
|
|
309
331
|
for (const f of fields) {
|
|
310
|
-
const anchors = extractAnchors(f.text);
|
|
332
|
+
const anchors = extractAnchors(f.text, language);
|
|
311
333
|
for (const a of anchors) {
|
|
312
334
|
total++;
|
|
313
335
|
let ok = false;
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
// The languages a profile can be written in.
|
|
2
|
+
//
|
|
3
|
+
// A language is one entry in LANGUAGES: its code, its English name (the prompt
|
|
4
|
+
// tells the model "write in <name>"), and the label table `profile.md` is
|
|
5
|
+
// rendered from. Adding a language is one entry here and nothing else.
|
|
6
|
+
//
|
|
7
|
+
// The payload never changes with the language: enum values stay the English
|
|
8
|
+
// codes the detectors emit ("daily driver", "deep focus", ...). Only what a
|
|
9
|
+
// person reads goes through `labels`: headings, fixed phrases, and the display
|
|
10
|
+
// name of each code. A code with no label shows as itself.
|
|
11
|
+
|
|
12
|
+
export const DEFAULT_LANGUAGE = "it";
|
|
13
|
+
|
|
14
|
+
const plural = (n, one, many) => (n === 1 ? one : many);
|
|
15
|
+
|
|
16
|
+
const EN = {
|
|
17
|
+
title: (name) => `Agentic profile${name ? ` — ${name}` : ""}`,
|
|
18
|
+
window: (p) => `Window: ${p.window.from} → ${p.window.to} · ${p.volume.sessions} sessions · ${p.volume.instructions} instructions · ${p.volume.products} products`,
|
|
19
|
+
screen: (score, note) => `Log consistency screen: ${score == null ? "n/a" : `${score}/100`} (${note})`,
|
|
20
|
+
sources: (list) => `Sources: ${list}`,
|
|
21
|
+
source: (s) => `${s.source} (${s.captureLevel} capture${s.backend ? `, ${s.backend}` : ""}) · ${s.sessions} sessions read`,
|
|
22
|
+
lowerBounds: "Window and counts are lower bounds: logs rotate and old sessions are pruned.",
|
|
23
|
+
domains: "Domains",
|
|
24
|
+
domainLine: (d, note) => `- **${d.label}** · ${d.products} products · ${d.sessions} sessions${note ? ` — ${note}` : ""}`,
|
|
25
|
+
representative: "Representative projects",
|
|
26
|
+
domainFallback: "(domain)",
|
|
27
|
+
projectLine: (pr, landing) => `${pr.span.from ?? "n/a"}→${pr.span.to ?? "n/a"} · ${pr.sessions} sessions · ${landing}`,
|
|
28
|
+
landing: (l) => `commits ${l.commits} · reverts ${l.reverts} · churn ${l.revertChurn}${l.checksRun ? " · checks passed" : ""}`,
|
|
29
|
+
stack: (list) => `stack: ${list}`,
|
|
30
|
+
orchestration: (bits) => `orchestration: ${bits}`,
|
|
31
|
+
sessionsByTool: (tools, disjoint) => `sessions by tool: ${tools}${disjoint ? " (different periods)" : ""}`,
|
|
32
|
+
dispatches: (n) => `${n} agent dispatches`,
|
|
33
|
+
delegations: (n) => `${n} sub-agent delegations`,
|
|
34
|
+
whyRepresentative: "why representative:",
|
|
35
|
+
artifact: (a) => `artifact: ${a ? a.label : "— (none attached)"}`,
|
|
36
|
+
otherProjects: "Other projects (inventory)",
|
|
37
|
+
otherLine: (o, types, tag) => `- ${types} · ${o.span.from ?? "n/a"}→${o.span.to ?? "n/a"} · ${o.sessions} sess${tag}`,
|
|
38
|
+
cognitive: "Cognitive profile",
|
|
39
|
+
tags: "tags:",
|
|
40
|
+
aiHeading: "How they work with the AI",
|
|
41
|
+
aiLine: (a, mode) => `${a.directing}% directing · ${a.coThinking}% co-thinking · ${mode}`,
|
|
42
|
+
intensity: "Practice intensity",
|
|
43
|
+
daysNote: (tz) => ` (days counted in ${tz})`,
|
|
44
|
+
activeDays: (i, note) => `- Active days: ${i.activeDays} / ${i.observedDays} (${Math.round(i.activeDaysRatio * 100)}%)${note}`,
|
|
45
|
+
medianSessionsPerDay: (n) => `- Median sessions per active day: ${n}`,
|
|
46
|
+
medianDepth: (n) => `- Median session depth: ${n} tool calls`,
|
|
47
|
+
streak: (n) => `- Longest streak: ${n} consecutive days`,
|
|
48
|
+
peakDay: (n) => `- Peak day: ${n} tool calls`,
|
|
49
|
+
cadence: (cadence, shape) => `Cadence: ${cadence} · ${shape}`,
|
|
50
|
+
distribution: "Work distribution",
|
|
51
|
+
perProduct: (d) => `- Sessions per product: median ${d.medianSessionsPerProduct} · mean ${d.meanSessionsPerProduct}`,
|
|
52
|
+
top3: (d) => `- Top 3 products: ${Math.round(d.top3Share * 100)}% of all sessions`,
|
|
53
|
+
multiMonth: (d) => `- Multi-month products: ${d.multiMonthProducts} / ${d.products} (${Math.round(d.multiMonthShare * 100)}%)`,
|
|
54
|
+
shape: (shape) => `Shape: ${shape}`,
|
|
55
|
+
techUsage: "Technology usage",
|
|
56
|
+
monthsNote: (tz) => ` (months counted in ${tz})`,
|
|
57
|
+
techIntro: (note) => `Counts per technology detected in the stack, across all products${note}. Sessions are those of the products where it was detected. The band only labels the month counts.`,
|
|
58
|
+
techLine: (t, band, span) => `- ${t.name}: ${band} · ${t.sessions} sessions · ${t.products} ${plural(t.products, "product", "products")} · ${t.months} ${plural(t.months, "month", "months")} (${span})`,
|
|
59
|
+
to: "to",
|
|
60
|
+
practices: "How the work is done",
|
|
61
|
+
practicesIntro: (note) => `Counts of sessions where a practice was seen, out of the sessions where it could have been${note}. Each row says how it was counted: by code, or by the person's own model.`,
|
|
62
|
+
practiceLine: (t, name, how) => `- ${name}: in ${t.seen} of ${t.of} ${plural(t.of, "session", "sessions")} · ${t.products} ${plural(t.products, "product", "products")} · ${t.months} ${plural(t.months, "month", "months")} · ${how}`,
|
|
63
|
+
byModel: "classified by the person's model",
|
|
64
|
+
byCode: "counted by code",
|
|
65
|
+
literacy: "Agentic literacy",
|
|
66
|
+
uses: "Uses",
|
|
67
|
+
builds: "Builds",
|
|
68
|
+
designs: "Designs",
|
|
69
|
+
subagentDelegations: (n) => `- Sub-agent delegations: ${n}`,
|
|
70
|
+
taskTracking: (n) => `- Task tracking events: ${n}`,
|
|
71
|
+
builtinSlash: (n) => `- Built-in slash commands invoked: ${n}`,
|
|
72
|
+
customSkills: (c) => `- Custom skills/commands: ${c.distinct} distinct, ${c.invocations} invocations`,
|
|
73
|
+
publicMcp: (m) => `- Public MCP servers: ${m.servers} · ${m.calls} calls`,
|
|
74
|
+
customMcp: (m) => `- Custom MCP servers: ${m.servers} · ${m.tools} tools · ${m.calls} calls`,
|
|
75
|
+
skillsAuthored: (n) => `- Skills authored: ${n}`,
|
|
76
|
+
commandsAuthored: (n) => `- Commands authored: ${n}`,
|
|
77
|
+
agentsAuthored: (n) => `- Agents authored: ${n}`,
|
|
78
|
+
hooksEdited: (n) => `- Hooks edited: ${n}`,
|
|
79
|
+
memoryFiles: (n) => `- Project memory files (CLAUDE.md): ${n}`,
|
|
80
|
+
plansFirst: (n) => `- Plans-first (ExitPlanMode): ${n}`,
|
|
81
|
+
subtaskTracking: (n) => `- Subtask tracking (TodoWrite): ${n}`,
|
|
82
|
+
clarifies: (n) => `- Clarifies (AskUserQuestion): ${n}`,
|
|
83
|
+
trajectory: "Trajectory",
|
|
84
|
+
shifts: (midpoint) => `Behavioral shifts (early → late half${midpoint ? `, split at ${midpoint}` : ""}):`,
|
|
85
|
+
topics: "Topics explored, by quarter:",
|
|
86
|
+
vocabulary: (list) => `New vocabulary adopted: ${list}`,
|
|
87
|
+
principles: "Principles codified:",
|
|
88
|
+
stackAdopted: "Stack adopted",
|
|
89
|
+
stackNote: "_Stack as currently declared in the repo: from package.json dependencies (npm manifests only) and the files touched. Dependencies are unavailable if the project folder no longer exists, and services used only over REST (no package) are not auto-detected._",
|
|
90
|
+
// Display names of the payload's codes. A code missing here shows as itself.
|
|
91
|
+
codes: {},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const IT = {
|
|
95
|
+
title: (name) => `Profilo agentico${name ? ` — ${name}` : ""}`,
|
|
96
|
+
window: (p) => `Periodo: ${p.window.from} → ${p.window.to} · ${p.volume.sessions} sessioni · ${p.volume.instructions} istruzioni · ${p.volume.products} prodotti`,
|
|
97
|
+
screen: (score, note) => `Controllo di coerenza dei log: ${score == null ? "n/d" : `${score}/100`} (${note})`,
|
|
98
|
+
sources: (list) => `Fonti: ${list}`,
|
|
99
|
+
source: (s) => `${s.source} (cattura ${s.captureLevel}${s.backend ? `, ${s.backend}` : ""}) · ${s.sessions} sessioni lette`,
|
|
100
|
+
lowerBounds: "Periodo e conteggi sono stime per difetto: i log ruotano e le sessioni vecchie vengono eliminate.",
|
|
101
|
+
domains: "Ambiti",
|
|
102
|
+
domainLine: (d, note) => `- **${d.label}** · ${d.products} prodotti · ${d.sessions} sessioni${note ? ` — ${note}` : ""}`,
|
|
103
|
+
representative: "Progetti rappresentativi",
|
|
104
|
+
domainFallback: "(ambito)",
|
|
105
|
+
projectLine: (pr, landing) => `${pr.span.from ?? "n/d"}→${pr.span.to ?? "n/d"} · ${pr.sessions} sessioni · ${landing}`,
|
|
106
|
+
landing: (l) => `commit ${l.commits} · revert ${l.reverts} · rimaneggiamento ${l.revertChurn}${l.checksRun ? " · controlli superati" : ""}`,
|
|
107
|
+
stack: (list) => `stack: ${list}`,
|
|
108
|
+
orchestration: (bits) => `orchestrazione: ${bits}`,
|
|
109
|
+
sessionsByTool: (tools, disjoint) => `sessioni per strumento: ${tools}${disjoint ? " (periodi diversi)" : ""}`,
|
|
110
|
+
dispatches: (n) => `${n} lanci di agenti`,
|
|
111
|
+
delegations: (n) => `${n} deleghe a sub-agent`,
|
|
112
|
+
whyRepresentative: "perché rappresentativo:",
|
|
113
|
+
artifact: (a) => `allegato: ${a ? a.label : "— (nessuno)"}`,
|
|
114
|
+
otherProjects: "Altri progetti (inventario)",
|
|
115
|
+
otherLine: (o, types, tag) => `- ${types} · ${o.span.from ?? "n/d"}→${o.span.to ?? "n/d"} · ${o.sessions} sess.${tag}`,
|
|
116
|
+
cognitive: "Profilo cognitivo",
|
|
117
|
+
tags: "tag:",
|
|
118
|
+
aiHeading: "Come lavorano con l'AI",
|
|
119
|
+
aiLine: (a, mode) => `${a.directing}% guida · ${a.coThinking}% ragionamento condiviso · ${mode}`,
|
|
120
|
+
intensity: "Intensità della pratica",
|
|
121
|
+
daysNote: (tz) => ` (giorni contati in ${tz})`,
|
|
122
|
+
activeDays: (i, note) => `- Giorni attivi: ${i.activeDays} / ${i.observedDays} (${Math.round(i.activeDaysRatio * 100)}%)${note}`,
|
|
123
|
+
medianSessionsPerDay: (n) => `- Sessioni mediane per giorno attivo: ${n}`,
|
|
124
|
+
medianDepth: (n) => `- Profondità mediana della sessione: ${n} chiamate a strumenti`,
|
|
125
|
+
streak: (n) => `- Serie più lunga: ${n} giorni consecutivi`,
|
|
126
|
+
peakDay: (n) => `- Giorno di picco: ${n} chiamate a strumenti`,
|
|
127
|
+
cadence: (cadence, shape) => `Cadenza: ${cadence} · ${shape}`,
|
|
128
|
+
distribution: "Distribuzione del lavoro",
|
|
129
|
+
perProduct: (d) => `- Sessioni per prodotto: mediana ${d.medianSessionsPerProduct} · media ${d.meanSessionsPerProduct}`,
|
|
130
|
+
top3: (d) => `- Primi 3 prodotti: ${Math.round(d.top3Share * 100)}% di tutte le sessioni`,
|
|
131
|
+
multiMonth: (d) => `- Prodotti su più mesi: ${d.multiMonthProducts} / ${d.products} (${Math.round(d.multiMonthShare * 100)}%)`,
|
|
132
|
+
shape: (shape) => `Forma: ${shape}`,
|
|
133
|
+
techUsage: "Uso delle tecnologie",
|
|
134
|
+
monthsNote: (tz) => ` (mesi contati in ${tz})`,
|
|
135
|
+
techIntro: (note) => `Conteggi per tecnologia rilevata nello stack, su tutti i prodotti${note}. Le sessioni sono quelle dei prodotti in cui è stata rilevata. La fascia etichetta solo i conteggi dei mesi.`,
|
|
136
|
+
techLine: (t, band, span) => `- ${t.name}: ${band} · ${t.sessions} sessioni · ${t.products} ${plural(t.products, "prodotto", "prodotti")} · ${t.months} ${plural(t.months, "mese", "mesi")} (${span})`,
|
|
137
|
+
to: "a",
|
|
138
|
+
practices: "Come si lavora",
|
|
139
|
+
practicesIntro: (note) => `Conteggi delle sessioni in cui una pratica è stata vista, sul totale delle sessioni in cui poteva esserlo${note}. Ogni riga dice come è stata contata: dal codice o dal modello della persona.`,
|
|
140
|
+
practiceLine: (t, name, how) => `- ${name}: in ${t.seen} su ${t.of} ${plural(t.of, "sessione", "sessioni")} · ${t.products} ${plural(t.products, "prodotto", "prodotti")} · ${t.months} ${plural(t.months, "mese", "mesi")} · ${how}`,
|
|
141
|
+
byModel: "classificata dal modello della persona",
|
|
142
|
+
byCode: "contata dal codice",
|
|
143
|
+
literacy: "Competenza agentica",
|
|
144
|
+
uses: "Usa",
|
|
145
|
+
builds: "Costruisce",
|
|
146
|
+
designs: "Progetta",
|
|
147
|
+
subagentDelegations: (n) => `- Deleghe a sub-agent: ${n}`,
|
|
148
|
+
taskTracking: (n) => `- Eventi di tracciamento attività: ${n}`,
|
|
149
|
+
builtinSlash: (n) => `- Comandi slash integrati usati: ${n}`,
|
|
150
|
+
customSkills: (c) => `- Skill/comandi personalizzati: ${c.distinct} distinti, ${c.invocations} invocazioni`,
|
|
151
|
+
publicMcp: (m) => `- Server MCP pubblici: ${m.servers} · ${m.calls} chiamate`,
|
|
152
|
+
customMcp: (m) => `- Server MCP personalizzati: ${m.servers} · ${m.tools} strumenti · ${m.calls} chiamate`,
|
|
153
|
+
skillsAuthored: (n) => `- Skill scritte: ${n}`,
|
|
154
|
+
commandsAuthored: (n) => `- Comandi scritti: ${n}`,
|
|
155
|
+
agentsAuthored: (n) => `- Agenti scritti: ${n}`,
|
|
156
|
+
hooksEdited: (n) => `- Hook modificati: ${n}`,
|
|
157
|
+
memoryFiles: (n) => `- File di memoria del progetto (CLAUDE.md): ${n}`,
|
|
158
|
+
plansFirst: (n) => `- Prima il piano (ExitPlanMode): ${n}`,
|
|
159
|
+
subtaskTracking: (n) => `- Tracciamento dei sotto-compiti (TodoWrite): ${n}`,
|
|
160
|
+
clarifies: (n) => `- Chiede chiarimenti (AskUserQuestion): ${n}`,
|
|
161
|
+
trajectory: "Traiettoria",
|
|
162
|
+
shifts: (midpoint) => `Cambiamenti di comportamento (prima → seconda metà${midpoint ? `, divisione a ${midpoint}` : ""}):`,
|
|
163
|
+
topics: "Temi esplorati, per trimestre:",
|
|
164
|
+
vocabulary: (list) => `Nuovo vocabolario adottato: ${list}`,
|
|
165
|
+
principles: "Principi codificati:",
|
|
166
|
+
stackAdopted: "Stack adottato",
|
|
167
|
+
stackNote: "_Stack come dichiarato oggi nel repo: dalle dipendenze di package.json (solo manifest npm) e dai file toccati. Le dipendenze non sono disponibili se la cartella del progetto non esiste più, e i servizi usati solo via REST (senza pacchetto) non vengono rilevati._",
|
|
168
|
+
codes: {
|
|
169
|
+
// intensity.cadence
|
|
170
|
+
"daily driver": "uso quotidiano",
|
|
171
|
+
"heavy regular": "uso regolare e intenso",
|
|
172
|
+
weekly: "settimanale",
|
|
173
|
+
occasional: "occasionale",
|
|
174
|
+
// intensity.sessionShape
|
|
175
|
+
"marathon sessions": "sessioni maratona",
|
|
176
|
+
"deep sessions": "sessioni profonde",
|
|
177
|
+
"focused sessions": "sessioni mirate",
|
|
178
|
+
"short bursts": "brevi interventi",
|
|
179
|
+
// distribution.shape
|
|
180
|
+
"deep focus": "focus profondo",
|
|
181
|
+
balanced: "equilibrata",
|
|
182
|
+
portfolio: "portafoglio",
|
|
183
|
+
// aiRelationship.mode
|
|
184
|
+
"directing-leaning": "orientata alla guida",
|
|
185
|
+
"co-thinking-leaning": "orientata al ragionamento condiviso",
|
|
186
|
+
// techUsage band
|
|
187
|
+
continuous: "continuo",
|
|
188
|
+
recurring: "ricorrente",
|
|
189
|
+
// trajectory metrics
|
|
190
|
+
"median prompt words": "parole mediane per prompt",
|
|
191
|
+
"delegation rate": "tasso di delega",
|
|
192
|
+
"research:mutation": "ricerca:modifica",
|
|
193
|
+
"verification rate": "tasso di verifica",
|
|
194
|
+
// trajectory topics
|
|
195
|
+
"agent architecture": "architettura degli agenti",
|
|
196
|
+
"design & UI": "design e UI",
|
|
197
|
+
"security & auth": "sicurezza e autenticazione",
|
|
198
|
+
"dev tooling": "strumenti di sviluppo",
|
|
199
|
+
"data & schema": "dati e schema",
|
|
200
|
+
"AI patterns": "pattern di AI",
|
|
201
|
+
"business & domain": "business e dominio",
|
|
202
|
+
// project type tags
|
|
203
|
+
"product-build": "sviluppo di prodotto",
|
|
204
|
+
"audit-research": "audit e ricerca",
|
|
205
|
+
"agent-tooling": "strumenti per agenti",
|
|
206
|
+
"static-site": "sito statico",
|
|
207
|
+
"ai-platform": "piattaforma AI",
|
|
208
|
+
"data-migration": "migrazione dati",
|
|
209
|
+
"feature-work": "lavoro su funzionalità",
|
|
210
|
+
testing: "test",
|
|
211
|
+
"quality-gating": "controllo di qualità",
|
|
212
|
+
orchestrated: "orchestrato",
|
|
213
|
+
"design-research": "ricerca di design",
|
|
214
|
+
exploration: "esplorazione",
|
|
215
|
+
// cognitive tags
|
|
216
|
+
"research-first": "prima la ricerca",
|
|
217
|
+
decomposer: "scompone i problemi",
|
|
218
|
+
orchestrator: "orchestra",
|
|
219
|
+
"verification-heavy": "verifica molto",
|
|
220
|
+
"risk-calibrated": "rischio calibrato",
|
|
221
|
+
// practices
|
|
222
|
+
checks_before_commit: "controlli prima del commit",
|
|
223
|
+
tests_with_changes: "test insieme alle modifiche",
|
|
224
|
+
failure_reproduced_before_fix: "errore riprodotto prima della correzione",
|
|
225
|
+
plan_before_edit: "piano prima della modifica",
|
|
226
|
+
reviews_changes: "rilegge le modifiche",
|
|
227
|
+
design_documents: "documenti di progettazione",
|
|
228
|
+
security_checks: "controlli di sicurezza",
|
|
229
|
+
asks_for_alternatives: "chiede alternative",
|
|
230
|
+
pushes_back_with_reason: "contesta con una ragione",
|
|
231
|
+
states_done_criteria: "dichiara i criteri di completamento",
|
|
232
|
+
limits_scope: "limita il perimetro",
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// name: the English name the prompt gives the model.
|
|
237
|
+
export const LANGUAGES = {
|
|
238
|
+
it: { code: "it", name: "Italian", labels: IT },
|
|
239
|
+
en: { code: "en", name: "English", labels: EN },
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
export const SUPPORTED_LANGUAGES = Object.keys(LANGUAGES);
|
|
243
|
+
|
|
244
|
+
export const isSupportedLanguage = (code) => Object.hasOwn(LANGUAGES, code);
|
|
245
|
+
|
|
246
|
+
// A profile with no `language` predates the field and was written in English.
|
|
247
|
+
export const labelsFor = (code) => (LANGUAGES[code] ?? LANGUAGES.en).labels;
|
|
248
|
+
|
|
249
|
+
// The display name of a payload code, or the code itself when the language has none.
|
|
250
|
+
export const codeLabel = (labels, code) => labels.codes[code] ?? code;
|
package/src/profile-llm.mjs
CHANGED
|
@@ -9,16 +9,17 @@
|
|
|
9
9
|
|
|
10
10
|
import { readFileSync } from "node:fs";
|
|
11
11
|
import { firstJsonObject } from "./agents/json-answer.mjs";
|
|
12
|
+
import { DEFAULT_LANGUAGE, LANGUAGES } from "./languages.mjs";
|
|
12
13
|
|
|
13
14
|
export const MODEL = "claude-opus-4-7";
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
const NARRATIVE_PROMPT = `You write a candidate's work profile from the logs of their activity with AI development tools.
|
|
16
17
|
|
|
17
18
|
HARD RULES:
|
|
18
19
|
- NO proper names: no companies, clients, people, products, brands, or repositories. Describe each project ONLY by abstract domain and context (e.g. "talent and campaigns management platform", not the actual product name). Exception: the agent CLI names in the orchestration data (e.g. Claude Code, opencode, codex, aider) are tools, not client brands — you may name them when citing the per-CLI split.
|
|
19
20
|
- Use only the data provided. No invention, no empty praise, no hyperbolic adjectives.
|
|
20
21
|
- Concrete and evidence-based: every claim must rest on signals in the digest (areas touched, stack, landing signals, prompts, commits).
|
|
21
|
-
-
|
|
22
|
+
- Write every text in {LANGUAGE}: dry, readable by a human. Technology, product, library and method names stay as written. Write numbers as plain digits exactly as they appear in the data, with no thousands separator. The JSON keys stay as shown. No emojis, no em dashes.
|
|
22
23
|
|
|
23
24
|
You receive a JSON with the selected projects (opaque ids p1, p2, ...), each with: type, span, volumes, code areas, stack, landing signals (commits/reverts/checks), an orchestration block, web-search topics, sampled prompts, and LOCAL repo context (description, docs, dependencies, commit subjects).
|
|
24
25
|
|
|
@@ -66,6 +67,9 @@ Reply ONLY with a valid JSON in this shape:
|
|
|
66
67
|
"projects": [ { "id": "p1", "domain": "abstract domain", "did": "2-3 sentences on what they did", "why_representative": "1 sentence" } ]
|
|
67
68
|
}`;
|
|
68
69
|
|
|
70
|
+
// The narrative prompt for a language code from src/languages.mjs.
|
|
71
|
+
export const narrativeSystem = (language = DEFAULT_LANGUAGE) => NARRATIVE_PROMPT.replace("{LANGUAGE}", LANGUAGES[language].name);
|
|
72
|
+
|
|
69
73
|
// Scrub probable proper nouns from the prompt samples we hand to the model
|
|
70
74
|
// as evidence. The LLM has a hard anti-naming rule but we don't rely on
|
|
71
75
|
// soft constraints alone: replace capitalised tokens (not at sentence start)
|
|
@@ -84,8 +88,11 @@ function scrubExamples(examples) {
|
|
|
84
88
|
};
|
|
85
89
|
}
|
|
86
90
|
|
|
87
|
-
function narrativeInput(selected, enrichments, trajectory, compactionSummaries, aiRelationship, agenticLiteracy, intensity, distribution, allProjects) {
|
|
91
|
+
function narrativeInput(selected, enrichments, trajectory, compactionSummaries, aiRelationship, agenticLiteracy, intensity, distribution, allProjects, language) {
|
|
88
92
|
return {
|
|
93
|
+
// The language the prose is written in: the prompt names it, and the slash command reads it here.
|
|
94
|
+
language,
|
|
95
|
+
languageName: LANGUAGES[language].name,
|
|
89
96
|
// Compact per-product evidence across ALL products (not just the selected
|
|
90
97
|
// ones) so the model can derive the aggregate domains. Local-only input;
|
|
91
98
|
// the output side carries abstract labels and counts, never names.
|
|
@@ -172,7 +179,7 @@ async function postMessage(key, system, user, maxTokens, signal) {
|
|
|
172
179
|
}
|
|
173
180
|
|
|
174
181
|
async function callAnthropic(input, key) {
|
|
175
|
-
const text = await postMessage(key,
|
|
182
|
+
const text = await postMessage(key, narrativeSystem(input.language), JSON.stringify(input), 3000);
|
|
176
183
|
return firstJsonObject(text);
|
|
177
184
|
}
|
|
178
185
|
|
|
@@ -228,8 +235,8 @@ export function validateNarrative(n, ctx) {
|
|
|
228
235
|
|
|
229
236
|
// Builds the narrative input only. Never touches the network, so `prepare`
|
|
230
237
|
// can call it whatever the environment holds.
|
|
231
|
-
export function narrativeInputFor(selected, enrichments, { trajectory, compactionSummaries, aiRelationship, agenticLiteracy, intensity, distribution, allProjects } = {}) {
|
|
232
|
-
return narrativeInput(selected, enrichments, trajectory, compactionSummaries, aiRelationship, agenticLiteracy, intensity, distribution, allProjects);
|
|
238
|
+
export function narrativeInputFor(selected, enrichments, { trajectory, compactionSummaries, aiRelationship, agenticLiteracy, intensity, distribution, allProjects, language = DEFAULT_LANGUAGE } = {}) {
|
|
239
|
+
return narrativeInput(selected, enrichments, trajectory, compactionSummaries, aiRelationship, agenticLiteracy, intensity, distribution, allProjects, language);
|
|
233
240
|
}
|
|
234
241
|
|
|
235
242
|
// Returns { narrative, input, source }. narrative is null if no key and no
|
|
@@ -237,8 +244,8 @@ export function narrativeInputFor(selected, enrichments, { trajectory, compactio
|
|
|
237
244
|
// An explicit --narrative-file always wins over the env key: the API path
|
|
238
245
|
// sends the narrative input off-machine, so it must never engage silently
|
|
239
246
|
// or discard a hand-curated narrative just because a key is in the env.
|
|
240
|
-
export async function generateNarrative(selected, enrichments, { overrideFile, trajectory, compactionSummaries, aiRelationship, agenticLiteracy, intensity, distribution, allProjects } = {}) {
|
|
241
|
-
const input = narrativeInputFor(selected, enrichments, { trajectory, compactionSummaries, aiRelationship, agenticLiteracy, intensity, distribution, allProjects });
|
|
247
|
+
export async function generateNarrative(selected, enrichments, { overrideFile, trajectory, compactionSummaries, aiRelationship, agenticLiteracy, intensity, distribution, allProjects, language } = {}) {
|
|
248
|
+
const input = narrativeInputFor(selected, enrichments, { trajectory, compactionSummaries, aiRelationship, agenticLiteracy, intensity, distribution, allProjects, language });
|
|
242
249
|
if (overrideFile) return { narrative: validateNarrative(JSON.parse(readFileSync(overrideFile, "utf8")), overrideFile), input, source: "file" };
|
|
243
250
|
const key = process.env.ANTHROPIC_API_KEY;
|
|
244
251
|
if (key) {
|
package/src/profile.mjs
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
// prose fields come from the narrative step. The Markdown is just a view, so
|
|
4
4
|
// human and agent never diverge.
|
|
5
5
|
|
|
6
|
+
import { DEFAULT_LANGUAGE, codeLabel, labelsFor } from "./languages.mjs";
|
|
7
|
+
|
|
6
8
|
// --- representative selection: significance leads, diversity breaks ties -----
|
|
7
9
|
//
|
|
8
10
|
// The pick is driven by how SIGNIFICANT the work is, not by how many chat
|
|
@@ -184,7 +186,7 @@ export function summarizeSources(parsed) {
|
|
|
184
186
|
|
|
185
187
|
// --- assemble ----------------------------------------------------------------
|
|
186
188
|
|
|
187
|
-
export function assembleProfile({ contact, projects, narrative, fingerprint, forensics, manifestHash, trajectory, groundedness, aiRelationship, agenticLiteracy, intensity, distribution, techUsage, practices, sources, generatedBy }) {
|
|
189
|
+
export function assembleProfile({ contact, projects, narrative, fingerprint, forensics, manifestHash, trajectory, groundedness, aiRelationship, agenticLiteracy, intensity, distribution, techUsage, practices, sources, generatedBy, language = DEFAULT_LANGUAGE }) {
|
|
188
190
|
const froms = projects.map((p) => p.from).filter(Boolean).sort();
|
|
189
191
|
const tos = projects.map((p) => p.to).filter(Boolean).sort();
|
|
190
192
|
const selected = projects.filter((p) => p.selected);
|
|
@@ -193,6 +195,8 @@ export function assembleProfile({ contact, projects, narrative, fingerprint, for
|
|
|
193
195
|
|
|
194
196
|
return {
|
|
195
197
|
schema: "playnew-profile/v1",
|
|
198
|
+
// The language every prose field and the rendered profile.md are written in (a code from src/languages.mjs).
|
|
199
|
+
language,
|
|
196
200
|
generatedAt: new Date().toISOString(),
|
|
197
201
|
// Optional and nullable: the schema keeps the field for readers of older profiles, but this tool no
|
|
198
202
|
// longer asks for it (the hub's sign-in identifies the person) and `submit` never sends it.
|
|
@@ -299,42 +303,34 @@ export function assembleProfile({ contact, projects, narrative, fingerprint, for
|
|
|
299
303
|
|
|
300
304
|
// --- render -------------------------------------------------------------------
|
|
301
305
|
|
|
302
|
-
const land = (l) =>
|
|
303
|
-
`commits ${l.commits} · reverts ${l.reverts} · churn ${l.revertChurn}${l.checksRun ? " · checks passed" : ""}`;
|
|
304
|
-
|
|
305
306
|
export function renderMarkdown(p) {
|
|
307
|
+
const T = labelsFor(p.language);
|
|
308
|
+
const code = (c) => codeLabel(T, c);
|
|
309
|
+
const codes = (list) => list.map(code).join(" · ");
|
|
306
310
|
const L = [];
|
|
307
311
|
const c = p.contact || {};
|
|
308
|
-
L.push(`#
|
|
312
|
+
L.push(`# ${T.title(c.name)}`);
|
|
309
313
|
const meta = [c.email, c.city, c.status].filter(Boolean).join(" · ");
|
|
310
314
|
if (meta) L.push(meta);
|
|
311
|
-
L.push(
|
|
312
|
-
|
|
313
|
-
);
|
|
314
|
-
L.push(`Log consistency screen: ${p.authenticity.score == null ? "n/a" : `${p.authenticity.score}/100`} (${p.authenticity.note})`);
|
|
315
|
+
L.push(T.window(p));
|
|
316
|
+
L.push(T.screen(p.authenticity.score, p.authenticity.note));
|
|
315
317
|
if (p.sources?.length) {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
.join(" · ");
|
|
319
|
-
L.push(`Sources: ${src}`);
|
|
320
|
-
L.push(`Window and counts are lower bounds: logs rotate and old sessions are pruned.`);
|
|
318
|
+
L.push(T.sources(p.sources.map(T.source).join(" · ")));
|
|
319
|
+
L.push(T.lowerBounds);
|
|
321
320
|
}
|
|
322
321
|
if (p.summary) L.push(`\n${p.summary}`);
|
|
323
322
|
|
|
324
323
|
if (p.domains?.length) {
|
|
325
|
-
L.push(`\n##
|
|
326
|
-
for (const d of p.domains)
|
|
327
|
-
const note = d.note ? ` — ${d.note}` : "";
|
|
328
|
-
L.push(`- **${d.label}** · ${d.products} products · ${d.sessions} sessions${note}`);
|
|
329
|
-
}
|
|
324
|
+
L.push(`\n## ${T.domains}`);
|
|
325
|
+
for (const d of p.domains) L.push(T.domainLine(d, d.note));
|
|
330
326
|
}
|
|
331
327
|
|
|
332
|
-
L.push(`\n##
|
|
328
|
+
L.push(`\n## ${T.representative}`);
|
|
333
329
|
for (const pr of p.projects) {
|
|
334
330
|
const headTail = pr.repoLabel ? ` _(${pr.id} — ${pr.repoLabel})_` : ` _(${pr.id})_`;
|
|
335
|
-
L.push(`\n### ${pr.domain ||
|
|
336
|
-
L.push(
|
|
337
|
-
if (pr.tech.length) L.push(
|
|
331
|
+
L.push(`\n### ${pr.domain || T.domainFallback} · ${codes(pr.type)}${headTail}`);
|
|
332
|
+
L.push(T.projectLine(pr, T.landing(pr.landing)));
|
|
333
|
+
if (pr.tech.length) L.push(T.stack(pr.tech.join(", ")));
|
|
338
334
|
// The orchestration data candidate.json submits, on the human review
|
|
339
335
|
// surface too. Rendered only when it says something (multi-tool, dispatch
|
|
340
336
|
// or delegation counts) — a single-tool zero line is noise, and the exact
|
|
@@ -343,131 +339,126 @@ export function renderMarkdown(p) {
|
|
|
343
339
|
if (o && (o.toolCount >= 2 || o.dispatchCommands > 0 || o.delegation > 0)) {
|
|
344
340
|
const bits = [];
|
|
345
341
|
const tools = Object.entries(o.tools ?? {}).map(([k, v]) => `${k} ${v}`).join(" + ");
|
|
346
|
-
if (o.toolCount >= 2 && tools)
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
if (o.delegation > 0) bits.push(`${o.delegation} sub-agent delegations`);
|
|
351
|
-
L.push(`orchestration: ${bits.join(" · ")}`);
|
|
342
|
+
if (o.toolCount >= 2 && tools) bits.push(T.sessionsByTool(tools, o.toolOverlap === false));
|
|
343
|
+
if (o.dispatchCommands > 0) bits.push(T.dispatches(o.dispatchCommands));
|
|
344
|
+
if (o.delegation > 0) bits.push(T.delegations(o.delegation));
|
|
345
|
+
L.push(T.orchestration(bits.join(" · ")));
|
|
352
346
|
}
|
|
353
347
|
if (pr.did) L.push(pr.did);
|
|
354
|
-
if (pr.whyRepresentative) L.push(`
|
|
355
|
-
L.push(
|
|
348
|
+
if (pr.whyRepresentative) L.push(`_${T.whyRepresentative}_ ${pr.whyRepresentative}`);
|
|
349
|
+
L.push(T.artifact(pr.artifact));
|
|
356
350
|
}
|
|
357
351
|
|
|
358
352
|
if (p.otherProjects.length) {
|
|
359
|
-
L.push(`\n##
|
|
353
|
+
L.push(`\n## ${T.otherProjects}`);
|
|
360
354
|
for (const o of p.otherProjects) {
|
|
361
355
|
const tag = o.repoLabel ? ` _(${o.repoLabel})_` : "";
|
|
362
|
-
L.push(
|
|
356
|
+
L.push(T.otherLine(o, codes(o.type), tag));
|
|
363
357
|
}
|
|
364
358
|
}
|
|
365
359
|
|
|
366
|
-
L.push(`\n##
|
|
367
|
-
if (p.cognitive.tags.length) L.push(
|
|
360
|
+
L.push(`\n## ${T.cognitive}`);
|
|
361
|
+
if (p.cognitive.tags.length) L.push(`${T.tags} ${codes(p.cognitive.tags)}`);
|
|
368
362
|
if (p.cognitive.narrative) L.push(p.cognitive.narrative);
|
|
369
363
|
|
|
370
364
|
if (p.aiRelationship) {
|
|
371
|
-
L.push(`\n##
|
|
372
|
-
L.push(
|
|
365
|
+
L.push(`\n## ${T.aiHeading}`);
|
|
366
|
+
L.push(T.aiLine(p.aiRelationship, code(p.aiRelationship.mode)));
|
|
373
367
|
if (p.aiRelationship.narrative) L.push(p.aiRelationship.narrative);
|
|
374
368
|
}
|
|
375
369
|
|
|
376
370
|
if (p.intensity) {
|
|
377
371
|
const i = p.intensity;
|
|
378
|
-
L.push(`\n##
|
|
379
|
-
const tzNote = i.timezone && i.timezone !== "UTC" ?
|
|
380
|
-
L.push(
|
|
381
|
-
L.push(
|
|
382
|
-
L.push(
|
|
383
|
-
L.push(
|
|
384
|
-
L.push(
|
|
385
|
-
L.push(
|
|
372
|
+
L.push(`\n## ${T.intensity}`);
|
|
373
|
+
const tzNote = i.timezone && i.timezone !== "UTC" ? T.daysNote(i.timezone) : "";
|
|
374
|
+
L.push(T.activeDays(i, tzNote));
|
|
375
|
+
L.push(T.medianSessionsPerDay(i.medianSessionsPerActiveDay));
|
|
376
|
+
L.push(T.medianDepth(i.medianSessionToolCalls));
|
|
377
|
+
L.push(T.streak(i.longestStreak));
|
|
378
|
+
L.push(T.peakDay(i.peakDayToolCalls));
|
|
379
|
+
L.push(T.cadence(code(i.cadence), code(i.sessionShape)));
|
|
386
380
|
if (i.narrative) L.push(`\n${i.narrative}`);
|
|
387
381
|
}
|
|
388
382
|
|
|
389
383
|
if (p.distribution) {
|
|
390
384
|
const d = p.distribution;
|
|
391
|
-
L.push(`\n##
|
|
392
|
-
L.push(
|
|
393
|
-
L.push(
|
|
394
|
-
L.push(
|
|
395
|
-
L.push(
|
|
385
|
+
L.push(`\n## ${T.distribution}`);
|
|
386
|
+
L.push(T.perProduct(d));
|
|
387
|
+
L.push(T.top3(d));
|
|
388
|
+
L.push(T.multiMonth(d));
|
|
389
|
+
L.push(T.shape(code(d.shape)));
|
|
396
390
|
if (d.narrative) L.push(`\n${d.narrative}`);
|
|
397
391
|
}
|
|
398
392
|
|
|
399
393
|
if (p.techUsage?.technologies?.length) {
|
|
400
394
|
const u = p.techUsage;
|
|
401
|
-
const tzNote = u.timezone && u.timezone !== "UTC" ?
|
|
402
|
-
L.push(`\n##
|
|
403
|
-
L.push(
|
|
395
|
+
const tzNote = u.timezone && u.timezone !== "UTC" ? T.monthsNote(u.timezone) : "";
|
|
396
|
+
L.push(`\n## ${T.techUsage}`);
|
|
397
|
+
L.push(T.techIntro(tzNote));
|
|
404
398
|
for (const t of u.technologies) {
|
|
405
|
-
const span = t.firstMonth === t.lastMonth ? t.firstMonth : `${t.firstMonth} to ${t.lastMonth}`;
|
|
406
|
-
L.push(
|
|
399
|
+
const span = t.firstMonth === t.lastMonth ? t.firstMonth : `${t.firstMonth} ${T.to} ${t.lastMonth}`;
|
|
400
|
+
L.push(T.techLine(t, code(t.band), span));
|
|
407
401
|
}
|
|
408
402
|
}
|
|
409
403
|
|
|
410
404
|
if (p.practices?.items?.length) {
|
|
411
405
|
const u = p.practices;
|
|
412
|
-
const tzNote = u.timezone && u.timezone !== "UTC" ?
|
|
413
|
-
L.push(`\n##
|
|
414
|
-
L.push(
|
|
415
|
-
for (const t of u.items)
|
|
416
|
-
const how = t.method === "model" ? "classified by the person's model" : "counted by code";
|
|
417
|
-
L.push(`- ${t.id}: in ${t.seen} of ${t.of} ${t.of === 1 ? "session" : "sessions"} · ${t.products} ${t.products === 1 ? "product" : "products"} · ${t.months} ${t.months === 1 ? "month" : "months"} · ${how}`);
|
|
418
|
-
}
|
|
406
|
+
const tzNote = u.timezone && u.timezone !== "UTC" ? T.monthsNote(u.timezone) : "";
|
|
407
|
+
L.push(`\n## ${T.practices}`);
|
|
408
|
+
L.push(T.practicesIntro(tzNote));
|
|
409
|
+
for (const t of u.items) L.push(T.practiceLine(t, code(t.id), t.method === "model" ? T.byModel : T.byCode));
|
|
419
410
|
}
|
|
420
411
|
|
|
421
412
|
if (p.agenticLiteracy) {
|
|
422
413
|
const a = p.agenticLiteracy;
|
|
423
|
-
L.push(`\n##
|
|
424
|
-
L.push(
|
|
425
|
-
L.push(
|
|
426
|
-
L.push(
|
|
427
|
-
L.push(
|
|
428
|
-
L.push(
|
|
429
|
-
L.push(
|
|
430
|
-
L.push(
|
|
431
|
-
L.push(`\
|
|
432
|
-
L.push(
|
|
433
|
-
L.push(
|
|
434
|
-
L.push(
|
|
435
|
-
L.push(
|
|
436
|
-
L.push(
|
|
437
|
-
L.push(`\
|
|
438
|
-
L.push(
|
|
439
|
-
L.push(
|
|
440
|
-
L.push(
|
|
414
|
+
L.push(`\n## ${T.literacy}`);
|
|
415
|
+
L.push(T.uses);
|
|
416
|
+
L.push(T.subagentDelegations(a.uses.subagentDelegations));
|
|
417
|
+
L.push(T.taskTracking(a.uses.taskTrackingEvents));
|
|
418
|
+
L.push(T.builtinSlash(a.uses.builtinSlashInvocations));
|
|
419
|
+
L.push(T.customSkills(a.uses.customSkillsCommands));
|
|
420
|
+
L.push(T.publicMcp(a.uses.publicMcp));
|
|
421
|
+
L.push(T.customMcp(a.uses.customMcp));
|
|
422
|
+
L.push(`\n${T.builds}`);
|
|
423
|
+
L.push(T.skillsAuthored(a.builds.skillsAuthored));
|
|
424
|
+
L.push(T.commandsAuthored(a.builds.commandsAuthored));
|
|
425
|
+
L.push(T.agentsAuthored(a.builds.agentsAuthored));
|
|
426
|
+
L.push(T.hooksEdited(a.builds.hooksEdited));
|
|
427
|
+
L.push(T.memoryFiles(a.builds.projectMemoryFiles));
|
|
428
|
+
L.push(`\n${T.designs}`);
|
|
429
|
+
L.push(T.plansFirst(a.designs.plansFirst));
|
|
430
|
+
L.push(T.subtaskTracking(a.designs.subtaskTracking));
|
|
431
|
+
L.push(T.clarifies(a.designs.clarifies));
|
|
441
432
|
if (a.narrative) L.push(`\n${a.narrative}`);
|
|
442
433
|
}
|
|
443
434
|
|
|
444
435
|
// Trajectory: what changed strategically over the window. Numbers first, then
|
|
445
436
|
// the LLM narrative, then the principles the candidate codified for themselves.
|
|
446
437
|
if (p.trajectory) {
|
|
447
|
-
L.push(`\n##
|
|
438
|
+
L.push(`\n## ${T.trajectory}`);
|
|
448
439
|
if (p.trajectory.narrative) L.push(p.trajectory.narrative);
|
|
449
440
|
|
|
450
441
|
if (p.trajectory.shifts && p.trajectory.shifts.deltas) {
|
|
451
|
-
L.push(`\
|
|
442
|
+
L.push(`\n${T.shifts(p.trajectory.shifts.midpoint)}`);
|
|
452
443
|
for (const d of p.trajectory.shifts.deltas) {
|
|
453
444
|
const arrow = d.dir === "up" ? "↑" : d.dir === "down" ? "↓" : d.dir === "stable" ? "·" : "";
|
|
454
|
-
L.push(`- ${d.metric}: ${formatVal(d.early, d.format)} → ${formatVal(d.late, d.format)} ${arrow}`);
|
|
445
|
+
L.push(`- ${code(d.metric)}: ${formatVal(d.early, d.format)} → ${formatVal(d.late, d.format)} ${arrow}`);
|
|
455
446
|
}
|
|
456
447
|
}
|
|
457
448
|
|
|
458
449
|
if (p.trajectory.topics?.length) {
|
|
459
|
-
L.push(`\
|
|
450
|
+
L.push(`\n${T.topics}`);
|
|
460
451
|
for (const q of p.trajectory.topics) {
|
|
461
|
-
L.push(`- ${q.quarter}: ${q.themes.map((t) => `${t.name} (${t.count})`).join(", ")}`);
|
|
452
|
+
L.push(`- ${q.quarter}: ${q.themes.map((t) => `${code(t.name)} (${t.count})`).join(", ")}`);
|
|
462
453
|
}
|
|
463
454
|
}
|
|
464
455
|
|
|
465
456
|
if (p.trajectory.newVocabulary?.length) {
|
|
466
|
-
L.push(`\
|
|
457
|
+
L.push(`\n${T.vocabulary(p.trajectory.newVocabulary.join(", "))}`);
|
|
467
458
|
}
|
|
468
459
|
|
|
469
460
|
if (p.trajectory.principlesAdopted?.length) {
|
|
470
|
-
L.push(`\
|
|
461
|
+
L.push(`\n${T.principles}`);
|
|
471
462
|
for (const pr of p.trajectory.principlesAdopted) {
|
|
472
463
|
const when = pr.when ? `_${pr.when}_ — ` : "";
|
|
473
464
|
L.push(`- ${when}${pr.text}`);
|
|
@@ -476,14 +467,14 @@ export function renderMarkdown(p) {
|
|
|
476
467
|
}
|
|
477
468
|
|
|
478
469
|
if (p.stackAdopted?.length) {
|
|
479
|
-
L.push(`\n##
|
|
470
|
+
L.push(`\n## ${T.stackAdopted}`);
|
|
480
471
|
L.push(p.stackAdopted.join(", "));
|
|
481
472
|
// Disclosed boundaries — detection reads package.json + touched files, never
|
|
482
473
|
// .env: (1) deps reflect the repo as it stands now, not at session time;
|
|
483
474
|
// (2) npm manifests only — no pyproject/requirements; (3) deps are absent if
|
|
484
475
|
// the project folder no longer exists; (4) REST-only services (an API key,
|
|
485
476
|
// no package) are not auto-detected.
|
|
486
|
-
L.push(
|
|
477
|
+
L.push(T.stackNote);
|
|
487
478
|
}
|
|
488
479
|
|
|
489
480
|
return L.join("\n") + "\n";
|