notebook-query

notebook-query is a command for coding agents from MarcosNahuel/antigravity-plugin-cc. It costs 74 tokens per session (2,068 once invoked), scanned A, original, MIT.

A read-only question tool for a SQLite database built from a folder of documents. You can ask questions in everyday language or provide SQL, and answers include the source document for each result.

In plain words
What is it for?
Use it to find mentions, calculate totals, look up records, or build timelines from a document collection with citations.
Why use it?
It avoids manually searching many documents or writing database queries without knowing where the information came from. It also prevents accidental changes because the database is read-only.

Command

Part of the antigravity plugin — 2 skills, 22 commands, 1 agent shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/marcosnahuel/antigravity-plugin-cc/notebook-query
Clone the repo
git clone --depth 1 https://github.com/MarcosNahuel/antigravity-plugin-cc

Or install antigravity, the plugin that ships this one along with the rest of its 2 skills, 22 commands, 1 agent.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for notebook-query

README.md
[![agentmods](https://agentmods.dev/badge/commands/marcosnahuel/antigravity-plugin-cc/notebook-query.svg)](https://agentmods.dev/commands/marcosnahuel/antigravity-plugin-cc/notebook-query)
Your own site
<a href="https://agentmods.dev/commands/marcosnahuel/antigravity-plugin-cc/notebook-query"><img src="https://agentmods.dev/badge/commands/marcosnahuel/antigravity-plugin-cc/notebook-query.svg" alt="Measured on agentmods" height="20"></a>
Per session 74 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,068 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00074 $0.02068
Opus 5 $0.00037 $0.01034
Sonnet 5 $0.00015 $0.00414
Haiku 4.5 $0.00007 $0.00207

Measured 5d ago against content hash 2118065ad656, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

notebook-query scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

import urllib.request
plugins/antigravity/commands/notebook-query.md · 135 lines

How it starts

The opening of the file, as written. The whole thing — 135 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Run a precise, read-only query over the notebook.db that /agy:notebook compiled from a folder of documents. Every answer is grounded in the documents and cited (each row carries its source doc_ref / basename). There is no sqlite3 CLI on this machine — all DB access is Python.

Raw user request: $ARGUMENTS

Phase 0 — Resolve the DB (ONE Bash call)

Split $ARGUMENTS on the first |: left = folder (or its notebook slug), right = the question/SQL. Resolve OUTDIR = docs/agy/notebook/<slug> (same slug() rule the notebook uses: lowercase, non -alnum→-). Confirm notebook.db exists; if missing, tell the user to run /agy:notebook <folder> | <objetivo> first and stop. If the DB is older than the newest *.facts.json, rebuild it first: python "<plugin>/scripts/notebook_db.py" "$OUTDIR" "$OBJETIVO".

Phase 1 — Two query modes

A) Raw SQL — if the text after | starts with SELECT or WITH, run it verbatim.

B) Natural language — write a SELECT against the schema below (use the recetas as templates), then run it. Prefer the v_* views (they dedup + carry citations). For aggregates over money, sum monto_cents and divide by 100.0 only for display.

ALWAYS execute via this read-only Python heredoc (never a sqlite3 shell):

python - "$OUTDIR/notebook.db" "$SQL" <<'PY'
import sqlite3, sys, json
con = sqlite3.connect("file:%s?mode=ro" % sys.argv[1], uri=True); con.row_factory = sqlite3.Row
try:
    print(json.dumps([dict(r) for r in con.execute(sys.argv[2])], ensure_ascii=False, indent=2, default=str))
except Exception as e:
    print("SQL_ERROR: %s" % e)
PY

Phase 1b — Hybrid semantic retrieval (only if the DB was built with --semantic)

If meta has an embedder row (i.e. /agy:notebook … --semantic ran and sqlite-vec is installed), a fuzzy/conceptual question can use hybrid retrieval: FTS5 keyword ranking + vector KNN, fused with Reciprocal Rank Fusion (RRF, k=60). The vec0 KNN needs its LIMIT inside a CTE (not through a JOIN). Use this to FIND the relevant documents, then answer with the structured queries above.

Read the full file on GitHub · 135 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 135 lines · 74 tokens per session scan A 2118065ad656

Subscribe to this mod's changes

notebook-query is a command published in the GitHub repository MarcosNahuel/antigravity-plugin-cc (26 stars, last pushed 20d ago), licensed MIT. It adds 74 tokens to every session and 2,068 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.