Quick Reference (30 seconds)
Purpose: Load relevant documentation on-demand based on user intent and context.
Primary Tools:
- WebSearch: Find latest documentation and resources online
- WebFetch: Retrieve specific documentation pages
- Context7 MCP: Access official library documentation (when available)
- Read, Grep, Glob: Search local project documentation
Trigger Patterns:
- User asks specific technical questions
- Technology keywords detected in conversation
- Domain expertise required for task completion
- Implementation guidance needed
Implementation Guide
Intent Detection
The system recognizes documentation needs through several patterns:
Question-Based Triggers:
- When users ask specific implementation questions (e.g., "how do I implement JWT authentication?")
- When users seek best practices or optimization guidance
- When troubleshooting questions arise
Technology-Specific Triggers:
- Detection of framework names: FastAPI, React, PostgreSQL, Docker, Kubernetes
- Detection of library names: pytest, TypeScript, GraphQL, Redis
- Detection of tool names: npm, pip, cargo, maven
Domain-Specific Triggers:
- Authentication and authorization topics
- Database and data modeling discussions
- Performance optimization inquiries
- Security-related questions
Pattern-Based Triggers:
- Implementation requests: "implement", "create", "build"
- Architecture discussions: "design", "structure", "pattern"
- Troubleshooting: "debug", "fix", "error", "not working"
Documentation Sources
The system retrieves documentation from multiple sources in priority order:
Local Project Documentation (Highest Priority):
- Check .moai/docs/ for project-specific documentation
- Check .moai/specs/ for requirements and specifications
- Check README.md for project overview
- Check docs/ directory for comprehensive documentation
Official Documentation Sources:
- Use WebFetch to retrieve official framework documentation
- Use Context7 MCP tools when available for library documentation
- Access technology-specific official websites
Community Resources:
- Use WebSearch to find high-quality tutorials
- Search for Stack Overflow solutions with high vote counts
- Find GitHub discussions for specific issues
Real-Time Web Research:
- Use WebSearch with current year for latest information
- Search for recent best practices and updates
- Find new features and deprecation notices
Loading Strategies
Intent Analysis Process:
- Identify technologies mentioned in user request
- Determine domain areas relevant to the question
- Classify question type (implementation, troubleshooting, conceptual)
- Assess complexity to determine documentation depth needed
Source Prioritization:
- If local documentation exists: Load project-specific docs first
- If official documentation available: Retrieve authoritative sources
- If implementation examples needed: Search community resources
- If latest information required: Perform web research
Context-Aware Caching:
- Cache retrieved documentation within session
- Maintain relevance based on current conversation context
- Remove outdated content when context shifts
- Prioritize frequently accessed documentation
Quality Assessment
Content Quality Evaluation:
- Authority: Official sources receive highest trust
- Recency: Content within 12 months preferred for fast-moving technologies
- Completeness: Documentation with examples ranked higher
- Relevance: Match between content and user intent
Relevance Ranking:
- Calculate match between documentation content and user question
- Weight authority (30%), recency (25%), completeness (25%), relevance (20%)
- Return highest-scoring documentation first
- Indicate confidence level in retrieved information
Practical Workflows
Authentication Implementation Workflow:
- When user asks about authentication: Detect technologies (e.g., FastAPI, JWT)
- Identify domains: authentication, security
- Load FastAPI security documentation via WebFetch
- Search for JWT best practices via WebSearch
- Provide comprehensive guidance with source attribution
Database Optimization Workflow:
- When user asks about query performance: Detect database technology
- Identify domain: performance, optimization
- Load official database documentation
- Search for optimization guides and tutorials
- Provide actionable recommendations with sources
New Technology Adoption Workflow:
- When user introduces unfamiliar technology: Detect technology name
- Load official getting started documentation
- Search for migration guides if applicable
- Find integration patterns with existing stack
- Provide strategic adoption guidance
Error Handling
Network Failures:
- If web search fails: Fall back to cached content
- If WebFetch fails: Use local documentation if available
- Indicate partial results when some sources unreachable
Content Quality Issues:
- If retrieved content seems outdated: Search for newer sources
- If relevance unclear: Ask user for clarification
- If conflicting information found: Present multiple sources with dates
Relevance Mismatches:
- If initial search yields poor results: Refine search query
- If user context unclear: Request clarification before loading
- If documentation gap exists: Acknowledge limitation
Performance Optimization
Caching Strategy:
- Maintain session-level cache for frequently accessed docs
- Keep project-specific documentation in memory
- Evict stale content based on access time
Efficient Loading:
- Load documentation only when explicitly needed
- Avoid preloading all possible documentation
- Use targeted searches rather than broad queries
Batch Processing:
- Combine related searches when possible
- Group documentation requests by technology
- Process multiple sources in parallel when appropriate
Advanced Patterns
Multi-Source Aggregation:
- Combine official documentation with community examples
- Cross-reference multiple authoritative sources
- Synthesize comprehensive answers from diverse materials
Context Persistence:
- Remember documentation loaded earlier in conversation
- Avoid redundant loading of same documentation
- Build cumulative knowledge through session
Proactive Loading:
- Anticipate documentation needs based on conversation flow
- Pre-load related topics when discussing complex features
- Suggest relevant documentation before user asks
Works Well With
Agents:
- workflow-docs: Documentation generation
- core-planner: Documentation planning
- workflow-spec: SPEC documentation
Skills:
- moai-docs-generation: Documentation generation
- moai-workflow-docs: Documentation validation
- moai-library-nextra: Nextra documentation
Commands:
- /moai:3-sync: Documentation synchronization
- /moai:9-feedback: Documentation improvements
1---2name: moai-workflow-jit-docs3description: Enhanced Just-In-Time document loading system that intelligently discovers, loads, and caches relevant documentation based on user intent and project context. Use when users need specific documentation, when working with new technologies, when answering domain-specific questions, or when context indicates documentation gaps.4license: Apache-2.05---67## Quick Reference (30 seconds)89Purpose: Load relevant documentation on-demand based on user intent and context.1011Primary Tools:1213- WebSearch: Find latest documentation and resources online14- WebFetch: Retrieve specific documentation pages15- Context7 MCP: Access official library documentation (when available)16- Read, Grep, Glob: Search local project documentation1718Trigger Patterns:1920- User asks specific technical questions21- Technology keywords detected in conversation22- Domain expertise required for task completion23- Implementation guidance needed2425## Implementation Guide2627### Intent Detection2829The system recognizes documentation needs through several patterns:3031Question-Based Triggers:3233- When users ask specific implementation questions (e.g., "how do I implement JWT authentication?")34- When users seek best practices or optimization guidance35- When troubleshooting questions arise3637Technology-Specific Triggers:3839- Detection of framework names: FastAPI, React, PostgreSQL, Docker, Kubernetes40- Detection of library names: pytest, TypeScript, GraphQL, Redis41- Detection of tool names: npm, pip, cargo, maven4243Domain-Specific Triggers:4445- Authentication and authorization topics46- Database and data modeling discussions47- Performance optimization inquiries48- Security-related questions4950Pattern-Based Triggers:5152- Implementation requests: "implement", "create", "build"53- Architecture discussions: "design", "structure", "pattern"54- Troubleshooting: "debug", "fix", "error", "not working"5556### Documentation Sources5758The system retrieves documentation from multiple sources in priority order:5960Local Project Documentation (Highest Priority):6162- Check .moai/docs/ for project-specific documentation63- Check .moai/specs/ for requirements and specifications64- Check README.md for project overview65- Check docs/ directory for comprehensive documentation6667Official Documentation Sources:6869- Use WebFetch to retrieve official framework documentation70- Use Context7 MCP tools when available for library documentation71- Access technology-specific official websites7273Community Resources:7475- Use WebSearch to find high-quality tutorials76- Search for Stack Overflow solutions with high vote counts77- Find GitHub discussions for specific issues7879Real-Time Web Research:8081- Use WebSearch with current year for latest information82- Search for recent best practices and updates83- Find new features and deprecation notices8485### Loading Strategies8687Intent Analysis Process:8889- Identify technologies mentioned in user request90- Determine domain areas relevant to the question91- Classify question type (implementation, troubleshooting, conceptual)92- Assess complexity to determine documentation depth needed9394Source Prioritization:9596- If local documentation exists: Load project-specific docs first97- If official documentation available: Retrieve authoritative sources98- If implementation examples needed: Search community resources99- If latest information required: Perform web research100101Context-Aware Caching:102103- Cache retrieved documentation within session104- Maintain relevance based on current conversation context105- Remove outdated content when context shifts106- Prioritize frequently accessed documentation107108### Quality Assessment109110Content Quality Evaluation:111112- Authority: Official sources receive highest trust113- Recency: Content within 12 months preferred for fast-moving technologies114- Completeness: Documentation with examples ranked higher115- Relevance: Match between content and user intent116117Relevance Ranking:118119- Calculate match between documentation content and user question120- Weight authority (30%), recency (25%), completeness (25%), relevance (20%)121- Return highest-scoring documentation first122- Indicate confidence level in retrieved information123124### Practical Workflows125126Authentication Implementation Workflow:127128- When user asks about authentication: Detect technologies (e.g., FastAPI, JWT)129- Identify domains: authentication, security130- Load FastAPI security documentation via WebFetch131- Search for JWT best practices via WebSearch132- Provide comprehensive guidance with source attribution133134Database Optimization Workflow:135136- When user asks about query performance: Detect database technology137- Identify domain: performance, optimization138- Load official database documentation139- Search for optimization guides and tutorials140- Provide actionable recommendations with sources141142New Technology Adoption Workflow:143144- When user introduces unfamiliar technology: Detect technology name145- Load official getting started documentation146- Search for migration guides if applicable147- Find integration patterns with existing stack148- Provide strategic adoption guidance149150### Error Handling151152Network Failures:153154- If web search fails: Fall back to cached content155- If WebFetch fails: Use local documentation if available156- Indicate partial results when some sources unreachable157158Content Quality Issues:159160- If retrieved content seems outdated: Search for newer sources161- If relevance unclear: Ask user for clarification162- If conflicting information found: Present multiple sources with dates163164Relevance Mismatches:165166- If initial search yields poor results: Refine search query167- If user context unclear: Request clarification before loading168- If documentation gap exists: Acknowledge limitation169170### Performance Optimization171172Caching Strategy:173174- Maintain session-level cache for frequently accessed docs175- Keep project-specific documentation in memory176- Evict stale content based on access time177178Efficient Loading:179180- Load documentation only when explicitly needed181- Avoid preloading all possible documentation182- Use targeted searches rather than broad queries183184Batch Processing:185186- Combine related searches when possible187- Group documentation requests by technology188- Process multiple sources in parallel when appropriate189190## Advanced Patterns191192Multi-Source Aggregation:193194- Combine official documentation with community examples195- Cross-reference multiple authoritative sources196- Synthesize comprehensive answers from diverse materials197198Context Persistence:199200- Remember documentation loaded earlier in conversation201- Avoid redundant loading of same documentation202- Build cumulative knowledge through session203204Proactive Loading:205206- Anticipate documentation needs based on conversation flow207- Pre-load related topics when discussing complex features208- Suggest relevant documentation before user asks209210---211212## Works Well With213214Agents:215216- workflow-docs: Documentation generation217- core-planner: Documentation planning218- workflow-spec: SPEC documentation219220Skills:221222- moai-docs-generation: Documentation generation223- moai-workflow-docs: Documentation validation224- moai-library-nextra: Nextra documentation225226Commands:227228- /moai:3-sync: Documentation synchronization229- /moai:9-feedback: Documentation improvements