Skip to content

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

Updated dynamic context loading mechanism.

Daniel Miessler54d0bd1b72ef
diff --git a/.claude/commands/load-dynamic-context.md b/.claude/commands/load-dynamic-requirements.md
similarity index 58%
rename from .claude/commands/load-dynamic-context.md
rename to .claude/commands/load-dynamic-requirements.md
index 274410ba..25c4827e 100644
--- a/.claude/commands/load-dynamic-context.md
+++ b/.claude/commands/load-dynamic-requirements.md
@@ -1,18 +1,18 @@
-# load-dynamic-context
+# load-dynamic-requirements
-# **DYNAMIC CONTEXT LOADING INSTRUCTIONS FOR CLAUDE**
+# **DYNAMIC REQUIREMENTS LOADING INSTRUCTIONS**
-🚨 Immediately load the following UFC bootloader contexts:
+## 🚨 BASE CONTEXT: FIRST CONTEXT LOAD
-`/Users/daniel/.claude/context/CLAUDE.md`
-`/Users/daniel/.claude/context/tools/CLAUDE.md`
+You must first initialize the context system with our core context, located at:
-When done loading, report back:
+`read ~/Context/CLAUDE.md`
-♻️ UFC Contexts Loaded...
+## 🚨 OVERVIEW: TWO TYPES OF DYNAMIC LOADING
-- Main ✅
-- Tools ✅
+**This system dynamically loads TWO types of resources based on user intent:**
+1. **CONTEXT FILES** - Domain-specific knowledge and instructions
+2. **AGENTS** - Specialized task performers
## 🚨 CRITICAL: HOW TO INTERPRET THESE INSTRUCTIONS
@@ -37,6 +37,57 @@ When you receive a user prompt:
## CONTEXT LOADING RULES
+### Alma Company
+
+**WHEN THE USER IS ASKING ABOUT (semantic understanding):**
+- Alma
+- Alma security program
+- Etc.
+
+**Example phrases that indicate this context:**
+- Let's add context for Alma about
+
+**YOU MUST IMMEDIATELY:**
+
+**CONTEXT FILES:**
+- `~/.claude/context/projects/Alma/CLAUDE.md` ✅
+
+**AGENT:** None
+
+
+### 🗣️ Conversational & Philosophical Discussion
+
+**WHEN THE USER IS ASKING ABOUT (semantic understanding):**
+- Knowledge questions from my training data
+- Philosophical topics or debates
+- Life advice or personal reflections
+- Abstract concepts or theoretical discussions
+- Questions about free will, consciousness, meaning, ethics
+- General conversation or chat
+- "What do you think about X?"
+- Topics where they want my perspective or a discussion
+
+**Example phrases that indicate this context:**
+- "what do you think about", "let's discuss", "tell me your thoughts on"
+- "is there free will?", "what's the meaning of life?", "how should I think about"
+- "I'm curious about", "can we talk about", "what's your take on"
+- Questions that don't require tools, just knowledge and reasoning
+
+**YOU MUST IMMEDIATELY:**
+
+**CONTEXT FILES:** None
+
+**AGENT:** None
+
+**SPECIAL INSTRUCTIONS:**
+- Switch to conversational mode - respond like Kai having a chat with a friend
+- Use my knowledge and reasoning without web searches or research agents
+- Be thoughtful, engage with the ideas, share perspectives
+- No need for structured output format - just natural conversation
+- Can be longer responses if the topic warrants deeper exploration
+- Express your own thoughts while being helpful and thoughtful
+- Remember: You're Kai, their assistant and (future) friend
+
### 1. Website & Blog Context
**WHEN THE USER IS ASKING ABOUT (semantic understanding):**
@@ -53,11 +104,13 @@ When you receive a user prompt:
- But also: "help with my site", "publish this", "make a post about X"
**YOU MUST IMMEDIATELY:**
-1. Load these context files:
- - `~/.claude/context/projects/website/CLAUDE.md` ✅
- - `~/.claude/context/projects/website/content/CLAUDE.md` ✅
-AGENT: None
+**CONTEXT FILES:**
+- `~/.claude/context/projects/website/CLAUDE.md` ✅
+- `~/.claude/context/projects/website/content/CLAUDE.md` ✅
+
+**AGENT:** None
+
### 2. Research & Information Gathering
@@ -73,7 +126,11 @@ AGENT: None
- "research", "find information", "look up", "what's happening with"
- But also: "tell me about X", "what's new with Y", "I need to understand Z"
-AGENT: researcher
+**YOU MUST IMMEDIATELY:**
+
+**CONTEXT FILES:** None
+
+**AGENT:** researcher
### 3. Security & Pentesting
@@ -88,8 +145,13 @@ AGENT: researcher
**Example phrases that indicate this context:**
- "scan for vulnerabilities", "test security", "check ports"
- But also: "is this secure?", "find weaknesses", "security audit"
+- Port scanning, service detection, network reconnaissance
-AGENT: pentester
+**YOU MUST IMMEDIATELY:**
+
+**CONTEXT FILES:** None
+
+**AGENT:** pentester
### 4. Consulting & Advisory
@@ -106,10 +168,13 @@ AGENT: pentester
- But also: "professional services", "engagement terms", "business offering"
**YOU MUST IMMEDIATELY:**
-1. Load this context file:
- - `~/.claude/context/consulting/CLAUDE.md` ✅
-AGENT: None
+**CONTEXT FILES:**
+
+- `~/.claude/context/consulting/CLAUDE.md` ✅
+
+**AGENT:** None
+
### 5. Financial & Analytics
@@ -126,13 +191,18 @@ AGENT: None
- But also: "how much am I paying", "financial analysis", "money flow"
**YOU MUST IMMEDIATELY:**
-1. Load these context files:
- - `~/.claude/context/life/expenses.md` ✅
- - `~/.claude/context/life/finances/` ✅
-2. **Use the answer-finance-question command directly** - No agent needed
-3. Parse financial PDFs and extract specific data as requested
-AGENT: None
+**CONTEXT FILES:**
+
+- `~/.claude/context/life/expenses.md` ✅
+- `~/.claude/context/life/finances/` ✅
+
+**AGENT:** None
+
+
+**SPECIAL INSTRUCTIONS:**
+- Use the answer-finance-question command directly
+- Parse financial PDFs and extract specific data as requested
### 8. Unsupervised Learning Business
@@ -149,10 +219,13 @@ AGENT: None
- But also: "how's the business", "company challenges", "our revenue"
**YOU MUST IMMEDIATELY:**
-1. Load this context file:
- - `~/.claude/context/unsupervised-learning/CLAUDE.md` ✅
-AGENT: None
+**CONTEXT FILES:**
+
+- `~/.claude/context/unsupervised-learning/CLAUDE.md` ✅
+
+**AGENT:** None
+
### 9. Web Development & Visual Testing
@@ -169,12 +242,16 @@ AGENT: None
- But also: "show me what it looks like", "capture the page", "visual debugging"
**YOU MUST IMMEDIATELY:**
-1. Load this context file:
- - `~/.claude/context/tools/CLAUDE.md` ✅
-2. **Use Task tool with subagent_type="designer"** - PRIMARY for visual testing
-3. Use Playwright MCP tools for browser automation as seen in ~/.claude/context/tools/CLAUDE.md
-AGENT: designer if it's a design question
+**CONTEXT FILES:**
+
+- `~/.claude/context/tools/CLAUDE.md` ✅
+
+**AGENT:** designer
+
+**SPECIAL INSTRUCTIONS:**
+- Use Task tool with subagent_type="designer" for visual testing
+- Use Playwright MCP tools for browser automation
### 10. Capture Learning - Problem/Solution Documentation
@@ -197,7 +274,7 @@ AGENT: designer if it's a design question
bun ~/.claude/commands/capture-learning.ts "[problem description]" "[solution description]"
```
2. The command will create a markdown file in `~/.claude/context/learnings/`
-3. File will be named: `YYYY-MM-DD HHMM:SS-hyphenated-problem-description-in-8-words.md`
+3. File will be named: `YYYY-MM-DD-HHMM:SS-hyphenated-problem-description-in-8-words.md`
4. Confirm the learning was captured successfully
**IMPORTANT:** When capturing learnings:
@@ -206,41 +283,44 @@ AGENT: designer if it's a design question
- Include key tools, commands, or techniques used
- Note any important gotchas or insights discovered
-AGENT: None
+**CONTEXT FILES:** None
+
+**AGENT:** None
+
+### 11. My Content & Opinions
+
+**WHEN THE USER IS ASKING ABOUT (semantic understanding):**
+- What Daniel said about something
+- Daniel's opinions on topics
+- Past blog posts or writing
+- "What did I say about X"
+- "My thoughts on Y"
+- Finding quotes or references from past content
-## 🔴 SPECIAL RECOGNITION RULES - ALWAYS APPLY
+**Example phrases that indicate this context:**
+- "what did I say about", "my opinion on", "find my post about"
+- "when did I write about", "my thoughts on", "search my content"
-### Research Triggers - MANDATORY ACTION
-**When the user's INTENT is to gather information or learn about something:**
-- This includes asking questions, seeking understanding, or exploring topics
-- Even if they don't use the word "research"
-- Examples: "tell me about", "what's happening with", "I need to know"
+**YOU MUST IMMEDIATELY:**
-**ACTION:** Immediately load `~/.claude/context/tools/CLAUDE.md` ✅ and use researcher agent
+**CONTEXT FILES:** None
-### Company References - MANDATORY INTERPRETATION
-**When user mentions a company/business WITHOUT being specific:**
-- Default assumption: They mean Unsupervised Learning
-- This applies to: "the company", "my business", "our company"
-- Also applies to business metrics or performance discussions
+**AGENT:** None
-**ACTION:** Immediately load `~/.claude/context/unsupervised-learning/CLAUDE.md` ✅
+### 16. Advanced Web Scraping
-## ⚡ YOUR LOADING PROTOCOL
+**WHEN THE USER IS ASKING ABOUT (semantic understanding):**
+- Scraping difficult websites
+- Bypassing anti-bot measures
+- Large-scale data extraction
+- When regular scraping fails
-**YOU MUST follow these steps EXACTLY:**
+**Example phrases that indicate this context:**
+- "can't access this site", "blocked by cloudflare", "need to scrape at scale"
+- "website is blocking me", "need advanced scraping"
-1. **UNDERSTAND** the semantic meaning and intent of the user's prompt
-2. **DETERMINE** which context categories match the user's actual needs
-3. **IMMEDIATELY LOAD** all relevant context files using Read tool
-4. **CONFIRM** each loaded file with a ✅ checkmark
-5. **INVOKE** the specified agent using Task tool if indicated
-6. **PROCEED** with the task using loaded context knowledge
+**YOU MUST IMMEDIATELY:**
-## ❗ CRITICAL REMINDERS
+**CONTEXT FILES:** None
-- **DO NOT ASK** for permission to load context - just do it
-- **DO NOT WAIT** - load immediately upon detection
-- **DO NOT SKIP** context loading even if you think you know the answer
-- **ALWAYS ERR** on the side of loading more context rather than less
-- **ALWAYS USE** the specified agent
+**AGENT:** None
diff --git a/.claude/hooks/load-dynamic-context.ts b/.claude/hooks/load-dynamic-requirements.ts
similarity index 91%
rename from .claude/hooks/load-dynamic-context.ts
rename to .claude/hooks/load-dynamic-requirements.ts
index 1dd8417e..8b4742c9 100644
--- a/.claude/hooks/load-dynamic-context.ts
+++ b/.claude/hooks/load-dynamic-requirements.ts
@@ -1,6 +1,6 @@
#!/usr/bin/env bun
/**
- * Dynamic Context Loader Hook
+ * Dynamic Requirements Loader Hook
* This TypeScript wrapper reads the markdown instructions and outputs them to Claude
* This allows the markdown file to be "executed" as a hook
*/
@@ -48,7 +48,7 @@ async function main() {
const data: HookInput = JSON.parse(input);
// Read the markdown file with instructions from commands directory
- const mdPath = '/Users/daniel/.claude/commands/load-dynamic-context.md';
+ const mdPath = '/Users/daniel/.claude/commands/load-dynamic-requirements.md';
const mdContent = readFileSync(mdPath, 'utf-8');
// Output the markdown content to stdout
@@ -56,7 +56,7 @@ async function main() {
console.log(mdContent);
// Also output a special marker to indicate this is a hook instruction
- console.log('\n<!-- HOOK_INSTRUCTION: Dynamic context loading based on user prompt -->');
+ console.log('\n<!-- HOOK_INSTRUCTION: Dynamic requirements loading based on user prompt -->');
console.log(`<!-- USER_PROMPT: ${data.prompt} -->`);
process.exit(0);
@@ -68,4 +68,4 @@ async function main() {
}
}
-main();
\ No newline at end of file
+main();
diff --git a/.claude/hooks/user-prompt-submit-hook.ts b/.claude/hooks/user-prompt-submit-hook.ts
deleted file mode 100755
index 8256f047..00000000
--- a/.claude/hooks/user-prompt-submit-hook.ts
+++ /dev/null
@@ -1,219 +0,0 @@
-#!/usr/bin/env bun
-/**
- * User Prompt Submit Hook - Voice greeting when Kai starts working
- * Triggered when user submits a request and Kai begins processing
- * Announces when Kai is starting work on the task
- */
-
-interface NotificationPayload {
- title: string;
- message: string;
- voice_enabled: boolean;
- priority?: 'low' | 'normal' | 'high';
- voice_id: string;
-}
-
-interface HookInput {
- session_id: string;
- prompt: string;
- transcript_path: string;
- hook_event_name: string;
-}
-
-/**
- * Generate conversational task summary from user prompt (action-oriented)
- * Dynamically extracts the actual task being requested
- */
-function generateTaskSummary(prompt: string): string {
- // Clean and extract meaningful words from the prompt
- const cleanPrompt = prompt.replace(/[^\w\s]/g, ' ').trim();
- const words = cleanPrompt.split(/\s+/).filter(word =>
- word.length > 2 &&
- !['the', 'and', 'but', 'for', 'are', 'with', 'his', 'her', 'this', 'that', 'you', 'can', 'will', 'have', 'been', 'your', 'from', 'they', 'were', 'said', 'what', 'them', 'just', 'told', 'said'].includes(word.toLowerCase())
- );
-
- const lowerPrompt = prompt.toLowerCase();
-
- // Dynamic extraction based on actual content
- let actionWord = '';
- let subjectWords = [];
-
- // Find the primary action verb from the actual prompt
- const actionVerbs = ['fix', 'debug', 'research', 'write', 'create', 'make', 'build', 'implement', 'analyze', 'review', 'update', 'modify', 'generate', 'develop', 'design', 'test', 'deploy', 'configure', 'setup', 'install', 'remove', 'delete', 'add', 'check', 'verify', 'validate', 'optimize', 'refactor', 'enhance', 'improve', 'send', 'email', 'help'];
-
- for (const verb of actionVerbs) {
- if (lowerPrompt.includes(verb)) {
- actionWord = verb;
- break;
- }
- }
-
- // If no specific action found, infer from context
- if (!actionWord) {
- if (lowerPrompt.includes('hook') || lowerPrompt.includes('static') || lowerPrompt.includes('dynamic')) {
- actionWord = 'fixing';
- } else if (lowerPrompt.includes('?')) {
- actionWord = 'answering';
- } else if (lowerPrompt.includes('greeting') || lowerPrompt.includes('hello') || lowerPrompt.includes('hi')) {
- actionWord = 'responding';
- } else {
- actionWord = 'handling';
- }
- } else {
- // Convert to progressive form for "I'm [verb]ing"
- if (actionWord.endsWith('e')) {
- actionWord = actionWord.slice(0, -1) + 'ing';
- } else if (actionWord === 'fix') {
- actionWord = 'fixing';
- } else if (actionWord === 'debug') {
- actionWord = 'debugging';
- } else if (!actionWord.endsWith('ing')) {
- actionWord = actionWord + 'ing';
- }
- }
-
- // Extract key subject matter (skip common words, focus on nouns/topics)
- const skipWords = ['user', 'prompt', 'thing', 'says', 'responding', 'greeting', 'properly', 'interpreting', 'section', 'those', 'things', 'some', 'that', 'have', 'your', 'need', 'dynamically', 'respond', 'describing', 'exactly', 'doing', 'basically', 'words', 'static', 'fucking', 'line', 'told', 'just'];
-
- subjectWords = words.filter(word =>
- !actionVerbs.includes(word.toLowerCase()) &&
- !skipWords.includes(word.toLowerCase()) &&
- !word.toLowerCase().includes(actionWord.replace('ing', '')) &&
- word.length > 2
- ).slice(0, 3);
-
- // Build the dynamic summary
- let summary = actionWord;
-
- // Add the most relevant subject words
- for (const word of subjectWords.slice(0, 3)) {
- summary += ' ' + word.toLowerCase();
- }
-
- // If we don't have enough specific words, extract more aggressively
- if (subjectWords.length === 0) {
- const fallbackWords = prompt.split(/\s+/)
- .filter(word =>
- word.length > 3 &&
- !/^(the|and|but|for|are|with|his|her|this|that|you|can|will|have|been|your|from|they|were|said|what|them|some|those|thing|says|just|told|fucking)$/i.test(word)
- )
- .slice(0, 3);
-
- for (const word of fallbackWords) {
- summary += ' ' + word.toLowerCase();
- }
- }
-
- // Clean up the summary
- summary = summary.replace(/\s+/g, ' ').trim();
-
- // Make it conversational by adding "for you" or similar
- if (!summary.includes('for you') && !summary.includes('that') && !summary.includes('this')) {
- if (subjectWords.length > 0) {
- summary += ' for you';
- } else {
- summary += ' that for you';
- }
- }
-
- return summary;
-}
-
-/**
- * Generate greeting phrase for when Kai starts working
- */
-function generateVoiceGreeting(): string {
- const greetings = [
- "Okay, I'm",
- "Sure thing, I'm",
- "Got it, I'm",
- "Alright, I'm",
- "On it, I'm",
- "Absolutely, I'm",
- "Right away, I'm",
- "Perfect, I'm",
- "Sounds good, I'm",
- "Will do, I'm"
- ];
-
- return greetings[Math.floor(Math.random() * greetings.length)];
-}
-
-/**
- * Send notification to the Kai notification server
- */
-async function sendNotification(payload: NotificationPayload): Promise<void> {
- try {
- const response = await fetch('http://localhost:8888/notify', {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify(payload),
- });
-
- if (!response.ok) {
- console.error('Notification server error:', response.statusText);
- }
- } catch (error) {
- console.error('Failed to send notification:', error);
- }
-}
-
-/**
- * Read stdin with timeout
- */
-async function readStdinWithTimeout(timeout: number = 5000): Promise<string> {
- return new Promise((resolve, reject) => {
- let data = '';
- const timer = setTimeout(() => {
- reject(new Error('Timeout reading from stdin'));
- }, timeout);
-
- process.stdin.on('data', (chunk) => {
- data += chunk.toString();
- });
-
- process.stdin.on('end', () => {
- clearTimeout(timer);
- resolve(data);
- });
-
- process.stdin.on('error', (err) => {
- clearTimeout(timer);
- reject(err);
- });
- });
-}
-
-async function main() {
- try {
- const input = await readStdinWithTimeout();
- const data: HookInput = JSON.parse(input);
-
- // DISABLED: Immediate voice notification causes janky experience
- // Voice feedback should come from completion hooks instead
- // This ensures clean, single voice notification after AI processing completes
-
- // Generate greeting with task summary (keeping for future use)
- // const greeting = generateVoiceGreeting();
- // const taskSummary = generateTaskSummary(data.prompt);
- // const fullMessage = `${greeting}, ${taskSummary}`;
-
- // COMMENTED OUT: Send notification with Kai's voice
- // const payload: NotificationPayload = {
- // title: 'Kai',
- // message: fullMessage,
- // voice_enabled: true,
- // priority: 'low',
- // voice_id: 'jqcCZkN6Knx8BJ5TBdYR' // Kai's main voice ID
- // };
-
- // await sendNotification(payload);
-
- process.exit(0);
- } catch (error) {
- console.error('UserPromptSubmit hook error:', error);
- process.exit(1);
- }
-}
-
-main();
\ No newline at end of file
diff --git a/.claude/settings.json b/.claude/settings.json
index ad5eb7af..a3b64600 100644
--- a/.claude/settings.json
+++ b/.claude/settings.json
@@ -119,7 +119,7 @@
"hooks": [
{
"type": "command",
- "command": "bun /Users/daniel/.claude/hooks/load-dynamic-context.ts"
+ "command": "bun /Users/daniel/.claude/hooks/load-dynamic-requirements.ts"
}
]
}