chore: update claude configuration and rules from tzj/vs_offload

- Add /sc:git command with smart commit functionality
- Add /sc:ultra-think command for deep thinking
- Update .claude/rules/ with improved documentation:
  - commands.md: command usage guidelines
  - doc-management.md: documentation policy
  - no-extra-docs.md: documentation creation policy
  - gpu-testing.md: GPU type detection and testing rules
- Update .claude/settings.json with claude-flow MCP configuration

这些改进提供了更好的开发体验和工具支持。
This commit is contained in:
Zijie Tian
2026-01-18 18:56:49 +08:00
parent 1a78ae74d5
commit d1bbb7efe2
6 changed files with 555 additions and 28 deletions

View File

@@ -1,20 +1,16 @@
# Commands
## Installation
## Running (with PYTHONPATH)
```bash
pip install -e .
```
## Running
For multi-instance development, use PYTHONPATH instead of pip install:
```bash
# Run example
python example.py
PYTHONPATH=/path/to/nano-vllm:$PYTHONPATH python example.py
# Run benchmarks
python bench.py # Standard benchmark
python bench_offload.py # CPU offload benchmark
PYTHONPATH=/path/to/nano-vllm:$PYTHONPATH python bench.py
PYTHONPATH=/path/to/nano-vllm:$PYTHONPATH python bench_offload.py
```
## Config Defaults

View File

@@ -0,0 +1,105 @@
# Documentation Management
## CLAUDE.md Content Policy
**CLAUDE.md should only contain operational requirements:**
- Environment setup (PYTHONPATH, GPU mutex)
- Execution requirements (how to run tests/benchmarks)
- Quick configuration reference
- Documentation index (links to detailed docs)
**Technical details should go to docs/:**
- Architecture and design explanations
- Implementation details and code flows
- Debugging techniques
- Memory analysis and profiling
- Algorithm explanations
## When Adding New Technical Content
Follow this workflow:
### Step 1: Analyze and Document
If doing technical analysis (e.g., memory profiling):
1. Calculate theoretical values using formulas
2. Run actual tests to measure real values
3. Compare theoretical vs actual (expect < 10% error for valid models)
4. Document findings with both theory and empirical validation
### Step 2: Create/Update docs/
Create a new doc or update existing one in `docs/`:
```
docs/
├── architecture_guide.md # Core components, design, flows
├── sparse_attention_guide.md # Sparse attention methods
├── layerwise_offload_memory_analysis.md # Memory analysis
├── debugging_guide.md # Debugging techniques
└── <new_topic>_guide.md # New technical topic
```
### Step 3: Update CLAUDE.md Documentation Index
Add entry to the Documentation Index table:
```markdown
| Document | Purpose |
|----------|---------|
| [`docs/new_doc.md`](docs/new_doc.md) | Brief description |
```
### Step 4: Refactor if Needed
If CLAUDE.md grows too large (> 150 lines), refactor:
1. Identify technical details that can be moved
2. Create appropriate doc in docs/
3. Replace detailed content with reference link
4. Keep only operational essentials in CLAUDE.md
## Documentation Structure Template
For new technical docs:
```markdown
# Topic Guide
Brief overview of what this document covers.
## Section 1: Concepts
- Key concepts and terminology
## Section 2: Implementation
- Code locations
- Key methods/functions
## Section 3: Details
- Detailed explanations
- Code examples
## Section 4: Validation (if applicable)
- Theoretical analysis
- Empirical measurements
- Comparison table
```
## Memory Analysis Template
When documenting memory behavior:
```markdown
## Theoretical Calculation
| Component | Formula | Size |
|-----------|---------|------|
| Buffer X | `param1 × param2 × dtype_size` | X MB |
## Empirical Validation
| Metric | Theoretical | Actual | Error |
|--------|-------------|--------|-------|
| Peak memory | X GB | Y GB | Z% |
## Key Findings
1. Finding 1
2. Finding 2
```

View File

@@ -2,39 +2,47 @@
## Do Not Create Unnecessary Documentation
**IMPORTANT**: Do NOT create extra markdown documentation files unless explicitly requested by the user.
**IMPORTANT**: Do NOT create extra markdown documentation files proactively unless:
1. User explicitly requests documentation
2. Refactoring CLAUDE.md to move technical details to docs/ (see `doc-management.md`)
### What NOT to do:
- Do NOT create README files proactively
- Do NOT create analysis documents (*.md) after completing tasks
- Do NOT create tutorial/guide documents
- ❌ Do NOT create summary documents
- Do NOT create README files proactively
- Do NOT create standalone analysis documents after completing tasks
- Do NOT create summary documents without request
### What TO do:
- ✅ Only create documentation when user explicitly asks for it
- ✅ Provide information directly in conversation instead
- Update existing documentation if changes require it
- ✅ Add inline code comments where necessary
- Provide information directly in conversation by default
- When user requests documentation, follow `doc-management.md` workflow
- Update existing docs in `docs/` when code changes affect them
- Keep CLAUDE.md concise (< 150 lines), move technical details to docs/
### Exceptions:
### Documentation Locations:
Documentation is acceptable ONLY when:
1. User explicitly requests "create a README" or "write documentation"
2. Updating existing documentation to reflect code changes
3. Adding inline comments/docstrings to code itself
| Type | Location |
|------|----------|
| Operational requirements | CLAUDE.md |
| Technical details | docs/*.md |
| Code comments | Inline in source |
### Examples:
**Bad** (Don't do this):
**Proactive docs (Don't do)**:
```
User: "Profile the code"
Assistant: [Creates profiling_results.md after profiling]
Assistant: [Creates profiling_results.md without being asked]
```
**Good** (Do this instead):
**On-request docs (Do this)**:
```
User: "Profile the code"
Assistant: [Runs profiling, shows results in conversation]
User: "Profile the code and document the findings"
Assistant: [Runs profiling, creates/updates docs/memory_analysis.md]
```
**Refactoring (Do this)**:
```
User: "CLAUDE.md is too long, refactor it"
Assistant: [Moves technical sections to docs/, updates CLAUDE.md index]
```