Skip to content
agentic-browser

Task Memory

The memory system learns from successful interactions and reuses proven patterns on repeat visits. Instead of rediscovering elements every time, an LLM can search memory for known selectors and workflows.

How It Works

Command executed
    ↓
Evidence recorded (success/failure + selector + URL)
    ↓
Grouped into TaskInsight (anchored by taskIntent + siteDomain, then narrowed by path and selector evidence)
    ↓
Scored by confidence, freshness, and relevance
    ↓
Available via memory search

Evidence

Every command execution creates an evidence record:

  • result — success or failure
  • selector — CSS selector used (if any)
  • url — page URL at time of execution
  • commandId — which command produced this

TaskInsight

Evidence is grouped into insights, each representing a learned pattern:

  • taskIntent — what was being done (e.g. "navigate:github.com")
  • siteDomain — which site
  • actionRecipe — sequence of steps that worked
  • selectorHints — CSS selectors that proved reliable
  • selectorAliases — human-readable names mapped to selectors with fallbacks (auto-generated after 3+ successes with high confidence)
  • confidence — success ratio (0-1)
  • freshness — how current the insight is

Freshness States

Insights move through three freshness states:

StateMeaningTrigger
freshRecently verified, high confidenceSuccessful use
suspectShowing failures or agingStructural failure, or 30+ days without reverification
staleOld or unreliable2+ structural failures, or 44+ days without reverification

Transitions are automatic:

  • Failure-based: structural errors (selector not found, timeout, zero-size element) increment a strike counter. One strike → suspect, two → stale.
  • Time-based: insights decay lazily at search time. After 30 days without reverification, fresh → suspect. After 44 days total, suspect → stale.
  • Recovery: a single successful execution resets freshness to fresh and clears the strike counter.

Usage

Search Memory

Find relevant patterns before interacting with a site:

# CLI
agentic-browser agent memory-search "login:github.com" --domain github.com --limit 5
 
# Or low-level
agentic-browser memory:search "login:github.com" --domain github.com
// Programmatic
const memory = core.searchMemory({
  taskIntent: "login:github.com",
  siteDomain: "github.com",
  limit: 5,
});

MCP: Call browser_search_memory with taskIntent.

Results are ranked by:

  1. Relevance — fuzzy match on taskIntent
  2. Confidence — success/failure ratio
  3. Freshness — more recent is better
  4. Domain match — exact domain gets a bonus

When executions are recorded, matching is also narrowed by path pattern and selector evidence. That reduces cross-contamination between different flows on the same site, for example /login/* versus /account/*.

Inspect an Insight

See the full details of a specific insight:

agentic-browser memory:inspect <insightId>
const insight = core.inspectMemory("insight-abc");
// insight.actionRecipe — step-by-step what worked
// insight.evidence — all recorded executions
// insight.confidence, insight.freshness

Verify an Insight

Mark an insight as manually verified (resets stale counter):

agentic-browser memory:verify <insightId>
core.verifyMemory("insight-abc");

Memory Statistics

agentic-browser memory:stats
const stats = core.memoryStats();
// stats.total — total insights
// stats.fresh — currently fresh
// stats.suspect — needs attention
// stats.stale — unreliable
// stats.topDomains — most-used sites

For an LLM working with a known site:

  1. Search first: memory-search "task:domain.com" — check if there are known patterns. Results include a siteProfile with the site's selector conventions and layout.
  2. Use selector hints and aliases: If memory returns results with high confidence and fresh status, use the selectorHints directly. selectorAliases provide human-readable names (e.g. "Submit") mapped to selectors with fallbacks — pass these as fallbackSelectors to browser_interact. Use siteProfile.selectorPatterns to understand which selector strategy the site prefers.
  3. Fall back to discovery: If no memory or stale results, use elements to discover fresh selectors (which also include fallbackSelectors)
  4. Let memory record: Successful executions are automatically recorded — no manual step needed. After 3+ successes with confidence ≥ 0.8, selector aliases are auto-generated. Site profiles are also built automatically from every visit.
  5. Verify when needed: If a site redesign breaks selectors, the freshness system will detect it and degrade the insight. Insights also decay automatically after 30+ days without use.

Site Profiles

Alongside per-command insights, the memory system builds site-level profiles that accumulate knowledge across visits to the same domain:

  • Selector patterns — which selector strategies a site uses (e.g. data-testid, aria-label, id-selector) with frequency counts
  • Layout fingerprints — headings and landmarks observed per URL path pattern (stored when browser_get_content returns a summary)
  • Navigation paths — URL path patterns seen across visits (e.g. /login/*, /dashboard/*)
  • Cookie banner — whether a cookie banner was detected, if it was auto-dismissed, and which method worked

Site profiles are built automatically — no manual step needed. When you search memory via browser_search_memory, results include a siteProfile field with relevant site-level context. This helps an LLM understand a site's selector conventions before interacting with it.

Storage

Memory is persisted as JSON in {AGENTIC_BROWSER_DIR}/memory/ (default: ~/.agentic-browser/memory/):

  • insights.json — task insights (per-command patterns)
  • site-profiles.json — site profiles (per-domain knowledge)

Both files survive across sessions and process restarts.