Scale With Jaryd
SCALE WITH JARYD
System Documentation//Authenticated

DeepSeek Integration Spec

Integration specification for DeepSeek AI capabilities.

#📡 JARYD.OS // DEEPSEEK API INTEGRATION SPECIFICATION

DATE: December 16, 2025 TARGET SYSTEM: DeepSeek-V3 (or R1) API OBJECTIVE: Replace hardcoded mock logic with live, neuro-adaptive AI intelligence.


1.0 SYSTEM ARCHITECTURE OVERVIEW

The JARYD.OS (Sovereign Stack) is a React-based application centered around two core components:

  1. ProtocolMay1Client.tsx (The Kernel): Handles the visual shell, security gate, telemetry, and module selection.
  2. CopilotClient.tsx (The Neural Core): Handles the chat interface, massive system prompts, and the interaction loop.

Integration Vector: The primary integration point for DeepSeek is within the handleSendMessage function in CopilotClient.tsx.


2.0 COMPONENT BREAKDOWN & API REQUIREMENTS

2.1 The "Warfare Suite" (Modes)

Each "Weapon Card" on the main hub corresponds to a distinct System Prompt context. DeepSeek must adapt its personality based on the active mode.

A. CLARITY TRIGGER (mode: CLARITY)

  • Purpose: Strip cognitive fog and noise.
  • Input: User confusion, overwhelming list of tasks, or vague anxiety.
  • System Prompt Persona: Cold, precise, surgical. No fluff. Asks binary questions.
  • DeepSeek Output Expectation: Short, bulleted directives. "Do X. Ignore Y."
  • API Payload Structure:
    json
    { "system": "You are the CLARITY TRIGGER. Your goal is to strip noise. Speak in short, jagged sentences. Disregard feelings; focus on facts.", "user": "[User Input]" }

B. RAGE ALCHEMY (mode: RAGE)

  • Purpose: Convert anger/frustration into kinetic energy/work.
  • Input: Ranting, complaints about enemies/failures, heat.
  • System Prompt Persona: Aggressive, encouraging, warlord-esque. Validates the anger but demands it be used as fuel.
  • DeepSeek Output Expectation: High-energy reframing. "Good. Use it. Build the empire on their doubt."

C. MELTDOWN ASSIST (mode: MELTDOWN)

  • Purpose: Emergency stabilization during panic or spiral.
  • Input: "I can't do this," "It's over," high-stress markers.
  • System Prompt Persona: Grounding, slow, authoritative parent/commander.
  • DeepSeek Output Expectation: Breathing instructions, sensory grounding (5-4-3-2-1), immediate halt orders.

D. IRON MINDSET (mode: IRON_MINDSET)

  • Purpose: Overwriting negative self-talk loops.
  • Input: "I am weak," "I always fail."
  • System Prompt Persona: The "Higher Self". Stoic, unwavering, truth-telling.
  • DeepSeek Output Expectation: Cognitive reframing. Challenging the inputs with evidence of past success.

E. MISSION OPTIMIZER (mode: MISSION)

  • Purpose: Strategic planning for the May 1, 2026 vector.
  • Input: "What should I do today?", "I'm off track."
  • System Prompt Persona: The Architect. Strategic, long-term vision holder.
  • DeepSeek Output Expectation: Schedule adjustments, tactical priorities, alignment checks.

3.0 TECHNICAL INFRASTRUCTURE & DATA FLOW

3.1 The Interaction Loop

Currently, CopilotClient.tsx simulates network latency with setTimeout. New Flow:

  1. User types input -> setInputText.
  2. handleSendMessage triggers.
  3. POST Request sent to Next.js API Route (e.g., /api/brain/deepseek).
  4. API Route calls DeepSeek API.
  5. Response text is returned and appended to messages state.

3.2 Context Window Strategy

To maintain the "Guardian" feel, the AI needs context of the current session.

  • Implementation: We must send the entire messages array (filtered for relevant props) to the API on each request, not just the last message.
  • Limit: DeepSeek has a large context window, but we should prune messages older than 20 turns to keep latency low.

3.3 Streaming vs. Static

  • Recommendation: Streaming Response.
  • Why: A "typewriter" effect is critical for the sci-fi terminal aesthetic. Waiting 3 seconds for a full block of text breaks the immersion.
  • Tech: Use vercel/ai SDK or native ReadableStream handling to pipe tokens directly into the UI as they arrive.

4.0 API PAYLOAD BLUEPRINT

When calling DeepSeek, the structure should look like this (Server-Side):

typescript
// /api/brain/route.ts const DEEPSEEK_ENDPOINT = "https://api.deepseek.com/v1/chat/completions"; export async function POST(req: Request) { const { mode, history, input } = await req.json(); // 1. Select Persona based on Mode const SYSTEM_PROMPTS = { 'CLARITY': "You are the Clarity Engine...", 'RAGE': "You are the Warlord...", // ... map all modes }; // 2. Construct Payload const payload = { model: "deepseek-chat", // or deepseek-coder if logic heavy messages: [ { role: "system", content: SYSTEM_PROMPTS[mode] || "You are JARYD.OS." }, ...history, // Previous [User, Assistant] pairs { role: "user", content: input } ], temperature: 0.7, // Higher for creative/rage, lower for clarity/analytics stream: true }; // 3. Execute & Stream // ... handling logic }

5.0 FRONTEND EXPECTATIONS

5.1 "Thinking" State

  • Visuals: The "glitch" or "pulsing cursor" must remain active while awaiting the first token.
  • Sound: A subtle "computing" hum should loop until response starts.

5.2 Output Formatting

  • Markdown Support: DeepSeek outputs Markdown. The CopilotClient must render:
    • Bold for emphasis.
    • Code Blocks for tactical steps.
    • Blockquotes for echoing back user truths.


6.0 NEXT STEPS FOR DEPLOYMENT

  1. Acquire API Key: Get DeepSeek API Key.
  2. Build API Route: Create @/app/api/deepseek/route.ts.
  3. Refactor Copilot: Replace mock setTimeout with fetch('/api/deepseek').
  4. Prompt Engineering: Fine-tune the 12 System Prompts (Clarity, Rage, etc.) to perfectly match the "Blacksite" tone.

This architecture ensures JARYD.OS transitions from a static prototype to a living, breathing neural network.