Files
memex/notes/org-skill-web-research.org

1.7 KiB

SKILL: Web Research Agent (Universal Literate Note)

Overview

The Web Research Agent provides high-fidelity information retrieval and serves as the bridge to non-API web interfaces (like Gemini Advanced) to leverage user subscriptions.

Phase A: Demand (PRD)

1. Purpose

Automate web-based information retrieval and subscription-tier AI access.

Phase B: Blueprint (PROTOCOL)

1. Architectural Intent

Implement a Lisp-to-Node bridge using Playwright for high-fidelity web interaction.

2. Semantic Interfaces

`fetch-url`

:signature `(fetch-url url &key (engine :browser)) :string`

`ask-gemini-web`

:signature `(ask-gemini-web prompt) :string`

Phase D: Build (Implementation)

Browser Logic

(in-package :org-agent)

(defun ask-gemini-web (prompt)
  "Calls the Playwright bridge to interact with Gemini Web UI."
  (let* ((cookie-str (uiop:getenv "GEMINI_COOKIES"))
         (script-path (namestring (merge-pathnames "src/gemini-web.js" (asdf:system-source-directory :org-skill-web-research)))))
    (unless cookie-str (return-from ask-gemini-web "(:type :LOG :payload (:text \"Gemini Cookies missing\"))"))
    (uiop:run-program (list "node" script-path prompt cookie-str) :output :string)))

Registration

(defskill :skill-web-research
  :priority 60
  :trigger (lambda (context) (eq (getf (getf context :payload) :sensor) :web-search))
  :neuro (lambda (context) nil)
  :symbolic (lambda (action context) (ask-gemini-web (getf (getf action :payload) :prompt))))