SmartCLI: Instructions file for Claude Code

CLAUDE.md

SmartCLI CLAUDE.md is an instructions file for Claude Code from dwgx/SmartCLI. It costs 5,158 tokens per session, scanned A, original, MIT.

Repository instructions for SmartCLI, a Python project that drives command-line agent sessions. They set rules for process usage, code-search tools, testing, and Git commits.

In plain words
What is it for?
Use them when running agent sessions, inspecting or testing the code, handling process failures, or preparing Git commits.
Why use it?
They reduce the risk of freezing the developer's computer by preventing bursts of concurrent processes and make the project's existing tools and checks easier to follow.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions .claude-plugin; mentions CLAUDE.md; mentions Claude Code.

This is dwgx/SmartCLI's own configuration. It tells Claude Code how to work on SmartCLI itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything SmartCLI configures →

Reuse

Borrowing it

Nothing to install: this file belongs to dwgx/SmartCLI. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/dwgx/SmartCLI/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/dwgx/SmartCLI

Made for: Claude Code.

Wrote 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.

agentmods badge for SmartCLI CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/dwgx/smartcli/claude-md/github.svg)](https://agentmods.dev/instructions/dwgx/smartcli/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/dwgx/smartcli/claude-md"><img src="https://agentmods.dev/badge/instructions/dwgx/smartcli/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for SmartCLI CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/dwgx/smartcli/claude-md"><img src="https://agentmods.dev/badge/instructions/dwgx/smartcli/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 5,158 This file is loaded in full into every session.
When invoked 5,158 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.05158 $0.05158
Opus 5.5 $0.02063 $0.02063
Sonnet 5.5 $0.01032 $0.01032
Haiku 4.5 $0.00516 $0.00516

Measured 7d ago against content hash 7fc16e89b484, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

SmartCLI CLAUDE.md 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 7d 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.

CLAUDE.md · 328 lines

How it starts

The opening of the file, as written. The whole thing — 328 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

⚠️ 硬性红线:严禁密集/并发 spawn 真实进程(会卡死/崩溃本机)

2026-07-13 事故:在一个会话里短时间内反复 spawn 大量真实进程(多个 grok/codex/ kiro-cli 全屏 TUI + 反复起关 daemon + mutation 来回 git checkout + verify_fx 每次 又开一堆 PTY 子进程),累积瞬时并发把用户 Windows 机器拖到卡死,用户被迫重启。 单个进程都清理干净了(零残留),元凶是叠加的瞬时并发峰值。

以后必须遵守:

  1. 一次只驱动一个 PTY/TUI 会话。 跑完立刻 close + 确认 tui.py list 零残留, 再起下一个。绝不同时开多个 agent CLI(grok/codex/kiro-cli 每个都拉起 node/rust 进程 + winpty,极吃资源)。
  2. 重活(verify_fx、run_all、drive-probe 全套)先征得用户同意再跑,且串行、 分开跑,不在一个会话里堆几十个进程。verify_fx 每跑一次要 spawn 一大批 PTY 特效 子进程——尤其重。
  3. mutation 验证要克制:来回 git checkout + 重跑 PTY 探针代价高;能用代码级 断言证明的就别反复起真实进程。
  4. 看到 spawn 层错误(uv_spawn、EUNKNOWN、exit 143/45、Git-bash spawn 失败)= 系统在示警资源紧张,立即停手,别换 shell 硬上。
  5. 需要用户自己跑重活时,建议用 ! python tests/verify_fx.py(前缀 ! 在会话里 直接跑),而不是我又开一批子进程。

Tool priorities

本仓库已建 CodeGraph 索引。优先用配好的工具:

  • 查代码用 CodeGraph:搞清符号、调用链、改动影响面时先 codegraph explore, 再决定要不要读文件。别一上来就 grep。
  • 搜文件用 rg 不用 grep;找文件用 fd 不用 find。
  • 读文件用 Read 工具,不用 cat/head 读代码。
  • 本仓库是 Python:ruff/mypy 已装,pyproject.toml 已配好,直接用。

Git commits

  • 不加任何 AI 署名(遵循用户全局 CLAUDE.md)。
  • 只有用户明确要求才 commit。

Commands

Set PYTHONIOENCODING=utf-8 before running anything (box-drawing/CJK glyphs crash on legacy codepages; CI sets it too).

Use an interpreter that has pyte installed. Every test here imports smartcli_core, so a bare python/python3 from a version manager will die with ModuleNotFoundError: No module named 'pyte' — which reads like a broken test. python -m venv .venv && .venv/bin/pip install -r requirements.txt -e . gives you one; python -m smartcli_core reports what a given interpreter can actually see. And take the exit code directly — python tests/x.py 2>&1 | tail yields tail's status, so an import crash reads as a pass.

# Full self-test aggregator — exit 0 iff everything present passes, and a gate
# that is tracked by git but missing on disk now FAILS rather than skipping
# (renaming or deleting one used to be a green SKIP). Entries may still SKIP
# themselves internally when an external binary is absent — tmux, vim, less — so
# a green run on a host lacking those covers less than a green run here. SLOW: spawns real
# PTY sessions serially. Per the red line above, get user consent before running.
python tests/run_all.py

# One gate needs a test-only dependency, or it reports an internal SKIP (which
# run_all now surfaces even on a PASS). It is NOT in requirements-optional.txt —
# that file is runtime extras with guarded imports; this is test-only, and CI
# installs it inline before running the gate.
pip install hypothesis                    # test_readiness_properties

# Run a single test (each test file is a standalone script, exit 0 = pass):
python tests/test_fx_contract.py          # deterministic, pure-memory — safe
python tests/test_readiness.py
python tests/test_vendor_sync.py
python tests/_drive_probe1.py             # spawns a real PTY — run serially

# fx effect regression (spawns many PTY children — heavy, consent first):
python tests/verify_fx.py

# Coverage over the deterministic subset (no PTY spawn; --full drives PTYs):
python tools/coverage_run.py
python tools/coverage_run.py --xml        # also write coverage.xml for Codecov

# Lint / type-check. PARTLY BLOCKING in CI (lint.yml): the ruff correctness subset
# and mypy fail the build; the full ruff report and format check are advisory.
ruff check --select E9,F63,F7,F82 .       # the blocking subset
mypy                                      # config in pyproject.toml; checks smartcli_core only
ruff check .                              # advisory (full style/modernization backlog)
# mypy MUST see the real pyte. Without it, ignore_missing_imports degrades
# pyte.Screen to Any, which BOTH hides real errors in the subclass and reports a
# correct `type: ignore` as unused — that once failed CI on a clean tree while two
# genuine errors went unseen. Run it in an env where `requirements.txt` is installed.

# cmd-art effect engine (run from skills/cmd-art):
python -m fx list                         # live catalog (30 effects)
python -m fx play donut --seconds 5
python -m fx gallery

# tui-ui layout engine (run from skills/tui-ui):
python -m ui widgets                      # 17 widgets
python self_test.py

# drive-tui: drive a real interactive program (ONE session at a time).
# Use "python3 -i -q" (POSIX) / "py -i -q" (Windows) — don't assume a bare
# `python` exists on PATH (modern macOS has none):
python skills/drive-tui/scripts/tui.py start --cmd "python3 -i -q" --cols 100 --rows 30
python skills/drive-tui/scripts/tui.py wait-regex --id <SID> ">>> " --timeout-ms 15000
python skills/drive-tui/scripts/tui.py send-line --id <SID> "print(6*7)"
python skills/drive-tui/scripts/tui.py snapshot --id <SID>
python skills/drive-tui/scripts/tui.py close --id <SID>
python skills/drive-tui/scripts/tui.py list   # verify zero leaked sessions

# After ANY change to smartcli_core: re-sync the vendored copy and verify.
python tools/sync_vendor.py
python tests/test_vendor_sync.py

Read the full file on GitHub · 328 lines

Changes

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.

  1. 7d ago Changed · +5 lines · +114 tokens per session 7fc16e89b484
  2. 18d ago Changed · +73 lines · +1,332 tokens per session 69cde8cbfbf6
  3. 1mo ago First seen · 250 lines · 3,712 tokens per session scan A aace7073f934

Subscribe to this mod's changes

SmartCLI CLAUDE.md is an instructions file published in the GitHub repository dwgx/SmartCLI (5 stars, last pushed 8d ago), licensed MIT. It adds 5,158 tokens to every session, about $0.0206 per session on Opus 5.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-08-31.

Related

Other instructions, from other repositories

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 9,649 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,257 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).

microsoft/vscode · 5,262 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,680 tokens

vscode copilot-instructions.md

Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).

microsoft/vscode · 2,731 tokens

deepseek-harness AGENTS.md

AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.

deepseek-ai/deepseek-harness · 4,159 tokens