afsim-debug

A command for diagnosing errors in AFSIM scenario files. AFSIM is military-simulation software, and Warlock and Wizard are tools used to work with its scenarios.

In plain words
What is it for?
Use it to analyse pasted errors, find documented fixes, create a minimal test file and suggest corrected code. Confirmed new fixes can later be added to the error reference after validation.
Why use it?
It replaces immediate guessing with a process that matches error messages to known causes and tests corrections in a small example first.

Command for Cursor

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 commands/qingzhoupro/afsim-skill/afsim-debug
Clone the repo
git clone --depth 1 https://github.com/qingzhoupro/afsim-skill

Made for: Cursor.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,216 The whole file, excluding the scripts and references it only reads on demand.
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.00000 $0.01216
Opus 5 $0.00000 $0.00608
Sonnet 5 $0.00000 $0.00243
Haiku 4.5 $0.00000 $0.00122

Measured 2d ago against content hash 9edfe056d894, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

afsim-debug 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.

.cursor/commands/afsim-debug.md · 156 lines

How it starts

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

/afsim-debug — 报错处理与教训激活

粘贴 Warlock/Wizard 的报错信息,获取修正方案和相关教训。

使用方式

/afsim-debug
[粘贴报错信息]

核心原则

报错后绝不立即猜测根因。必须用断点(逐段注释/最小测试文件)隔离问题。


处理流程

Step 1: errors-ref 快速匹配

refs/errors-ref.md 中搜索报错关键字:

  • Unknown command
  • Invalid position
  • not found
  • expected
  • undefined
  • syntax error
  • 具体命令名(如 platform_typeradar_signature 等)

匹配到 [Exxx] 条目后,记录相关教训 ID。

Step 2: 教训激活(应激触发)

仅在 errors-ref 命中时,加载 memory/cold/lesson-index.md 查找相关教训 ID。

找到教训 ID 后,加载 memory/cold/lesson-root-causes.md 中对应段落。

Step 3: 修正方案输出 + 断点验证

输出格式:

## 报错分析

[描述报错原因]

## 修正方案

```text
[修正后的代码片段]

断点测试计划

修正后,写一个最小化测试文件(只保留报错相关的最小片段), 验证修正是否正确。测试通过后再改主文件。

Demo 参考

详见:refs/demos-index.md → [相关 Demo 名称]


### Step 4: 追加记录(需用户确认)

如果该报错在 errors-ref 中无记录:
1. 将报错模式和修正方案追加到 `refs/errors-ref.md`
2. 如果该错误有深层根因,创建对应教训追加到 `memory/cold/`

> **注意**:追加前必须等用户 Warlock 验证通过后再追加,不可提前追加未经确认的教训。

---

## 断点调试工作流(核心)

> 当报错信息不足以直接定位根因时,必须使用断点调试。

### 何时使用

- 报错关键字模糊(如 `Unknown weapon`、`not found`)
- 修正后错误依然存在
- 无法从报错行号直接推断问题

### 断点调试流程

1. **提取最小片段**:从原文件中提取报错相关的最小代码块
2. **写测试文件**:将最小片段写成独立测试文件(`output/staging/test_xxx.txt`)
3. **Warlock 验证**:用 Warlock 打开测试文件,确认是否仍报错
4. **逐步加回**:测试通过后,逐步加回被注释掉的代码,再次验证
5. **确认根因**:通过断点测试精确定位问题,然后修正原文件

### 断点测试文件命名规范

output/staging/test_<功能><编号>.txt 例如: test_weapon_type_1.txt # 断点1:weapon 类型定义 test_weapon_with_type_1.txt # 断点2:weapon + platform_type test<具体修正点>.txt


### 断点调试示例

场景:报错 "Unknown weapon: my_weapon"

断点1(最小化): weapon MY_WEAPON WSF_EXPLICIT_WEAPON launched_platform_type MY_MISSILE end_weapon random_seed 1 end_time 1 sec → Warlock 测试

断点2(加上 platform_type): weapon MY_WEAPON WSF_EXPLICIT_WEAPON launched_platform_type MY_MISSILE end_weapon platform_type MY_MISSILE WSF_PLATFORM end_platform_type random_seed 1 end_time 1 sec → Warlock 测试

断点3(加上 platform 实例): weapon MY_WEAPON WSF_EXPLICIT_WEAPON launched_platform_type MY_MISSILE end_weapon platform_type MY_MISSILE WSF_PLATFORM end_platform_type platform test WSF_PLATFORM weapon my_weapon MY_WEAPON end_weapon end_platform random_seed 1 end_time 1 sec → Warlock 测试

通过后,再加回其他配置(mover、sensor 等)

Read the full file on GitHub · 156 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 · 156 lines · 0 tokens per session scan A 9edfe056d894

Subscribe to this mod's changes

afsim-debug is a command published in the GitHub repository qingzhoupro/afsim-skill (51 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,216 tokens. 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-30.