Checkpoint: MoE Document Classification System
Checkpoint: MoE Document Classification System
Date: December 28, 2025 Session: 2025-12-28-002 Author: Claude Opus 4.5 + Hal Casteel
Executive Summary
Implemented automatic document classification system using Mixture of Experts (MoE) methodology. The core classification pipeline is fully operational, but automatic hook triggering is blocked by a Claude Code bug (#15585).
Completed Work
1. MoE Classification System Architecture (ADR-023)
Status: ✅ Complete
Created comprehensive ADR documenting the 4-phase classification pipeline:
| Phase | Components | Purpose |
|---|---|---|
| 1. Analysts | 6 specialists (metadata, structural, content, pattern, semantic, path) | Multi-signal analysis |
| 2. Consensus | Weighted voting | Confidence calculation |
| 3. Judges | Consistency, Quality, Domain | Validation (if < 85%) |
| 4. Deep Analysis | SemanticSimilarity, Contextual, ContentReasoning, CrossRef | Edge case resolution |
Location: submodules/ops/coditect-document-management/docs/adrs/approved/ADR-023_moe-document-classification.md
2. Pattern Improvements (100% Accuracy)
Status: ✅ Complete
Tuned detection patterns for all document types:
- Agents: 100% accuracy
- Commands: 100% accuracy
- References: 100% accuracy
- Guides: 100% accuracy
Key improvement: Added frontmatter detection (type:, component_type:) as primary signal with 0.6 weight.
3. /classify Command v2.0
Status: ✅ Complete
Upgraded command to use full MoE classifier with all options:
/classify docs/ -r # Recursive analysis
/classify docs/ -r --update-frontmatter # Auto-add frontmatter
/classify docs/ -r --output report.json # JSON report
/classify docs/ -r --dry-run # Preview mode
/classify docs/ -r --exclude "test_*" # Skip patterns
/classify docs/ -r -v # Verbose logging
Location: commands/classify.md
4. Hook Infrastructure
Status: ✅ Created (⚠️ Not firing due to bug)
Created PostToolUse hook components:
hooks/classify-document.sh- Shell wrapperhooks/classify_document.py- Python handler (simplified classifier)- Hook registered in
~/.claude/settings.json
5. document-classification-patterns Skill
Status: ✅ Complete
Created skill with:
- Classification categories and signals
- Confidence thresholds
- Frontmatter templates for each type
Location: skills/document-classification-patterns/SKILL.md
6. GKE Deployment Guide Classification
Status: ✅ Complete
Classified and added frontmatter to:
submodules/cloud/coditect-cloud-infra/docs/deployment/gke-deployment-guide.md- Type:
guide(95% confidence, AUTO_APPROVED)
Known Issues
PostToolUse Hook Bug (BLOCKING)
Issue: Claude Code bug #15585 - PostToolUse hooks configured correctly but never execute
Impact: Automatic classification on Write/Edit operations does not trigger
Workaround: Use /classify command manually after creating documents
Tracking: https://github.com/anthropics/claude-code/issues/15585
Related Issues: #6305, #3179
Component Inventory
| Component | Path | Status |
|---|---|---|
| ADR-023 | submodules/ops/coditect-document-management/docs/adrs/approved/ADR-023_moe-document-classification.md | ✅ |
| /classify command | commands/classify.md | ✅ |
| Hook shell wrapper | hooks/classify-document.sh | ✅ |
| Hook Python handler | hooks/classify_document.py | ✅ |
| Skill | skills/document-classification-patterns/SKILL.md | ✅ |
| Full MoE classifier | submodules/ops/coditect-document-management/scripts/moe_classifier/ | ✅ |
Commits
| Commit | Repo | Description |
|---|---|---|
ad5f7dc | coditect-document-management | Guide pattern improvements |
98f2c74 | coditect-document-management | ADR-023 MoE classification |
ea650bc2 | coditect-core | Classification system (hooks, command, skill) |
6a66a104 | coditect-core | /classify v2.0 with full MoE |
0766fa3 | coditect-cloud-infra | GKE Deployment Guide with frontmatter |
9deb4821 | rollout-master | Updated submodule pointers |
8d0314b2 | rollout-master | /classify full MoE pointer update |
Remaining Work
Priority 1: Blocked by Bug Fix
| Task | Description | Blocked By |
|---|---|---|
| Auto-classification | PostToolUse hook auto-trigger | Bug #15585 |
| Hook validation | Test hook fires on Write/Edit | Bug #15585 |
Priority 2: Enhancements
| Task | Description | Effort |
|---|---|---|
| Batch frontmatter update | Run /classify --update-frontmatter on all docs | 1 hour |
| Classification report | Generate baseline classification for all CODITECT docs | 2 hours |
| Hook fallback | Implement PreToolUse alternative (may have same bug) | 1 hour |
Priority 3: Future Improvements
| Task | Description | Effort |
|---|---|---|
| Semantic embeddings | Add vector similarity for edge cases | 4 hours |
| Custom type training | Learn new document types from examples | 8 hours |
| CI/CD integration | Auto-classify in GitHub Actions | 2 hours |
| Frontmatter validation | Enforce required fields per type | 2 hours |
Metrics
Classification Accuracy (from testing)
| Document Type | Accuracy | Sample Size |
|---|---|---|
| Agent | 100% | 10 |
| Command | 100% | 10 |
| Reference | 100% | 10 |
| Guide | 100% | 20 |
| Workflow | 95% | 10 |
| ADR | 100% | 5 |
| Skill | 100% | 10 |
Component Counts (Post-Implementation)
{
"agents": 135,
"commands": 148,
"skills": 196,
"scripts": 238,
"hooks": 44,
"workflows": 1152,
"total": 1918
}
How to Test
Manual Classification
# Single file
/classify path/to/file.md
# Directory recursive
/classify docs/ -r
# With frontmatter update
/classify docs/ -r --update-frontmatter
# Dry run
/classify docs/ -r --dry-run
Direct Python Handler
cd submodules/core/coditect-core
python3 hooks/classify_document.py path/to/file.md
Full MoE Classifier
python3 submodules/ops/coditect-document-management/scripts/moe_classifier/classify.py docs/ -r
Next Session Recommendations
- Monitor bug #15585 - Check for fix in Claude Code updates
- Run batch classification -
/classify . -r --update-frontmatteracross docs - Generate classification report - Baseline all CODITECT documents
- Test PreToolUse alternative - May work if PostToolUse is buggy
References
- ADR-023: MoE Document Classification
- /classify command
- document-classification-patterns skill
- Claude Code Bug #15585
Session Context Extracted: 88,428 messages in unified store
Export: 2025-12-28-002.txt
🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com