Spaces:
Paused
Download agents.md from Nymbo/MiniSearch: direct link, hf CLI and curl.
- Browser
- Download file 13.5 kB
-
https://huggingface.co/spaces/Nymbo/MiniSearch/resolve/main/agents.md
- Command line
-
hf download hf://spaces/Nymbo/MiniSearch/agents.md
-
curl -L -o agents.md https://huggingface.co/spaces/Nymbo/MiniSearch/resolve/main/agents.md
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/configuration.md#tuning-the-search-engines- Replacing the SearXNG settings file at container start: engine selection, engines blocked from an IP, theTMPDIRrequirementdocs/security.md- Access control, privacy, and security model
Core Functionality
docs/api.md- HTTP endpoint reference: parameters, responses, and error codesdocs/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/page-content.md- Reading result pages to ground AI answersdocs/glossary.md- Codebase-specific terms and domain concepts
Development
docs/development-commands.md- Docker, npm, and testing commandsdocs/failure-injection.md- Graceful-degradation test matrixdocs/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- Single-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/pageContentEndpointServerHook.ts-/page-contentendpointserver/internalApiEndpointServerHook.ts-/inferenceproxyserver/webSearchService.ts- SearXNG integrationserver/rerankerService.ts- Local result reranking
UI Components
client/components/DictationButton.tsx- Microphone control shared by the search field and the chat follow-up fieldclient/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/pageContent.ts- Requests extracted page text from/page-contentclient/modules/pageExcerptAllocation.ts- Pure page-excerpt budget logic, shared by the worker and the synchronous fallbackclient/modules/pageExcerptWorker.ts- Tokenizes page bodies off the main thread at the search-to-generation handoffclient/modules/pageExcerptWorkerProtocol.ts- Message types shared by both sides of the excerpt workerclient/modules/systemPrompt.ts- System prompt templatesclient/modules/logEntries.ts- Application logging with unique IDsclient/modules/appInfo.ts- Application metadata and version infoclient/modules/textToSpeech.ts- Reads answers aloud: engine selection, fallback, and the playback queueclient/modules/textToSpeechWorker.ts- Synthesizes sentences off the main threadclient/modules/textToSpeechWorkerProtocol.ts- Message types shared by both sides of the workerclient/modules/piper.ts- The only module that imports@diffusionstudio/vits-webclient/modules/speechToText.ts- Dictation: microphone capture, the worker's lifecycle, and engine selection between the on-device model andSpeechRecognitionclient/modules/speechToTextWorker.ts- Runs the Moonshine transcriber off the main threadclient/modules/speechToTextWorkerProtocol.ts- Message types shared by both sides of the dictation workerclient/modules/moonshine.ts- The only module that imports@moonshine-ai/moonshine-wasmclient/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/thumbnailEndpointServerHook.ts-/thumbnailendpoint: one search-result thumbnail at a time, token-gated, with an in-process LRU in front of the upstream hostserver/internalApiEndpointServerHook.ts-/inferenceproxy to self-hosted APIserver/validateAccessKeyServerHook.ts- Access key validation endpointserver/statusEndpointServerHook.ts-/statushealth check endpointserver/configEndpointServerHook.ts-/api/configruntime client configurationserver/rerankerServiceHook.ts- Reranker model lifecycle managementserver/compressionServerHook.ts- gzip/brotli compression for responsesserver/crossOriginServerHook.ts- COOP/COEP headers for SharedArrayBufferserver/dictationModelServerHook.ts-/dictation-models/endpoint: serves the pinned speech-to-text model files from the instanceserver/cacheServerHook.ts- Cache-Control headers (preview server only)server/webSearchService.ts- SearXNG integration with circuit breaker and retry logicserver/pageContentService.ts- Reads result pages and extracts query-relevant passagesserver/pageReadHostBreaker.ts- Per-host circuit breaker for page reads: skips a host that refused the last three reads, then probes it onceserver/utils/publicUrl.ts- Blocks private and reserved addresses before a server-side fetchserver/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 loggingclient/hooks/useScreenWakeLock.ts- Keeps the screen awake while a response is generating
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:
npm run lint
Inside the dev container, the same command is 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
A bare tsc is not a full typecheck
The project is split across three TypeScript configs, and the default one covers less than its name suggests:
| Config | Covers |
|---|---|
tsconfig.json |
client, shared, test |
tsconfig.node.json |
vite.config.ts, server, shared, e2e, playwright.config.ts |
tsconfig.eval.json |
eval, shared |
So npx tsc --noEmit reports success while type errors sit in server/ or eval/, and CI then fails on a change that looked clean locally. Only npm run lint runs all three configs. Never treat a bare tsc as a green typecheck.
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