gather-context

gather-context is a command for Claude Code from Filip-Podstavec/claude-leverage. It costs 29 tokens per session (515 once invoked), scanned A, original, MIT.

A command that has a separate coding agent inspect the repository and collect relevant context before implementation begins.

In plain words
What is it for?
Use it before implementing a task when you need an overview of the current branch, recent changes, and likely files or code areas involved.
Why use it?
It reduces the need to manually search the codebase before starting a task. The main agent can use the collected context to guide the implementation.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions subagents.

Part of the claude-leverage plugin — 16 skills, 5 commands, 14 agents, 4 hooks shipped together

Good fit Use it before implementing a task when you need an overview of the current branch, recent changes, and likely files or code areas involved.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/filip-podstavec/claude-leverage/gather-context
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/Filip-Podstavec/claude-leverage

Made for: Claude Code.

Or install claude-leverage, the plugin that ships this one along with the rest of its 16 skills, 5 commands, 14 agents, 4 hooks.

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 gather-context

README.md
[![agentmods](https://agentmods.dev/badge/commands/filip-podstavec/claude-leverage/gather-context.svg)](https://agentmods.dev/commands/filip-podstavec/claude-leverage/gather-context)
Your own site
<a href="https://agentmods.dev/commands/filip-podstavec/claude-leverage/gather-context"><img src="https://agentmods.dev/badge/commands/filip-podstavec/claude-leverage/gather-context.svg" alt="Measured on agentmods" height="20"></a>
Per session 29 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 515 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.00029 $0.00515
Opus 5 $0.00015 $0.00258
Sonnet 5 $0.00006 $0.00103
Haiku 4.5 $0.00003 $0.00052

Measured 8d ago against content hash c200ecceac8f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

gather-context 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 8d 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.

bench/archive-token-savings-thesis/commands/gather-context.md · 42 lines

What it actually says

Context

Branch: !git branch --show-current Status: !git status --short Recent changes: !git diff --stat HEAD~1 2>/dev/null || echo "no previous commit"

Your role

You are orchestrating a context-gathering phase:

  • Phase 1: a Sonnet-based subagent explores the codebase and returns a structured context package.
  • Phase 2: you (the main session) use that context to implement the task.

You do NOT explore the codebase yourself. The subagent does that. Your job is to delegate with a clear task description, receive the context package, and then use it to guide your implementation.

Workflow

  1. Determine task scope:

    • If $ARGUMENTS contains a task description, use it directly.
    • If $ARGUMENTS is empty, ask the user what they're about to implement.
  2. Invoke the context-gatherer subagent with the task description. Pass it verbatim — do not rephrase or reduce scope.

  3. Present the context package to the user. Keep it as-is — the subagent's structured output is already optimized for consumption.

  4. Use the context for implementation:

    • If the context package includes "Suggested starting points" — read those ranges to begin, and expand to other files if you judge them relevant. Treat the list as a starting set, not the closed set.
    • If the subagent indicates this is greenfield (no existing code matches), proceed directly to implementation using the nearest relevant patterns listed in the package.

Hard rules

  • Do not explore the codebase yourself before delegating. That defeats the purpose — the subagent handles exploration.
  • Do not ask the subagent to "also write the code" — it is read-only by design.
  • If the subagent returns "Task too broad", ask the user to narrow the scope. Do not attempt to gather context yourself.
  • If the context package is insufficient for implementation, you may do targeted follow-up reads (specific files the subagent pointed to), but do not re-explore from scratch.
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. 8d ago First seen · 42 lines · 29 tokens per session scan A c200ecceac8f

Subscribe to this mod's changes

gather-context is a command published in the GitHub repository Filip-Podstavec/claude-leverage (68 stars, last pushed 1mo ago), licensed MIT. It adds 29 tokens to every session and 515 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-08-30.