@seanhogg/builderforce-memory 2026.6.35 → 2026.7.11

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 (56) hide show
  1. package/README.md +4 -3
  2. package/dist/cognition/EvermindCognition.d.ts.map +1 -1
  3. package/dist/cognition/EvermindCognition.js +17 -7
  4. package/dist/cognition/EvermindCognition.js.map +1 -1
  5. package/dist/diagnostics/stack-diagnostic.d.ts +9 -0
  6. package/dist/diagnostics/stack-diagnostic.d.ts.map +1 -1
  7. package/dist/diagnostics/stack-diagnostic.js +27 -1
  8. package/dist/diagnostics/stack-diagnostic.js.map +1 -1
  9. package/dist/distillation/DistillationEngine.d.ts +6 -0
  10. package/dist/distillation/DistillationEngine.d.ts.map +1 -1
  11. package/dist/distillation/DistillationEngine.js +10 -4
  12. package/dist/distillation/DistillationEngine.js.map +1 -1
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +1 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/limbic/LimbicSession.d.ts +31 -1
  18. package/dist/limbic/LimbicSession.d.ts.map +1 -1
  19. package/dist/limbic/LimbicSession.js +47 -3
  20. package/dist/limbic/LimbicSession.js.map +1 -1
  21. package/dist/memory/MemoryStore.d.ts +10 -0
  22. package/dist/memory/MemoryStore.d.ts.map +1 -1
  23. package/dist/memory/MemoryStore.js +13 -2
  24. package/dist/memory/MemoryStore.js.map +1 -1
  25. package/dist/session/session.d.ts +22 -0
  26. package/dist/session/session.d.ts.map +1 -1
  27. package/dist/session/session.js +45 -2
  28. package/dist/session/session.js.map +1 -1
  29. package/dist/workflow/code-eval.d.ts +54 -0
  30. package/dist/workflow/code-eval.d.ts.map +1 -0
  31. package/dist/workflow/code-eval.js +135 -0
  32. package/dist/workflow/code-eval.js.map +1 -0
  33. package/dist/workflow/index.d.ts +3 -2
  34. package/dist/workflow/index.d.ts.map +1 -1
  35. package/dist/workflow/index.js +3 -2
  36. package/dist/workflow/index.js.map +1 -1
  37. package/dist/workflow/steps.d.ts +20 -0
  38. package/dist/workflow/steps.d.ts.map +1 -1
  39. package/dist/workflow/steps.js +522 -7
  40. package/dist/workflow/steps.js.map +1 -1
  41. package/dist/workflow/templates.d.ts +15 -0
  42. package/dist/workflow/templates.d.ts.map +1 -1
  43. package/dist/workflow/templates.js +64 -1
  44. package/dist/workflow/templates.js.map +1 -1
  45. package/package.json +8 -4
  46. package/src/cognition/EvermindCognition.ts +24 -7
  47. package/src/diagnostics/stack-diagnostic.ts +37 -1
  48. package/src/distillation/DistillationEngine.ts +17 -4
  49. package/src/index.ts +6 -0
  50. package/src/limbic/LimbicSession.ts +61 -1
  51. package/src/memory/MemoryStore.ts +14 -2
  52. package/src/session/session.ts +72 -2
  53. package/src/workflow/code-eval.ts +143 -0
  54. package/src/workflow/index.ts +9 -1
  55. package/src/workflow/steps.ts +605 -6
  56. package/src/workflow/templates.ts +67 -1
@@ -69,7 +69,73 @@ export const TRAIN_LLM: WorkflowConfig = {
69
69
  ],
70
70
  };
71
71
 
72
- export const WORKFLOW_TEMPLATES: WorkflowConfig[] = [AGENTIC_SEVEN_LAYER, TRAIN_LLM];
72
+ /**
73
+ * Out-of-the-box (prompt → code) exemplars so "Teach Evermind to Code" runs with
74
+ * no network. Each carries execution `cases` so the same best-of-N / exec-filter
75
+ * path a live run uses is exercised offline (an exemplar whose code fails its
76
+ * cases is dropped, never trained on).
77
+ *
78
+ * A real run instead sets a teacher PANEL on the `distill-corpus` step —
79
+ * `teachers: [{provider:"anthropic", model:"claude-opus-4-8", apiKey},
80
+ * {provider:"openai", baseUrl:<gateway>, model:<coder>, apiKey}]`
81
+ * (strongest first) — plus `tasks: [{prompt, cases}]`. Per task every teacher is
82
+ * queried, only completions that PASS the cases survive, and the strongest
83
+ * correct answer is kept: Opus is the authority, cheaper models contribute only
84
+ * where they are verifiably right.
85
+ */
86
+ const CODE_DISTILL_PAIRS = [
87
+ { prompt: "Write a JS function add(a, b) that returns their sum.", completion: "function add(a, b) {\n return a + b;\n}", cases: [{ call: "add(2, 3)", expect: 5 }] },
88
+ { prompt: "Write a JS function isEven(n) that returns true when n is even.", completion: "function isEven(n) {\n return n % 2 === 0;\n}", cases: [{ call: "isEven(4)", expect: true }, { call: "isEven(7)", expect: false }] },
89
+ { prompt: "Write a JS function max(a, b) returning the larger value.", completion: "function max(a, b) {\n return a > b ? a : b;\n}", cases: [{ call: "max(2, 9)", expect: 9 }] },
90
+ { prompt: "Write a JS function reverse(s) that reverses a string.", completion: "function reverse(s) {\n return s.split('').reverse().join('');\n}", cases: [{ call: "reverse('abc')", expect: "cba" }] },
91
+ { prompt: "Write a JS function clamp(x, lo, hi) bounding x to [lo, hi].", completion: "function clamp(x, lo, hi) {\n return Math.min(hi, Math.max(lo, x));\n}", cases: [{ call: "clamp(12, 0, 10)", expect: 10 }] },
92
+ { prompt: "Write a JS function sum(xs) that adds an array of numbers.", completion: "function sum(xs) {\n return xs.reduce((a, b) => a + b, 0);\n}", cases: [{ call: "sum([1, 2, 3])", expect: 6 }] },
93
+ ];
94
+
95
+ /**
96
+ * Teach Evermind to Code — the foundation pipeline for the coding skill.
97
+ *
98
+ * Distil a PANEL of teacher coders — Opus as the authority plus any cheaper
99
+ * models (gateway/OpenRouter/local) — into an execution-verified (prompt → code)
100
+ * corpus (best-of-N: only completions that pass their tests survive), learn a
101
+ * code tokenizer (train fresh by default; set `hfTokenizerUrl` on the tokenizer
102
+ * step to import merges from a proven code tokenizer instead), train the model,
103
+ * and gate it with the standard convergence/benchmark checks PLUS code-specific
104
+ * ones: structural/parse validity and an execution-grounded test reward.
105
+ *
106
+ * The code gates ship report-only (no thresholds) so the template completes and
107
+ * surfaces metrics; a real run sets `minScore` / `minPassRate` to enforce them.
108
+ */
109
+ export const TEACH_CODE: WorkflowConfig = {
110
+ id: "teach-code",
111
+ name: "Teach Evermind to Code",
112
+ description:
113
+ "Distil a teacher coder into a (prompt → code) corpus, train an EvermindLM on it, and validate with code-aware gates: structural parse + an execution test reward. Tokenizer supports both train-fresh and import-merges.",
114
+ steps: [
115
+ { id: "distill", type: "distill-corpus", params: { pairs: CODE_DISTILL_PAIRS } },
116
+ { id: "tok", type: "train-tokenizer", params: { numMerges: 200 } },
117
+ { id: "data", type: "dataset-quality", params: { minSequences: 3, minWords: 20 } },
118
+ { id: "model", type: "train-model", params: { epochs: 60, dModel: 24, numLayers: 2, hiddenDim: 32 } },
119
+ { id: "converge", type: "convergence" },
120
+ { id: "eval", type: "evaluate", params: { prompt: "function" } },
121
+ { id: "gen", type: "generate-check", params: { prompt: "function" } },
122
+ { id: "parse", type: "code-parse-check", params: { language: "js" } },
123
+ { id: "reward", type: "code-eval", params: { cases: [{ call: "add(2, 3)", expect: 5 }] } },
124
+ { id: "bench", type: "benchmark" },
125
+ // Held-out pass@1 — measures whether the student can GENERATE passing code on
126
+ // unseen prompts (symmetric with `bench`'s held-out perplexity). Ungated here
127
+ // (a demo-scale model won't pass) so it reports the metric without failing the
128
+ // pipeline; real corpora set `minPass1` to enforce a student-quality floor.
129
+ { id: "codebench", type: "code-benchmark", params: { tasks: [
130
+ { prompt: "function subtract", cases: [{ call: "subtract(5, 2)", expect: 3 }] },
131
+ { prompt: "function isEven", cases: [{ call: "isEven(4)", expect: true }, { call: "isEven(3)", expect: false }] },
132
+ ] } },
133
+ { id: "pkg", type: "roundtrip", params: { name: "evermind-coder" } },
134
+ { id: "export", type: "export", params: { format: "huggingface", name: "evermind-coder", version: "1.0.0" } },
135
+ ],
136
+ };
137
+
138
+ export const WORKFLOW_TEMPLATES: WorkflowConfig[] = [AGENTIC_SEVEN_LAYER, TRAIN_LLM, TEACH_CODE];
73
139
 
74
140
  export function getTemplate(id: string): WorkflowConfig | undefined {
75
141
  return WORKFLOW_TEMPLATES.find((t) => t.id === id);