Conversation
Add `bsk site`, a daemon-free CLI family that keeps per-host site memory under `~/.bsk/sites/` so an explored flow is not re-explored: - `site context` / `checkpoint`: constrained SITE.md facts with `[verified YYYY-MM-DD]` stamps, per-task draft isolation, per-host revision CAS with draft re-seeding on conflict, repo-level file lock, transactional writes with journal rollback, 0700/0600 on unix. - `site workflow save|list|show|verify`: derive a semantic workflow from a TraceV3 recording bundle. `@eN` refs are stripped, VOM state annotations are dropped from anchors, typed values become named parameters and are never stored, page-driven navigations after a click/submit are treated as effects (landing URLs can embed typed values), `<select>` option values stay inline. `verify --pass` clears review flags except on anchorless steps. - `site candidate add|list|show`: evidence-gated observations that only promote after two distinct UTC dates. - Sensitive hosts (banking, SSO, password managers) are refused at every entry point; SITE.md, references and candidates are secret-scanned. Let an agent record its own run: `bsk record start --detach` arms the recorder and returns instead of holding the session busy, so the agent's observe/act commands are accepted and land in the bundle. The daemon's idle reaper skips sessions with an armed recording, and `record stop` no longer reports exit 4 when it races the blocked `record start`. Extension fixes found while testing on real sites: the search-chrome heuristic in record-capture treated `<body class="...search-vue...">` as a search shell and swallowed every click on zh.wikipedia.org after the first navigation (affects human recordings too); frame agents re-arm after a bfcache restore; `navigate-back`/`forward` onto a fragment-only history entry now waits for `Page.navigatedWithinDocument` and reports `reached=same_document` instead of timing out. Docs: SKILL.md "Site memory" section and operation-audit notes on what site memory stores and what it never stores. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
BrowserSkill 已经有
bsk record产出的 TraceV3 录制工件,但没有任何消费者:一次探索出来的流程下次仍要从头探索。本 PR 借鉴 webcmd 的"站点记忆纪律"(受约束的 SITE.md、草稿隔离、revision 比较交换、证据分级),用纯 CLI 在~/.bsk/sites/下实现本机私有的站点记忆,并让 agent 自己执行任务时顺手录制,不再依赖人工演示。不移植 webcmd 的 JS 适配器、插件、pipeline、cookie/intercept 策略与云端 seed。
改动
bsk site命令族(不需要 daemon)site context/site checkpoint:SITE.md 每条事实必须带[verified YYYY-MM-DD],行数预算与references/指针;每个任务一份草稿;per-host revision 比较交换,conflict 时重跑context会用已发布版本重新播种草稿(agent 重放自己的编辑);仓库级文件锁;事务写入,失败回滚含 journal 截断;unix 上目录 0700、文件 0600。site workflow save|list|show|verify:从录制 bundle 派生语义 workflow。强制剥除@eN;锚点与参数名剥掉[expanded]一类 VOM 状态注解;fill值一律参数化、不落盘(--inline-values显式内联,且凭证/邮箱/手机号启发式仍转参数);<select>的 option value 视为站点常量内联;页面因点击/提交自行发生的跳转视为前一步的效果而丢弃(落地 URL 常内嵌输入值,例如搜索结果页);about:blank等非 http(s) 跳转丢弃而非致命;首步缺 navigate 时用entry.start_url补。verify --pass清除复核标记,但无锚点 step 保留。site candidate add|list|show:候选观察需 ≥2 个不同 UTC 日期的证据才晋升。agent 自驱录制
bsk record start --detach:录制武装后立即返回并输出session_id,不再占住 session 的 busy gate,agent 的 observe/act 由扩展录制器按 trusted event 自动捕获;record stop --output导出。扩展代码无需改动。record stop与阻塞中的record start争抢stop_session的竞态不再导致 exit 4。扩展缺陷(真机测试中发现,人工录制同样受影响)
record-capture的搜索外壳启发式把<body class="…skin-vector-search-vue…">当成搜索框外壳,zh.wikipedia.org 首次跳转后所有点击被吞。已收紧判定。pageshow persisted)后重新武装。navigate-back/navigate-forward到 fragment-only 历史项时改等Page.navigatedWithinDocument,返回reached=same_document,不再超时(超时后重试会多退一格)。文档
skill/SKILL.md新增 "Site memory" 一节:三条规则(先读记忆、不为学习而探索、学习失败不影响任务)、detach 录制流程、conflict 恢复语义。docs/operation-audit.md新增"站点记忆:存什么、不存什么"。验证
cargo fmt --check、cargo clippy --workspace --all-targets -D warnings、cargo test --workspace --locked:826 通过,0 失败(基于 upstream/main)。tsc --noEmit干净,biome 干净,vitest 1691 通过。@eN、无输入值、无注解;新会话按 workflow 直接查询另一座山峰海拔零探索命中;conflict 恢复保留双方内容;idle 回收器跳过录制;黑名单与@劫持拒绝;grep输入值与@eN在~/.bsk/sites/零命中。已知限制
bsk observe在 www.wikipedia.org 上看不到#searchInput(packages/vom遮挡采样规则),复用时该步需用 CSS selector 兜底;同名多链接录制时标unmatched,派生丢锚点,后续可用ctx消歧。🤖 Generated with Claude Code