code-discovery
Use when discovering or navigating a codebase before planning, implementing, debugging, or refactoring — prefer a Graphify code-graph query over broad Glob/Grep/Read to cut token cost, with automatic fallback to grep when Graphify is absent, stale, or unhealthy.
- License 许可
- MIT
- 所属仓库
- HigorAlves/orc
- 最近更新
- 2026-11-07
- Stars
- ★ 7
- Forks
- 0
01 前言 Front Matter
- name
- code-discovery
- description
- Use when discovering or navigating a codebase before planning, implementing, debugging, or refactoring — prefer a Graphify code-graph query over broad Glob/Grep/Read to cut token cost, with automatic fallback to grep when Graphify is absent, stale, or unhealthy.
02 资源文件 1
- 参考文档references/GRAPHIFY.md3.7 KB
03 SKILL.md 正文
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
- Detect + health-check.
command -v graphify; graph exists atgraphify-out/graph.json; graph fresh (built_at_commitin graph.json ==git rev-parse HEAD, orgraphify check-update .is clean). Binary absent → step 5; never prompt to install (SessionStart tool-check already surfaces it). - Build/refresh when missing or stale — pure local AST, no API key, seconds:
graphify extract . --code-only(missing) orgraphify 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. - Load lessons once, if present.
Readgraphify-out/reflections/LESSONS.mdbefore 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. - Query-first. Answer structural questions by traversal, most-specific verb first:
Thengraphify 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 verdictsReadonly the citedsource_locations. Noisy answer → raise--budgetor 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 withgraphify <verb> --help). - Fallback (absent / stale / failed / empty):
Globcandidates,Grepsymbols,Readimmediate dependencies. Graceful degradation, not an error — say nothing alarming. - 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
Honesty rules
- Never claim you used the graph when you grepped, or vice-versa.
- The graph points; the code decides — read cited sources before asserting.
- Freshness is load-bearing for any completeness claim: stale graph → refresh or grep the changed area.
Deep detail — verb catalog with caveats, --budget discipline, LESSONS.md mechanics, worktree exclude paths: GRAPHIFY.md (interactive sessions only; this body is self-sufficient for preloaded agents).
04 同仓库更多 Skills
writing-plans
Write a comprehensive implementation plan of bite-sized TDD tasks that an engineer with zero codebase context could execute — exact files, code, tests, and verification steps
writing-for-agents
orc's doctrine layer for writing any document an agent consumes — skills, AGENTS.md/CLAUDE.md, reference docs
workspace-mode
Use when cwd is a parent dir holding multiple sibling git repos — defines repo auto-detection, --repos/--repo/--all-repos/--this-repo precedence, per-repo dispatch, and linked-PR mechanics.
wizard
Generate an interactive bash wizard walking a human through work only they can perform — credentials, secrets, one-off migrations
wait-what
Stop and re-pitch — the last message did not land; say it again simply, in the project's own vocabulary.
vitest
Vitest fast unit testing framework powered by Vite with Jest-compatible API