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:
@@ -94,7 +94,7 @@ function summarizeInput(input: Record<string, unknown>): string {
|
||||
* approve blind: the approver sees the skill's name up front and can expand the
|
||||
* exact bytes `writeSkill` will persist before allowing it. `summarizeInput`
|
||||
* surfaces none of `{name, content}`, so without this the card showed only the
|
||||
* tool name — a review-before-apply gap for the self-evolution loop.
|
||||
* tool name — a review-before-apply gap for agent-authored skills.
|
||||
*/
|
||||
function SkillPreview({ name, content }: { name: string; content: string }) {
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState } from 'react';
|
||||
import { motion, useReducedMotion } from 'framer-motion';
|
||||
import { Brain, Clock, Network, Download, Activity, BookOpen, Sparkles, User, Briefcase, ShieldCheck, SlidersHorizontal, ChevronDown } from 'lucide-react';
|
||||
import { Brain, Clock, Network, Download, Activity, BookOpen, User, Briefcase, ShieldCheck, SlidersHorizontal, ChevronDown } from 'lucide-react';
|
||||
import type { KGNode, KGEdge } from '@/lib/types';
|
||||
import { HintTooltip } from '@/components/ui/hint-tooltip';
|
||||
import { SPRING } from '@/lib/motion/tokens';
|
||||
@@ -10,7 +10,6 @@ import KnowledgeGraphViewer from './memory/KnowledgeGraphViewer';
|
||||
import HarvestTab from './memory/HarvestTab';
|
||||
import WeaverPanel from './memory/WeaverPanel';
|
||||
import WikiTab from './memory/WikiTab';
|
||||
import EvolutionTab from './memory/EvolutionTab';
|
||||
import MemoryCenterTab from './memory/MemoryCenterTab';
|
||||
import TimelineTab, { type TimelineTabProps } from './memory/TimelineTab';
|
||||
import ImportReminderBanner from './memory/ImportReminderBanner';
|
||||
@@ -23,7 +22,7 @@ import { useOnboarding } from '@/hooks/useOnboarding';
|
||||
* Top-level structure is the ratified TWO-MIND SPLIT: "About you" reads the
|
||||
* Personal Mind; "About this work" reads the active workspace's Mind. The
|
||||
* per-mind list is MemoryCenterTab (reused, parameterized — D2). The legacy
|
||||
* MemoryApp views (Timeline / Graph / Harvest / Weaver / Wiki / Evolution)
|
||||
* MemoryApp views (Timeline / Graph / Harvest / Weaver / Wiki)
|
||||
* survive as secondary tabs after a divider — capability preserved, entry
|
||||
* restructured. Mind pills render only on the Memories tab: the legacy tabs
|
||||
* keep their own scoping (Graph has a scope selector; Harvest writes to the
|
||||
@@ -35,12 +34,12 @@ import { useOnboarding } from '@/hooks/useOnboarding';
|
||||
*/
|
||||
|
||||
export type MindScope = 'personal' | 'workspace';
|
||||
export type MemoryView = 'trust' | 'memories' | 'timeline' | 'graph' | 'harvest' | 'weaver' | 'wiki' | 'evolution';
|
||||
export type MemoryView = 'trust' | 'memories' | 'timeline' | 'graph' | 'harvest' | 'weaver' | 'wiki';
|
||||
|
||||
// PR3.5: 'trust' (screen 19) is the new PRIMARY front door — first + default;
|
||||
// the legacy views demote to secondary (after the divider).
|
||||
export const MEMORY_VIEWS: readonly MemoryView[] = [
|
||||
'trust', 'memories', 'timeline', 'graph', 'harvest', 'weaver', 'wiki', 'evolution',
|
||||
'trust', 'memories', 'timeline', 'graph', 'harvest', 'weaver', 'wiki',
|
||||
];
|
||||
|
||||
interface MemoryTabDef {
|
||||
@@ -50,9 +49,9 @@ interface MemoryTabDef {
|
||||
tooltip: string;
|
||||
}
|
||||
|
||||
// UX gold-standard H1: 8 equal-weight tabs regrouped into 4 primary + an
|
||||
// UX gold-standard H1: 7 equal-weight tabs regrouped into 4 primary + an
|
||||
// "Advanced" flyout (display-level IA only — every view id, route and
|
||||
// ?tab= deep-link is unchanged; MEMORY_VIEWS still validates all 8).
|
||||
// ?tab= deep-link is unchanged; MEMORY_VIEWS still validates all 7).
|
||||
const PRIMARY_TABS: MemoryTabDef[] = [
|
||||
{ id: 'trust', label: 'Trust', icon: ShieldCheck, tooltip: 'Memory Trust — confidence & freshness, forget / correct / confirm, and "why did you do that?"' },
|
||||
{ id: 'memories', label: 'Memories', icon: Brain, tooltip: 'Memory Center — inspect, edit, review, merge' },
|
||||
@@ -64,7 +63,6 @@ const ADVANCED_TABS: MemoryTabDef[] = [
|
||||
{ id: 'harvest', label: 'Imports', icon: Download, tooltip: 'Import conversations from other AIs' },
|
||||
{ id: 'weaver', label: 'Maintenance', icon: Activity, tooltip: 'Memory distillation and consolidation' },
|
||||
{ id: 'wiki', label: 'Wiki', icon: BookOpen, tooltip: 'Compiled knowledge pages' },
|
||||
{ id: 'evolution', label: 'Improvements', icon: Sparkles, tooltip: 'Self-evolving prompts and agents' },
|
||||
];
|
||||
|
||||
export interface MemoryCenterAppProps {
|
||||
@@ -151,7 +149,7 @@ const MemoryCenterApp = ({
|
||||
<div className="flex items-center">
|
||||
<div className="w-px h-4 bg-border/60 mx-1" aria-hidden="true" />
|
||||
<div className="relative">
|
||||
<HintTooltip content="Imports, maintenance, wiki, and improvements">
|
||||
<HintTooltip content="Imports, maintenance, and wiki">
|
||||
<button
|
||||
role="tab"
|
||||
onClick={() => setAdvancedOpen(o => !o)}
|
||||
@@ -279,10 +277,8 @@ const MemoryCenterApp = ({
|
||||
<HarvestTab />
|
||||
) : view === 'weaver' ? (
|
||||
<WeaverPanel />
|
||||
) : view === 'wiki' ? (
|
||||
<WikiTab />
|
||||
) : (
|
||||
<EvolutionTab />
|
||||
<WikiTab />
|
||||
)}
|
||||
</motion.div>
|
||||
</div>
|
||||
|
||||
@@ -1,253 +0,0 @@
|
||||
/**
|
||||
* EvolutionTab — PR6b B4 (skill-card + version-ladder view, D12/D13).
|
||||
*
|
||||
* Covers the new aggregation framing layered over the EXISTING run-review:
|
||||
* - runs aggregate by (target_kind, target_name) into skill cards
|
||||
* - the version ladder orders v1=oldest→vN=newest and renders score bars
|
||||
* - the D13 provenance badge appears ONLY when a deployed run records a
|
||||
* passing regression gate, and is OMITTED otherwise (no fabrication)
|
||||
* - the "By skill" / "By run" toggle preserves the raw run list
|
||||
* - selecting a version loads the existing detail view
|
||||
*/
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
import { render, screen, cleanup, fireEvent } from '@testing-library/react';
|
||||
import { TooltipProvider } from '@/components/ui/tooltip';
|
||||
|
||||
const mocks = vi.hoisted(() => ({
|
||||
adapter: {
|
||||
fetch: vi.fn(),
|
||||
},
|
||||
}));
|
||||
vi.mock('@/lib/adapter', () => ({ adapter: mocks.adapter, default: vi.fn() }));
|
||||
|
||||
import EvolutionTab from './EvolutionTab';
|
||||
|
||||
/** HintTooltip (radix) requires a provider in the tree. */
|
||||
function renderTab() {
|
||||
return render(
|
||||
<TooltipProvider>
|
||||
<EvolutionTab />
|
||||
</TooltipProvider>,
|
||||
);
|
||||
}
|
||||
|
||||
interface FakeRun {
|
||||
id: number;
|
||||
run_uuid: string;
|
||||
target_kind: string;
|
||||
target_name: string | null;
|
||||
baseline_text: string;
|
||||
winner_text: string;
|
||||
delta_accuracy: number;
|
||||
gate_verdict: 'pass' | 'fail' | 'warn';
|
||||
gate_reasons_json: string;
|
||||
status: 'proposed' | 'accepted' | 'rejected' | 'deployed' | 'failed';
|
||||
user_note?: string | null;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
const baseRun = (over: Partial<FakeRun>): FakeRun => ({
|
||||
id: 1,
|
||||
run_uuid: 'uuid-1',
|
||||
target_kind: 'behavioral-spec-section',
|
||||
target_name: 'Section A',
|
||||
baseline_text: 'baseline',
|
||||
winner_text: 'winner',
|
||||
delta_accuracy: 0.05,
|
||||
gate_verdict: 'pass',
|
||||
gate_reasons_json: '[]',
|
||||
status: 'proposed',
|
||||
user_note: null,
|
||||
created_at: '2026-06-01T00:00:00.000Z',
|
||||
...over,
|
||||
});
|
||||
|
||||
// Two versions of the same skill (Section A) + one different skill (Section B).
|
||||
const RUNS: FakeRun[] = [
|
||||
baseRun({
|
||||
id: 1, run_uuid: 'a-v1', target_name: 'Section A',
|
||||
delta_accuracy: 0.03, status: 'rejected', user_note: 'first draft',
|
||||
created_at: '2026-06-01T00:00:00.000Z',
|
||||
}),
|
||||
baseRun({
|
||||
id: 2, run_uuid: 'a-v2', target_name: 'Section A',
|
||||
delta_accuracy: 0.09, status: 'deployed', user_note: 'added a citation lane',
|
||||
gate_reasons_json: JSON.stringify([{ gate: 'regression', verdict: 'pass', reason: 'beat baseline' }]),
|
||||
created_at: '2026-06-05T00:00:00.000Z',
|
||||
}),
|
||||
baseRun({
|
||||
id: 3, run_uuid: 'b-v1', target_name: 'Section B',
|
||||
delta_accuracy: 0.02, status: 'proposed',
|
||||
created_at: '2026-06-03T00:00:00.000Z',
|
||||
}),
|
||||
];
|
||||
|
||||
const STATUS = {
|
||||
counts: { proposed: 1, accepted: 0, rejected: 1, deployed: 1, failed: 0 },
|
||||
pendingCount: 1,
|
||||
};
|
||||
|
||||
function routeFetch(url: string): Response {
|
||||
if (url.includes('/api/evolution/targets')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
personas: [{ id: 'general-purpose', name: 'General Purpose' }],
|
||||
sections: ['Section A'],
|
||||
defaultSchema: { kind: 'baseline' },
|
||||
}),
|
||||
} as unknown as Response;
|
||||
}
|
||||
if (url.includes('/api/evolution/baseline')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
baseline: 'section baseline text',
|
||||
schemaBaseline: { kind: 'baseline' },
|
||||
}),
|
||||
} as unknown as Response;
|
||||
}
|
||||
if (url.includes('/api/evolution/status')) {
|
||||
return { ok: true, json: async () => STATUS } as unknown as Response;
|
||||
}
|
||||
if (url.includes('/api/evolution/runs/')) {
|
||||
const uuid = url.split('/api/evolution/runs/')[1];
|
||||
const run = RUNS.find(r => r.run_uuid === uuid);
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({ ...run, winnerSchema: null, artifacts: null, gateReasons: [] }),
|
||||
} as unknown as Response;
|
||||
}
|
||||
if (url.includes('/api/evolution/runs')) {
|
||||
return { ok: true, json: async () => ({ runs: RUNS }) } as unknown as Response;
|
||||
}
|
||||
return { ok: true, json: async () => ({}) } as unknown as Response;
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
mocks.adapter.fetch.mockImplementation((url: string) =>
|
||||
Promise.resolve(routeFetch(url)),
|
||||
);
|
||||
});
|
||||
afterEach(() => { cleanup(); vi.clearAllMocks(); });
|
||||
|
||||
describe('EvolutionTab — skill-card / version-ladder (D12)', () => {
|
||||
it('aggregates runs by target into skill cards (two cards for two distinct targets)', async () => {
|
||||
renderTab();
|
||||
// Skill view is the default — both targets appear as card headers.
|
||||
expect(await screen.findByText('Section A')).toBeInTheDocument();
|
||||
expect(screen.getByText('Section B')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders a version ladder ordered v1=oldest with score bars per version', async () => {
|
||||
renderTab();
|
||||
await screen.findByText('Section A');
|
||||
// Subtitle text is interpolated ("<kind> · N versions") — match on the
|
||||
// count substring with a node matcher.
|
||||
expect(screen.getByText(/2 versions/)).toBeInTheDocument();
|
||||
expect(screen.getByText(/1 version\b/)).toBeInTheDocument();
|
||||
// v1/v2 tags + the human notes used as improve-notes, in order.
|
||||
expect(screen.getByText('first draft')).toBeInTheDocument();
|
||||
expect(screen.getByText('added a citation lane')).toBeInTheDocument();
|
||||
expect(screen.getAllByText('v1').length).toBeGreaterThanOrEqual(2);
|
||||
expect(screen.getByText('v2')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows the D13 provenance badge ONLY for the deployed run with a passing regression gate', async () => {
|
||||
renderTab();
|
||||
await screen.findByText('Section A');
|
||||
// The deployed v2 (regression pass) earns the verified pill; nothing else does.
|
||||
const badges = screen.getAllByText(/regression gate · score-verified/i);
|
||||
expect(badges).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('does NOT fabricate a "judged by 3 models" / GEPA roster string', async () => {
|
||||
renderTab();
|
||||
await screen.findByText('Section A');
|
||||
expect(screen.queryByText(/judged by 3 models/i)).not.toBeInTheDocument();
|
||||
expect(screen.queryByText(/GEPA optimized/i)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('preserves the raw run list behind the "By run" toggle, with status filter chips', async () => {
|
||||
renderTab();
|
||||
await screen.findByText('Section A');
|
||||
// Filter chips are hidden in skill view.
|
||||
expect(screen.queryByRole('button', { name: /^all/i })).not.toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('tab', { name: /by run/i }));
|
||||
// Now the filter chips (raw run list controls) are present.
|
||||
expect(await screen.findByRole('button', { name: /^all/i })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('selecting a version routes to the existing run detail view', async () => {
|
||||
renderTab();
|
||||
const card = (await screen.findByText('Section A')).closest('div')!;
|
||||
// Click the deployed v2 version row.
|
||||
fireEvent.click(screen.getByText('added a citation lane'));
|
||||
// Detail view loads the run (right pane shows the Baseline vs Winner diff).
|
||||
expect(await screen.findByText(/baseline vs winner/i)).toBeInTheDocument();
|
||||
expect(card).toBeTruthy();
|
||||
});
|
||||
|
||||
it('a11y: proposal review note exposes stable form metadata and a visible focus style', async () => {
|
||||
renderTab();
|
||||
fireEvent.click(await screen.findByRole('button', { name: /v1 awaiting review/i }));
|
||||
const note = await screen.findByLabelText(/note \(optional\)/i);
|
||||
expect(note).toHaveAttribute('name', 'evolutionReviewNote');
|
||||
expect(note).toHaveAttribute('autocomplete', 'off');
|
||||
expect(note.className).toContain('focus-visible:ring-2');
|
||||
});
|
||||
|
||||
it('still surfaces the pending-review banner and New Run affordance', async () => {
|
||||
renderTab();
|
||||
expect(await screen.findByText(/1 proposal awaiting review/i)).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: /new evolution run/i })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('a11y: new run modal close icon has a name and visible focus style', async () => {
|
||||
renderTab();
|
||||
fireEvent.click(await screen.findByRole('button', { name: /new evolution run/i }));
|
||||
const close = await screen.findByRole('button', { name: /close new evolution run/i });
|
||||
expect(close.className).toContain('focus-visible:ring-2');
|
||||
});
|
||||
|
||||
it('a11y: new run modal controls expose stable form metadata and visible focus styles', async () => {
|
||||
renderTab();
|
||||
fireEvent.click(await screen.findByRole('button', { name: /new evolution run/i }));
|
||||
|
||||
const kind = await screen.findByLabelText(/target kind/i);
|
||||
expect(kind).toHaveAttribute('id', 'evolution-run-target-kind');
|
||||
expect(kind).toHaveAttribute('name', 'evolutionTargetKind');
|
||||
expect(kind).toHaveAttribute('autocomplete', 'off');
|
||||
expect(kind.className).toContain('focus-visible:ring-2');
|
||||
|
||||
const name = screen.getByLabelText(/target name/i);
|
||||
expect(name).toHaveAttribute('id', 'evolution-run-target-name');
|
||||
expect(name).toHaveAttribute('name', 'evolutionTargetName');
|
||||
expect(name).toHaveAttribute('autocomplete', 'off');
|
||||
expect(name.className).toContain('focus-visible:ring-2');
|
||||
|
||||
const baseline = await screen.findByLabelText(/^baseline/i);
|
||||
expect(baseline).toHaveAttribute('id', 'evolution-run-baseline');
|
||||
expect(baseline).toHaveAttribute('name', 'evolutionBaseline');
|
||||
expect(baseline).toHaveAttribute('autocomplete', 'off');
|
||||
expect(baseline.className).toContain('focus-visible:ring-2');
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: /advanced \(schema baseline\)/i }));
|
||||
const schema = await screen.findByLabelText(/schema baseline json/i);
|
||||
expect(schema).toHaveAttribute('id', 'evolution-run-schema');
|
||||
expect(schema).toHaveAttribute('name', 'evolutionSchemaBaseline');
|
||||
expect(schema).toHaveAttribute('autocomplete', 'off');
|
||||
expect(schema.className).toContain('focus-visible:ring-2');
|
||||
});
|
||||
|
||||
it('shows the empty state when there are no runs', async () => {
|
||||
mocks.adapter.fetch.mockImplementation((url: string) => {
|
||||
if (url.includes('/api/evolution/status')) {
|
||||
return Promise.resolve({ ok: true, json: async () => ({ counts: {}, pendingCount: 0 }) } as unknown as Response);
|
||||
}
|
||||
return Promise.resolve({ ok: true, json: async () => ({ runs: [] }) } as unknown as Response);
|
||||
});
|
||||
renderTab();
|
||||
expect(await screen.findByText(/your skills get better on their own/i)).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
@@ -108,7 +108,7 @@ function actionToResult(action: ResolvedAction): CommandResult {
|
||||
* (idle) palette by naming the power-tool categories — no sidebar items added,
|
||||
* no new persistence. Typing filters them away via the curated catalog above. */
|
||||
const POWER_TOOL_HINTS: readonly string[] = [
|
||||
'Automations', 'Files', 'Vault', 'Usage', 'Connectors', 'Evolution',
|
||||
'Automations', 'Files', 'Vault', 'Usage', 'Connectors',
|
||||
];
|
||||
|
||||
/* ── Permission prompt (C9 — reuses the chat ApprovalGate visual pattern) ──
|
||||
|
||||
Reference in New Issue
Block a user