Skip to content

feat: agent web search strategy (configurable AGENT_WEB_SEARCH_STRATEGY) + CLAUDE.md pointer#75

Merged
bamaas merged 6 commits into
mainfrom
feature/web-search-retrieval-grill
Jun 4, 2026
Merged

feat: agent web search strategy (configurable AGENT_WEB_SEARCH_STRATEGY) + CLAUDE.md pointer#75
bamaas merged 6 commits into
mainfrom
feature/web-search-retrieval-grill

Conversation

@bamaas

@bamaas bamaas commented Jun 4, 2026

Copy link
Copy Markdown
Owner

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_STRATEGY env var:

  • off — never suggest web search
  • fallback (default) — suggest web search only when the vault lacks an answer
  • time-sensitive — suggest web search for time-sensitive queries
  • immediately — always prefer web search first

LucidVault does not provide, proxy, or wrap any web search itself. The strategy is purely guidance injected into AGENTS.md so the host agent uses its own native web search per the configured policy (ADR-024).

Companion change

The injected CLAUDE.md section is reduced to a pointer that tells the agent to read AGENTS.md and follow it. This eliminates strategy drift between the two files (ADR-025, supersedes ADR-008).

References

  • ADR-024 — agent web search strategy (provider-agnostic, no LucidVault-provided search)
  • ADR-025 — CLAUDE.md reduced to a pointer to AGENTS.md (supersedes ADR-008)

Notes

  • No new Go dependency.
  • No search_web tool added.
  • MCP tool surface unchanged.

Test plan

  • mise run test passes (all packages green).
  • mise run lint passes (go: 0 issues; markdown, yaml, dockerfile, actions, vuln all clean).
  • New tests: per-mode AGENTS.md output, cmd env-parsing + warning-on-unknown-value, claudemd pointer section.

🤖 Generated with Claude Code

cibotbm Bot and others added 6 commits June 4, 2026 08:36
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>
@bamaas bamaas enabled auto-merge (squash) June 4, 2026 09:03
@bamaas bamaas merged commit a9c37bf into main Jun 4, 2026
3 checks passed
@bamaas bamaas deleted the feature/web-search-retrieval-grill branch June 4, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant