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.4---5
6## Quick Reference (30 seconds)
7
8Purpose: Load relevant documentation on-demand based on user intent and context.
9
10Primary Tools:
11
12- WebSearch: Find latest documentation and resources online
13- WebFetch: Retrieve specific documentation pages
14- Context7 MCP: Access official library documentation (when available)
15- Read, Grep, Glob: Search local project documentation
16
17Trigger Patterns:
18
19- User asks specific technical questions
20- Technology keywords detected in conversation
21- Domain expertise required for task completion
22- Implementation guidance needed
23
24## Implementation Guide
25
26### Intent Detection
27
28The system recognizes documentation needs through several patterns:
29
30Question-Based Triggers:
31
32- When users ask specific implementation questions (e.g., "how do I implement JWT authentication?")
33- When users seek best practices or optimization guidance
34- When troubleshooting questions arise
35
36Technology-Specific Triggers:
37
38- Detection of framework names: FastAPI, React, PostgreSQL, Docker, Kubernetes
39- Detection of library names: pytest, TypeScript, GraphQL, Redis
40- Detection of tool names: npm, pip, cargo, maven
41
42Domain-Specific Triggers:
43
44- Authentication and authorization topics
45- Database and data modeling discussions
46- Performance optimization inquiries
47- Security-related questions
48
49Pattern-Based Triggers:
50
51- Implementation requests: "implement", "create", "build"
52- Architecture discussions: "design", "structure", "pattern"
53- Troubleshooting: "debug", "fix", "error", "not working"
54
55### Documentation Sources
56
57The system retrieves documentation from multiple sources in priority order:
58
59Local Project Documentation (Highest Priority):
60
61- Check .moai/docs/ for project-specific documentation
62- Check .moai/specs/ for requirements and specifications
63- Check README.md for project overview
64- Check docs/ directory for comprehensive documentation
65
66Official Documentation Sources:
67
68- Use WebFetch to retrieve official framework documentation
69- Use Context7 MCP tools when available for library documentation
70- Access technology-specific official websites
71
72Community Resources:
73
74- Use WebSearch to find high-quality tutorials
75- Search for Stack Overflow solutions with high vote counts
76- Find GitHub discussions for specific issues
77
78Real-Time Web Research:
79
80- Use WebSearch with current year for latest information
81- Search for recent best practices and updates
82- Find new features and deprecation notices
83
84### Loading Strategies
85
86Intent Analysis Process:
87
88- Identify technologies mentioned in user request
89- Determine domain areas relevant to the question
90- Classify question type (implementation, troubleshooting, conceptual)
91- Assess complexity to determine documentation depth needed
92
93Source Prioritization:
94
95- If local documentation exists: Load project-specific docs first
96- If official documentation available: Retrieve authoritative sources
97- If implementation examples needed: Search community resources
98- If latest information required: Perform web research
99
100Context-Aware Caching:
101
102- Cache retrieved documentation within session
103- Maintain relevance based on current conversation context
104- Remove outdated content when context shifts
105- Prioritize frequently accessed documentation
106
107### Quality Assessment
108
109Content Quality Evaluation:
110
111- Authority: Official sources receive highest trust
112- Recency: Content within 12 months preferred for fast-moving technologies
113- Completeness: Documentation with examples ranked higher
114- Relevance: Match between content and user intent
115
116Relevance Ranking:
117
118- Calculate match between documentation content and user question
119- Weight authority (30%), recency (25%), completeness (25%), relevance (20%)
120- Return highest-scoring documentation first
121- Indicate confidence level in retrieved information
122
123### Practical Workflows
124
125Authentication Implementation Workflow:
126
127- When user asks about authentication: Detect technologies (e.g., FastAPI, JWT)
128- Identify domains: authentication, security
129- Load FastAPI security documentation via WebFetch
130- Search for JWT best practices via WebSearch
131- Provide comprehensive guidance with source attribution
132
133Database Optimization Workflow:
134
135- When user asks about query performance: Detect database technology
136- Identify domain: performance, optimization
137- Load official database documentation
138- Search for optimization guides and tutorials
139- Provide actionable recommendations with sources
140
141New Technology Adoption Workflow:
142
143- When user introduces unfamiliar technology: Detect technology name
144- Load official getting started documentation
145- Search for migration guides if applicable
146- Find integration patterns with existing stack
147- Provide strategic adoption guidance
148
149### Error Handling
150
151Network Failures:
152
153- If web search fails: Fall back to cached content
154- If WebFetch fails: Use local documentation if available
155- Indicate partial results when some sources unreachable
156
157Content Quality Issues:
158
159- If retrieved content seems outdated: Search for newer sources
160- If relevance unclear: Ask user for clarification
161- If conflicting information found: Present multiple sources with dates
162
163Relevance Mismatches:
164
165- If initial search yields poor results: Refine search query
166- If user context unclear: Request clarification before loading
167- If documentation gap exists: Acknowledge limitation
168
169### Performance Optimization
170
171Caching Strategy:
172
173- Maintain session-level cache for frequently accessed docs
174- Keep project-specific documentation in memory
175- Evict stale content based on access time
176
177Efficient Loading:
178
179- Load documentation only when explicitly needed
180- Avoid preloading all possible documentation
181- Use targeted searches rather than broad queries
182
183Batch Processing:
184
185- Combine related searches when possible
186- Group documentation requests by technology
187- Process multiple sources in parallel when appropriate
188
189## Advanced Patterns
190
191Multi-Source Aggregation:
192
193- Combine official documentation with community examples
194- Cross-reference multiple authoritative sources
195- Synthesize comprehensive answers from diverse materials
196
197Context Persistence:
198
199- Remember documentation loaded earlier in conversation
200- Avoid redundant loading of same documentation
201- Build cumulative knowledge through session
202
203Proactive Loading:
204
205- Anticipate documentation needs based on conversation flow
206- Pre-load related topics when discussing complex features
207- Suggest relevant documentation before user asks
208
209---
210
211## Works Well With
212
213Agents:
214
215- workflow-docs: Documentation generation
216- core-planner: Documentation planning
217- workflow-spec: SPEC documentation
218
219Skills:
220
221- moai-docs-generation: Documentation generation
222- moai-workflow-docs: Documentation validation
223- moai-library-nextra: Nextra documentation
224
225Commands:
226
227- /moai:3-sync: Documentation synchronization
228- /moai:9-feedback: Documentation improvements