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

@@ -2,10 +2,9 @@ import { describe, it, expect } from 'vitest';
import { PERSONAS, getPersona, listPersonas, composePersonaPrompt } from '../src/personas.js';
describe('Agent Personas', () => {
it('PERSONAS catalog has 23 entries', () => {
// 22 user-facing (8 universal + 14 specialists) + 1 internal review persona
// (session-reviewer) used only by the IdleSessionWatcher self-evolution loop.
expect(PERSONAS).toHaveLength(23);
it('PERSONAS catalog has 22 entries', () => {
// 8 universal + 14 specialists.
expect(PERSONAS).toHaveLength(22);
});
it('each persona has required fields', () => {
@@ -40,9 +39,9 @@ describe('Agent Personas', () => {
expect(getPersona('')).toBeNull();
});
it('listPersonas() returns all 23 personas', () => {
it('listPersonas() returns all 22 personas', () => {
const list = listPersonas();
expect(list).toHaveLength(23);
expect(list).toHaveLength(22);
expect(list).not.toBe(PERSONAS); // Returns a copy
});
@@ -208,19 +207,6 @@ describe('Soft tool model', () => {
expect(v!.disallowedTools).toContain('write_file');
expect(v!.isReadOnly).toBe(true);
});
it('session-reviewer is a trust-boundary persona: reads + create_skill only, no writes/exec/memory', () => {
const r = getPersona('session-reviewer');
expect(r, 'session-reviewer not found').toBeTruthy();
// create_skill is the proposal vehicle and must stay in the allowlist.
expect(r!.tools).toContain('create_skill');
// isReadOnly would strip create_skill, so it must be false.
expect(r!.isReadOnly).toBe(false);
// The critical tools ALWAYS_AVAILABLE_TOOLS re-adds must be explicitly denied.
for (const t of ['save_memory', 'delete_skill', 'install_capability', 'acquire_capability', 'spawn_agent', 'bash']) {
expect(r!.disallowedTools, `${t} must be disallowed`).toContain(t);
}
});
});
describe('New domain personas', () => {
@@ -239,8 +225,7 @@ describe('New domain personas', () => {
});
}
it('total persona count is 23', () => {
// 22 tiered + session-reviewer (internal self-evolution reviewer).
expect(PERSONAS.length).toBe(23);
it('total persona count is 22', () => {
expect(PERSONAS.length).toBe(22);
});
});