[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7F72FY2F5XTP678Z6S4PXZQ":3,"skill-same:01M7F72FY2F5XTP678Z6S4PXZQ":66},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":38,"commitSha":39,"skillDirectory":40,"forksCount":14,"repositoryHtmlUrl":41,"repositoryHomepageUrl":6,"ownerHtmlUrl":42,"ownerBlogUrl":43,"ownerDescription":44,"updatedAt":45,"install":46,"resources":59},"01M7F72FY2F5XTP678Z6S4PXZQ","hermes-web-provider-plugin",null,"Use when building a Hermes web-search provider plugin.","chaorenex1\u002Fhermes-home-content","chaorenex1","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F23194925?v=4","01M7F5NA1D1D02R2MEMYQN2NZT","chan chan","01M7F5NA20KTHMTY2015CYM1TZ",0,"MIT","https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002Fhermes-web-provider-plugin\u002FSKILL.md",[],[],"2026-11-16 10:05:34",false,"---\r\nname: hermes-web-provider-plugin\r\nversion: 1.1.0\r\ndescription: \"Use when building a Hermes web-search provider plugin.\"\r\nauthor: Masia\r\nlicense: MIT\r\nmetadata:\r\n  hermes:\r\n    tags: [hermes, plugins, web-search, camofox, provider]\r\n    related_skills: [hermes-agent, authoring-hermes-skills, safe-extension-deployment]\r\n---\r\n\r\n# Building a Hermes web-search provider plugin\r\n\r\n## When to Use\r\n\r\n- Building or extending a Hermes plugin that services `web_search` \u002F `web_extract`\r\n  (a new backend provider, or changes to camofox-search \u002F ai-search).\r\n- Debugging why a configured web provider is not registered, not selected, or not loading.\r\n- Needing plugin-side LLM calls (`ctx.llm`) or a child agent session (`ctx.subagent_lifecycle`) — see the `hermes-plugin-development` skill.\r\n\r\nReference implementations on this machine: `~\u002Fprojects\u002Fcamofox-search` (Camofox browser backend),\r\n`~\u002Fprojects\u002Fai-search` (Crawl4AI backend). Full docs: hermes-agent repo\r\n`website\u002Fdocs\u002Fdeveloper-guide\u002Fweb-search-provider-plugin.md` + `...\u002Fplugins\u002Findex.md`.\r\n\r\n## Repo layout that works\r\n\r\n```\r\n\u003Crepo>\u002F\r\n  plugin\u002F\u003Cpkg>\u002F                    # __init__.py (register), plugin.yaml, provider.py,\r\n                                   # client.py, engines.py, settings.py\r\n  scripts\u002Finstall_dev_plugin.py    # copy installer -> $HERMES_HOME\u002Fplugins\u002Fweb\u002F\u003Cpkg>\r\n  scripts\u002Fsmoke_live.py            # live daemon smoke (run with Hermes venv python)\r\n  tests\u002F                           # offline pytest (conftest stubs agent.* outside Hermes)\r\n  pyproject.toml                   # [project.entry-points.\"hermes_agent.plugins\"]\r\n```\r\n\r\n## Contracts (verified against hermes-agent source)\r\n\r\n- ABC: `agent.web_search_provider.WebSearchProvider` — implement `name`,\r\n  `is_available()` (cheap, NO network — runs on every `hermes tools` paint),\r\n  `supports_search()`\u002F`supports_extract()`, `search()`\u002F`extract()`, `get_setup_schema()`.\r\n- Return shapes, and they are NOT the same. `search()` returns the legacy envelope\r\n  `{\"success\": True, \"data\": {\"web\": [{title,url,description,position}]}}`, or\r\n  `{\"success\": False, \"error\": str}` on failure. `extract()` returns a bare **list**\r\n  `[{url,title,content,raw_content,metadata}, ...]` with `error` on a per-URL failure — never an\r\n  envelope. `tools\u002Fweb_tools_extract.py::_dispatch_extract` iterates the value directly, so an\r\n  envelope makes it iterate the dict's KEYS and the whole call dies with `'str' object has no\r\n  attribute 'get'`. `search`\u002F`extract` may be `async def`.\r\n- `agent\u002Fweb_search_provider.py`'s MODULE docstring still describes the envelope for extract; that\r\n  line is stale. The truth is the `extract()` method docstring, the bundled providers\r\n  (`plugins\u002Fweb\u002F{tavily,exa,firecrawl,parallel,keenable,perplexity}` all annotate `-> list[dict]`),\r\n  and the dispatcher that consumes the value.\r\n- `plugin.yaml`: `kind: backend` + `provides_web_providers: [\u003Cprovider-name>]`; manifest `name`\r\n  like `web-\u003Cslug>`; `requires_env` drives `hermes plugins install` prompts.\r\n- User plugin dirs: `$HERMES_HOME\u002Fplugins\u002F\u003Ccategory>\u002F\u003Cdir>\u002F` → loader key `\u003Ccategory>\u002F\u003Cdir>`, module\r\n  namespace `hermes_plugins.\u003Ccat>__\u003Cdir>` (`\u002F`→`__`, `-`→`_`). USE RELATIVE IMPORTS in the package.\r\n- User plugins are opt-in: `hermes plugins enable web\u002F\u003Cdir>`; bundled backends auto-load.\r\n- Install: copy to `$HERMES_HOME\u002Fplugins\u002Fweb\u002F\u003Cdir>` → `hermes plugins enable web\u002F\u003Cdir>`. The enable\r\n  soft-reloads a running Gateway (tools\u002Fskills land in the NEXT session) but re-imports no provider\r\n  code — a changed `provider.py` takes effect only after a gateway restart (deploy sequence below).\r\n  Validate with `hermes plugins validate \u003Cplugin_dir>` (runs register() in isolation).\r\n- Config\u002Fenv: resolve via `hermes_cli.config.get_env_value` (secret-scope aware) then\r\n  `os.environ`; re-raise `UnscopedSecretError` instead of falling back across profiles.\r\n- Live smoke needs the Hermes venv python (that python can import `agent.*`).\r\n\r\n## camofox REST (live-verified camofox-browser 2.4.8, engine camoufox)\r\n\r\n- Auth: `Authorization: Bearer \u003CCAMOFOX_API_KEY>` (Hermes `.env`); base `CAMOFOX_URL`,\r\n  default `http:\u002F\u002Flocalhost:9377`. Container: `docker start camofox-browser`.\r\n- `POST \u002Ftabs {userId, sessionKey, url}` → `{tabId}` — `sessionKey` is REQUIRED here\r\n  (core `tools\u002Fbrowser_camofox.py` sends `listItemId`; the daemon version rejects less).\r\n- `POST \u002Ftabs\u002F{id}\u002Fevaluate {userId, expression}` → `{ok, result, resultType, truncated}`;\r\n  normalize `result` (decoded JSON on 2.4.8, JSON string on other versions).\r\n- `DELETE \u002Fsessions\u002F{userId}` closes the browser context and clears the daemon's in-memory\r\n  per-user state; the on-disk profile dir (and its cookies) PERSISTS — it is not a wipe.\r\n- Bing SERP (cn.bing verified): `#b_results > li.b_algo`, `h2 a`, `.b_caption p`.\r\n- Tab creation rejects non-http(s) URLs (`Blocked URL scheme: about:`); blank tabs must OMIT `url`.\r\n\r\n## Plugin-owned profile + cookies (verified on camofox-browser 2.4.8 \u002F Edge 155)\r\n\r\n- Browse with ONE stable userId (`CAMOFOX_SEARCH_USER_ID`, default `camofox_search`): a cookie\r\n  import only reaches sessions of the SAME userId, so per-call random userIds silently discard\r\n  every import. Per call: open a work tab → do the work → close only that tab.\r\n- Camoufox destroys its browser WINDOW when a context's last tab closes; every later\r\n  `Browser.newPage` then fails (500, `delayedStartupPromise, window is null`). Keep one idle\r\n  blank HOLDER tab in the profile, and heal a broken context once: close session → ensure\r\n  holder → retry the tab create. A live smoke that opens\u002Fcloses tabs repeatedly is the probe\r\n  for this — a single-tab check will not catch it.\r\n- Cookie endpoints: `POST \u002Fsessions\u002F{userId}\u002Fcookies {cookies, tabId?}` (Playwright format;\r\n  each cookie needs name+value+domain; max 500 per request; needs a live tab — passing `tabId`\r\n  skips the canonical-profile checks) and `GET \u002Ftabs\u002F{tabId}\u002Fcookies?userId=` for round-trip\r\n  verification. Tool output carries counts only — never cookie values.\r\n- Reading the USER's own browser cookies (Windows): a running Chromium-family browser holds its\r\n  Cookies DB locked (persistent WinError 32, retries do not help). Fall back to a CDP export\r\n  from a browser started with `--remote-debugging-port` (probe a configurable port list), and\r\n  report what to close\u002Frestart — never kill the user's browser. Chromium values: DPAPI key from\r\n  `Local State` + AES-GCM, and modern builds prepend a 32-byte binding prefix to the plaintext\r\n  (strip it); app-bound `v20` is undecryptable — skip. Firefox `cookies.sqlite` is plaintext.\r\n- Depth — session\u002Fprofile model, exact decrypt formats, CDP recipe, scheduled-job pattern,\r\n  testing recipe: `references\u002Fcamofox-profile-and-cookies.md`.\r\n\r\n## Provider plugin + agent tool + bundled skill (one plugin, three surfaces)\r\n\r\nA web-provider plugin can also register agent tools and a bundled skill (proven in camofox-search v0.2):\r\n\r\n- `ctx.register_tool(name, toolset, schema, handler, emoji=...)`: handler signature `handler(args, **kwargs)`\r\n  must return a JSON **string** (the registry rejects plain dicts; only the multimodal envelope passes).\r\n- The manifest must declare the tool: `provides_tools: [\u003Cname>]` — otherwise\r\n  `hermes plugins validate` fails with \"undeclared tools registered (not in provides_tools)\".\r\n- `ctx.register_skill(\u003Cname>, Path(SKILL.md), description=..., frontmatter=...)`: read-only, resolvable\r\n  as `\u003Cmanifest name>:\u003Cskill>` (load with `skill_view`), listed in `\u003Cavailable_skills>` while enabled;\r\n  no manifest field needed. **Pass the parsed frontmatter explicitly**: the `\u003Cavailable_skills>` row\r\n  comes from register-time metadata (`list_plugin_skill_metadata`), NOT from re-reading the file — a\r\n  skill registered bare shows an empty description and no future agent can see its triggers. Parse\r\n  SKILL.md in `register()` with a small self-contained `key: value` + block-scalar parser; do NOT\r\n  import `agent.skill_utils` or other agent internals for it (`hermes plugins validate` flags private\r\n  core imports, and those seams move between releases).\r\n- Bundled skill conventions (user preference): write SKILL.md in ENGLISH — committed artifacts are\r\n  English-first even when the session language is Chinese — and put the trigger conditions in the\r\n  frontmatter `description`, since that text is all a future agent sees in the skills index before\r\n  deciding to load it.\r\n- Per-plugin SQLite store: resolve data dir from `hermes_constants.get_hermes_home()` (profile-aware;\r\n  fall back to `HERMES_HOME` env → platform default for standalone\u002Ftests), open connections with\r\n  `PRAGMA journal_mode=WAL` + `busy_timeout`, and catch store errors in the provider so search\u002Fextract\r\n  degrade to built-ins instead of failing.\r\n- Verify Hermes-side without pytest: `hermes plugins validate \u003Cplugin_dir>` (runs `register()` with a real\r\n  ctx — catches undeclared tools, collisions, import errors) and `hermes plugins doctor \u003Cplugin_dir>`\r\n  (discovery + import + registration in a temp HERMES_HOME). The Hermes venv ships no pytest: run the\r\n  repo suite under the repo venv (`PYTHONPATH=\u003Chermes-agent repo>` to exercise the real ABC), and run a\r\n  small probe script with the Hermes venv python for runtime checks.\r\n\r\n## Deploy to the live Hermes home and prove it (verified sequence)\r\n\r\nTreat \"deploy the plugin\" as full activation, not a file copy: install, enable, live smoke,\r\nbackend switch, evidence, revert path.\r\n\r\n1. Install the copy from the repo venv python:\r\n   `scripts\u002Finstall_dev_plugin.py --target-hermes-home \"$HERMES_HOME\"` (dry-run first; `--replace`\r\n   when a copy exists — it backs up and hash-verifies).\r\n2. `hermes plugins enable web\u002F\u003Cdir>` — output confirms enablement plus\r\n   `Gateway reloaded plugins — deferred: tools (next session)`. The first enable's soft reload\r\n   re-registers tools\u002Fskills metadata; it does NOT re-import provider code, so a changed\r\n   `provider.py` reaches the live gateway only after a restart.\r\n   - `hermes gateway restart` WORKS from an external CLI session: it drains, starts a new PID and\r\n     the platforms reconnect. Verify `hermes gateway status` reports the new PID and `gateway.log`\r\n     shows `✓ \u003Cplatform> connected`; a transient `127.0.0.1:8642 still accepting connections`\r\n     warning is the old socket draining, not a fault.\r\n   - It is refused only when the shell IS inside the gateway's own process tree (a gateway-hosted\r\n     session driving the terminal tool) — there, use the control-socket reload (step 8).\r\n   - Ship the fix with a `plugin.yaml` + `pyproject.toml` version bump in the same commit, so the\r\n     installed copy is identifiable against a later `--replace`.\r\n3. Prove the LIVE gateway loaded it:\r\n   `grep -i \"\u003Cplugin-dir>\" \"$HERMES_HOME\u002Flogs\u002Fagent.log\"` — expect\r\n   `Registered web provider '\u003Cname>'`, `registered tool: ...`, `registered skill: ...` lines.\r\n4. Live smoke with the Hermes venv python against the real daemon — this is also what creates the\r\n   real data dir \u002F rule DB for the first time.\r\n5. Point the profile at the provider: `hermes config set web.search_backend \u003Cname>` and\r\n   `web.extract_backend \u003Cname>`. Selection re-reads config per call, so no restart is needed.\r\n6. Prove selection with a probe under the Hermes venv python:\r\n   `discover_plugins()` → `agent.web_search_registry._configured_backend(\"search\")` →\r\n   `_resolve(configured, capability=\"search\").name` (same for `\"extract\"`).\r\n7. A configured backend may be DANGLING: `web.search_backend` can name a plugin installed only in\r\n   a different profile and resolution falls back silently. Check `hermes plugins list --plain`\r\n   before believing a configured value is active; switch it only when it is broken or the user asked.\r\n8. Updating an already-enabled plugin: `hermes plugins enable web\u002F\u003Cdir>` on an enabled plugin is a\r\n   NO-OP — it does not reload the gateway, so changed skill registration metadata (name\u002Fdescription)\r\n   stays stale in the running process. Force the reload over the gateway control socket (Hermes venv\r\n   python): `from gateway.control_socket import reload_gateway_plugins;\r\n   reload_gateway_plugins(Path(\"\u003Chermes home>\"))` → `{reloaded: True, plugins: [...],\r\n   adapters_rewired: N}`. Skill FILE content is path-served (a deployed SKILL.md edit is live on the\r\n   next `skill_view`) — only registration metadata needs the reload.\r\n9. Verifying a just-deployed tool: a `hermes chat -q` spawned from the agent shell routes through the\r\n   RUNNING gateway (platform=local) and reflects its IN-MEMORY plugin state — before the reload\r\n   lands it reports \"'\u003Ctool>' is not a known tool name\" even though the disk copy is new. Verify the\r\n   on-disk copy in a fresh python instead: `discover_plugins()` then\r\n   `model_tools.get_tool_definitions(skip_tool_search_assembly=True)` and check the tool names; then\r\n   reload over the control socket and re-run `hermes chat -q` to prove the live path.\r\n10. After installing a provider fix, prove the INSTALLED copy, not the repo: load it as a synthetic\r\n    package (`spec_from_file_location(name, \u003Cinstalled>\u002F__init__.py, submodule_search_locations=[\u003Cinstalled>])`)\r\n    and run the host dispatcher against it with a stubbed client. Then run the installer's backup\r\n    copy through the same probe — the old tree must reproduce the logged failure and the new one\r\n    must return entries. That A\u002FB is the only causal proof that the deployed bytes changed behaviour.\r\n\r\n## Pitfalls\r\n\r\n- Parallel work from a provider MUST run worker threads inside a copy of the caller's context:\r\n  the gateway's per-turn secret scope (`agent.secret_scope._SECRET_SCOPE`) is a `ContextVar` that\r\n  fresh threads do NOT inherit, and `get_env_value` on a multiplexed gateway FAILS CLOSED for any\r\n  env read in an unscoped thread (`UnscopedSecretError` — \"could not read this profile's\r\n  \u003CVAR> ... Run `hermes gateway restart`\"). The web_search call then errors and Hermes silently\r\n  rescues it with a keyless fallback (`served_by`\u002F`rescued_from` in the response) — broken, but\r\n  it looks like a result. Pattern: `context = contextvars.copy_context()` once, then\r\n  `pool.submit(context.copy().run, fn, ...)` per task — each task needs its OWN copy (a shared\r\n  Context cannot be entered concurrently). Regression-test by setting a probe ContextVar before\r\n  `search()` and asserting it inside the worker.\r\n- A provider's own test suite asserts whatever shape its author assumed, so it cannot catch a\r\n  contract mismatch — a green suite says nothing about the host. Verify every provider return value\r\n  against the real dispatcher with a stubbed client:\r\n  `asyncio.run(_dispatch_extract(Provider(), [\"https:\u002F\u002Fexample.com\u002F\"], None))` must return a list\r\n  of entries and must not raise; do the same for `_memoized_search`'s envelope expectations.\r\n- After deploying\u002Freloading a provider plugin, verify the LIVE gateway path with a real\r\n  `web_search` call and read the envelope: a `served_by`\u002F`rescued_from`\u002F`backend_error` rescue is\r\n  a FAILED call even though results come back. Direct probe scripts (Hermes venv python, no\r\n  gateway) never exercise the multiplex scope, so scope bugs surface only through the gateway.\r\n- Write `.gitignore` FIRST. For any full-file rewrite go straight to `rm` + `write_file`: the\r\n  stale-read guard blocks `write_file` on an existing file even after a fresh full read (a single\r\n  earlier paginated read poisons it) and re-reading does not reliably clear it.\r\n- Tests must pass outside Hermes: conftest installs a stub `agent.web_search_provider`\r\n  when the real runtime isn't importable. Run `compileall` under BOTH pythons\r\n  (Hermes venv 3.14 + repo venv).\r\n- Clamp `limit` with try\u002Fexcept `max(1, min(int(limit), 20))`; `limit or 5` turns 0 into 5.\r\n- Repo venv: `uv venv && uv pip install -p .venv\u002FScripts\u002Fpython.exe pytest requests`;\r\n  tests: `.venv\u002FScripts\u002Fpython.exe -m pytest`.\r\n- After a live smoke, check tabs PER USER: `GET \u002Ftabs?userId=\u003Cuser>` — the unfiltered\r\n  `GET \u002Ftabs` misleadingly returns `[]` and hides everything. The plugin's stable profile\r\n  should show exactly one idle blank holder tab and no leftover work tabs.\r\n","# Building a Hermes web-search provider plugin\r\n\r\n## When to Use\r\n\r\n- Building or extending a Hermes plugin that services `web_search` \u002F `web_extract`\r\n  (a new backend provider, or changes to camofox-search \u002F ai-search).\r\n- Debugging why a configured web provider is not registered, not selected, or not loading.\r\n- Needing plugin-side LLM calls (`ctx.llm`) or a child agent session (`ctx.subagent_lifecycle`) — see the `hermes-plugin-development` skill.\r\n\r\nReference implementations on this machine: `~\u002Fprojects\u002Fcamofox-search` (Camofox browser backend),\r\n`~\u002Fprojects\u002Fai-search` (Crawl4AI backend). Full docs: hermes-agent repo\r\n`website\u002Fdocs\u002Fdeveloper-guide\u002Fweb-search-provider-plugin.md` + `...\u002Fplugins\u002Findex.md`.\r\n\r\n## Repo layout that works\r\n\r\n```\r\n\u003Crepo>\u002F\r\n  plugin\u002F\u003Cpkg>\u002F                    # __init__.py (register), plugin.yaml, provider.py,\r\n                                   # client.py, engines.py, settings.py\r\n  scripts\u002Finstall_dev_plugin.py    # copy installer -> $HERMES_HOME\u002Fplugins\u002Fweb\u002F\u003Cpkg>\r\n  scripts\u002Fsmoke_live.py            # live daemon smoke (run with Hermes venv python)\r\n  tests\u002F                           # offline pytest (conftest stubs agent.* outside Hermes)\r\n  pyproject.toml                   # [project.entry-points.\"hermes_agent.plugins\"]\r\n```\r\n\r\n## Contracts (verified against hermes-agent source)\r\n\r\n- ABC: `agent.web_search_provider.WebSearchProvider` — implement `name`,\r\n  `is_available()` (cheap, NO network — runs on every `hermes tools` paint),\r\n  `supports_search()`\u002F`supports_extract()`, `search()`\u002F`extract()`, `get_setup_schema()`.\r\n- Return shapes, and they are NOT the same. `search()` returns the legacy envelope\r\n  `{\"success\": True, \"data\": {\"web\": [{title,url,description,position}]}}`, or\r\n  `{\"success\": False, \"error\": str}` on failure. `extract()` returns a bare **list**\r\n  `[{url,title,content,raw_content,metadata}, ...]` with `error` on a per-URL failure — never an\r\n  envelope. `tools\u002Fweb_tools_extract.py::_dispatch_extract` iterates the value directly, so an\r\n  envelope makes it iterate the dict's KEYS and the whole call dies with `'str' object has no\r\n  attribute 'get'`. `search`\u002F`extract` may be `async def`.\r\n- `agent\u002Fweb_search_provider.py`'s MODULE docstring still describes the envelope for extract; that\r\n  line is stale. The truth is the `extract()` method docstring, the bundled providers\r\n  (`plugins\u002Fweb\u002F{tavily,exa,firecrawl,parallel,keenable,perplexity}` all annotate `-> list[dict]`),\r\n  and the dispatcher that consumes the value.\r\n- `plugin.yaml`: `kind: backend` + `provides_web_providers: [\u003Cprovider-name>]`; manifest `name`\r\n  like `web-\u003Cslug>`; `requires_env` drives `hermes plugins install` prompts.\r\n- User plugin dirs: `$HERMES_HOME\u002Fplugins\u002F\u003Ccategory>\u002F\u003Cdir>\u002F` → loader key `\u003Ccategory>\u002F\u003Cdir>`, module\r\n  namespace `hermes_plugins.\u003Ccat>__\u003Cdir>` (`\u002F`→`__`, `-`→`_`). USE RELATIVE IMPORTS in the package.\r\n- User plugins are opt-in: `hermes plugins enable web\u002F\u003Cdir>`; bundled backends auto-load.\r\n- Install: copy to `$HERMES_HOME\u002Fplugins\u002Fweb\u002F\u003Cdir>` → `hermes plugins enable web\u002F\u003Cdir>`. The enable\r\n  soft-reloads a running Gateway (tools\u002Fskills land in the NEXT session) but re-imports no provider\r\n  code — a changed `provider.py` takes effect only after a gateway restart (deploy sequence below).\r\n  Validate with `hermes plugins validate \u003Cplugin_dir>` (runs register() in isolation).\r\n- Config\u002Fenv: resolve via `hermes_cli.config.get_env_value` (secret-scope aware) then\r\n  `os.environ`; re-raise `UnscopedSecretError` instead of falling back across profiles.\r\n- Live smoke needs the Hermes venv python (that python can import `agent.*`).\r\n\r\n## camofox REST (live-verified camofox-browser 2.4.8, engine camoufox)\r\n\r\n- Auth: `Authorization: Bearer \u003CCAMOFOX_API_KEY>` (Hermes `.env`); base `CAMOFOX_URL`,\r\n  default `http:\u002F\u002Flocalhost:9377`. Container: `docker start camofox-browser`.\r\n- `POST \u002Ftabs {userId, sessionKey, url}` → `{tabId}` — `sessionKey` is REQUIRED here\r\n  (core `tools\u002Fbrowser_camofox.py` sends `listItemId`; the daemon version rejects less).\r\n- `POST \u002Ftabs\u002F{id}\u002Fevaluate {userId, expression}` → `{ok, result, resultType, truncated}`;\r\n  normalize `result` (decoded JSON on 2.4.8, JSON string on other versions).\r\n- `DELETE \u002Fsessions\u002F{userId}` closes the browser context and clears the daemon's in-memory\r\n  per-user state; the on-disk profile dir (and its cookies) PERSISTS — it is not a wipe.\r\n- Bing SERP (cn.bing verified): `#b_results > li.b_algo`, `h2 a`, `.b_caption p`.\r\n- Tab creation rejects non-http(s) URLs (`Blocked URL scheme: about:`); blank tabs must OMIT `url`.\r\n\r\n## Plugin-owned profile + cookies (verified on camofox-browser 2.4.8 \u002F Edge 155)\r\n\r\n- Browse with ONE stable userId (`CAMOFOX_SEARCH_USER_ID`, default `camofox_search`): a cookie\r\n  import only reaches sessions of the SAME userId, so per-call random userIds silently discard\r\n  every import. Per call: open a work tab → do the work → close only that tab.\r\n- Camoufox destroys its browser WINDOW when a context's last tab closes; every later\r\n  `Browser.newPage` then fails (500, `delayedStartupPromise, window is null`). Keep one idle\r\n  blank HOLDER tab in the profile, and heal a broken context once: close session → ensure\r\n  holder → retry the tab create. A live smoke that opens\u002Fcloses tabs repeatedly is the probe\r\n  for this — a single-tab check will not catch it.\r\n- Cookie endpoints: `POST \u002Fsessions\u002F{userId}\u002Fcookies {cookies, tabId?}` (Playwright format;\r\n  each cookie needs name+value+domain; max 500 per request; needs a live tab — passing `tabId`\r\n  skips the canonical-profile checks) and `GET \u002Ftabs\u002F{tabId}\u002Fcookies?userId=` for round-trip\r\n  verification. Tool output carries counts only — never cookie values.\r\n- Reading the USER's own browser cookies (Windows): a running Chromium-family browser holds its\r\n  Cookies DB locked (persistent WinError 32, retries do not help). Fall back to a CDP export\r\n  from a browser started with `--remote-debugging-port` (probe a configurable port list), and\r\n  report what to close\u002Frestart — never kill the user's browser. Chromium values: DPAPI key from\r\n  `Local State` + AES-GCM, and modern builds prepend a 32-byte binding prefix to the plaintext\r\n  (strip it); app-bound `v20` is undecryptable — skip. Firefox `cookies.sqlite` is plaintext.\r\n- Depth — session\u002Fprofile model, exact decrypt formats, CDP recipe, scheduled-job pattern,\r\n  testing recipe: `references\u002Fcamofox-profile-and-cookies.md`.\r\n\r\n## Provider plugin + agent tool + bundled skill (one plugin, three surfaces)\r\n\r\nA web-provider plugin can also register agent tools and a bundled skill (proven in camofox-search v0.2):\r\n\r\n- `ctx.register_tool(name, toolset, schema, handler, emoji=...)`: handler signature `handler(args, **kwargs)`\r\n  must return a JSON **string** (the registry rejects plain dicts; only the multimodal envelope passes).\r\n- The manifest must declare the tool: `provides_tools: [\u003Cname>]` — otherwise\r\n  `hermes plugins validate` fails with \"undeclared tools registered (not in provides_tools)\".\r\n- `ctx.register_skill(\u003Cname>, Path(SKILL.md), description=..., frontmatter=...)`: read-only, resolvable\r\n  as `\u003Cmanifest name>:\u003Cskill>` (load with `skill_view`), listed in `\u003Cavailable_skills>` while enabled;\r\n  no manifest field needed. **Pass the parsed frontmatter explicitly**: the `\u003Cavailable_skills>` row\r\n  comes from register-time metadata (`list_plugin_skill_metadata`), NOT from re-reading the file — a\r\n  skill registered bare shows an empty description and no future agent can see its triggers. Parse\r\n  SKILL.md in `register()` with a small self-contained `key: value` + block-scalar parser; do NOT\r\n  import `agent.skill_utils` or other agent internals for it (`hermes plugins validate` flags private\r\n  core imports, and those seams move between releases).\r\n- Bundled skill conventions (user preference): write SKILL.md in ENGLISH — committed artifacts are\r\n  English-first even when the session language is Chinese — and put the trigger conditions in the\r\n  frontmatter `description`, since that text is all a future agent sees in the skills index before\r\n  deciding to load it.\r\n- Per-plugin SQLite store: resolve data dir from `hermes_constants.get_hermes_home()` (profile-aware;\r\n  fall back to `HERMES_HOME` env → platform default for standalone\u002Ftests), open connections with\r\n  `PRAGMA journal_mode=WAL` + `busy_timeout`, and catch store errors in the provider so search\u002Fextract\r\n  degrade to built-ins instead of failing.\r\n- Verify Hermes-side without pytest: `hermes plugins validate \u003Cplugin_dir>` (runs `register()` with a real\r\n  ctx — catches undeclared tools, collisions, import errors) and `hermes plugins doctor \u003Cplugin_dir>`\r\n  (discovery + import + registration in a temp HERMES_HOME). The Hermes venv ships no pytest: run the\r\n  repo suite under the repo venv (`PYTHONPATH=\u003Chermes-agent repo>` to exercise the real ABC), and run a\r\n  small probe script with the Hermes venv python for runtime checks.\r\n\r\n## Deploy to the live Hermes home and prove it (verified sequence)\r\n\r\nTreat \"deploy the plugin\" as full activation, not a file copy: install, enable, live smoke,\r\nbackend switch, evidence, revert path.\r\n\r\n1. Install the copy from the repo venv python:\r\n   `scripts\u002Finstall_dev_plugin.py --target-hermes-home \"$HERMES_HOME\"` (dry-run first; `--replace`\r\n   when a copy exists — it backs up and hash-verifies).\r\n2. `hermes plugins enable web\u002F\u003Cdir>` — output confirms enablement plus\r\n   `Gateway reloaded plugins — deferred: tools (next session)`. The first enable's soft reload\r\n   re-registers tools\u002Fskills metadata; it does NOT re-import provider code, so a changed\r\n   `provider.py` reaches the live gateway only after a restart.\r\n   - `hermes gateway restart` WORKS from an external CLI session: it drains, starts a new PID and\r\n     the platforms reconnect. Verify `hermes gateway status` reports the new PID and `gateway.log`\r\n     shows `✓ \u003Cplatform> connected`; a transient `127.0.0.1:8642 still accepting connections`\r\n     warning is the old socket draining, not a fault.\r\n   - It is refused only when the shell IS inside the gateway's own process tree (a gateway-hosted\r\n     session driving the terminal tool) — there, use the control-socket reload (step 8).\r\n   - Ship the fix with a `plugin.yaml` + `pyproject.toml` version bump in the same commit, so the\r\n     installed copy is identifiable against a later `--replace`.\r\n3. Prove the LIVE gateway loaded it:\r\n   `grep -i \"\u003Cplugin-dir>\" \"$HERMES_HOME\u002Flogs\u002Fagent.log\"` — expect\r\n   `Registered web provider '\u003Cname>'`, `registered tool: ...`, `registered skill: ...` lines.\r\n4. Live smoke with the Hermes venv python against the real daemon — this is also what creates the\r\n   real data dir \u002F rule DB for the first time.\r\n5. Point the profile at the provider: `hermes config set web.search_backend \u003Cname>` and\r\n   `web.extract_backend \u003Cname>`. Selection re-reads config per call, so no restart is needed.\r\n6. Prove selection with a probe under the Hermes venv python:\r\n   `discover_plugins()` → `agent.web_search_registry._configured_backend(\"search\")` →\r\n   `_resolve(configured, capability=\"search\").name` (same for `\"extract\"`).\r\n7. A configured backend may be DANGLING: `web.search_backend` can name a plugin installed only in\r\n   a different profile and resolution falls back silently. Check `hermes plugins list --plain`\r\n   before believing a configured value is active; switch it only when it is broken or the user asked.\r\n8. Updating an already-enabled plugin: `hermes plugins enable web\u002F\u003Cdir>` on an enabled plugin is a\r\n   NO-OP — it does not reload the gateway, so changed skill registration metadata (name\u002Fdescription)\r\n   stays stale in the running process. Force the reload over the gateway control socket (Hermes venv\r\n   python): `from gateway.control_socket import reload_gateway_plugins;\r\n   reload_gateway_plugins(Path(\"\u003Chermes home>\"))` → `{reloaded: True, plugins: [...],\r\n   adapters_rewired: N}`. Skill FILE content is path-served (a deployed SKILL.md edit is live on the\r\n   next `skill_view`) — only registration metadata needs the reload.\r\n9. Verifying a just-deployed tool: a `hermes chat -q` spawned from the agent shell routes through the\r\n   RUNNING gateway (platform=local) and reflects its IN-MEMORY plugin state — before the reload\r\n   lands it reports \"'\u003Ctool>' is not a known tool name\" even though the disk copy is new. Verify the\r\n   on-disk copy in a fresh python instead: `discover_plugins()` then\r\n   `model_tools.get_tool_definitions(skip_tool_search_assembly=True)` and check the tool names; then\r\n   reload over the control socket and re-run `hermes chat -q` to prove the live path.\r\n10. After installing a provider fix, prove the INSTALLED copy, not the repo: load it as a synthetic\r\n    package (`spec_from_file_location(name, \u003Cinstalled>\u002F__init__.py, submodule_search_locations=[\u003Cinstalled>])`)\r\n    and run the host dispatcher against it with a stubbed client. Then run the installer's backup\r\n    copy through the same probe — the old tree must reproduce the logged failure and the new one\r\n    must return entries. That A\u002FB is the only causal proof that the deployed bytes changed behaviour.\r\n\r\n## Pitfalls\r\n\r\n- Parallel work from a provider MUST run worker threads inside a copy of the caller's context:\r\n  the gateway's per-turn secret scope (`agent.secret_scope._SECRET_SCOPE`) is a `ContextVar` that\r\n  fresh threads do NOT inherit, and `get_env_value` on a multiplexed gateway FAILS CLOSED for any\r\n  env read in an unscoped thread (`UnscopedSecretError` — \"could not read this profile's\r\n  \u003CVAR> ... Run `hermes gateway restart`\"). The web_search call then errors and Hermes silently\r\n  rescues it with a keyless fallback (`served_by`\u002F`rescued_from` in the response) — broken, but\r\n  it looks like a result. Pattern: `context = contextvars.copy_context()` once, then\r\n  `pool.submit(context.copy().run, fn, ...)` per task — each task needs its OWN copy (a shared\r\n  Context cannot be entered concurrently). Regression-test by setting a probe ContextVar before\r\n  `search()` and asserting it inside the worker.\r\n- A provider's own test suite asserts whatever shape its author assumed, so it cannot catch a\r\n  contract mismatch — a green suite says nothing about the host. Verify every provider return value\r\n  against the real dispatcher with a stubbed client:\r\n  `asyncio.run(_dispatch_extract(Provider(), [\"https:\u002F\u002Fexample.com\u002F\"], None))` must return a list\r\n  of entries and must not raise; do the same for `_memoized_search`'s envelope expectations.\r\n- After deploying\u002Freloading a provider plugin, verify the LIVE gateway path with a real\r\n  `web_search` call and read the envelope: a `served_by`\u002F`rescued_from`\u002F`backend_error` rescue is\r\n  a FAILED call even though results come back. Direct probe scripts (Hermes venv python, no\r\n  gateway) never exercise the multiplex scope, so scope bugs surface only through the gateway.\r\n- Write `.gitignore` FIRST. For any full-file rewrite go straight to `rm` + `write_file`: the\r\n  stale-read guard blocks `write_file` on an existing file even after a fresh full read (a single\r\n  earlier paginated read poisons it) and re-reading does not reliably clear it.\r\n- Tests must pass outside Hermes: conftest installs a stub `agent.web_search_provider`\r\n  when the real runtime isn't importable. Run `compileall` under BOTH pythons\r\n  (Hermes venv 3.14 + repo venv).\r\n- Clamp `limit` with try\u002Fexcept `max(1, min(int(limit), 20))`; `limit or 5` turns 0 into 5.\r\n- Repo venv: `uv venv && uv pip install -p .venv\u002FScripts\u002Fpython.exe pytest requests`;\r\n  tests: `.venv\u002FScripts\u002Fpython.exe -m pytest`.\r\n- After a live smoke, check tabs PER USER: `GET \u002Ftabs?userId=\u003Cuser>` — the unfiltered\r\n  `GET \u002Ftabs` misleadingly returns `[]` and hides everything. The plugin's stable profile\r\n  should show exactly one idle blank holder tab and no leftover work tabs.\r\n",{"name":5,"author":24,"license":15,"version":25,"metadata":26,"description":7},"Masia","1.1.0",{"hermes":27},{"tags":28,"related_skills":34},[29,30,31,32,33],"hermes","plugins","web-search","camofox","provider",[35,36,37],"hermes-agent","authoring-hermes-skills","safe-extension-deployment","main","a3f3199bb87ec3c91248f68a39d88527e1847ae9","skills\u002Fhermes-web-provider-plugin","https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content","https:\u002F\u002Fgithub.com\u002Fchaorenex1","https:\u002F\u002Fblog.aduib.com","A programmer whose only hobby in life is coding","2026-10-20 00:34:32",{"source":8,"skillName":5,"commands":47,"prompt":57,"zipAvailable":58},[48,51,54],{"tool":49,"command":50},"npx","npx skills add chaorenex1\u002Fhermes-home-content --skill hermes-web-provider-plugin",{"tool":52,"command":53},"bunx","bunx skills add chaorenex1\u002Fhermes-home-content --skill hermes-web-provider-plugin",{"tool":55,"command":56},"pnpm","pnpm dlx skills add chaorenex1\u002Fhermes-home-content --skill hermes-web-provider-plugin","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002Fhermes-web-provider-plugin\u002FSKILL.md",true,[60],{"path":61,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":64,"sourceHtmlUrl":65},"references\u002Fcamofox-profile-and-cookies.md","REFERENCE","参考文档",7955,"https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002Fhermes-web-provider-plugin\u002Freferences\u002Fcamofox-profile-and-cookies.md",[67,74,81,88,95,102],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M7F8GF32YD5MBQW2TGSRH1YP","web-retrieval-resilience","Web tools fail or search rules break: repair or fall back.","https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002Fweb\u002Fweb-retrieval-resilience\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M7F8FP46QESQMCZ1KBT3TW3R","blocked-page-recovery","Use when a fetch fails: 403\u002F429, paywall, WAF, bot wall.","https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002Fweb\u002Fblocked-page-recovery\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M7F8ER6VXHBNVRQBZS7X08SE","verification-loop","Run a six-phase verification of a Claude Code session's work — build, type check, lint, tests with coverage, security grep, and diff review — then produce a PASS\u002FFAIL verification report. Use when verifying work after completing a feature or refactor, before creating a PR, or when quality gates must pass.","https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002Fverification-loop\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M7F8E4BQJ38KVQVM3MT20PYV","unreal-world-builder","开放世界与环境专家——精通 UE5 World Partition、Landscape、程序化植被、HLOD 和大规模关卡流式加载，打造无缝开放世界体验","https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002Funreal-engine\u002Funreal-world-builder\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":19},"01M7F8D747SQW2FTP7GBSX38BR","unreal-technical-artist","Unreal Engine 视觉管线专家——精通材质编辑器、Niagara 特效、程序化内容生成和 UE5 项目的美术到引擎管线","https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002Funreal-engine\u002Funreal-technical-artist\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":19},"01M7F8CKHYJVZVBTN0321J88T2","unreal-systems-engineer","性能与混合架构专家——精通 C++\u002FBlueprint 边界、Nanite 几何体、Lumen GI 和 Gameplay Ability System，面向 AAA 级 Unreal Engine 项目","https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002Funreal-engine\u002Funreal-systems-engineer\u002FSKILL.md",[],[]]