派活 · 运维、文件、数据、系统各跑通一件Dispatch · One Real Job Each in Ops, Files, Data, and System.
发动机不挑活。这章把不同形状的手动活跑通:300 张图批量转格式(含 dry-run 和回滚)是主线,运维、文件、数据、系统四个域各一条可抄的紧凑变体,外加进数据库只读核数的一幕。最后划清:什么时候该切回脚本、cron 和专用工具。The engine doesn't care what the work is. This chapter runs manual jobs of different shapes: batch-converting 300 images (dry-run and rollback included) as the main line, one copyable compact variant each for ops, files, data, and system, plus a read-only pass inside a database. Then the line: when to switch back to scripts, cron, and dedicated tools.
这是全书论点落地的一章。官网把 Agent Mode 演示成改 bug、提 PR,于是你默认它是给写代码的人的。但发动机不挑活:运维、文件、数据、系统的手工活,剥开底下都是命令行和脚本,照样能一件件交办。这章主线跑通一件真实的批处理 —— 300 张图转 webp,含 dry-run 和回滚;然后四个域各给你一条可抄的紧凑变体;最后划清什么时候该切回脚本、cron 和专用工具。This is where the book's thesis lands. The vendor demos Agent Mode as bug fixes and PRs, so you default to thinking it's for people who write code. But the engine doesn't care what the work is: ops, files, data, and system chores are, underneath, command-line and scripts, and can be dispatched one by one. The main line runs one real batch job — 300 images to webp, dry-run and rollback included; then four domains each get a compact variant you can copy; finally, the line on when to switch back to scripts, cron, and dedicated tools.
— I
主线:300 张图转 webp,带 dry-run 和回滚The Main Line: 300 Images to webp, with Dry-Run and Rollback.
场景:设计给了你一个 ./assets/raw/ 目录,300 张 PNG 要统一转成 80% 质量的 webp 上网。手动路径是找在线转换工具、分批上传、等、下载、改名 —— 或者自己拼一条 find 加 cwebp 的参数,拼错一次就得重来。这次交办,但守一条纪律:批量写入的活,先 dry-run 再真跑。2注 2Note 2Warp Docs · Warp Agents overview —— 本地 agent 嵌在终端里,能写代码、debug、运行命令、自动化开发任务,并使用代码库、Warp Drive 与连接工具上下文;本地 agent 交互运行,云端 agent 后台运行。Warp Docs · Warp Agents overview — local agents are embedded in the terminal and can write code, debug, run commands, automate development tasks, and use codebase, Warp Drive, and connected-tool context; local agents run interactively while cloud agents run in the background.The scene: design hands you a ./assets/raw/ directory — 300 PNGs to convert to 80%-quality webp for the web. The manual path is an online converter, batch uploads, waiting, downloading, renaming — or assembling a find plus cwebp one-liner yourself and starting over when a flag is wrong. This time we dispatch, with one discipline: for batch writes, dry-run first, real run second.2注 2Note 2Warp Docs · Warp Agents overview —— 本地 agent 嵌在终端里,能写代码、debug、运行命令、自动化开发任务,并使用代码库、Warp Drive 与连接工具上下文;本地 agent 交互运行,云端 agent 后台运行。Warp Docs · Warp Agents overview — local agents are embedded in the terminal and can write code, debug, run commands, automate development tasks, and use codebase, Warp Drive, and connected-tool context; local agents run interactively while cloud agents run in the background.
01
交办时就写死 dry-run 纪律Write the dry-run discipline into the dispatch
⌘↩ 开会话,贴上下面 PromptBox 示例 tab 那段话。注意它没让 agent 直接转换 —— 它先要求列出前 20 个会被处理的文件和源 → 目标路径,声明会不会覆盖。这一步是整件事的保险丝。⌘↩ to open a conversation, paste the sentence from the Example tab of the PromptBox below. Note it doesn't ask the agent to convert anything yet — it first demands the first 20 files it would touch, source → target paths, and a statement on overwrites. That step is the fuse for the whole job.
02
审 dry-run 输出,而不是审它的信心Review the dry-run output, not its confidence
它跑完只读分析,给你:300 个文件匹配、目标目录 ./assets/webp/、不覆盖原图、预计总大小。你抽查三条路径映射对不对 —— 对,才说「跑」。它怎么说不重要,那张清单对不对才重要。It finishes the read-only pass and reports: 300 files matched, target directory ./assets/webp/, originals untouched, estimated total size. You spot-check three path mappings — if they're right, say 'run.' What it claims doesn't matter; whether that list is right does.
03
真跑,盯着计数器Run for real, eyes on the counters
转换是批量写,但写进的是新目录,原图还在 —— 这就是为什么这个任务敢让它自动跑完。几分钟后它报:成功 298、失败 2,两个失败的是带特殊字符的文件名,它已经单独列出来等你处理。The conversion is a batch write, but into a new directory with originals intact — which is exactly why this job can be left to run unattended. Minutes later it reports: 298 succeeded, 2 failed — two filenames with special characters, listed separately for you.
04
验收 + 确认回滚路径Accept + confirm the rollback path
验收三条:输出目录文件数对得上、抽查一张图能正常打开、总大小从 1.2G 降到 90M。回滚路径也在交办时就想好了 —— 原图未动,删掉 ./assets/webp/ 就回到起点。批量活敢交办的前提,从来不是信它,是回滚成本够低。Three acceptance checks: the output count matches, a sampled image opens fine, total size dropped from 1.2G to 90M. The rollback path was settled at dispatch time — originals untouched, so deleting ./assets/webp/ returns to start. The precondition for daring to dispatch batch work is never trusting it — it's a cheap rollback.
提示词Prompt文件批处理 dry-run 模板(主线同款)File batch dry-run template (the main line's own)
目标:批量处理 <目录/文件模式>,但先不要改任何文件。
要求:
1. 先列出会被处理的前 20 个文件;
2. 给出 dry-run 命令或只打印源路径 -> 目标路径;
3. 说明是否会覆盖、删除、移动;
4. 我确认后才执行真实写入;
5. 执行后给出处理数量、失败数量、可回滚方式。Goal: Batch-process <directory/file pattern>, but do not change files yet.
Requirements:
1. List the first 20 files that would be touched;
2. Provide a dry-run command or print source -> target only;
3. State whether anything will overwrite, delete, or move;
4. Execute real writes only after I confirm;
5. After execution, report processed count, failures, and rollback path.
目标:批量处理 ./assets/raw/*.png,统一转成 80% 质量的 .webp,输出到 ./assets/webp/,但先不要改任何文件。
要求:
1. 先列出会被处理的前 20 个文件;
2. 给出 dry-run 命令或只打印源路径 -> 目标路径;
3. 说明是否会覆盖、删除、移动;
4. 我确认后才执行真实写入;
5. 执行后给出处理数量、失败数量、可回滚方式。Goal: Batch-process ./assets/raw/*.png, converting all to 80%-quality .webp into ./assets/webp/, but do not change files yet.
Requirements:
1. List the first 20 files that would be touched;
2. Provide a dry-run command or print source -> target only;
3. State whether anything will overwrite, delete, or move;
4. Execute real writes only after I confirm;
5. After execution, report processed count, failures, and rollback path.
手动路径的那个下午That afternoon on the manual path
在线转换工具一次限 20 张,你分了 15 批;第三批传完发现免费版加水印;换工具,重来;下载回来的文件名全被改了,再写个脚本对应回去。或者你自己拼 find + cwebp,第一次参数错了覆盖了三张原图 —— 没有 dry-run 的习惯,批量活每一步都在赌。The online converter caps at 20 images a batch, so you split into 15; after batch three you notice the free tier watermarks; switch tools, start over; the downloads come back renamed, so you write a script to map them back. Or you assemble find + cwebp yourself, get a flag wrong, and overwrite three originals — without a dry-run habit, every step of batch work is a bet.
刚才这十五分钟The fifteen minutes you just had
一段话交办,一张清单审过,一次真跑,三条验收。失败的两张它单独列出来了,原图一张没动。你做的唯一判断是抽查路径映射 —— 剩下的时间你回了三封邮件。One paragraph dispatched, one list reviewed, one real run, three acceptance checks. The two failures came back listed separately, and not one original was touched. The only judgment you made was spot-checking path mappings — the rest of the time you answered three emails.
— II
四个域,各一条可抄的Four Domains, One Copyable Each.
一件事适不适合 Warp,先看它能不能被命令、文件、脚本、日志、环境变量表达。四个域各一条紧凑交办词 —— 抄走,改尖括号里的部分就能用:Whether work belongs in Warp starts with whether it can be expressed as commands, files, scripts, logs, and environment variables. One compact dispatch per domain — copy them and change the angle-bracket parts:
提示词Prompt从日志里捞统计(只读)Pull stats from logs (read-only)
从 <日志路径> 里统计 <时间范围> 每小时的 5xx 请求数,
按「小时 → 次数」输出,顺带列出 5xx 最多的前 5 个路径。
先把你打算跑的命令给我看,确认后再跑,别写任何文件。From <log path>, count 5xx requests per hour over <time range>,
output as 'hour -> count', plus the top 5 paths with the most 5xx.
Show me the commands you plan to run first, confirm before running, and don't write any files.
从 ./logs/nginx/access.log 里统计昨天每小时的 5xx 请求数,
按「小时 → 次数」输出,顺带列出 5xx 最多的前 5 个路径。
先把你打算跑的命令给我看,确认后再跑,别写任何文件。From ./logs/nginx/access.log, count yesterday's 5xx requests per hour,
output as 'hour -> count', plus the top 5 paths with the most 5xx.
Show me the commands you plan to run first, confirm before running, and don't write any files.
提示词Prompt批量重命名 + 归类(dry-run 先行)Batch rename + organize (dry-run first)
把 <目录> 里的文件按 <规则> 重命名并归入子目录。
先只打印「现名 → 新名/去向」的前 20 条,不改任何文件;
说明冲突怎么处理(重名、非法字符);
我确认后再动;动完给成功/失败计数和回滚方式。Rename files in <directory> by <rule> and sort them into subdirectories.
First print only the first 20 'current name -> new name/destination' mappings, changing nothing;
state how conflicts are handled (dupes, illegal characters);
act only after I confirm; then report success/failure counts and the rollback path.
把 ~/Downloads 里的截图按「2026-08-06_项目名_序号」重命名,按月份归入子目录。
先只打印「现名 → 新名/去向」的前 20 条,不改任何文件;
说明冲突怎么处理(重名、非法字符);
我确认后再动;动完给成功/失败计数和回滚方式。Rename the screenshots in ~/Downloads as '2026-08-06_project_seq' and sort them into month subdirectories.
First print only the first 20 'current name -> new name/destination' mappings, changing nothing;
state how conflicts are handled (dupes, illegal characters);
act only after I confirm; then report success/failure counts and the rollback path.
提示词PromptCSV 清洗(不覆盖原文件)CSV cleaning (never overwrite the original)
读取 <input.csv>。
先做只读分析:行数 / 字段名 / 缺失值统计;抽样 10 行;你建议的清洗规则。
然后给一个可复现脚本,输出写到 <output.tmp>,不要覆盖原文件。
最后用 diff / head / wc 验收。Read <input.csv>.
First a read-only analysis: row count / field names / missing values; sample 10 rows; the cleaning rules you suggest.
Then a reproducible script writing to <output.tmp>, without overwriting the original.
Verify at the end with diff / head / wc.
读取 ./data/subscribers.csv。
先做只读分析:行数 / 字段名 / 缺失值统计;抽样 10 行;你建议的清洗规则。
然后给一个可复现脚本,把去掉重复邮箱、统一小写后的结果写到 ./data/subscribers.clean.tmp,不要覆盖原文件。
最后用 diff / head / wc 验收。Read ./data/subscribers.csv.
First a read-only analysis: row count / field names / missing values; sample 10 rows; the cleaning rules you suggest.
Then a reproducible script that dedupes emails and lowercases them, writing to ./data/subscribers.clean.tmp, without overwriting the original.
Verify at the end with diff / head / wc.
适合:CSV/JSON 抽样、jq/sed/awk/Python 小脚本。切走:正经 ETL、BI、Notebook 探索、生产写库。Fits: CSV/JSON sampling, jq/sed/awk/Python scripts. Switch away: real ETL, BI, notebook exploration, production writes.
只读诊断这台机器的 <某方面> 环境:
版本、路径、环境变量、端口、进程、磁盘、权限。
每条命令只读,先给我看我确认再跑;
最后给一段「正常 / 异常 / 建议」的结论。Read-only diagnosis of this machine's <aspect> environment:
versions, paths, env vars, ports, processes, disk, permissions.
Every command read-only, shown to me first for confirmation;
end with a 'normal / abnormal / recommended' conclusion.
只读诊断这台机器的 Node 开发环境:
版本、路径、环境变量、端口、进程、磁盘、权限。
每条命令只读,先给我看我确认再跑;
最后给一段「正常 / 异常 / 建议」的结论。Read-only diagnosis of this machine's Node dev environment:
versions, paths, env vars, ports, processes, disk, permissions.
Every command read-only, shown to me first for confirmation;
end with a 'normal / abnormal / recommended' conclusion.
适合:环境诊断、依赖检查、权限排查、配置 diff。切走:内核、权限、安全策略变更 —— 那要专用工具和人工流程。Fits: environment diagnosis, dependency checks, permission checks, config diff. Switch away: kernel, permission, and security-policy changes — those need dedicated tools and human process.
运维 / 文件 / 数据 / 系统:同一台发动机,四种形状的活Ops / files / data / system: one engine, four shapes of work
— III
一幕:进数据库,只读核数One Scene: Into the Database, Read-Only Recon.
agent 不止能跑一次性命令 —— Full Terminal Use 让它看到实时终端缓冲、向 PTY 写入、应答提示,于是它能开 psql 进去待着、来回试。1注 1Note 1Warp Docs · Full Terminal Use —— 截至 2026-08-06:agent 能看到实时终端缓冲、向 PTY 写入、应答提示,在运行中的进程里继续工作(psql / mysql、gdb、vim、Python REPL、dev server);跑着的交互命令可以用底部 Use Agent 按钮或 ⌘I 把 agent 拉进来;全局 FTU 权限默认三档:首次写入询问 / 总是询问 / 总是允许;Secret Redaction 仍然生效;FTU 交互消耗 credits。Warp Docs · Full Terminal Use — as of 2026-08-06: the agent sees the live terminal buffer, writes to the PTY, answers prompts, and keeps working inside running processes (psql / mysql, gdb, vim, Python REPLs, dev servers); tag the agent into a running interactive command with the footer Use Agent button or ⌘I; global FTU permission defaults come in three: ask on first write / always ask / always allow; Secret Redaction still applies; FTU interactions consume credits.很多数据活不是「跑一条命令」,是「进去看一眼再决定」。看这一幕:The agent doesn't only run one-shot commands — Full Terminal Use lets it see the live terminal buffer, write to the PTY, and answer prompts, so it can open psql, stay inside, and iterate.1注 1Note 1Warp Docs · Full Terminal Use —— 截至 2026-08-06:agent 能看到实时终端缓冲、向 PTY 写入、应答提示,在运行中的进程里继续工作(psql / mysql、gdb、vim、Python REPL、dev server);跑着的交互命令可以用底部 Use Agent 按钮或 ⌘I 把 agent 拉进来;全局 FTU 权限默认三档:首次写入询问 / 总是询问 / 总是允许;Secret Redaction 仍然生效;FTU 交互消耗 credits。Warp Docs · Full Terminal Use — as of 2026-08-06: the agent sees the live terminal buffer, writes to the PTY, answers prompts, and keeps working inside running processes (psql / mysql, gdb, vim, Python REPLs, dev servers); tag the agent into a running interactive command with the footer Use Agent button or ⌘I; global FTU permission defaults come in three: ask on first write / always ask / always allow; Secret Redaction still applies; FTU interactions consume credits. Much data work isn't 'run one command' but 'go in, look, then decide.' Watch this scene:
# agent 开了一个 psql 会话,先只读地确认范围psql "$DATABASE_URL"=> SELECT count(*) FROM orders WHERE status IS NULL; count------- 1843=> SELECT id, created_at FROM orders WHERE status IS NULL ORDER BY created_at DESC LIMIT 5;-- 1843 行待回填,样本看过了,现在它把打算跑的 UPDATE 摆出来等你点头
agent 进 psql 核一段数据(只读,先看再动)The agent stepping into psql to check data (read-only, look before touching)
注意纪律没变:它进得去,不代表它该闭眼改。先只读会话核范围、样本、行数,UPDATE 摆出来你点头才执行。两个开关值得知道:全局 FTU 权限默认「首次写入询问」,跑着的交互命令(比如你手开的 psql)可以按 ⌘I 或点底部 Use Agent 把 agent 拉进来接管。1注 1Note 1Warp Docs · Full Terminal Use —— 截至 2026-08-06:agent 能看到实时终端缓冲、向 PTY 写入、应答提示,在运行中的进程里继续工作(psql / mysql、gdb、vim、Python REPL、dev server);跑着的交互命令可以用底部 Use Agent 按钮或 ⌘I 把 agent 拉进来;全局 FTU 权限默认三档:首次写入询问 / 总是询问 / 总是允许;Secret Redaction 仍然生效;FTU 交互消耗 credits。Warp Docs · Full Terminal Use — as of 2026-08-06: the agent sees the live terminal buffer, writes to the PTY, answers prompts, and keeps working inside running processes (psql / mysql, gdb, vim, Python REPLs, dev servers); tag the agent into a running interactive command with the footer Use Agent button or ⌘I; global FTU permission defaults come in three: ask on first write / always ask / always allow; Secret Redaction still applies; FTU interactions consume credits.Note the discipline doesn't change: it can get in doesn't mean it should edit blind. First a read-only session to confirm scope, sample, row count; the UPDATE waits for your nod. Two switches worth knowing: the global FTU permission defaults to 'ask on first write,' and for an interactive command already running (say a psql you opened by hand) you can press ⌘I or the footer Use Agent button to tag the agent in.1注 1Note 1Warp Docs · Full Terminal Use —— 截至 2026-08-06:agent 能看到实时终端缓冲、向 PTY 写入、应答提示,在运行中的进程里继续工作(psql / mysql、gdb、vim、Python REPL、dev server);跑着的交互命令可以用底部 Use Agent 按钮或 ⌘I 把 agent 拉进来;全局 FTU 权限默认三档:首次写入询问 / 总是询问 / 总是允许;Secret Redaction 仍然生效;FTU 交互消耗 credits。Warp Docs · Full Terminal Use — as of 2026-08-06: the agent sees the live terminal buffer, writes to the PTY, answers prompts, and keeps working inside running processes (psql / mysql, gdb, vim, Python REPLs, dev servers); tag the agent into a running interactive command with the footer Use Agent button or ⌘I; global FTU permission defaults come in three: ask on first write / always ask / always allow; Secret Redaction still applies; FTU interactions consume credits.
— IV
什么时候别派给它When Not to Dispatch It.
稳定重复的活该沉淀:一件事每周都做且步骤固定,让 agent 每次现编就是浪费 —— 让它做一次,存成 Workflow 或写成脚本挂上 cron,下次直接跑。3注 3Note 3Warp Docs · Workflows —— 把一条参数化命令命名保存,带描述与参数默认值,从命令面板、⌃⇧R 或 Warp Drive 调用,免得重复手敲;Block Actions 和 agent 结果里都有 Save as Workflow。Warp Docs · Workflows — name and save a parameterized command with a description and argument defaults, invoked from the command palette, ⌃⇧R, or Warp Drive, so frequent commands aren't retyped; Save as Workflow is available from Block Actions and agent results.还有一类该交给专用工具:正经 ETL、备份、监控有成熟的东西,比 agent 每次重搭更稳。元工具的价值是覆盖那条长长的杂活尾巴,不是取代那几件值得专门工具的事。再往外,要去点别的 GUI app,那已经出了边界 —— 第十章的事。Stable repeated work deserves distillation: if you do something weekly with fixed steps, having the agent improvise each time is waste — have it do it once, save it as a Workflow or a script on cron, and just run it next time.3注 3Note 3Warp Docs · Workflows —— 把一条参数化命令命名保存,带描述与参数默认值,从命令面板、⌃⇧R 或 Warp Drive 调用,免得重复手敲;Block Actions 和 agent 结果里都有 Save as Workflow。Warp Docs · Workflows — name and save a parameterized command with a description and argument defaults, invoked from the command palette, ⌃⇧R, or Warp Drive, so frequent commands aren't retyped; Save as Workflow is available from Block Actions and agent results. And one class belongs to dedicated tools: real ETL, backup, and monitoring have mature options steadier than the agent re-building them each time. A meta-tool's value is covering the long tail of odd jobs, not replacing the few things that deserve a dedicated tool. Further out, clicking another GUI app is past the boundary — chapter 10's subject.
切到Switch to
信号Signal
普通终端Plain terminal
只跑一两条你已经懂的命令、远程服务器默认环境、离线容器One or two commands you already know, default remote server environment, offline container
脚本 / cron / CIScript / cron / CI
流程稳定、重复、需要审计和失败重试Stable repeated flow needing audit and retries
ETL / BI / NotebookETL / BI / Notebook
数据量大、需要可视化探索、统计假设要反复验证Large data, visual exploration, statistical hypotheses to iterate