@champpaba/claude-agent-kit 3.0.2 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/.claude/CHANGELOG.md +527 -0
  2. package/.claude/CLAUDE.md +98 -586
  3. package/.claude/agents/_shared/pre-work-checklist.md +53 -0
  4. package/.claude/commands/csetup.md +65 -0
  5. package/.claude/commands/cview.md +364 -364
  6. package/.claude/contexts/design/accessibility.md +611 -611
  7. package/.claude/contexts/design/layout.md +400 -400
  8. package/.claude/contexts/design/responsive.md +551 -551
  9. package/.claude/contexts/design/shadows.md +522 -522
  10. package/.claude/contexts/design/typography.md +465 -465
  11. package/.claude/contexts/domain/README.md +164 -164
  12. package/.claude/contexts/patterns/agent-coordination.md +388 -388
  13. package/.claude/contexts/patterns/development-principles.md +513 -513
  14. package/.claude/contexts/patterns/error-handling.md +478 -478
  15. package/.claude/contexts/patterns/logging.md +424 -424
  16. package/.claude/contexts/patterns/tdd-classification.md +516 -516
  17. package/.claude/contexts/patterns/testing.md +413 -413
  18. package/.claude/lib/tdd-classifier.md +345 -345
  19. package/.claude/lib/validation-gates.md +484 -484
  20. package/.claude/settings.local.json +42 -42
  21. package/.claude/templates/PROJECT_STATUS.template.yml +16 -41
  22. package/.claude/templates/context-template.md +45 -45
  23. package/.claude/templates/flags-template.json +42 -42
  24. package/.claude/templates/phases-sections/accessibility-test.md +17 -17
  25. package/.claude/templates/phases-sections/api-design.md +37 -37
  26. package/.claude/templates/phases-sections/backend-tests.md +16 -16
  27. package/.claude/templates/phases-sections/backend.md +37 -37
  28. package/.claude/templates/phases-sections/business-logic-validation.md +16 -16
  29. package/.claude/templates/phases-sections/component-tests.md +17 -17
  30. package/.claude/templates/phases-sections/contract-backend.md +16 -16
  31. package/.claude/templates/phases-sections/contract-frontend.md +16 -16
  32. package/.claude/templates/phases-sections/database.md +35 -35
  33. package/.claude/templates/phases-sections/e2e-tests.md +16 -16
  34. package/.claude/templates/phases-sections/fix-implementation.md +17 -17
  35. package/.claude/templates/phases-sections/frontend-integration.md +18 -18
  36. package/.claude/templates/phases-sections/manual-flow-test.md +15 -15
  37. package/.claude/templates/phases-sections/manual-ux-test.md +16 -16
  38. package/.claude/templates/phases-sections/refactor-implementation.md +17 -17
  39. package/.claude/templates/phases-sections/refactor.md +16 -16
  40. package/.claude/templates/phases-sections/regression-tests.md +15 -15
  41. package/.claude/templates/phases-sections/responsive-test.md +16 -16
  42. package/.claude/templates/phases-sections/script-implementation.md +43 -43
  43. package/.claude/templates/phases-sections/test-coverage.md +16 -16
  44. package/.claude/templates/phases-sections/user-approval.md +14 -14
  45. package/LICENSE +21 -21
  46. package/package.json +1 -1
package/.claude/CLAUDE.md CHANGED
@@ -302,558 +302,35 @@ User: "Build login system"
302
302
 
303
303
  ---
304
304
 
305
- ## 🆕 v3.0.0: Template-Free Architecture (Task Analyzer v2.0)
305
+ ## 📜 Version History
306
306
 
307
- **Problem Solved:** Phase templates (`phase-templates.json`) were limiting and caused task loss. When `tasks.md` had 5 detailed phases but template had only 2, tasks disappeared. Templates overrode the single source of truth.
307
+ > **Full changelog with technical details, code examples, and migration guides:**
308
+ > See [`.claude/CHANGELOG.md`](./CHANGELOG.md)
308
309
 
309
- **Solution:** Delete templates entirely. Use AI-driven Task Analyzer to transform `tasks.md` (WHAT) into `phases.md` (HOW).
310
-
311
- ### Key Changes
312
-
313
- | Component | Before (v2.x) | After (v3.0) |
314
- |-----------|---------------|--------------|
315
- | phases.md source | phase-templates.json | tasks.md (single source of truth) |
316
- | Agent assignment | Keyword matching | AI context understanding |
317
- | Missing best practices | Warning prompts | Auto-add automatically |
318
- | Complex tasks | Same as simple | Incremental milestones |
319
- | Task filtering | Templates filter tasks | No filtering, ALL tasks kept |
320
-
321
- ### How It Works
322
-
323
- ```
324
- tasks.md (WHAT to build)
325
-
326
- Step 1: Parse ALL tasks (no filtering)
327
- Step 2: AI-driven analysis (complexity, risk, agent, dependencies)
328
- Step 3: Auto-add best practices (no warnings)
329
- Step 4: Generate incremental milestones
330
- Step 5: Sort by priority (phase order → dependencies → risk)
331
-
332
- phases.md (HOW to build incrementally)
333
- ```
334
-
335
- ### AI-Driven Analysis (vs Keyword Matching)
336
-
337
- **Old (keyword matching):**
338
- ```
339
- "Create user service that connects to database"
340
- Keywords: "service" (backend), "connects" (frontend), "database" (database)
341
- → Conflict! Which agent?
342
- ```
343
-
344
- **New (AI decision):**
345
- ```
346
- "Create user service that connects to database"
347
- → AI understands: This is a backend service layer
348
- → Agent: backend ✓
349
- ```
350
-
351
- ### Auto-Add Best Practices (No Warnings)
352
-
353
- | Condition | Auto-Added Task |
354
- |-----------|-----------------|
355
- | HIGH risk task | Checkpoint: Verify before proceeding |
356
- | External API | Error handling + retry + timeout |
357
- | Implementation (complexity ≥ 5) | Verification task |
358
- | Database changes | Backup + rollback test |
359
- | Security-critical | Security review + log check |
360
-
361
- ### Incremental Milestones
362
-
363
- Complex tasks (risk=HIGH OR complexity≥7) get automatic milestones:
364
-
365
- | Pattern | Strategy | Milestones |
366
- |---------|----------|------------|
367
- | Repository/Service | method-by-method | 1 method → half → all |
368
- | External API | mock-to-real | mock → 1 real → errors → scale |
369
- | Batch Processing | scale-up | 1 → 5 → 20 → full |
370
- | Complex Form | field-by-field | architecture → e2e → all fields |
371
-
372
- ### Files Changed
373
-
374
- | File | Change |
375
- |------|--------|
376
- | `phase-templates.json` | **DELETED** |
377
- | `task-analyzer.md` | Complete rewrite (v2.0) - 666 lines |
378
- | `csetup.md` | Remove Steps 3-4 (keyword/template), new Step 3 (Task Analyzer) |
379
-
380
- ### Migration
381
-
382
- No migration needed. Just run `/csetup` - it will generate phases.md from tasks.md directly.
383
-
384
- ---
385
-
386
- ## 🆕 v2.8.0: Critical Flow Injection
387
-
388
- **Problem Solved:** Research layers are flexible and context-dependent, but security/compliance items are non-negotiable. Previously, critical requirements like password hashing, PCI-DSS compliance, or HIPAA regulations could be missed if research didn't surface them.
389
-
390
- **Solution:** Auto-inject critical required items into research layers based on change analysis.
391
-
392
- ### How It Works
393
-
394
- ```
395
- /csetup analyzes change:
396
- ├── hasAuth: true → Inject auth security items (7 items)
397
- ├── hasPayment: true → Inject payment security items (5 items)
398
- ├── industryContext: healthcare → Inject HIPAA compliance items (5 items)
399
- └── industryContext: fintech → Inject PCI-DSS compliance items (6 items)
400
-
401
- Research layers (flexible) + Critical items (non-negotiable)
402
- ```
403
-
404
- ### Critical Flow Categories
405
-
406
- | Flow | Layer | Items | Examples |
407
- |------|-------|-------|----------|
408
- | Auth | Security | 7 | Password hashing (bcrypt/argon2), JWT secure storage, session timeout |
409
- | Payment | Security | 5 | PCI key security, no card storage, webhook signature verification |
410
- | Healthcare | Compliance | 5 | PHI encryption, role-based access, audit trail, BAA, breach plan |
411
- | Fintech | Compliance | 6 | Data encryption, key rotation, audit logging, access controls |
412
- | Sensitive Data | Security + Data Architecture | 6 | Encryption at rest/transit, access logging, backup, retention |
413
-
414
- ### Item Structure
415
-
416
- Each critical item has:
417
- ```javascript
418
- {
419
- id: 'auth-password-hash', // Unique identifier
420
- check: '☐ Password hashing...', // Checklist item
421
- why: 'Plain text passwords...', // Explanation
422
- severity: 'critical' // Always 'critical'
423
- }
424
- ```
425
-
426
- ### Files Changed
427
-
428
- | File | Change |
429
- |------|--------|
430
- | `tests/helpers.js` | `CRITICAL_FLOWS` constant + `injectCriticalRequiredItems()` function |
431
- | `csetup.md` Step 2.6 | Calls `injectCriticalRequiredItems()` for each layer |
432
-
433
- ---
434
-
435
- ## 🆕 v2.7.0: UX Testing Agent (Persona-Based)
436
-
437
- **Problem Solved:** UI was approved by developers, not real users. No validation that the UI actually converts customers before spending time on backend development.
438
-
439
- **Solution:** Auto-inject Phase 1.5 (ux-tester) after uxui-frontend with approval gate workflow.
440
-
441
- ### How It Works
442
-
443
- ```
444
- Phase 1: uxui-frontend (build UI)
445
-
446
- Phase 1.5: ux-tester (approval gate)
447
- → Auto-generate personas from product context
448
- → Test each persona via Chrome DevTools
449
- → Calculate weighted conversion prediction
450
- → Generate UX test report
451
- → PAUSE for user approval
452
-
453
- [User approves] → Phase 2: backend + database
454
- [User rejects] → Loop back to Phase 1 with feedback
455
- ```
456
-
457
- ### Key Features
458
-
459
- | Feature | Description |
310
+ **Recent versions:**
311
+ | Version | Key Feature |
460
312
  |---------|-------------|
461
- | **Auto-Generated Personas** | 3-5 personas with % breakdown based on product context |
462
- | **Weighted Conversion** | Calculate purchase likelihood weighted by customer % |
463
- | **Chrome DevTools Testing** | Screenshots, snapshots, click tests, mobile responsive |
464
- | **Approval Gate** | PAUSE and wait for user approve/reject |
465
- | **Rejection Loop** | Feedback passed to uxui-frontend, re-run Phase 1 → 1.5 |
466
-
467
- ### Files Changed
468
-
469
- | File | Change |
470
- |------|--------|
471
- | `.claude/agents/07-ux-tester.md` | New agent for persona-based UX testing |
472
- | `.claude/templates/phases-sections/ux-testing.md` | Phase template with approval gate |
473
- | `.claude/lib/task-analyzer.md` | **v2.0:** Complete rewrite - template-free, AI-driven |
474
- | `.claude/lib/agent-executor.md` | Approval gate execution logic |
475
- | `.claude/commands/cdev.md` | Step 4.6 approval gate handling |
476
-
477
- ### UX Test Report Example
478
-
479
- ```markdown
480
- # UX Test Report
481
-
482
- ## Personas Tested
483
- | Persona | % ลูกค้า | Would Buy | Weighted |
484
- |---------|----------|-----------|----------|
485
- | นักศึกษา 18-24 | 40% | Maybe (50%) | +20% |
486
- | พนักงาน 25-35 | 35% | Yes (100%) | +35% |
487
- | ผู้สูงวัย 50-65 | 15% | No (0%) | +0% |
488
- | ผู้ปกครอง 35-50 | 10% | Maybe (50%) | +5% |
489
-
490
- ## Conversion Prediction: 60%
491
- ## Potential After Fixes: 92.5%
492
- ```
493
-
494
- ---
495
-
496
- ## 🆕 v2.5.0: Smart Topic Query + Integration Risk Detection
497
-
498
- **Problem Solved:** Context7 queries used static topic "best practices" which missed adapter/integration documentation. Example: Drizzle + Auth.js requires specific column naming (snake_case) but this wasn't detected, causing runtime errors.
499
-
500
- **Solution:** Smart Topic Query includes other library names in topic + automatic integration risk detection.
501
-
502
- ### How Smart Topic Query Works
503
-
504
- ```
505
- Old (v2.4.0):
506
- topic: "best practices, patterns, anti-patterns, common mistakes"
507
- → Misses adapter-specific docs
508
-
509
- New (v2.5.0):
510
- topic: "best practices, patterns, adapter, integration, schema, {other-lib-names}"
511
- → Gets cross-library integration docs automatically
512
- ```
513
-
514
- ### Key Features
515
-
516
- | Feature | Description |
517
- |---------|-------------|
518
- | **Smart Topic** | Includes other detected library names in Context7 topic |
519
- | **Bidirectional Query** | Query BOTH libraries (Auth.js → Drizzle, Drizzle → Auth.js) |
520
- | **Risk Pattern Detection** | Scans docs for adapter, schema, column, sync, webhook patterns |
521
- | **INTEGRATION_RISKS.md** | Auto-generated summary of detected integration concerns |
522
- | **Zero Maintenance** | No hardcoded library pairs - works with any combination |
523
-
524
- ### Integration Risk Patterns Detected
525
-
526
- | Pattern | Keywords | Example |
527
- |---------|----------|---------|
528
- | Adapter | adapter, drizzleadapter, prismaadapter | ORM + Auth integrations |
529
- | Schema | column, snake_case, camelcase, mapping | Column naming mismatches |
530
- | Sync | sync, migrate, syncurl, embedded replica | Mobile/Edge data sync |
531
- | Webhook | webhook, webhookendpoint | Payment/notification handlers |
532
- | Lifecycle | beforeall, aftereach, setup, teardown | Test configuration |
533
-
534
- ### Output Files
535
-
536
- | File | Content |
537
- |------|---------|
538
- | `best-practices/{lib}.md` | Library-specific best practices (enhanced with integration docs) |
539
- | `best-practices/INTEGRATION_RISKS.md` | Cross-library risk summary + checklist |
540
-
541
- ### Example Flow
542
-
543
- ```
544
- Detected: [drizzle, auth.js, stripe]
545
-
546
- Query drizzle with topic: "best practices, adapter, integration, auth.js, stripe"
547
- → Gets: Drizzle adapter patterns, column naming
548
-
549
- Query auth.js with topic: "best practices, adapter, integration, drizzle, stripe"
550
- → Gets: DrizzleAdapter config, usersTable/accountsTable schema
551
-
552
- Query stripe with topic: "best practices, adapter, integration, drizzle, auth.js"
553
- → Gets: Webhook patterns, payment integration
554
-
555
- Risk Detection:
556
- → auth.js mentions "drizzleadapter", "userstable" → SCHEMA pattern
557
- → stripe mentions "webhook", "webhooksecret" → WEBHOOK pattern
558
-
559
- Output:
560
- → drizzle.md (with auth.js integration info)
561
- → auth-js.md (with Drizzle adapter config)
562
- → stripe.md (with webhook patterns)
563
- → INTEGRATION_RISKS.md (summary of all detected risks)
564
- ```
565
-
566
- ### Files Changed
567
-
568
- | File | Change |
569
- |------|--------|
570
- | `csetup.md` Step 2.7 | Smart Topic Query implementation |
571
- | `detectIntegrationRisks()` | New: Pattern detection from docs |
572
- | `generateIntegrationRiskSummary()` | New: INTEGRATION_RISKS.md output |
573
-
574
- ---
575
-
576
- ## 🆕 v2.4.0: Adaptive Depth Research
577
-
578
- **Problem Solved:** Previous feature detection was hardcoded (only 4 types: auth, payment, fileUpload, apiDesign) and used fixed standards. Missing domain-level best practices like "how to design a good database" or "healthcare compliance requirements."
579
-
580
- **Solution:** Dynamic research layers that adapt to each change's complexity (0 to 10+ layers).
581
-
582
- ### Key Principles
583
-
584
- | Principle | Description |
585
- |-----------|-------------|
586
- | L1 = Best Practice (ALWAYS) | "คนอื่นทำกันยังไง?" (How do others do it?) for ALL non-trivial changes |
587
- | Dynamic Depth | No fixed min/max - truly adaptive (0-10+ layers) |
588
- | Separation of Concerns | Visual (/designsetup) is STATIC, Strategy (research) is DYNAMIC |
589
- | Per-Change Output | Generates `research-checklist.md` for each change |
590
- | Design Conflict Warnings | Warns if industry practice conflicts with user's design choices |
591
-
592
- ### Layer Examples by Change Type
593
-
594
- | Change Type | Layers | Example Layers |
595
- |-------------|--------|----------------|
596
- | Typo fix, debug log | 0 | None needed |
597
- | Simple API endpoint | 2 | Best Practice, API Design |
598
- | Auth system | 4 | Best Practice, Security, API Design, Testing |
599
- | E-commerce checkout | 7 | Best Practice, Security, UX, Payment, Integration, Performance, Testing |
600
- | Healthcare portal | 10 | Best Practice, Security, Compliance (HIPAA), UX, Data Architecture, API, Performance, Testing, Integration, Audit |
601
-
602
- ### Knowledge Sources (Separated)
603
-
604
- | Step | Knowledge Type | Source | Example |
605
- |------|----------------|--------|---------|
606
- | **2.6** | Domain (HOW to design) | Claude's Knowledge | Normalization, UX patterns, Security |
607
- | **2.7** | Stack (HOW to use tool) | Context7 | Prisma, React, Next.js |
608
-
609
- ### How It Works
610
-
611
- ```
612
- 1. Analyze change from proposal.md, tasks.md, design.md
613
- → Detect: primaryType, complexity, riskLevel, domains, features
614
-
615
- 2. Determine research layers dynamically:
616
- - Trivial (complexity ≤ 1, no UI/API/DB) → 0 layers
617
- - Non-trivial → L1 Best Practice + context-specific layers
618
-
619
- 3. Execute research per layer using Claude's knowledge:
620
- - Claude knows: UX (Nielsen Norman, Baymard), DB (Codd), Security (OWASP)
621
- - No static files needed - Claude reasons from training
622
- - No WebSearch needed - domain knowledge is stable
623
-
624
- 4. Generate research-checklist.md with:
625
- - Key questions per layer
626
- - Best practices (from Claude's knowledge)
627
- - Anti-patterns to avoid
628
- - Trade-offs explained
629
- - Recommendations specific to THIS change
630
-
631
- 5. Agents read research-checklist.md before implementing
632
- ```
633
-
634
- **WHY Claude's Knowledge?**
635
- - Domain principles rarely change (Normalization = 50 years, REST = 20 years)
636
- - No maintenance needed (no static files to update)
637
- - Context-aware (Claude applies principles to YOUR specific change)
638
- - Stack knowledge goes to Context7 (Step 2.7) which has live docs
639
-
640
- ### Available Research Layers
641
-
642
- | Layer | Triggered By |
643
- |-------|--------------|
644
- | Best Practice / Industry Standard | Always (non-trivial changes) |
645
- | Security Requirements | hasAuth, hasPayment, hasSensitiveData |
646
- | {Industry} Compliance | healthcare, fintech, or other regulated industries |
647
- | User Experience Patterns | isExternalFacing + hasUI |
648
- | Conversion Psychology | marketing/sales pages |
649
- | Content Strategy | marketing/content pages |
650
- | Data Architecture | hasDatabase, data-intensive |
651
- | API Design | hasAPI |
652
- | Multi-tenancy Patterns | SaaS with tenant isolation |
653
- | Real-time Architecture | WebSocket, collaboration features |
654
- | Performance Optimization | external-facing OR complexity ≥ 6 |
655
- | Integration Patterns | external APIs, webhooks |
656
- | Testing Strategy | HIGH risk OR complexity ≥ 7 |
657
-
658
- ### Files Changed
659
-
660
- | File | Change |
661
- |------|--------|
662
- | `csetup.md` Step 2.6 | Complete rewrite - Adaptive Depth Research |
663
- | `analyzeChangeCharacteristics()` | New: semantic analysis of change context |
664
- | `determineResearchLayers()` | New: dynamic layer selection |
665
- | `executeLayerResearch()` | New: Context7 + semantic research |
666
- | `generateResearchChecklist()` | New: markdown output per change |
667
- | `checkDesignConflicts()` | New: warns on design vs industry fit |
668
-
669
- ### Output Example
670
-
671
- ```markdown
672
- # Research Checklist: healthcare-portal
673
-
674
- > Generated by Adaptive Depth Research (v2.4.0)
675
- > Complexity: 9/10 | Risk: HIGH
676
-
677
- ## Summary
678
-
679
- | Layer | Focus | Status |
680
- |-------|-------|--------|
681
- | L1: Best Practice | How do others implement healthcare? | ⏳ Pending |
682
- | L2: Security Requirements | What security measures? | ⏳ Pending |
683
- | L3: Healthcare Compliance | What HIPAA regulations? | ⏳ Pending |
684
- ...
685
-
686
- ## L1: Best Practice / Industry Standard
687
-
688
- **Focus:** How do others implement healthcare portals?
689
-
690
- ### Key Questions
691
- - [ ] What is the industry standard for healthcare portals?
692
- - [ ] What are common patterns and anti-patterns?
693
- ...
694
- ```
695
-
696
- ---
697
-
698
- ## 🆕 v2.3.0: Zero-Maintenance Tech Stack Detection
699
-
700
- **Problem Solved:** Previously, `/csetup` required hardcoded regex patterns and Context7 ID mappings for each library. Adding support for new libraries (like SQLAlchemy, Pydantic, Rust crates) required code changes.
701
-
702
- **Solution:** Dynamic detection that works with any library in any language without maintenance.
703
-
704
- ### How It Works
705
-
706
- ```
707
- 1. Extract potential library names from ALL text sources:
708
- - Spec files (proposal.md, design.md, tasks.md)
709
- - Package files (package.json, requirements.txt, Cargo.toml, go.mod, etc.)
710
- - Import statements in code snippets
711
- - Prose mentions ("using FastAPI", "with Prisma")
712
-
713
- 2. Send each candidate to Context7 resolve-library-id:
714
- - If Context7 recognizes it → confirmed library ✅
715
- - If not recognized → not a library, skip ❌
716
-
717
- 3. For confirmed libraries, fetch best practices:
718
- - Context7 get-library-docs with "best practices" topic
719
- - Generate .md file with patterns, anti-patterns, checklist
720
-
721
- 4. Result: Best practices for ANY library, automatically!
722
- ```
723
-
724
- ### Benefits
725
-
726
- | Aspect | Before (v1.8.0) | After (v2.3.0) |
727
- |--------|-----------------|----------------|
728
- | New library support | Manual code change | Automatic |
729
- | Python stack | Partial (FastAPI, Django only) | Full (SQLAlchemy, Pydantic, Click, etc.) |
730
- | Rust support | None | Automatic |
731
- | Go support | None | Automatic |
732
- | Maintenance | Required for each library | Zero |
733
-
734
- ### Files Changed
735
-
736
- | File | Change |
737
- |------|--------|
738
- | `csetup.md` Step 2.7 | Complete rewrite with dynamic detection |
739
- | `extractPotentialLibraryNames()` | New helper for NLP extraction |
740
- | `parseContext7Response()` | New helper for Context7 response parsing |
741
- | `generateBestPracticesFile()` | Updated signature, includes Context7 ID |
742
- | `detectAdditionalTech()` | Deprecated, delegates to new system |
743
-
744
- ---
745
-
746
- ## 🆕 v2.0.0: Claude 4.5 Optimization + Design System v2.0
747
-
748
- **Based on:** [Claude 4 Best Practices](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-4-best-practices)
749
-
750
- ### Claude 4.5 Changes Applied
751
-
752
- | Before | After | WHY |
753
- |--------|-------|-----|
754
- | "MUST", "WILL BE REJECTED" | Professional tone | Claude 4.5 works better with respectful instructions |
755
- | "Don't do X", "Never Y" | "Use X instead" | Positive instructions are clearer |
756
- | Rules without context | Rules with WHY | Claude applies rules more intelligently |
757
- | Duplicated content (6x) | Shared `_shared/` folder | 83% token reduction |
758
- | ~1000 lines per agent | ~250-350 lines | 65% smaller |
759
-
760
- ### New Shared Components
761
-
762
- ```
763
- .claude/agents/_shared/
764
- ├── pre-work-checklist.md # Common validation steps
765
- ├── package-manager.md # Package manager protocol
766
- ├── documentation-policy.md # What files to create
767
- ├── agent-boundaries.md # When to use which agent
768
- └── README.md # Overview
769
- ```
770
-
771
- ### Token Savings
772
-
773
- | Agent | Before | After | Reduction |
774
- |-------|--------|-------|-----------|
775
- | uxui-frontend | ~1037 | ~375 | 64% |
776
- | integration | ~600 | ~210 | 65% |
777
- | backend | ~700 | ~244 | 65% |
778
- | database | ~680 | ~273 | 60% |
779
- | frontend | ~650 | ~296 | 54% |
780
- | test-debug | ~580 | ~252 | 57% |
781
- | **Total** | **~4247** | **~1650** | **61%** |
782
-
783
- Plus ~500 tokens in shared files = **~2150 total** (was ~4247)
784
-
785
- ### Best Practices Applied
786
-
787
- 1. **Tone Calibration** - Professional, direct (not aggressive)
788
- 2. **Action Orientation** - Explicit "Write code" vs "Consider"
789
- 3. **Prevent Overengineering** - Clear boundaries
790
- 4. **Encourage Exploration** - Read before implementing
791
- 5. **Rich Output When Needed** - Specify requirements
792
- 6. **Context for Rules** - Explain WHY
793
- 7. **Positive Instructions** - "Use X" not "Don't Y"
794
-
795
- ### Additional Files Refactored
796
-
797
- Beyond the 6 agent files, these supporting files were also updated:
798
-
799
- **Implementation Logic (lib/):**
800
- | File | Changes |
801
- |------|---------|
802
- | `agent-router.md` | Routing table format, removed "CANNOT/forbidden" language |
803
- | `agent-executor.md` | Professional rejection messages, table format |
804
- | `context-loading-protocol.md` | WHY explanations, removed "CRITICAL" warnings |
805
- | `flags-updater.md` | Best practices table, removed "Step 3 CANNOT be skipped" |
806
- | `document-loader.md` | Table format for DO/DON'T sections |
807
- | `detailed-guides/agent-system.md` | Compact table format, shared file references |
808
-
809
- **Commands:**
810
- | File | Changes |
811
- |------|---------|
812
- | `cdev.md` | WHY context for best practices, softer tone |
813
- | `csetup.md` | Best Practices / Anti-Patterns format |
814
- | `pageplan.md` | "Guidelines" instead of "CRITICAL Rules" |
815
- | `designsetup.md` | "Follow this format" instead of "EXACT format" |
816
-
817
- **Patterns (contexts/patterns/):**
818
- | File | Changes |
819
- |------|---------|
820
- | `validation-framework.md` | WHY explanations, removed "🚨" symbols |
821
- | `error-recovery.md` | "⚠️" instead of "🚨", professional escalation format |
822
- | `ui-component-consistency.md` | "Common Issues" instead of "Red Flags" |
823
- | `task-breakdown.md` | Positive framing for incremental approach |
824
- | `agent-discovery.md` | Softer language, "⚠️ Fallback" instead of "🚨" |
825
- | `code-standards.md` | "File Creation Policy" with WHY table |
826
- | `animation-patterns.md` | "⚠️ Common Mistakes" instead of "🚨" |
827
- | `frontend-component-strategy.md` | "⚠️ Anti-Patterns" instead of "🚨" |
828
- | `performance-optimization.md` | "⚠️ Common Mistakes" instead of "🚨" |
829
- | `change-workflow.md` | Table format for read-only files |
830
- | `task-classification.md` | "Agent Capabilities Reference" section title |
831
-
832
- **Design (contexts/design/):**
833
- | File | Changes |
834
- |------|---------|
835
- | `index.md` | "should check" instead of "MUST check" |
836
- | `box-thinking.md` | "⚠️ Common Mistakes" instead of "🚨" |
837
-
838
- **Templates:**
839
- | File | Changes |
840
- |------|---------|
841
- | `phases-sections/frontend-mockup.md` | Table with WHY for design rules |
842
- | `design-context-template.md` | "⚠️ Design Rules" instead of "🚨 Critical" |
843
- | `STYLE_GUIDE.template.md` | "🔧 Troubleshooting" instead of "🚨" |
844
-
845
- **Other lib files:**
846
- | File | Changes |
847
- |------|---------|
848
- | `lib/README.md` | Softer descriptions, "📌 Important" |
849
- | `detailed-guides/taskmaster-analysis.md` | "🔴 HIGH" instead of "🚨 HIGH" |
313
+ | v3.0.0 | Template-Free Architecture (AI-driven Task Analyzer v2.0) |
314
+ | v2.8.0 | Critical Flow Injection (auto-inject security/compliance items) |
315
+ | v2.7.0 | UX Testing Agent (persona-based, approval gate) |
316
+ | v2.5.0 | Smart Topic Query + Integration Risk Detection |
317
+ | v2.4.0 | Adaptive Depth Research (0-10+ dynamic layers) |
318
+ | v2.3.0 | Zero-Maintenance Tech Stack Detection |
319
+ | v2.2.0 | claude-mem Integration |
320
+ | v2.1.0 | Design System v2 (YAML-based) |
321
+ | v2.0.0 | Claude 4.5 Optimization (61% token reduction) |
850
322
 
851
323
  ---
852
324
 
853
- ## 📊 PROJECT_STATUS.yml Protocol (v2.1.0)
325
+ ## 📊 PROJECT_STATUS.yml Protocol (v2.2.0 - claude-mem Integration)
854
326
 
855
327
  **WHY this exists:** New Claude sessions lose context about infrastructure state, blockers, and priorities. This file provides a quick snapshot.
856
328
 
329
+ **v2.2.0 Changes (claude-mem integration):**
330
+ - **REMOVED:** `decisions`, `notes`, `future_ideas` → claude-mem handles automatically
331
+ - **KEPT:** `blockers`, `next_priorities`, `technical_debt` → requires human decision
332
+ - **Query past context:** Just ask naturally → mem-search skill auto-invoked
333
+
857
334
  ### Session Start Behavior
858
335
 
859
336
  If `PROJECT_STATUS.yml` exists in project root:
@@ -873,15 +350,13 @@ Prompt "Update PROJECT_STATUS.yml?" when detecting these patterns:
873
350
  | Infrastructure change (deploy, tunnel, DB migration) | Update `infrastructure` |
874
351
  | User discusses priority shift | Update `next_priorities` |
875
352
  | `/csetup {change-id}` started | Update `current_focus` + **check `pending_followups` for related items** |
876
- | **Future features/ideas:** "อยากให้มี...", "want to add...", "later we should...", "in the future..." | Add to `future_ideas` |
877
353
  | **Technical debt:** "ต้องแก้...", "should refactor...", "tech debt...", "needs cleanup..." | Add to `technical_debt` |
878
- | **Decisions made:** "ตัดสินใจว่า...", "we decided...", "going with...", "chose X over Y" | Add to `decisions` |
879
- | **Learnings/notes:** "พบว่า...", "discovered...", "note:...", "important:..." | Add to `notes` |
880
354
  | **Problems found (by Claude):** "⚠️ ปัญหาที่พบ", "ไม่มี X", "missing X", "not configured" | Add to `technical_debt` or `blockers` |
881
355
  | **Config gaps:** "ไม่ได้ตั้งค่า...", "need to configure...", "should add to CI/CD" | Add to `technical_debt` |
882
356
  | **Sync issues:** "DB not synced", "schema mismatch", "local vs production differs" | Add to `blockers` + `infrastructure` |
883
357
  | **Non-Goal needs follow-up:** design.md has "Non-Goal: X (separate proposal)" | Add to `pending_followups` when archiving |
884
358
  | **Pending resolved:** User creates proposal for pending item | Remove from `pending_followups` |
359
+ | ~~**Future ideas, Decisions, Notes**~~ | **REMOVED** - claude-mem handles automatically |
885
360
 
886
361
  ### Update Protocol
887
362
 
@@ -906,68 +381,105 @@ Claude: "Update PROJECT_STATUS.yml?
906
381
  # After archiving
907
382
  Claude: "Auth-system archived. Add to completed_changes?"
908
383
 
909
- # Casual conversation - future idea
910
- User: "อยากให้มี dark mode ด้วยนะ ไว้ทำทีหลัง"
911
- Claude: "Add to PROJECT_STATUS.yml future_ideas?
912
- - idea: Dark mode support
913
- - context: User requested, low priority"
914
-
915
- # Discussion - technical debt
384
+ # Discussion - technical debt (still tracked in PROJECT_STATUS)
916
385
  User: "ตรงนี้ code มันซ้ำๆ ต้องแก้ทีหลัง"
917
386
  Claude: "Add to PROJECT_STATUS.yml technical_debt?
918
387
  - item: Refactor duplicated code in auth middleware
919
388
  - priority: medium"
920
389
 
921
- # Decision made
922
- User: "ตัดสินใจใช้ Drizzle แทน Prisma แล้ว เพราะ type-safe กว่า"
923
- Claude: "Add to PROJECT_STATUS.yml decisions?
924
- - decision: Use Drizzle over Prisma
925
- - reason: Better type safety"
926
-
927
390
  # Problem found by Claude during analysis
928
391
  Claude: "⚠️ ปัญหาที่พบ: ไม่มี migration step ใน CI/CD!"
929
392
  Claude: "Add to PROJECT_STATUS.yml?
930
393
  technical_debt:
931
394
  - item: Add DB migration to CI/CD
932
- - reason: Schema not synced between local and VPS
933
395
  - priority: high"
934
396
 
935
- # Config gap discovered
936
- Claude: "Local DB กับ VPS schema ไม่ sync กัน"
937
- Claude: "Add to PROJECT_STATUS.yml?
938
- blockers:
939
- - id: db-schema-sync
940
- - description: Local and VPS DB schemas out of sync
941
- infrastructure.database:
942
- - status: degraded
943
- - notes: Schema mismatch, need migration"
944
-
945
- # Archive with Non-Goals that need follow-up
946
- Claude: "Archiving add-infrastructure-cicd..."
947
- Claude: *reads design.md, finds Non-Goals: "Database migrations (separate proposal)"*
948
- Claude: "Add to PROJECT_STATUS.yml pending_followups?
949
- - item: Database migration strategy
950
- - from_change: add-infrastructure-cicd
951
- - reason: Non-Goal marked 'separate proposal'
952
- - affects: ['any change with DB schema']"
953
-
954
- # /csetup checks pending_followups (Medium aggressiveness)
397
+ # Query past decisions (claude-mem handles this now!)
398
+ User: "เราตัดสินใจเรื่อง database ว่ายังไงมาก่อน?"
399
+ Claude: *auto-invokes mem-search skill*
400
+ Claude: "จากการค้นหา พบ 2 decisions เกี่ยวกับ database:
401
+ - #12345: Chose Drizzle over Prisma (3 days ago)
402
+ - #12340: PostgreSQL over MongoDB (1 week ago)"
403
+
404
+ # Query past learnings (claude-mem handles this now!)
405
+ User: "เราเคยเจอ bug เกี่ยวกับ auth ไหม?"
406
+ Claude: *auto-invokes mem-search skill*
407
+ Claude: "พบ 1 bugfix เกี่ยวกับ auth:
408
+ - #12330: Fixed token refresh race condition"
409
+
410
+ # /csetup checks pending_followups
955
411
  User: "/csetup add-auth-system"
956
412
  Claude: *reads PROJECT_STATUS.yml pending_followups*
957
413
  Claude: "⚠️ Found related pending follow-up:
958
414
  - 'Database migration strategy' (from add-infrastructure-cicd)
959
- - Affects: 'any change with DB schema'
960
-
961
- This change adds DB tables. The migration strategy hasn't been addressed yet.
962
415
 
963
416
  Options:
964
417
  1. Continue anyway (risk: schema sync issues)
965
- 2. Address migration first (create proposal)
966
- 3. Add migration step to this change's scope
418
+ 2. Address migration first
419
+ 3. Add migration step to this change's scope"
420
+ ```
967
421
 
968
- Which approach?"
422
+ ---
423
+
424
+ ## 🧠 claude-mem Integration (v2.2.0)
425
+
426
+ **What is claude-mem?** A Claude Code plugin that automatically captures tool usage observations and provides persistent memory across sessions.
427
+
428
+ ### Division of Responsibilities
429
+
430
+ | Data Type | Source | How to Access |
431
+ |-----------|--------|---------------|
432
+ | Past decisions | claude-mem (auto) | Ask: "what decisions about X?" |
433
+ | Past learnings | claude-mem (auto) | Ask: "what did we learn about X?" |
434
+ | Past bugs/fixes | claude-mem (auto) | Ask: "what bugs with X?" |
435
+ | Future ideas | claude-mem (auto) | Ask: "what ideas for X?" |
436
+ | **Blockers** | PROJECT_STATUS.yml | Read file (requires human decision) |
437
+ | **Priorities** | PROJECT_STATUS.yml | Read file (requires human decision) |
438
+ | **Tech debt** | PROJECT_STATUS.yml | Read file (actionable items) |
439
+ | What to build | tasks.md → phases.md | /csetup generates |
440
+ | How to build | Agents | /cdev executes |
441
+
442
+ ### How claude-mem Works
443
+
444
+ ```
445
+ 1. You work normally (Read, Write, Edit, Bash, etc.)
446
+ → claude-mem captures tool usage automatically
447
+
448
+ 2. Session ends (/clear or exit)
449
+ → claude-mem generates session summary
450
+
451
+ 3. New session starts
452
+ → claude-mem injects recent observations
453
+
454
+ 4. You ask about past work
455
+ → mem-search skill auto-invoked
456
+ ```
457
+
458
+ ### Query Examples
459
+
460
+ ```
461
+ # Query past decisions
462
+ "เราตัดสินใจเรื่อง authentication ยังไง?"
463
+ → Claude auto-invokes mem-search → shows past decisions
464
+
465
+ # Query past bugs
466
+ "เราเคยแก้ bug เกี่ยวกับ token ไหม?"
467
+ → Claude shows past bugfixes
468
+
469
+ # Query implementation details
470
+ "เราทำ pagination ยังไง?"
471
+ → Claude shows past implementation observations
969
472
  ```
970
473
 
474
+ ### Agent Memory Access
475
+
476
+ Agents query claude-mem in STEP 0 before implementation:
477
+ - Check for past decisions about similar components
478
+ - Find previous solutions to similar problems
479
+ - Avoid repeating past mistakes
480
+
481
+ → See: `.claude/agents/_shared/pre-work-checklist.md` Step 0.6
482
+
971
483
  ---
972
484
 
973
485
  **💡 Remember:** This template is universal. Use Context7 for framework-specific docs!