Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:29:41 +08:00
commit 4236420b70
13 changed files with 2222 additions and 0 deletions

199
commands/memory-overview.md Normal file
View File

@@ -0,0 +1,199 @@
---
description: Generate comprehensive project overview from memory store
---
# Memory Overview
Generates a comprehensive overview of the project by analyzing the memory store, git history, CLAUDE.md files, and development patterns. Provides a holistic view of project architecture, business logic, and team conventions.
## What this command generates
1. **Project architecture**: High-level structure and key components
2. **Business logic overview**: Core business rules and workflows
3. **Development patterns**: Established coding conventions and patterns
4. **Technology stack**: Languages, frameworks, and tools used
5. **Team conventions**: Coding standards, commit patterns, branching strategy
6. **Key decisions**: Important architectural and technical decisions
7. **Active areas**: Currently active development areas
8. **Knowledge gaps**: Areas with less documentation or context
## Usage
```
/memory-overview
```
## Options
```
/memory-overview --format=markdown
/memory-overview --format=json
/memory-overview --save-to=PROJECT_OVERVIEW.md
/memory-overview --detailed
```
## Example Output
```
User: /memory-overview
Claude: Project Overview - E-Commerce Platform
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Generated from 247 memories, 150+ commits, 5 CLAUDE.md files
## Architecture Overview
### Frontend (React + TypeScript)
- Component structure: Atomic design pattern
- State management: Redux Toolkit
- Routing: React Router v6
- Styling: Tailwind CSS + CSS Modules
Key directories:
- src/components/ - Reusable UI components
- src/pages/ - Page-level components
- src/store/ - Redux state management
- src/api/ - API client layer
### Backend (Node.js + Express)
- Architecture: RESTful API with service layer pattern
- Database: PostgreSQL with Prisma ORM
- Authentication: OAuth2 + JWT tokens
- File structure: Feature-based modules
Key directories:
- src/api/ - API routes and controllers
- src/services/ - Business logic layer
- src/models/ - Database models
- src/middleware/ - Express middleware
## Business Logic
### Core Workflows
1. **User Authentication** (src/api/auth.ts)
- OAuth2 flow with Google/GitHub
- JWT token-based sessions
- Automatic token refresh
- Documented: CLAUDE.md <!-- AUTH-FLOW -->
2. **Product Catalog** (src/services/products.ts)
- Dynamic pricing rules
- Inventory management
- Category hierarchy
- Search with Elasticsearch
3. **Order Processing** (src/services/orders.ts)
- Multi-step checkout flow
- Payment integration (Stripe)
- Order fulfillment pipeline
- Email notifications
## Development Patterns
### Coding Conventions
- TypeScript strict mode enabled
- ESLint + Prettier for code formatting
- Functional components with hooks
- Error handling: Standardized error codes
- Testing: Jest + React Testing Library
### Commit Patterns
- Conventional commits (feat:, fix:, docs:, etc.)
- Branch naming: feature/, bugfix/, hotfix/
- PR requirements: Tests + review
- Squash merges to main
### Key Decisions
1. **Why PostgreSQL over MongoDB?** (3 months ago)
- Decision: Use PostgreSQL for ACID compliance
- Reasoning: Complex relationships, transactions needed
- Team consensus in session mem-2024-10-15-xyz
2. **OAuth2 Authentication** (2 months ago)
- Decision: Implement OAuth2 instead of basic auth
- Reasoning: Better security, SSO support, industry standard
- Implementation: src/api/auth.ts
3. **Service Layer Pattern** (1 month ago)
- Decision: Separate business logic from API routes
- Reasoning: Better testability, code organization
- Pattern: src/services/*
## Active Development Areas
Current sprint focus:
- 🔥 Payment integration (Stripe)
- 🔥 Admin dashboard redesign
- 📝 API documentation (OpenAPI)
- 🧪 E2E test coverage improvement
Recent commits (last 7 days):
- 15 commits on payment features
- 8 commits on admin UI
- 5 commits on testing
## Team Conventions
### CLAUDE.md Anchor Comments
- <!-- AUTH-FLOW --> - Authentication patterns
- <!-- API-SECURITY --> - API security guidelines
- <!-- DB-SCHEMA --> - Database schema decisions
- <!-- ERROR-HANDLING --> - Error handling conventions
- <!-- TESTING-GUIDE --> - Testing best practices
### Code Review Guidelines
- Minimum 1 approval required
- Tests must pass
- No console.logs in production code
- Update CLAUDE.md for new patterns
## Knowledge Gaps
Areas needing more documentation:
⚠️ Payment webhook handling
⚠️ Database backup strategy
⚠️ Deployment pipeline
⚠️ Performance monitoring setup
## Statistics
- Total files: 450+
- Lines of code: ~85,000
- Test coverage: 78%
- Team size: 5 developers
- Project age: 6 months
- Last major refactor: 2 weeks ago
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
This overview is continuously updated as development progresses.
Last updated: 5 minutes ago
Next sync: Automatic on session end
```
## Use Cases
### For New Team Members
```
/memory-overview --save-to=ONBOARDING.md
```
Creates a comprehensive onboarding document.
### For Documentation
```
/memory-overview --format=markdown > PROJECT_OVERVIEW.md
```
Generates markdown documentation.
### For Stakeholder Updates
```
/memory-overview --format=json | jq '.active_areas'
```
Extracts specific sections for reports.
## Related Commands
- `/memory-sync` - Sync current state to memory
- `/memory-status` - View tracking status
- `/memory-context` - Retrieve specific context

157
commands/memory-recall.md Normal file
View File

@@ -0,0 +1,157 @@
---
description: Retrieve relevant context from memory store for current work
---
# Memory Recall
Retrieves relevant development context, patterns, and team knowledge from the memory store based on your query or current task.
## What this command does
1. **Searches memory store**: Finds relevant past work and decisions
2. **Shows similar implementations**: Displays patterns used in similar contexts
3. **Retrieves team knowledge**: Surfaces insights from other team members
4. **Suggests best practices**: Recommends patterns based on project history
5. **Warns about deviations**: Alerts if current approach differs from established patterns
## Usage
```
/memory-recall [query]
```
## Examples
### Query Authentication Patterns
```
/memory-recall authentication flow
```
**Returns:**
- OAuth2 implementation pattern (src/api/auth.ts:45)
- Past decisions about auth approach
- Token refresh strategy
- Error handling conventions
- Related team decisions
### Find Database Decisions
```
/memory-recall why did we choose PostgreSQL
```
**Returns:**
- Decision reasoning (ACID compliance)
- Rejected alternatives (MongoDB, etc.)
- When decided (Nov 13, 2025)
- Stakeholders (Security Team)
- Related constraints
### Retrieve Error Handling Patterns
```
/memory-recall error handling in API
```
**Returns:**
- Established error patterns
- Standardized error codes
- Logging conventions
- Team practices
- Example implementations
### Get Team Expertise
```
/memory-recall who knows about frontend
```
**Returns:**
- Ownership map (Bob: 90% frontend commits)
- Expertise areas
- Recent work
- Best person to ask
## Example Output
```
/memory-recall authentication patterns
📋 Retrieved Context from Memory Store
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Authentication Implementation (3 relevant memories)
1. OAuth2 Flow Pattern (2 weeks ago)
- Location: src/api/auth.ts:45
- Decision: OAuth2 password flow for all auth
- Reasoning: PCI compliance requirement
- Context: <!-- AUTH-FLOW --> in CLAUDE.md
2. Token Refresh Strategy (1 week ago)
- Pattern: Automatic refresh before expiration
- Implementation: src/utils/tokenManager.ts:78
- Edge cases: Network failures, concurrent requests
3. Error Handling (3 days ago)
- Pattern: Standardized auth error codes
- Location: src/types/errors.ts:23
- Used by: All authentication endpoints
Related Patterns:
- Session management: src/api/sessions.ts
- User permissions: src/middleware/permissions.ts
- API security: See CLAUDE.md
Suggested Actions:
1. Follow OAuth2 pattern in src/api/auth.ts
2. Use standardized error codes
3. Update documentation with any new patterns
```
## When to Use
- ✅ Starting new feature (check similar work)
- ✅ Making decisions (review past choices)
- ✅ Code reviews (understand context)
- ✅ Bug fixing (see similar issues)
- ✅ Onboarding (learn project patterns)
## Automatic vs Manual
**Automatic Recall** (happens during conversation):
- Claude retrieves context automatically
- No command needed
- Happens every 5-10 messages
- Triggered by keywords
**Manual Recall** (this command):
- Explicit context retrieval
- Specific queries
- Detailed results
- On-demand information
## Advanced Usage
### Filter by Time
```
/memory-recall --since="1 week" database changes
```
### Filter by Author
```
/memory-recall --author=alice backend patterns
```
### Include Commits
```
/memory-recall --with-commits authentication
```
## Related Commands
- `/memory-record "info"` - Store new memories
- `/memory-overview` - Full project overview
- `/memory-status` - Current session stats
- `/memory-ownership [person]` - Team expertise map
## Note
Most context retrieval happens **automatically** during conversations. Use `/memory-recall` when you want specific, detailed information on demand.

72
commands/memory-status.md Normal file
View File

@@ -0,0 +1,72 @@
---
description: View current memory tracking status and statistics
---
# Memory Status
Displays the current session tracking status, showing what files have been modified, commits analyzed, and context stored during this session.
## What this command shows
1. **Session information**: Current session ID, duration, and start time
2. **Files tracked**: List of files modified in this session
3. **Commits analyzed**: Recent commits that have been processed
4. **Context stored**: Number of memories recorded
5. **Memory store statistics**: Total memories, last sync time
## Usage
```
/memory-status
```
## Options
```
/memory-status --detailed
/memory-status --json
```
## Example Output
```
User: /memory-status
Claude: Memory Tracking Status
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Session Information:
Session ID: mem-2025-01-15-abc123
Duration: 2h 45m
Started: 2025-01-15 09:30:00
Files Tracked (8):
✓ src/api/auth.ts - Modified 15 minutes ago
✓ src/components/Login.tsx - Modified 20 minutes ago
✓ tests/auth.test.ts - Created 30 minutes ago
✓ CLAUDE.md - Updated anchor comments
... (4 more files)
Commits Analyzed (3):
✓ feat: add OAuth2 authentication flow
✓ test: add auth integration tests
✓ docs: update CLAUDE.md with auth patterns
Context Stored:
- 12 development decisions recorded
- 5 pattern implementations tracked
- 3 business logic rules captured
Memory Store:
Total memories: 247
Last sync: 5 minutes ago
Status: ✓ Connected
Next automatic sync: in 10 minutes
```
## Related Commands
- `/memory-sync` - Manually sync to memory
- `/memory-context` - Retrieve relevant context
- `/memory-overview` - Generate project overview