Skip to content

⛰️ LifeOS — The AI-powered Life Operating System that helps you hill climb to wherever you're going.

feat(kai-bundle): v2.0.0 - Simplified wizard with direct ~/.claude install

Daniel Miesslerf6fee4ead8ae
diff --git a/Bundles/Kai/README.md b/Bundles/Kai/README.md
index c2c0430f..c132b6bc 100644
--- a/Bundles/Kai/README.md
+++ b/Bundles/Kai/README.md
@@ -2,201 +2,67 @@
<img src="kai.png" alt="The Official PAI (Kai) Bundle" width="256">
</p>
-# The Official PAI (Kai) Bundle
+# The Official PAI (Kai) Bundle v2.0.0
-> **FOR AI AGENTS:** You are about to install the complete Kai bundle. Walk your principal through an interactive wizard to configure their system, then install each pack in order.
+> **FOR AI AGENTS:** You are about to install the complete Kai bundle. Run the wizard, then install each pack in order.
-## AI Installation Wizard
+## Quick Start
-The wizard has three 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
-3. **Phase 3: Generate Configuration Files** - Create all necessary config files
-
----
-
-### 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)
-3. **What's your timezone?** (e.g., America/Los_Angeles, Europe/London)
-
-**After gathering answers, create the .env file:**
```bash
-# Create PAI directory
-mkdir -p $PAI_DIR
-
-# Copy the example .env file
-cp ../../.env.example $PAI_DIR/.env
-
-# The .env file should contain:
-DA="[their AI name]"
-TIME_ZONE="[their timezone]"
+# Run the installation wizard
+bun run install.ts
```
-**Note:** API keys (ElevenLabs, Replicate, etc.) are added to `.env` later when installing packs that need them. See the [Authentication](#authentication) section for details.
-
----
-
-### 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.**
-
----
-
-## What Are Packs and Bundles?
-
-**Packs** are collections of functionality organized around a single theme or capability. Each pack is a complete system in itself—not a single ingredient, but a whole subsystem. For example, the `kai-hook-system` pack provides an entire event-driven automation framework with multiple hooks, libraries, and configuration.
-
-**Bundles** are curated combinations of packs that work exceptionally well together—a harmonious system from a single author or unified around a single theme. A bundle isn't just "these packs exist," it's "these packs were designed to integrate seamlessly, and installing them together creates something greater than the sum of its parts."
-
-| Concept | What It Is | Example |
-|---------|-----------|---------|
-| **Pack** | Complete functionality around one theme | kai-hook-system (entire event system) |
-| **Bundle** | Harmonious combination of packs | Kai Bundle (4 packs that form a complete AI infrastructure) |
-
----
-
-## About This Bundle
-
-This is *a highly opinionated* bundle of PAI Packs that gets near feature parity to my (Daniel's) own, active Kai system I use every day, and that started the project. I have replicated most of the functionality of my system into individual Packs, which are all contained within this bundle.
+The wizard will:
+1. **Create a backup** of your existing `~/.claude` directory to `~/.claude-BACKUP`
+2. **Ask a few questions** (your name, AI name, timezone, voice preference)
+3. **Install directly to `~/.claude`** - the standard Claude Code location
+4. **Configure environment variables** automatically
-## Why This Is Different
-
-This sounds similar to custom ChatGPT configurations or AI assistant presets, which also enhance AI capabilities. What makes this approach different?
-
-Custom configurations are static and monolithic—everything loads every time. The Kai Bundle is a modular, layered system where each Pack builds on the previous, creating emergent capabilities through composition. Hook events trigger history capture which feeds skill context which drives voice output. Each layer works independently, but together they create an AI infrastructure that feels like a production system, not a chatbot with extra prompts.
-
-- Modular composition creates emergent capabilities through layering
-- Each Pack works independently but integrates seamlessly
-- Event-driven architecture enables real-time intelligent automation
-- Production infrastructure patterns not chatbot configuration hacks
+That's it. No need to open another terminal or manually source files.
---
## What This Bundle Provides
-When fully installed, the Kai bundle gives you a number of features that elevate Claude Code, or whatever underlying system you are using, with fundamental enhancements that make everything about your AI experience better:
+When fully installed, the Kai bundle gives you:
-- A custom **History system** - Automatically captures sessions, decisions, learnings, and research so your AI never forgets important context
+- A custom **History system** - Automatically captures sessions, decisions, learnings, and research
- A custom set of **Hooks** - Event-driven automation that triggers on session start, tool use, and task completion
-- A custom **Skill system** - Modular capabilities that route based on intent, with dynamic loading to minimize context usage
-- A custom **Voice notification system** - Spoken updates via ElevenLabs when tasks complete, with prosody enhancement for natural speech
-- A custom **Agent swarm creation system** - Spawn parallel agents for concurrent work, with personality templates and voice assignments
-- A custom **Security control system** - Protection against prompt injection, dangerous operations, and accidental exposure of sensitive data
-- And many more
+- A custom **Skill system** - Modular capabilities that route based on intent
+- A custom **Voice notification system** - Spoken updates via ElevenLabs when tasks complete (optional)
+- A custom **Agent swarm creation system** - Spawn parallel agents with personality templates
+- A custom **Security control system** - Protection against prompt injection and dangerous operations
---
## Installation Order (CRITICAL)
-**Install Packs in this exact order** - each depends on the previous:
+**After running the wizard, install these packs IN ORDER:**
| # | Pack | Purpose | Dependencies |
|---|------|---------|--------------|
| 1 | [kai-hook-system](../../Packs/kai-hook-system.md) | Event-driven automation | None |
| 2 | [kai-history-system](../../Packs/kai-history-system.md) | Memory and capture | Hooks |
| 3 | [kai-core-install](../../Packs/kai-core-install.md) | Skills + Identity + Architecture | Hooks, History |
-| 4 | [kai-voice-system](../../Packs/kai-voice-system.md) | Voice notifications | Hooks, Core |
+| 4 | [kai-voice-system](../../Packs/kai-voice-system.md) | Voice notifications (optional) | Hooks, Core |
-### Why Order Matters
+### How to Install Packs
-- **Hooks** are the foundation - they enable all event-driven automation
-- **History** uses hooks to capture events and context
-- **Core Install** provides skill routing, identity framework, and architecture tracking (combines former skill-system and identity packs)
-- **Voice** uses hooks for completion events and integrates with the response format from Core
+Give each pack file to your AI and ask it to install:
-### Pack Availability
+```
+"Install kai-hook-system pack"
+```
-| Pack | Status |
-|------|--------|
-| kai-hook-system | **Available** |
-| kai-history-system | **Available** |
-| kai-core-install | **Available** (NEW - replaces kai-skill-system + kai-identity) |
-| kai-voice-system | **Available** |
+The AI will read the pack and follow the installation instructions inside.
-*All Packs are now available. Install in order to get the complete Kai experience.*
+### Why Order Matters
-> **Note:** `kai-skill-system` and `kai-identity` have been merged into `kai-core-install` as of v1.0.0. The old packs are deprecated.
+- **Hooks** are the foundation - they enable all event-driven automation
+- **History** uses hooks to capture events and context
+- **Core Install** provides skill routing and identity framework
+- **Voice** uses hooks for completion events (requires ElevenLabs API key)
---
@@ -207,52 +73,20 @@ When fully installed, the Kai bundle gives you a number of features that elevate
---
-## Authentication
-
-**All API keys live in ONE place: `$PAI_DIR/.env`**
-
-This is a core principle of PAI: no keys stored anywhere else in the system. Every pack reads from this single file.
-
-### Setup
-
-```bash
-# 1. Copy the example file to your PAI directory
-cp ../../.env.example $PAI_DIR/.env
-
-# 2. Edit and add your API keys
-nano $PAI_DIR/.env
-
-# 3. Uncomment and fill in the keys you need
-```
-
-### Which Packs Need Keys?
-
-Most packs require **no API keys** - only packs that integrate with external services need them. Each pack documents its specific requirements in its installation section.
-
-### Security Rules
-
-1. **NEVER commit `.env` files to git**
-2. **NEVER store API keys in pack files, configs, or code**
-3. **ALL authentication flows through `$PAI_DIR/.env`**
-
-See [.env.example](../../.env.example) for the complete template.
-
----
-
## Verification
-After installing all packs, verify the bundle:
+After installing all packs:
```bash
-# Check complete directory structure
-ls -la $PAI_DIR/
+# Check directory structure
+ls -la ~/.claude/
# Expected directories:
# hooks/ - Event-driven automation
# History/ - Sessions, Learnings, Research, Decisions
# Skills/ - CORE and other skills
# Tools/ - CLI utilities
-# voice/ - Voice server files
+# voice/ - Voice server files (if installed)
# Check hooks are registered
cat ~/.claude/settings.json | grep -A 5 "hooks"
@@ -262,6 +96,28 @@ cat ~/.claude/settings.json | grep -A 5 "hooks"
---
+## Restoring from Backup
+
+If something goes wrong:
+
+```bash
+# Remove the new installation
+rm -rf ~/.claude
+
+# Restore from backup
+mv ~/.claude-BACKUP ~/.claude
+```
+
+---
+
+## What Are Packs and Bundles?
+
+**Packs** are complete subsystems organized around a single capability. For example, `kai-hook-system` provides an entire event-driven automation framework.
+
+**Bundles** are curated combinations of packs designed to work together. The Kai Bundle is 4 packs that form a complete AI infrastructure.
+
+---
+
## The 14 Founding Principles
The Kai system embeds these principles from [PAI](https://danielmiessler.com/blog/personal-ai-infrastructure):
@@ -283,6 +139,21 @@ The Kai system embeds these principles from [PAI](https://danielmiessler.com/blo
---
+## Changelog
+
+### 2.0.0 - 2025-12-30
+- **BREAKING**: Now installs directly to `~/.claude` instead of configurable `$PAI_DIR`
+- **NEW**: Automatic backup to `~/.claude-BACKUP` before installation
+- **NEW**: Environment variables set automatically (no manual shell sourcing needed)
+- **SIMPLIFIED**: Removed personality calibration questions - just name, timezone, voice
+- **SIMPLIFIED**: Removed technical preference questions - use sensible defaults
+- **SIMPLIFIED**: Removed "open another terminal" instructions
+
+### 1.0.0 - 2025-12-29
+- Initial release with full wizard
+
+---
+
## Credits
**Author:** Daniel Miessler
diff --git a/Bundles/Kai/install.ts b/Bundles/Kai/install.ts
index a34c4abe..8db4f326 100644
--- a/Bundles/Kai/install.ts
+++ b/Bundles/Kai/install.ts
@@ -1,69 +1,29 @@
#!/usr/bin/env bun
/**
- * Kai Bundle Installation Wizard
+ * Kai Bundle Installation Wizard v2.0.0
*
- * Interactive CLI wizard for setting up the complete Kai bundle
- * with full identity and personalization configuration.
+ * Simplified interactive CLI wizard for setting up the Kai bundle.
+ * Installs directly to ~/.claude with automatic backup.
*
* Usage: bun run install.ts
*/
import { $ } from "bun";
import * as readline from "readline";
+import { existsSync } from "fs";
// =============================================================================
// TYPES
// =============================================================================
-interface SystemConfig {
- paiDir: string;
+interface WizardConfig {
daName: string;
timeZone: string;
+ userName: 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
// =============================================================================
@@ -93,91 +53,57 @@ async function askYesNo(question: string, defaultYes = true): Promise<boolean> {
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}`);
- }
+function printHeader(title: string) {
+ console.log("\n" + "=".repeat(60));
+ console.log(` ${title}`);
+ console.log("=".repeat(60) + "\n");
}
-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];
- }
+// =============================================================================
+// BACKUP
+// =============================================================================
- const match = options.find(o => o.toLowerCase() === answer.toLowerCase());
- if (match) return match;
+async function createBackup(): Promise<boolean> {
+ const claudeDir = `${process.env.HOME}/.claude`;
+ const backupDir = `${process.env.HOME}/.claude-BACKUP`;
- console.log("Invalid choice, please try again.");
+ if (!existsSync(claudeDir)) {
+ console.log("No existing ~/.claude directory found. Fresh install.");
+ return true;
}
-}
-
-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}`);
- }
- }
+ if (existsSync(backupDir)) {
+ console.log(`\nExisting backup found at ${backupDir}`);
+ const overwrite = await askYesNo("Overwrite existing backup?", false);
+ if (!overwrite) {
+ console.log("Please manually remove or rename the existing backup first.");
+ return false;
}
+ await $`rm -rf ${backupDir}`;
}
- 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");
+ console.log(`\nBacking up ~/.claude to ~/.claude-BACKUP...`);
+ await $`cp -r ${claudeDir} ${backupDir}`;
+ console.log("Backup complete.");
+ return true;
}
// =============================================================================
-// WIZARD PHASES
+// MAIN WIZARD
// =============================================================================
-async function gatherSystemConfig(): Promise<SystemConfig> {
- printHeader("PHASE 1: SYSTEM SETUP");
+async function gatherConfig(): Promise<WizardConfig> {
+ printHeader("KAI BUNDLE SETUP");
- const paiDir = await askWithDefault(
- "Where should PAI be installed?",
- "~/.config/pai"
- );
+ console.log("This wizard will configure your AI assistant.\n");
+ console.log("Installation directory: ~/.claude (standard Claude Code location)\n");
+
+ // Essential questions only
+ const userName = await ask("What is your name? ");
const daName = await askWithDefault(
"What would you like to name your AI assistant?",
- "PAI"
+ "Kai"
);
const timeZone = await askWithDefault(
@@ -185,7 +111,8 @@ async function gatherSystemConfig(): Promise<SystemConfig> {
Intl.DateTimeFormat().resolvedOptions().timeZone
);
- const wantsVoice = await askYesNo("Do you want voice notifications (requires ElevenLabs)?", false);
+ // Voice is optional
+ const wantsVoice = await askYesNo("\nDo you want voice notifications? (requires ElevenLabs API key)", false);
let elevenLabsApiKey: string | undefined;
let elevenLabsVoiceId: string | undefined;
@@ -198,256 +125,20 @@ async function gatherSystemConfig(): Promise<SystemConfig> {
);
}
- // Detect shell profile
- const shell = process.env.SHELL || "/bin/zsh";
- const shellProfile = shell.includes("zsh") ? "~/.zshrc" : "~/.bashrc";
-
return {
- paiDir,
daName,
timeZone,
+ userName,
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.
@@ -457,25 +148,6 @@ description: Personal AI Infrastructure core. AUTO-LOADS at session start. USE W
**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:**
@@ -485,35 +157,6 @@ User: "What's ${config.contacts[0]?.name || 'Alex'}'s email?"
**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"} |
---
@@ -532,39 +175,14 @@ Your AI should speak as itself, not about itself in third person.
---
-## Technical Stack Preferences
-
-**Technical Level:** ${config.technicalLevel}
-**Programmer:** ${config.isProgrammer}
-
-**Platform:**
-- OS: ${config.primaryOS}
-- Runtime: ${config.serverRuntime}
-- Package Manager: ${config.packageManager}
+## Stack Preferences
-**Languages (in order of preference):**
-${languageList}
+Default preferences (customize in CoreStack.md):
-**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\`
+- **Language:** TypeScript preferred over Python
+- **Package Manager:** bun (NEVER npm/yarn/pnpm)
+- **Runtime:** Bun
+- **Markup:** Markdown (NEVER HTML for basic content)
---
@@ -580,7 +198,7 @@ Define a consistent response format for task-based responses:
➡️ NEXT: [Recommended next steps]
\`\`\`
-Customize this format to match your preferences.
+Customize this format in SKILL.md to match your preferences.
---
@@ -588,51 +206,12 @@ Customize this format to match your preferences.
**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.
@@ -643,45 +222,31 @@ Quick reference for frequently contacted people.
| Name | Role | Email | Notes |
|------|------|-------|-------|
-${contactsTable}
+| [Add contacts here] | [Role] | [email] | [Notes] |
---
## 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
+To add a new contact, edit this file following the table format above.
---
## Usage
-When the user asks about someone:
+When asked about someone:
1. Check this directory first
2. Return the relevant contact information
-3. If not found, ask the user for details
+3. If not found, ask 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]}
+Generated: ${new Date().toISOString().split("T")[0]}
---
@@ -689,7 +254,8 @@ Generated from setup wizard: ${new Date().toISOString().split("T")[0]}
| Priority | Language | Use Case |
|----------|----------|----------|
-${languageTable}
+| 1 | TypeScript | Primary for all new code |
+| 2 | Python | Data science, ML, when required |
---
@@ -697,7 +263,7 @@ ${languageTable}
| Language | Manager | Never Use |
|----------|---------|-----------|
-| JavaScript/TypeScript | ${config.packageManager} | ${["npm", "yarn", "pnpm"].filter(m => m !== config.packageManager).join(", ")} |
+| JavaScript/TypeScript | bun | npm, yarn, pnpm |
| Python | uv | pip, pip3 |
---
@@ -706,18 +272,8 @@ ${languageTable}
| 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"} |
+| JavaScript Runtime | Bun |
+| Serverless | Cloudflare Workers |
---
@@ -726,19 +282,8 @@ ${languageTable}
| 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\` |
+| YAML | Configuration, frontmatter | - |
+| JSON | API responses, data | - |
---
@@ -766,56 +311,72 @@ async function main() {
║ ██║ ██╗██║ ██║██║ ██████╔╝╚██████╔╝██║ ╚████║██████╔╝███████╗
║ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═════╝ ╚══════╝
║ ║
-║ Personal AI Infrastructure Installation Wizard ║
+║ Personal AI Infrastructure - v2.0.0 ║
║ ║
╚═══════════════════════════════════════════════════════════════════╝
`);
try {
- // Phase 1: System Setup
- const systemConfig = await gatherSystemConfig();
-
- // Phase 2: Personalization
- const personalizationConfig = await gatherPersonalization();
+ // Step 1: Create backup
+ printHeader("STEP 1: BACKUP");
+ const backupOk = await createBackup();
+ if (!backupOk) {
+ console.log("\nInstallation cancelled.");
+ process.exit(1);
+ }
- // Combine configs
- const config: WizardConfig = {
- ...systemConfig,
- ...personalizationConfig,
- };
+ // Step 2: Gather configuration
+ printHeader("STEP 2: CONFIGURATION");
+ const config = await gatherConfig();
- // Phase 3: Generate Files
- printHeader("PHASE 3: GENERATING CONFIGURATION");
+ // Step 3: Install
+ printHeader("STEP 3: INSTALLATION");
- const paiDir = config.paiDir.replace("~", process.env.HOME || "~");
+ const claudeDir = `${process.env.HOME}/.claude`;
// 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`;
+ await $`mkdir -p ${claudeDir}/Skills/CORE/Workflows`;
+ await $`mkdir -p ${claudeDir}/Skills/CORE/Tools`;
+ await $`mkdir -p ${claudeDir}/History/{Sessions,Learnings,Research,Decisions}`;
+ await $`mkdir -p ${claudeDir}/hooks/lib`;
+ await $`mkdir -p ${claudeDir}/Tools`;
+ await $`mkdir -p ${claudeDir}/voice`;
// Generate files
console.log("Generating SKILL.md...");
const skillMd = generateSkillMd(config);
- await Bun.write(`${paiDir}/Skills/CORE/SKILL.md`, skillMd);
+ await Bun.write(`${claudeDir}/Skills/CORE/SKILL.md`, skillMd);
console.log("Generating Contacts.md...");
const contactsMd = generateContactsMd(config);
- await Bun.write(`${paiDir}/Skills/CORE/Contacts.md`, contactsMd);
+ await Bun.write(`${claudeDir}/Skills/CORE/Contacts.md`, contactsMd);
console.log("Generating CoreStack.md...");
const coreStackMd = generateCoreStackMd(config);
- await Bun.write(`${paiDir}/Skills/CORE/CoreStack.md`, coreStackMd);
+ await Bun.write(`${claudeDir}/Skills/CORE/CoreStack.md`, coreStackMd);
+
+ // Create .env file
+ console.log("Creating .env file...");
+ const envFileContent = `# PAI Environment Configuration
+# Created by Kai Bundle installer - ${new Date().toISOString().split("T")[0]}
+
+DA="${config.daName}"
+TIME_ZONE="${config.timeZone}"
+${config.elevenLabsApiKey ? `ELEVENLABS_API_KEY="${config.elevenLabsApiKey}"` : "# ELEVENLABS_API_KEY="}
+${config.elevenLabsVoiceId ? `ELEVENLABS_VOICE_ID="${config.elevenLabsVoiceId}"` : "# ELEVENLABS_VOICE_ID="}
+`;
+ await Bun.write(`${claudeDir}/.env`, envFileContent);
+
+ // Add to shell profile
+ console.log("Updating shell profile...");
+ const shell = process.env.SHELL || "/bin/zsh";
+ const shellProfile = shell.includes("zsh")
+ ? `${process.env.HOME}/.zshrc`
+ : `${process.env.HOME}/.bashrc`;
- // 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"
@@ -823,69 +384,58 @@ ${config.elevenLabsApiKey ? `export ELEVENLABS_API_KEY="${config.elevenLabsApiKe
${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")) {
+ if (!existingProfile.includes("PAI Configuration")) {
await Bun.write(shellProfile, existingProfile + "\n" + envExports);
- console.log(`✓ Added environment variables to ${config.shellProfile}`);
+ console.log(`Added environment variables to ${shellProfile}`);
} else {
- console.log(`ℹ PAI environment variables already exist in ${config.shellProfile}`);
+ console.log(`PAI environment variables already exist in ${shellProfile}`);
}
- // Also create .env file for packs to read (fixes #260)
- console.log("Creating .env file for pack compatibility...");
- const envFileContent = `# PAI Environment Configuration
-# Created by Kai Bundle installer - ${new Date().toISOString().split("T")[0]}
-# This file is read by packs during installation
-
-DA="${config.daName}"
-PAI_DIR="${config.paiDir}"
-TIME_ZONE="${config.timeZone}"
-${config.elevenLabsApiKey ? `ELEVENLABS_API_KEY="${config.elevenLabsApiKey}"` : "# ELEVENLABS_API_KEY="}
-${config.elevenLabsVoiceId ? `ELEVENLABS_VOICE_ID="${config.elevenLabsVoiceId}"` : "# ELEVENLABS_VOICE_ID="}
-`;
- await Bun.write(`${paiDir}/.env`, envFileContent);
- console.log(`✓ Created ${config.paiDir}/.env`);
-
- // Export to current process for immediate use
- process.env.PAI_DIR = config.paiDir;
- process.env.DA = config.daName;
- process.env.TIME_ZONE = config.timeZone;
- if (config.elevenLabsApiKey) process.env.ELEVENLABS_API_KEY = config.elevenLabsApiKey;
- if (config.elevenLabsVoiceId) process.env.ELEVENLABS_VOICE_ID = config.elevenLabsVoiceId;
+ // Source the shell profile to make variables available
+ console.log("Sourcing shell profile...");
+ try {
+ // Export to current process
+ process.env.DA = config.daName;
+ process.env.TIME_ZONE = config.timeZone;
+ process.env.PAI_SOURCE_APP = config.daName;
+ if (config.elevenLabsApiKey) process.env.ELEVENLABS_API_KEY = config.elevenLabsApiKey;
+ if (config.elevenLabsVoiceId) process.env.ELEVENLABS_VOICE_ID = config.elevenLabsVoiceId;
+ console.log("Environment variables set for current session.");
+ } catch (e) {
+ // Silently continue - environment is exported to file
+ }
// Summary
printHeader("INSTALLATION COMPLETE");
console.log(`
-Your Kai system is configured with:
+Your Kai system is configured:
- 📁 PAI Directory: ${config.paiDir}
+ 📁 Installation: ~/.claude
+ 💾 Backup: ~/.claude-BACKUP
🤖 Assistant Name: ${config.daName}
- 👤 User: ${config.userName} (${config.userProfession})
- 🎯 Purpose: ${config.primaryPurpose}
- 💻 Stack: ${config.preferredLanguages.join(", ")} + ${config.packageManager}
- 👥 Contacts: ${config.contacts.length} added
+ 👤 User: ${config.userName}
+ 🌍 Timezone: ${config.timeZone}
+ 🔊 Voice: ${config.elevenLabsApiKey ? "Enabled" : "Disabled"}
-Next steps:
-
- 1. Reload your shell: source ${config.shellProfile}
+Files created:
+ - ~/.claude/Skills/CORE/SKILL.md
+ - ~/.claude/Skills/CORE/Contacts.md
+ - ~/.claude/Skills/CORE/CoreStack.md
+ - ~/.claude/.env
- 2. Install the packs in order by asking your AI:
- - "Install kai-hook-system pack"
- - "Install kai-history-system pack"
- - "Install kai-core-install pack"
- - "Install kai-voice-system pack"
+Next steps:
- Each pack is a markdown file in Packs/. Give it to your AI
- and ask it to install - it contains all instructions.
+ 1. Install the packs IN ORDER by giving each pack file to your AI:
+ - kai-hook-system.md
+ - kai-history-system.md
+ - kai-core-install.md
+ - kai-voice-system.md (optional, requires ElevenLabs)
- 3. Restart Claude Code to activate hooks
+ 2. Restart Claude Code to activate hooks
-Files created:
- - ${paiDir}/Skills/CORE/SKILL.md
- - ${paiDir}/Skills/CORE/Contacts.md
- - ${paiDir}/Skills/CORE/CoreStack.md
+Your backup is at ~/.claude-BACKUP if you need to restore.
`);
} catch (error) {