Skip to main content
ClaudeWave
Slash Command105 repo starsupdated 3mo ago

suggest

Analyze activity and suggest memories to save

Install in Claude Code
Copy
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/SukinShetty/Nemp-memory/HEAD/commands/suggest.md -o ~/.claude/commands/suggest.md
Then start a new Claude Code session; the slash command loads automatically.

suggest.md

# /nemp:suggest

Intelligently suggest memories to save based on your recent work patterns.

## Usage
```bash
/nemp:suggest            # Analyze and show suggestions interactively
/nemp:suggest --auto     # Automatically save all suggestions
```

## Instructions

You are an intelligent pattern analyzer. Examine the user's recent activity and suggest valuable memories to save.

### Step 1: Read Activity Log

Read the activity log from `.nemp/activity.log` or `.nemp-pro/activity.log`.

If no activity log exists:
```
No Activity Log Found

Enable activity capture to get personalized suggestions:
  /nemp:auto-capture on

Or manually add memories:
  /nemp:save <key> <value>
  /nemp:init              # Auto-detect project stack
```

### Step 2: Parse and Analyze Patterns

Analyze the activity log entries to identify patterns:

**Pattern Detection Categories:**

| Category | Detection Method | Suggestion Type |
|----------|------------------|-----------------|
| **Hot Files** | Files edited 3+ times | `important-files` |
| **Core Modules** | Directories with most activity | `project-structure` |
| **Workflow Commands** | Repeated bash commands (git, npm, test) | `dev-workflow` |
| **Stack Signals** | File extensions + paths | `stack-hints` |
| **Testing Patterns** | Test commands + test file edits | `testing-workflow` |
| **Build Patterns** | Build/deploy commands | `build-workflow` |
| **New Dependencies** | npm/yarn/pnpm install commands | `new-packages` |

**Analysis Rules:**

```
FOR EACH activity entry:
  - Track file paths → count modifications per file
  - Track directories → identify hot zones (e.g., src/auth/, src/api/)
  - Track commands → identify workflow patterns
  - Track file types → detect stack usage
  - Track install commands → detect new dependencies (Rule 2)

THRESHOLDS:
  - File modified 3+ times → IMPORTANT FILE
  - Directory has 5+ file edits → CORE MODULE
  - Command run 3+ times → WORKFLOW PATTERN
  - Same file type in multiple edits → STACK SIGNAL
  - Any npm/yarn/pnpm/bun install → NEW DEPENDENCY (always suggest)
```

### Step 3: Smart Memory Drafting

For each suggestion, auto-generate a memory value that is concise, actionable, and useful for future sessions.

**Drafting Rules:**

1. **Be Specific** - Include actual file paths, command names, package versions
2. **Be Concise** - Keep under 200 characters when possible
3. **Be Actionable** - Write in a way that helps future Claude sessions
4. **Include Context** - Add brief explanations for non-obvious items

**Memory Value Templates:**

| Suggestion Type | Template | Example |
|-----------------|----------|---------|
| `important-files` | `Core files: {file1} ({purpose}), {file2} ({purpose})` | `Core files: src/auth/login.ts (auth logic), src/api/users.ts (user CRUD)` |
| `core-modules` | `Architecture: {dir1}/ ({purpose}), {dir2}/ ({purpose})` | `Architecture: src/auth/ (authentication), src/api/ (REST endpoints)` |
| `dev-workflow` | `Dev: {cmd1}, Test: {cmd2}, Build: {cmd3}` | `Dev: npm run dev, Test: npm test, Build: npm run build` |
| `testing-approach` | `Tests: {runner} in {location}, run with {command}` | `Tests: vitest in src/__tests__/, run with npm test` |
| `deploy-process` | `Deploy: {build_cmd} then {deploy_method}` | `Deploy: npm run build then vercel --prod` |
| `new-packages` | `Added: {pkg1} ({desc}), {pkg2} ({desc})` | `Added: zod (validation), react-query (data fetching)` |

**Example Drafts:**

```
DETECTED: File src/auth/login.ts edited 7 times
DRAFTED:  "Core auth file handling user login, token generation, and session creation"

DETECTED: npm install zod @tanstack/react-query
DRAFTED:  "Added zod (schema validation) and @tanstack/react-query (server state management)"

DETECTED: Commands npm test (5x), npm run dev (8x), git commit (4x)
DRAFTED:  "Workflow: dev server with 'npm run dev', test with 'npm test', commit frequently"

DETECTED: Directory src/components/ has 12 file edits
DRAFTED:  "UI components in src/components/ - Button, Modal, Form, Layout are most active"
```

**Intelligent Inference:**

When drafting, infer purpose from file/directory names:

| Pattern | Inferred Purpose |
|---------|------------------|
| `*/auth/*`, `*/login*`, `*/session*` | Authentication |
| `*/api/*`, `*/routes/*`, `*/endpoints/*` | API layer |
| `*/components/*`, `*/ui/*` | UI components |
| `*/hooks/*` | Custom React hooks |
| `*/utils/*`, `*/helpers/*`, `*/lib/*` | Utilities |
| `*/store/*`, `*/state/*` | State management |
| `*/types/*`, `*.d.ts` | Type definitions |
| `*/tests/*`, `*/__tests__/*`, `*.test.*` | Testing |
| `*/middleware/*` | Request middleware |
| `*/services/*` | Business logic |
| `*/models/*`, `*/entities/*` | Data models |
| `*/config/*`, `*.config.*` | Configuration |

**Quality Checks:**

Before finalizing a drafted memory:

```
CHECK 1: Is it under 200 characters? (Prefer concise)
CHECK 2: Does it contain specific names? (No vague references)
CHECK 3: Would it help a new session understand the project? (Useful)
CHECK 4: Is it different from existing memories? (No duplicates)
```

If a draft is too long, summarize:
```
BEFORE: "The authentication system uses src/auth/login.ts for handling user
        login requests, src/auth/register.ts for new user registration,
        src/auth/logout.ts for session termination, and src/middleware/auth.ts
        for protecting routes"

AFTER:  "Auth: login.ts (login), register.ts (signup), logout.ts (signout),
        middleware/auth.ts (route protection)"
```

### Step 4: Generate Suggestions

Based on analysis and smart drafting, create memory suggestions:

**Suggestion Types:**

1. **Important Files**
```
Suggestion: important-files
Value: The most frequently modified files in this project are:
  - src/auth/login.ts (7 edits)
  - src/api/users.ts (5 edits)
  - src/utils/helpers.ts (4 edits)
Reason: These files are central to your work and likely contain core logic.
```

2. **Project Structure**
```
Suggestion: core-modules
Value: Key dir