Logseq Debug Workflow
Use for any Logseq bug investigation.
Core rule
Treat this as a debugging workflow, not a code-only change.
Before claiming a fix, you must:
- Choose the correct runtime repl and say why:
:app for renderer, DOM, UI, frontend state
:electron for main-process, BrowserWindow, IPC, app config
:db-worker-node for worker DB behavior, worker IPC, queries, transactions
- CLI for
logseq command behavior
- Reproduce the bug in runtime REPL before editing code.
- Capture concrete evidence from that runtime: REPL output, CLI output, logs, or a failing test that matches the real runtime path.
- Check relevant logs early.
- Apply the smallest justified fix.
- Re-run the same reproduction flow after the fix and capture evidence again.
- Include restart/reload/reopen verification when the bug involves settings, startup, persistence, window creation, or cross-process behavior.
Do not conclude early
Do not say the bug is fixed if any of these is missing:
- pre-fix reproduction evidence
- relevant log evidence, or an explicit statement that checked logs had nothing useful
- post-fix evidence from the same runtime/path
- required end-to-end lifecycle verification
Unit tests alone are not enough when this skill applies, unless the bug is truly unit-level and you explicitly justify that.
If the environment blocks full verification, report:
- the blocker
- what you tried
- which evidence is still missing
- the strongest partial evidence you have
Debugging tools
General
- Add labeled
prn checkpoints when helpful.
- Use small REPL/eval checks.
- Use targeted tests to confirm behavior.
- Inspect only relevant inputs, branches, transformed values, outputs, and errors.
- For async flows, inspect both sides of the async boundary.
Logseq REPL
check logseq-repl skill.
When running under Codex, using the REPL is not enough for :app verification. Also use the chrome skill, open the :app target in the browser, and verify the behavior there.
Logs
Logs are evidence. Check them early for Electron, CLI, worker, IPC, async, or persistence issues.
Common locations:
tmp/desktop-app-repl/desktop-electron.log (logseq-repl skill)
tmp/logseq-repl/shared-shadow-watch.log (logseq-repl skill)
~/Library/Logs/Logseq/main.log
~/Library/Logs/Logseq/main.old.log
~/Library/Application Support/Logseq/configs.edn
- graph-local
db-worker-node-<timestamp>.log
Logseq CLI
Before using logseq, load logseq-cli skill.
Required final output
The final response must include these sections or an equivalent structure:
- Runtime chosen — which runtime REPL you used and why
- Pre-fix reproduction — reproduce bug in runtime REPL, exact steps and evidence
- Root cause — concrete cause and relevant files/flow
- Fix applied — short description of the change
- Post-fix verification — same steps again with new evidence
- Additional verification — tests/checks run, and what was not verified
- Gaps or blockers — any missing evidence and why
Quick checklist
Before ending, make sure the answer is yes to all:
- Did I reproduce the bug before fixing it?
- Did I show evidence, not just claim reproduction?
- Did I inspect relevant logs?
- Did I verify in the correct runtime?
- Did I rerun the same scenario after the fix?
- Did I include both before and after evidence in the final output?
- Did I avoid claiming completion if required evidence is missing?
Verification reminders
- Never run tests, lint, build, or E2E verification in the background.
- Check logs before trusting REPL/CLI output alone.
- For performance bugs, compare
--profile before/after on the same graph and command.
- For CLI bugs, reuse the same
--graph, --data-dir, and output mode.
- For REPL debugging, verify against the intended runtime, not a stale one.
Common checks: bb dev:test -v <namespace/testcase-name>, bb dev:lint-and-test, bb dev:cli-e2e.
1---2name: logseq-debug-workflow3description: Debug Logseq bugs with the right runtime, concrete before/after evidence, and end-to-end reproduction steps.4---56# Logseq Debug Workflow78Use for any Logseq bug investigation.910## Core rule1112Treat this as a debugging workflow, not a code-only change.1314Before claiming a fix, you must:15161. Choose the correct *runtime repl* and say why:17 - `:app` for renderer, DOM, UI, frontend state18 - `:electron` for main-process, BrowserWindow, IPC, app config19 - `:db-worker-node` for worker DB behavior, worker IPC, queries, transactions20 - CLI for `logseq` command behavior212. Reproduce the bug in *runtime REPL* before editing code.223. Capture concrete evidence from that runtime: REPL output, CLI output, logs, or a failing test that matches the real runtime path.234. Check relevant logs early.245. Apply the smallest justified fix.256. Re-run the same reproduction flow after the fix and capture evidence again.267. Include restart/reload/reopen verification when the bug involves settings, startup, persistence, window creation, or cross-process behavior.2728## Do not conclude early2930Do **not** say the bug is fixed if any of these is missing:3132- pre-fix reproduction evidence33- relevant log evidence, or an explicit statement that checked logs had nothing useful34- post-fix evidence from the same runtime/path35- required end-to-end lifecycle verification3637Unit tests alone are **not** enough when this skill applies, unless the bug is truly unit-level and you explicitly justify that.3839If the environment blocks full verification, report:4041- the blocker42- what you tried43- which evidence is still missing44- the strongest partial evidence you have4546## Debugging tools4748### General4950- Add labeled `prn` checkpoints when helpful.51- Use small REPL/eval checks.52- Use targeted tests to confirm behavior.53- Inspect only relevant inputs, branches, transformed values, outputs, and errors.54- For async flows, inspect both sides of the async boundary.5556### Logseq REPL5758check `logseq-repl` skill.5960When running under Codex, using the REPL is not enough for `:app` verification. Also use the `chrome` skill, open the `:app` target in the browser, and verify the behavior there.6162### Logs6364Logs are evidence. Check them early for Electron, CLI, worker, IPC, async, or persistence issues.6566Common locations:67- `tmp/desktop-app-repl/desktop-electron.log` (logseq-repl skill)68- `tmp/logseq-repl/shared-shadow-watch.log` (logseq-repl skill)69- `~/Library/Logs/Logseq/main.log`70- `~/Library/Logs/Logseq/main.old.log`71- `~/Library/Application Support/Logseq/configs.edn`72- graph-local `db-worker-node-<timestamp>.log`7374### Logseq CLI7576Before using `logseq`, load `logseq-cli` skill.7778## Required final output7980The final response must include these sections or an equivalent structure:81821. **Runtime chosen** — which *runtime REPL* you used and why832. **Pre-fix reproduction** — reproduce bug in *runtime REPL*, exact steps and evidence843. **Root cause** — concrete cause and relevant files/flow854. **Fix applied** — short description of the change865. **Post-fix verification** — same steps again with new evidence876. **Additional verification** — tests/checks run, and what was not verified887. **Gaps or blockers** — any missing evidence and why8990## Quick checklist9192Before ending, make sure the answer is yes to all:9394- Did I reproduce the bug before fixing it?95- Did I show evidence, not just claim reproduction?96- Did I inspect relevant logs?97- Did I verify in the correct runtime?98- Did I rerun the same scenario after the fix?99- Did I include both before and after evidence in the final output?100- Did I avoid claiming completion if required evidence is missing?101102## Verification reminders103104- Never run tests, lint, build, or E2E verification in the background.105- Check logs before trusting REPL/CLI output alone.106- For performance bugs, compare `--profile` before/after on the same graph and command.107- For CLI bugs, reuse the same `--graph`, `--data-dir`, and output mode.108- For REPL debugging, verify against the intended runtime, not a stale one.109110Common checks: `bb dev:test -v <namespace/testcase-name>`, `bb dev:lint-and-test`, `bb dev:cli-e2e`.