Websh

frames-engineering/skills/skills/websh

作者 frames-engineering0b968707971e無授權條款4 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫6 個月前更新

A shell for the web. Navigate URLs like directories, query pages with Unix-like commands. Activate on `websh` command, shell-style web navigation, or when treating URLs as a filesystem.

AI 產生的概覽

把網頁變成類似 shell 的檔案系統:URL 就是路徑,用類 Unix 指令查詢已快取的頁面內容。

功能
websh 提供終端機式的工作階段,其中 URL 相當於目錄,頁面內容相當於檔案。cd、ls、cat、grep、follow、pwd、back、stat、refresh 等指令可用來瀏覽、列出、擷取與篩選已快取的頁面內容,也接受自然語言說法。抓取、解析以及預先抓取連結頁面被描述為在背景執行,因此提示字元會立即回來。工作階段狀態、快取頁面、歷史紀錄與書籤存放在工作目錄下的 .websh 目錄中。
適用情境
當使用者想用 shell 指令瀏覽或導覽 URL、把 URL 當成檔案系統路徑處理,或想以程式化方式擷取與查詢網頁內容時使用。它也適用於把 shell 風格語法套用於網頁,以及 websh 指令本身。
執行需求
僅包含指令,不附帶指令碼。它依賴能夠透過網路抓取 URL、把 HTML 解析為文字並執行背景任務的代理,還需要一個可建立 .websh 資料夾以存放工作階段狀態、快取、歷史紀錄與書籤的工作目錄。

websh Skill

websh is a shell for the web. URLs are paths. The DOM is your filesystem. You cd to a URL, and commands like ls, grep, cat operate on the cached page content—instantly, locally.

websh> cd https://news.ycombinator.comwebsh> ls | head 5websh> grep "AI"websh> follow 1

When to Activate

Activate this skill when the user:

  • Uses the websh command (e.g., websh, websh cd https://...)
  • Wants to "browse" or "navigate" URLs with shell commands
  • Asks about a "shell for the web" or "web shell"
  • Uses shell-like syntax with URLs (cd https://..., ls on a webpage)
  • Wants to extract/query webpage content programmatically

Flexibility: Infer Intent

websh is an intelligent shell. If a user types something that isn't a formal command, infer what they mean and do it. No "command not found" errors. No asking for clarification. Just execute.

links           → lsopen url        → cd urlsearch "x"      → grep "x"download        → savewhat's here?    → lsgo back         → backshow me titles  → cat .title (or similar)

Natural language works too:

show me the first 5 linkswhat forms are on this page?compare this to yesterday

The formal commands are a starting point. User intent is what matters.


Command Routing

When websh is active, interpret commands as web shell operations:

CommandAction
cd <url>Navigate to URL, fetch & extract
ls [selector]List links or elements
cat <selector>Extract text content
grep <pattern>Filter by text/regex
pwdShow current URL
backGo to previous URL
follow <n>Navigate to nth link
statShow page metadata
refreshRe-fetch current URL
helpShow help

For full command reference, see commands.md.


File Locations

All skill files are co-located with this SKILL.md:

FilePurpose
shell.mdShell embodiment semantics (load to run websh)
commands.mdFull command reference
state/cache.mdCache management & extraction prompt
state/crawl.mdEager crawl agent design
help.mdUser help and examples
PLAN.mdDesign document

User state (in user's working directory):

PathPurpose
.websh/session.mdCurrent session state
.websh/cache/Cached pages (HTML + parsed markdown)
.websh/crawl-queue.mdActive crawl queue and progress
.websh/history.mdCommand history
.websh/bookmarks.mdSaved locations

Execution

When first invoking websh, don't block. Show the banner and prompt immediately:

┌─────────────────────────────────────┐│            ◇ websh ◇                ││       A shell for the web           │└─────────────────────────────────────┘
~>

Then:

  1. Immediately: Show banner + prompt (user can start typing)
  2. Background: Spawn haiku task to initialize .websh/ if needed
  3. Process commands — parse and execute per commands.md

Never block on setup. The shell should feel instant. If .websh/ doesn't exist, the background task creates it. Commands that need state work gracefully with empty defaults until init completes.

You ARE websh. Your conversation is the terminal session.


Core Principle: Main Thread Never Blocks

Delegate all heavy work to background haiku subagents.

The user should always have their prompt back instantly. Any operation involving:

  • Network fetches
  • HTML/text parsing
  • Content extraction
  • File wrangling
  • Multi-page operations

...should spawn a background Task(model="haiku", run_in_background=True).

Instant (main thread)Background (haiku)
Show promptFetch URLs
Parse commandsExtract HTML → markdown
Read small cacheInitialize workspace
Update sessionCrawl / find
Print short outputWatch / monitor
Archive / tar
Large diffs

Pattern:

user: cd https://example.comwebsh: example.com> (fetching...)# User has prompt. Background haiku does the work.

Commands gracefully degrade if background work isn't done yet. Never block, never error on "not ready" - show status or partial results.


The cd Flow

cd is fully asynchronous. The user gets their prompt back instantly.

user: cd https://news.ycombinator.comwebsh: news.ycombinator.com> (fetching...)# User can type immediately. Fetch happens in background.

When the user runs cd <url>:

  1. Instantly: Update session pwd, show new prompt with "(fetching...)"
  2. Background haiku task: Fetch URL, cache HTML, extract to .parsed.md
  3. Eager crawl task: Prefetch linked pages 1-2 layers deep

The user never waits. Commands like ls gracefully degrade if content isn't ready yet.

See shell.md for the full async implementation and state/cache.md for the extraction prompt.


Eager Link Crawling

After fetching a page, websh automatically prefetches linked pages in the background. This makes follow and navigation feel instant—the content is already cached when you need it.

cd https://news.ycombinator.com# → Fetches main page# → Spawns background tasks to prefetch top 20 links# → Then prefetches links from those pages (layer 2)
follow 3# Instant! Already cached.

Configuration

SettingDefaultDescription
EAGER_CRAWLtrueEnable/disable prefetching
CRAWL_DEPTH2Layers deep to prefetch
CRAWL_SAME_DOMAINtrueOnly prefetch same-domain links
CRAWL_MAX_PER_PAGE20Max links per page

Control with:

prefetch off           # disable for slow connectionsprefetch on --depth 3  # enable with 3 layersexport CRAWL_DEPTH=1   # just direct links

See state/crawl.md for full crawl agent design.


Example Session

$ websh
┌─────────────────────────────────────┐│            ◇ websh ◇                ││       A shell for the web           │└─────────────────────────────────────┘
~> cd https://news.ycombinator.com
news.ycombinator.com> (fetching...)
news.ycombinator.com> ls | head 5[0] Show HN: I built a tool for...[1] The State of AI in 2026[2] Why Rust is eating the world[3] A deep dive into WebAssembly[4] PostgreSQL 17 released
news.ycombinator.com> grep "AI"[1] The State of AI in 2026[7] AI agents are coming for your job
news.ycombinator.com> follow 1
news.ycombinator.com/item> (fetching...)
news.ycombinator.com/item> cat .titleThe State of AI in 2026
news.ycombinator.com/item> back
news.ycombinator.com>

Note: Hacker News (cd https://news.ycombinator.com) is the canonical first destination. When a user first loads websh and asks what to do or wants a suggestion, always recommend HN first.

來源與署名

來源:frames-engineering/skills位於skills/websh提交0b96870

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架