SSyncropel Docs

Debugging Syncropel

When something isn't working (the server doesn't respond, a task is stuck in the wrong status, a record didn't route), use these tools in this order.

When to use this guide

You're staring at output you don't understand. A spl status returned something wrong, a task is in a status you didn't expect, a record didn't trigger the routing rule you thought it would, or the instance isn't responding at all. Before you start grepping logs, work through these tools in order.

Four commands (spl doctor, spl debug replay, spl debug thread-diff, spl audit export) cover most problems. Each is read-only, so you can run them freely without making anything worse.

Order of operations

1. spl doctor            ─── is the instance even healthy?
        ↓
2. spl status / spl task list  ─── what's the current state?
        ↓
3. spl debug replay      ─── why is THIS task in THAT state?
        ↓
4. spl debug thread-diff ─── how does this thread differ from a known-good one?
        ↓
5. spl audit export      ─── what security-relevant events fired recently?
        ↓
6. tail ~/.syncro/logs/spl.log  ─── last resort: read raw instance output

Try steps 1-5 before the log. They tell you what is broken much faster than the log tells you what happened.

Step 1: spl doctor (is the instance healthy?)

If you don't know whether the problem is in the instance or your understanding of the instance, run spl doctor first. It runs 7 read-only checks and prints PASS/WARN/FAIL with a short reason for each:

spl doctor
spl doctor

  ✓ instance reachable          <version> on sqlite:///home/you/.syncro/hub.db
  ✓ pid file                  /home/you/.syncro/run/spl.pid → live spl serve (pid 264247)
  ✓ store has records         4690 records across 232 threads
  ✓ store path agreement      instance reports sqlite:///home/you/.syncro/hub.db
  ✓ intelligence              enabled, model=claude-haiku-4-5-20251001
  ✓ engine config thread      th_engine_config has 254 records
  ✓ expression cache          hit_rate=0.0% size=0/1024 avg_compile=0μs (cache cold — no CEL evaluated yet)

Exit code:

CodeMeaning
0All 7 checks PASS
1At least one WARN, no FAIL
2At least one FAIL

You can run it on a schedule: add spl doctor --json to your monitoring and alert on a non-zero exit code. The JSON output has one object per check with name, status and detail.

What each check means

instance reachable: GET /health returns 200. If this fails, the instance is not running OR not bound to localhost:9100 OR you're pointing SPL_SERVE_URL somewhere wrong.

pid file: ~/.syncro/run/spl.pid exists, points at a live process, and that process's /proc/<pid>/cmdline contains "spl serve". A WARN here means the instance is responding but the PID file is missing, so spl stop will not be able to find it. See recovering an orphaned instance.

store has records: the store is non-empty. A WARN means it's empty (fresh install or a just-deleted store). A FAIL means the store query itself errored.

store path agreement: the instance's reported store URL matches what the config file says it should be. A WARN here means either the instance was started with an explicit --store override, or two instances are running against different stores and you're talking to the wrong one.

intelligence: whether the built-in AI assistant is enabled, and which model it uses. Disabled is fine if you didn't set up an API key; if you did and this says disabled, your key isn't being read.

engine config thread: your settings thread (th_engine_config) has at least one record. A WARN means there is nothing to load, so your routing rules, status rules, permission rules and health checks are all empty.

expression cache: how well the expression cache is working. An empty cache is normal just after a restart. A WARN means the hit rate is under 50%, which may mean expressions are being recompiled each time.

When doctor catches something

If any check is non-PASS, the line tells you what to do. The PID file orphan case prints the exact recovery command. The store path mismatch tells you to check --store overrides. None of doctor's output is a dead end. Every WARN/FAIL has a next step.

Step 2: spl status and spl task list (what's the current state?)

If doctor was clean and you're still confused, look at the high-level state:

spl status                     # engine counters, store, intelligence, uptime
spl task list                  # full task table with status, priority, cost
spl trust                      # trust scores per (actor, domain)
spl namespace list             # registered namespaces

These are read-only summary commands. Together they tell you "the instance thinks the world looks like X". If X doesn't match what you expected, you've narrowed the problem to a single task, thread, or actor.

Step 3: spl debug replay (why is THIS task in THAT state?)

You found the problematic task. spl task show TASK-0042 says it's in status review, but you expected approved. Why?

Run replay against the task's thread:

spl debug replay TASK-0042
spl debug replay th_be084400f080b84313c90321ffda6eae8ffca3b51c05abc13ebbf7403a609f86

  CLOCK  ACT    ACTOR                               STATUS       BODY
      0  INTEND did:sync:user:alice             inbox        goal=Fix the auth bug
→     1  DO     did:sync:agent:dev                  active       topic=task_started
→     2  KNOW   did:sync:agent:dev                  review       fulfills=7a2936eccf...
      3  KNOW   did:sync:agent:dev                  review       fulfills=2bce18d4f3...

  Final status: review (4 records)

The arrow (→) marks records that changed the task's status. Reading this:

  • clock 0: the task was created and went to inbox (no arrow, because there was nothing before it).
  • clock 1: dev ran spl task start, and the task became active.
  • clock 2: dev reported it done, and the task became review.
  • clock 3: dev reported it done again. No change; it is still in review.

Now you can see why the task isn't approved: there is no KNOW record with a verdict from a different actor. The spl task done from dev moved the task to review, but no evaluator has approved it yet. The fix: have a distinct reviewer actor run spl task approve TASK-0042.

Replay against any thread, not just tasks

The first argument can be a task alias OR a literal thread ID. For other threads (for example th_engine_config, a decision thread or a dispatch thread) you see the same record-by-record trace. It helps you see why a routing rule fired or didn't, or what was decided about a particular AI proposal.

spl debug replay th_engine_config | head -10
spl debug replay $(spl thread list | grep decision | head -1 | awk '{print $1}')

Step 4: spl debug thread-diff (how does this differ from a known-good one?)

You have a task that's behaving differently from one you know works. Compare them structurally:

spl debug thread-diff TASK-0042 TASK-0035
spl debug thread-diff

  PROPERTY                  th_be084400f080b8431…    th_03f822528448c2a04…
  record count              4                         8
  participants              2                         3
  status                    review                    approved

  Act distribution:
    DO             1                         1
    INTEND         1                         1
    KNOW           2                         5

Right away you can see:

  • The good one has 3 participants vs 2. Likely the missing participant is the evaluator.
  • It has 5 KNOW records vs 2. The extra ones are usually verdicts.
  • Its status is approved; the other is review.

The differences point at the missing piece without you having to read both threads in full. Once you have a likely cause, go back to spl debug replay on each side to confirm.

Step 5: spl audit export (what security-relevant events fired recently?)

If the problem looks like access denial, permission, or governance ("I tried to do X and got 403" or "this rule isn't matching"), pull the audit export:

spl audit export --since 1h

This emits one JSON object per line for every security-relevant record in the last hour: system actions, approval decisions, dispatch outcomes and governance events. Each line carries a category tag so you can filter:

spl audit export --since 1h --categories decision
spl audit export --since 24h --categories dispatch | jq -r '.record.body.summary'
spl audit export --since 24h --actor did:sync:user:alice
spl audit export --since 24h --thread th_be084400...

The output is JSONL: each line is independent, suitable for piping to jq, ingest into Splunk/Elastic/Loki, or grep. See SIEM Integration for production pipeline recipes.

What audit export does not include

Permission denials on HTTP requests are written to the server log, not to the audit export. Find them with grep "PERMISSION DENIED" ~/.syncro/logs/spl.log.

Step 6: read the instance log

If steps 1-5 didn't find the issue, read the structured log:

tail -f ~/.syncro/logs/spl.log

The log is JSON-line format. The fields you'll care about most:

FieldMeaning
levelERROR, WARN, INFO, DEBUG, TRACE
targetThe part of the server that wrote the line
actorThe DID involved in the operation
threadThe thread ID being touched
recordRecord ID for ingest events

Useful filters:

# All permission denials
grep "PERMISSION DENIED" ~/.syncro/logs/spl.log

# Errors only
grep '"level":"ERROR"' ~/.syncro/logs/spl.log | tail -20

# Activity for a specific thread
grep "th_be084400" ~/.syncro/logs/spl.log

Common scenarios

"My task is stuck in review, why isn't it approved?"

spl debug replay <task-alias>

Look for a KNOW record with body.verdict = "accept" from an actor different from the one who claimed completion. If none exists, the task hasn't been evaluated yet. Syncropel requires the reviewer to be a different actor from the one who did the work.

"I created a CEL routing rule but it's not firing"

spl config list-rules                        # is your rule loaded?
spl expr check '<your-cel-expression>' --context routing   # does it compile?
spl expr eval '<your-cel-expression>' --context routing --record '<sample-record>'   # does it evaluate to true?
spl debug replay <thread-where-record-landed>  # which records ARE on that thread?

If the rule loads, compiles, evaluates true on a sample, but isn't firing on real records, check the instance log for reload_config: processing LEARN record to confirm the rule was reloaded after you added it.

"The instance won't start"

spl doctor                       # what's the current state?
tail -50 ~/.syncro/logs/spl.log  # what did the server last report?
ls -la ~/.syncro/run/            # is there a stale PID file?

Most start failures are: port already in use, stale PID file, or a corrupt database. The runbook covers each: see Instance lifecycle.

"I think permissions are denying my requests"

spl config list-permission-rules            # what rules are loaded?
spl config show                              # is enforcement enabled?
grep "PERMISSION DENIED" ~/.syncro/logs/spl.log | tail -20   # what got denied?
spl audit export --since 1h --categories decision                # approval decisions in the same window

If you've locked yourself out, see spl config permissions-unlock.

"I deleted the record store by accident"

Don't restart the server. Starting a fresh server overwrites your good startup backup. See Backup discipline. Restore from off-host first.

"A namespace claim is being rejected and I don't know why"

spl namespace list                    # what's actually in the registry?
spl namespace show <claimed-ns>       # walk the ancestor chain

The show output marks each ancestor with ✓ (Active) or ✗ (Archived/Deleted). If any ancestor is non-Active, the descendant is rejected. That is the narrowing rule.

What these tools don't cover

A few things still require reading the log:

  • How a trust score was reached. spl trust shows current scores, not the evidence behind them. Read the verdict records for the actor to see it.
  • Dispatch details. When a dispatch fails you see the failure on the task thread, but not timings, retries or tool calls. Find those in the server log.
  • Slow rules. spl doctor shows expression cache statistics, but per-rule timings are only in the log.

For everything else, the tools above are enough.

Reference

On this page