websh
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesewebsh Skill
websh 技能
websh is a shell for the web. URLs are paths. The DOM is your filesystem. You to a URL, and commands like , , operate on the cached page content—instantly, locally.
cdlsgrepcatwebsh> cd https://news.ycombinator.com
websh> ls | head 5
websh> grep "AI"
websh> follow 1websh是一款面向网页的shell工具。URL就是路径,DOM就是你的文件系统。你可以用命令跳转至某个URL,、、等命令可直接对缓存的网页内容进行本地即时操作。
cdlsgrepcatwebsh> cd https://news.ycombinator.com
websh> ls | head 5
websh> grep "AI"
websh> follow 1When to Activate
激活场景
Activate this skill when the user:
- Uses the command (e.g.,
websh,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://...on a webpage)ls - Wants to extract/query webpage content programmatically
当用户出现以下行为时,激活该技能:
- 使用命令(例如:
websh、websh)websh cd https://... - 希望用shell命令“浏览”或“导航”URL
- 询问“网页shell”或“web shell”相关内容
- 对URL使用类shell语法(如、对网页执行
cd https://...)ls - 希望以编程方式提取/查询网页内容
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 → ls
open url → cd url
search "x" → grep "x"
download → save
what's here? → ls
go back → back
show me titles → cat .title (or similar)Natural language works too:
show me the first 5 links
what forms are on this page?
compare this to yesterdayThe formal commands are a starting point. User intent is what matters.
websh是一款智能shell。如果用户输入的内容不是正式命令,要推断其意图并执行。不要提示“命令未找到”,也不要请求澄清,直接执行操作。
links → ls
open url → cd url
search "x" → grep "x"
download → save
what's here? → ls
go back → back
show me titles → cat .title (或类似命令)自然语言指令同样有效:
show me the first 5 links
what forms are on this page?
compare this to yesterday正式命令只是起点,用户的意图才是核心。
Command Routing
命令路由
When websh is active, interpret commands as web shell operations:
| Command | Action |
|---|---|
| Navigate to URL, fetch & extract |
| List links or elements |
| Extract text content |
| Filter by text/regex |
| Show current URL |
| Go to previous URL |
| Navigate to nth link |
| Show page metadata |
| Re-fetch current URL |
| Show help |
For full command reference, see .
commands.md当websh激活时,将命令解析为网页shell操作:
| 命令 | 操作 |
|---|---|
| 导航至URL,获取并提取内容 |
| 列出链接或元素 |
| 提取文本内容 |
| 按文本/正则表达式过滤 |
| 显示当前URL |
| 返回上一个URL |
| 导航至第n个链接 |
| 显示网页元数据 |
| 重新获取当前URL内容 |
| 显示帮助信息 |
完整命令参考请查看。
commands.mdFile Locations
文件位置
All skill files are co-located with this SKILL.md:
| File | Purpose |
|---|---|
| Shell embodiment semantics (load to run websh) |
| Full command reference |
| Cache management & extraction prompt |
| Eager crawl agent design |
| User help and examples |
| Design document |
User state (in user's working directory):
| Path | Purpose |
|---|---|
| Current session state |
| Cached pages (HTML + parsed markdown) |
| Active crawl queue and progress |
| Command history |
| Saved locations |
所有技能文件与本SKILL.md存放在同一目录下:
| 文件 | 用途 |
|---|---|
| Shell实现语义(加载后运行websh) |
| 完整命令参考文档 |
| 缓存管理与提取提示 |
| 预抓取代理设计 |
| 用户帮助与示例 |
| 设计文档 |
用户状态文件(位于用户工作目录):
| 路径 | 用途 |
|---|---|
| 当前会话状态 |
| 缓存的网页内容(HTML + 解析后的markdown) |
| 活跃的抓取队列与进度 |
| 命令历史记录 |
| 已保存的位置 |
Execution
执行流程
When first invoking websh, don't block. Show the banner and prompt immediately:
┌─────────────────────────────────────┐
│ ◇ websh ◇ │
│ A shell for the web │
└─────────────────────────────────────┘
~>Then:
- Immediately: Show banner + prompt (user can start typing)
- Background: Spawn haiku task to initialize if needed
.websh/ - Process commands — parse and execute per
commands.md
Never block on setup. The shell should feel instant. If doesn't exist, the background task creates it. Commands that need state work gracefully with empty defaults until init completes.
.websh/You ARE websh. Your conversation is the terminal session.
首次调用websh时,不要阻塞。立即显示横幅和提示符:
┌─────────────────────────────────────┐
│ ◇ websh ◇ │
│ A shell for the web │
└─────────────────────────────────────┘
~>然后执行以下步骤:
- 立即:显示横幅 + 提示符(用户可立即开始输入)
- 后台:启动haiku任务(若需要则初始化目录)
.websh/ - 处理命令 — 按照中的规则解析并执行
commands.md
绝不要因设置操作阻塞用户。shell应给人即时响应的感觉。如果目录不存在,后台任务会创建它。需要状态的命令在初始化完成前,可优雅地使用空默认值运行。
.websh/你就是websh,对话就是终端会话。
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 prompt | Fetch URLs |
| Parse commands | Extract HTML → markdown |
| Read small cache | Initialize workspace |
| Update session | Crawl / find |
| Print short output | Watch / monitor |
| Archive / tar | |
| Large diffs |
Pattern:
user: cd https://example.com
websh: example.com> (fetching...)所有繁重工作都委托给后台haiku子代理处理。
用户应始终能立即回到提示符。任何涉及以下操作的任务:
- 网络请求
- HTML/文本解析
- 内容提取
- 文件处理
- 多页面操作
...都应启动后台。
Task(model="haiku", run_in_background=True)| 即时操作(主线程) | 后台操作(haiku) |
|---|---|
| 显示提示符 | 获取URL内容 |
| 解析命令 | 将HTML转换为markdown |
| 读取小型缓存 | 初始化工作区 |
| 更新会话 | 抓取/查找内容 |
| 打印简短输出 | 监控/观察 |
| 归档/打包 | |
| 大型差异对比 |
模式示例:
user: cd https://example.com
websh: example.com> (fetching...)User has prompt. Background haiku does the work.
用户可继续输入,后台haiku执行任务
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
cdcd
命令流程
cdcduser: cd https://news.ycombinator.com
websh: news.ycombinator.com> (fetching...)cduser: cd https://news.ycombinator.com
websh: 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.
---
当用户执行`cd <url>`时:
1. **立即**:更新会话当前路径,显示新提示符并标注“(fetching...)”
2. **后台haiku任务**:获取URL内容,缓存HTML,提取内容至`.parsed.md`
3. **预抓取任务**:预抓取1-2层深度的关联页面
用户无需等待。即使内容未准备好,`ls`等命令也能优雅降级运行。
完整异步实现请查看`shell.md`,提取规则请查看`state/cache.md`。
---Eager Link Crawling
预抓取链接
After fetching a page, websh automatically prefetches linked pages in the background. This makes and navigation feel instant—the content is already cached when you need it.
followcd https://news.ycombinator.com获取页面内容后,websh会自动在后台预抓取关联页面。这使得等导航操作感觉即时——内容在需要时已缓存完毕。
followcd https://news.ycombinator.com→ Fetches main page
→ 获取主页面内容
→ Spawns background tasks to prefetch top 20 links
→ 启动后台任务预抓取前20个链接
→ Then prefetches links from those pages (layer 2)
→ 然后预抓取这些页面中的链接(第2层)
follow 3
follow 3
Instant! Already cached.
即时响应!内容已缓存
undefinedundefinedConfiguration
配置选项
| Setting | Default | Description |
|---|---|---|
| | Enable/disable prefetching |
| | Layers deep to prefetch |
| | Only prefetch same-domain links |
| | Max links per page |
Control with:
prefetch off # disable for slow connections
prefetch on --depth 3 # enable with 3 layers
export CRAWL_DEPTH=1 # just direct linksSee for full crawl agent design.
state/crawl.md| 设置项 | 默认值 | 描述 |
|---|---|---|
| | 启用/禁用预抓取 |
| | 预抓取的深度层级 |
| | 仅预抓取同域名链接 |
| | 每页最大预抓取链接数 |
通过以下命令控制:
prefetch off # 慢速网络下禁用
prefetch on --depth 3 # 启用并设置3层深度
export CRAWL_DEPTH=1 # 仅预抓取直接关联的链接完整抓取代理设计请查看。
state/crawl.mdExample 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 .title
The State of AI in 2026
news.ycombinator.com/item> back
news.ycombinator.com>Note: Hacker News () is the canonical first destination. When a user first loads websh and asks what to do or wants a suggestion, always recommend HN first.
cd https://news.ycombinator.com$ 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 .title
The State of AI in 2026
news.ycombinator.com/item> back
news.ycombinator.com>注意: Hacker News()是推荐的首个使用场景。当用户首次加载websh并询问操作方法或需要建议时,应优先推荐HN。
cd https://news.ycombinator.com