@dailephd/my-dev-kit-lab 0.8.1 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/README.md +5 -4
  3. package/dist/src/cli/help.js +16 -1
  4. package/dist/src/commands/runExperimentDescribeCommand.js +8 -1
  5. package/dist/src/commands/runExperimentRunCommand.js +90 -3
  6. package/dist/src/evaluation/runMyDevKitRetrieval.js +1 -0
  7. package/dist/src/experiments/defaultRegistry.js +2 -0
  8. package/dist/src/experiments/plugins/contextPackGeneration/analysis.js +157 -0
  9. package/dist/src/experiments/plugins/contextPackGeneration/analysisArtifact.js +22 -0
  10. package/dist/src/experiments/plugins/contextPackGeneration/analysisTypes.js +1 -0
  11. package/dist/src/experiments/plugins/contextPackGeneration/buildContextPack.js +84 -0
  12. package/dist/src/experiments/plugins/contextPackGeneration/config.js +39 -0
  13. package/dist/src/experiments/plugins/contextPackGeneration/execution.js +361 -0
  14. package/dist/src/experiments/plugins/contextPackGeneration/executionArtifact.js +17 -0
  15. package/dist/src/experiments/plugins/contextPackGeneration/executionTypes.js +11 -0
  16. package/dist/src/experiments/plugins/contextPackGeneration/identityEvidence.js +71 -0
  17. package/dist/src/experiments/plugins/contextPackGeneration/index.js +19 -0
  18. package/dist/src/experiments/plugins/contextPackGeneration/localSubjectExecution.js +146 -0
  19. package/dist/src/experiments/plugins/contextPackGeneration/localSubjectPrivacy.js +276 -0
  20. package/dist/src/experiments/plugins/contextPackGeneration/metadata.js +24 -0
  21. package/dist/src/experiments/plugins/contextPackGeneration/metrics.js +46 -0
  22. package/dist/src/experiments/plugins/contextPackGeneration/packArtifact.js +17 -0
  23. package/dist/src/experiments/plugins/contextPackGeneration/packEvidence.js +152 -0
  24. package/dist/src/experiments/plugins/contextPackGeneration/packSelectionPolicy.js +305 -0
  25. package/dist/src/experiments/plugins/contextPackGeneration/plugin.js +355 -0
  26. package/dist/src/experiments/plugins/contextPackGeneration/renderContextPack.js +61 -0
  27. package/dist/src/experiments/plugins/contextPackGeneration/types.js +29 -0
  28. package/dist/src/report/experiments/buildContextPackGenerationReport.js +171 -0
  29. package/dist/src/report/experiments/buildPluginExperimentReport.js +24 -2
  30. package/dist/src/report/experiments/contextPackGenerationReportModel.js +9 -0
  31. package/dist/src/report/experiments/index.js +5 -0
  32. package/dist/src/report/experiments/loadContextPackArtifacts.js +43 -0
  33. package/dist/src/report/experiments/renderContextPackGenerationHtml.js +122 -0
  34. package/dist/src/report/experiments/renderContextPackGenerationText.js +101 -0
  35. package/dist/src/report/experiments/renderPluginExperimentReportHtml.js +3 -0
  36. package/dist/src/report/experiments/renderPluginExperimentReportText.js +7 -0
  37. package/dist/src/report/experiments/renderRetrievalQueryStrategyComparisonHtml.js +15 -15
  38. package/dist/src/report/experiments/writePluginExperimentReports.js +2 -0
  39. package/docs/METRICS.md +28 -1
  40. package/package.json +1 -1
@@ -5,6 +5,7 @@ import { REINDEX_RECOMMENDATION_EXPLANATIONS } from "./buildWarmIndexReuseReport
5
5
  import { renderContextWindowScalingTextLines } from "./renderContextWindowScalingText.js";
6
6
  import { renderRetrievalPrecisionRecallTextLines } from "./renderRetrievalPrecisionRecallText.js";
7
7
  import { renderRetrievalQueryStrategyComparisonTextLines } from "./renderRetrievalQueryStrategyComparisonText.js";
8
+ import { renderContextPackGenerationTextLines } from "./renderContextPackGenerationText.js";
8
9
  function sanitizeScalar(value) {
9
10
  const text = String(value);
10
11
  let result = "";
@@ -689,6 +690,12 @@ export function renderPluginExperimentReportText(report) {
689
690
  else {
690
691
  lines.push(...renderRetrievalQueryStrategyComparisonTextLines(retrievalQueryStrategyComparison));
691
692
  }
693
+ // Additive: other plugins keep their existing text output unchanged.
694
+ const contextPackGeneration = report.contextPackGeneration ?? null;
695
+ if (contextPackGeneration !== null) {
696
+ pushSection(lines, "Context Pack Generation");
697
+ lines.push(...renderContextPackGenerationTextLines(contextPackGeneration));
698
+ }
692
699
  pushSection(lines, "Warnings, Skips, And Failures");
693
700
  pushDashList(lines, report.findings.map((finding) => `${finding.severity} ${finding.code} ${finding.message} variant=${finding.variantId ?? ""} case=${finding.caseId ?? ""}`));
694
701
  pushSection(lines, "Artifacts");
@@ -4,9 +4,9 @@ export function renderRetrievalQueryStrategyComparisonHtml(section) {
4
4
  return "";
5
5
  const methodology = section.methodology;
6
6
  const objective = (value, digits) => (value === undefined ? "unavailable" : digits ? value.toFixed(4) : String(value));
7
- return `<section>
8
- <h2>Retrieval Query Strategy Comparison</h2>
9
- <h3>Methodology</h3>
7
+ return `<section>
8
+ <h2>Retrieval Query Strategy Comparison</h2>
9
+ <h3>Methodology</h3>
10
10
  ${table(["Field", "Value"], [
11
11
  ["Schema", section.schemaVersion],
12
12
  ["File F1", methodology.fileF1],
@@ -15,9 +15,9 @@ export function renderRetrievalQueryStrategyComparisonHtml(section) {
15
15
  ["Multi-objective comparison", methodology.multiObjectiveComparison],
16
16
  ["Unique-best rule", methodology.uniqueBestRule],
17
17
  ["Strategy order", section.strategyOrder.join(", ")]
18
- ])}
19
- ${section.identityRedaction !== null ? `<p><strong>Identity redaction.</strong> ${escapeHtml(RETRIEVAL_QUERY_STRATEGY_EXTERNAL_PRIVACY_NOTE)}</p>` : ""}
20
- <h3>Task-Type Comparison</h3>
18
+ ])}
19
+ ${section.identityRedaction !== null ? `<p><strong>Identity redaction.</strong> ${escapeHtml(RETRIEVAL_QUERY_STRATEGY_EXTERNAL_PRIVACY_NOTE)}</p>` : ""}
20
+ <h3>Task-Type Comparison</h3>
21
21
  ${table(["Scope", "Cases", "Matched Cases", "Excluded Cases", "Interpretation", "Best Strategy", "Pareto Front"], section.scopes.map((scope) => [
22
22
  scope.scopeId,
23
23
  String(scope.caseCount),
@@ -26,11 +26,11 @@ export function renderRetrievalQueryStrategyComparisonHtml(section) {
26
26
  scope.interpretation,
27
27
  scope.bestStrategyId ?? "none",
28
28
  formatRetrievalQueryStrategyList(scope.paretoFrontStrategyIds)
29
- ]))}
30
- ${listHtml(section.scopes.map(describeRetrievalQueryStrategyScope))}
31
- <h3>Per-Scope Strategy Objectives</h3>
29
+ ]))}
30
+ ${listHtml(section.scopes.map(describeRetrievalQueryStrategyScope))}
31
+ <h3>Per-Scope Strategy Objectives</h3>
32
32
  ${section.scopes
33
- .map((scope) => `<h4>${escapeHtml(scope.scopeId)}</h4>
33
+ .map((scope) => `<h4>${escapeHtml(scope.scopeId)}</h4>
34
34
  ${table(["Strategy", "Completed", "Partial", "Failed", "Mean File F1", "Mean Symbol F1", "Mean Fact Coverage", "Mean Retrieved Tokens"], scope.strategySummaries.map((summary) => [
35
35
  summary.strategyId,
36
36
  String(summary.completedCaseCount),
@@ -41,8 +41,8 @@ export function renderRetrievalQueryStrategyComparisonHtml(section) {
41
41
  objective(summary.objectives?.meanFactCoverage, true),
42
42
  objective(summary.objectives?.meanRetrievedTokenCount, false)
43
43
  ]))}`)
44
- .join("\n ")}
45
- <h3>Per-Case Treatments</h3>
44
+ .join("\n ")}
45
+ <h3>Per-Case Treatments</h3>
46
46
  ${table([
47
47
  "Case",
48
48
  "Task Type",
@@ -73,9 +73,9 @@ export function renderRetrievalQueryStrategyComparisonHtml(section) {
73
73
  formatRetrievalQueryStrategyMetric(treatment.factCoverage),
74
74
  formatRetrievalQueryStrategyMetric(treatment.irrelevantContextRatio),
75
75
  formatRetrievalQueryStrategyNumber(treatment.retrievedTokenCount)
76
- ])))}
77
- <h3>Interpretation Limits</h3>
78
- ${listHtml(section.limitations)}
76
+ ])))}
77
+ <h3>Interpretation Limits</h3>
78
+ ${listHtml(section.limitations)}
79
79
  </section>`;
80
80
  }
81
81
  function listHtml(items) {
@@ -2,6 +2,7 @@ import { mkdir, writeFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { resolveWithinRoot } from "../../core/pathSafety.js";
4
4
  import { buildPluginExperimentReport } from "./buildPluginExperimentReport.js";
5
+ import { loadContextPackArtifacts } from "./loadContextPackArtifacts.js";
5
6
  import { renderPluginExperimentReportHtml } from "./renderPluginExperimentReportHtml.js";
6
7
  import { renderPluginExperimentReportText } from "./renderPluginExperimentReportText.js";
7
8
  export async function writePluginExperimentReports(args) {
@@ -22,6 +23,7 @@ export async function writePluginExperimentReports(args) {
22
23
  plugin: args.plugin,
23
24
  outputRoot: outputPaths.outDir,
24
25
  generatedAt: args.generatedAt,
26
+ contextPacks: await loadContextPackArtifacts(args.run, outputPaths.outDir),
25
27
  });
26
28
  const report = args.redactOutputRoot
27
29
  ? { ...builtReport, metadata: { ...builtReport.metadata, outputRoot: "[redacted]" } }
package/docs/METRICS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Metrics
2
2
 
3
- This document is the canonical metric glossary for my-dev-kit-lab. It defines every metric that appears in benchmark profiles, prompt variants, controlled experiment artifacts, and rendered reports across the registered experiment plugins (`context-strategy-comparison`, `warm-index-reuse`, `incremental-change-staleness`, `context-window-scaling`, `retrieval-precision-recall`, and `retrieval-query-strategy-comparison`).
3
+ This document is the canonical metric glossary for my-dev-kit-lab. It defines every metric that appears in benchmark profiles, prompt variants, controlled experiment artifacts, and rendered reports across the registered experiment plugins (`context-strategy-comparison`, `warm-index-reuse`, `incremental-change-staleness`, `context-window-scaling`, `retrieval-precision-recall`, `retrieval-query-strategy-comparison`, and `context-pack-generation`).
4
4
 
5
5
  Related documentation:
6
6
  - [ARCHITECTURE.md](ARCHITECTURE.md) — how metrics flow through the pipeline
@@ -841,3 +841,30 @@ Retrieved token count is `ceil(character count / 4)` through the existing estima
841
841
  `retrieval-query-strategy-comparison-execution.json` holds execution evidence only. `retrieval-query-strategy-comparison-analysis.json` is the scientific truth owner for the metrics, objective vectors, matched scopes, Pareto fronts, and best-strategy interpretation. `report.json`, `report.html`, and `report.txt` present the precomputed analysis and do not recalculate it. The generic experiment metrics (per-treatment values and per-scope objective means) are projections of the same precomputed values.
842
842
 
843
843
  See [COMMANDS.md](COMMANDS.md#retrieval-query-strategy-comparison-v081), [WORKFLOWS.md](WORKFLOWS.md#retrieval-query-strategy-comparison-experiment-v081), and [ARCHITECTURE.md](ARCHITECTURE.md#retrieval-query-strategy-comparison-architecture-v081).
844
+
845
+ ## Context-pack generation metrics (v0.8.2)
846
+
847
+ Status: released in v0.8.2. The `context-pack-generation` plugin runs the fixed paired treatments `raw-full-file` and `context-pack`. It calculates each treatment once and persists the execution and analysis artifacts; reports present those values without recalculating them.
848
+
849
+ ### Reused retrieval-quality measures
850
+
851
+ The plugin reuses the v0.8.0 identity-based measures and availability semantics:
852
+
853
+ - fact coverage from the answer key's explicit fact-to-context mappings;
854
+ - file precision, recall, and balanced F1;
855
+ - symbol precision, recall, and balanced F1; and
856
+ - irrelevant-context ratio where the existing retrieval-quality calculation applies.
857
+
858
+ Precision, recall, F1, fact coverage, and irrelevant-context ratio retain their existing numerator, denominator, unavailable, and not-applicable behavior. There is no new composite quality score.
859
+
860
+ ### Estimated size and paired comparison
861
+
862
+ Both treatments report estimated context size using the existing estimated-token semantics (`ceil(character count / 4)`), not a provider tokenizer or billing measurement. For each matched case, `tokensSaved = rawEstimatedTokens - packEstimatedTokens`; `percentSaved = tokensSaved / rawEstimatedTokens * 100`, with zero when the raw estimate is zero. Negative savings are valid and are not clamped.
863
+
864
+ For each case, the analysis reports pack-minus-raw objective deltas for file F1, symbol F1, fact coverage, and estimated tokens. A case contributes to scope means only when both treatments have all four required measures available. Scope summaries report included and excluded case counts, treatment objective means, mean tokens saved, and percent saved from the means. Existing task-locality scopes are `overall`, `localized`, `cross-module`, and `broad-change`.
865
+
866
+ There is no composite score, winner, or ranking. Tests and call relationships may be included descriptively in a context pack, but the frozen answer key does not provide expected test or call-edge identities; v0.8.2 therefore defines no test-coverage or call-edge-coverage score.
867
+
868
+ In external-local mode, analysis uses real identities before the privacy projection. Redacted placeholders never enter metric calculations. Durable external-local output has no pack body; the report preview presents redacted identities.
869
+
870
+ See [COMMANDS.md](COMMANDS.md#context-pack-generation-v082), [WORKFLOWS.md](WORKFLOWS.md#context-pack-generation-experiment), and [ARCHITECTURE.md](ARCHITECTURE.md#context-pack-generation-architecture-v082).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dailephd/my-dev-kit-lab",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "type": "module",
5
5
  "description": "Evidence, benchmark, and evaluation companion for my-dev-kit.",
6
6
  "bin": {