refactor: remove self-learning and the optimizer package (P1.4)

Self-learning is excluded from the community edition (ADR-0004); the
project owner reworks it separately. Cost tracking stays.

- agent: delete behaviour evolution (evolve-schema, iterative GEPA,
  compose-evolution, evolution gates, orchestrator and deploy),
  improvement and correction detection, AgentLearning, the eval-dataset
  builder, optimization-capture and the agent_insights tool. Secret
  detection moves from eval-dataset to secret-patterns. The LLM wiring
  keeps only the Haiku adapter and judge call used by skill audit and
  hygiene, so @ax-llm/ax is now declared by agent instead of server.
- server: delete /api/evolution/*, the evolution and optimizer services,
  GEPA expansion of the first chat message, the prompt_optimization and
  monthly_assessment jobs, the idle-session reviewer and its
  session-reviewer persona, prompt injection of past corrections and
  thumbs-down recorded as correction signals. Existing job rows of the
  removed types are ignored, not deleted.
- core: delete OptimizationLogStore; stop re-exporting the improvement
  signal and evolution run stores.
- web: delete the Evolution screen and the two job types in the
  automation editor.
- delete packages/optimizer.

Also logs UF-027 (self-learning loops read data nothing collects) and
UF-028 (the Settings prompt-shape choice is ignored by chat).
This commit is contained in:
shumeiko.it
2026-10-20 00:54:58 +02:00
parent b734c1d3d2
commit 2e1999a3f6
112 changed files with 336 additions and 16165 deletions

View File

@@ -3,13 +3,12 @@
*
* Tests the one-step promotion personal → workspace, the refusal of team and
* enterprise scopes in this edition, frontmatter rewrite with promoted_from
* history, file move, and skill_promotion improvement signal emission.
* history and file move.
*/
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import * as fs from 'node:fs';
import * as path from 'node:path';
import * as os from 'node:os';
import { MindDB, ImprovementSignalStore } from '@waggle/core';
import { createSkillTools, getSkillDirForScope } from '../src/skill-tools.js';
import { parseSkillFrontmatter } from '../src/skill-frontmatter.js';
@@ -22,8 +21,6 @@ function seedSkill(dir: string, name: string, scope: string | null, body = 'body
describe('promote_skill — gap E', () => {
let tmpDir: string;
let db: MindDB;
let signals: ImprovementSignalStore;
let reloadCount: number;
function createTools(overrides: Partial<Parameters<typeof createSkillTools>[0]> = {}) {
@@ -32,7 +29,6 @@ describe('promote_skill — gap E', () => {
onSkillsChanged: () => { reloadCount++; },
getWorkspaceId: () => 'ws-alpha',
getTeamId: () => 'team-bravo',
improvementSignals: signals,
...overrides,
});
}
@@ -45,18 +41,15 @@ describe('promote_skill — gap E', () => {
beforeEach(() => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-promote-test-'));
db = new MindDB(':memory:');
signals = new ImprovementSignalStore(db);
reloadCount = 0;
});
afterEach(() => {
db.close();
fs.rmSync(tmpDir, { recursive: true, force: true });
});
describe('happy path', () => {
it('promotes personal → workspace, moves file, appends history, records signal', async () => {
it('promotes personal → workspace, moves file, appends history', async () => {
const personalDir = getSkillDirForScope(tmpDir, 'personal', {})!;
seedSkill(personalDir, 'deploy-helper', 'personal');
const tools = createTools();
@@ -64,7 +57,6 @@ describe('promote_skill — gap E', () => {
const out = await run(tools, 'promote_skill', { skill_name: 'deploy-helper' });
expect(out).toContain('personal → workspace');
expect(out).toContain('Signal recorded');
// File moved
expect(fs.existsSync(path.join(personalDir, 'deploy-helper.md'))).toBe(false);
@@ -77,11 +69,6 @@ describe('promote_skill — gap E', () => {
expect(parsed.frontmatter.scope).toBe('workspace');
expect(parsed.frontmatter.promoted_from).toEqual(['personal']);
// Signal emitted
const recorded = signals.getByCategory('skill_promotion');
expect(recorded.length).toBe(1);
expect(recorded[0].pattern_key).toBe('promote:deploy-helper:personal->workspace');
// onSkillsChanged fired
expect(reloadCount).toBe(1);
});
@@ -125,7 +112,6 @@ describe('promote_skill — gap E', () => {
const out = await run(createTools(), 'promote_skill', { skill_name: 'shared-helper' });
expect(out).toContain('not available in this edition');
expect(fs.existsSync(path.join(wsDir, 'shared-helper.md'))).toBe(true);
expect(signals.getByCategory('skill_promotion')).toHaveLength(0);
});
it('refuses enterprise promotion', async () => {