feat: agent web search strategy (configurable AGENT_WEB_SEARCH_STRATEGY) + CLAUDE.md pointer#75
Merged
Merged
Conversation
Output of grill-with-docs for the web-search-retrieval feature. The Tavily search_web tool was rejected in favour of instructing the agent to use its own web search via a configurable AGENTS.md strategy. - ADR-024: web search belongs to the agent, not LucidVault - ADR-025: reduce CLAUDE.md injection to a pointer (supersedes ADR-008) - plan-agent-web-search-strategy.md: AGENT_WEB_SEARCH_STRATEGY (off|fallback|time-sensitive|immediately, default fallback) - CONTEXT.md: Agent Web Search and Web Search Strategy terms Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Spec-only failing tests for the AGENT_WEB_SEARCH_STRATEGY feature (ADR-024) and the CLAUDE.md pointer reduction (ADR-025): - agentsmd: per-mode Web Search section wording (off/fallback/time-sensitive/ immediately), shared trust-vs-recency + provider-agnostic + citation rules, ParseWebSearchStrategy enum parsing, and a provider-name sweep asserting no vendor is ever named. - cmd: AGENT_WEB_SEARCH_STRATEGY env parsing (four values, unknown/empty -> fallback). - claudemd: pointer-form section (abs vault path + "read AGENTS.md and follow it"), with the retrieval strategy and file legend removed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Tell an agent how and when to use its OWN web search relative to the curated vault, without LucidVault providing, proxying, or naming any search service (ADR-024). The strategy is provider-agnostic advisory prose, configurable via AGENT_WEB_SEARCH_STRATEGY (off | fallback | time-sensitive | immediately; default fallback), mirroring the existing readTools env threading. - cmd/main.go: parse AGENT_WEB_SEARCH_STRATEGY in loadConfig (unknown/empty -> fallback, slog.Warn on unknown non-empty); add config field; thread into generateAgentsMD. - internal/agentsmd: new WebSearchStrategy enum + ParseWebSearchStrategy; Generate gains a strategy param and assembles the Source Attribution section (web bullet conditional) and the mode-specific ## Web Search section. Only the first directive differs per mode; the trust-vs-recency, provider-agnostic, and citation rules are shared. off omits both the section and the attribution bullet. - internal/agentsmd/template.md: move the static ## Web Search section and the web-search attribution bullet out into generator logic. - No new dependency, no search_web tool; the MCP tool surface is unchanged. - docs: README env table + Claude Code integration section, CLAUDE.md env section, .env.example. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Shrink the upserted CLAUDE.md section to a minimal pointer (ADR-025, supersedes ADR-008): the vault's absolute path plus "read AGENTS.md and follow it". The retrieval strategy, file legend, and (now) web-search guidance live solely in the always-regenerated AGENTS.md, so the two no longer drift. Markers, Upsert, idempotent replacement, and CLAUDE_MD_PATH are unchanged; only the section body shrinks (the abs-path Sprintf now takes a single arg). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…own value AC1 of the agent web-search-strategy plan requires an unknown non-empty value to fall back "with a logged warning." The existing test only checked the resolved enum, so deleting the slog.Warn in loadConfig stayed green. Capture the global slog default into a buffer per subtest and assert the warning fires exactly for the unknown non-empty case (carrying the rejected value) and stays silent for every recognized/empty/unset input. Verified via mutation: removing the slog.Warn now fails the test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The new webSearchStrategy field widened the longest field name in the config struct (and its return literal) in cmd/main.go, and the test-case struct in websearch_test.go was over-padded, leaving both files gofmt-dirty. Re-run gofmt to re-align. Whitespace only, no behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
LucidVault now instructs the agent how/when to use the agent's OWN web search (provider-agnostic), configurable via the new
AGENT_WEB_SEARCH_STRATEGYenv var:off— never suggest web searchfallback(default) — suggest web search only when the vault lacks an answertime-sensitive— suggest web search for time-sensitive queriesimmediately— always prefer web search firstLucidVault does not provide, proxy, or wrap any web search itself. The strategy is purely guidance injected into
AGENTS.mdso the host agent uses its own native web search per the configured policy (ADR-024).Companion change
The injected
CLAUDE.mdsection is reduced to a pointer that tells the agent to readAGENTS.mdand follow it. This eliminates strategy drift between the two files (ADR-025, supersedes ADR-008).References
Notes
search_webtool added.Test plan
mise run testpasses (all packages green).mise run lintpasses (go: 0 issues; markdown, yaml, dockerfile, actions, vuln all clean).AGENTS.mdoutput,cmdenv-parsing + warning-on-unknown-value,claudemdpointer section.🤖 Generated with Claude Code