# How Site Skills and Learnings Drive Experience Accumulation in ego-lite

> Discover how ego-lite accumulates experience using site skills and learning packs to load website capabilities and expose domain-specific tools for AI agents.

- Repository: [CitroLabs/ego-lite](https://github.com/citrolabs/ego-lite)
- Tags: internals
- Published: 2026-08-16

---

**ego-lite accumulates experience by loading site-specific learning packs—called site skills—that describe web site capabilities and expose domain-specific tools an AI agent can execute to gather knowledge.**

In the citrolabs/ego-lite architecture, experience is not a static metric but an expanding repository of actionable knowledge. The runtime leverages **site skills** (version-controlled learning packs) to teach agents how to interact with specific domains, enabling them to perform complex automation tasks that grow more capable with each execution.

## Understanding Site Skills and Learnings

Site skills in ego-lite are structured learning packs stored in the `skills/ego-browser/learnings/` directory. Each pack contains a [`manifest.json`](https://github.com/citrolabs/ego-lite/blob/main/manifest.json) that defines the site’s identity, supported domains, and available tools. These manifests specify **Node-side tools** (executed in the agent’s process) and **Browser-side tools** (injected into the web page), complete with JSON schemas for arguments and return values.

When an agent encounters a new URL, it does not rely on generic heuristics. Instead, it queries the learning system to retrieve pre-defined interaction patterns, effectively downloading "experience" for that specific domain. This design allows the agent’s capabilities to expand simply by adding new learning packs to the codebase.

## The Three-Stage Experience Accumulation Workflow

The `site.learnContext(url)` method triggers a three-stage pipeline that transforms raw learning packs into executable agent knowledge.

### Domain Matching and Lookup

First, [`src/learning/check-domain-learning.ts`](https://github.com/citrolabs/ego-lite/blob/main/src/learning/check-domain-learning.ts) performs a domain lookup against the requested URL. The module walks the `skills/ego-browser/learnings/` directory and matches the URL against the `domains` array in each manifest, returning a filtered list of applicable learning packs. This ensures agents only load relevant skills for the current site.

### Pack Loading and Validation

Next, [`src/learning/index.ts`](https://github.com/citrolabs/ego-lite/blob/main/src/learning/index.ts) loads the matching manifests alongside any documentation in `notes/*.md`. The [`src/learning/validate-learning-format.ts`](https://github.com/citrolabs/ego-lite/blob/main/src/learning/validate-learning-format.ts) module validates the structure of each [`manifest.json`](https://github.com/citrolabs/ego-lite/blob/main/manifest.json) to guarantee consistent tool schemas. Each validated pack exposes a stable site ID (e.g., `google`, `x-com`) and its associated tool definitions.

### Context Exposure and Tool Execution

Finally, [`src/helpers.ts`](https://github.com/citrolabs/ego-lite/blob/main/src/helpers.ts) re-exports the public API (`learnContext`, `runTool`, `runBrowserTool`) into the agent’s script scope. The resolved context object provides:

- `site.skills(url)` – Returns the raw list of matching packs
- `site.runTool(siteId, toolName, args)` – Executes Node-side tools
- `site.runBrowserTool(siteId, toolName, args)` – Injects and runs browser-side scripts

## How Tool Execution Builds Experience

Each successful tool invocation adds new knowledge to the agent’s session, creating a compounding effect that constitutes experience accumulation.

**Node-side tools** fetch data, call external APIs, or transform results, enriching the agent’s internal state with structured information. These run within the agent’s process and can perform computationally intensive operations without browser constraints.

**Browser-side tools** scrape fresh DOM information, trigger UI actions, or extract dynamic content directly from the page. Because these execute in the browser context, they feed the agent real-time observations that reflect the current state of interactive web applications.

As agents invoke these tools across different sites, they accumulate a reusable knowledge base of site-specific actions and data extraction patterns.

## Practical Implementation Example

The following code demonstrates how an agent loads learning context and executes both Node-side and Browser-side tools:

```javascript
// Load the learning context for a Google Search page
const ctx = await site.learnContext('https://www.google.com/search?q=ego+lite');

// Inspect the available tools for this site
console.log(ctx.tools);
// → [{ name: 'search_and_extract', args: { query:string, maxResults:number }, returns:{ results:Array } }]

// Run a Node-side tool defined in the Google learning pack
const results = await site.runTool('google', 'search_and_extract', {
  query: 'ego-lite',
  maxResults: 5,
});
console.log(results);

// Run a browser-side tool on the current page (e.g., X-Com timeline extraction)
await site.runBrowserTool('x-com', 'extractPost');

```

## Key Source Files in citrolabs/ego-lite

The experience accumulation system is implemented across these critical modules:

- **[`src/learning/index.ts`](https://github.com/citrolabs/ego-lite/blob/main/src/learning/index.ts)** – Entry point for loading learning packs and exposing the public API.
- **[`src/learning/check-domain-learning.ts`](https://github.com/citrolabs/ego-lite/blob/main/src/learning/check-domain-learning.ts)** – Contains domain matching logic to resolve applicable learning packs.
- **[`src/helpers.ts`](https://github.com/citrolabs/ego-lite/blob/main/src/helpers.ts)** – Re-exports `learnContext`, `runTool`, and `runBrowserTool` into the agent scope.
- **[`src/learning/validate-learning-format.ts`](https://github.com/citrolabs/ego-lite/blob/main/src/learning/validate-learning-format.ts)** – Validates [`manifest.json`](https://github.com/citrolabs/ego-lite/blob/main/manifest.json) structure to ensure tool schema consistency.
- **`skills/ego-browser/learnings/<site>/manifest.json`** – Defines site capabilities, domains, and tool schemas.
- **`skills/ego-browser/learnings/<site>/tools/*.js`** – Implementations of Node-side and browser-side tools.

## Summary

- ego-lite treats **experience as accumulated site-specific knowledge** stored in version-controlled learning packs.
- The `site.learnContext(url)` method triggers a three-stage pipeline: domain matching, pack validation, and context exposure.
- **Node-side tools** enrich internal agent state through API calls and data processing, while **Browser-side tools** extract real-time DOM information.
- Tool execution is cumulative; each invocation adds to the agent’s repertoire of domain-specific actions.
- New capabilities are added by creating learning packs in `skills/ego-browser/learnings/` without modifying core agent logic.

## Frequently Asked Questions

### What is the difference between Node-side and Browser-side tools in ego-lite?

Node-side tools execute within the agent’s process and can perform server-side operations like API calls and data transformation. Browser-side tools are injected into the webpage and interact with the DOM to extract dynamic content or trigger UI events. Both contribute to experience accumulation by feeding results back into the agent’s session state.

### How does ego-lite determine which learning pack to load for a URL?

The [`src/learning/check-domain-learning.ts`](https://github.com/citrolabs/ego-lite/blob/main/src/learning/check-domain-learning.ts) module walks the `skills/ego-browser/learnings/` directory and matches the requested URL against the `domains` array defined in each manifest.json. Only packs with matching domain patterns are loaded, ensuring agents receive relevant skills for the current site.

### What validates the structure of learning packs in ego-lite?

The [`src/learning/validate-learning-format.ts`](https://github.com/citrolabs/ego-lite/blob/main/src/learning/validate-learning-format.ts) module validates each [`manifest.json`](https://github.com/citrolabs/ego-lite/blob/main/manifest.json) against a defined schema. This guarantees that tool arguments, return values, and site metadata follow consistent patterns required for the agent to execute tools correctly.

### How does tool execution contribute to an agent's experience accumulation?

Each invocation of `site.runTool()` or `site.runBrowserTool()` returns data that the agent stores in its session context. Over time, these accumulated results—ranging from search results to scraped DOM elements—form a growing knowledge base that the agent references in future interactions, effectively constituting "experience" in the ego-lite framework.