中文

← 灵感页

rcode

我自己写的 agent 宿主,Node、零依赖、MIT。

站上不跑它:它会执行 shell、读写文件。下面的判定与 prompt 是构建时用它自己的模块现算的。

快速问答模式:纯对话,不暴露任何工具

0 / 10 个工具在这个模式里够得着;片段按 current-mode.md → interaction.md → mode-behavior.md 顺序拼装。

闸门判定(rcode 的 gate.check() 现算,不是抄的)
工具判定理由
read_file读文件拒绝当前模式未授权工具 read_file
list_dir列目录拒绝当前模式未授权工具 list_dir
write_file写文件拒绝当前模式未授权工具 write_file
run_command跑命令拒绝当前模式未授权工具 run_command
fetch_url抓网页拒绝当前模式未授权工具 fetch_url
use_skill加载技能拒绝当前模式未授权工具 use_skill
submit_plan交计划拒绝当前模式未授权工具 submit_plan
task_create建任务拒绝当前模式未授权工具 task_create
agent派子代理拒绝当前模式未授权工具 agent
mcp__demo__echoMCP 外部工具拒绝当前模式未授权工具 mcp__demo__echo
看这个模式拼出来的 system prompt(1527 字符)
You are rcode, a focused coding and system agent running inside a terminal harness.
You complete tasks by reasoning step by step and calling tools when they genuinely help.

Environment:
- Working directory: ~/项目
- Today: 2026-10-28
- Interactive terminal session. The human is present and watches every tool approval.

# Operating principles

1. Be direct and useful. Skip filler. Actions and results speak.
2. Prefer the smallest correct action: read before writing, verify before claiming done.
3. When a task matches a skill in the catalog below, load that skill first and follow it.
4. Tool permission boundaries are enforced by the harness, not by you. If a call is denied,
   do not retry the same call; adjust the approach or ask the human.
5. Never fabricate tool output or file content you have not actually read.

# Skills

The catalog below lists routing descriptions only. When one matches the current task,
call use_skill with its exact name to load the full instructions, then follow them.

- repo-map: When the user asks what a repository/project is about, its structure, or "where is X implemented", load this skill to build a structural map from real directory reads.
- word-counter: When the user asks how many words, characters, or lines a text file (or code file) contains, load this skill to count them accurately with real file reads.

<mode>
当前处于 **quick 模式**:快速问答。
直接回答,简洁为上。此模式下没有任何工具可用,不要尝试调用工具;
若问题需要读代码或执行操作才能回答,告诉用户切换到 ask 或 craft 模式(`/mode ask`)。

</mode>

---
tools: []
---








(本次会话没有注入记忆)

清单读不到时会怎样

闸门是 fail-closed:受控工具清单不可核实,就一律要求确认,绝不静默放行。 受控工具本身只有两个:write_file(组 fs-write)、run_command(组 shell-exec)。把清单目录指到一个不存在的地方再问一次,结果是:

清单不可用时的判定(同一个 gate.check(),清单路径故意指错)
工具判定理由
write_file要先问受控工具清单不可用,无法核实该工具是否需要审批,默认要求确认。
run_command要先问受控工具清单不可用,无法核实该工具是否需要审批,默认要求确认。

它带的两个演示技能

技能目录常驻在 system prompt 里只放一行路由描述,正文等命中才加载——目录便宜,正文昂贵。

  • repo-map
  • word-counter

在你自己机器上跑

export RCODE_API_KEY="你的模型密钥"   # OpenAI 兼容协议均可:GLM / DeepSeek / 本地 vLLM
node rcode.mjs --selftest              # 不调模型,只验装配与闸门
node rcode.mjs --serve                 # Web 前端 → http://127.0.0.1:7717
node rcode.mjs --mode ask              # 只读模式进 REPL

Node ≥18。来源:rcode(ruans,MIT);站点仓库里 vendor/rcode 是它的只读副本, 每次构建跑一遍 ops/rcode_probe.mjs 取数。要改它请改原仓库,这里只读。