query

query is a command for coding agents from XBlueSky/cortexes. It costs 18 tokens per session (651 once invoked), scanned A, original, Apache-2.0.

Manually search the cortex vault (Notes, Projects, Raw) for existing notes.

Command

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/xbluesky/cortexes/query
Clone the repo
git clone --depth 1 https://github.com/XBlueSky/cortexes

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 query

README.md
[![agentmods](https://agentmods.dev/badge/commands/xbluesky/cortexes/query.svg)](https://agentmods.dev/commands/xbluesky/cortexes/query)
Your own site
<a href="https://agentmods.dev/commands/xbluesky/cortexes/query"><img src="https://agentmods.dev/badge/commands/xbluesky/cortexes/query.svg" alt="Measured on agentmods" height="20"></a>
Per session 18 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 651 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin unknown 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 $0.00018 $0.00651
Opus 5 $0.00009 $0.00326
Sonnet 5 $0.00004 $0.00130
Haiku 4.5 $0.00002 $0.00065

Measured today against content hash dfc273781483, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

query 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 today.

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.

commands/query.md · 56 lines

What it actually says

Invoke the cortexes:cortex-query skill and follow it for the actual search. Command frontmatter cannot load a skill for you, so invoke it explicitly with its fully qualified name via the Skill tool.

Argument handling:

  • With arguments → treat $ARGUMENTS as the search query verbatim. Do not reword or narrow it; the user's phrasing is the query.
  • No arguments → ask the user what to search for, then run the search with their answer. Do not guess a query from the conversation, and do not search the whole vault "to see what's there".

This command is user-invoked only (disable-model-invocation: true), so running it is the user's explicit request — using-cortex signal 1. Search even if the session earlier picked "直接開始工作" at SessionStart.

Follow the skill's layered strategy: cortex-vec search first (repo-scoped by default inside a git repo, overridable with "search all"), exact-match search as the supplement, and Raw/ only on request. Present results in the skill's response format, and read a full page only when the user picks one.

This command pre-approves only what the search itself runs — cortex-vec search, grep, and the two read-only git calls used to detect the repo — rather than shell access in general. Each entry is scoped to the subcommand: git remote get-url, not git remote, which would also cover add, remove, rename and set-url — write operations a read-only search has no business pre-approving. cortex-vec status is deliberately absent; the search flow never calls it. grep is on the list because the vault usually sits outside the session's working directory, where the Grep tool cannot reach.

Scoped Bash does not escape the workspace boundary the way a blanket Bash approval did. cortex-vec search is unaffected (it takes no path argument), so the normal path still works; only the grep fallback needs the vault to be inside the working directory or added with /add-dir <vault_path>. If that bites, say so explicitly rather than reporting an empty result.

If cortex-vec is not installed, say so and fall back to grep rather than failing. Semantic scoring needs OPENAI_API_KEY; without it cortex-vec degrades to its local BM25 index on its own, which is still a real search — report the degraded mode, don't call retrieval unavailable.

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. today First seen · 56 lines · 18 tokens per session scan A dfc273781483

Subscribe to this mod's changes

query is a command published in the GitHub repository XBlueSky/cortexes (20 stars, last pushed 3d ago), licensed Apache-2.0. It adds 18 tokens to every session and 651 once invoked, about $0.0001 per session on Opus 5. 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-09-04.