agentleFS
mo-cmykmo-cmyk/mazarbul/.claude/skills/inspect-db/SKILL.md

inspect-db

Skill2 starsChanged 35 days agoApache-2.0View on GitHub

Live data-layer diagnostics for Mazarbul. USE WHEN user asks "why is recall slow", "show me the event log", "is the graph corrupted", "what's in the vector index", or any question about the four-layer storage (event log + Kuzu + sqlite-vec + FTS). NOT FOR schema introspection of upcoming entity kinds (those live in JSON Schema source).

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If a recall is slow:

    line 71
  2. Very specific:

    Run the query with --explain on the CLI (when implemented).

    line 73
  3. Distinctive:

    Check that the kernel composer is filtering by scope (some scopes prune the candidate set drastically).

    line 76
  4. Very specific:

    SQLite locked: when maz mcp serve is running, use ?mode=ro URI or stop the daemon.

    line 87
  5. Very specific:

    Vector dimension mismatch: after switching embedding models, blow away vec.sqlite and re-index.

    line 89

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Live data-layer diagnostics

Mazarbul stores facts across four layers, all rooted at $MAZ_DATA_DIR:

  • events.sqlite, the append-only event log.
  • graph.kuzu, the property graph.
  • vec.sqlite, the sqlite-vec vector index.
  • fts.sqlite, the FTS5 full-text index.

This skill is for probing them live.

Triage tree

1. Event log

sqlite3 "$MAZ_DATA_DIR/events.sqlite" <<SQL
.headers on
.mode column
SELECT kind, source_connector, count(*) FROM events GROUP BY kind, source_connector ORDER BY 3 DESC LIMIT 20;
SQL

Watch for:

  • Unexpected supersede chains (one event with many supersededBy references).
  • Events lacking source_connector or confidence (provenance gaps).
  • Time clustering (a single connector flooding the log).

2. Vector index

sqlite3 "$MAZ_DATA_DIR/vec.sqlite" <<SQL
.headers on
SELECT count(*) AS embeddings, max(length(vec)) AS dim FROM embeddings;
SQL

Watch for:

  • Dimension drift (you changed embedding model mid-stream).
  • Counts diverging from the event log count (indexer is behind).

3. Full-text index

sqlite3 "$MAZ_DATA_DIR/fts.sqlite" "SELECT count(*) FROM fts;"

4. Graph

kuzu "$MAZ_DATA_DIR/graph.kuzu" <<CYPHER
MATCH (n) RETURN labels(n)[0] AS kind, count(*) AS n ORDER BY n DESC;
CYPHER

Watch for:

  • Orphan nodes (entities with no incoming or outgoing edges).
  • Edge counts wildly higher than node counts (over-relating).

Slow recall

If a recall is slow:

  1. Run the query with --explain on the CLI (when implemented).
  2. Confirm the vector index is up to date (count above).
  3. Confirm the FTS index is up to date (count above).
  4. Check that the kernel composer is filtering by scope (some scopes prune the candidate set drastically).
  5. Profile the recall path: mise run pprof:cpu against the running daemon.

Storage hygiene

  • VACUUM the SQLite files monthly: sqlite3 events.sqlite "VACUUM;".
  • Kuzu's storage layer reclaims space on rebuild only; maz kuzu compact (when implemented) handles this.
  • Backup is git-mediated for events.sqlite (CRDT sync). Other layers are derived and re-buildable.

Common gotchas

  • SQLite locked when maz mcp serve is running, use ?mode=ro URI or stop the daemon.
  • Kuzu requires a single writer, multiple kuzu CLIs at once will fail.
  • Vector dimension mismatch after switching embedding models, blow away vec.sqlite and re-index.

What this skill is NOT

  • Schema design for new entity kinds, see /new-resource for that.
  • Cloud-DB ops, Mazarbul is local-first.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.