engine-debug
Skill2 starsChanged 46 days agoMITView on GitHub
Dev-only, anti-hall repo (not part of the shipped plugin). Use when the ah-engine daemon or a hook misbehaves - high CPU, memory growth, a frozen or crashing daemon, slow hooks, a wrong decision - to find the cause with evidence before any fix, without touching the live daemon's state.
- Deletes or force-pushes
In this repository7 other files it gives its agents.
- AGENTS.mdAGENTS.md
- llms.txtllms.txt
- dogfoodSkill
- engine-laneSkill
- gh-workSkill
- releaseSkill
- repo-hygieneSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
Never touch the live daemon's state.
- Distinctive: line 22
No rollback of the engine during a live test, and no "restart it and see".
- Very specific: line 50
Write the failing test first (see engine-lane), then fix the cause, not the symptom.
- Distinctive: line 58
Do not guess a cause from a metric or a log line.
- Very specific: line 59
Do not add a threshold, interval or text to Rust source while fixing: it goes in the plugin's engine/defaults/*.toml …
- Very specific: line 61
Do not add a flag or environment variable without its entry in flags.toml / engine.toml: the reference drift tests fail otherwise.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
engine-debug: find the cause of an engine problem
Dev-only: lives in the repo's .claude/skills/, outside plugins/anti-hall/, so it is never
installed for users. The long form, with commands and a worked example, is the "A debugging
session" section of docs/DEVELOPMENT.md (and "CPU and memory profiling" in
docs/AH-ENGINE.md). This skill is the checklist for an agent. Every flag, environment variable
and key named here is listed in ah-engine/REFERENCE.md.
Safety rules (they win over speed)
- Never touch the live daemon's state. Read its logs; reproduce in a scratch home
(
AH_ENGINE_DIRandHOMEin a fresh temp directory, which also gives the scratch daemon its own socket). Copy databases withah-engine backup --to <scratch>, never with a barecpof a live database. - Kill by PID only (
kill <pid>). Nopkill, nokillall: they stop the daemons of other sessions. Track every PID you start and stop exactly those. - No rollback of the engine during a live test, and no "restart it and see". Roll back only when hooks exceed their timeout or the guards stop blocking; otherwise fix forward.
- A debugger or sampler stays attached only as long as its command runs (
--batch, then detach). Never leave one on the live daemon. - Debug mode is off in normal use. Turn it on for the shortest time that answers the question,
then back off (
--debug,AH_ENGINE_DEBUG,diagnostics.debug_mode). - Bound everything: a build only when load is under 14,
nice -n 19,-j 2; deletetarget/of a scratch clone when done (move to the Trash, norm -rf).
Steps
- State the symptom with a number. CPU %, RSS, hook latency, exit code. "Slow" is not a symptom.
- Health first.
ah-engine status --json:health.degraded,health.restarts,health.last_crash, breaker, crash-loop. Acli-crash.jsonentry is a command-line or hook-client panic and is not a daemon crash. - Logs. The event log
ah-engine.login the state directory, thenlast-crash.jsonand its breadcrumb. Quote the lines you rely on. - Name the busy thread.
ah-engine status --threads(CPU % per thread name, work counters per second). Do not read code before you know which thread and which counter. - Memory.
ah-engine status --memory; thenmem.ndjson(per request) andmem-snapshot.json(when the cap tripped). For allocation sites use a scratch daemon withdiagnostics.allocator = systemorAH_ENGINE_ALLOCATOR=system. - Profile.
samply record -p <pid>, or on macOSsample <pid> 5 -file <out>symbolised withatosand the build'sah-engine.dSYM. Symbols match only the binary of the same build (dwarfdump --uuid). - Frozen daemon. Stacks before restart:
rust-lldb -p <pid> --batch -o 'thread backtrace all' -o detach -o quit(Linux:eu-stack -p <pid>). Save them, then stop the daemon by PID. - Reproduce in a scratch home with the smallest input that shows the number from step 1.
Write the failing test first (see
engine-lane), then fix the cause, not the symptom. - Prove the fix with the same measurement as step 1, on the same kind of data. A lab number is not a live number: say which one you have.
- Record it. A line in
.anti-hall/history/(Cause / Fix / Verified) and, for a defect, the GitHub issue (gh-work).
Do not
- Do not guess a cause from a metric or a log line; get the per-item breakdown first.
- Do not add a threshold, interval or text to Rust source while fixing: it goes in the plugin's
engine/defaults/*.toml(no_hardcoded_tunables). - Do not add a flag or environment variable without its entry in
flags.toml/engine.toml: the reference drift tests fail otherwise.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

