docs(07): auto-generated context (research + search)

This commit is contained in:
Mikkel Georgsen 2026-04-10 07:42:21 +00:00
parent 16a469bfdd
commit 987dc4b97c

View file

@ -0,0 +1,70 @@
# Phase 7: Research Agent & Search - Context
**Gathered:** 2026-04-10
**Status:** Ready for planning
**Mode:** Auto-generated (autonomous mode)
<domain>
## Phase Boundary
Items flagged needs_research are automatically enriched by a SearXNG research agent, and any inventory question can be answered via natural language search. This phase delivers the SearXNG Tier 2 client, research agent that consumes needs_research items, and natural language search endpoint.
</domain>
<decisions>
## Implementation Decisions
### SearXNG Client
- HTTP client to SearXNG JSON API at http://10.5.0.129:8080/search
- Sanitize queries before dispatch
- Return list of result objects (title, url, snippet)
### Research Agent
- Background worker that polls NetBox for catalog_status=needs_research items
- For each item: query SearXNG for product info, send results to Tier 2 LLM, extract structured data
- Update NetBox device with enriched data, set catalog_status=researched
- Run periodically (every 10 minutes) or on-demand via POST /api/research/trigger
### Natural Language Search
- Endpoint: GET /api/search?q=...
- Use Tier 1 (Gemma 4) to translate query to NetBox filter params
- Return matching devices
### Frontend
- Search bar in dashboard top
- Results page reuses dashboard cards
</decisions>
<code_context>
## Existing Code Insights
### Reusable Assets from prior phases
- internal/ai/ — AIClient, TierClient, orchestrator
- internal/ai/research.go — ResearchClient interface (NoOp from Phase 2)
- internal/netbox/client.go — ListDevices, GetDevice, PatchCustomFields
- internal/inventory/quality_gate.go + catalog_updater.go
- internal/api/router.go
- web/src/lib/api.ts
### Integration Points
- Replace NoOpResearchClient with real SearXNGResearchClient
- Add internal/research/ package
- Add internal/api/handlers/search.go
- Frontend: dashboard search bar wires GET /api/search
</code_context>
<specifics>
## Specific Ideas
- SearXNG client uses standard net/http
- Research agent runs as goroutine started from main.go
- Search endpoint translates "show me free 10GbE NICs" to filter: category=NIC, status=available, tags has 10gbe
</specifics>
<deferred>
## Deferred Ideas
- Saved searches
- Search history
</deferred>