# Pidgey Assist Skills & Architecture 🐦

Pidgey Assist is a powerful, autonomous browser agent built directly into a Chrome Extension sidebar. He does not use an iframe; his "brain" communicates directly with the Gemini REST API to maintain high-speed, multi-turn reasoning loops.

## Core Capabilities (Tools)

Pidgey uses Google's `functionCalling` feature in the Gemini API. Behind the scenes, he iteratively uses the following tools in a single "train of thought" until he solves the user's objective:

### 1. 🦅 Wing Navigation (`navigate_to`)
Pidgey can command the browser to load specific URLs. He can fly the user's active tab to a new site, or navigate his stealth background tabs to conduct research without interrupting the user.

### 2. 🤫 Background Flocks (`manage_background_tab`)
Pidgey can spin up invisible browser tabs in the background. If you ask him to research something extensively, he will open a hidden tab, load a search engine, scrape the data he needs, and automatically close the tab when finished—all without taking over your screen.
*(He can also use this with `active: true` to pop open a visible tab so you can watch him work!)*

### 3. 📸 Eagle Eye Vision (`take_screenshot`)
Instead of just scraping code, Pidgey can take a literal, pixel-perfect photograph (screenshot) of your current active tab. He sends this image back to Gemini's multi-modal API to understand complex visual layouts, charts, or images that standard text scraping misses.

### 4. 🔍 Swoop & Scrape (`scrape_page`)
Pidgey can ingest the DOM code of any page to extract specific data types instantly:
- `text`: Reads the body text for summarization.
- `links`: Extracts Markdown-formatted hyperlinks to find navigation targets.
- `prices`: Uses regex to find and return a list of numerical prices on shopping pages.
- `images`: Pulls image alt-text and source URLs.

### 5. 🎯 Sharper Beak (`interact_with_page`)
The core DOM manipulator. Using a combination of `content.js` highlighting and Javascript injection, Pidgey can:
- `click`: Visually outline and trigger clicks on buttons, links, or inputs based on human-readable descriptions (e.g., "the blue submit button").
- `type`: Inject values into forms and textareas.
- `scroll`: Auto-scroll the page so elements come into view.

### 6. 🗂️ Workspace Manager (`organize_tabs`)
Pidgey has full control over the browser window context. He can list all open tabs across your active window, close down distractive tabs, or intelligently group related tabs together into distinct Chrome Tab Groups (like "Research" or "Shopping").

### 7. ✏️ Autofill-the-Feathers (`autofill_form`)
Rapidly fills multiple form inputs on checkout or registration pages at once, utilizing `interact_with_page`'s logic simultaneously across many elements. Pidgey combines this with his Memory to autonomously fill out what he knows, stopping to ask the user to clarify anything he doesn't know.

### 8. 📦 Carrier Pigeon (`manage_files`)
Pidgey can generate files directly from the sidebar. If you ask him to compile a `.json` or `.txt` file of his research, he converts the text into a Base64 Object URL and triggers Chrome's native Downloads API to save the final file securely to your local disk.

### 9. 🥚 Nest-Egg Memory (`update_preferences`)
Whenever you off-handedly mention a personal detail (like "I live in NY" or "I prefer concise emails"), Pidgey silently calls this tool to save that fact as a JSON dictionary to `chrome.storage.sync`. Because it uses Chrome Sync, his memory effortlessly follows you across different devices.

### Future Integrations
- **Eternal Nest (`google_drive_action`)**: Planned integration to allow OAuth connection directly to the user's Google Drive, letting Pidgey create, edit, and read live Google Docs and Sheets.
