Skip to content

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

feat: WorkCommand works on vanilla Claude Code — auto-detects PAI vs stock install

Daniel Miessler301d5413c779
diff --git a/Packs/WorkCommand/README.md b/Packs/WorkCommand/README.md
index 8e7373ed..51e381bd 100644
--- a/Packs/WorkCommand/README.md
+++ b/Packs/WorkCommand/README.md
@@ -32,15 +32,21 @@ The fundamental issue: your AI infrastructure generates valuable work artifacts
## The Solution
-The Work Command adds two slash commands (`/w` and `/work`) that search across **five data sources** in parallel:
+The Work Command adds two slash commands (`/w` and `/work`) that automatically detect your environment and search the right data sources.
-1. **Session Registry** (`work.json`) — Structured metadata for all tracked sessions
-2. **Work Directories** (`MEMORY/WORK/`) — Full PRD files with context, criteria, decisions
-3. **Git History** — Commit messages mentioning the topic
-4. **Session Names** — Human-readable session name cache
-5. **PRD Content** — Full-text search across all PRD bodies
+**Any Claude Code install (vanilla):**
+1. **Conversation History** (`history.jsonl`) — Every prior prompt you've sent, with timestamps and project context
+2. **Git History** — Commit messages in the current project mentioning the topic
+3. **Project Memory** — Auto-memory files saved across all your projects
-The command synthesizes results into an actionable summary sorted by recency, then reads the most recent matching PRD in full so the AI can immediately continue where you left off.
+**PAI-enhanced installs (additional sources):**
+4. **Session Registry** (`work.json`) — Structured metadata for all tracked sessions
+5. **Work Directories** (`MEMORY/WORK/`) — Full PRD files with context, criteria, decisions
+6. **Session Names** — Human-readable session name cache
+7. **PRD Content** — Full-text search across all PRD bodies
+8. **PAI Git History** — Commits in the PAI infrastructure repo
+
+The command synthesizes results into an actionable summary sorted by recency, then loads the most relevant context so your AI can immediately continue where you left off.
---
@@ -70,12 +76,12 @@ This pack is designed for AI-assisted installation. Give this directory to your
This sounds similar to `git log --grep` which also searches past work. What makes this approach different?
-Work recall searches five complementary data sources simultaneously — session metadata, PRD content, git history, session names, and work directories. A git grep only finds commit messages. Work recall finds the full decision context, criteria status, and progress state, then synthesizes it into an immediately actionable summary. Your AI reads the actual PRDs and is ready to continue.
+Work recall searches up to eight data sources simultaneously — conversation history, git commits, project memory, session metadata, PRD content, session names, and work directories. A git grep only finds commit messages. Work recall finds everything: what you asked, what was decided, what the criteria were, and where it left off. It works on any Claude Code install out of the box, and gets richer if you have PAI installed.
-- Five parallel searches cover more than git alone
-- PRD context includes decisions and criteria status
+- Works on vanilla Claude Code — no PAI required
+- Auto-detects environment and searches available sources
- Output is structured for instant AI context loading
-- Graceful degradation when some sources are missing
+- PAI users get additional PRD and session registry search
---
diff --git a/Packs/WorkCommand/src/commands/w.md b/Packs/WorkCommand/src/commands/w.md
index f29e66b2..a4365911 100644
--- a/Packs/WorkCommand/src/commands/w.md
+++ b/Packs/WorkCommand/src/commands/w.md
@@ -12,24 +12,43 @@ Search all prior work for: **$ARGUMENTS**
You are recalling prior work on the topic "$ARGUMENTS". Search across ALL available sources, synthesize what you find, and present an actionable summary so the user can immediately resume or start fresh work on this topic.
-## Search Instructions
+## Step 1: Detect Environment
-Execute these searches in parallel:
+Check which data sources exist. This determines whether you're on a vanilla Claude Code install or a PAI-enhanced one.
-### 1. Session Registry (work.json)
+```
+PAI detected if: ~/.claude/MEMORY/WORK/ directory exists
+```
+
+## Step 2: Search (execute available searches in parallel)
+
+### Always Available (any Claude Code install)
+
+**A. Conversation History**
+Search `~/.claude/history.jsonl` for lines where the `display` field matches "$ARGUMENTS" (case-insensitive, partial match). Each line is JSON with fields: `display`, `timestamp`, `project`, `sessionId`. Extract the most recent 10 matching entries with their timestamps and project paths.
+
+**B. Current Project Git History**
+Run: `git log --oneline --all --grep="$ARGUMENTS" -i -20` to find commits in the current project mentioning this topic.
+
+**C. Project Memory Files**
+Use Glob to find `~/.claude/projects/*/memory/*.md` files, then Grep across them for "$ARGUMENTS" to find any saved context from prior projects.
+
+### PAI-Enhanced (only if ~/.claude/MEMORY/WORK/ exists)
+
+**D. Session Registry**
Read `~/.claude/MEMORY/STATE/work.json` and find all sessions where the `task` field, slug key, or `sessionName` field matches "$ARGUMENTS" (case-insensitive, partial match). Extract: task, phase, progress, effort, started, criteria summary.
-### 2. Work Directories
-Search `~/.claude/MEMORY/WORK/` for matching directory names (case-insensitive, partial match). For each match, read the PRD.md frontmatter and `## Context` section to get the full picture.
+**E. Work Directories**
+Search `~/.claude/MEMORY/WORK/` for matching directory names (case-insensitive, partial match). For each match, read the PRD.md frontmatter and `## Context` section.
-### 3. Git History
-Run: `git -C ~/.claude log --oneline --all --grep="$ARGUMENTS" -i -20` to find recent commits mentioning this topic.
+**F. PAI Git History**
+Run: `git -C ~/.claude log --oneline --all --grep="$ARGUMENTS" -i -20` to find commits in the PAI repo mentioning this topic.
-### 4. Session Names
+**G. Session Names**
Read `~/.claude/MEMORY/STATE/session-names.json` and find entries where the session name matches "$ARGUMENTS" (case-insensitive, partial match).
-### 5. Project Files
-Search for "$ARGUMENTS" across PRD files in `~/.claude/MEMORY/WORK/` (limit to `**/PRD.md` glob) for deeper context matches beyond just directory names.
+**H. PRD Content Search**
+Use Grep to search for "$ARGUMENTS" in `~/.claude/MEMORY/WORK/` across PRD files (limit to `**/PRD.md` glob) for deeper context matches.
## Output Format
@@ -41,32 +60,38 @@ Present your findings as:
📋 MATCHING SESSIONS (sorted by most recent first):
For each match:
- • [session slug] — [task description]
+ • [session slug or sessionId] — [task description or user prompt]
Phase: [phase] | Progress: [progress] | Effort: [effort]
Started: [date] | Last updated: [date]
- Key context: [1-2 sentence summary from PRD Context section]
- Criteria status: [X passed / Y total]
+ Key context: [1-2 sentence summary]
+ Criteria status: [X passed / Y total] (if PAI PRD available)
🔗 RELATED COMMITS (last 20):
• [commit hash] [message] ([date])
+💬 CONVERSATION HISTORY (recent matching prompts):
+ • [timestamp] [project] — [user prompt excerpt]
+
📂 WORK DIRECTORIES:
• [list of matching directory names]
───────────────────────────────────────────────
```
+Omit any section that has no results. Only show sections with actual matches.
+
## After Presenting Results
After showing the summary:
-1. **If matches found:** Read the most recent matching PRD.md in full (the `## Context`, `## Criteria`, `## Decisions` sections). Then tell the user: "I've caught up on [topic]. The most recent session was [X]. Ready to continue — what would you like to work on?"
+1. **If matches found:** Read the most recent matching PRD (if PAI) or summarize the most recent conversation context. Then say: "I've caught up on [topic]. The most recent session was [X]. Ready to continue — what would you like to work on?"
-2. **If no matches found:** Tell the user: "No prior work found on [topic]. Ready to start fresh — what would you like to build?"
+2. **If no matches found:** Say: "No prior work found on [topic]. Ready to start fresh — what would you like to build?"
## Important
- Sort everything by recency (newest first)
-- Read actual PRD files for the top 3 matches — don't just show metadata
-- Be concise but thorough — the goal is to get the user back up to speed instantly
-- If there are more than 10 matches, show the 10 most recent and mention the total count
+- If PAI PRDs found, read the top 3 in full for context
+- Be concise but thorough — the goal is instant context recovery
+- If there are more than 10 matches in any section, show the 10 most recent and mention the total count
+- The conversation history search (history.jsonl) can be large — limit to 10 most recent matches
diff --git a/Packs/WorkCommand/src/commands/work.md b/Packs/WorkCommand/src/commands/work.md
index dca95d7a..5532bf48 100644
--- a/Packs/WorkCommand/src/commands/work.md
+++ b/Packs/WorkCommand/src/commands/work.md
@@ -12,24 +12,43 @@ Search all prior work for: **$ARGUMENTS**
You are recalling prior work on the topic "$ARGUMENTS". Search across ALL available sources, synthesize what you find, and present an actionable summary so the user can immediately resume or start fresh work on this topic.
-## Search Instructions
+## Step 1: Detect Environment
-Execute these searches in parallel:
+Check which data sources exist. This determines whether you're on a vanilla Claude Code install or a PAI-enhanced one.
-### 1. Session Registry (work.json)
+```
+PAI detected if: ~/.claude/MEMORY/WORK/ directory exists
+```
+
+## Step 2: Search (execute available searches in parallel)
+
+### Always Available (any Claude Code install)
+
+**A. Conversation History**
+Search `~/.claude/history.jsonl` for lines where the `display` field matches "$ARGUMENTS" (case-insensitive, partial match). Each line is JSON with fields: `display`, `timestamp`, `project`, `sessionId`. Extract the most recent 10 matching entries with their timestamps and project paths.
+
+**B. Current Project Git History**
+Run: `git log --oneline --all --grep="$ARGUMENTS" -i -20` to find commits in the current project mentioning this topic.
+
+**C. Project Memory Files**
+Use Glob to find `~/.claude/projects/*/memory/*.md` files, then Grep across them for "$ARGUMENTS" to find any saved context from prior projects.
+
+### PAI-Enhanced (only if ~/.claude/MEMORY/WORK/ exists)
+
+**D. Session Registry**
Read `~/.claude/MEMORY/STATE/work.json` and find all sessions where the `task` field, slug key, or `sessionName` field matches "$ARGUMENTS" (case-insensitive, partial match). Extract: task, phase, progress, effort, started, criteria summary.
-### 2. Work Directories
-Search `~/.claude/MEMORY/WORK/` for matching directory names (case-insensitive, partial match). For each match, read the PRD.md frontmatter and `## Context` section to get the full picture.
+**E. Work Directories**
+Search `~/.claude/MEMORY/WORK/` for matching directory names (case-insensitive, partial match). For each match, read the PRD.md frontmatter and `## Context` section.
-### 3. Git History
-Run: `git -C ~/.claude log --oneline --all --grep="$ARGUMENTS" -i -20` to find recent commits mentioning this topic.
+**F. PAI Git History**
+Run: `git -C ~/.claude log --oneline --all --grep="$ARGUMENTS" -i -20` to find commits in the PAI repo mentioning this topic.
-### 4. Session Names
+**G. Session Names**
Read `~/.claude/MEMORY/STATE/session-names.json` and find entries where the session name matches "$ARGUMENTS" (case-insensitive, partial match).
-### 5. Project Files
-Search for "$ARGUMENTS" across PRD files in `~/.claude/MEMORY/WORK/` (limit to `**/PRD.md` glob) for deeper context matches beyond just directory names.
+**H. PRD Content Search**
+Use Grep to search for "$ARGUMENTS" in `~/.claude/MEMORY/WORK/` across PRD files (limit to `**/PRD.md` glob) for deeper context matches.
## Output Format
@@ -41,32 +60,38 @@ Present your findings as:
📋 MATCHING SESSIONS (sorted by most recent first):
For each match:
- • [session slug] — [task description]
+ • [session slug or sessionId] — [task description or user prompt]
Phase: [phase] | Progress: [progress] | Effort: [effort]
Started: [date] | Last updated: [date]
- Key context: [1-2 sentence summary from PRD Context section]
- Criteria status: [X passed / Y total]
+ Key context: [1-2 sentence summary]
+ Criteria status: [X passed / Y total] (if PAI PRD available)
🔗 RELATED COMMITS (last 20):
• [commit hash] [message] ([date])
+💬 CONVERSATION HISTORY (recent matching prompts):
+ • [timestamp] [project] — [user prompt excerpt]
+
📂 WORK DIRECTORIES:
• [list of matching directory names]
───────────────────────────────────────────────
```
+Omit any section that has no results. Only show sections with actual matches.
+
## After Presenting Results
After showing the summary:
-1. **If matches found:** Read the most recent matching PRD.md in full (the `## Context`, `## Criteria`, `## Decisions` sections). Then tell the user: "I've caught up on [topic]. The most recent session was [X]. Ready to continue — what would you like to work on?"
+1. **If matches found:** Read the most recent matching PRD (if PAI) or summarize the most recent conversation context. Then say: "I've caught up on [topic]. The most recent session was [X]. Ready to continue — what would you like to work on?"
-2. **If no matches found:** Tell the user: "No prior work found on [topic]. Ready to start fresh — what would you like to build?"
+2. **If no matches found:** Say: "No prior work found on [topic]. Ready to start fresh — what would you like to build?"
## Important
- Sort everything by recency (newest first)
-- Read actual PRD files for the top 3 matches — don't just show metadata
-- Be concise but thorough — the goal is to get the user back up to speed instantly
-- If there are more than 10 matches, show the 10 most recent and mention the total count
+- If PAI PRDs found, read the top 3 in full for context
+- Be concise but thorough — the goal is instant context recovery
+- If there are more than 10 matches in any section, show the 10 most recent and mention the total count
+- The conversation history search (history.jsonl) can be large — limit to 10 most recent matches