feat(research): hydrate web-search results with cleaned page content

Fetch and clean each search result's page body (bounded by size,
concurrency, and a configurable MaxPageContentRunes), store it on the
new ResearchResult.Content field, and surface those excerpts in agent
memory so the model reasons over real page text rather than snippets
alone. Promotes golang.org/x/net to a direct dependency for HTML
parsing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-08 10:56:31 +08:00
parent 222e5a0219
commit 836de5b597
8 changed files with 252 additions and 17 deletions
@@ -238,6 +238,7 @@ func researchMemory(messages []design.Message) string {
Title string `json:"title"`
URL string `json:"url"`
Snippet string `json:"snippet"`
Content string `json:"content"`
} `json:"results"`
}
if err := json.Unmarshal([]byte(message.Content), &report); err != nil {
@@ -255,6 +256,9 @@ func researchMemory(messages []design.Message) string {
if snippet := strings.TrimSpace(result.Snippet); snippet != "" {
line += " | " + shortenMemoryText(snippet, 160)
}
if content := strings.TrimSpace(result.Content); content != "" {
line += " | page: " + shortenMemoryText(content, 360)
}
lines = append(lines, line)
if len(lines) >= 10 {
break