memory-query

memory-query is a command for Claude Code from yeaight7/agent-powerups. It costs 25 tokens per session (511 once invoked), scanned A, original, Apache-2.0.

A command workflow for asking questions of an existing knowledge graph before reopening the original files. It supports broad lookups, connection tracing, and explanations of individual concepts.

In plain words
What is it for?
Use it to find related information, trace a path between files or systems, explain a concept in context, or check whether changed sources require an update.
Why use it?
It reduces unnecessary full-corpus rereading and warns when the stored graph is missing or may be out of date. It can also point out when the graph does not provide enough evidence.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the memory-optimization plugin — 6 skills, 3 commands, 2 agents shipped together

Good fit Use it to find related information, trace a path between files or systems, explain a concept in context, or check whether changed sources require an update.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/yeaight7/agent-powerups/memory-query
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.

Clone the repo
git clone --depth 1 https://github.com/yeaight7/agent-powerups

Made for: Claude Code.

Or install memory-optimization, the plugin that ships this one along with the rest of its 6 skills, 3 commands, 2 agents.

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 memory-query

README.md
[![agentmods](https://agentmods.dev/badge/commands/yeaight7/agent-powerups/memory-query/github.svg)](https://agentmods.dev/commands/yeaight7/agent-powerups/memory-query)
Your own site
<a href="https://agentmods.dev/commands/yeaight7/agent-powerups/memory-query"><img src="https://agentmods.dev/badge/commands/yeaight7/agent-powerups/memory-query/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for memory-query

Your own site · 80×15
<a href="https://agentmods.dev/commands/yeaight7/agent-powerups/memory-query"><img src="https://agentmods.dev/badge/commands/yeaight7/agent-powerups/memory-query.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 25 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 511 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00025 $0.00511
Opus 5 $0.00013 $0.00255
Sonnet 5 $0.00005 $0.00102
Haiku 4.5 $0.00003 $0.00051

Measured yesterday against content hash 5b77de75a23c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-15, from the pricing page.

Security

Grade A, and why

memory-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 yesterday.

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.

plugins/memory-optimization/commands/memory-query.md · 52 lines

What it actually says

Objective

Use graph-backed memory first. Query existing graph state before reopening source documents.

Context

Input: a user question, node name, or relationship target from $ARGUMENTS.

Expected state:

  • graphify-out/graph.json already exists for the target corpus
  • graphify is available for query, path, or explain flows

Process

  1. Check apx check graphify.
  2. Confirm graphify-out/graph.json exists before answering from graph memory.
  3. If graphify is missing, stop and report the missing requirement. If the graph file is missing, stop and route to memory-build.
  4. Route the request to one primary flow:
    • broad question, topic lookup, or "what do we know about X?" -> graphify query
    • relationship trace, dependency chain, or "how does X connect to Y?" -> graphify path
    • concept/node explanation or "explain X" -> graphify explain
  5. Check freshness before leaning on the answer:
    • if the corpus changed after the graph was built, say the graph may be stale
    • recommend memory-build or graphify --update before treating the answer as current
  6. If the graph answer is weak, partial, or clearly off-route, say so explicitly and recommend either refresh or targeted source reread.

Stop Conditions

  • graphify requirement check fails
  • graphify-out/graph.json does not exist
  • user is asking for current corpus state but the graph is known stale enough that the answer would mislead
  • query intent is ambiguous enough that query/path/explain routing would likely choose the wrong flow

Rules

  • prefer graph retrieval over corpus reread
  • do not hallucinate edges, nodes, or freshness
  • do not silently fall back to full-corpus reread unless the user asked for it or graph retrieval is unusable
  • if graph answer is weak, say so and recommend refresh or targeted source read
  • graphify query is default only for broad retrieval; use path and explain when the question shape is narrower
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. yesterday First seen · 52 lines · 25 tokens per session scan A 5b77de75a23c

Subscribe to this mod's changes

memory-query is a command published in the GitHub repository yeaight7/agent-powerups (6 stars, last pushed 2d ago), licensed Apache-2.0. It adds 25 tokens to every session and 511 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-14.