- Home
- Skills
- Agents & Orchestration
- ug: Codebase Knowledge Graph for AI Agents
More screenshots
Works with the AI Agents you already use
ug: Codebase Knowledge Graph for AI Agents
- **Safe edits.** Before an edit, `find_usages` and `analyze boundary_impact` show who depends on a symbol and whether a change escapes the system.
Free
ug: Codebase Knowledge Graph for AI Agents
Example session with this skill installed
I'm about to change fit_to_budget in native/src/storage/query.rs. Before I touch it: who calls it, and which tests do I need to re-run afterwards?
- Read your context and instructions
- Compiled the output
Summary
One ug context call answered both halves (callers with call sites, and the tests that reach the function) without opening a file. This is a real run against the ug repository itself.
$ ug context fit_to_budget --include caller --include test --max-chars 3500
Context for Function fit_to_budget native/src/storage/query.rs:643-668
id: function:native/src/storage/query.rs:fit_to_budget
2794 chars of 3500 budget · 3 caller, 5 test
── callers (3) ──
- Function search_kb_ppr native/src/storage/query.rs:716-836
id: function:native/src/storage/query.rs:search_kb_ppr
doc: Default path: RRF seeds become a personalization vector for Personalized PageRank over the full edge graph. PPR scores replace both BFS expansion and MMR reranking — a single ranking that fuses seed p
this —Calls→ target
820 if !fit_to_budget(&mut item, total_chars, opts.max_chars, cap) {
- Function search_kb_flat native/src/storage/query.rs:848-903
id: function:native/src/storage/query.rs:search_kb_flat
doc: Seeds only: RRF fusion, then stop. No PPR, no BFS, no neighbors — every item came back because the query matched it, so `hop` is always 0 and `matched_by` is only ever `semantic` or `keyword`. This i
this —Calls→ target
887 if !fit_to_budget(&mut item, total_chars, opts.max_chars, cap) {
- Function search_kb_mmr native/src/storage/query.rs:907-1012
id: function:native/src/storage/query.rs:search_kb_mmr
doc: Legacy path: seed -> BFS expand -> MMR rerank. Kept available via `RankStrategy::Mmr` for callers who want diversity-first behavior.
this —Calls→ target
996 if !fit_to_budget(&mut item, total_chars, opts.max_chars, cap) {
── tests (5) ──
- Function one_huge_item_no_longer_swallows_the_whole_result native/src/storage/query.rs:1041-1071
id: function:native/src/storage/query.rs:one_huge_item_no_longer_swallows_the_whole_result
test —Calls→ target
1055 if !fit_to_budget(&mut c, used, max, cap) {
- Function the_budget_is_never_exceeded native/src/storage/query.rs:1075-1087
id: function:native/src/storage/query.rs:the_budget_is_never_exceeded
test —Calls→ target
1081 if !fit_to_budget(&mut c, used, max, cap) {
- Function the_cap_is_a_ceiling_not_a_reservation native/src/storage/query.rs:1126-1133
id: function:native/src/storage/query.rs:the_cap_is_a_ceiling_not_a_reservation
test —Calls→ target
1130 assert!(fit_to_budget(&mut c, 0, max, cap));
- Function only_a_spent_budget_stops_the_loop native/src/storage/query.rs:1137-1143
id: function:native/src/storage/query.rs:only_a_spent_budget_stops_the_loop
test —Calls→ target
1141 assert!(fit_to_budget(&mut c, 0, max, cap), "room at the start");
1142 assert!(!fit_to_budget(&mut c, 999, max, cap), "budget spent");
- Function the_description_survives_before_the_snippet native/src/storage/query.rs:1148-1155
id: function:native/src/storage/query.rs:the_description_survives_before_the_snippet
test —Calls→ target
1152 assert!(fit_to_budget(&mut c, 0, max, cap));
Next: get_code <id> for any item's full body · find_usages <id> --hops 2 for transitive users
What this means for your change
| Count | Where | |
|---|---|---|
| Callers | 3 | search_kb_ppr, search_kb_flat, search_kb_mmr, all in storage/query.rs, all calling it as a loop guard (if !fit_to_budget(...) { break }) |
| Tests | 5 | all in storage/query.rs's test module |
All three callers rely on the
return value meaning "stop the loop", so changing what false means changes all three search strategies at once.
Next steps
- Make the edit, then
ug update native/src/storage/query.rsso the graph reflects it. ug analyze diff_retest_scope --arg files=native/src/storage/query.rsto confirm the tests to run.- Run those 5 tests:
cargo nextest run -E 'test(/fit_to_budget|budget|description_survives|huge_item/)'.
Connects securely to your tools. The creator never sees your data.
About this skill
Stop letting your agent grep blindly through large repos. This skill teaches Claude Code, Cursor, Codex, Gemini CLI and other SKILL.md agents to drive ug (UltraGraph), a local engine that indexes your code and docs into a knowledge graph of symbols and edges: calls, imports, references, tests, routes. The agent then asks the graph who depends on something instead of guessing from text matches.
What it does
- One call instead of five.
ug context <symbol>returns the source, every direct caller with its call site, the tests that reach it, its dependencies and linked docs, inside a character budget you set. - Safe edits. Before an edit,
find_usagesandanalyze boundary_impactshow who depends on a symbol and whether a change escapes the system. After an edit,analyze diff_impact/diff_retest_scopegive the blast radius and the exact tests to re-run. - Read a change, not a patch.
ug walk main...HEADmaps each diff hunk to the innermost function it touched and orders the stops by the call graph. - Repo-wide answers in one call. 35+
ug analyzepresets cover dead code, untested symbols, long functions, hotspots, layering violations, documentation coverage and REST/CLI/queue boundaries. Anything they don't cover can be written as Cypher-style GQL. - Wildcards everywhere.
ug find_usages 'validate_*'is one call, not a loop.
How it works
- Install the free
ugCLI (see Requirements) and copy theug/folder into your agent's skills directory. - Run
ug genin your repo once, and optionallyug hook installso the graph re-indexes after every commit. - Ask your agent normal questions ("what breaks if I change X?", "where do I start?", "what tests cover this?"). The skill tells it which
ugcommand answers each one, and how to refresh the index withug update <file>after it edits.
Languages
Rust, Python, TypeScript/JavaScript (including JSX/TSX) and Java, plus Markdown and PDF docs.
Why this beats prompting it yourself
Text search sees strings; it can't tell a call from a comment, and an agent fed grep output guesses at call sites and misses tests. ug answers from the resolved call graph, budgets its output so it doesn't flood the context window, and says when an answer is truncated or comes from a stale index.
Requirements
- The
ugCLI, free and local, no API key or cloud:curl -fsSL https://ultra-graph.web.app/install.sh | sh(macOS/Linux; Windows zip on GitHub Releases) - Git, for diff/walk/hooks
Known limitations
Like any static graph, it under-reports reflection, dynamic dispatch and macro-generated calls; the skill tells the agent that an in-degree of 0 means "nothing resolves to it", not "unused". Structural answers describe the last index until ug update runs on edited files, and ug warns when that's the case.
Under-reports reflection, dynamic dispatch, and macros. Structural queries require manual refresh via ug update after file edits. Commands default to the current working directory.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 10 days ago
- Free with an Agensi account
Requires
Permissions
Allowed Hosts
The agent runs the `ug` CLI in a terminal. ug reads the repository to index it and writes its index only under ~/.ug/<project>/. Write access is used for that index and, only if you run `ug hook install`, for git hooks in .git/hooks. No network access is needed after installing the CLI, and no code leaves your machine.