refactor: rename swift → cortex in code and documentation

Complete rename of "swift" terminology to "cortex" across the codebase:

Code Changes:
- Rename directories: lib/swift → lib/cortex, components/swift → components/cortex
- Rename API routes: /api/swift/* → /api/cortex/*
- Rename page routes: /epd/swift → /epd/cortex
- Rename store: swift-store.ts → cortex-store.ts

Type Renames:
- SwiftIntent → CortexIntent
- SwiftStore → CortexStore
- useSwiftStore → useCortexStore
- SwiftContext → CortexContext
- useSwiftVoice → useCortexVoice

Documentation Updates (docs/intent/):
- Safety Net → Nudge (Layer 3 rename)
- SafetySuggestion → NudgeSuggestion
- evaluateSafetyNet → evaluateNudge
- SWIFT_* feature flags → CORTEX_*
- All path references updated to match new structure

Files affected: 47 files, ~700 lines changed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
colinislit
2025-12-30 09:18:06 +01:00
parent c8aaba657e
commit 2170b23348
62 changed files with 364 additions and 355 deletions

View File

@@ -1,7 +1,7 @@
/**
* Swift Layout
* Cortex Layout
*
* Full-screen layout for Swift Command Center.
* Full-screen layout for Cortex Command Center.
* No sidebar - the entire screen is the Command Center.
*/
@@ -9,11 +9,11 @@ import type { ReactNode } from 'react';
import { getUser } from '@/lib/auth/server';
import { redirect } from 'next/navigation';
interface SwiftLayoutProps {
interface CortexLayoutProps {
children: ReactNode;
}
export default async function SwiftLayout({ children }: SwiftLayoutProps) {
export default async function CortexLayout({ children }: CortexLayoutProps) {
const user = await getUser();
if (!user) {

View File

@@ -0,0 +1,13 @@
'use client';
/**
* Cortex Command Center Page
*
* Main entry point for Cortex - the Contextual UI EPD.
*/
import { CommandCenter } from '@/components/cortex';
export default function CortexPage() {
return <CommandCenter />;
}

View File

@@ -1,13 +0,0 @@
'use client';
/**
* Swift Command Center Page
*
* Main entry point for Swift - the Contextual UI EPD.
*/
import { CommandCenter } from '@/components/swift';
export default function SwiftPage() {
return <CommandCenter />;
}

View File

@@ -1,19 +1,19 @@
/**
* Swift Chat API Route (v3.0)
* Cortex Chat API Route (v3.0)
*
* Streaming chat endpoint voor Swift Assistent met Server-Sent Events (SSE).
* Streaming chat endpoint voor Cortex Assistent met Server-Sent Events (SSE).
*
* Epic: E3 (Chat API & Swift Assistent)
* Epic: E3 (Chat API & Cortex Assistent)
* Story: E3.S1 (Chat API endpoint skeleton)
*/
import { NextRequest, NextResponse } from 'next/server';
import { z } from 'zod';
import { getSession } from '@/lib/auth/server';
import type { ChatMessage as ChatMessageType, ChatAction } from '@/stores/swift-store';
import type { ChatMessage as ChatMessageType, ChatAction } from '@/stores/cortex-store';
// Configuration
const SWIFT_MODEL = process.env.SWIFT_MODEL ?? 'claude-sonnet-4-20250514';
const CORTEX_MODEL = process.env.CORTEX_MODEL ?? 'claude-sonnet-4-20250514';
const MAX_HISTORY_MESSAGES = 20;
const MAX_USER_MESSAGE_LENGTH = 2000;
@@ -76,7 +76,7 @@ const RequestSchema = z.object({
type RequestData = z.infer<typeof RequestSchema>;
/**
* Build Swift Assistent system prompt (E3.S3)
* Build Cortex Assistent system prompt (E3.S3)
* Full prompt with intent detection, entity extraction, and action generation
*/
function buildSystemPrompt(context?: RequestData['context']): string {
@@ -92,7 +92,7 @@ function buildSystemPrompt(context?: RequestData['context']): string {
const shiftContext = context?.shift ?? 'ochtend';
return `Je bent Swift Assistent, een medische assistent voor Swift EPD, een Nederlands EPD-systeem voor GGZ-instellingen.
return `Je bent Cortex Assistent, een medische assistent voor Cortex EPD, een Nederlands EPD-systeem voor GGZ-instellingen.
## Je rol
@@ -524,7 +524,7 @@ export async function POST(request: NextRequest) {
// 4. Prepare conversation history (limit to last N messages)
const history = messages.slice(-MAX_HISTORY_MESSAGES);
// 5. Build Swift Assistent system prompt (E3.S3)
// 5. Build Cortex Assistent system prompt (E3.S3)
const systemPrompt = buildSystemPrompt(context);
// 6. Check for Claude API key
@@ -543,7 +543,7 @@ export async function POST(request: NextRequest) {
Accept: 'text/event-stream',
},
body: JSON.stringify({
model: SWIFT_MODEL,
model: CORTEX_MODEL,
max_tokens: 2048,
temperature: 0.7,
stream: true,
@@ -667,7 +667,7 @@ export async function POST(request: NextRequest) {
return NextResponse.json({ error: 'Ongeldige JSON payload' }, { status: 400 });
}
console.error('Swift chat endpoint error:', error);
console.error('Cortex chat endpoint error:', error);
return NextResponse.json({ error: 'Onverwachte serverfout' }, { status: 500 });
}
}

View File

@@ -8,10 +8,10 @@
import { createClient } from '@/lib/auth/server';
import { NextRequest, NextResponse } from 'next/server';
import { z } from 'zod';
import { classifyIntent, isHighConfidence } from '@/lib/swift/intent-classifier';
import { classifyIntentWithAI } from '@/lib/swift/intent-classifier-ai';
import { extractEntities } from '@/lib/swift/entity-extractor';
import type { IntentClassificationResult } from '@/lib/swift/types';
import { classifyIntent, isHighConfidence } from '@/lib/cortex/intent-classifier';
import { classifyIntentWithAI } from '@/lib/cortex/intent-classifier-ai';
import { extractEntities } from '@/lib/cortex/entity-extractor';
import type { IntentClassificationResult } from '@/lib/cortex/types';
// Request schema
const ClassifyRequestSchema = z.object({

View File

@@ -47,7 +47,7 @@ interface EPDSidebarProps {
// LEVEL 1: Behandelaar Context Navigation
const level1NavigationItems: NavigationItem[] = [
{ id: "swift", name: "Swift", icon: Zap, href: "/epd/swift" },
{ id: "cortex", name: "Cortex", icon: Zap, href: "/epd/cortex" },
{ id: "dashboard", name: "Dashboard", icon: LayoutDashboard, href: "/epd/dashboard" },
{ id: "clients", name: "Cliënten", icon: Users, href: "/epd/patients" },
{