⛰️ LifeOS — The AI-powered Life Operating System that helps you hill climb to wherever you're going.
Add kai-observability-server pack, rename Special Sauce sections
Daniel Miesslerfb7e357efe1f
diff --git a/Bundles/Kai/README.md b/Bundles/Kai/README.mdindex f7e6f327..4105eb4a 100644--- a/Bundles/Kai/README.md+++ b/Bundles/Kai/README.md@@ -8,7 +8,15 @@## AI Installation Wizard-**Start by asking your principal these questions:**+The wizard has two phases:+1. **Phase 1: System Setup** - Where to install, basic configuration+2. **Phase 2: Identity & Personalization** - Who you are, what you want from the system++---++### Phase 1: System Setup++**Ask these questions first:**1. **Where should PAI be installed?** (default: `~/.config/pai`)2. **What would you like to name your AI assistant?** (e.g., Kai, Atlas, Nova, Jarvis)@@ -25,6 +33,87 @@ export ELEVENLABS_API_KEY="[if provided]"export ELEVENLABS_VOICE_ID="[if provided]"```+---++### Phase 2: Identity & Personalization++**This is where we make the AI truly yours.** Ask these questions to customize the CORE skill with personal context.++#### Section 1: DA Personality++Choose ONE path:++**Option A - Generate Personality (Recommended):**+> "Describe your ideal AI assistant personality in a few sentences. What kind of collaborator do you want?"++Based on their description, generate calibration values (0-100 scale) for:+- Humor (0=serious, 100=witty)+- Curiosity (0=focused, 100=exploratory)+- Precision (0=approximate, 100=exact)+- Formality (0=casual, 100=professional)+- Playfulness (0=businesslike, 100=playful)+- Directness (0=diplomatic, 100=blunt)++**Option B - Manual Calibration:**+> "Rate each trait from 0-100:"+> - Humor?+> - Curiosity?+> - Precision?+> - Formality?+> - Playfulness?+> - Directness?++#### Section 2: About You++1. **What is your name?**+2. **What is your profession or primary role?** (e.g., software engineer, entrepreneur, researcher)+3. **What is the primary purpose you'll use this system for?** (e.g., software development, content creation, research, business automation)+4. **What would you like to be able to do with this system?** (List 3-5 goals)+5. **Where do you see yourself in 5 years?** (Career/life context helps AI understand priorities)+6. **Are you working for yourself or for a company?** (self-employed / employed / building a company / other)++#### Section 3: Key Contacts++> "Would you like to add any key contacts now? These are people you frequently reference - colleagues, family, business partners. Your AI can look them up instantly."++If yes, for each contact:+- **Name** (and pronunciation if unusual)+- **Email**+- **Role/Relationship** (e.g., "Business Partner", "Spouse", "CTO", "Mentor")++Continue adding contacts until they say they're done.++#### Section 4: Technical Preferences++> "Let me understand your technical setup so I can give better recommendations."++1. **How technical are you?** (Beginner / Intermediate / Advanced / Expert)+2. **Are you a programmer?** (Yes / No / Learning)+3. **What OS do you primarily use?** (macOS / Windows / Linux)+4. **Preferred programming languages?** (multi-select: TypeScript, Python, Go, Rust, Java, etc.)+5. **Preferred package manager for JS/TS?** (bun / npm / yarn / pnpm)+6. **Preferred server runtime?** (Bun / Node.js / Deno)+7. **Do you use Cloudflare?** (Yes / No / Not sure)+8. **Preferred backend infrastructure?** (Cloudflare Workers / AWS / GCP / Vercel / Railway / Fly.io / etc.)+9. **Database preference?** (PostgreSQL / SQLite / MySQL / MongoDB / Supabase / etc.)++---++### Phase 3: Generate Configuration Files++After gathering all answers, use them to populate the CORE skill templates:++**Files to populate:**+- `$PAI_DIR/Skills/CORE/SKILL.md` - Identity, personality, goals+- `$PAI_DIR/Skills/CORE/Contacts.md` - Contact directory+- `$PAI_DIR/Skills/CORE/CoreStack.md` - Technical preferences with generated rules++**Example stack rules generation:**+If user selected: TypeScript, bun, Cloudflare Workers+→ Generate: "Use TypeScript for all code. Use bun (NEVER npm/yarn). Deploy to Cloudflare Workers."++---+**Then proceed through each pack in the Installation Order section, reading each pack file and installing it with the configured variables.**---diff --git a/Bundles/Kai/install.ts b/Bundles/Kai/install.tsnew file mode 100644index 00000000..2363d86f--- /dev/null+++ b/Bundles/Kai/install.ts@@ -0,0 +1,873 @@+#!/usr/bin/env bun+/**+ * Kai Bundle Installation Wizard+ *+ * Interactive CLI wizard for setting up the complete Kai bundle+ * with full identity and personalization configuration.+ *+ * Usage: bun run install.ts+ */++import { $ } from "bun";+import * as readline from "readline";++// =============================================================================+// TYPES+// =============================================================================++interface SystemConfig {+ paiDir: string;+ daName: string;+ timeZone: string;+ elevenLabsApiKey?: string;+ elevenLabsVoiceId?: string;+ shellProfile: string;+}++interface PersonalityTraits {+ humor: number;+ curiosity: number;+ precision: number;+ formality: number;+ playfulness: number;+ directness: number;+}++interface Contact {+ name: string;+ email: string;+ role: string;+ pronunciation?: string;+}++interface PersonalizationConfig {+ userName: string;+ userProfession: string;+ primaryPurpose: string;+ systemGoals: string[];+ fiveYearVision: string;+ employmentContext: "self-employed" | "employed" | "building-company" | "other";+ personalityMode: "generate" | "custom";+ personalityDescription?: string;+ personalityTraits?: PersonalityTraits;+ contacts: Contact[];+ technicalLevel: "beginner" | "intermediate" | "advanced" | "expert";+ isProgrammer: "yes" | "no" | "learning";+ primaryOS: "macos" | "windows" | "linux";+ preferredLanguages: string[];+ packageManager: "bun" | "npm" | "yarn" | "pnpm";+ serverRuntime: "bun" | "node" | "deno";+ usesCloudflare: boolean;+ backendPreference: string;+ databasePreference: string;+}++type WizardConfig = SystemConfig & PersonalizationConfig;++// =============================================================================+// UTILITIES+// =============================================================================++const rl = readline.createInterface({+ input: process.stdin,+ output: process.stdout,+});++function ask(question: string): Promise<string> {+ return new Promise((resolve) => {+ rl.question(question, (answer) => {+ resolve(answer.trim());+ });+ });+}++async function askWithDefault(question: string, defaultValue: string): Promise<string> {+ const answer = await ask(`${question} [${defaultValue}]: `);+ return answer || defaultValue;+}++async function askYesNo(question: string, defaultYes = true): Promise<boolean> {+ const defaultStr = defaultYes ? "Y/n" : "y/N";+ const answer = await ask(`${question} [${defaultStr}]: `);+ if (!answer) return defaultYes;+ return answer.toLowerCase().startsWith("y");+}++async function askNumber(question: string, min: number, max: number, defaultValue: number): Promise<number> {+ while (true) {+ const answer = await ask(`${question} (${min}-${max}) [${defaultValue}]: `);+ if (!answer) return defaultValue;+ const num = parseInt(answer, 10);+ if (!isNaN(num) && num >= min && num <= max) return num;+ console.log(`Please enter a number between ${min} and ${max}`);+ }+}++async function askChoice<T extends string>(question: string, options: T[], defaultOption?: T): Promise<T> {+ console.log(`\n${question}`);+ options.forEach((opt, i) => {+ const isDefault = opt === defaultOption ? " (default)" : "";+ console.log(` ${i + 1}. ${opt}${isDefault}`);+ });++ while (true) {+ const answer = await ask("Enter number or value: ");+ if (!answer && defaultOption) return defaultOption;++ const num = parseInt(answer, 10);+ if (!isNaN(num) && num >= 1 && num <= options.length) {+ return options[num - 1];+ }++ const match = options.find(o => o.toLowerCase() === answer.toLowerCase());+ if (match) return match;++ console.log("Invalid choice, please try again.");+ }+}++async function askMultiSelect(question: string, options: string[]): Promise<string[]> {+ console.log(`\n${question} (enter numbers separated by commas, or 'done'):`);+ options.forEach((opt, i) => {+ console.log(` ${i + 1}. ${opt}`);+ });++ const selected: string[] = [];+ while (true) {+ const answer = await ask("Add selection (or 'done'): ");+ if (answer.toLowerCase() === "done") break;++ const nums = answer.split(",").map(s => parseInt(s.trim(), 10));+ for (const num of nums) {+ if (!isNaN(num) && num >= 1 && num <= options.length) {+ const opt = options[num - 1];+ if (!selected.includes(opt)) {+ selected.push(opt);+ console.log(` ✓ Added: ${opt}`);+ }+ }+ }+ }+ return selected;+}++function printHeader(title: string) {+ console.log("\n" + "=".repeat(60));+ console.log(` ${title}`);+ console.log("=".repeat(60) + "\n");+}++function printSection(title: string) {+ console.log("\n" + "-".repeat(40));+ console.log(` ${title}`);+ console.log("-".repeat(40) + "\n");+}++// =============================================================================+// WIZARD PHASES+// =============================================================================++async function gatherSystemConfig(): Promise<SystemConfig> {+ printHeader("PHASE 1: SYSTEM SETUP");++ const paiDir = await askWithDefault(+ "Where should PAI be installed?",+ "~/.config/pai"+ );++ const daName = await askWithDefault(+ "What would you like to name your AI assistant?",+ "PAI"+ );++ const timeZone = await askWithDefault(+ "What's your timezone?",+ Intl.DateTimeFormat().resolvedOptions().timeZone+ );++ const wantsVoice = await askYesNo("Do you want voice notifications (requires ElevenLabs)?", false);++ let elevenLabsApiKey: string | undefined;+ let elevenLabsVoiceId: string | undefined;++ if (wantsVoice) {+ elevenLabsApiKey = await ask("Enter your ElevenLabs API key: ");+ elevenLabsVoiceId = await askWithDefault(+ "Enter your preferred voice ID",+ "s3TPKV1kjDlVtZbl4Ksh"+ );+ }++ // Detect shell profile+ const shell = process.env.SHELL || "/bin/zsh";+ const shellProfile = shell.includes("zsh") ? "~/.zshrc" : "~/.bashrc";++ return {+ paiDir,+ daName,+ timeZone,+ elevenLabsApiKey,+ elevenLabsVoiceId,+ shellProfile,+ };+}++async function gatherPersonalization(): Promise<PersonalizationConfig> {+ printHeader("PHASE 2: IDENTITY & PERSONALIZATION");++ // Section 1: DA Personality+ printSection("Section 1: DA Personality");++ const personalityMode = await askChoice<"generate" | "custom">(+ "How would you like to configure your AI's personality?",+ ["generate", "custom"],+ "generate"+ );++ let personalityDescription: string | undefined;+ let personalityTraits: PersonalityTraits | undefined;++ if (personalityMode === "generate") {+ console.log("\nDescribe your ideal AI assistant personality.");+ console.log("Example: 'Helpful and precise, with dry wit. Direct but friendly.'");+ personalityDescription = await ask("\nYour description: ");++ // Generate traits from description (simple heuristics, AI would do better)+ personalityTraits = generatePersonalityFromDescription(personalityDescription);+ console.log("\nGenerated personality calibration:");+ Object.entries(personalityTraits).forEach(([trait, value]) => {+ console.log(` ${trait}: ${value}/100`);+ });+ } else {+ console.log("\nRate each trait from 0-100:");+ personalityTraits = {+ humor: await askNumber("Humor (0=serious, 100=witty)", 0, 100, 50),+ curiosity: await askNumber("Curiosity (0=focused, 100=exploratory)", 0, 100, 70),+ precision: await askNumber("Precision (0=approximate, 100=exact)", 0, 100, 80),+ formality: await askNumber("Formality (0=casual, 100=professional)", 0, 100, 60),+ playfulness: await askNumber("Playfulness (0=businesslike, 100=playful)", 0, 100, 50),+ directness: await askNumber("Directness (0=diplomatic, 100=blunt)", 0, 100, 70),+ };+ }++ // Section 2: About You+ printSection("Section 2: About You");++ const userName = await ask("What is your name? ");+ const userProfession = await ask("What is your profession or primary role? ");+ const primaryPurpose = await ask("What is the primary purpose you'll use this system for? ");++ console.log("\nWhat would you like to be able to do with this system? (enter goals, 'done' when finished)");+ const systemGoals: string[] = [];+ while (true) {+ const goal = await ask(`Goal ${systemGoals.length + 1} (or 'done'): `);+ if (goal.toLowerCase() === "done" || !goal) break;+ systemGoals.push(goal);+ }++ const fiveYearVision = await ask("Where do you see yourself in 5 years? ");++ const employmentContext = await askChoice<PersonalizationConfig["employmentContext"]>(+ "What's your work situation?",+ ["self-employed", "employed", "building-company", "other"],+ "employed"+ );++ // Section 3: Key Contacts+ printSection("Section 3: Key Contacts");++ const contacts: Contact[] = [];+ const wantsContacts = await askYesNo("Would you like to add key contacts now?", true);++ if (wantsContacts) {+ while (true) {+ const name = await ask("\nContact name (or 'done'): ");+ if (name.toLowerCase() === "done" || !name) break;++ const email = await ask("Email: ");+ const role = await ask("Role/Relationship: ");+ const pronunciation = await ask("Pronunciation (if unusual, or press Enter to skip): ");++ contacts.push({+ name,+ email,+ role,+ pronunciation: pronunciation || undefined,+ });+ console.log(`✓ Added ${name}`);+ }+ }++ // Section 4: Technical Preferences+ printSection("Section 4: Technical Preferences");++ const technicalLevel = await askChoice<PersonalizationConfig["technicalLevel"]>(+ "How technical are you?",+ ["beginner", "intermediate", "advanced", "expert"],+ "intermediate"+ );++ const isProgrammer = await askChoice<PersonalizationConfig["isProgrammer"]>(+ "Are you a programmer?",+ ["yes", "no", "learning"],+ "yes"+ );++ const primaryOS = await askChoice<PersonalizationConfig["primaryOS"]>(+ "What OS do you primarily use?",+ ["macos", "windows", "linux"],+ "macos"+ );++ const preferredLanguages = await askMultiSelect(+ "What programming languages do you prefer?",+ ["TypeScript", "Python", "Go", "Rust", "Java", "C#", "Ruby", "PHP", "Swift", "Kotlin"]+ );++ const packageManager = await askChoice<PersonalizationConfig["packageManager"]>(+ "Preferred package manager for JS/TS?",+ ["bun", "npm", "yarn", "pnpm"],+ "bun"+ );++ const serverRuntime = await askChoice<PersonalizationConfig["serverRuntime"]>(+ "Preferred server runtime?",+ ["bun", "node", "deno"],+ "bun"+ );++ const usesCloudflare = await askYesNo("Do you use Cloudflare?", true);++ const backendPreference = await askWithDefault(+ "Preferred backend infrastructure?",+ usesCloudflare ? "Cloudflare Workers" : "AWS"+ );++ const databasePreference = await askWithDefault(+ "Database preference?",+ "PostgreSQL"+ );++ return {+ userName,+ userProfession,+ primaryPurpose,+ systemGoals,+ fiveYearVision,+ employmentContext,+ personalityMode,+ personalityDescription,+ personalityTraits,+ contacts,+ technicalLevel,+ isProgrammer,+ primaryOS,+ preferredLanguages,+ packageManager,+ serverRuntime,+ usesCloudflare,+ backendPreference,+ databasePreference,+ };+}++function generatePersonalityFromDescription(description: string): PersonalityTraits {+ const lower = description.toLowerCase();++ // Simple keyword-based heuristics+ const traits: PersonalityTraits = {+ humor: 50,+ curiosity: 70,+ precision: 75,+ formality: 60,+ playfulness: 50,+ directness: 65,+ };++ // Humor+ if (lower.includes("witty") || lower.includes("funny") || lower.includes("humor")) {+ traits.humor = 80;+ } else if (lower.includes("serious") || lower.includes("professional")) {+ traits.humor = 30;+ }++ // Curiosity+ if (lower.includes("curious") || lower.includes("exploratory") || lower.includes("creative")) {+ traits.curiosity = 85;+ } else if (lower.includes("focused") || lower.includes("efficient")) {+ traits.curiosity = 50;+ }++ // Precision+ if (lower.includes("precise") || lower.includes("exact") || lower.includes("detailed")) {+ traits.precision = 95;+ } else if (lower.includes("flexible") || lower.includes("casual")) {+ traits.precision = 60;+ }++ // Formality+ if (lower.includes("formal") || lower.includes("professional")) {+ traits.formality = 85;+ } else if (lower.includes("casual") || lower.includes("friendly") || lower.includes("relaxed")) {+ traits.formality = 40;+ }++ // Playfulness+ if (lower.includes("playful") || lower.includes("fun") || lower.includes("energetic")) {+ traits.playfulness = 80;+ } else if (lower.includes("businesslike") || lower.includes("serious")) {+ traits.playfulness = 30;+ }++ // Directness+ if (lower.includes("direct") || lower.includes("blunt") || lower.includes("honest")) {+ traits.directness = 85;+ } else if (lower.includes("diplomatic") || lower.includes("gentle") || lower.includes("careful")) {+ traits.directness = 45;+ }++ return traits;+}++// =============================================================================+// FILE GENERATION+// =============================================================================++function generateSkillMd(config: WizardConfig): string {+ const traits = config.personalityTraits!;++ const languageList = config.preferredLanguages.length > 0+ ? config.preferredLanguages.map((l, i) => `${i + 1}. ${l}`).join("\n")+ : "1. TypeScript";++ const contactsList = config.contacts.length > 0+ ? config.contacts.map(c => `- **${c.name}** (${c.role}): ${c.email}`).join("\n")+ : "No contacts added yet.";++ const goalsList = config.systemGoals.length > 0+ ? config.systemGoals.map((g, i) => `${i + 1}. ${g}`).join("\n")+ : "Not specified";++ return `---+name: CORE+description: Personal AI Infrastructure core. AUTO-LOADS at session start. USE WHEN any session begins OR user asks about identity, response format, contacts, stack preferences.+---++# CORE - Personal AI Infrastructure++**Auto-loads at session start.** This skill defines your AI's identity, response format, and core operating principles.++## Workflow Routing++| Workflow | Trigger | File |+|----------|---------|------|+| **UpdateIdentity** | "update identity", "change personality" | \`Workflows/UpdateIdentity.md\` |+| **AddContact** | "add contact", "new contact" | \`Workflows/AddContact.md\` |+| **UpdateAssets** | "update assets", "add property" | \`Workflows/UpdateAssets.md\` |++## Examples++**Example 1: Check contact information**+\`\`\`+User: "What's ${config.contacts[0]?.name || 'Alex'}'s email?"+→ Reads Contacts.md+→ Returns contact information+\`\`\`++---++## Identity++**Assistant:**+- Name: ${config.daName}+- Role: ${config.userName}'s AI assistant+- Operating Environment: Personal AI infrastructure built on Claude Code++**User:**+- Name: ${config.userName}+- Profession: ${config.userProfession}+- Work Situation: ${config.employmentContext}++---++## Purpose & Goals++**Primary Purpose:** ${config.primaryPurpose}++**System Goals:**+${goalsList}++**5-Year Vision:**+${config.fiveYearVision}++---++## Personality Calibration++${config.personalityMode === "generate" ? `**Generated from description:** "${config.personalityDescription}"` : "**Custom configuration:**"}++| Trait | Value | Description |+|-------|-------|-------------|+| Humor | ${traits.humor}/100 | ${traits.humor > 60 ? "Witty and playful" : traits.humor > 40 ? "Moderate wit" : "Serious and focused"} |+| Curiosity | ${traits.curiosity}/100 | ${traits.curiosity > 60 ? "Exploratory" : "Task-focused"} |+| Precision | ${traits.precision}/100 | ${traits.precision > 70 ? "Highly exact" : "Flexible"} |+| Formality | ${traits.formality}/100 | ${traits.formality > 60 ? "Professional" : "Casual and friendly"} |+| Playfulness | ${traits.playfulness}/100 | ${traits.playfulness > 60 ? "Playful" : "Businesslike"} |+| Directness | ${traits.directness}/100 | ${traits.directness > 60 ? "Direct and blunt" : "Diplomatic"} |++---++## First-Person Voice (CRITICAL)++Your AI should speak as itself, not about itself in third person.++**Correct:**+- "for my system" / "in my architecture"+- "I can help" / "my delegation patterns"+- "we built this together"++**Wrong:**+- "for ${config.daName}" / "for the ${config.daName} system"+- "the system can" (when meaning "I can")++---++## Technical Stack Preferences++**Technical Level:** ${config.technicalLevel}+**Programmer:** ${config.isProgrammer}++**Platform:**+- OS: ${config.primaryOS}+- Runtime: ${config.serverRuntime}+- Package Manager: ${config.packageManager}++**Languages (in order of preference):**+${languageList}++**Infrastructure:**+- Cloudflare: ${config.usesCloudflare ? "Yes" : "No"}+- Backend: ${config.backendPreference}+- Database: ${config.databasePreference}++---++## Stack Rules++Based on your preferences, always follow these rules:++${generateStackRules(config)}++---++## Contacts (Quick Reference)++${contactsList}++📚 Full contact directory: \`Contacts.md\`++---++## Response Format (Optional)++Define a consistent response format for task-based responses:++\`\`\`+📋 SUMMARY: [One sentence]+🔍 ANALYSIS: [Key findings]+⚡ ACTIONS: [Steps taken]+✅ RESULTS: [Outcomes]+➡️ NEXT: [Recommended next steps]+\`\`\`++Customize this format to match your preferences.++---++## Quick Reference++**Full documentation available in context files:**+- Contacts: \`Contacts.md\`+- Assets: \`AssetManagement.md\`+- Stack preferences: \`CoreStack.md\`+- Security protocols: \`SecurityProtocols.md\`+`;+}++function generateStackRules(config: WizardConfig): string {+ const rules: string[] = [];++ // Language preference+ if (config.preferredLanguages.length > 0) {+ rules.push(`- **Primary Language:** Use ${config.preferredLanguages[0]} for all new code unless explicitly requested otherwise`);+ if (config.preferredLanguages.includes("TypeScript") && config.preferredLanguages.includes("Python")) {+ rules.push(`- **TypeScript > Python:** Prefer TypeScript over Python when both would work`);+ }+ }++ // Package manager+ const wrongManagers = ["npm", "yarn", "pnpm"].filter(m => m !== config.packageManager);+ rules.push(`- **Package Manager:** Use ${config.packageManager} (NEVER ${wrongManagers.join("/")})`);++ // Runtime+ rules.push(`- **Runtime:** Use ${config.serverRuntime} as the default JavaScript runtime`);++ // Infrastructure+ if (config.usesCloudflare) {+ rules.push(`- **Deployment:** Default to Cloudflare Workers for serverless functions`);+ }+ rules.push(`- **Backend:** Prefer ${config.backendPreference} for backend infrastructure`);+ rules.push(`- **Database:** Default to ${config.databasePreference} for data storage`);++ // Markup+ rules.push(`- **Markdown:** Use markdown for all documentation. NEVER use HTML for basic content.`);++ return rules.join("\n");+}++function generateContactsMd(config: WizardConfig): string {+ const contactsTable = config.contacts.length > 0+ ? config.contacts.map(c => {+ const notes = c.pronunciation ? `Pronunciation: ${c.pronunciation}` : "";+ return `| ${c.name} | ${c.role} | ${c.email} | ${notes} |`;+ }).join("\n")+ : "| [Name] | [Role] | [[email protected]] | [Any notes] |";++ return `# Contact Directory++Quick reference for frequently contacted people.++---++## Contacts++| Name | Role | Email | Notes |+|------|------|-------|-------|+${contactsTable}++---++## Adding Contacts++To add a new contact:++1. Use the AddContact workflow: "Add [Name] as a contact"+2. Or manually edit this file following the table format++---++## Usage++When the user asks about someone:+1. Check this directory first+2. Return the relevant contact information+3. If not found, ask the user for details+`;+}++function generateCoreStackMd(config: WizardConfig): string {+ const languageTable = config.preferredLanguages.length > 0+ ? config.preferredLanguages.map((lang, i) => {+ let useCase = "General purpose";+ if (lang === "TypeScript") useCase = "Primary for all new code";+ if (lang === "Python") useCase = "Data science, ML, when required";+ if (lang === "Go") useCase = "Performance-critical services";+ if (lang === "Rust") useCase = "Systems programming, WASM";+ return `| ${i + 1} | ${lang} | ${useCase} |`;+ }).join("\n")+ : "| 1 | TypeScript | Primary for all new code |";++ return `# Core Stack Preferences++Technical preferences for code generation and tooling.++Generated from setup wizard: ${new Date().toISOString().split("T")[0]}++---++## Language Preferences++| Priority | Language | Use Case |+|----------|----------|----------|+${languageTable}++---++## Package Managers++| Language | Manager | Never Use |+|----------|---------|-----------|+| JavaScript/TypeScript | ${config.packageManager} | ${["npm", "yarn", "pnpm"].filter(m => m !== config.packageManager).join(", ")} |+| Python | uv | pip, pip3 |++---++## Runtime++| Purpose | Tool |+|---------|------|+| JavaScript Runtime | ${config.serverRuntime} |+| Serverless | ${config.usesCloudflare ? "Cloudflare Workers" : config.backendPreference} |++---++## Infrastructure++| Component | Preference |+|-----------|------------|+| Backend | ${config.backendPreference} |+| Database | ${config.databasePreference} |+| Cloudflare | ${config.usesCloudflare ? "Yes - use for Workers, Pages, R2, KV" : "No"} |++---++## Markup Preferences++| Format | Use | Never Use |+|--------|-----|-----------|+| Markdown | All content, docs, notes | HTML for basic content |+| YAML | Configuration, frontmatter | JSON for config files |+| JSON | API responses, data | YAML for data |++---++## File Naming++| Type | Convention | Example |+|------|------------|---------|+| Skill directories | TitleCase | \`Research\`, \`Art\` |+| Workflow files | TitleCase.md | \`Create.md\`, \`Update.md\` |+| Tool files | TitleCase.ts | \`Generate.ts\` |+| Config files | lowercase | \`settings.json\` |++---++## Code Style++- Prefer explicit over clever+- No unnecessary abstractions+- Comments only where logic isn't self-evident+- Error messages should be actionable+`;+}++// =============================================================================+// MAIN+// =============================================================================++async function main() {+ console.log(`+╔═══════════════════════════════════════════════════════════════════╗+║ ║+║ ██╗ ██╗ █████╗ ██╗ ██████╗ ██╗ ██╗███╗ ██╗██████╗ ██╗ ║+║ ██║ ██╔╝██╔══██╗██║ ██╔══██╗██║ ██║████╗ ██║██╔══██╗██║ ║+║ █████╔╝ ███████║██║ ██████╔╝██║ ██║██╔██╗ ██║██║ ██║██║ ║+║ ██╔═██╗ ██╔══██║██║ ██╔══██╗██║ ██║██║╚██╗██║██║ ██║██║ ║+║ ██║ ██╗██║ ██║██║ ██████╔╝╚██████╔╝██║ ╚████║██████╔╝███████╗+║ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═════╝ ╚══════╝+║ ║+║ Personal AI Infrastructure Installation Wizard ║+║ ║+╚═══════════════════════════════════════════════════════════════════╝+ `);++ try {+ // Phase 1: System Setup+ const systemConfig = await gatherSystemConfig();++ // Phase 2: Personalization+ const personalizationConfig = await gatherPersonalization();++ // Combine configs+ const config: WizardConfig = {+ ...systemConfig,+ ...personalizationConfig,+ };++ // Phase 3: Generate Files+ printHeader("PHASE 3: GENERATING CONFIGURATION");++ const paiDir = config.paiDir.replace("~", process.env.HOME || "~");++ // Create directory structure+ console.log("Creating directory structure...");+ await $`mkdir -p ${paiDir}/Skills/CORE/Workflows`;+ await $`mkdir -p ${paiDir}/Skills/CORE/Tools`;+ await $`mkdir -p ${paiDir}/History/{Sessions,Learnings,Research,Decisions}`;+ await $`mkdir -p ${paiDir}/hooks/lib`;+ await $`mkdir -p ${paiDir}/Tools`;+ await $`mkdir -p ${paiDir}/voice`;++ // Generate files+ console.log("Generating SKILL.md...");+ const skillMd = generateSkillMd(config);+ await Bun.write(`${paiDir}/Skills/CORE/SKILL.md`, skillMd);++ console.log("Generating Contacts.md...");+ const contactsMd = generateContactsMd(config);+ await Bun.write(`${paiDir}/Skills/CORE/Contacts.md`, contactsMd);++ console.log("Generating CoreStack.md...");+ const coreStackMd = generateCoreStackMd(config);+ await Bun.write(`${paiDir}/Skills/CORE/CoreStack.md`, coreStackMd);++ // Set environment variables+ console.log("\nSetting environment variables...");+ const envExports = `+# PAI Configuration (added by Kai Bundle installer)+export PAI_DIR="${config.paiDir}"+export DA="${config.daName}"+export TIME_ZONE="${config.timeZone}"+export PAI_SOURCE_APP="$DA"+${config.elevenLabsApiKey ? `export ELEVENLABS_API_KEY="${config.elevenLabsApiKey}"` : ""}+${config.elevenLabsVoiceId ? `export ELEVENLABS_VOICE_ID="${config.elevenLabsVoiceId}"` : ""}+`;++ const shellProfile = config.shellProfile.replace("~", process.env.HOME || "~");+ const existingProfile = await Bun.file(shellProfile).text().catch(() => "");+ if (!existingProfile.includes("PAI_DIR")) {+ await Bun.write(shellProfile, existingProfile + "\n" + envExports);+ console.log(`✓ Added environment variables to ${config.shellProfile}`);+ } else {+ console.log(`ℹ PAI environment variables already exist in ${config.shellProfile}`);+ }++ // Summary+ printHeader("INSTALLATION COMPLETE");++ console.log(`+Your Kai system is configured with:++ 📁 PAI Directory: ${config.paiDir}+ 🤖 Assistant Name: ${config.daName}+ 👤 User: ${config.userName} (${config.userProfession})+ 🎯 Purpose: ${config.primaryPurpose}+ 💻 Stack: ${config.preferredLanguages.join(", ")} + ${config.packageManager}+ 👥 Contacts: ${config.contacts.length} added++Next steps:++ 1. Reload your shell: source ${config.shellProfile}+ 2. Install the packs in order:+ - kai-hook-system+ - kai-history-system+ - kai-skill-system+ - kai-voice-system+ - kai-identity+ 3. Restart Claude Code to activate hooks++Files created:+ - ${paiDir}/Skills/CORE/SKILL.md+ - ${paiDir}/Skills/CORE/Contacts.md+ - ${paiDir}/Skills/CORE/CoreStack.md+`);++ } catch (error) {+ console.error("\n❌ Installation failed:", error);+ process.exit(1);+ } finally {+ rl.close();+ }+}++main();diff --git a/PAIBundleTemplate.md b/PAIBundleTemplate.mdindex 92bb94d9..55a2bfd8 100644--- a/PAIBundleTemplate.md+++ b/PAIBundleTemplate.md@@ -209,7 +209,7 @@ When fully installed, this bundle gives you:🚨 THIS SECTION IS CRITICAL - IT'S WHAT MAKES BUNDLES VALUABLE 🚨INSTRUCTIONS FOR AI: This is where you explain how the packs in this bundle-interact and build on each other. This is the "special sauce" that justifies+interact and build on each other. This is what makes them work together that justifiesthe bundle's existence over installing packs individually.Every bundle MUST explain:diff --git a/PAIPackTemplate.md b/PAIPackTemplate.mdindex a12cecac..b1f83558 100644--- a/PAIPackTemplate.md+++ b/PAIPackTemplate.md@@ -264,14 +264,14 @@ Don't include code here - that goes in Installation. Focus on helping the readerunderstand the approach conceptually before diving into implementation.-->-## Architecture: The Special Sauce+## What Makes This Different<!--(4096 words max)🚨 THIS SECTION IS CRITICAL - IT'S WHAT MAKES PACKS VALUABLE 🚨INSTRUCTIONS FOR AI: This is where you explain WHY this pack is architecturally-interesting and BETTER than a baseline AI installation. This is the "special sauce"+interesting and BETTER than a baseline AI installation. This is what makes it differentthat justifies the pack's existence.Every pack MUST explain its architectural innovation:diff --git a/Packs/icons/kai-observability-server-v2.png b/Packs/icons/kai-observability-server-v2.pngnew file mode 100644index 00000000..450267ecBinary files /dev/null and b/Packs/icons/kai-observability-server-v2.png differdiff --git a/Packs/icons/kai-observability-server.png b/Packs/icons/kai-observability-server.pngdeleted file mode 100644index 0f077f1f..00000000Binary files a/Packs/icons/kai-observability-server.png and /dev/null differdiff --git a/Packs/kai-history-system.md b/Packs/kai-history-system.mdindex 0f869d2f..fe0fd3df 100644--- a/Packs/kai-history-system.md+++ b/Packs/kai-history-system.md@@ -149,7 +149,7 @@ Documentation is a byproduct, not a task. By instrumenting the work itself, you----## Architecture: The Special Sauce+## What Makes This DifferentThe history system's power comes from its **automatic categorization pipeline** - a multi-layered architecture that captures, analyzes, and routes every piece of work to the right location without any manual intervention.diff --git a/Packs/kai-hook-system.md b/Packs/kai-hook-system.mdindex ea96982a..5d83a6dc 100644--- a/Packs/kai-hook-system.md+++ b/Packs/kai-hook-system.md@@ -120,7 +120,7 @@ Hooks are middleware for your AI. They sit between Claude Code's event system an----## Architecture: The Special Sauce+## What Makes This DifferentThe hook system's power comes from its **event-driven middleware pattern** - a layered architecture that intercepts, processes, and extends every AI operation without modifying Claude Code itself.diff --git a/Packs/kai-identity.md b/Packs/kai-identity.mdindex 9b802834..b4058352 100644--- a/Packs/kai-identity.md+++ b/Packs/kai-identity.md@@ -166,7 +166,7 @@ System prompts define behavior but lack structure. They're free-form text that v----## Architecture: The Special Sauce+## What Makes This DifferentThe Kai Identity Pack uses a **5-layer constitutional identity framework** that transforms generic AI behavior into consistent, personality-driven collaboration with voice integration:diff --git a/Packs/kai-observability-server.md b/Packs/kai-observability-server.mdindex 0a052afd..2be73f69 100644--- a/Packs/kai-observability-server.md+++ b/Packs/kai-observability-server.md@@ -12,7 +12,7 @@ keywords: [observability, dashboard, monitoring, agents, websocket, streaming, e---<p align="center">- <img src="icons/kai-observability-server.png" alt="Kai Observability Server" width="256">+ <img src="icons/kai-observability-server-v2.png" alt="Kai Observability Server" width="256"></p># Kai Observability Server (kai-observability-server)@@ -164,7 +164,7 @@ $PAI_DIR/----## Architecture: The Special Sauce+## What Makes This DifferentThe observability system's power comes from its **file-based streaming architecture** - a simple but effective pattern that separates event capture from event display.diff --git a/Packs/kai-voice-system.md b/Packs/kai-voice-system.mdindex ef960107..b1c5ae59 100644--- a/Packs/kai-voice-system.md+++ b/Packs/kai-voice-system.md@@ -144,7 +144,7 @@ Basic TTS reads everything literally—code blocks, markdown syntax, technical a----## Architecture: The Special Sauce+## What Makes This DifferentThe Kai Voice System uses a **5-layer prosody enhancement pipeline** that transforms raw AI text into natural speech with emotional intelligence and personality-driven delivery: