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 —
successorfailure - 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:
| State | Meaning | Trigger |
|---|---|---|
fresh | Recently verified, high confidence | Successful use |
suspect | Showing failures or aging | Structural failure, or 30+ days without reverification |
stale | Old or unreliable | 2+ 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
freshand 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:
- Relevance — fuzzy match on taskIntent
- Confidence — success/failure ratio
- Freshness — more recent is better
- 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.freshnessVerify 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:statsconst stats = core.memoryStats();
// stats.total — total insights
// stats.fresh — currently fresh
// stats.suspect — needs attention
// stats.stale — unreliable
// stats.topDomains — most-used sitesRecommended Workflow
For an LLM working with a known site:
- Search first:
memory-search "task:domain.com"— check if there are known patterns. Results include asiteProfilewith the site's selector conventions and layout. - Use selector hints and aliases: If memory returns results with high confidence and fresh status, use the
selectorHintsdirectly.selectorAliasesprovide human-readable names (e.g. "Submit") mapped to selectors with fallbacks — pass these asfallbackSelectorstobrowser_interact. UsesiteProfile.selectorPatternsto understand which selector strategy the site prefers. - Fall back to discovery: If no memory or stale results, use
elementsto discover fresh selectors (which also includefallbackSelectors) - 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.
- 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_contentreturns 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.