# Hodios paste pack: Debugging

Everything in Debugging from Hodios, the open prompt library by Hermes IDE: 25 entries, catalog 2026.1004.3.

Every entry is dedicated to the public domain under CC0 1.0. Copy, change and share them freely, no attribution needed.

Browse and search the library at https://hermes-ide.com/prompts

## How to use

Find an entry below and copy the text inside its block into ChatGPT, claude.ai or any chat. Replace each [PLACEHOLDER] with your own material. Personas, rules and styles work best as custom instructions or project instructions.

## Contents

- Debugging
  - [Bisect a regression](#bisect-regression) (prompt)
  - [Bugfix track](#bugfix-track) (workflow)
  - [Debug a failing network request](#debug-network-request) (prompt)
  - [Debug a mobile app crash](#debug-mobile-crash) (prompt)
  - [Debug a native crash](#debug-native-crash) (prompt)
  - [Debug a production-only bug](#debug-production-only-bug) (prompt)
  - [Debug a race condition](#debug-race-condition) (prompt)
  - [Debug bus communication](#debug-bus-communication) (prompt)
  - [Debugger](#debugger) (persona)
  - [Decode a microcontroller hard fault](#decode-microcontroller-hard-fault) (prompt)
  - [Diagnose a crash-looping pod](#diagnose-crashlooping-pod) (prompt)
  - [Diagnose a mobile app freeze](#diagnose-app-not-responding) (prompt)
  - [Explain a stack trace](#explain-stack-trace) (prompt)
  - [Find and fix latent bugs before users do](#find-latent-bugs) (prompt)
  - [Find the root cause of a bug](#find-root-cause) (prompt)
  - [Fix a CSS layout bug](#fix-css-layout-bug) (prompt)
  - [Fix a date and time bug](#fix-date-time-bug) (prompt)
  - [Fix a failing Docker build](#fix-docker-build-failure) (prompt)
  - [Fix a mobile build failure](#fix-mobile-build-failure) (prompt)
  - [Fix a text encoding bug](#fix-text-encoding-bug) (prompt)
  - [Fix physics jitter and tunnelling](#fix-physics-jitter-and-tunneling) (prompt)
  - [Resolve a dependency conflict](#resolve-dependency-conflict) (prompt)
  - [Solve a debugging case by experiment](#play-debugging-detective) (prompt)
  - [Triage a failing CI build](#triage-failing-ci) (prompt)
  - [Turn a bug report into a minimal reproduction](#reproduce-bug-report) (prompt)

---

<a id="bisect-regression"></a>

## Bisect a regression

`bisect-regression` · prompt · Debugging · https://hermes-ide.com/prompts/bisect-regression

Finds the commit or input that introduced a regression by writing an automated good/bad check first, then bisecting. Use when something that used to work is broken and the cause is unclear.

````markdown
<context>
Bisection finds the first bad commit in log2(n) steps, but only if every step is judged correctly. Most failed bisects come from a manual or flaky check, an untestable commit marked bad, or a "good" endpoint that was never verified. So the check comes first: one script that builds what it needs, reproduces the symptom, and exits with an unambiguous code. The same idea applies when the regression is triggered by data rather than code: halve the input until the smallest failing input remains.
</context>

<task>
Find what introduced this regression:
[REGRESSION]

Bad: HEAD. 

1. **Write the check.** A script that exits 0 when the behaviour is good, 1 when it shows this specific regression, and 125 when the commit cannot be tested (build fails for an unrelated reason, missing migration). It must test the regression itself, not "any failure", and must map crashes and signals to 1 or 125 explicitly, because `git bisect run` aborts on any exit code above 127. Make it deterministic: fixed seeds, clean build output, isolated temp data. If the symptom is intermittent, run it N times and call it bad if any run fails; say what N gives enough confidence for the failure rate you observed.
2. **Confirm the endpoints.** Run the check on the bad ref and the good ref and show the results. If no good ref is known, find one by testing older release tags or stepping back exponentially (bad~10, ~20, ~40…), and stop to ask if nothing older is good. If the check disagrees with the user's report on either endpoint, stop and fix the check.
3. **Decide what to bisect.** If the regression appears with the same code and different data or configuration, bisect the input instead: split the input in halves (records, config keys, files), keep the half that still fails, and repeat until removing any single part makes it pass.
4. **Run the bisect:** `git bisect start <bad> <good>`, then `git bisect run <check>`. Use `--first-parent` when the history has merges and the team wants the merge that introduced it. Note any skipped commits.
5. **Confirm the culprit.** Show the commit, read its diff, and explain the mechanism that breaks the behaviour. Where practical, revert just that commit on top of the bad ref and show the check passes.
6. End with `git bisect reset` and say which branch is checked out.
</task>

<constraints>
- Never mark a commit bad because it fails to build or fails for a different reason; that is a skip (exit 125).
- Do not modify tracked files during the bisect; keep the check script outside the repository or untracked so checkouts do not change it.
- If you cannot run commands, give the user the check script and the exact commands, and ask for the output at each decision point instead of guessing results.
- Before saying the work is done, run the check that proves it (tests, build, type check or the command the user gave) and report the real result.
- If you could not run a check, say so plainly and say which one.
- Separate what you verified from what you inferred. Mark inferences as such.
- When you do not know, say "I don't know" once and state what would settle it.
</constraints>

<output_format>
## Check
The script in a code block, and what each exit code means for this regression.
## Good and bad endpoints
The refs and the check result on each.
## Bisect
The exact commands, and the bisect log if you ran it.
## Result
The first bad commit (hash, title, author date), or the minimal failing input, with how many steps it took and any skipped commits.
## Culprit analysis
What in that change causes the regression, the revert check, and a suggested next step (fix forward or revert).
</output_format>
````

---

<a id="bugfix-track"></a>

## Bugfix track

`bugfix-track` · workflow · Debugging · https://hermes-ide.com/prompts/bugfix-track

Takes a bug from report to reproduction, root cause, regression test, minimal fix and a verified pull request, stopping for approval between steps. Use for any bug worth fixing properly.

````markdown
Fixes this bug properly, one approved step at a time:

<bug_report>
[BUG_REPORT]
</bug_report>

Severity: medium.

The order is fixed: reproduce it, find the root cause, write a test that fails because of the bug, make the smallest fix that turns the test green, then verify everything and prepare the pull request. Each step ends with a short report and stops for the developer's approval; later steps build on the approved findings instead of re-asking. Nothing is called fixed until a test that failed before the change passes after it and the rest of the suite still passes. If the severity is high or critical, the first step also says whether users need a mitigation now (rollback, feature flag, config change) while the proper fix is made, and leaves that decision to the developer.

Throughout: read the code before making a claim about it, run real commands and quote their real output, change only what the bug requires, and never push, merge or open a pull request without explicit approval.

## Steps

Work through these steps in order. Do not skip a gate.

1. reproduce (discover)
2. root-cause (discover)
3. regression-test (verify)
4. fix (build)
5. pull-request (ship)

### Step 1: Reproduce

Turn the report into a reproduction you can run on demand.

1. Restate the bug as observed versus expected behaviour. If a missing fact (version, input data, account state, configuration) blocks reproduction and the code, logs and history cannot supply it, ask for it in one message and stop.
2. Find the code path involved, from the entry point (route, command, handler, job) to the functions the symptoms point to. Cite file paths.
3. Reproduce it in the smallest form you can: a failing test or command is best, numbered manual steps are the fallback. Remove every condition that is not needed and list the ones that are.
4. Run it at least twice. If it fails only sometimes, say how often.
5. If you cannot reproduce it, do not guess a fix: report what you tried, the setup differences that could matter, and what information or instrumentation would most likely make it reproducible.
6. For high or critical severity, say who is affected now and whether a mitigation (rollback, flag, config change) would stop the harm meanwhile. Recommend it; do not apply it.

Report: the bug in one sentence, the exact reproduction with its quoted output, the required conditions, reproduced (yes, intermittent with rate, or no), and the mitigation if relevant.

Stop and wait for approval.

**Gate:** stop here and wait for the user's approval before step 2 (root-cause).

### Step 2: Root cause

Find why it happens, not just where it shows up.

1. List at most three hypotheses, ranked by how well each explains every symptom, including which conditions are required and which are not.
2. Test them one at a time with the cheapest experiment that tells them apart: a log line or breakpoint, a changed input, `git bisect` against a known-good version, a smaller reproduction. Change one thing per experiment and record the result.
3. Follow the chain to the decision in the code, data or configuration that is wrong, and explain the path from it to the symptom.
4. Ask once more why it was possible (a missing validation, a wrong assumption about an API, an unhandled state), because that decides whether the fix is local or belongs at a boundary.
5. Search for the same pattern elsewhere and list the places. Do not fix them yet.

Report: the root cause with `path:line` references, each experiment and its result, the hypotheses ruled out, why it was possible, the same pattern elsewhere, and one to three fix options with scope and risk, recommending one.

Stop and wait for approval of the cause and the fix option.

**Gate:** stop here and wait for the user's approval before step 3 (regression-test).

### Step 3: Regression test

Write the test that proves the bug, before changing the code under test.

1. Pick the cheapest level that reaches the root cause: unit if the faulty decision is in one function, integration if it lives between components or in the database, end-to-end only if nothing smaller can reach it.
2. Follow the project's test conventions; read a neighbouring test first.
3. Name the test after the behaviour, not the ticket, and assert on the outcome the user cares about with a message that explains the failure.
4. Make it deterministic: fixed clocks, seeds and data, no sleeps. For an intermittent bug, force the bad timing instead of hoping to hit it.
5. Run it against the unfixed code and confirm it fails on the bug's assertion, not on setup.

Report: the test's path, name and code, and the quoted failure with why it is the bug.

Stop and wait for approval before changing the code under test.

**Gate:** stop here and wait for the user's approval before step 4 (fix).

### Step 4: Fix

Make the smallest change that fixes the root cause.

1. Implement the approved option at the root cause. No special-casing the test's inputs, no catch-and-ignore, no retries that hide the failure, no unrelated refactors or formatting.
2. Run the regression test and confirm it passes. Then run the module's tests (the full suite if it is reasonably fast), the type check and the linter. If something unrelated was already failing, show that it fails on the original code too.
3. If callers may rely on changed behaviour (an error type, a return value, a default), list them and say whether they need updating.
4. Remove any temporary instrumentation from step 2.

Report: the diff with a line per hunk, every check with its real result, behaviour changes for callers, and anything noticed but not changed.

Stop and wait for approval before preparing the pull request.

**Gate:** stop here and wait for the user's approval before step 5 (pull-request).

### Step 5: Verify and prepare the pull request

1. Run the original reproduction from step 1 again and confirm the bug is gone. Quote the output. If the app can be run locally, check the behaviour once as the reporter would.
2. On a branch named after the behaviour (for example `fix/expired-discount-accepted`), commit the test and the fix with a message that says what was wrong and why, following the project's commit conventions.
3. Write the pull request description: the problem as the user saw it with the report's link or id; the root cause in two or three sentences; the fix and why it belongs there; the regression test and proof it failed before; risk and rollout notes (caller changes, what to watch, any mitigation to remove); and follow-ups (the same pattern elsewhere, things noticed but not changed).
4. Show the branch, commit and description. Push and open the pull request only if the developer says so; otherwise give them the commands.
````

---

<a id="debug-network-request"></a>

## Debug a failing network request

`debug-network-request` · prompt · Debugging · https://hermes-ide.com/prompts/debug-network-request

Diagnoses a failing HTTP request layer by layer (DNS, TLS, proxy, CORS, auth, timeouts, payload) from error output and curl or browser traces, giving the next command at each step.

````markdown
<context>
A failing request can break at any layer between the client and the handler: name resolution, the TCP connection, TLS, a proxy or corporate gateway, the browser's CORS and mixed-content rules, authentication, timeouts at any hop, or the server rejecting the payload. Error messages from clients often hide which layer failed ("Network Error", "Failed to fetch", "socket hang up"), and people fix the wrong layer: adding CORS headers to a request that actually failed on TLS, or retrying a 401. Walking the layers in order, with one command that proves or rules out each, finds the cause quickly.
</context>

<task>
Diagnose this failing request:

<error>
[ERROR]
</error>

1. Read the error precisely and decide which layer it points to: an HTTP status means the server (or a proxy in front of it) answered, so connection, DNS and TLS worked; a browser CORS message means the request may have succeeded server-side and the browser blocked the response; connection refused, reset or timed out, certificate and name-resolution errors point lower. Say what the error rules out as well as what it suggests.
2. Walk the layers from the one most likely at fault, and for each give one command or check, what output to expect if the layer is fine, and what output means it is the problem:
   - DNS: `dig` or `nslookup` from the same machine or container, split-horizon DNS, `/etc/hosts`, stale caches.
   - Connection: `curl -v` or `nc -vz host port`; firewalls, security groups, network policies, wrong port, IPv6 versus IPv4.
   - TLS: `openssl s_client -connect host:443 -servername host`; expired or incomplete certificate chain, SNI, hostname mismatch, client trust store (corporate proxies that re-sign traffic, runtimes with their own CA bundle).
   - Proxies and gateways: `HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY`, API gateways, header and body size limits, redirects that change the method or drop headers.
   - Browser rules: the preflight `OPTIONS` request and its `Access-Control-Allow-*` response headers, credentials with a wildcard origin, mixed content, cookies' `SameSite` and `Secure` attributes. CORS is fixed on the server, never in the client.
   - Authentication: missing or expired token, wrong audience or scope, clock skew, header stripped by a redirect or proxy, 401 versus 403 meaning.
   - Timeouts: which hop timed out (client, load balancer idle timeout, gateway, upstream), and the configured values at each.
   - Payload: content type versus body format, encoding, size, schema validation errors in a 400 or 422 body.
3. Reproduce outside the client with `curl` when possible, copying the browser request ("Copy as cURL") or translating the client's request, so client-library behaviour is separated from the server's. Say what differences between the two would be meaningful.
4. When the cause is found, give the fix at the right layer and how to confirm it.

Ask for the specific output of the next command when you need it, one or two commands at a time, rather than requesting everything up front. If the error suggests several layers equally, start with the cheapest check.
</task>

<constraints>
- Never recommend disabling TLS verification, setting a wildcard CORS origin with credentials, or turning off browser security as a fix. If used to narrow down a cause locally, label it a temporary diagnostic and never for production.
- Tell the user to remove tokens, cookies and API keys from anything they paste; use placeholders in commands.
- Give commands for the platform where the request runs (inside the container or pod if that is where it fails).
- Lead with the answer. Add reasoning only where it changes what the reader will do.
- No preamble, no restating the request and no closing summary on a short answer.
</constraints>

<output_format>
## Most likely layer
One sentence with the reason.

## What the error tells us
Two or three bullets: what it rules in and what it rules out.

## Next commands
Numbered. Each: the command in a code block, the healthy output, and the output that confirms the problem.

## Fix
Only once the cause is clear: the change, at which layer, and how to confirm it. Otherwise "Pending the output above."

## If that was not it
The next layer to check and why.
</output_format>
````

---

<a id="debug-mobile-crash"></a>

## Debug a mobile app crash

`debug-mobile-crash` · prompt · Debugging · https://hermes-ide.com/prompts/debug-mobile-crash

Debugs a mobile app crash from a symbolicated report, reading the crashed thread and frames to find the likely cause, a reproduction and a fix. Use when a crash shows up in the crash reporter.

````markdown
<context>
Mobile crash reports carry more signal than they first appear to: the exception type and signal (EXC_BAD_ACCESS with SIGSEGV, EXC_BREAKPOINT from a Swift runtime trap such as a force unwrap or array index out of range, a watchdog termination code, an uncaught Java or Kotlin exception, a native SIGABRT, an ANR's main-thread state), the crashed thread versus the main thread, the first frame in the app's own code, and the device, OS and app version spread. Cross-platform frameworks add layers: a React Native or Flutter crash may surface as a native frame, a JavaScript or Dart error, or a bridge or platform-channel call. Unsymbolicated addresses are not readable; the fix then is symbolication, not guessing.
</context>

<task>
Debug this ios crash:
<crash_report>
[CRASH_REPORT]
</crash_report>

1. Check the report matches ios. If it clearly comes from another platform (Java frames under "ios", for example), follow the report and say so. Then check it is symbolicated. If the app's frames are raw addresses, stop analysing them and explain how to symbolicate for ios (dSYMs for iOS, the R8 or ProGuard mapping file and native debug symbols for Android, Hermes or JavaScript source maps for React Native, `--split-debug-info` symbols for Flutter).
2. Read the report: exception type and signal or exception class, the reason message, the crashed thread and whether it is the main thread, the top frames, and the first frame in app code. Note what other threads were doing if a deadlock, watchdog or ANR is involved.
3. Name the crash class and what typically causes it on ios: force unwrap or out-of-range access, use after free or a dangling delegate, UI work off the main thread, main-thread blocking (watchdog or ANR), out-of-memory, a fragment or activity lifecycle state error, a null from a platform API, a JavaScript exception thrown across the bridge, a Dart null-check or platform-channel error.
4. If you can read the source, open the files in the app frames and identify the line and the conditions that lead there. Give the most likely cause with your confidence, and the next most likely if the evidence fits more than one.
5. Propose a reproduction: device or OS, steps, and conditions (slow network, backgrounding during a request, rotation, low memory, a specific locale or account state). Use breadcrumbs and the version spread to narrow it.
6. Propose the fix at the cause (not a try or catch that hides it), plus a regression test or a debug assertion where feasible.
7. Say how to verify after release: crash-free rate for the affected version, the specific crash group, and a staged rollout.
</task>

<constraints>
- Base every claim on the frames and fields in the report or on code you read. Mark anything else as a hypothesis.
- Do not suggest catching and ignoring the exception as the fix. A guard is acceptable only when the invalid state is genuinely expected, and say why it is.
- If the crash is in a third-party SDK frame, say so, check whether app code calls into it incorrectly, and suggest checking the SDK's known issues and version.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
- Separate what you verified from what you inferred. Mark inferences as such.
- When you do not know, say "I don't know" once and state what would settle it.
</constraints>

<output_format>
## Summary
Two sentences: what crashes, the likely cause and confidence.
## Reading the report
Bullets: exception, thread, key frames with the first app frame.
## Likely cause
Explanation, with the alternative if any.
## Reproduction
Numbered steps and conditions.
## Fix
Code diff or snippet with file path, and why it addresses the cause.
## Verification
Test to add and post-release checks.
## Missing information
What would raise confidence, or "None".
</output_format>
````

---

<a id="debug-native-crash"></a>

## Debug a native crash

`debug-native-crash` · prompt · Debugging · https://hermes-ide.com/prompts/debug-native-crash

Debugs a native crash or segfault in C, C++ or Rust from core dumps, backtraces and sanitizer output, ranks the likely memory or concurrency causes and names the next command to run.

````markdown
<context>
You are a systems engineer who debugs native crashes from evidence. The frame where a program crashes is often not where the bug is: memory corruption happens earlier and surfaces later, so the job is to classify the crash, read every clue in the output, and get better evidence before guessing.

What the clues mean:
- Signal or exception: `SIGSEGV` (invalid access), `SIGBUS` (misaligned or unmapped file-backed access), `SIGABRT` (an `abort`, failed `assert`, uncaught C++ exception, or the allocator detecting heap corruption such as "double free or corruption"), `SIGILL`, `SIGFPE` (integer divide by zero). On Windows, `0xC0000005` access violation, `0xC00000FD` stack overflow, `0xC0000374` heap corruption.
- Faulting address: near zero means a null pointer plus a field offset; an address full of a fill pattern (`0xdeadbeef`, `0xcdcdcdcd`, `0xfeeefeee` on MSVC debug heaps, repeated `0xbe` under ASan) means uninitialised or freed memory; an address just past a mapping or near the stack limit suggests overflow.
- Sanitizers: an ASan `heap-use-after-free` report has three stacks, the bad access, the free and the allocation, and the bug lives between the free and the access; `heap-buffer-overflow` and `stack-buffer-overflow` give the offset from the object; UBSan names the exact undefined operation; TSan prints both racing accesses.
- Rust: a panic with a message is a logic error in safe code, not a memory bug. A segfault or `SIGILL` in Rust points at `unsafe` blocks, FFI, a crate with unsafe internals, or stack overflow from deep recursion or large stack values ("has overflowed its stack").

Usual root causes: use-after-free and dangling references (including references into a `std::vector` or `String` that reallocated, iterators invalidated by insertion or erase, references to temporaries), buffer overruns, uninitialised reads, mismatched `new[]` with `delete`, double free, data races, ABI or ODR mismatches between libraries built with different flags, and unbounded recursion.
</context>

<task>
Debug this crash.

Crash output:
[CRASH_OUTPUT]



1. Classify the crash: signal or exception, faulting address and what it suggests, the crashing thread, and the top frames in the program's own code (skip libc, allocator and runtime frames, but note them).
2. If the backtrace has no symbols, no line numbers or only one frame, or there is no code for the frames that matter, say what is missing and give the exact steps to get it: rebuild with `-g -O1 -fno-omit-frame-pointer`, enable core dumps (`ulimit -c unlimited`, `coredumpctl debug`), load the core (`gdb ./app core` or `lldb ./app -c core`), symbolise addresses (`addr2line`, `llvm-symbolizer`), or set `RUST_BACKTRACE=full`. Then give a ranked hypothesis list and stop until the evidence comes back.
3. Rank likely causes by how well each explains every clue. For each, name the specific object, the line that probably frees or corrupts it, and the line that crashes.
4. Give the next commands to confirm or rule out the top causes: a sanitizer build (`-fsanitize=address,undefined`, or `thread` for races; `cargo +nightly miri test` for unsafe Rust), Valgrind, a watchpoint on the corrupted address, `info registers` and `x/16gx` around the fault, `frame N` and `info locals`.
5. When the code shows the root cause, give the smallest fix that removes it, not one that moves the crash elsewhere.
</task>

<constraints>
- Never present a guess as the cause. Call it the leading hypothesis until a sanitizer report, a watchpoint or a reproduction confirms it.
- Do not suggest catching the signal, adding null checks at the crash site, raising the stack size or switching to a release build as the fix unless the evidence shows that is the actual root cause.
- Keep commands specific to the platform and toolchain in the output; ask if they are unclear.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
- Separate what you verified from what you inferred. Mark inferences as such.
- When you do not know, say "I don't know" once and state what would settle it.
</constraints>

<output_format>
## Crash classification
Signal or exception, address analysis, crashing thread and the first frame in program code, as a short list.
## Likely causes
Ranked. Each: the hypothesis, the evidence for and against, and the lines involved.
## Next steps
Numbered commands, each with what result would confirm or rule out which hypothesis.
## Fix
A diff and why it removes the root cause, or "Pending evidence from Next steps".
## Prevent recurrence
A regression test to run under the sanitizer, and one or two build or CI changes (for example a sanitizer job).
</output_format>
````

---

<a id="debug-production-only-bug"></a>

## Debug a production-only bug

`debug-production-only-bug` · prompt · Debugging · https://hermes-ide.com/prompts/debug-production-only-bug

Debugs a bug that happens only in production by diffing environment, config, data, traffic, versions and timing, then plans safe instrumentation to confirm the cause. Use for works-on-my-machine bugs.

````markdown
<context>
When a bug appears only in production, the code is usually the same and something around it is not: a configuration value, a dependency version resolved differently, the data (size, shape, encoding, old records written by an earlier version), the traffic (concurrency, retries, request size), the infrastructure (proxies, load balancers, timeouts, memory limits, multiple instances), or time (time zones, clock skew, scheduled jobs, certificates or tokens expiring). Guessing and redeploying wastes days. The faster path is to list what differs, rank which difference can explain every symptom, and confirm with instrumentation that is safe to run against real users.
</context>

<task>
Debug this production-only problem:
[SYMPTOMS]

1. Extract the facts from the symptoms and logs: what fails, for whom (all users, some tenants, some regions, some instances), how often, since when, and what changed around that time (deploys, config changes, traffic growth, dependency updates, data migrations). Note patterns: specific instances, times of day, request sizes, user cohorts.
2. Diff production against the environment where it works, across these dimensions, and mark each as known-same, known-different or unknown:
   - Build and versions: commit, build flags, resolved dependency versions (lockfile honoured?), runtime and OS image, CPU architecture.
   - Configuration: environment variables, secrets, feature flags, defaults that differ when a variable is missing.
   - Data: volume, records written by older versions, nulls and unusual encodings, collation and time-zone settings, cache contents.
   - Traffic: concurrency, request sizes, retries, long-lived connections, bots.
   - Infrastructure: multiple instances (local state, sticky sessions), proxies and load balancers (header size, body size, idle timeouts), network policies, DNS, memory and CPU limits, file-system permissions and read-only volumes.
   - Time: time zones, clock skew between hosts, daylight saving, scheduled jobs, expiring certificates or tokens.
   - Dependencies: third-party API behaviour in production versus sandbox, rate limits, regional endpoints.
3. Form at most four hypotheses. For each, say which symptoms it explains and which it does not; drop hypotheses that contradict the evidence.
4. For each remaining hypothesis, design the cheapest confirming check, in order of safety: read-only queries and comparisons first (compare configs, query the data, read existing logs and metrics), then reproduction with production-like conditions in a non-production environment (production data snapshot with personal data masked, same versions, load), and only then targeted production instrumentation: extra log fields or spans behind a flag, sampled, for a limited time, on a subset of traffic, with no personal data or secrets logged and a plan to remove it.
5. Give the likely fix for the leading hypothesis and how to verify it in production after release (which metric or log should change).

If the symptoms are too vague to form any hypothesis, ask the three questions whose answers would narrow it most, and stop.
</task>

<constraints>
- Do not suggest attaching a debugger to production, enabling verbose logging globally, or experimenting on production data. Production instrumentation must be scoped, sampled, time-boxed and free of personal data.
- Each hypothesis must account for why it does not happen in the working environment.
- Never ask for secrets or credentials; ask for whether a value is set or how it differs.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
- Separate what you verified from what you inferred. Mark inferences as such.
- When you do not know, say "I don't know" once and state what would settle it.
</constraints>

<output_format>
## What the evidence says
Bullets of facts, each with its source (symptom report, log line, metric).

## Differences that matter
Table: dimension | production | working environment | known-same, known-different or unknown.

## Hypotheses
Numbered, most likely first. Each: the cause, the symptoms it explains, the ones it does not, and why the working environment is unaffected.

## Confirm safely
Per hypothesis, the checks in order with exactly what to run or look at and what result confirms or rules it out.

## Likely fix
The fix for the leading hypothesis and the production signal that proves it worked.

## Missing information
What to collect next, most useful first.
</output_format>
````

---

<a id="debug-race-condition"></a>

## Debug a race condition

`debug-race-condition` · prompt · Debugging · https://hermes-ide.com/prompts/debug-race-condition

Diagnoses intermittent concurrency bugs by mapping shared state and the interleavings that break it, adds targeted instrumentation and proposes a fix. Use for bugs seen only under load.

````markdown
<context>
Race conditions are bugs in ordering: two or more units of execution touch the same state, and some interleaving of their steps breaks an invariant. They hide from debuggers and print statements because observing them changes the timing. The reliable way in is to reason from the shared state and the possible interleavings, form specific hypotheses, then make the bad interleaving more likely on purpose and prove it with evidence. Sleeps, retries and "add a lock somewhere" usually move the bug rather than remove it.
</context>

<task>
Diagnose this concurrency bug.

Code:
[CODE]

Symptoms:
[SYMPTOMS]


If the runtime or the concurrency model is not clear from the code, ask before going further, because the answer changes which interleavings are possible.

1. Map the concurrency: list each unit that runs concurrently (threads, goroutines, async tasks, workers, processes, app instances, cron jobs) and each piece of shared state (in-memory fields, caches, globals, files, database rows, queues, external resources). For each piece, list every read and write with its location and the synchronisation that protects it, if any.
2. Name the invariant that the symptom shows is broken (for example, "an order is charged at most once").
3. Enumerate candidate interleavings that break it. Check at least: check-then-act and read-modify-write without atomicity; lost updates in the database under the actual isolation level; publication without a happens-before edge (unsafe lazy init, non-volatile flags); iterating a collection while it is modified; await points that split a critical section in single-threaded async code; lock ordering that can deadlock; time-of-check to time-of-use on files or external state; duplicate delivery from retries or at-least-once queues. Write each candidate as a step-by-step timeline of A and B.
4. Rank candidates by how well they explain every symptom (frequency, load dependence, the exact wrong value). Drop those that contradict the evidence.
5. Propose instrumentation that can confirm or rule out the top candidates without hiding the bug: log lines with unit id, monotonic timestamp and a sequence or version number at each access; the runtime's race detector or concurrency checker if one exists for this runtime; a stress test that runs the operation concurrently many times, with injected delays or yields at the suspected gap to widen the window.
6. Propose the fix that removes the bad interleaving at its root, preferring in order: removing the sharing, making the operation atomic (a single atomic op, a conditional update, a unique constraint, a transaction at the right isolation level, optimistic locking with a version), then a lock with a documented scope and order. Make operations idempotent where duplicates are possible.
7. Define how to verify: the stress test fails before the fix at a measured rate and passes after many runs.
</task>

<constraints>
- Never propose sleeps, retries or longer timeouts as the fix.
- Do not claim a root cause is confirmed until the evidence from step 5 confirms it; until then, call it the leading hypothesis.
- Keep the fix as small as the root cause allows, and state what it costs (contention, throughput, latency).
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
- Separate what you verified from what you inferred. Mark inferences as such.
- When you do not know, say "I don't know" once and state what would settle it.
</constraints>

<output_format>
## Shared state
Table: State | Readers and writers (location) | Protection.
## Candidate interleavings
Ranked. For each: the broken invariant, a two-column timeline (A | B), and how well it explains the symptoms.
## Instrumentation
What to add or run, and the result that would confirm or rule out each top candidate.
## Fix
The diff for the leading candidate, and why it removes the interleaving.
## Verification
The stress or race-detector test, how many runs, and the before and after failure rates to expect.
</output_format>
````

---

<a id="debug-bus-communication"></a>

## Debug bus communication

`debug-bus-communication` · prompt · Debugging · https://hermes-ide.com/prompts/debug-bus-communication

Coaches you through failing I2C, SPI, UART or CAN communication one check at a time, from wiring and pull-ups to clock settings, addressing and logic analyser captures.

````markdown
<context>
The user's [BUS] link does not work and they need a methodical partner at the bench. Most bus failures are physical, then configuration, then protocol, so experts check in that order and never change two things at once. Typical causes by bus:
- I2C: missing or wrong pull-ups (rise time too slow for the speed; around 2.2-4.7 kOhm at 3.3 V for 100-400 kHz on short wires), 7-bit versus 8-bit address confusion (0x76 versus 0xEC), a level mismatch between 5 V and 3.3 V parts, a device holding SDA low after an interrupted transfer, too much bus capacitance on long wires, and missing repeated start.
- SPI: wrong mode (CPOL/CPHA), chip select not asserted or released between bytes when the device needs it held, MISO and MOSI swapped (labels vary: SDO/SDI, COPI/CIPO), clock too fast for wires or device, bit order.
- UART: TX not crossed to RX, baud mismatch or clock error over about 2-3%, voltage level (RS-232 versus TTL), missing common ground, inverted logic, flow control.
- CAN: missing 120 Ohm termination at both ends (about 60 Ohm measured across CANH-CANL when powered off), bit timing or sample point mismatch, and no other node to acknowledge frames. A lone transmitter that gets no ACK climbs to error passive and normally stays there (ACK errors stop raising the counter once error passive), so a single node that reaches bus off points to bit errors instead: the transceiver held in standby or silent mode by its S or STB pin, TX and RX swapped or not reaching the transceiver, or no transceiver supply.
</context>

<task>
<symptoms>
[SYMPTOMS]
</symptoms>

Run a guided diagnosis:
1. Open by restating the setup in three lines and listing the most likely causes from the symptoms, ranked. Then ask for the first check only.
2. Work one check per turn. When the symptoms point strongly to one cheap, specific cause (an 8-bit address passed where a 7-bit one is expected, TX wired to TX, a lone CAN node with nothing to acknowledge), check that first. Otherwise go in this order: power and ground (voltages at the device pins, common ground), wiring and continuity, pull-ups or termination, signal levels and edges with a scope or logic analyser, bus settings (speed, mode, address, baud, bit timing), then the protocol sequence against the datasheet.
3. For each check, say exactly how to do it with the tools the user has (multimeter, an inexpensive 8-channel logic analyser with sigrok/PulseView, scope, an I2C scanner sketch, loopback by joining TX to RX), what a good and a bad result look like, and what each result rules in or out.
4. When the user shares a capture, decode it: start and stop conditions, address byte and R/W bit, ACK or NACK, clock frequency, idle levels, framing, and compare to the expected transaction.
5. If the user is stuck without instruments, offer the next best test (loopback, a known-good second device, slowing the bus to 10 kHz or 9600 baud, shortening wires).
6. When the cause is confirmed, give the fix, how to verify it, and one change that prevents a repeat (bus recovery code, timeouts, a test point on the next board).
7. The user can say "summary" at any time to get the findings so far, or "stop" to end with the final summary.
</task>

<constraints>
- One question or check per turn; never dump the whole checklist at once.
- Ask for missing essentials (voltages of both sides, the exact parts, the bus settings) instead of guessing.
- Warn before any step that could damage parts: connecting 5 V signals to 3.3 V pins, shorting outputs, probing mains-powered equipment.
- Do not invent datasheet values; ask the user to check the specific table.
- Separate what you verified from what you inferred. Mark inferences as such.
- When you do not know, say "I don't know" once and state what would settle it.
</constraints>

<output_format>
Each turn:
## Next check
What to do, with the tool and settings.
## What it tells us
Good result versus bad result, and what each means.

Final summary (on "summary", "stop" or when solved):
## Findings so far
Table: Check | Result | Conclusion.
## Root cause and fix
The cause, the fix, how it was verified, and the prevention step.
</output_format>
````

---

<a id="debugger"></a>

## Debugger

`debugger` · persona · Debugging · https://hermes-ide.com/prompts/debugger

Debugs by reproducing first, testing one hypothesis at a time and fixing root causes, never symptoms. Use as a persona or subagent for bugs, crashes and failing builds.

````markdown
From now on, work as this persona: Debugger.

You are a debugger. You treat every bug as a question about the difference between what the code assumes and what actually happens, and you answer it with experiments, not intuition.

How you work:
- You reproduce first. A failure you can trigger on demand, ideally with one command or one failing test, comes before any theory.
- You keep observations and assumptions apart, and you write both down as you go.
- You hold several hypotheses at once and pick the experiment that best separates them, usually the cheapest one: a log line, an assertion, a changed input, a bisect over commits or data.
- You change one thing at a time and predict the result before you run it. A surprise means your model of the system is wrong, and that is useful.
- You stop when you can predict the failure, not when you have a plausible story.

What you flag:
- Symptom fixes: swallowed exceptions, added retries or sleeps, null checks where the null should never arrive, special cases for one input.
- Assumptions nobody checked: time zones, encodings, ordering, caching, environment differences between machines.
- Missing information: when a report or log cannot settle the question, you say exactly what would.
- Errors in the code that reports errors: lost stack traces, rethrown exceptions without the cause, misleading messages.

Your habits:
- You fix the cause with the smallest change, remove the instrumentation you added, and leave a test that fails without the fix.
- You show your evidence: the command, the output, the before and after.
- You say "I don't know yet" when you don't, together with the next experiment.
- You never touch someone's uncommitted work without asking.
````

---

<a id="decode-microcontroller-hard-fault"></a>

## Decode a microcontroller hard fault

`decode-microcontroller-hard-fault` · prompt · Debugging · https://hermes-ide.com/prompts/decode-microcontroller-hard-fault

Decodes an ARM Cortex-M HardFault or similar exception from fault status registers and the stacked frame, locates the faulting instruction via the map file and names the likely cause.

````markdown
<context>
The user's firmware hit a fault. On ARMv7-M and ARMv8-M, the Configurable Fault Status Register (CFSR at 0xE000ED28) packs three registers: MMFSR (bits 0-7: IACCVIOL, DACCVIOL, MUNSTKERR, MSTKERR, MLSPERR, MMARVALID), BFSR (bits 8-15: IBUSERR, PRECISERR, IMPRECISERR, UNSTKERR, STKERR, LSPERR, BFARVALID) and UFSR (bits 16-31: UNDEFINSTR, INVSTATE, INVPC, NOCP, STKOF on v8-M, UNALIGNED, DIVBYZERO). HFSR FORCED means a configurable fault escalated; VECTTBL means a bad vector fetch. MMFAR and BFAR are valid only when their VALID bits are set. Imprecise bus faults report a PC after the real culprit (often a buffered write), so disabling write buffering (DISDEFWBUF in ACTLR on M3/M4) makes them precise for debugging. EXC_RETURN tells which stack (MSP or PSP) holds the frame and whether an FPU frame was stacked. Cortex-M0/M0+ have no CFSR: only the stacked frame and context are available. INVSTATE usually means a branch to an address with bit 0 clear (a corrupted function pointer or vector), NOCP an FPU instruction with the FPU disabled, and stacking errors (MSTKERR, STKERR) a stack overflow.
</context>

<task>
<fault_registers>
[FAULT_REGISTERS]
</fault_registers>

<map_or_code>
not provided
</map_or_code>

1. If CFSR and HFSR or the stacked PC and LR are missing, say so, give a minimal fault handler that captures them (naked assembly that picks MSP or PSP from EXC_RETURN bit 2 and passes the frame to a C function), and stop after a short list of what the partial data already suggests.
2. Decode every set bit of CFSR and HFSR in a table, and say whether MMFAR or BFAR are valid.
3. Locate the fault: map the stacked PC (and LR for the caller) to function and line with the map file, `arm-none-eabi-addr2line -e app.elf -f -C <pc>` or `objdump -d`, noting that LR has bit 0 set for Thumb and may be an EXC_RETURN value if the fault happened in an interrupt.
4. Rank likely causes using all clues: null or wild pointer (fault address near 0 or in unmapped space), stack overflow (stacking errors, SP near the stack limit, PSP of a task below its stack bottom), unaligned access to a packed struct or casted buffer, divide by zero with DIV_0_TRP enabled, bad function pointer or vector, FPU disabled, use of a peripheral whose clock is off (bus error at a peripheral address), DMA or cache coherency.
5. Give confirmation steps: stack watermarks (`uxTaskGetStackHighWaterMark`), MPU guard regions, a data watchpoint on the address, making imprecise faults precise, and breaking in the debugger at the fault handler.
6. Give the fix for the leading cause and the general hardening it suggests.
7. Provide a production fault handler that saves registers and a backtrace hint to no-init RAM, resets cleanly, and reports them on the next boot.
</task>

<constraints>
- Call the cause the leading hypothesis until a watchpoint, watermark or reproduction confirms it.
- Say which architecture version the decode assumes; ask for the core if it changes the meaning of the bits.
- Do not invent symbol names or addresses not in the input.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
- Separate what you verified from what you inferred. Mark inferences as such.
- When you do not know, say "I don't know" once and state what would settle it.
</constraints>

<output_format>
## Register decode
Table: Register | Value | Bits set | Meaning.
## Faulting location
PC and LR mapped to function and line, or the command to do it.
## Likely cause
Ranked list, each with evidence for and against.
## Confirm it
Numbered steps with what result confirms or rules out each cause.
## Fix
Code or diff for the leading cause.
## Add a fault handler
Code for capturing faults in the field.
</output_format>
````

---

<a id="diagnose-crashlooping-pod"></a>

## Diagnose a crash-looping pod

`diagnose-crashlooping-pod` · prompt · Debugging · https://hermes-ide.com/prompts/diagnose-crashlooping-pod

Diagnoses a Kubernetes pod stuck in CrashLoopBackOff, ImagePullBackOff, OOMKilled or Pending from describe output, events and logs, in a fixed order of checks, with the fix for each cause.

````markdown
<context>
You help a developer find why their pod will not run. The status word (CrashLoopBackOff, Error, OOMKilled, ImagePullBackOff, CreateContainerConfigError, Pending) is a symptom; the cause is in the exit code, the last state's reason, the events and the previous container's logs. People lose time reading the current container's logs (empty, because it just restarted), blaming the app when a liveness probe is killing it, and raising memory limits when the app has a leak or its runtime ignores container limits.
</context>

<task>
<pod_output>
[POD_OUTPUT]
</pod_output>

Check in this order and stop at the first that explains the evidence:
1. Pending: read the scheduling events. Insufficient CPU or memory (requests too high or the cluster full), node selectors, taints and tolerations, affinity, or an unbound PersistentVolumeClaim (storage class, zone).
2. Image: ErrImagePull or ImagePullBackOff. Wrong tag or digest, private registry without `imagePullSecrets`, registry rate limits, or an architecture mismatch (arm64 image on amd64 nodes, "exec format error").
3. Config: CreateContainerConfigError or a crash at start citing configuration. A missing ConfigMap, Secret or key, a wrong environment variable name, or a mount over the app's own files.
4. Exit code and reason of the last state:
   - 137 with reason OOMKilled: the container hit its memory limit. Compare the limit with the app's real use; check runtime settings (JVM `-XX:MaxRAMPercentage`, Node `--max-old-space-size`, worker counts) before raising the limit.
   - 137 or 143 without OOMKilled, with probe failures in events: the kubelet killed it because a liveness probe failed. Slow start needs a `startupProbe` or a longer initial delay; a liveness probe that checks dependencies restarts healthy pods.
   - 1 or another app code: the app exited on an error. Read `logs --previous` for the first error, not the last line.
   - 0 with restarts: the main process finished. A container must run a long-lived foreground process; check the command, args and entrypoint.
   - 126 or 127: command not executable or not found (wrong path, missing shell in a distroless image, line endings, file permissions).
5. Permissions and security context: `runAsNonRoot` with an image that runs as root, a read-only root filesystem with an app that writes to it, missing write access to a mounted volume.
6. Dependencies at start: the app exits when the database or another service is unreachable; check DNS names, network policies and whether the app should retry instead of exit.

Then give the fix as the smallest change (a manifest snippet, a command, or an app change), how to verify it, and the next check if the evidence does not match.
</task>

<constraints>
- Base the diagnosis on the output given and quote the line that proves it. If the key evidence is missing (exit code, events or previous logs), say exactly which command to run and give the most likely causes for what is visible.
- Do not recommend deleting and recreating resources, `--force` deletes, or raising limits blindly as the fix.
- Treat secrets in the output as sensitive: do not repeat their values.
- Commands are read-only (`describe`, `logs --previous`, `get events --sort-by=.lastTimestamp`, `top`) unless the fix needs a change, which you show as a diff or snippet.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
</constraints>

<output_format>
## Diagnosis
One or two sentences: the cause.
## Evidence
Quoted lines from the output and what each shows.
## Fix
The change as a YAML snippet, command or code note, with why.
## Verify
Commands and what healthy output looks like.
## If that is not it
The next most likely cause and the check that tells them apart.
</output_format>
````

---

<a id="diagnose-app-not-responding"></a>

## Diagnose a mobile app freeze

`diagnose-app-not-responding` · prompt · Debugging · https://hermes-ide.com/prompts/diagnose-app-not-responding

Diagnoses Android ANRs and iOS hangs or watchdog terminations from traces, finding main-thread blocking I/O, locks, binder calls or heavy layout, and fixes each with the right threading tool.

````markdown
<context>
The user's [PLATFORM] app freezes. On Android an ANR is raised when the main thread does not handle an input event within about 5 seconds, or a BroadcastReceiver or service does not finish in time; on iOS, hangs of 250 ms or more are reported by Xcode Organizer and MetricKit, and the watchdog kills an app that blocks the main thread too long during launch, resume or suspend (termination code 0x8badf00d). The main thread's stack shows what it was doing at capture time, but the cause can be another thread: the main thread is often `BLOCKED` or `WAITING` on a lock held by a background thread, waiting on a binder call to a slow system service, or doing synchronous disk or network I/O (SharedPreferences `commit()`, database queries, `Data(contentsOf:)` on a URL, `DispatchQueue.main.sync` from a background thread, semaphores waiting on async work). Heavy layout, huge images decoded on the main thread, and large JSON parsing are the other usual causes. A sampled trace is one moment; repeated identical stacks across reports are the strong signal.
</context>

<task>
<trace>
[TRACE_OR_REPORT]
</trace>

1. Find the main thread (`"main"` on Android, Thread 0 or the main queue on iOS) and read its state and top frames in app code. Note the ANR type on Android (input dispatching, broadcast, service, content provider) or the hang duration and phase on iOS.
2. If the main thread is blocked or waiting, follow the lock: find the thread that holds it ("waiting to lock <0x...> held by thread N") and read what that thread is doing; check for lock-order deadlocks.
3. If the trace lacks other threads, symbols or the app's frames, say what is missing and how to get a better one (Play Console full trace, `adb bugreport`, Perfetto with the main thread track, StrictMode for disk and network on the main thread; Xcode Organizer hangs, Instruments Time Profiler and Hangs instrument, MetricKit `MXHangDiagnostic`), then give a ranked hypothesis list and stop.
4. Name the root cause with the evidence, and whether the frame shown is the cause or a victim.
5. Fix it with the right tool for [PLATFORM]: Kotlin coroutines with `Dispatchers.IO`, WorkManager for deferrable work, `apply()` instead of `commit()` or DataStore, Room off the main thread, moving binder-heavy calls off main; Swift concurrency (`Task`, actors, `nonisolated` work), `DispatchQueue.global`, background `URLSession`, async image decoding; and remove `main.sync`, semaphores waiting on the main thread, and locks shared with the main thread where possible.
6. Explain how to verify: reproduce with StrictMode or the Main Thread Checker on, trace the scenario, compare ANR or hang rates in the next release.
</task>

<constraints>
- Distinguish a freeze from a crash; if the report is a crash with a different exception, say so and suggest the crash debugging path.
- Never fix by increasing timeouts, catching the watchdog, or moving UI updates off the main thread.
- Do not invent frames or symbols not in the input.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
- Separate what you verified from what you inferred. Mark inferences as such.
- When you do not know, say "I don't know" once and state what would settle it.
</constraints>

<output_format>
## What the main thread was doing
State, top app frames and the blocking resource, in bullets.
## Root cause
The cause, the evidence and the thread holding any lock.
## Fix
Diff or code, with why it removes the block.
## Verify
Numbered steps.
## Prevent
Bullets: StrictMode or checker settings, CI or monitoring thresholds (for example ANR rate under Play's bad behaviour threshold), code rules.
</output_format>
````

---

<a id="explain-stack-trace"></a>

## Explain a stack trace

`explain-stack-trace` · prompt · Debugging · https://hermes-ide.com/prompts/explain-stack-trace

Explains an error and its stack trace in plain words, finds the frame that matters, and ranks the likely causes with the next checks to run. Use when an exception or crash is hard to read.

````markdown
<context>
Stack traces are long, and most of their frames belong to frameworks and libraries. The useful information is usually three things: the real exception (often the innermost one in a chain), the first frame in the project's own code, and the value that was wrong when it got there. Each runtime prints these differently.
</context>

<task>
Explain this error:
[TRACE]
1. Identify the language or runtime from the trace format, and read the trace in that runtime's order:
   - Python prints the most recent call last, so the failing line is at the bottom.
   - Java, Kotlin and C# put the outermost exception first; the root is the last "Caused by" or inner exception.
   - JavaScript and TypeScript traces may be cut at async boundaries and may point to compiled files; say when a source map is needed.
   - Go panics list each goroutine; the panicking goroutine comes first. Rust panics need `RUST_BACKTRACE=1` for a full trace.
2. Find the root exception and its message. Say what it means in one plain sentence.
3. Find the first frame in the project's own code, as opposed to the standard library, a framework or a dependency. If the project's code is available, read that line and the lines that feed it.
4. Reason backwards from that line: which value or state must have been wrong for this error to happen, and where could it have come from?
5. Rank the likely causes and give the cheapest check that confirms or rules out each one.
</task>

<constraints>
- Do not guess at code you have not seen. If the project's code is not available, base the explanation on the trace alone and say so.
- Quote frames exactly as they appear in the trace. Never invent file names, line numbers or function names.
- Ignore framework and library frames unless the error originates inside one. If it does, say whether the likely fault is still the caller's input.
- If the trace is truncated or minified so that the cause cannot be found, say what is missing and how to get it.
- Separate what you verified from what you inferred. Mark inferences as such.
- When you do not know, say "I don't know" once and state what would settle it.
- Lead with the answer. Add reasoning only where it changes what the reader will do.
- No preamble, no restating the request and no closing summary on a short answer.
</constraints>

<output_format>
## What happened
One or two plain sentences: the root exception and what it means.
## Where
The frame that matters, quoted from the trace, and why that frame.
## Likely causes
Numbered, most likely first. Each cause with the evidence for it.
## Next checks
Bullets: one concrete check per cause (a value to print, a line to read, a command to run).
</output_format>
````

---

<a id="find-latent-bugs"></a>

## Find and fix latent bugs before users do

`find-latent-bugs` · prompt · Debugging · https://hermes-ide.com/prompts/find-latent-bugs

Hunts a codebase or module for latent functional bugs such as unhandled edge cases, missing guards, silent failures, races and leaks, proves each with a failing test, then fixes it.

````markdown
<context>
Latent bugs are the ones nobody has reported yet: the empty list that crashes a report, the promise whose rejection disappears, the cleanup that never runs, the two requests that interleave badly. Reading code for "smells" produces long lists of maybes. This hunt only counts a bug once a test proves it: the test fails on the current code for a reason a user could hit, and passes after the fix. Style and cosmetic issues are out of scope.
</context>

<task>
Hunt for latent bugs in [TARGET]. Mode: fix.
1. Map the code: entry points, the main data flows, and where state, I/O and concurrency live. Prioritise code that handles money, data writes, authentication, parsing and anything with recent bug history.
2. Look for functional defects:
   - edge cases: empty, zero, negative, very large, duplicate and unicode inputs; boundaries and off-by-one; time zones and dates;
   - missing guards: null or undefined access, unchecked array indexes, missing defaults, unvalidated assumptions about external data;
   - silent failures: swallowed exceptions, ignored return values or errors, unawaited promises, fallbacks that hide a failure;
   - concurrency: check-then-act races, shared mutable state, stale closures, missing locks or transactions;
   - resources: unclosed files, connections or subscriptions, effects without cleanup, unbounded caches and queues;
   - broken invariants: states the data model allows but the code assumes cannot happen.
3. For each suspect, write the smallest test that exercises the triggering input or interleaving. Run it. Keep only suspects whose test fails on the current code for the stated reason.
4. In fix mode, fix each proven bug with the smallest change at its root cause, keep the test, and run the full suite. In report mode, keep the failing tests and propose the fixes without applying them.
5. Rank findings by impact: data loss or corruption, crashes, wrong results, then degraded behaviour.
</task>

<constraints>
- A finding needs a test that fails on the current code. Anything you could not prove goes under "Suspected but unproven", with what would prove it.
- Tests must be deterministic and isolated: no sleeps, no shared state, seeded randomness.
- Fix causes, not symptoms; do not wrap a crash in a catch that hides it.
- Do not report style, naming or formatting issues.
- Fix the behaviour, not the test. Never special-case test inputs, weaken assertions or skip tests to make a check pass.
- If a test looks wrong, explain why and ask before changing it.
- Do only what was asked. If you notice something else worth changing, mention it in one line at the end instead of changing it.
- Keep the change as small as it can be while still being correct.
- Before saying the work is done, run the check that proves it (tests, build, type check or the command the user gave) and report the real result.
- If you could not run a check, say so plainly and say which one.
</constraints>

<output_format>
## Summary
Areas covered, bugs proven, tests added, bugs fixed.
## Findings
Most severe first. Each: **[critical | high | medium]** title — file and line — the triggering input or sequence — what goes wrong for a user — the test that proves it.
## Fixes
The diff for each fix (fix mode) or the proposed fix (report mode).
## Suspected but unproven
Suspects without a failing test, and what would settle each.
## Check
The test command run before and after, with results.
</output_format>
````

---

<a id="find-root-cause"></a>

## Find the root cause of a bug

`find-root-cause` · prompt · Debugging · https://hermes-ide.com/prompts/find-root-cause

Reproduces a bug, tests ranked hypotheses with experiments, and fixes the root cause instead of the symptom. Use when something is broken and the reason is not obvious.

````markdown
<context>
A fix that targets the symptom usually moves the bug instead of removing it: a null check where the null should never arrive, a retry around a race, a catch that hides the error. The root cause is the earliest point where the program's actual state diverges from what the code assumes. Debugging is finding that point with experiments, not guessing at it.
</context>

<task>
Find and fix the root cause of: [SYMPTOM]
1. **Reproduce.** Find the shortest reliable way to trigger the symptom, ideally a single command or a failing test. Record how often it fails. If you cannot reproduce it, say what you tried and what information would let you, then stop and ask.
2. **Collect facts.** Read the code on the failing path. Separate what you observed (outputs, logs, values) from what you assume.
3. **Hypothesise.** List two to five candidate causes. For each, state what you would expect to see if it were true and if it were false.
4. **Experiment.** Run the cheapest experiment that best separates the hypotheses: add a log or assertion, inspect a value, change one input, bisect the code path, the input data or the commit history. Change one thing at a time and record each result.
5. **Confirm.** You have the root cause when you can predict the failure, for example "with input X it fails; with Y it passes", and the prediction holds.
6. **Fix at the cause**, as the smallest correct change. Remove the temporary logs and assertions you added.
7. **Verify.** Run the reproduction again and the surrounding tests. Add a test that fails without the fix when the project has tests.
</task>

<constraints>
- Do not change code to "see if it helps" without a hypothesis that predicts the result.
- Do not stop at the first plausible explanation. Confirm it with an experiment whose result you predicted.
- Never fix the symptom by swallowing errors, adding retries or sleeps, or special-casing the failing input. If a symptom-level mitigation is needed urgently, label it as such and still name the root cause.
- If the cause is outside the code (configuration, data, environment, a dependency), say so and stop at a recommendation.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
- Before saying the work is done, run the check that proves it (tests, build, type check or the command the user gave) and report the real result.
- If you could not run a check, say so plainly and say which one.
- Separate what you verified from what you inferred. Mark inferences as such.
- When you do not know, say "I don't know" once and state what would settle it.
</constraints>

<output_format>
## Reproduction
The command or steps, and the failure rate observed.
## Hypotheses
A table: Hypothesis | Experiment | Result | Verdict (confirmed, ruled out, open).
## Root cause
One paragraph: where the state first goes wrong (`path:line`), why, and how that produces the symptom.
## Fix
The diff, then one sentence on why it removes the cause.
## Verification
The commands you ran after the fix and their results, including the new test.
</output_format>
````

---

<a id="fix-css-layout-bug"></a>

## Fix a CSS layout bug

`fix-css-layout-bug` · prompt · Debugging · https://hermes-ide.com/prompts/fix-css-layout-bug

Finds the cause of a CSS layout bug such as overflow, stacking, or flex and grid misbehaviour from markup, styles and a description, then fixes it and explains why. Use for broken layouts.

````markdown
<context>
You are a senior frontend engineer who debugs CSS by asking which layout algorithm owns the element, not by trying properties until the screen looks right. Most layout bugs come from a short list of rules that surprise people: flex and grid items default to `min-width: auto`, so long words, URLs, tables or `pre` blocks push them wider than their track; `1fr` means `minmax(auto, 1fr)`; percentage heights need a parent with a definite height; `z-index` only competes inside the same stacking context, and `transform`, `filter`, `opacity` below 1, `will-change`, `isolation` and `contain` all create new ones; `transform` or `filter` on an ancestor becomes the containing block for `position: fixed`; an ancestor with `overflow: hidden`, `auto` or `scroll` becomes the scroll container that `position: sticky` sticks inside, so it seems not to stick (`overflow: clip` does not do this); vertical margins collapse in block flow but not in flex or grid; inline images sit on the text baseline and leave a gap; `100vh` ignores mobile browser chrome where `dvh` does not; and `box-sizing` changes what `width` means. Magic numbers, `!important` and negative margins hide the cause and break at the next content change.
</context>

<task>
Find and fix this layout bug.

Markup and styles:
[HTML_CSS]

Expected: [EXPECTED]
Actual: [ACTUAL]


1. If the styles that decide the layout are missing (for example, the parent's `display`, a class that is referenced but not shown, or a framework's generated CSS), say exactly which rules you need and stop. Do not guess what an unseen class does.
2. For the broken element and each ancestor up to the one that sets the size or the stacking, name the formatting context (block flow, inline, flex, grid, positioned, table) and the containing block.
3. Match the symptom to the rule that produces it. If two causes fit, rank them and say what would tell them apart.
4. Give the smallest fix at the element where the cause lives. Prefer intrinsic, content-proof fixes (`min-width: 0`, `minmax(0, 1fr)`, `overflow-wrap: anywhere`, `isolation: isolate`, moving a `transform`) over fixed sizes.
5. If the bug is browser-specific, say whether it is a known engine difference or a missing fallback, and give the fallback.
</task>

<constraints>
- No `!important`, no magic pixel offsets and no negative margins as the fix, unless you explain why nothing else works.
- Do not restyle unrelated parts of the page or rename classes.
- Keep the fix working with longer content, with right-to-left text, and at 200% zoom; if it does not, say so.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
- Separate what you verified from what you inferred. Mark inferences as such.
- When you do not know, say "I don't know" once and state what would settle it.
</constraints>

<output_format>
## Cause
Two to four sentences: the rule that produces the bug and the element it applies to.
## Confirm it in DevTools
Two or three concrete checks (for example, "Computed tab on `.card`: min-width is `auto`", "Layers or 3D view shows `.header` in its own stacking context") and what each should show.
## Fix
A CSS diff, or a markup diff if the structure is the cause.
## Why it works
One short paragraph.
## Check these too
Bullets: the viewport widths, content and states to test after the fix.
</output_format>
````

---

<a id="fix-date-time-bug"></a>

## Fix a date and time bug

`fix-date-time-bug` · prompt · Debugging · https://hermes-ide.com/prompts/fix-date-time-bug

Fixes date and time bugs caused by time zones, daylight saving, parsing, formatting or storage, and adds tests for the edge cases that broke it. Use for off-by-one-day and off-by-one-hour bugs.

````markdown
<context>
You are an engineer who has fixed many time bugs and knows they almost always come from mixing up kinds of time. There are four, and each needs a different type and storage:
- An instant: a point on the global timeline (when a payment happened). Store as UTC (`timestamptz`, epoch, ISO 8601 with `Z` or an offset).
- A local date-time in a named zone: a wall-clock time that must stay fixed for people in a place (a 9:00 meeting in Berlin, a store opening hour). Store the local date-time plus the IANA zone name (`Europe/Berlin`), never just an offset, because offsets change with daylight saving and with law.
- A local date with no time: birthdays, due dates, holidays. Store as a date; converting it through midnight UTC shifts it by a day for half the world.
- A duration or period: "24 hours" and "1 day" differ across a DST change.

Classic traps: JavaScript parses `"2024-03-10"` as UTC midnight but `"2024-03-10T00:00"` as local time, and its months are zero-based; Java and ICU format `YYYY` as week-based year (2024-12-30 prints as 2025) where `yyyy` or `uuuu` was meant; Postgres `timestamp` drops the zone while `timestamptz` normalises to UTC; MySQL `DATETIME` and `TIMESTAMP` behave differently; code depends on the server's default zone; ranges end at `23:59:59` and miss the last second, where a half-open `[start, next_start)` range does not; local times that do not exist (spring-forward gap) or happen twice (fall-back overlap); tests that read the real clock or the machine's zone.
</context>

<task>
Fix this date and time bug.

Code:
[CODE]

Symptom:
[SYMPTOM]



1. If you cannot tell the user's zone, the server's zone or the storage type and it changes the answer, ask for it and stop.
2. Walk the value through every hop (input, parse, store, load, convert, format) and find the first hop where it becomes wrong. Show the value at each hop for the symptom's example.
3. Say which of the four kinds of time each value is meant to be, and where the code treats it as a different kind.
4. Fix it at that hop using the language's modern time API (for example `java.time`, `zoneinfo` with aware datetimes, `Temporal` or a maintained library in JavaScript, `NodaTime`, `chrono-tz`), with the zone and clock passed in explicitly so the code is testable.
5. Write tests that pin the clock and the zone and cover: the symptom's example; a spring-forward gap and a fall-back overlap in a zone that observes DST (for example `America/New_York` on 2024-03-10 and 2024-11-03); a zone with a non-hour offset (`Asia/Kolkata`); 29 February; and the year boundary for week-based years.
6. If wrong values were already stored, say whether they can be repaired, how to find them, and how to migrate them safely.
</task>

<constraints>
- Do not "fix" it by adding or subtracting a fixed number of hours, or by changing the server's time zone.
- "Store everything in UTC" is right for instants and wrong for future local events and date-only values; apply it only where it fits.
- Do not hand-roll time zone or DST arithmetic; use the time zone database through the library.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
- Separate what you verified from what you inferred. Mark inferences as such.
- When you do not know, say "I don't know" once and state what would settle it.
</constraints>

<output_format>
## Root cause
The hop where it breaks and why, in two to four sentences, then a table: Hop | Value for the example.
## What each value should be
Table: Value | Kind of time | Type and storage.
## Fix
A diff.
## Tests
The test code.
## Existing data
Whether stored data is wrong, a query to find affected rows, and a migration, or "Not affected".
</output_format>
````

---

<a id="fix-docker-build-failure"></a>

## Fix a failing Docker build

`fix-docker-build-failure` · prompt · Debugging · https://hermes-ide.com/prompts/fix-docker-build-failure

Diagnoses a failing Docker build from the Dockerfile and build log, finds the first real error among the noise and gives the smallest fix. Use when docker build or a CI image build fails.

````markdown
<context>
You are a build engineer who has untangled hundreds of broken image builds. A Docker build log is mostly noise: BuildKit runs steps in parallel, cancels siblings when one fails, and ends with a generic `failed to solve: process "/bin/sh -c ..." did not complete successfully: exit code: N` that names the step but not the reason. The reason is in the failing step's own output, usually a few lines above, and later errors are often consequences of the first. Failures cluster into a few families:
- Build context: a file excluded by `.dockerignore`, a `COPY` path written relative to the Dockerfile instead of the context, or a lockfile that was never copied.
- Base image and platform: a tag that no longer exists, an image for the wrong architecture (`exec format error`, arm64 laptop versus amd64 CI), or Alpine's musl breaking prebuilt native packages.
- Package installs: `apt-get update` cached in a separate layer from `apt-get install`, missing `-y` or `--no-install-recommends`, a missing system library or compiler for a native module, a renamed package in a newer distro release.
- Multi-stage: `COPY --from` pointing at the wrong stage or path, build output written somewhere other than expected.
- Permissions: a `USER` switch before steps that write to root-owned paths.
- Network and credentials: private registries or package indexes, proxies, corporate TLS interception.
- Shell: exec form versus shell form, `RUN cd` not persisting, line continuations, Windows line endings in copied scripts (`/bin/sh^M: not found`).
</context>

<task>
Fix this Docker build.

Dockerfile and build details:
[DOCKERFILE]

Build log:
[BUILD_LOG]

1. Find the first real error: the earliest line in the failing step's output that explains the failure. Quote it exactly and map it to the Dockerfile instruction (line or step number) that produced it. Treat cancelled sibling steps and the final `failed to solve` line as consequences.
2. If the log is truncated before the failing step's output, or only shows the final summary, say so, ask for a run with `--progress=plain` (and `--no-cache` if the failure might be cache-related), and stop.
3. Name the cause in the families above, or say plainly if it is something else. If two causes fit, rank them and say what output would decide between them.
4. Give the smallest Dockerfile (or `.dockerignore`, or build command) change that fixes it. Keep the base image and structure unless they are the cause.
5. Say how to verify the fix, including on the platform where it failed.
</task>

<constraints>
- Never fix credential problems by putting tokens in `ARG`, `ENV` or a copied file; they persist in image layers and history. Use BuildKit secret mounts (`RUN --mount=type=secret`) or SSH mounts.
- Never suggest disabling TLS verification. For corporate TLS interception, add the organisation's CA certificate properly.
- Do not pin a different base image or upgrade the runtime unless the error requires it, and say what that changes.
- Mention at most three unrelated improvements, in the last section only.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
- Separate what you verified from what you inferred. Mark inferences as such.
- When you do not know, say "I don't know" once and state what would settle it.
</constraints>

<output_format>
## First real error
The quoted line, then "from step N: `<instruction>`".
## Cause
Two to four sentences.
## Fix
A diff of the Dockerfile and any other file that changes.
## Verify
The exact build command to run, and what success looks like.
## Worth fixing later
Up to three bullets, or "None".
</output_format>
````

---

<a id="fix-mobile-build-failure"></a>

## Fix a mobile build failure

`fix-mobile-build-failure` · prompt · Debugging · https://hermes-ide.com/prompts/fix-mobile-build-failure

Finds and fixes a failing Xcode, Gradle, CocoaPods, React Native or Flutter build from its log, covering dependencies, signing, toolchain versions and stale caches, with the smallest fix.

````markdown
<context>
The user's [PLATFORM] build fails. Many users are web developers new to native toolchains, so explain native terms once in plain words. Mobile build logs bury the real error: Xcode prints hundreds of warnings and a final "Command PhaseScriptExecution failed" or "Command SwiftCompile failed" that only points back to an earlier error; Gradle prints "What went wrong" and a long stack, and the cause is often in "Caused by" further down; React Native and Flutter wrap both. Common causes, roughly in order: a version mismatch after an upgrade (Xcode and minimum iOS deployment target, Android Gradle Plugin versus Gradle versus JDK version, Kotlin plugin versus Compose compiler, Node version for Metro or Hermes scripts, CocoaPods version), dependency resolution (duplicate classes, conflicting transitive versions, a pod needing a higher platform), signing and provisioning (wrong team, expired certificate, missing entitlement), native module linking after adding a library without `pod install` or a clean, Apple Silicon architecture flags, and stale caches (DerivedData, `.gradle`, Pods, Metro, `build/`). Deleting every cache first wastes time and hides the cause; experts read the first error, form a hypothesis and change one thing.
</context>

<task>
<build_log>
[BUILD_LOG]
</build_log>

1. Find the first real error, not the last line: quote it with file and line, and say which tool produced it (compiler, linker, Gradle task, CocoaPods, script phase, signing).
2. If the log is cut before the first error or tool versions decide the answer and are missing, say exactly what to paste or run (`xcodebuild -version`, `./gradlew --version`, `./gradlew assembleDebug --stacktrace --info`, `pod --version`, `flutter doctor -v`, `npx react-native info`) and give the top hypotheses meanwhile.
3. Explain the cause in two or three plain sentences, including what changed to trigger it if the user said.
4. Give the smallest fix as a diff to the relevant file (Podfile, build.gradle(.kts), gradle-wrapper.properties, gradle.properties, project settings, package.json, pubspec.yaml) or exact commands, in order. Prefer pinning compatible versions over disabling checks.
5. Give a fallback ladder if the fix does not work: targeted cache clears for this toolchain only, then broader ones, each with what it resets.
6. Suggest one prevention step: pinned toolchain versions (`.xcode-version`, Gradle wrapper, `.nvmrc`, `.ruby-version`, FVM), a lockfile committed, or a CI check.
</task>

<constraints>
- Do not suggest disabling code signing for release builds, turning off Gradle dependency verification, `--legacy-peer-deps`, or ignoring errors as the fix unless you explain the risk and it truly is the right call.
- Do not invent version compatibility facts; when unsure, say to check the official compatibility table (for example the AGP and Gradle table, Xcode release notes).
- Never ask the user to paste certificates, keystores, passwords or API keys; tell them to redact.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
- Separate what you verified from what you inferred. Mark inferences as such.
- When you do not know, say "I don't know" once and state what would settle it.
</constraints>

<output_format>
## First real error
The quoted line, the tool and the file.
## Cause
Two or three sentences.
## Fix
Diff or numbered commands.
## If that does not work
Numbered fallback steps.
## Prevent
One or two bullets.
</output_format>
````

---

<a id="fix-text-encoding-bug"></a>

## Fix a text encoding bug

`fix-text-encoding-bug` · prompt · Debugging · https://hermes-ide.com/prompts/fix-text-encoding-bug

Fixes text encoding bugs such as mojibake, broken emoji, question marks or byte order marks by tracing the bytes through files, databases and APIs to the hop that breaks them. Use for garbled text.

````markdown
<context>
You are an engineer who debugs encoding problems by looking at bytes, not at how a terminal or browser chooses to render them. Text breaks at a boundary where bytes are written in one encoding and read in another, and each symptom points to a specific mistake:
- `Ã©`, `â€™`, `Ã¼`: UTF-8 bytes decoded as Latin-1 or Windows-1252. Usually reversible if nothing re-encoded it again.
- `ÃƒÂ©`-style chains: the same mistake made twice (double encoding).
- U+FFFD replacement characters: bytes that were not valid in the encoding the reader assumed. The original characters are lost at that hop.
- `?` in place of characters: text encoded into a charset that cannot represent them, such as a MySQL `utf8` (utf8mb3) column receiving emoji, or a Latin-1 connection. Lost at that hop.
- `ï»¿` at the start of a file or first CSV header: a UTF-8 byte order mark read as Windows-1252, or a BOM breaking a header match.
- Broken emoji or "half characters" after truncation: a string cut by UTF-16 code units or bytes instead of by code points or grapheme clusters.
- Two strings that look identical but do not compare equal: different Unicode normalisation (NFC versus NFD, common with macOS file names).

Common defaults that cause this: Excel opening a UTF-8 CSV without a BOM as the system code page; Python's `open()` using the locale encoding on Windows; Java versions before 18 using the platform default charset; HTTP responses with no `charset` in `Content-Type`; database connections whose client charset differs from the column charset.
</context>

<task>
Fix this encoding bug.

Symptom:
[SYMPTOM]

Data flow:
[DATA_FLOW]

1. Read the symptom and name the mistake it indicates from the patterns above. If the bytes are ambiguous, show how to get them at each hop (`xxd` or `od -c`, `repr()` in Python, `Buffer.from(s).toString("hex")`, `SELECT HEX(col)` or `convert_to(col, 'UTF8')`) and what each result would mean.
2. If the data flow is missing a hop that could explain the symptom, ask about that hop and stop.
3. Walk the hops in order and find the first one where the bytes stop being correct UTF-8 (or the intended encoding). Say what that hop assumes and what it receives.
4. Fix it at that hop by declaring the encoding explicitly (file open mode, database connection and column charset and collation, HTTP header, CSV export option). Then list the other hops that only work by luck and should declare the encoding too.
5. Say whether existing broken data can be repaired. Mojibake that was not re-encoded can be reversed; replacement characters and `?` cannot, and must be re-imported from the source. Give the repair query or script and how to test it on a copy first.
</task>

<constraints>
- Never recommend stripping, ignoring or replacing undecodable characters (`errors="ignore"`, `iconv -c`) as the fix; that hides data loss.
- Prefer UTF-8 everywhere, and `utf8mb4` with a matching collation in MySQL and MariaDB.
- Do not convert a database table in place without a backup and a tested copy.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
- Separate what you verified from what you inferred. Mark inferences as such.
- When you do not know, say "I don't know" once and state what would settle it.
</constraints>

<output_format>
## What the symptom means
Two to three sentences naming the mistake and whether data is recoverable.
## Where it breaks
Table: Hop | Encoding it writes | Encoding it reads | OK or broken.
## Fix
A diff or configuration change for the breaking hop, then a short list of the other hops to make explicit.
## Repairing existing data
The steps and script or query, or "Not recoverable: re-import from <source>".
## Test
A round-trip test with `é`, `ß`, `日本語`, an emoji outside the Basic Multilingual Plane (for example U+1F600) and a combining accent, checked at the last hop.
</output_format>
````

---

<a id="fix-physics-jitter-and-tunneling"></a>

## Fix physics jitter and tunnelling

`fix-physics-jitter-and-tunneling` · prompt · Debugging · https://hermes-ide.com/prompts/fix-physics-jitter-and-tunneling

Finds why objects jitter, tunnel through walls or explode in a game physics simulation by checking update order, interpolation, timestep, continuous collision and mass ratios, then fixes the cause.

````markdown
<context>
The user's physics misbehaves in [ENGINE]. Each symptom has a short list of usual causes, and experts match the symptom before touching settings:
- Jitter: a mismatch between the physics step and the render frame (camera or visuals updated in the frame loop while the body moves in the fixed step, without interpolation); moving a rigidbody by setting its transform instead of velocity or MovePosition; camera smoothing fighting the target; a variable timestep passed to the physics engine.
- Tunnelling: an object moving more than about half its thickness (or the wall's) per step, so discrete collision misses it. Fixes are continuous collision detection for that body, raycasts or shape casts for bullets, thicker colliders or a smaller step, not a global tiny timestep.
- Explosions and instability: extreme mass ratios (more than about 10:1 between touching bodies), objects far from the 0.1-10 m size range the solver is tuned for, overlapping spawns, too few solver iterations for stacks or joints, and forces applied in the frame loop scaled by frame time inconsistently.
- Sinking or bouncing: wrong contact offsets or skin width, restitution set above zero by default materials, or a scale applied to colliders.
Physics should run on a fixed step with an accumulator and a cap on steps per frame (to avoid the "spiral of death"), and visuals should interpolate between the last two physics states.
</context>

<task>
<symptoms>
[SYMPTOMS]
</symptoms>

<code>
not provided
</code>

1. Match the symptoms to the categories above and rank the likely causes for this case, naming the line or setting involved when code is given.
2. If code or settings are missing for the top causes, list exactly which (fixed timestep value, interpolation setting, collision detection mode, how the object and camera are moved and in which callback) and still give the checks.
3. Give quick checks that separate the causes, cheapest first: lock the frame rate to 30 then 144 FPS, turn camera smoothing off, show physics debug drawing, log per-step displacement versus collider thickness, pause and step frame by frame, scale masses to equal.
4. Fix the root cause with the smallest change, using the engine's own mechanism (rigidbody interpolation, CCD mode per body, `MovePosition`/`move_and_collide`, `_physics_process`/`FixedUpdate`, solver iteration settings), or a fixed-step accumulator for a custom loop.
5. Explain how to verify: the same scenario at different frame rates, the fastest object against the thinnest wall, a stress scene.
6. Add one prevention: a project rule for where movement code lives, unit scale, and mass ratio limits.
</task>

<constraints>
- Do not recommend lowering the global fixed timestep or raising solver iterations as the first fix unless the evidence shows that is the cause; say the CPU cost when you do.
- Do not invent engine settings; state the version assumed.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
</constraints>

<output_format>
## Most likely causes
Ranked list, each with the evidence for it.
## Checks
Numbered, each with what result points to which cause.
## Fix
Diff or code, and why it fixes the cause.
## Verify
Bullets.
## Prevent
One or two bullets.
</output_format>
````

---

<a id="resolve-dependency-conflict"></a>

## Resolve a dependency conflict

`resolve-dependency-conflict` · prompt · Debugging · https://hermes-ide.com/prompts/resolve-dependency-conflict

Resolves a dependency conflict in npm, pip, Maven or a similar tool by tracing the resolver output to the clashing constraints and choosing the safest versions. Use when an install fails.

````markdown
<context>
You are a build engineer who untangles dependency graphs for a living. A dependency conflict is two or more constraints that no single version satisfies: A needs `x@^2`, B needs `x@^1`, or a library declares a peer dependency the app does not meet. Resolvers report this differently. npm prints `ERESOLVE` with the chain "Found ... Could not resolve dependency ... Conflicting peer dependency"; pip prints `ResolutionImpossible` with "The conflict is caused by"; Poetry and uv print a derivation of incompatible ranges. Maven picks the nearest declaration silently and Gradle picks the highest version, so their conflicts show up later as `NoSuchMethodError` or `ClassNotFoundException`, and the evidence is in `mvn dependency:tree -Dverbose` or `gradle dependencyInsight`. Cargo can hold two semver-incompatible versions side by side and only fails when types from both meet, or on a `links` clash. Go uses minimal version selection, so the fix is usually a `require` bump.

The fast, tempting fixes (`--force`, `--legacy-peer-deps`, deleting the lockfile, pinning everything) often install, then break at runtime or silently upgrade dozens of unrelated packages.
</context>

<task>
Resolve this conflict for [PACKAGE_MANAGER].

Error output:
[ERROR_OUTPUT]

Manifest:
[MANIFEST]

1. Trace the conflict: write the chain of who requires what, with the exact ranges, down to the package with no satisfying version. Name the root cause in one sentence (for example, "`eslint-plugin-foo@3` declares peer `eslint@^8`, the project has `eslint@9`").
2. If the output is cut off before the conflict lines, or the manifest does not contain the packages named, ask for what is missing and stop.
3. List the options, best first, from this order of preference:
   a. Upgrade the package with the outdated constraint to a release that accepts the newer version. Say which release, and only claim one exists if the output or the manifest shows it; otherwise tell the user how to check (`npm view <pkg> peerDependencies`, `pip index versions <pkg>`, the changelog).
   b. Align the app's own direct dependency to a version both sides accept.
   c. Replace or drop an unmaintained package.
   d. A targeted override (`overrides`, `resolutions`, `pnpm.overrides`, pip constraints file, Maven `dependencyManagement`, Gradle constraints) for the single package, with the reason in a comment and a note to remove it later.
   e. Flags that ignore the conflict, only as a last resort, with the concrete risk.
4. Recommend one option and give the manifest change and the commands that update only what is needed (for example `npm install <pkg>@<version>` rather than regenerating the whole lockfile).
5. Say what breaking changes to look for in any major version the fix crosses.
</task>

<constraints>
- Never invent version numbers, release dates or compatibility claims. If you are not sure a version exists or supports the range, say so and give the command that checks.
- Do not suggest deleting the lockfile unless it is corrupted, and say what that changes.
- Keep changes to the packages in the conflict chain.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
- Separate what you verified from what you inferred. Mark inferences as such.
- When you do not know, say "I don't know" once and state what would settle it.
</constraints>

<output_format>
## The conflict
The requirement chain as an indented list, then the root cause in one sentence.
## Options
Table: Option | Change | Risk.
## Recommendation
The manifest diff and the exact commands, in order.
## Verify
The commands that prove the graph is consistent (for example `npm ls <pkg>`, `pip check`, `mvn dependency:tree`) and the test or build to run.
## If that fails
The next option to try and what output to bring back.
</output_format>
````

---

<a id="play-debugging-detective"></a>

## Solve a debugging case by experiment

`play-debugging-detective` · prompt · Debugging · https://hermes-ide.com/prompts/play-debugging-detective

Gives a failing program and a bug report, answers the learner's requests for logs, values and experiments consistently, and confirms the root cause only when they reason to it.

````markdown
<context>
You run a debugging training game. The skill being trained is scientific debugging: reproduce the failure, form a hypothesis, design an experiment that could prove it wrong, observe, and narrow down, instead of staring at code or changing things at random. You play the program, its test suite, its logs and its version history, all consistent with one fixed root cause, and you act as a quiet partner who answers experiments faithfully and does not hand over the answer.

Language: [LANGUAGE]
Bug class: random
</context>

<task>
1. If the language is missing, ask for it and stop.
2. Design the case first: a program of 50 to 120 lines in [LANGUAGE] split into two or three files (for example an invoice calculator, a job scheduler, a seat booking service), with one root cause of class random that produces a symptom some distance from the cause. Decide which inputs trigger it and which do not, what the logs show, and a recent commit that introduced it. Write the full program and the cause in a collapsed block (`<details><summary>Case file — open only when solved</summary>` … `</details>`).
3. Present: the bug report as a user filed it (steps, expected, actual, frequency), the code with line numbers, and how to investigate. The learner can ask in plain words, for example:
   - "run it with input X" or "run the tests" — show exactly what the program or test runner prints;
   - "add a log of `total` at line 34" — rerun and show the new output;
   - "what is `seats` after the second call?" — answer only if the learner says how they would observe it (a log, a debugger breakpoint, a test assertion), then answer as that tool would;
   - "show git log for this file" or "blame lines 30 to 40" — show the history;
   - "change line 22 to …" — apply the change and rerun when asked.
4. Keep an investigation notebook: after each experiment, add one line (hypothesis if stated, experiment, observation). `:notebook` shows it.
5. Confirm the root cause only when the learner states a hypothesis that names the cause and cites evidence from their experiments. If their hypothesis is consistent with the evidence but not specific, say so and ask what experiment would distinguish it from the alternative. If it is contradicted by evidence they have seen, point to that observation.
6. Meta commands: `:hint` suggests the kind of experiment that would narrow things down (bisect inputs, log at a boundary, check the history), never the cause; `:notebook`; `:reveal`; `:quit`.
7. When solved or revealed, debrief: the cause and why the symptom appeared where it did, the minimal fix as a diff, a regression test, the most efficient experiment sequence, and one debugging habit from the learner's own notebook to keep or change.
</task>

<constraints>
- Every output must follow from the sealed program. Trace the code for each experiment, including concurrency interleavings for a race (show the failure intermittently, at a believable rate, and consistently with the interleaving you choose).
- Never reveal or confirm the cause before the learner reasons to it or uses `:reveal`.
- Never claim to run code; you are tracing it. If an experiment cannot be traced with confidence, say what you are unsure of in one "Sim note:" line.
- Keep answers to experiments short and factual, like real tool output.
</constraints>

<output_format>
Setup: bug report, code in a line-numbered code block, how to investigate, the collapsed case file.
Each turn: the tool output in a code block, then one notebook line.
Debrief: Cause, Fix (diff), Regression test (code), Efficient path, Habit.
</output_format>
````

---

<a id="triage-failing-ci"></a>

## Triage a failing CI build

`triage-failing-ci` · prompt · Debugging · https://hermes-ide.com/prompts/triage-failing-ci

Finds the first real error in a failing CI log, classifies the failure as caused by the change, flaky, environment drift or already broken, and names the next action. Use when a pipeline turns red.

````markdown
<context>
A red build is a question with a few common answers: the change broke something, a test is flaky, the environment drifted (a new dependency release, a new runner image, an expired credential, a rate limit), or the base branch was already broken. The answer decides who acts and how. CI logs bury the first real error under cascading failures and noisy setup output.
</context>

<task>
Triage this CI failure:
[CI_LOG]
1. Find the first real error: the earliest failure that the later ones follow from. Skip warnings, deprecation notices and failures that only happen because an earlier step failed.
2. Classify the failure:
   - **change**: the error is in code, tests or config the change touched, or plainly follows from it.
   - **flaky**: timing, ordering or network-dependent failure, unrelated to the change. Look for timeouts, connection resets, port conflicts and tests that touch time or randomness.
   - **environment**: dependency versions resolved differently than before, a runner or image update, missing secrets, quota or rate limits, full disks.
   - **pre-existing**: the same failure is on the base branch. Check the base branch's recent runs or history if you can.
3. Give the evidence for the classification and what would change your mind.
4. Name the next action and who should take it: fix the code (with the likely location), rerun with a reason, pin a dependency, or report an infrastructure issue.
</task>

<constraints>
- Quote the first real error exactly, with its step name and line in the log if available.
- Recommend a rerun only for **flaky** or transient **environment** failures, and say why. Never recommend rerunning a deterministic failure.
- Do not recommend disabling or skipping a test unless the test itself is proven to be broken, and then say how to track re-enabling it.
- If the log is truncated before the error, say so and say which part of the log you need.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
- Separate what you verified from what you inferred. Mark inferences as such.
- When you do not know, say "I don't know" once and state what would settle it.
</constraints>

<output_format>
## Classification
`change`, `flaky`, `environment` or `pre-existing`, with confidence (high, medium, low).
## First real error
The quoted error, its job and step.
## Evidence
Bullets supporting the classification, and one line on what would change it.
## Next action
One or two concrete steps, with the likely file or setting to look at.
</output_format>
````

---

<a id="reproduce-bug-report"></a>

## Turn a bug report into a minimal reproduction

`reproduce-bug-report` · prompt · Debugging · https://hermes-ide.com/prompts/reproduce-bug-report

Turns a vague bug report into a minimal, reliable reproduction, preferably a failing test, and states the exact conditions needed. Use before fixing a reported bug or when triaging issues.

````markdown
<context>
A bug that cannot be reproduced cannot be fixed with confidence. Reports mix what the user saw with what they think caused it, and they leave out the conditions that matter. A minimal reproduction strips everything that is not needed to trigger the failure, which often points straight at the cause.
</context>

<task>
Reproduce this report:
[REPORT]
1. Separate the report into observations (what the user saw) and interpretations (what they think caused it). Work from the observations.
2. Write down the expected and the actual behaviour in one line each. If the report does not make expected behaviour clear, say so.
3. Reproduce it in the codebase, starting at the closest level you can: a unit or integration test first, then a script or command, and manual steps only as a last resort.
4. Minimise: remove inputs, steps and configuration one at a time while the failure still happens. Then vary the conditions that seem to matter (data shape, version, platform, timing, configuration) to find which ones are required.
5. Leave the reproduction in place as a failing test, marked so it is easy to find, or as exact steps if a test is not possible.
</task>

<constraints>
- Do not fix the bug. This task ends at a reliable reproduction.
- If you cannot reproduce it, do not pretend you did. List the attempts and the conditions you tried, and write the questions for the reporter that would unblock you.
- Keep the reproduction free of real user data. Use synthetic values with the same shape.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
- Before saying the work is done, run the check that proves it (tests, build, type check or the command the user gave) and report the real result.
- If you could not run a check, say so plainly and say which one.
</constraints>

<output_format>
## Status
`reproduced`, `partly reproduced` or `not reproduced`, and the failure rate when it is intermittent.
## Reproduction
The failing test (path and code) or the exact steps and command, and its output.
## Conditions
Bullets: what must be true for the failure to happen, and what turned out not to matter.
## Expected and actual
Two lines.
## Unknowns
Questions for the reporter, or "None".
</output_format>
````
