SmartCLI CLAUDE.md

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

Install

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.

agentmods
npx agentmods add instructions/dwgx/smartcli/claude-md
Clone the repo
git clone --depth 1 https://github.com/dwgx/SmartCLI
Per session 3,712 This file is loaded in full into every session.
When invoked 3,712 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.03712 $0.03712
Opus 5 $0.01856 $0.01856
Sonnet 5 $0.00742 $0.00742
Haiku 4.5 $0.00371 $0.00371

Measured 2d ago against content hash aace7073f934, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 2d 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 · 250 lines

How it starts

The opening of the file, as written. The whole thing — 250 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_spawnEUNKNOWN、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 directlypython 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 · 250 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. 2d 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 (3 stars, last pushed 22d ago), licensed MIT. It adds 3,712 tokens to every session, about $0.0186 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-08-31.

Related

Other instructions, from other repositories

docx-cli CLAUDE.md

Instructions for kklimuk/docx-cli, covering docx-cli, conventions, invariants, commands and testing.

kklimuk/docx-cli · 8,873 tokens

superdesign-skill AGENTS.md

Instructions for superdesigndev/superdesign-skill, covering project agent memory, what this repo is, skill flow invariant: two entry paths, ground truth for cli behavior and plugin packaging & release.

superdesigndev/superdesign-skill · 1,698 tokens

stewie-pixel guidelines

Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes, surface assumptions, and define verifiable success criteria.

Stewie-pixel/claude-with-leetcode · 827 tokens

vanguard-frontier-agentic copilot-instructions.md

Instructions for VincentChuWaiChow/vanguard-frontier-agentic, covering vanguard frontier agentic repository instructions, what to optimize for, repo structure, rules for changes and cross-platform asset rule.

VincentChuWaiChow/vanguard-frontier-agentic · 359 tokens

archeyes CLAUDE.md

Instructions for thisAAY/archeyes, covering archeyes — project guide, layout, design system, commands and publishing a release.

thisAAY/archeyes · 1,284 tokens

kleinanzeigen-reader CLAUDE.md

Instructions for its-me-prash/kleinanzeigen-reader, covering claude.md — kleinanzeigen-reader, what this repo is, auto-load instructions for claude code, quick command reference and fetch a listing.

its-me-prash/kleinanzeigen-reader · 834 tokens