⛰️ LifeOS — The AI-powered Life Operating System that helps you hill climb to wherever you're going.
feat: Add WorkCommand pack — /W and /work slash commands for session recall
Daniel Miessler84427d6e5536
diff --git a/Packs/WorkCommand/INSTALL.md b/Packs/WorkCommand/INSTALL.mdnew file mode 100644index 00000000..03ab1700--- /dev/null+++ b/Packs/WorkCommand/INSTALL.md@@ -0,0 +1,405 @@+# Work Command v1.0.0 - Installation Guide++**This guide is designed for AI agents installing this pack into a user's infrastructure.**++---++## AI Agent Instructions++**This is a wizard-style installation.** Use Claude Code's native tools to guide the user through installation:++1. **AskUserQuestion** - For user decisions and confirmations+2. **TodoWrite** - For progress tracking+3. **Bash/Read/Write** - For actual installation+4. **VERIFY.md** - For final validation++### Welcome Message++Before starting, greet the user:+```+"I'm installing Work Command v1.0.0 — instant recall of prior work sessions by topic.++This pack adds two slash commands:+- /W [topic] — short form for quick access+- /work [topic] — descriptive form++Let me analyze your system and guide you through installation."+```++---++## Phase 1: System Analysis++**Execute this analysis BEFORE any file operations.**++### 1.1 Run These Commands++```bash+# Check for Claude Code commands directory+CLAUDE_DIR="$HOME/.claude"+echo "Claude directory: $CLAUDE_DIR"++# Check if commands directory exists+if [ -d "$CLAUDE_DIR/commands" ]; then+ echo "OK Commands directory exists at: $CLAUDE_DIR/commands"+ ls -la "$CLAUDE_DIR/commands/" 2>/dev/null+else+ echo "INFO Commands directory does not exist (will be created)"+fi++# Check for existing W.md or work.md commands+if [ -f "$CLAUDE_DIR/commands/W.md" ]; then+ echo "WARNING Existing /W command found at: $CLAUDE_DIR/commands/W.md"+else+ echo "OK No existing /W command (clean install)"+fi++if [ -f "$CLAUDE_DIR/commands/work.md" ]; then+ echo "WARNING Existing /work command found at: $CLAUDE_DIR/commands/work.md"+else+ echo "OK No existing /work command (clean install)"+fi++# Check for PAI MEMORY structure (optional, enhances results)+if [ -d "$CLAUDE_DIR/MEMORY/WORK" ]; then+ echo "OK PAI MEMORY/WORK directory exists (full functionality available)"+else+ echo "INFO PAI MEMORY/WORK not found (command will work but may return fewer results)"+fi++if [ -f "$CLAUDE_DIR/MEMORY/STATE/work.json" ]; then+ echo "OK work.json session registry exists"+else+ echo "INFO work.json not found (session registry search will be skipped)"+fi++if [ -f "$CLAUDE_DIR/MEMORY/STATE/session-names.json" ]; then+ echo "OK session-names.json exists"+else+ echo "INFO session-names.json not found (session name search will be skipped)"+fi++# Check if ~/.claude is a git repo (for git history search)+if [ -d "$CLAUDE_DIR/.git" ]; then+ echo "OK ~/.claude is a git repository (git history search available)"+else+ echo "INFO ~/.claude is not a git repository (git history search will be skipped)"+fi+```++### 1.2 Present Findings++Tell the user what you found:+```+"Here's what I found on your system:+- Commands directory: [exists / will be created]+- Existing /W command: [found — will ask about conflict / not found]+- Existing /work command: [found — will ask about conflict / not found]+- PAI MEMORY structure: [found (full functionality) / not found (basic functionality)]+- Git repository: [found / not found]++[If MEMORY not found]: Note: The Work Command searches PAI's MEMORY directories+for prior work sessions. Without PAI installed, the command will still work but+will only search git history. For full functionality, consider installing PAI:+https://github.com/danielmiessler/Personal_AI_Infrastructure"+```++---++## Phase 2: User Questions++**Use AskUserQuestion tool at each decision point.**++### Question 1: Conflict Resolution (if existing commands found)++**Only ask if existing /W or /work command detected:**++```json+{+ "header": "Conflict — Existing Command",+ "question": "An existing /W or /work command was found. How should I proceed?",+ "multiSelect": false,+ "options": [+ {"label": "Backup and Replace (Recommended)", "description": "Creates timestamped backup of existing command, then installs new version"},+ {"label": "Replace Without Backup", "description": "Overwrites existing command without backup"},+ {"label": "Abort Installation", "description": "Cancel installation, keep existing command"}+ ]+}+```++### Question 2: Command Selection++```json+{+ "header": "Command Names",+ "question": "Which command names would you like to install?",+ "multiSelect": false,+ "options": [+ {"label": "Both /W and /work (Recommended)", "description": "/W for quick access, /work for discoverability"},+ {"label": "Only /W", "description": "Short form only"},+ {"label": "Only /work", "description": "Descriptive form only"}+ ]+}+```++### Question 3: Final Confirmation++```json+{+ "header": "Install",+ "question": "Ready to install Work Command v1.0.0?",+ "multiSelect": false,+ "options": [+ {"label": "Yes, install now (Recommended)", "description": "Copies command files to ~/.claude/commands/"},+ {"label": "Show me what will change", "description": "Lists all files that will be created"},+ {"label": "Cancel", "description": "Abort installation"}+ ]+}+```++**If user chose "Show me what will change":**+```+"Files to be created:+- ~/.claude/commands/W.md (slash command definition)+- ~/.claude/commands/work.md (slash command definition, same content)++No other files will be modified. No hooks, no configuration changes."+```++Then re-ask the final confirmation question.++---++## Phase 3: Backup (If Needed)++**Only execute if user chose "Backup and Replace":**++```bash+CLAUDE_DIR="$HOME/.claude"+BACKUP_DIR="$CLAUDE_DIR/Backups/work-command-$(date +%Y%m%d-%H%M%S)"+mkdir -p "$BACKUP_DIR"++# Backup existing commands+[ -f "$CLAUDE_DIR/commands/W.md" ] && cp "$CLAUDE_DIR/commands/W.md" "$BACKUP_DIR/W.md" && echo "Backed up W.md"+[ -f "$CLAUDE_DIR/commands/work.md" ] && cp "$CLAUDE_DIR/commands/work.md" "$BACKUP_DIR/work.md" && echo "Backed up work.md"++echo "Backup created at: $BACKUP_DIR"+```++---++## Phase 4: Installation++**Create a TodoWrite list to track progress:**++```json+{+ "todos": [+ {"content": "Create commands directory", "status": "pending", "activeForm": "Creating commands directory"},+ {"content": "Copy command files", "status": "pending", "activeForm": "Copying command files"},+ {"content": "Run verification", "status": "pending", "activeForm": "Running verification"}+ ]+}+```++### 4.1 Create Commands Directory++**Mark todo "Create commands directory" as in_progress.**++```bash+CLAUDE_DIR="$HOME/.claude"+mkdir -p "$CLAUDE_DIR/commands"+```++**Mark todo as completed.**++### 4.2 Copy Command Files++**Mark todo "Copy command files" as in_progress.**++**Copy files based on user's command selection:**++**For "Both /W and /work" (default):**+```bash+PACK_DIR="$(pwd)"+CLAUDE_DIR="$HOME/.claude"+cp "$PACK_DIR/src/commands/W.md" "$CLAUDE_DIR/commands/W.md"+cp "$PACK_DIR/src/commands/work.md" "$CLAUDE_DIR/commands/work.md"+echo "Installed /W and /work commands"+```++**For "Only /W":**+```bash+PACK_DIR="$(pwd)"+CLAUDE_DIR="$HOME/.claude"+cp "$PACK_DIR/src/commands/W.md" "$CLAUDE_DIR/commands/W.md"+echo "Installed /W command"+```++**For "Only /work":**+```bash+PACK_DIR="$(pwd)"+CLAUDE_DIR="$HOME/.claude"+cp "$PACK_DIR/src/commands/work.md" "$CLAUDE_DIR/commands/work.md"+echo "Installed /work command"+```++**Mark todo as completed.**++---++## Phase 5: Verification++**Mark todo "Run verification" as in_progress.**++**Execute all checks from VERIFY.md:**++```bash+CLAUDE_DIR="$HOME/.claude"++echo "=== Work Command Verification ==="++# Check command files exist+echo "Checking command files..."+[ -f "$CLAUDE_DIR/commands/W.md" ] && echo "OK /W command installed" || echo "SKIP /W not installed (user chose /work only)"+[ -f "$CLAUDE_DIR/commands/work.md" ] && echo "OK /work command installed" || echo "SKIP /work not installed (user chose /W only)"++# Check frontmatter is valid+echo "Checking frontmatter..."+if [ -f "$CLAUDE_DIR/commands/W.md" ]; then+ head -1 "$CLAUDE_DIR/commands/W.md" | grep -q "^---" && echo "OK W.md has valid frontmatter" || echo "ERROR W.md missing frontmatter"+fi+if [ -f "$CLAUDE_DIR/commands/work.md" ]; then+ head -1 "$CLAUDE_DIR/commands/work.md" | grep -q "^---" && echo "OK work.md has valid frontmatter" || echo "ERROR work.md missing frontmatter"+fi++# Check file contents are complete+echo "Checking file contents..."+if [ -f "$CLAUDE_DIR/commands/W.md" ]; then+ grep -q "WORK RECALL" "$CLAUDE_DIR/commands/W.md" && echo "OK W.md contains work recall template" || echo "ERROR W.md incomplete"+ grep -q "work.json" "$CLAUDE_DIR/commands/W.md" && echo "OK W.md references session registry" || echo "ERROR W.md missing search sources"+fi++# Check data sources (informational, not blocking)+echo ""+echo "Data source availability (informational):"+[ -f "$CLAUDE_DIR/MEMORY/STATE/work.json" ] && echo " OK work.json — session registry available" || echo " INFO work.json — not found (install PAI for this feature)"+[ -d "$CLAUDE_DIR/MEMORY/WORK" ] && echo " OK MEMORY/WORK — PRD directory available" || echo " INFO MEMORY/WORK — not found (install PAI for this feature)"+[ -f "$CLAUDE_DIR/MEMORY/STATE/session-names.json" ] && echo " OK session-names.json — session names available" || echo " INFO session-names.json — not found (install PAI for this feature)"+[ -d "$CLAUDE_DIR/.git" ] && echo " OK .git — git history available" || echo " INFO .git — not found (git history search unavailable)"++echo ""+echo "=== Verification Complete ==="+```++**Mark todo as completed when file checks pass.**++---++## Success/Failure Messages++### On Success++```+"Work Command v1.0.0 installed successfully!++What's available:+- /W [topic] — quick search for prior work+- /work [topic] — same command, descriptive name++Try it now: Type '/W' followed by any topic you've worked on before.++Example: /W authentication+Example: /W dashboard+Example: /W deploy++Note: Results improve the more you use PAI's work tracking system (PRDs, session names, git commits)."+```++### On Success (Without PAI MEMORY)++```+"Work Command v1.0.0 installed successfully!++The commands are ready, but PAI's MEMORY system isn't installed yet.+Right now, the commands will search git history only.++For full functionality (PRD search, session registry, work directories), install PAI:+https://github.com/danielmiessler/Personal_AI_Infrastructure++Try it now: /W [any topic]"+```++### On Failure++```+"Installation encountered issues. Here's what to check:++1. Ensure ~/.claude/ directory exists (created by Claude Code)+2. Check write permissions on ~/.claude/commands/+3. Run the verification commands in VERIFY.md++Need help? Open an issue at https://github.com/danielmiessler/Personal_AI_Infrastructure/issues"+```++---++## Troubleshooting++### Commands not showing up after installation++Restart Claude Code. Custom commands from `~/.claude/commands/` are loaded at session start.++### "No prior work found" for everything++This is expected if PAI's MEMORY system isn't installed. The command searches PAI-specific directories. Options:+1. Install PAI for full work tracking: https://github.com/danielmiessler/Personal_AI_Infrastructure+2. The command will still search git history if `~/.claude/` is a git repo++### Command works but results are sparse++The Work Command searches data created by PAI's Algorithm (PRDs, session metadata). The more you use PAI's structured workflow, the richer the search results become.++---++## What's Included++| File | Purpose |+|------|---------|+| `src/commands/W.md` | Primary slash command — short form `/W` |+| `src/commands/work.md` | Alias slash command — descriptive form `/work` |++Both files contain identical logic. The only difference is the `name` field in the frontmatter (`W` vs `work`), which determines the slash command name in Claude Code.++---++## Usage++### From Claude Code++```+/W authentication+/W dashboard redesign+/W deploy+/work security audit+/work blog publishing+```++### How It Works++When you type `/W [topic]`, Claude Code:+1. Loads the command template from `~/.claude/commands/W.md`+2. Substitutes `$ARGUMENTS` with your topic+3. The AI executes the five parallel searches defined in the template+4. Results are presented in a structured format+5. The AI reads the most recent matching PRD for full context++### Integration with PAI++If you have PAI installed, the Work Command becomes significantly more powerful:+- **work.json** provides structured session metadata+- **MEMORY/WORK/*/PRD.md** provides full context, criteria, and decisions+- **session-names.json** provides human-readable session names+- **Git history** provides commit-level detail++Without PAI, the command still works but only searches git history.diff --git a/Packs/WorkCommand/README.md b/Packs/WorkCommand/README.mdnew file mode 100644index 00000000..e987db47--- /dev/null+++ b/Packs/WorkCommand/README.md@@ -0,0 +1,228 @@+---+name: Work Command+pack-id: danielmiessler-work-command-v1.0.0+version: 1.0.0+author: danielmiessler+description: Instant recall of prior work sessions by topic — search PRDs, git history, session names, and work directories with a single slash command+type: skill+purpose-type: [productivity, workflow, context-recovery]+platform: claude-code+dependencies: []+keywords: [work-recall, session-search, context-recovery, PRD, slash-command, resume-work, prior-work, session-history, commands]+---++# Work Command++> Instant recall of prior work sessions by topic — never lose context between sessions again.++> **Installation:** This pack is designed for AI-assisted installation. Give this directory to your AI and ask it to install using `INSTALL.md`.++---++## Installation Prompt++You are receiving a PAI Pack — a modular upgrade for AI agent systems.++**What is PAI?** See: [PAI Project Overview](../../README.md#what-is-pai)++**What is a Pack?** See: [Pack System](../README.md)++This pack adds **work recall** to your Claude Code setup. It installs two slash commands (`/W` and `/work`) that let you instantly search across all prior work sessions by topic. Type `/W authentication` and your AI searches PRDs, git history, session names, and work directories to bring you up to speed in seconds.++**Why you want this:**+- **Context loss between sessions** is the #1 productivity killer with AI assistants+- You've done work before — your AI should remember it+- No more manually grepping through files to find "that thing we did last week"++Please follow the installation instructions in `INSTALL.md` to integrate this pack.++---++## What's Included++| Component | File | Purpose |+|-----------|------|---------|+| Primary command | `src/commands/W.md` | `/W` slash command — short form for quick access |+| Alias command | `src/commands/work.md` | `/work` slash command — descriptive form |++**Summary:**+- **Files created:** 2+- **Hooks registered:** 0+- **Dependencies:** None (works standalone, enhanced by PAI MEMORY structure)++---++## The Problem++AI agents are powerful but amnesiac. Each session starts fresh with no memory of prior work. When you've built features, debugged issues, or done research in past sessions, that context is gone. You end up:++- **Re-explaining context** — "We already worked on this last week..."+- **Losing decisions** — "Why did we choose that approach? I don't remember."+- **Duplicating effort** — Starting from scratch on problems you've already solved+- **Missing connections** — Not realizing that today's task relates to prior work++The fundamental issue: your AI infrastructure generates valuable work artifacts (PRDs, git commits, session summaries), but there's no fast way to search and recall them by topic.++---++## The Solution++The Work Command adds two slash commands (`/W` and `/work`) that search across **five data sources** in parallel:++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++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.++---++## What Makes This Different++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.++- Five parallel searches cover more than git alone+- PRD context includes decisions and criteria status+- Output is structured for instant AI context loading+- Graceful degradation when some sources are missing++---++## Invocation Scenarios++| Trigger | What Happens |+|---------|--------------|+| `/W authentication` | Searches all 5 sources for "authentication", presents structured results |+| `/work dashboard` | Same search using the longer alias |+| `/W deploy` | Finds all sessions related to deployment work |+| `/W helios` | Finds project-specific sessions by name |++The command accepts any topic as a free-text argument. Matching is case-insensitive and partial — searching "auth" will match "authentication", "auth-middleware", etc.++---++## Example Usage++### Finding Prior Work++```+User: /W authentication++AI responds:+═══ WORK RECALL: authentication ══════════════════++📋 MATCHING SESSIONS (sorted by most recent first):++ • 20260312-143000_fix-auth-middleware — Fix authentication middleware race condition+ Phase: complete | Progress: 8/8 | Effort: standard+ Started: 2026-03-12 | Last updated: 2026-03-12+ Key context: Fixed race condition in auth token refresh causing 401 errors+ Criteria status: 8 passed / 8 total++ • 20260310-091500_add-oauth-flow — Add OAuth2 login flow+ Phase: complete | Progress: 12/12 | Effort: extended+ Started: 2026-03-10 | Last updated: 2026-03-10+ Key context: Implemented OAuth2 PKCE flow with Google and GitHub providers+ Criteria status: 12 passed / 12 total++🔗 RELATED COMMITS (last 20):+ • a1b2c3d Fix auth middleware race condition (2026-03-12)+ • d4e5f6g Add OAuth2 PKCE flow (2026-03-10)++📂 WORK DIRECTORIES:+ • 20260312-143000_fix-auth-middleware/+ • 20260310-091500_add-oauth-flow/++───────────────────────────────────────────────++"I've caught up on authentication. The most recent session fixed a race condition+in auth middleware. Ready to continue — what would you like to work on?"+```++### No Results++```+User: /W quantum-computing++AI responds:+═══ WORK RECALL: quantum-computing ══════════════════++📋 MATCHING SESSIONS: None found++🔗 RELATED COMMITS: None found++📂 WORK DIRECTORIES: None found++───────────────────────────────────────────────++"No prior work found on quantum-computing. Ready to start fresh —+what would you like to build?"+```++---++## Configuration++No configuration required.++The command searches these paths by default:+- `~/.claude/MEMORY/STATE/work.json`+- `~/.claude/MEMORY/WORK/`+- `~/.claude/MEMORY/STATE/session-names.json`+- `~/.claude/` (git history)++If these paths don't exist (e.g., PAI's MEMORY system isn't installed), the command gracefully returns "no matches found" for those sources. No errors, no crashes.++---++## Customization++### Recommended Customization++No customization needed — the command works as-is.++### Optional Customization++If you use a different directory structure for your work tracking, you can edit the command files to point to your paths:++| Customization | File | Impact |+|--------------|------|--------|+| Change work registry path | `W.md` / `work.md` | Searches your custom work.json location |+| Change work directory path | `W.md` / `work.md` | Searches your custom PRD directory |+| Add additional search sources | `W.md` / `work.md` | Extends search to cover more data |++---++## Credits++- **Original concept:** Daniel Miessler — developed as part of the PAI (Personal AI Infrastructure) system+- **Inspired by:** The frustration of losing context between AI sessions++---++## Related Work++- **PAI MEMORY System** — The work tracking infrastructure that generates the data this command searches+- **PAI Algorithm** — The system that creates PRDs with structured criteria, decisions, and verification++---++## Works Well With++- **PAI Core Install** — Provides the MEMORY directory structure for full functionality+- **PAI Algorithm Skill** — Generates the PRDs that Work Command searches++---++## Changelog++### 1.0.0 - 2026-03-13+- Initial release+- Two commands: `/W` (short) and `/work` (descriptive)+- Five parallel search sources+- Structured output format with recency sorting+- Graceful degradation when data sources are missingdiff --git a/Packs/WorkCommand/VERIFY.md b/Packs/WorkCommand/VERIFY.mdnew file mode 100644index 00000000..46e97a4e--- /dev/null+++ b/Packs/WorkCommand/VERIFY.md@@ -0,0 +1,118 @@+# Work Command Verification++> **FOR AI AGENTS:** Complete this checklist AFTER installation. Every file check must pass before declaring the pack installed. Data source checks are informational only.++---++## File Verification++### Check command files exist++```bash+CLAUDE_DIR="$HOME/.claude"+[ -f "$CLAUDE_DIR/commands/W.md" ] && echo "OK W.md" || echo "MISSING W.md"+[ -f "$CLAUDE_DIR/commands/work.md" ] && echo "OK work.md" || echo "MISSING work.md"+```++**Expected:** At least one command file present (both if user chose "Both").++### Check frontmatter is valid++```bash+CLAUDE_DIR="$HOME/.claude"+for cmd in W.md work.md; do+ if [ -f "$CLAUDE_DIR/commands/$cmd" ]; then+ head -1 "$CLAUDE_DIR/commands/$cmd" | grep -q "^---" && echo "OK $cmd frontmatter" || echo "ERROR $cmd missing frontmatter"+ grep -q "^name:" "$CLAUDE_DIR/commands/$cmd" && echo "OK $cmd has name field" || echo "ERROR $cmd missing name field"+ grep -q "^description:" "$CLAUDE_DIR/commands/$cmd" && echo "OK $cmd has description" || echo "ERROR $cmd missing description"+ grep -q "^argument-hint:" "$CLAUDE_DIR/commands/$cmd" && echo "OK $cmd has argument-hint" || echo "ERROR $cmd missing argument-hint"+ fi+done+```++**Expected:** All three frontmatter fields present in each installed file.++### Check command content is complete++```bash+CLAUDE_DIR="$HOME/.claude"+for cmd in W.md work.md; do+ if [ -f "$CLAUDE_DIR/commands/$cmd" ]; then+ echo "Checking $cmd content..."+ grep -q "WORK RECALL" "$CLAUDE_DIR/commands/$cmd" && echo " OK Has work recall header" || echo " ERROR Missing work recall header"+ grep -q "work.json" "$CLAUDE_DIR/commands/$cmd" && echo " OK References session registry" || echo " ERROR Missing session registry search"+ grep -q "MEMORY/WORK" "$CLAUDE_DIR/commands/$cmd" && echo " OK References work directories" || echo " ERROR Missing work directory search"+ grep -q "git.*log" "$CLAUDE_DIR/commands/$cmd" && echo " OK References git history" || echo " ERROR Missing git history search"+ grep -q "session-names" "$CLAUDE_DIR/commands/$cmd" && echo " OK References session names" || echo " ERROR Missing session name search"+ grep -q "PRD.md" "$CLAUDE_DIR/commands/$cmd" && echo " OK References PRD files" || echo " ERROR Missing PRD search"+ echo " All 5 search sources present"+ fi+done+```++**Expected:** All 5 search sources referenced in each command file.++---++## Data Source Availability (Informational)++These checks are NOT blocking — the command works without these, but results improve with them.++```bash+CLAUDE_DIR="$HOME/.claude"++echo "Data sources:"+[ -f "$CLAUDE_DIR/MEMORY/STATE/work.json" ] && echo " AVAILABLE work.json (session registry)" || echo " UNAVAILABLE work.json (install PAI for this)"+[ -d "$CLAUDE_DIR/MEMORY/WORK" ] && echo " AVAILABLE MEMORY/WORK (PRD directory)" || echo " UNAVAILABLE MEMORY/WORK (install PAI for this)"+[ -f "$CLAUDE_DIR/MEMORY/STATE/session-names.json" ] && echo " AVAILABLE session-names.json" || echo " UNAVAILABLE session-names.json (install PAI for this)"+[ -d "$CLAUDE_DIR/.git" ] && echo " AVAILABLE git history" || echo " UNAVAILABLE git history"+```++---++## Installation Checklist++Mark each item as complete:++```markdown+## Work Command Installation Verification++### Files+- [ ] At least one command file installed (W.md or work.md)+- [ ] Command file(s) have valid YAML frontmatter+- [ ] Command file(s) contain all 5 search source sections+- [ ] Command file(s) contain output format template+- [ ] Command file(s) contain post-results instructions++### Functional (manual test)+- [ ] Typing /W [topic] in Claude Code triggers the command+- [ ] Typing /work [topic] in Claude Code triggers the command (if installed)+- [ ] Command returns structured output or "no matches found"+```++---++## Quick Functional Test++After installation, restart Claude Code and run:++```+/W test+```++**Expected behavior:**+- The AI searches all available data sources for "test"+- Returns structured results (or "no prior work found on test")+- No errors or crashes++If the command isn't recognized, ensure you restarted Claude Code after installation.++---++## Verification Complete++When all file checks pass:++1. **Confirm to user:** "Work Command installation verified successfully"+2. **Recommend:** "Try it now: `/W` followed by any topic you've worked on"+3. **Note:** "Restart Claude Code if the commands aren't recognized yet"diff --git a/Packs/WorkCommand/src/commands/W.md b/Packs/WorkCommand/src/commands/W.mdnew file mode 100644index 00000000..9980c00d--- /dev/null+++ b/Packs/WorkCommand/src/commands/W.md@@ -0,0 +1,72 @@+---+name: W+description: Search all prior work by topic to recall context and resume sessions. Use when wanting to find, recall, or continue previous work on any topic.+argument-hint: [topic]+---++# Work Recall++Search all prior work for: **$ARGUMENTS**++## Your Task++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++Execute these searches in parallel:++### 1. Session Registry (work.json)+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.++### 3. Git History+Run: `git -C ~/.claude log --oneline --all --grep="$ARGUMENTS" -i -20` to find recent commits mentioning this topic.++### 4. 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.++## Output Format++Present your findings as:++```+═══ WORK RECALL: $ARGUMENTS ══════════════════++📋 MATCHING SESSIONS (sorted by most recent first):++ For each match:+ • [session slug] — [task description]+ 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]++🔗 RELATED COMMITS (last 20):+ • [commit hash] [message] ([date])++📂 WORK DIRECTORIES:+ • [list of matching directory names]++───────────────────────────────────────────────+```++## 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?"++2. **If no matches found:** Tell the user: "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 countdiff --git a/Packs/WorkCommand/src/commands/work.md b/Packs/WorkCommand/src/commands/work.mdnew file mode 100644index 00000000..dca95d7a--- /dev/null+++ b/Packs/WorkCommand/src/commands/work.md@@ -0,0 +1,72 @@+---+name: work+description: Search all prior work by topic to recall context and resume sessions. Use when wanting to find, recall, or continue previous work on any topic.+argument-hint: [topic]+---++# Work Recall++Search all prior work for: **$ARGUMENTS**++## Your Task++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++Execute these searches in parallel:++### 1. Session Registry (work.json)+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.++### 3. Git History+Run: `git -C ~/.claude log --oneline --all --grep="$ARGUMENTS" -i -20` to find recent commits mentioning this topic.++### 4. 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.++## Output Format++Present your findings as:++```+═══ WORK RECALL: $ARGUMENTS ══════════════════++📋 MATCHING SESSIONS (sorted by most recent first):++ For each match:+ • [session slug] — [task description]+ 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]++🔗 RELATED COMMITS (last 20):+ • [commit hash] [message] ([date])++📂 WORK DIRECTORIES:+ • [list of matching directory names]++───────────────────────────────────────────────+```++## 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?"++2. **If no matches found:** Tell the user: "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