code-discovery

A code-discovery skill for finding the parts of a codebase relevant to a task before planning or changing it. A code graph is used when available, with ordinary file search as a fallback.

In plain words
What is it for?
Use it before implementing, debugging, refactoring, or planning changes to locate related files, symbols, and dependencies.
Why use it?
It reduces the time and context needed to navigate unfamiliar code while still working when the graph is missing or outdated.

Skill for Claude CodeCodex

Part of the orc plugin — 13 skills, 30 commands, 14 agents, 5 hooks 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 skills/higoralves/orc/code-discovery
Any agent
npx skills add HigorAlves/orc --skill code-discovery
Clone the repo
git clone --depth 1 https://github.com/HigorAlves/orc

Made for: Claude Code, Codex.

Or install orc, the plugin that ships this one along with the rest of its 13 skills, 30 commands, 14 agents, 5 hooks.

Per session 59 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 836 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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 $0.00059 $0.00836
Opus 5 $0.00030 $0.00418
Sonnet 5 $0.00012 $0.00167
Haiku 4.5 $0.00006 $0.00084

Measured 3d ago against content hash 37f023fe8cc7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-discovery 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 3d 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.

orc/skills/code-discovery/SKILL.md · 36 lines

How it starts

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

Code Discovery

Discovery — finding the code relevant to a task before changing it — is the largest easily-wasted token cost in a session. When Graphify is available, query the pre-built code graph and Read only the cited source_locations instead of grepping the tree. Graphify is optional and pre-1.0: every step below is guarded and falls back to plain Glob/Grep/Read — discovery never hard-blocks on it.

The protocol

  1. Detect + health-check. command -v graphify; graph exists at graphify-out/graph.json; graph fresh (built_at_commit in graph.json == git rev-parse HEAD, or graphify check-update . is clean). Binary absent → step 5; never prompt to install (SessionStart tool-check already surfaces it).
  2. Build/refresh when missing or stale — pure local AST, no API key, seconds: graphify extract . --code-only (missing) or graphify update . (stale). Mention it in interactive commands; just do it in dispatched agents. Build fails → step 5, no retry loop. Never run a semantic (non---code-only) build for discovery.
  3. Load lessons once, if present. Read graphify-out/reflections/LESSONS.md before the first query (bounded ≈1500 tokens); prefer its listed nodes, skip its dead ends. Lessons are hints, not ground truth. Absent → skip silently. You only consume lessons — the orchestrating command records outcomes at a verified gate, so surface which graph nodes you relied on.
  4. Query-first. Answer structural questions by traversal, most-specific verb first:
    graphify query "where is auth wired to the database?" --budget 1500
    graphify explain "RateLimiter"          # one symbol and its connections
    graphify path "UserService" "DatabasePool"
    graphify affected "processRefund" --depth 2   # reverse blast radius — leads, not verdicts
    
    Then Read only the cited source_locations. Noisy answer → raise --budget or rephrase before abandoning the graph. Verify every cited caller by reading it — never claim "all callers handled" from graph output alone, least of all from a stale graph. A verb that errors or emits unparseable output → treat the graph as unavailable for that question and fall back (probe new verbs with graphify <verb> --help).
  5. Fallback (absent / stale / failed / empty): Glob candidates, Grep symbols, Read immediate dependencies. Graceful degradation, not an error — say nothing alarming.
  6. Keep the graph out of version control (repo-local exclude, no tracked-file diff):
    grep -qxF 'graphify-out/' .git/info/exclude 2>/dev/null || echo 'graphify-out/' >> .git/info/exclude
    

Read the full file on GitHub · 36 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 3d ago First seen · 36 lines · 59 tokens per session scan A 37f023fe8cc7

Subscribe to this mod's changes

code-discovery is a skill published in the GitHub repository HigorAlves/orc (6 stars, last pushed 6d ago), licensed MIT. It adds 59 tokens to every session and 836 once invoked, about $0.0003 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-31.