Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:1broseidon Ketch cache TagPage TagURL TagResult

From Leeroopedia
Knowledge Sources
Domains Caching, Tagging
Last Updated 2026-10-27 00:00 GMT

Overview

Writes a bookmark entry to the durable tag index from three trigger shapes: a fetched page, a bare URL, or a search/code/docs result's URL+title+description.

Description

Three write entry points share one `tagEntry` → `tagDB.PutTagEntry` path. TagPage derives a bounded title and description from a fetched `*scrape.Page`. TagURL stores a URL with no network access, filling title/description from the cached page when one exists (a URL with no cached body is still indexed — the index is a durable record, not a view over the cache) and reports whether a body was available. TagResult stores a search/code/docs result's URL with explicit title/description. The bbolt key is `tag + "\x00" + cacheKey(URL)`; a cold re-add preserves existing title/description via `fillTagMetadata`.

⚠ Deprecated: the exported `ErrNotCached` variable in the same file is retained only for source compatibility — it is never returned. See Heuristic:1broseidon_Ketch_Deprecated_ErrNotCached.

Usage

Called by the `--tag` writer (`tagWriter.record`/`recordResult`) on scrape/crawl/search/code/docs, by `tag add` (which uses `TagURL`), and by the MCP tag tool.

Code Reference

Source Location

  • Repository: ketch
  • File: cache/tags.go, cache/tag_store.go

Signature

type TagEntry struct {
	URL         string
	Key         string
	Title       string
	Description string
	TaggedAt    int64
}

// TagPage records a fetched page under a tag.
func (c *Cache) TagPage(tag, key, url string, page *scrape.Page) error

// TagURL records a URL without network access; reports whether a body was available.
func (c *Cache) TagURL(tag, key, url string) (cached bool, err error)

// TagResult records a search/code/docs result's URL with explicit metadata.
func (c *Cache) TagResult(tag, key, url, title, description string) error

Import

import "github.com/1broseidon/ketch/cache"

I/O Contract

Inputs

Name Type Required Description
tag string Yes Validated tag name
key string Yes Composite cache key (Scraper.CacheKey(Rewrite(url)))
url string Yes Source URL (membership key)
page / title+description varies one Page (TagPage) or explicit metadata (TagResult); TagURL needs only url

Outputs

Name Type Description
cached (TagURL) bool Whether a cached body was available
err error Validation failure or bbolt write failure

Usage Examples

Tag a Fetched Page

key := scraper.CacheKey(scraper.Rewrite(url))
if err := tags.TagPage("docs", key, url, page); err != nil {
	// CLI: stderr warning; MCP: warnings field — research output retained.
}

Tag a Bare URL (No Network)

cached, err := tags.TagURL("docs", key, url)
// cached == false -> entry has no title/description until the page is fetched.

Related Pages

Implements Principle

Uses Heuristic

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment