资讯动态

screenpipe 如何编写自己的定时 AI 自动化 pipe(pipe.md)?

发布时间:2026/9/14 7:26:36 来源:尧图企业网站定制
screenpipe 如何编写自己的定时 AI 自动化 pipepipe.md【免费下载链接】screenpipeYC (S26) | Open Computer History | Record your screen continuously locally and provide context to your agents (Claude, Codex, Openclaw, Hermes, Runner...)项目地址: https://gitcode.com/GitHub_Trending/sc/screenpipescreenpipe 会持续在本地记录屏幕内容主要通过 accessibility API必要时 OCR 兜底和音频转写并在http://localhost:3030提供一个本地 API。如果你想让一段 AI 指令按固定周期自动执行——比如每 30 分钟总结我刚才的屏幕活动——screenpipe 的 pipe 就是为此设计的一个 pipe 就是一个纯 Markdown 文件pipe.md由 YAML frontmatter定时计划等配置加一段提示词组成。本文的完整任务路径是创建pipe.md→ 安装并启用 → 手动触发测试 → 查看执行日志确认结果 → 需要时收紧权限或更换模型。前提条件来自文档已安装并在运行 screenpipe 桌面应用且已完成授权macOS 需在 System Settings → Privacy Security 允许屏幕录制和辅助功能访问screenpipe 本地 API 存活curl http://localhost:3030/health该接口不需要 token机器上有 Nodenpx、Bun 或其他文档支持的运行时之一。创建 pipe.md一个文件夹加一个文件每个 pipe 对应~/.screenpipe/pipes/下的一个文件夹文件夹内放一个pipe.md。文档给出的最短创建命令可直接执行my-pipe为固定示例名想改可直接替换mkdir -p ~/.screenpipe/pipes/my-pipe cat ~/.screenpipe/pipes/my-pipe/pipe.md EOF --- schedule: every 30m enabled: true --- Summarize my screen activity for the last 30 minutes. Query screenpipe at http://localhost:3030/search using the time range from the context header. Authenticate with the SCREENPIPE_LOCAL_API_KEY environment variable. Write the summary to ./output/date.md EOF其中date是提示词里给 AI agent 的占位写法agent 运行时用实际日期替换不是需要你在 shell 里预先替换的变量。frontmatter 字段来自文档的完整表格字段必填默认值说明schedule是manualevery 30m、every 2h、daily、5 段式 cron如0 */2 * * *或manual仅手动触发enabled否true调度器是否运行这个 pipetimeout否3005 分钟执行超时秒数慢模型可提高如timeout: 240040 分钟。超过会被终止提示词里不需要写时间模板变量执行前 screenpipe 会自动在提示词前加一段 context header内容包含时间范围基于 schedule 间隔的起止时间戳、当前日期、用户时区、pipe 名称、输出目录和本地 API 地址Time range: 2026-02-12T13:00:00Z to 2026-02-12T14:00:00Z Date: 2026-02-12 Timezone: PST (UTC-08:00) Pipe name: my-pipe Output directory: ./output/ Screenpipe API: http://localhost:3030所以上面的提示词只需写用 context header 里的时间范围查http://localhost:3030/search不需要自己拼时间戳。agent 每次运行会拿到注入的SCREENPIPE_LOCAL_API_KEY环境变量用它给受保护的本地 API 请求加认证头curl -H Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY \ http://localhost:3030/search?limit20content_typeallstart_timeISO8601end_timeISO8601ISO8601替换为具体时间戳常用查询参数包括q文本搜索、content_typeall/ocr/audio/input/accessibility、limit默认 20、app_name、window_name等。browser_url是返回的元数据而非过滤器——想按 URL 找页面要用q搜索再检查每条结果的browser_url。外部服务的密钥放 .env不要写进提示词如果 pipe 要调用 Toggl、Slack 等外部 API把 key 存在 pipe 文件夹内的.env而不是pipe.md正文里提示词可能出现在日志中echo TOGGL_API_KEYyour_key_here ~/.screenpipe/pipes/toggl-sync/.env然后在提示词中指示 agentsource .env curl -u $TOGGL_API_KEY:api_token ...。安装、启用并手动测试screenpipe CLI 通过npx -y screenpipelatest直接调用无需单独安装bunx screenpipelatest和bun x screenpipelatest等价机器上有哪个用哪个。文档建议把 CLI 命令放在干净的临时目录里执行避免node_modules冲突cd $(mktemp -d) # 安装本地文件夹或 GitHub URL 均可 npx -y screenpipelatest pipe install ~/.screenpipe/pipes/my-pipe # 打开调度 npx -y screenpipelatest pipe enable my-pipe # 立即手动跑一次先验证再依赖定时 npx -y screenpipelatest pipe run my-pipe # 查看执行日志 npx -y screenpipelatest pipe logs my-pipe完整命令集list/install/enable/disable/run/logs/delete在 pipes 文档 中都有。桌面应用里也能做同样的事打开Pipes → My Pipes可以看到本地发现的 pipe 文件夹在那里切换调度、手动运行、查看日志、为每个 pipe 指定 AI preset。通过 REST API 管理可选路径screenpipe 运行时也可以用带认证的 REST API 完成同样的操作export SCREENPIPE_LOCAL_API_KEY$(npx -y screenpipelatest auth token) # 列出所有 pipes curl http://localhost:3030/pipes \ -H Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY # 手动运行一次 curl -X POST http://localhost:3030/pipes/my-pipe/run \ -H Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY # 启用/停用 curl -X POST http://localhost:3030/pipes/my-pipe/enable \ -H Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY \ -H Content-Type: application/json \ -d {enabled: true} # 查看日志 curl http://localhost:3030/pipes/my-pipe/logs \ -H Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY当Require API Authentication开启时受保护请求都需要上面的 Bearer 头/health除外。结果验证日志与输出文件验证分三层来自 pipe debugging 文档 的快速分诊表检查项命令确认什么引擎存活curl http://localhost:3030/health本地 API 在工作有可查数据curl http://localhost:3030/search?limit5屏幕/音频数据可被检索pipe 已安装且启用curl http://localhost:3030/pipes列表里有你的 pipe执行日志curl http://localhost:3030/pipes/name/logs最近一次 stdout/stderr 和错误手动触发curl -X POST http://localhost:3030/pipes/name/run排除调度问题清理卡住的运行curl -X POST http://localhost:3030/pipes/name/stop清除卡死执行name替换为你的 pipe 名。判断标准是手动 run 后日志里能看到 agent 执行过程且提示词要求写的输出文件如./output/date.md确实生成。日志同时保存在~/.screenpipe/pipes/{name}/logs/下JSON 格式。文档特别指出两类常见问题写提示词时就要避免运行了但没输出提示词必须明确要求写到哪、通知什么并先pipe run本地测试不要直接等调度触发调度了但不跑确认 pipe 文件夹名与预期 pipe 名一致context header 中的Pipe name用于 agent 自识别确认npx -y screenpipelatest pipe list能列出它然后看 logs。搜索排查的原则先用宽查询content_typeall或accessibility确认有数据再逐个加app_name、window_name、start_time等过滤条件——界面上看到的窗口标题和存储的window_name可能不一致先查宽结果里实际存的值。可选配置权限与模型收紧权限推荐用于不需要写操作的 pipe默认情况下 pipe 有完整的本地 API 访问权。如果 pipe 只读数据在 frontmatter 加一行即可--- schedule: every 30m permissions: reader ---readerpreset 只放行/search、/activity-summary、/meetingsGET、/notify、/health等只读端点其他全部拒绝。完整的 presetreader/writer/admin、Api(METHOD /path)、App()、Window()、Content()自定义规则和 deny 优先的求值顺序见 pipe permissions 文档。指定 AI 提供商与模型默认 pipe 使用 screenpipe cloud有 screenpipe 账号即可无需额外配置。要用自己的订阅Claude Pro、ChatGPT Plus、GitHub Copilot、Gemini或 API keypipe 复用 pi 的原生认证交互式运行pi后输入/login选择订阅或把 key 写入~/.pi/agent/auth.json或设置环境变量ANTHROPIC_API_KEY/OPENAI_API_KEY/GEMINI_API_KEY。然后在 frontmatter 中指定--- schedule: every 30m provider: anthropic model: claude-haiku-4-520251001 ---解析顺序是应用内为 pipe 分配的 AI preset在Pipes → My Pipes中设置→ frontmatter 的 provider/model → screenpipe cloud。限制与运行约束以下约束直接影响定时 pipe 的行为来自文档的架构说明同一时间只跑一个 pipe全局信号量防止重叠一个 pipe 卡住会阻塞其他 pipe 的运行回看窗口 schedule 间隔上限 8 小时超过 8h 的间隔不会让 agent 拿到更长的历史时间范围防止上下文溢出超时即终止默认 300 秒慢模型或复杂分析要用timeout显式调大Windows 上注意任务计划程序里的 pipe 任务必须排在 screenpipe 引擎启动之后执行否则本地 API 不可用会报权限/连接错误。下一步pipe 稳定运行后文档给出的延伸路径有两条在Pipes → My Pipes里为它指定 AI preset 微调模型如果做得通用可以到 pipe store 提交提供 pipe 名、描述、图标、pipe.md源码或 GitHub raw 链接、tags由维护者审核后上架其他用户在Pipes → Discover中一键安装。更多 pipe 示例standup report、Obsidian 日记、项目工时报告等见 pipes 文档。【免费下载链接】screenpipeYC (S26) | Open Computer History | Record your screen continuously locally and provide context to your agents (Claude, Codex, Openclaw, Hermes, Runner...)项目地址: https://gitcode.com/GitHub_Trending/sc/screenpipe创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

读完文章,也想定制专属网站?

尧图设计师 24 小时内与您沟通定制方案

免费获取报价