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.
npx agentmods add commands/upstash/redis-js/queryinggit clone --depth 1 https://github.com/upstash/redis-jsWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.01582 |
| Opus 5 | $0.00000 | $0.00791 |
| Sonnet 5 | $0.00000 | $0.00316 |
| Haiku 4.5 | $0.00000 | $0.00158 |
Grade A, and why
querying scanned grade A with 0 findings 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 2d 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.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 279 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Querying & Counting
Overview
Query documents from a search index using type-safe filters with support for pagination, sorting, field selection, scoring, and highlighting. Count matching documents efficiently without returning results.
Good For
- Full-text search with fuzzy matching and phrase queries
- Filtering by numeric ranges, dates, booleans, keywords
- Paginated results with sorting
- Highlighting search terms in results
- Counting documents matching a filter
Examples
Basic Query
import { Redis, s } from "@upstash/redis";
const redis = Redis.fromEnv();
const index = await redis.search.createIndex({
name: "products",
prefix: "product:",
dataType: "json",
schema: s.object({
name: s.string(),
price: s.number("F64"),
category: s.keyword(),
inStock: s.boolean(),
}),
});
// Insert data
await redis.json.set("product:1", "$", {
name: "Gaming Laptop",
price: 1299.99,
category: "electronics",
inStock: true,
});
await redis.json.set("product:2", "$", {
name: "Wireless Mouse",
price: 29.99,
category: "electronics",
inStock: true,
});
await redis.json.set("product:3", "$", {
name: "Laptop Stand",
price: 49.99,
category: "accessories",
inStock: false,
});
await index.waitIndexing();
// Query with filter and return data
const results = await index.query({
filter: { category: { $eq: "electronics" } },
select: { name: true, price: true },
});
// [
// { key: "product:1", score: ..., data: { name: "Gaming Laptop", price: 1299.99 } },
// { key: "product:2", score: ..., data: { name: "Wireless Mouse", price: 29.99 } },
// ]
Keys Only (No Data)
// Set select to {}
const keysOnly = await index.query({
filter: { inStock: { $eq: true } },
select: {},
});
// [{ key: "product:1", score: ... }, { key: "product:2", score: ... }]
Pagination
const page2 = await index.query({
filter: { category: { $eq: "electronics" } },
select: { name: true },
limit: 10,
offset: 10, // skip first 10 results
});
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.
- 2d ago First seen · 279 lines · 0 tokens per session scan A db7157cb40c2
querying is a command published in the GitHub repository upstash/redis-js (967 stars, last pushed 6d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,582 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other commands, from other repositories
gen-prisma-model
Add a new Prisma model to this codebase: $ARGUMENTS.
commit-all
Group all changes semantically and commit each group separately.
bucket-advance
Advances a cursor to fetch or process the next batch of documents.
schema
Interactive schema design — delegates to schema-designer agent.
d1-migration
Run D1 migration workflow — generate, inspect, apply.
symfony-migrations
Create and manage Doctrine migrations for database schema changes.