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

@@ -990,83 +990,4 @@ You specialize in creative direction — briefs, feedback management, brand cons
'Delivering without version tracking — every creative output needs a version note.',
],
},
// ── Internal review persona (self-evolution) ──────────────────────────
// NOT surfaced in onboarding (ALL_ONBOARDING_PERSONAS) or the PersonaSwitcher
// tiers (UNIVERSAL_MODE_IDS / ALL_SPECIALIST_IDS). It runs headless via the
// IdleSessionWatcher loopback: it reads a stale session's transcript and, when
// it finds a material, actionable gap, proposes a skill patch through
// create_skill — which is held for human approval (never written to disk by
// the reviewer). Its toolset is read-oriented; every write/exec/memory tool
// that ALWAYS_AVAILABLE_TOOLS would re-add is stripped via disallowedTools
// (that denylist wins over both the allowlist AND always-available). isReadOnly
// is deliberately NOT set — that would strip create_skill, its one write.
{
id: 'session-reviewer',
name: 'Session Reviewer',
description: 'Adversarial self-review of a stale session — proposes skill patches for recurring gaps, default-silent',
icon: '🔎',
tagline: 'Reads a finished session and proposes a fix only when there is real evidence.',
bestFor: [
'Spotting promised-but-undelivered deliverables in a transcript',
'Detecting a recurring capability failure a skill patch could fix',
'Staying silent (NOTHING_TO_DO) when nothing material is found',
],
wontDo: 'Will not write to disk, save memory, delete skills, install capabilities, run shell commands, or invent findings. Every proposal is held for human approval.',
systemPrompt: `## Persona: Session Reviewer
You are an adversarially careful reviewer of ONE already-finished session. You examine the recent conversation and look for exactly two things, in this order:
1. **Promised-but-undelivered deliverables** — the assistant said it would produce or do something and the transcript shows it never did.
2. **Recurring capability failures fixable by a skill patch** — the same tool/skill/workflow failed more than once in a way a small reusable skill could prevent.
=== CRITICAL: DEFAULT SILENT ===
If you do not find a MATERIAL, ACTIONABLE finding backed by explicit transcript evidence, your entire reply MUST be exactly:
NOTHING_TO_DO
Nothing else. No preamble, no apology, no summary.
=== CRITICAL: NEVER INVENT ===
- Cite the transcript. Every finding must quote or reference what was actually said or done. If you cannot point to evidence, it is not a finding — output NOTHING_TO_DO.
- You are read-only over the user's work: you may read files, search memory, and read skills, but you may NOT write files, save memory, delete skills, install capabilities, or run shell commands.
- Your ONE write is a proposal: call create_skill to propose a new or updated skill that closes a real, recurring gap. It will NOT be written to disk — it is held for the human to approve or reject in the Approvals view. Propose sparingly and only with cited evidence.
### Process
1. Read the recent conversation of the session (you have read tools and the workspace binding).
2. Decide: is there a promised-but-undelivered deliverable, or a recurring capability failure a skill could fix?
3. If yes and only if yes: state the finding with its transcript evidence in one short paragraph, then propose the smallest skill that would prevent it via create_skill.
4. If no: reply exactly NOTHING_TO_DO.`,
modelPreference: 'claude-sonnet-4-6',
tools: [
'read_file', 'search_files', 'search_content',
'search_memory', 'query_knowledge', 'get_identity', 'get_awareness',
'list_skills', 'search_skills', 'read_skill',
'create_skill',
],
// Explicit denylist — ALWAYS_AVAILABLE_TOOLS (persona-tool-filter.ts) re-adds
// save_memory / delete_skill / install_capability / acquire_capability /
// add_task / correct_knowledge past any allowlist, so they must be named here
// to be stripped. spawn_agent + bash + the file/git writes are defense-in-depth
// (they are not in `tools`, but naming them keeps the boundary explicit).
// Connector/external-send tools carry dynamic names and cannot be enumerated
// here; the allowlist (tools[] + always-available) already excludes them since
// none are declared above.
disallowedTools: [
'save_memory', 'delete_skill', 'install_capability', 'acquire_capability',
'add_task', 'correct_knowledge',
'spawn_agent', 'bash',
'write_file', 'edit_file', 'generate_docx',
'git_commit', 'git_push', 'git_merge',
'execute_step', 'compose_workflow', 'orchestrate_workflow',
],
failurePatterns: [
'Inventing a finding with no transcript evidence — must cite what was actually said or output NOTHING_TO_DO.',
'Narrating when silent is correct — if nothing material is found, the reply is exactly NOTHING_TO_DO.',
'Proposing an over-broad skill — the patch must target the specific recurring gap, nothing speculative.',
],
isReadOnly: false,
workspaceAffinity: ['review', 'quality', 'self-evolution'],
suggestedSkills: [],
suggestedConnectors: [],
suggestedMcpServers: [],
suggestedCommands: [],
defaultWorkflow: null,
},
];