AGENT SKILL
cortex
Use Cortex to get structural codebase context before editing an unfamiliar repository. Index the repo locally, resolve symbol ownership, trace callers and dependencies, and estimate blast radius through the CLI or local daemon.
- License 许可
- MIT
- 最近更新
- 2026-04-16
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- cortex
- description
- Use Cortex to get structural codebase context before editing an unfamiliar repository. Index the repo locally, resolve symbol ownership, trace callers and dependencies, and estimate blast radius through the CLI or local daemon.
02 资源文件 48
- 其他.gitattributes668 B
- 参考文档.github/dependabot.yml199 B
- 参考文档.github/workflows/ci.yml893 B
- 参考文档.github/workflows/pages.yml741 B
- 参考文档.github/workflows/release.yml1.8 KB
- 其他.gitignore270 B
- 参考文档AGENTS.md1.8 KB
- 参考文档agents/openai.yaml293 B
- 参考文档benchmarks/latest.json34.9 KB
- 参考文档benchmarks/latest.md3.8 KB
- 其他Cargo.lock46.9 KB
- 其他Cargo.toml1.7 KB
- 参考文档CODE_OF_CONDUCT.md754 B
- 参考文档CONTRIBUTING.md629 B
- 其他crates/cortex-cli/Cargo.toml356 B
- 脚本crates/cortex-cli/src/main.rs8.4 KB
- 其他crates/cortex-core/Cargo.toml1.4 KB
- 脚本crates/cortex-core/src/extractors.rs29.2 KB
- 脚本crates/cortex-core/src/indexer.rs21.8 KB
- 脚本crates/cortex-core/src/lib.rs646 B
- 脚本crates/cortex-core/src/model.rs10.7 KB
- 脚本crates/cortex-core/src/query.rs21.9 KB
- 脚本crates/cortex-core/src/storage.rs7.5 KB
- 脚本crates/cortex-core/tests/indexing.rs4.4 KB
- 其他crates/cortex-daemon/Cargo.toml381 B
- 脚本crates/cortex-daemon/src/main.rs7.7 KB
- 参考文档docs/plans/2026-03-17-benchmark-expansion-design.md3.1 KB
- 参考文档docs/plans/2026-03-17-language-expansion-compaction-design.md3.7 KB
- 参考文档docs/SELF-TEST.md1.8 KB
- 许可证LICENSE1.1 KB
- 参考文档README.md5.9 KB
- 其他rust-toolchain.toml66 B
- 脚本scripts/benchmark.ps133.2 KB
- 脚本scripts/install.ps13.2 KB
- 脚本scripts/install.sh1.1 KB
- 脚本scripts/self-test.ps12.5 KB
- 参考文档SECURITY.md607 B
- 其他site/config.toml547 B
- 参考文档site/data/benchmarks.json34.9 KB
- 资产文件site/static/icon.svg820 B
- 脚本site/static/site.js6.0 KB
- 其他site/static/style.css13.5 KB
- 参考文档site/templates/base.html620 B
- 参考文档site/templates/docs-page.html523 B
- 参考文档site/templates/docs-section.html243 B
- 参考文档site/templates/index.html14.9 KB
- 参考文档site/templates/partials/logo.html930 B
- 参考文档site/templates/skill-page.html237 B
03 SKILL.md 正文
Cortex Skill
Use this skill when Cortex is available in the working environment and you need structural answers about the codebase before making changes.
Best For
- finding the real owner of a symbol
- checking who calls a function before editing it
- tracing inbound and outbound dependencies
- estimating bounded impact before refactors
- giving coding agents more reliable architectural context than text search alone
Fast Workflow
- Build or refresh the local graph:
cortex index --repo /path/to/repo
If the repo changes after indexing, refresh the graph before answering:
cortex index --repo /path/to/repo
If using the daemon, refresh over HTTP:
curl -X POST "http://127.0.0.1:8787/index/refresh"
- Resolve the target symbol:
cortex query --repo /path/to/repo find-symbol --name PaymentService
- Inspect structural neighborhood before editing:
cortex query --repo /path/to/repo callers --target update_status
cortex query --repo /path/to/repo dependencies --target PaymentService --direction both --depth 1
cortex query --repo /path/to/repo impact --target update_status --depth 1
What Each Query Is Good At
find-symbolUse when you need the canonical definition candidate and file/span location.callersUse before changing behavior or signatures to see likely upstream dependents.calleesUse when reading through behavior from a function outward.dependenciesUse when you need the local structural neighborhood around a symbol or file.referencesUse for best-effort identifier references when call edges are insufficient.impactUse for a conservative blast-radius estimate with supporting edges.explainUse when you want a compact summary of why a symbol matters structurally.
Daemon Mode
If repeated queries are needed, run the daemon once and hit the HTTP API:
cortexd --repo /path/to/repo --bind 127.0.0.1:8787
curl "http://127.0.0.1:8787/graph/find_symbol?name=PaymentService"
How To Use Results Well
- quote the resolved file path and line span in your reasoning
- distinguish confirmed structure from inferred behavior
- use
callers,dependencies, andimpactbefore edits that could widen blast radius - fall back to direct code reading when the graph is too broad or ambiguous
Current Limits
- Cortex is conservative and syntax-driven, not compiler-grade truth
- dynamic dispatch, runtime data flow, and framework magic may need manual confirmation
- larger impact results may include tests and example code; filter accordingly
Good Output Pattern For Agents
When reporting findings from Cortex, include:
- the queried symbol or target
- the resolved owner path and span
- the most relevant callers or dependencies
- what remains uncertain and needs manual reading