=============== LIBRARY RULES =============== From library maintainers: - Use SKILL.md for command routing and the linked step documents for detailed workflow contracts. - Distinguish documented host compatibility, automated checks and actual host or device execution evidence. - Documentation retrieval does not authorize workflow execution, deployment, publishing or changes to user tickets. ### Install cheap-research globally Source: https://github.com/ayukyo/icode-skill/blob/main/mcp/cheap-research/README.md Execute the installation script from the project directory. Use the CHEAP_RESEARCH_TARGET environment variable to specify a custom installation path. ```bash cd <你的 icode-skill 仓库>/mcp/cheap-research ./install.sh ``` -------------------------------- ### Example provider configurations Source: https://github.com/ayukyo/icode-skill/blob/main/mcp/vision-bridge/README.md Common examples of base_url and model for various providers. These are not recommendations; always use your platform's actual documentation. ```text # OpenAI 官方 base_url: https://api.openai.com/v1 model: gpt-4o-mini # Anthropic Claude (通过 OpenAI 兼容代理) base_url: <你的代理地址> model: <代理提供的 Claude 模型名> # 国内厂商(按你平台真实文档为准) base_url: <你平台给的端点> model: <你平台视觉模型名> # 自建 vLLM / Ollama / LM Studio (OpenAI 兼容服务) base_url: http://localhost:8000/v1 model: <你加载的视觉模型> ``` -------------------------------- ### Usage example: React 19 Server Components docs Source: https://github.com/ayukyo/icode-skill/blob/main/mcp/context7/README.md Shows a two-step example of using context7 to fetch the latest documentation for React 19 Server Components: first resolve the library ID, then get the docs with a token limit of 5000. ```text # 查 React 19 的 Server Components 最新文档 1. resolve-library-id("/reactjs/react.dev") → react 2. get-library-docs("react", "server components", 5000) ``` -------------------------------- ### 解析最新合格 init 工单(--guide 分支) Source: https://github.com/ayukyo/icode-skill/blob/main/steps/00_init.md 在 `--guide` 模式下,使用 `icode_control.py resolve-ticket` 命令解析工作区中最新且合格的 init 工单。该命令要求工单状态为 `init_in_progress`,包含 `00_init.md` 工件,并通过 `--require-init-ready` 检查。筛选在取最新之前进行,因此较新的不合格工单不会遮蔽较早的合格工单。 ```bash python3 "${ICODE_SKILL_ROOT}/tools/icode_control.py" resolve-ticket --latest \ --workspace "$WORKSPACE_ROOT" \ --require-status init_in_progress \ --require-artifact 00_init.md \ --require-init-ready ``` -------------------------------- ### Mode C: Init then start commands Source: https://github.com/ayukyo/icode-skill/blob/main/README.md Starts with an init command that opens a multi-turn dialogue to clarify the feature, then follows with a start command to execute the workflow. ```bash cd demo && /icode init add new feature to calculator ``` ```bash /icode start ``` -------------------------------- ### Example configuration values Source: https://github.com/ayukyo/icode-skill/blob/main/mcp/cheap-research/README.md Examples of configuration settings for various platforms including OpenAI, Anthropic proxies, domestic providers, and local Ollama instances. ```text # OpenAI 官方 (便宜) base_url: https://api.openai.com/v1 model: gpt-4o-mini # Anthropic Claude (通过 OpenAI 兼容代理) base_url: <你的代理地址> model: <代理提供的便宜模型,如 claude-3-5-haiku> # 国内厂商 (按你平台真实文档为准) base_url: https://api.deepseek.com/v1 model: deepseek-chat # 本地 Ollama (默认端口 11434) provider: local_ollama base_url: http://localhost:11434/v1 model: qwen2.5:7b ``` -------------------------------- ### Installation command Source: https://github.com/ayukyo/icode-skill/blob/main/mcp/context7/README.md Command to install the context7 MCP component from the icode-skill repository's mcp directory. ```bash cd /mcp ./install.sh ``` -------------------------------- ### Install and run full ICODE flow Source: https://github.com/ayukyo/icode-skill/blob/main/README.md Clones the open-source installer, installs ICODE plus shared skills and MCPs for Claude Code and Codex, then starts a full ticket flow. Run these commands in order from a shell. ```bash git clone https://github.com/ayukyo/icode-skill ~/icode-skill cd ~/icode-skill # 2) Install ICODE, shared skills, and MCPs for Claude Code + Codex ./install.sh --client all # 3) Run a full flow /icode start Implement a feature module ``` -------------------------------- ### Create entities example (Python) Source: https://github.com/ayukyo/icode-skill/blob/main/mcp/memory/README.md Example of using memory.create_entities to automatically remember user preferences and project characteristics across work orders. ```python # 跨工单自动记住 memory.create_entities([{ "name": "user_preference", "entityType": "preference", "contents": ["user prefers NoSQL", "project uses gRPC v3"] }]) ``` -------------------------------- ### 前置环境检查(python-pptx、LibreOffice、pdftoppm) Source: https://github.com/ayukyo/icode-skill/blob/main/tools/ppt/README.md 检查运行`tools/ppt`所需的核心依赖:python-pptx 1.0+(必需)、LibreOffice(仅在渲染预览时需要)和 pdftoppm(poppler,仅在渲染预览时需要)。如果缺少python-pptx,需要运行`pip install python-pptx`安装。 ```bash python3 -c "import pptx" # python-pptx 1.0+(必需,缺则 pip install python-pptx) soffice --version # LibreOffice(仅 render_slides.py 预览需要) which pdftoppm # poppler(仅 render_slides.py 预览需要) ``` -------------------------------- ### Install cheap-research MCP Source: https://github.com/ayukyo/icode-skill/blob/main/README.md Installs the cheap-research MCP for low-cost LLM inference. Run from the cheap-research directory; the script creates a venv, installs dependencies, and registers the MCP to ~/.claude.json. After installation, edit the generated config.json with your base_url, api_key, and model, then restart Claude Code. ```bash cd ~/.claude/skills/icode/mcp/cheap-research ./install.sh # auto: venv + install deps + register to ~/.claude.json # edit the generated config.json with your base_url / api_key / model # restart Claude Code to take effect ``` -------------------------------- ### 运行离线完整性检查命令 (check_skill_installation.py) Source: https://github.com/ayukyo/icode-skill/blob/main/docs/find-skills-compatibility.md 在可信的源码 checkout 中运行,要求 Linux、Python 3.10+、Git。--source 必须是 Git 根目录;--installed 必须直接包含根 SKILL.md。检查器只读取本地文件和 Git 索引,不联网、不安装、不修复,不写缓存或报告文件。 ```bash python3 -B tools/check_skill_installation.py \ --source /absolute/path/to/icode-skill \ --installed /absolute/path/to/project/.agents/skills/icode ``` -------------------------------- ### Install vision-bridge globally Source: https://github.com/ayukyo/icode-skill/blob/main/mcp/vision-bridge/README.md Run the install script from the vision-bridge directory to install globally. Default target is ~/.claude/skills/icode/mcp/vision-bridge; override with VISION_BRIDGE_TARGET. ```bash cd <你的 icode-skill 仓库>/mcp/vision-bridge ./install.sh ``` -------------------------------- ### Install custom sequential-thinking fork Source: https://github.com/ayukyo/icode-skill/blob/main/mcp/sequential-thinking/README.md Use this command to install a community or forked implementation of sequential-thinking instead of the default npm package. ```bash ./install.sh "@your-org/your-sequential-thinking-fork" ``` -------------------------------- ### 开始长动作 (operation --phase start) Source: https://github.com/ayukyo/icode-skill/blob/main/references/execution_model.md 用于启动一个长动作,必须提供输出目录、稳定名称、动作类别、身份描述和请求。对于 managed_write、external_side_effect、destructive_hardware 类别,request 是必需的。 ```bash python3 tools/icode_control.py operation --dir --phase start \ --name --opclass --input \ --request ``` -------------------------------- ### Clone snapshot, build distribution, install and verify skill (Bash) Source: https://github.com/ayukyo/icode-skill/blob/main/docs/find-skills-compatibility.md Clones the trusted checkout at its current HEAD without checkout, builds the distribution using build_skill_distribution.py, adds and installs the icode skill with --copy --yes, lists installed skills, and runs check_skill_installation.py integrity check. Runs all steps under isolated environment and timeout. Must check cli-version.stdout is 1.7.0 before proceeding; empty search results are not proof that a repo is uninstallable. ```bash evaluation_commit=$(git -C "$evaluation_source" rev-parse --verify HEAD) || exit 1 printf '%s\n' "$evaluation_commit" >"$evaluation_root/logs/source.commit" evaluation_record source-clone evaluation_env timeout --kill-after=5s 120s \ git clone --no-local --no-checkout -- "$evaluation_source" "$evaluation_root/source" || exit 1 evaluation_record source-checkout evaluation_env timeout --kill-after=5s 30s \ git -C "$evaluation_root/source" checkout --detach "$evaluation_commit" || exit 1 evaluation_record distribution evaluation_env timeout --kill-after=5s 120s \ python3 -B "$evaluation_source/tools/build_skill_distribution.py" \ --source "$evaluation_root/source" --output "$evaluation_root/icode" || exit 1 evaluation_payload="$evaluation_root/icode/skills/icode" evaluation_record available evaluation_cli add "$evaluation_payload" --list || exit 1 evaluation_record install evaluation_cli add "$evaluation_payload" \ --skill icode --agent codex --copy --yes || exit 1 evaluation_record installed evaluation_cli list evaluation_record integrity-before evaluation_env timeout --kill-after=5s 120s \ python3 -B "$evaluation_source/tools/check_skill_installation.py" \ --source "$evaluation_root/source" \ --installed "$evaluation_root/project/.agents/skills/icode" ``` -------------------------------- ### Install and configure OpenAI SDK for Responses API Source: https://github.com/ayukyo/icode-skill/blob/main/agent_runtime/README.md Installs the optional openai package and sets the OPENAI_API_KEY environment variable. The SDK reads the key only from the environment; never put it in command arguments, metadata, events, ticket artifacts, or logs. ```bash python3 -m pip install --user openai export OPENAI_API_KEY='<通过安全环境注入>' python3 tools/icode_agent.py run \ --dir \ --backend openai-responses --model \ --capability text --prompt 'perform one bounded task' \ --task-scope 'bounded task' --expected-artifact 'text result' \ --evidence-boundary 'declared inputs only' \ --join-condition 'non-empty bounded output' --request-id turn-1 ``` -------------------------------- ### Install sequential-thinking MCP server Source: https://github.com/ayukyo/icode-skill/blob/main/mcp/sequential-thinking/README.md Run this script from the mcp/sequential-thinking directory to register the server. It requires Node.js ≥ 18 and npm ≥ 9, and will write the server to ~/.claude.json's mcpServers section. ```bash cd <你的 icode-skill 仓库>/mcp/sequential-thinking ./install.sh ``` -------------------------------- ### Start local web UI: python3 tools/icode_agent.py ui Source: https://github.com/ayukyo/icode-skill/blob/main/agent_runtime/README.md Starts the optional local web UI (ICODE Manager 2.0). Defaults to listening on 127.0.0.1:8765 and opens a browser; reuses an existing global UI via ~/.claude/icode_data/ui_instance.json when called without arguments. The server prints the actual URL and reused status. ```bash python3 tools/icode_agent.py ui ``` -------------------------------- ### Run the docx runtime bootstrapper Source: https://github.com/ayukyo/icode-skill/blob/main/tools/docx/README.md Run once on a machine. Creates a lock-content-addressed venv under ~/.local/share/icode/runtime/docx// using pinned third-party packages. Requires normal package-index network access on first installation unless wheels are bundled in tools/docx/wheels/; respects PIP_INDEX_URL, PIP_EXTRA_INDEX_URL, and PIP_NO_INDEX exactly. With no pip index configured it tries PyPI and then built-in HTTPS mirrors (Tsinghua, Aliyun) only for network/timeout failures. ```bash python3 tools/docx/bootstrap_runtime.py ``` -------------------------------- ### Mode D: Log then start commands Source: https://github.com/ayukyo/icode-skill/blob/main/README.md Uses a log command to output root cause and fix requirements, then follows with a start command to apply the fix. ```bash cd demo && /icode log "symptom" ``` ```bash /icode start ``` -------------------------------- ### 下一步建议输出块 Source: https://github.com/ayukyo/icode-skill/blob/main/steps/00_init.md 工作量评估后输出的固定格式建议块,包含评估等级、理由和推荐入口(/icode start 或 /icode fast)。 ```markdown ## 下一步建议 📊 工作量评估:{level} 理由:需求点 N / 涉及 M 文件 / 跨 K 模块 / 命中 H 大改词 💡 建议入口:/icode {start|fast} - /icode start:完整 3 轮对抗 + 完整 deepcheck({适用情况}) - /icode fast:1 轮无对抗 + 单阶段 deepcheck({适用情况})—— {当前是否推荐} ``` -------------------------------- ### Install and set up credentials for icode-mail-observe Source: https://github.com/ayukyo/icode-skill/blob/main/mcp/icode-mail-observe/README.md Commands to install the MCP adapter and create a secure credential file. The credential file must have permissions 0600 on Linux/macOS; the directory is set to 700. The secret is read from this file or the ICODE_MAIL_OBSERVE_SECRET environment variable. ```bash ./mcp/install.sh --client all icode-mail-observe mkdir -p ~/.config/icode chmod 700 ~/.config/icode # 用编辑器创建 ~/.config/icode/mail-observe.secret,然后: chmod 600 ~/.config/icode/mail-observe.secret ``` -------------------------------- ### Install vision-bridge MCP Source: https://github.com/ayukyo/icode-skill/blob/main/README.md Installs the vision-bridge MCP for image/video understanding. Run from the vision-bridge directory; the script creates a venv, installs dependencies, and registers the MCP to ~/.claude.json. After installation, edit the generated config.json with your base_url, api_key, and model, then restart Claude Code. ```bash cd ~/.claude/skills/icode/mcp/vision-bridge ./install.sh # auto: venv + install deps + register to ~/.claude.json # edit the generated config.json with your base_url / api_key / model # restart Claude Code to take effect ``` -------------------------------- ### Example verification run metadata JSON Source: https://github.com/ayukyo/icode-skill/blob/main/steps/verify.md Example metadata record for a verification run, showing the schema fields including run_id, kind, build_source, outcome, and evidence. ```json { "run_id": "", "at": "date +%Y-%m-%dT%H:%M:%S", "kind": "build | deploy | listen | device_test", "build_source": "fresh | reused | existing | unknown", "device": "<连接标识,可选>", "artifact_identity": "<实际部署 commit/构建标识,可选>", "window": "<监听窗口描述,可选>", "profile": "generic | embedded | camera,可选", "baseline_ref": "sha256:<与 verification_contract.baseline_ref 完全一致的摘要>", "metrics": {"fps": 29.7}, "outcome": "pass | fail | inconclusive", "evidence": "file:line / 日志时间点 / 行为证据(双通道标注)", "note": "<可选补充>" } ``` -------------------------------- ### Start local web UI without opening browser: --no-browser Source: https://github.com/ayukyo/icode-skill/blob/main/agent_runtime/README.md Starts the local web UI without automatically opening a browser. Use this when you prefer to manually navigate to the printed URL. ```bash python3 tools/icode_agent.py ui --no-browser ``` -------------------------------- ### python3 tools/icode_control.py step --phase start Source: https://github.com/ayukyo/icode-skill/blob/main/references/execution_model.md 启动一个已登记步骤的验证 attempt。从 JSON 输出取得 attempt,后续命令需带回该值。 ```bash python3 tools/icode_control.py step --dir --step --phase start --request ``` -------------------------------- ### Install Chromium for playwright Source: https://github.com/ayukyo/icode-skill/blob/main/mcp/playwright/README.md Pre-installs the Chromium browser to speed up the first MCP tool call. This is optional but recommended to avoid the automatic download that occurs on first use. ```bash npx playwright install chromium ``` -------------------------------- ### Mode A: Full-flow start command Source: https://github.com/ayukyo/icode-skill/blob/main/README.md Runs the full icode workflow in Mode A to add modulo, power operations, and integer overflow checks to the calculator. ```bash cd demo && /icode start add modulo and power operations to the calculator, plus integer overflow checks ``` -------------------------------- ### Setup isolated evaluation environment and helpers (Bash) Source: https://github.com/ayukyo/icode-skill/blob/main/docs/find-skills-compatibility.md Defines environment variables, helper functions, and the evaluation harness. Creates a temporary directory with subdirectories, clears inherited credentials with env -i, disables telemetry, and runs all commands under timeout. Closes telemetry but does not imply offline; npm downloads still need network. Used before running any evaluation commands. ```bash evaluation_source=/absolute/path/to/trusted/icode-skill evaluation_root=$(mktemp -d /tmp/icode-skills-eval.XXXXXX) mkdir -p "$evaluation_root"/{home,config,cache,data,tmp,project,logs} evaluation_env() { env -i PATH="$PATH" HOME="$evaluation_root/home" \ XDG_CONFIG_HOME="$evaluation_root/config" \ XDG_CACHE_HOME="$evaluation_root/cache" XDG_DATA_HOME="$evaluation_root/data" \ TMPDIR="$evaluation_root/tmp" \ GIT_CONFIG_NOSYSTEM=1 GIT_CONFIG_GLOBAL=/dev/null GIT_TERMINAL_PROMPT=0 \ DISABLE_TELEMETRY=1 DO_NOT_TRACK=1 CI=1 \ npm_config_cache="$evaluation_root/cache/npm" \ npm_config_userconfig=/dev/null npm_config_globalconfig=/dev/null \ npm_config_ignore_scripts=true npm_config_audit=false npm_config_fund=false \ "$@" } evaluation_cli() { evaluation_env timeout --kill-after=5s 120s \ npx --yes --package=skills@1.7.0 skills "$@" } # 每步保存 stdout/stderr 和真实退出码;124/137 等超时绝不计为通过。 evaluation_record() { local label="$1" result shift if "$@" >"$evaluation_root/logs/$label.stdout" \ 2>"$evaluation_root/logs/$label.stderr"; then result=0 else result=$? fi printf '%s\n' "$result" >"$evaluation_root/logs/$label.exit" return "$result" } cd "$evaluation_root/project" || exit 1 evaluation_record cli-version evaluation_cli --version || exit 1 evaluation_record find evaluation_cli find icode ``` -------------------------------- ### Natural-language ICODE entry examples Source: https://github.com/ayukyo/icode-skill/blob/main/README.md Shows plain-language ways to invoke ICODE: naming the tool, describing the goal, and mixing Chinese and English. The host agent routes to existing steps and gates; no extra model service is needed. ```text Use ICODE to design retries for this module. Stop at the plan; do not change code. Use ICODE to test the version already on the device. Do not build or deploy. 使用 ICODE 把当前工单做成 PPT,给测试同事看。 /icode 帮我查看当前工单还有哪些验证没完成 ``` -------------------------------- ### Mode B: Step-by-step commands Source: https://github.com/ayukyo/icode-skill/blob/main/README.md Executes the step-by-step icode workflow in Mode B, starting with planning and followed by review, merge, code, deepcheck, and audit commands. ```bash cd demo && /icode plan add isqrt to calc.c ``` ```bash /icode review ``` ```bash /icode merge ``` ```bash /icode code ``` ```bash /icode deepcheck ``` ```bash /icode audit ``` -------------------------------- ### Workflow diagram Source: https://github.com/ayukyo/icode-skill/blob/main/README.md ASCII diagram showing the icode workflow: optional log/init steps feed into a six-step chain (Plan, Review, Merge, Code, Deep Check, Audit) with /icode start chaining all steps and /icode fast using a trimmed chain. ```text /icode log (optional) /icode init (optional) log root-cause analysis ─┐ requirement draft ─┐ └──────────┬────────────┘ ▼ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │ Plan │ → │ Review │ → │ Merge │ → │ Code │ → │ Deep │ → │ Audit │ │ Step 1 │ │ Step 2 │ │ Step 3 │ │ Step 4 │ │ Check │ │ Step 6 │ └────────┘ └────────┘ └────────┘ └────────┘ │ Step 5 │ └────────┘ └────────┘ /icode start = steps 1→6 chained | /icode fast = trimmed chain ``` -------------------------------- ### Build, inspect, and render DOCX from ICODE Markdown (bash pipeline) Source: https://github.com/ayukyo/icode-skill/blob/main/tools/docx/README.md Uses the bootstrapper's JSON output to locate the pinned Python interpreter, then builds guide.docx from guide.md, records a manifest, inspects the result, and renders a preview. Requires the bootstrap step to have been run first and a compatible renderer bundle present for the preview step; unsupported Mermaid is kept as a code block and recorded in the source map. ```bash RUNTIME_JSON="$(python3 tools/docx/bootstrap_runtime.py)" PYTHON="$(python3 -c 'import json,sys; print(json.loads(sys.argv[1])["python"])' "$RUNTIME_JSON")" "$PYTHON" tools/docx/build_docx.py guide.md guide.docx --manifest guide.manifest.json "$PYTHON" tools/docx/inspect_docx.py guide.docx --source guide.md --manifest guide.manifest.json "$PYTHON" tools/docx/render_docx.py guide.docx preview --result-manifest guide.manifest.json ``` -------------------------------- ### Build and run demo calculator Source: https://github.com/ayukyo/icode-skill/blob/main/README.md Builds and runs the demo calculator to confirm the baseline works. Use this before testing any icode modes. ```bash cd demo && make && ./calc_demo # confirm the baseline builds and runs ``` -------------------------------- ### ICODE entry points: UI, fast, init, log, doc, docx, backup Source: https://github.com/ayukyo/icode-skill/blob/main/README.md Shows the other ICODE entry points: local UI, fast mode, init for drafting, log for root-cause analysis, doc for project knowledge base, docx for DOCX delivery, and backup for safety snapshots. Includes comments explaining each command's behavior and defaults. ```bash # Local global ticket manager (defaults to 127.0.0.1:8765; auto-falls back if occupied) /icode ui # Trimmed full flow (fast mode: single-file/small changes; not a fixed cost guarantee) /icode fast "Add isqrt function to calc.c" # plan→review(1 round, no adversarial)→merge→code→deepcheck(Reverse only)→audit # Requirement unclear? Draft it in conversation first /icode init Record sensor data re-bag # Step 0: kick-off draft + dialogue # After the init analysis and discussion, turn the latest eligible draft into a beginner-facing guide /icode init --guide # Refreshes deliverables/guide.md; does not create another ticket # From a bug log: analyze root cause first, then fix /icode log ~/work/log/service-anomaly "no response after startup" # Entry: log root-cause analysis → fix requirement # Project-level knowledge base (standalone step, runs anytime) /icode doc myproject # Generate/update this project's knowledge base chapters # DOCX delivery (standalone; preserves `/icode doc` knowledge-base semantics) /icode docx docs/release-guide.md # P0: faithful DOCX beside the Markdown source /icode docx current bug delivery Word # P1: latest unique ICODE ticket → .icode_output/docx/ # Backup all work orders before deleting a project (safety net — run BEFORE deleting) /icode bak # Snapshot current project's entire .icode_output/ to ~/.claude/icode_data/project_backup/ /icode bak --project ~/work/myproj # Backup a specified project # Repeatable: each run creates a new timestamp snapshot (rsync --link-dest hardlink dedup). # After the project is deleted, history retrieval still finds full work orders from the backup (project-first, backup fallback). ``` -------------------------------- ### 创建新目录:工作区锚定与硬熔断(bash) Source: https://github.com/ayukyo/icode-skill/blob/main/references/dir_and_metadata.md 用于常规 init/log 创建工单目录。首先解析工作区根,然后递增目录号,并通过三个硬熔断防止误复用。要求输出目录位于 WORKSPACE_ROOT 内,禁止手写目录号。 ```bash # ——工作区根锚定(建前必做,L1 致命,阻塞流程)—— # 输出目录必须落在「当前会话工作区根」内:先解析工作区根(git 仓库 = git rev-parse --show-toplevel;非 git 仓库 = pwd 兜底), # 之后所有路径一律基于该绝对根。禁止凭历史路径假设/硬编码另一副本绝对路径写产物 # (历史事故:工单被写入另一仓库副本、用户按报告路径找不到;.icode_output 被 gitignore 时 git status 也不提示)。 # ⚠️ 概念区分(勿混):WORKSPACE_ROOT = 「当前 checkout 根」,即产物物理落点——worktree 内就是 worktree 根,**不做 F1 归一**; # 而 project_id 的 F1 归一(worktree 归主仓根,见「project_id 与 branch 语义」)只用于索引/limit/doc 键,**不用于产物落点**。 # 原地(非 worktree)时两概念同根;worktree 时产物必须落在 worktree 内(隔离 checkout),否则破坏 worktree 隔离(工单产物进错仓库)。 # 归档/备份不在此步:归档(worktree 回流后 archive_path)与备份(/icode bak)作用于已入索引的工单,debug 工单不入索引、无归档/备份流程。 WORKSPACE_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd) mkdir -p "$WORKSPACE_ROOT/.icode_output" # 统一父目录,所有产物收纳于此(基于工作区根绝对路径) # ⚠️ 目录号必须由下方递增逻辑计算,禁止手写/硬编码 N(如 .icode_output_10)——手写绕过递增 = 拆除"max+1 防误复用"安全网(历史事故:误复用已有工单目录,覆盖其 metadata 与 00_init) LAST=$(ls -d "$WORKSPACE_ROOT"/.icode_output/.icode_output_* 2>/dev/null | grep -oP '(?<=\.icode_output_)\d+' | sort -n | tail -1) NEXT=${LAST:-0}; NEXT=$((NEXT + 1)) ICODE_OUT_DIR="$WORKSPACE_ROOT/.icode_output/.icode_output_${NEXT}" # ——硬熔断① 建前检查(防误复用,L1 致命,阻塞流程)—— # 目标目录已存在 = 递增逻辑被绕过 / 目录号手写 / 并发竞态 → 立即中止,禁止覆盖 test -d "$ICODE_OUT_DIR" && { echo "❌ 误复用风险:目标目录已存在 $ICODE_OUT_DIR(递增逻辑被绕过或目录号手写/硬编码),禁止在此新建工单"; exit 1; } mkdir -p "$ICODE_OUT_DIR" # ——硬熔断② 建后验证(防误复用,L1 致命,阻塞流程)—— # 新建目录必须为空;非空 = 误复用(已含旧产物 / 旧工单所有权标志 .ico_metadata.json)→ 立即中止 [ -z "$(ls -A "$ICODE_OUT_DIR")" ] || { echo "❌ 目录非空=误复用,禁止在此新建工单"; exit 1; } # ——硬熔断③ 建后校验(工作区根锚定,L1 致命,阻塞流程)—— # 产物目录真实路径必须位于工作区根内;不在 = cwd 漂移 / 路径假设错误(凭历史路径写到了别的仓库副本)→ 立即中止,不静默写入 case "$(realpath "$ICODE_OUT_DIR")" in "$WORKSPACE_ROOT"/*) : ;; *) echo "❌ 输出目录 $(realpath "$ICODE_OUT_DIR") 不在当前工作区根 $WORKSPACE_ROOT 内(cwd 漂移或路径假设错误),禁止在此新建工单"; exit 1 ;; esac # 建后确认只能用磁盘状态(ls -A 为空 / 目录 mtime),禁止用 echo "created" 充当确认(echo 与磁盘状态无关,是伪确认) # ——创建完成提示(强制输出)—— echo "📁 ICODE_OUT_DIR = $(realpath "$ICODE_OUT_DIR")" # 绝对路径,供用户一眼核对是否落在当前工作区 grep -qE '^[^#]*\.icode_output' "$WORKSPACE_ROOT/.gitignore" 2>/dev/null && echo "⚠️ 产物目录被 gitignore,git status 不会提示写入位置,请以上方 📁 绝对路径为准(L3 提示,非阻断)" ``` -------------------------------- ### 构建并运行 demo 计算器(验证基线) Source: https://github.com/ayukyo/icode-skill/blob/main/README.zh-CN.md 在 demo 目录下编译并运行计算器程序,确认基线可编译可运行。 ```bash cd demo && make && ./calc_demo # 确认基线可编译可运行 ``` -------------------------------- ### 统一安装入口:git clone 与 install.sh Source: https://github.com/ayukyo/icode-skill/blob/main/README.zh-CN.md 将源码克隆到普通目录并运行顶层安装器,一次性安装 ICODE、共享技能、命令桥和 MCP。默认只安装 Claude(--client claude),双端使用 --client all,CodeBuddy 单独使用 --client codebuddy。 ```bash git clone https://github.com/ayukyo/icode-skill ~/icode-skill cd ~/icode-skill ./install.sh --client all ``` -------------------------------- ### 使用隔离环境变量运行评估 Source: https://github.com/ayukyo/icode-skill/blob/main/docs/skill-creator-compatibility.md 从隔离 demo 目录启动官方 runner,设置必要的环境变量并执行评估。此调用可能产生费用,需确认模型权限与预算。 ```bash SKILL_CREATOR=/absolute/path/to/anthropic-skills/skills/skill-creator ICODE_COPY=/absolute/path/to/isolated/icode DEMO_ROOT=/absolute/path/to/isolated/demo MODEL_ID=actual-authorized-model-id EVAL_RUN=/absolute/path/to/isolated/iteration-1 cd "$DEMO_ROOT" || exit 1 PYTHONPATH="$SKILL_CREATOR" python3 -m scripts.run_eval \ --eval "$ICODE_COPY/evals/icode/trigger-evals.json" \ --skill-path "$ICODE_COPY" --model "$MODEL_ID" \ --runs-per-query 3 --num-workers 1 --timeout 60 \ > "$EVAL_RUN/trigger-results.json" ``` -------------------------------- ### 查看执行轨迹:python3 tools/icode_control.py trace Source: https://github.com/ayukyo/icode-skill/blob/main/references/execution_model.md 使用 trace 命令输出统一的 step/gate/artifact/operation/agent/state 时间线,并显示 open_steps / open_operations / open_agents / agent_spawns。agent_spawns 是控制面在事件链校验后生成的一次性可信投影,UI/CLI 不得在校验后直读 metadata。恢复会话时先查看 trace,以决定从上一个已通过边界继续、重新 check、回流、重试或补 finish。 ```bash python3 tools/icode_control.py trace --dir --limit 50 ``` -------------------------------- ### 构建、结构验收与视觉验收的 bash 命令序列 Source: https://github.com/ayukyo/icode-skill/blob/main/steps/docx.md 使用 bootstrap JSON 获取 ICODE 自管 Python,然后依次执行 build_docx.py、inspect_docx.py 和 render_docx.py。结构验收失败不得交付;视觉验收仅使用 ICODE 所有的匹配 renderer,无匹配包会写 visual_qa_pending。 ```bash # 1) 用 bootstrap JSON 取 ICODE 自管 Python RUNTIME_JSON="$(python3 tools/docx/bootstrap_runtime.py)" DOCX_PYTHON="$(python3 -c 'import json,sys; print(json.loads(sys.argv[1])["python"])' "$RUNTIME_JSON")" # 2) P0:源文件同级输出;P1:SOURCE 是刚收集的真实交付 Markdown "$DOCX_PYTHON" tools/docx/build_docx.py "$SOURCE" "$OUTPUT" --manifest "$MANIFEST" # 3) 必须结构验收;失败不得交付 "$DOCX_PYTHON" tools/docx/inspect_docx.py "$OUTPUT" --source "$SOURCE" --manifest "$MANIFEST" # 4) 视觉验收仅使用 ICODE 所有的匹配 renderer;无匹配包会写 visual_qa_pending "$DOCX_PYTHON" tools/docx/render_docx.py "$OUTPUT" "$PREVIEW_DIR" --result-manifest "$MANIFEST" ``` -------------------------------- ### 运行安装与分发测试的固定验收命令 Source: https://github.com/ayukyo/icode-skill/blob/main/docs/find-skills-compatibility.md 用于离线验收的固定命令,分别运行安装和分发测试。第一个命令执行 test_skill_installation.py,第二个执行 test_skill_distribution.py。两者均使用 -B 禁用 .pyc 写入,并以 -v 输出详细结果。 ```bash python3 -B -m unittest discover -s tests -p test_skill_installation.py -v python3 -B -m unittest discover -s tests -p test_skill_distribution.py -v ``` -------------------------------- ### 生成专用资料草稿(prepare_skill_listing.py) Source: https://github.com/ayukyo/icode-skill/blob/main/docs/skill-catalog-submission.md 用于生成各平台(默认、SkillHub、Smithery)的专用资料草稿。工具只读取根 SKILL.md,无网络、无凭据读取、无文件写入,JSON 仅输出到终端;版本必须是唯一的稳定 X.Y.Z。 ```bash # 无网络、无凭据读取、无文件写入;JSON 仅输出到终端 python3 tools/prepare_skill_listing.py python3 tools/prepare_skill_listing.py --platform skillhub python3 tools/prepare_skill_listing.py --platform smithery ``` -------------------------------- ### 创建新目录(debug 变体):--debug 模式(bash) Source: https://github.com/ayukyo/icode-skill/blob/main/references/dir_and_metadata.md 用于 /icode init --debug 或 /icode log --debug。目录建在 .icode_output/.debug/ 下,编号与正常工单隔离,但硬熔断①②③完全相同。debug 忽略 --worktree,原地创建。 ```bash # 工作区根锚定(建前必做,同「创建新目录」段,L1 致命):debug 产物必须落在当前工作区根内, # 禁止凭历史路径假设/硬编码另一副本绝对路径写产物(历史事故:debug 工单被写入另一仓库副本,用户按路径找不到)。 # debug 忽略 --worktree 原地创建:cwd 在 worktree 内时 WORKSPACE_ROOT = worktree 根,产物落该 checkout 的 .icode_output/.debug/ WORKSPACE_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd) mkdir -p "$WORKSPACE_ROOT/.icode_output/.debug" LAST=$(ls -d "$WORKSPACE_ROOT"/.icode_output/.debug/.icode_output_* 2>/dev/null | grep -oP '(?<=\.icode_output_)\d+' | sort -n | tail -1) NEXT=${LAST:-0}; NEXT=$((NEXT + 1)) ICODE_OUT_DIR="$WORKSPACE_ROOT/.icode_output/.debug/.icode_output_${NEXT}" # 硬熔断① 建前检查:目标 debug 目录已存在 = 递增被绕过/目录号手写 → 中止 test -d "$ICODE_OUT_DIR" && { echo "❌ 误复用风险:目标 debug 目录已存在 $ICODE_OUT_DIR(递增逻辑被绕过或目录号手写),禁止在此新建工单"; exit 1; } mkdir -p "$ICODE_OUT_DIR" # 硬熔断② 建后验证:新建目录必须为空 [ -z "$(ls -A "$ICODE_OUT_DIR")" ] || { echo "❌ 目录非空=误复用,禁止在此新建 debug 工单"; exit 1; } # 硬熔断③ 建后校验(工作区根锚定,L1 致命):真实路径必须位于工作区根内,不在 = cwd 漂移/路径假设错误 → 中止 case "$(realpath "$ICODE_OUT_DIR")" in "$WORKSPACE_ROOT"/*) : ;; *) echo "❌ 输出目录 $(realpath "$ICODE_OUT_DIR") 不在当前工作区根 $WORKSPACE_ROOT 内(cwd 漂移或路径假设错误),禁止在此新建 debug 工单"; exit 1 ;; esac # 创建完成提示(强制输出):绝对路径供核对 echo "📁 ICODE_OUT_DIR = $(realpath "$ICODE_OUT_DIR")" grep -qE '^[^#]*\.icode_output' "$WORKSPACE_ROOT/.gitignore" 2>/dev/null && echo "⚠️ 产物目录被 gitignore,git status 不会提示写入位置,请以上方 📁 绝对路径为准(L3 提示,非阻断)" ``` -------------------------------- ### PPT 生成主流程(build_pptx.py + render_slides.py + check_render_output.py) Source: https://github.com/ayukyo/icode-skill/blob/main/tools/ppt/README.md 从模板生成 PPT 的完整流程:先设置模板路径,生成 edits.json,然后运行`build_pptx.py`生成 .pptx,再可选运行`render_slides.py`渲染预览 PNG,最后运行`check_render_output.py`执行确定性检查。注意`check_render_output.py`通过只代表渲染结构完整,视觉排版仍标记为`unobserved`。 ```bash TPL=tools/ppt/templates/minimal-business-summary ``` ```bash mkdir -p .icode_output/ppt python3 tools/ppt/scripts/build_pptx.py \ $TPL/template.pptx .icode_output/ppt/{场景关键词}_edits.json .icode_output/ppt/{名称}.pptx \ --detail $TPL/detail.json ``` ```bash # 渲染预览(可选):每页一张 PNG 自检 python3 tools/ppt/scripts/render_slides.py .icode_output/ppt/{名称}.pptx .icode_output/ppt/preview --dpi 144 python3 tools/ppt/scripts/check_render_output.py .icode_output/ppt/{名称}.pptx .icode_output/ppt/preview ``` -------------------------------- ### Cross-project debug usage with /icode init and /icode log Source: https://github.com/ayukyo/icode-skill/blob/main/references/debug_mode.md Shows how to start debug work orders in different projects. Each project's debug work orders are stored under its own .icode_output/.debug/ directory, ensuring global isolation. ```bash cd /path/to/project-A /icode init --debug "研究 A 项目的设计合理性" # → A/.icode_output/.debug/.icode_output_1/ ``` ```bash cd /path/to/project-B /icode log --debug 服务异常日志路径 # → B/.icode_output/.debug/.icode_output_1/ ``` -------------------------------- ### Identity Plan Output at close_planned Source: https://github.com/ayukyo/icode-skill/blob/main/steps/close.md Machine-readable identity plan emitted when close starts, acting as anchor for expected closure result. Lists ticket, output dir, repo actions, cleanup paths, branches, and archive handoff. ```text identity plan: ticket: source_out_dir: status: completed active_checkout: → 置 submitted(移入 checkout_history) per-repo: {repo_path, target_remote_ref, expected_commit, action: [置submitted + 清理checkout + 安全删分支]} cleanup: [<子仓隔离路径>, ] branches: [] control_root: → (archived 阶段交接) ``` -------------------------------- ### before 链路图(ASCII) Source: https://github.com/ayukyo/icode-skill/blob/main/steps/00_init.md init 直出时展示当前调用/数据流链路,节点标注 file:line 或模块名。信息不足时用 ? 标未定节点,不得留空。 ```text {从入口到出口的调用/数据流 ASCII 图,关键节点标 file:line 或模块名} 调用方 --A--> 模块X.foo(src/foo.c:42) --B--> 出口 ``` -------------------------------- ### 冻结 fresh 文件 Source: https://github.com/ayukyo/icode-skill/blob/main/steps/crosscheck.md freeze 成功后 fresh 文件不可再改,仅此时才能读取 previous_round 并比较前后变化。 ```bash python3 tools/icode_crosscheck.py freeze --dir --round ```