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

@@ -35,7 +35,6 @@ import {
SKILL_SCOPE_ORDER,
type SkillScope,
} from './skill-frontmatter.js';
import type { ImprovementSignalStore } from '@waggle/core';
import { autoExtractAndCreateSkill, type AutoExtractMessage } from './skill-autoextract.js';
import { retireStaleSkills } from './skill-retirement.js';
@@ -57,11 +56,9 @@ export interface SkillToolsDeps {
/**
* Skills 2.0 gap E: promotion infrastructure. Each callback is optional.
* - getWorkspaceId / getTeamId resolve scope dirs dynamically at tool-call time.
* - improvementSignals records skill_promotion signals on successful moves.
*/
getWorkspaceId?: () => string | null;
getTeamId?: () => string | null;
improvementSignals?: ImprovementSignalStore;
/**
* Skills 2.0 gap A: session-message accessor for auto-extracting skills
* from repeated workflow patterns. When provided, enables the
@@ -665,15 +662,14 @@ Only use this after acquire_capability has identified a specific installable can
},
// Skills 2.0 gap E: promote_skill — move a skill up one scope rung.
// personal → workspace. Enforces one-step-at-a-time and records a
// skill_promotion improvement signal on success.
// personal → workspace. Enforces one-step-at-a-time.
{
name: 'promote_skill',
description:
'Promote an installed skill one scope up (personal → workspace). '
+ 'Team and enterprise scopes are not available in this edition. '
+ 'The file is moved to the appropriate directory, frontmatter is rewritten '
+ '(scope + promoted_from history), and a skill_promotion signal is recorded.',
+ 'The file is moved to the appropriate directory and frontmatter is rewritten '
+ '(scope + promoted_from history).',
parameters: {
type: 'object',
properties: {
@@ -784,19 +780,7 @@ Only use this after acquire_capability has identified a specific installable can
// failing the promotion. An audit warning is fine.
}
// 8. Record skill_promotion signal
if (deps.improvementSignals) {
try {
deps.improvementSignals.record(
'skill_promotion',
`promote:${skillName}:${currentScope}->${target}`,
`Promoted skill "${skillName}" from ${currentScope} to ${target}`,
{ skillName, from: currentScope, to: target, workspaceId, teamId },
);
} catch { /* non-blocking */ }
}
// 9. Let the agent reload its skill list so the new scope is picked up
// 8. Let the agent reload its skill list so the new scope is picked up
onSkillsChanged?.();
return (
@@ -805,7 +789,7 @@ Only use this after acquire_capability has identified a specific installable can
+ `- Moved from \`${found.filePath}\`\n`
+ `- Now at \`${destPath}\`\n`
+ `- Promotion history: ${updatedFrontmatter.promoted_from!.join(' → ')} → ${target}\n`
+ `- Signal recorded: skill_promotion\n\n`
+ `\n`
+ `The skill is available immediately at the new scope. Agents in other `
+ `sessions will pick it up on their next skill reload.`
);
@@ -823,8 +807,7 @@ Only use this after acquire_capability has identified a specific installable can
'Scan the current session for repeated workflow patterns (the same 3+ tools '
+ 'used in the same order 2+ times) and auto-create a SKILL.md for any pattern '
+ 'found. Creates personal-scope skills only — promote_skill moves them up '
+ 'afterwards. Dedups by filename. Records a workflow_pattern signal on each '
+ 'successful extraction.',
+ 'afterwards. Dedups by filename.',
parameters: {
type: 'object',
properties: {},
@@ -839,7 +822,6 @@ Only use this after acquire_capability has identified a specific installable can
}
const result = await autoExtractAndCreateSkill(messages, {
personalSkillsDir: skillsDir,
improvementSignals: deps.improvementSignals,
});
if (result.filePath) {
onSkillsChanged?.();
@@ -850,7 +832,6 @@ Only use this after acquire_capability has identified a specific installable can
+ `- Tools: ${result.template!.tools.join(', ')}\n`
+ `- Written to: \`${result.filePath}\`\n`
+ `- Scope: personal (use promote_skill to move it up)\n`
+ `- Signal: workflow_pattern recorded\n`
);
}
if (result.reason === 'already_exists') {
@@ -870,7 +851,7 @@ Only use this after acquire_capability has identified a specific installable can
'Archive personal-scope skills that have not been used within the idle window. '
+ 'Moves stale SKILL.md files to ~/.waggle/skills-archive/ (recoverable — no deletion). '
+ 'Default max_idle_days is 90. Default dry_run is true — call with dry_run: false to '
+ 'actually move the files. Records a workflow_pattern signal per retirement.',
+ 'actually move the files.',
parameters: {
type: 'object',
properties: {
@@ -890,7 +871,6 @@ Only use this after acquire_capability has identified a specific installable can
const report = retireStaleSkills(waggleHome, {
maxIdleDays,
dryRun,
improvementSignals: deps.improvementSignals,
});
if (!dryRun && report.retired.length > 0) {
onSkillsChanged?.();