Spaces:
Running
Running
MiniSearch Agent Guidelines
This is your navigation hub. Start here, follow the links, and return when you need orientation.
Before You Start
New to this codebase? Read in this order:
docs/quick-start.md- Get it runningdocs/overview.md- Understand the systemdocs/project-structure.md- Navigate the code
Making changes? Check:
docs/coding-conventions.md- Code styledocs/development-commands.md- Available commandsdocs/pull-requests.md- How to submit
Repository Map
Getting Started
docs/quick-start.md- Installation, first run, verificationdocs/overview.md- System architecture and data flowdocs/project-structure.md- Directory layout and component organization
Configuration & Setup
docs/configuration.md- Environment variables and settings referencedocs/security.md- Access control, privacy, and security model
Core Functionality
docs/ai-integration.md- AI inference types (Wllama, OpenAI, AI Horde, Internal)docs/ui-components.md- Component architecture and PubSub patternsdocs/search-history.md- History database schema and managementdocs/conversation-memory.md- Token budgeting and rolling summariesdocs/reranking.md- Reranker subsystem and model lifecycledocs/glossary.md- Codebase-specific terms and domain concepts
Development
docs/development-commands.md- Docker, npm, and testing commandsdocs/coding-conventions.md- Style guide and patternsdocs/pull-requests.md- PR process and merge philosophydocs/core-technologies.md- Technology stack and dependenciesdocs/design.md- UI/UX design principles
Agent Decision Tree
Need to:
βββ Add a feature?
β βββ UI component β docs/ui-components.md
β βββ AI integration β docs/ai-integration.md
β βββ Search functionality β client/modules/search.ts
β βββ Settings option β docs/configuration.md
βββ Fix a bug?
β βββ UI issue β Check component + PubSub channels
β βββ AI not working β docs/ai-integration.md + browser console
β βββ Search failing β Check SearXNG + server hooks
β βββ Build error β docs/development-commands.md
βββ Configure deployment?
β βββ Environment variables β docs/configuration.md
β βββ Access control β docs/security.md
β βββ Docker setup β docs/overview.md
βββ Understand data flow?
βββ Search flow β client/modules/search.ts
βββ AI generation β client/modules/textGeneration.ts
βββ State management β docs/ui-components.md
βββ History/Chat β docs/search-history.md + docs/conversation-memory.md
Key Files Reference
Entry Points
client/index.tsx- React app initializationvite.config.ts- Vite dev server with hooksDockerfile- Multi-stage container build
Business Logic Modules
client/modules/search.ts- Search orchestration and cachingclient/modules/textGeneration.ts- AI response flowclient/modules/pubSub.ts- All PubSub channelsclient/modules/settings.ts- Settings managementclient/modules/history.ts- Search history database
Server-Side Modules
server/searchEndpointServerHook.ts-/searchendpointsserver/internalApiEndpointServerHook.ts-/inferenceproxyserver/webSearchService.ts- SearXNG integrationserver/rerankerService.ts- Local result reranking
UI Components
client/components/App/- Application shell with error boundariesclient/components/Search/Form/- Search input and formclient/components/Search/Results/- Textual and graphical results displayclient/components/Search/History/- History drawer and buttonclient/components/AiResponse/- AI response display and chat interfaceclient/components/Pages/Main/- Main page layoutclient/components/Pages/Main/Menu/- Settings drawers (AI, Search, Interface, History, Voice, Actions)client/components/Pages/AccessPage.tsx- Access key validation pageclient/components/Analytics/SearchStats.tsx- Search analytics cardsclient/components/Logs/- Application logging modalclient/components/Settings/HistorySettings.tsx- History configuration UI
Client Modules
client/modules/pubSub.ts- All PubSub channels for state managementclient/modules/search.ts- Search orchestration and IndexedDB cachingclient/modules/textGeneration.ts- AI response generation and chat handlingclient/modules/textGenerationWithWllama.ts- Browser-based inferenceclient/modules/textGenerationWithOpenAi.ts- OpenAI-compatible API inferenceclient/modules/textGenerationWithHorde.ts- AI Horde distributed inferenceclient/modules/textGenerationWithInternalApi.ts- Internal API proxy inferenceclient/modules/settings.ts- Default settings and inference type definitionsclient/modules/history.ts- IndexedDB persistence for searches and chatclient/modules/wllama.ts- Wllama model configuration and managementclient/modules/webGpu.ts- WebGPU availability detection ("gpu" in navigator)client/modules/querySuggestions.ts- Search suggestion UI, stored in IndexedDBclient/modules/relatedSearchQuery.ts- Generates related search queriesclient/modules/followUpQuestions.ts- Generates follow-up questions viafollowUpQuestionPubSubclient/modules/accessKey.ts- Validates and stores access keys using argon2id hashing and localStorageclient/modules/parentWindow.ts- PostMessage API for embedding in parent windowsclient/modules/searchTokenHash.ts- CSRF protection token generationclient/modules/systemPrompt.ts- System prompt templatesclient/modules/logEntries.ts- Application logging with unique IDsclient/modules/appInfo.ts- Application metadata and version infoclient/modules/keyboard.ts- Keyboard shortcut handlingclient/modules/stringFormatters.ts- Text formatting utilitiesclient/modules/types.ts- Shared TypeScript type definitions
Server Modules
server/searchEndpointServerHook.ts-/search/textand/search/imagesendpointsserver/internalApiEndpointServerHook.ts-/inferenceproxy to self-hosted APIserver/validateAccessKeyServerHook.ts- Access key validation endpointserver/statusEndpointServerHook.ts-/statushealth check endpointserver/rerankerServiceHook.ts- Reranker model lifecycle managementserver/compressionServerHook.ts- gzip/brotli compression for responsesserver/crossOriginServerHook.ts- COOP/COEP headers for SharedArrayBufferserver/cacheServerHook.ts- Cache-Control headers (preview server only)server/webSearchService.ts- SearXNG integration with circuit breaker and retry logicserver/rerankerService.ts- Reranker service (ONNX Runtime inference)server/rankSearchResults.ts- Score-based filtering and result reorderingserver/searchToken.ts- CSRF token generation and storageserver/verifiedTokens.ts- In-memorySet<string>of verified session tokensserver/verifyTokenAndRateLimit.ts- Token verification and rate limitingserver/handleTokenVerification.ts- Search token validation logicserver/searchesSinceLastRestart.ts- In-memory search counters for analyticsserver/downloadFileFromHuggingFaceRepository.ts- Downloads model files from HuggingFace
Hooks
client/hooks/useSearchHistory.ts- Search history management from IndexedDBclient/hooks/useHistoryRestore.ts- Restores full search state from historyclient/hooks/useDrawerState.ts- Drawer open/close state with logging
Common Tasks Quick Reference
Add a new AI model
- Add to
client/modules/wllama.ts - Update
docs/ai-integration.md - Update
docs/configuration.mddefaults
Add a new setting
- Add to
client/modules/settings.tsdefault object - Add UI in
client/components/Pages/Main/Menu/ - Update
docs/configuration.mdsettings table
Modify search behavior
- Edit
client/modules/search.ts - Update
server/webSearchService.tsif server-side changes needed - Check
server/rerankerService.tsif reranking affected
Fix UI state issues
- Check PubSub channels in
client/modules/pubSub.ts - Verify component subscriptions in
docs/ui-components.md - Ensure proper state updates in business logic modules
Analyze test coverage
- Run
npm run test:coverageto generate reports - Check
coverage/coverage-summary.jsonfor quick metrics - See
docs/development-commands.mdfor full coverage analysis guide
Quality Gates
Before any change:
docker compose exec development-server npm run lint
This runs:
- Biome (formatting/linting)
- TypeScript (type checking)
- knip (dead code detection)
- jscpd (copy-paste detection)
- Custom architectural linter
- Doc gardening and documentation validator scripts
Agent-First Principles
Repository as System of Record:
- All knowledge lives in versioned docs/ structure
- This file is your entry point - start here
- Follow links, don't assume - verify in code
Context Efficiency:
- Use this map to navigate quickly
- Return to this file when context drifts
- Follow the decision tree for common tasks
Architecture & Boundaries:
- Respect PubSub boundaries - don't cross concerns
- Client vs server - keep them separate
- Feature-based organization - one folder per feature
Documentation Maintenance:
- Update these docs when you learn something new
- Add cross-references when linking concepts
- Keep examples current with actual code
Technology Stack
React + TypeScript + Mantine UI v9, with privacy-first architecture.
See docs/core-technologies.md for complete dependency list and selection criteria.
Need Help?
- Check relevant doc in
docs/ - Read the module code in
client/modules/orserver/ - Look at similar existing implementations
- Run
npm run lintto validate changes