Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add echoVic/blade-code --skill cli-bootstrap-headless-and-printgit clone --depth 1 https://github.com/echoVic/blade-codeWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/echovic/blade-code/cli-bootstrap-headless-and-print)<a href="https://agentmods.dev/skills/echovic/blade-code/cli-bootstrap-headless-and-print"><img src="https://agentmods.dev/badge/skills/echovic/blade-code/cli-bootstrap-headless-and-print.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00160 | $0.02068 |
| Opus 5 | $0.00080 | $0.01034 |
| Sonnet 5 | $0.00032 | $0.00414 |
| Haiku 4.5 | $0.00016 | $0.00207 |
Grade A, and why
knowledge-interaction-surfaces-cli-bootstrap-headless-and-print scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 67 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Module Structure
CLI 层先建立进程级 cwd、日志和可信资源覆盖,再按参数选择专用运行器;Headless 与 Print 都直接拥有 SessionRuntime,但面向不同的机器消费与一次性文本消费场景。
Directory Layout
packages/cli/src/blade.tsx— 进程预解析、工作区初始化、模式分流和默认 Ink 启动packages/cli/src/cli/— 全局选项、设置文件校验、运行时配置合并和中间件packages/cli/src/commands/headless.ts— 完整 Agent loop 的非交互运行器packages/cli/src/commands/headlessEvents.ts— 版本化 snake_case JSONL wire schemapackages/cli/src/commands/HeadlessOutputEgress.ts— stdout/stderr 有界串行写入packages/cli/src/commands/print.ts— 单一最终响应运行器packages/cli/src/commands/shared/— 输入规范化、输出 schema 和非交互 Session 解析packages/cli/src/commands/— Serve、Web、Browser、Doctor、MCP、Projects、Schedule 等管理命令
Key Entry Points
main()inpackages/cli/src/blade.tsx— 选择 Headless、Print、ACP、yargs 子命令或 TUIloadConfiguration()inpackages/cli/src/cli/middleware.ts— 合并 settings、CLI 和持久配置runHeadless()inpackages/cli/src/commands/headless.ts— 执行完整事件化 Agent looprunPrint()inpackages/cli/src/commands/print.ts— 聚合一次最终响应并退出resolveNonInteractiveSession()inpackages/cli/src/commands/shared/sessionContext.ts— 统一 resume、continue 与 fork
Gotchas
--debug必须在导入 yargs 和创建其他 logger 前从原始 argv 预解析,否则早期模块日志不会继承过滤设置 (packages/cli/src/blade.tsx)- 工作区根与命令调用目录不是同一概念:项目探测会更新全局 cwd,但
--plugin-dir和--settings的相对路径仍按原始 invocation cwd 解析 (packages/cli/src/blade.tsx,packages/cli/src/cli/settings.ts) --headless在全局GracefulShutdown初始化前分流并独占 SIGINT/SIGTERM;把它移到普通 yargs 路径会让活动 turn 来不及 settle 就退出 (packages/cli/src/blade.tsx,packages/cli/src/commands/headless.ts,git:3d7ec137)- Headless 新 Session 默认
yolo,Print 则回退到 Runtime 配置的权限模式;resume 时两者都优先采用显式参数,再采用 Session 持久模式 (packages/cli/src/commands/headless.ts,packages/cli/src/commands/print.ts) - 无参数
--resume只在 TUI 中打开选择器,Print/Headless 必须获得具体 Session ID;--session-id与 resume/continue 同用时还必须显式 fork (packages/cli/src/cli/middleware.ts,packages/cli/src/commands/shared/sessionContext.ts) - Headless 的
jsonl是版本化、snake_case 且经 TypeBox 定义的外部契约,不应直接序列化内部 camelCaseLoopEvent(packages/cli/src/commands/headlessEvents.ts) - Print 的
stream-json名称不表示逐 delta 输出;实现会先drainLoop(),最后只写一个 response 或 structured_output 对象 (packages/cli/src/commands/print.ts) ! <command>不能与 output schema 组合,Headless 中还不能与--task-isolation组合;这些路径跳过模型并使用 Shell 自己的退出码 (packages/cli/src/commands/headless.ts,packages/cli/src/commands/print.ts)- Headless 的 stdout 与 stderr 是两个独立容量队列;任一 writer 的 EPIPE、超时、overflow 或无法观察的
drain都会中止当前运行并返回失败 (packages/cli/src/commands/HeadlessOutputEgress.ts,git:1af43232) - Headless 对 MCP Elicitation 和 Sampling 默认拒绝,但普通工具确认默认 Session 级批准;这不是 TUI 的交互权限行为 (
packages/cli/src/commands/headless.ts) globalOptions的 yargs 总体为strict: false以保留兼容性,Headless 仍在内部用HeadlessOptionsSchemafail closed;新增选项必须同步这两层,否则可能被 yargs 接收后在运行器拒绝 (packages/cli/src/cli/config.ts,packages/cli/src/commands/headless.ts)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago First seen · 67 lines · 160 tokens per session scan A 1344f335c7e6
knowledge-interaction-surfaces-cli-bootstrap-headless-and-print is a skill published in the GitHub repository echoVic/blade-code (178 stars, last pushed yesterday), licensed MIT. It adds 160 tokens to every session and 2,068 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
groq-inference
Ultra-fast LLM inference on custom LPU hardware. OpenAI-compatible API at api.groq.com. Lowest latency in the industry (500-1000+ tok/s). Supports chat completions, vision, audio (Whisper STT + TTS), tool calling, JSON mode, and streaming. Free tier available. Inference only — no training.
bun-file-io
Use this when you are working on file operations like reading, writing, scanning, or deleting files. It summarizes the preferred file APIs and patterns used in this repo. It also notes when to use filesystem helpers for directories.
protocolsio-integration
Integration with protocols.io API for managing scientific protocols. This skill should be used when working with protocols.io to search, create, update, or publish protocols; manage protocol steps and materials; handle discussions and comments; organize workspaces; upload and manage files; or integrate protocols.io…
Code Execution
Run Python, Node.js, AND arbitrary shell commands in a secure E2B cloud sandbox that PERSISTS across calls within a conversation. Clone repos, install packages, run CLI tools (git, psql, ffmpeg, duckdb), and build up state turn over turn.
slack-tools
Slack workspace management and automation specialist.
tg-moderator
Telegram chat moderator/companion mode. No tools, conversational only.