#+TITLE: SKILL: Web Research Agent (Universal Literate Note) #+ID: skill-web-research #+STARTUP: content #+FILETAGS: :web:research:browser:psf: * 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) :PROPERTIES: :STATUS: SIGNED :END: ** 1. Purpose Automate web-based information retrieval and subscription-tier AI access. * Phase B: Blueprint (PROTOCOL) :PROPERTIES: :STATUS: SIGNED :END: ** 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 #+begin_src lisp :tangle ../projects/org-skill-web-research/src/research-logic.lisp (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))) #+end_src * Registration #+begin_src lisp (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)))) #+end_src