Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问许可证需确认审计提醒

cartogcartog 搜索

Agent Skill

cartog 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,280

周安装

55

GitHub Stars

3

下载量

449
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:cartog(cartog 搜索)
来源仓库:https://github.com/jrollin/cartog
仓库路径:skills/cartog
安装命令:
npx skills add https://github.com/jrollin/cartog --skill cartog
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/jrollin/cartog --skill cartog

简介

cartog 通过代码图谱导航快速理解陌生项目结构,提供符号级依赖与热点分析。

  • 适用于新成员 onboarding、技术债识别或重构优先级判定等代码理解任务。
  • 支持自然语言查询与文件树浏览,自动索引后显著加速搜索效率。
  • 首次使用前需运行 setup 脚本建立索引,确保项目规模在处理能力范围内。
  • cartog 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

cartog — Code Graph Navigation Skill

Quick Start

  1. Ensure indexed — run the setup script (see Setup below). This is required before any command works.
  2. Explore an unfamiliar codebasecartog map gives a file tree + top symbols ranked by centrality. Start here when onboarding or orienting.
  3. Search for anythingcartog rag search "your query" is the default entry point. It handles keywords, natural language, and concept queries in a single call.

When to Use

Use cartog before reaching for grep, cat, or file reads when you need to:

  • Orient in a codebasecartog map [--tokens N] (start here for unfamiliar projects)
  • Find code by name, concept, or behavior → cartog rag search "query"
  • Search project documentation → cartog rag search "query" --kind document
  • Understand the structure of a file → cartog outline <file>
  • Find who references a symbol → cartog refs <name> (or --kind calls for just callers)
  • See what a function calls → cartog callees <name>
  • Assess refactoring impact → cartog impact <name> --depth 3
  • Understand class hierarchies → cartog hierarchy <class>
  • See file dependencies → cartog deps <file>
  • See what changed recently → cartog changes [--commits N]

How to Run

cartog has two modes — CLI (via Bash) and MCP server. Prefer CLI by default.

SituationModeWhy
Single command or simple queryCLINo server overhead, direct output
Multi-step workflow (e.g. search → refs → impact)MCPWarm DB connection, parallel tool calls
SubagentCLIMCP tools are only available to the main agent

Do not fall back to grep/glob if MCP tools are missing — use the Bash tool instead.

Rules for both modes:

  • Run independent cartog commands as parallel tool calls — whether MCP or Bash
  • Subagents: always use CLI mode via Bash. Skip setup — assume the parent has already indexed

CLI mode: every cartog command in the examples below must be run via a Bash tool call. Do not chain with && or | — use separate Bash calls.

All examples below use CLI syntax. MCP tool names and parameters:

CLI commandMCP toolParameters
cartog index.cartog_indexpath, force
cartog search <name>cartog_searchquery, kind?, file?, limit?
cartog rag search "<query>"cartog_rag_searchquery, kind?, limit?
cartog rag index.cartog_rag_indexpath, force
cartog outline <file>cartog_outlinefile
cartog refs <name>cartog_refsname, kind?
cartog callees <name>cartog_calleesname
cartog impact <name>cartog_impactname, depth?
cartog hierarchy <class>cartog_hierarchyname
cartog deps <file>cartog_depsfile
cartog changescartog_changescommits?, kind?
cartog statscartog_stats
cartog doctor— (CLI only)

Setup

Before first use, ensure cartog is installed and indexed.

If the project uses Ollama (check .cartog.toml for [embedding] provider = "ollama"), skip rag setup — models are managed by the Ollama server.

The scripts/ directory is located next to this SKILL.md file. Before running any setup command, look at the absolute path from which this SKILL.md was loaded (visible in your tool call history), take its parent directory, and use that as the scripts root in the bash commands below.

For example: if this file was loaded from /home/user/.claude/skills/cartog/SKILL.md, run:

# Install if missing
command -v cartog || bash "/home/user/.claude/skills/cartog/scripts/install.sh"

# Run the setup script (handles version check + 3 indexing phases)
bash "/home/user/.claude/skills/cartog/scripts/ensure_indexed.sh"

The setup script checks for newer cartog versions (cached, at most once per 24h). If an update is available it prints a notice like:

New cartog version available: X.Y.Z (installed: A.B.C). Update with: bash "/path/to/skill/scripts/install.sh" X.Y.Z

When you see this notice, ask the user if they want to update before continuing. If they agree, run the suggested command, then re-run bash "/path/to/skill/scripts/ensure_indexed.sh".

Search quality tiers

cartog rag search works at three quality levels depending on setup state:

TierAfterFTS5RerankerVectorQuality
1cartog index.YesNoNoKeyword matching only
2+ cartog rag setupYesYesNoKeyword + neural reranking
3+ cartog rag index.YesYesYesFull hybrid (best)

The setup script runs tier 1+2 blocking, then tier 3 in the background. cartog rag search is usable immediately after tier 2 — vector search becomes available transparently once background embedding completes.

First run: tier 2 downloads ~1.2GB of ONNX models (cached in ~/.cache/cartog/models/). This may take a few minutes — do not abort. Subsequent runs are instant.

Database Location

The index is stored in a SQLite database. cartog resolves the path automatically:

PrioritySource
1--db <path> flag or CARTOG_DB env var
2.cartog.toml[database] path = "..." at git root
3Auto git-root: DB placed at the root of the current git repository
4.cartog.db in the current directory (fallback)

For most projects, no configuration is needed — running cartog index. from any subdirectory will place the DB at the git root automatically.

# Override examples
cartog --db /tmp/myproject.db index .
CARTOG_DB=~/.local/share/cartog/proj.db cartog index .

Why cartog Over grep/glob

cartog pre-computes a code graph (symbols + edges) with tree-sitter and stores it in SQLite. Compared to grep/glob:

  • Fewer tool calls: 1 command vs 3-6 grep/read cycles
  • Transitive analysis: impact --depth 3 traces callers-of-callers — grep can't do this
  • Structured results: symbols with types, signatures, and line ranges — not raw text matches

Workflow Rules

  1. Before you grep or read a file to understand structure, query cartog first.
  2. Search routing — pick the right strategy based on the query: A. Semantic search (cartog rag search "<query>") — default for all searches. Returns code only by default; use --kind document for docs or --kind all for both. Handles keyword matching (FTS5), vector similarity, and cross-encoder reranking in a single call. Works for both natural language and keyword-style queries. Always use ONE call with the full query — never split a query into multiple rag search calls. cartog rag search "authentication token validation" cartog rag search "contract management and timesheet signing" cartog rag search "config" B. Structural search (cartog search <name>) — use only when you need a symbol name to feed into refs, callees, impact, or hierarchy. These commands require exact symbol names, not search results. cartog search validate_token cartog search AuthService --kind class Routing rules:

- Need to find code? → A (rag search) — always - Need a symbol name for refs/callees/impact? → B (search) first, then the structural command - User already gave an exact symbol name? → call refs/callees/impact directly — skip search

  1. When using cartog search to locate a symbol before refs/callees/impact:

- Exactly one result → use that symbol name and file, proceed. - Multiple results, same name, different files → add --file <path> to disambiguate. - Multiple results, different names → add --kind <kind> to filter, then re-evaluate. - Never pass an ambiguous name to refs/callees/impact — the result will be wrong.

  1. Use cartog outline <file> instead of cat <file> when you need structure, not content. Then use Read (with offset/limit) for the specific lines you need — this is more efficient than reading entire files.
  2. Before refactoring, run cartog impact <symbol> to see the blast radius.
  3. Only fall back to grep/read when cartog doesn't have what you need (e.g., reading actual implementation logic, string literals, config values).
  4. After making code changes, run cartog index. --no-lsp to quickly update the graph.

Do / Don't

DO:

  • Use cartog rag search as your default search — it combines FTS5 keyword + vector + reranking in one call
  • Use cartog search only to get a symbol name for structural commands (refs, callees, impact, hierarchy)
  • Trust that rag search degrades gracefully — FTS5 works even without vector embeddings

DON'T:

  • Run cartog search and cartog rag search in parallel for the same query — this wastes a tool call. rag search already includes FTS5 keyword matching internally
  • Split one query into multiple rag search calls with rephrased variants — one call is enough. The hybrid search (FTS5 + vector + reranker) handles synonyms and related terms internally
  • Block on RAG embedding at setup — background indexing is fine, rag search works immediately with FTS5 + reranker
  • Assume rag search requires rag index — it works (at reduced quality) with just cartog index.
  • Chain multiple cartog CLI commands with && or | — each invocation opens a fresh SQLite connection with full initialization overhead (PRAGMAs, schema checks, cold cache). Run them as separate tool calls instead
  • Pipe cartog output through grep — cartog already returns focused, structured results. Filtering with grep discards context (line numbers, kinds, file paths) and can break && chains when grep finds no match (exit code 1)
  • Combine unrelated cartog queries in one bash command — this creates false dependencies and hides failures. See references/query_cookbook.md → "Anti-patterns to avoid" for examples

Commands Reference

Index (build/rebuild)

cartog index .                    # Index current directory (with LSP if available)
cartog index . --no-lsp           # Fast heuristic-only index (~1-4s)
cartog index src/                 # Index specific directory
cartog index . --force            # Re-index all files (ignore cache)

By default, cartog index. auto-detects language servers on PATH and uses them to resolve additional edges. LSP results are persisted in the database — subsequent queries benefit without re-running LSP. Use --no-lsp for fast day-to-day indexing. LSP can be omitted entirely at build time with --no-default-features.

Search (find symbols by partial name)

cartog search parse                          # prefix + substring match
cartog search parse --kind function          # filter by symbol kind
cartog search config --file src/db.rs        # filter to one file
cartog search parse --limit 10               # cap results

Returns symbols ranked: exact match → prefix → substring. Case-insensitive. Max 100 results.

Valid --kind values: function, class, method, variable, import, interface, enum, type-alias, trait, module, document.

RAG Search (hybrid keyword + semantic)

cartog rag search "authentication token validation"
cartog rag search "error handling" --kind function
cartog rag search "database schema setup" --limit 20
cartog rag search "deployment architecture" --kind document

By default, returns code only. Use --kind document for docs or --kind all for both. Uses hybrid retrieval: FTS5 keyword matching + vector KNN, merged via Reciprocal Rank Fusion. When the cross-encoder model is available, results are re-ranked for better precision.

Outline (file structure)

cartog outline src/auth/tokens.py

Output shows symbols with types, signatures, and line ranges — no need to read the file.

Refs (who references this?)

cartog refs validate_token               # all reference types
cartog refs validate_token --kind calls  # only call sites

Available --kind values: calls, imports, inherits, references, raises, implements, type-of.

Callees (what does this call?)

cartog callees authenticate

Impact (transitive blast radius)

cartog impact SessionManager --depth 3

Shows everything that transitively depends on a symbol up to N hops.

Hierarchy (inheritance tree)

cartog hierarchy BaseService

Deps (file imports)

cartog deps src/routes/auth.py

Map (codebase overview)

cartog map                               # default 4000 tokens
cartog map --tokens 2000                 # compact
cartog map --tokens 8000                 # detailed

File tree + top symbols ranked by reference count (centrality). Use at the start of a session for context loading.

Changes (recently modified symbols)

cartog changes                           # last 5 commits + working tree
cartog changes --commits 10              # last 10 commits
cartog changes --kind function           # only functions

Shows symbols affected by recent git changes, grouped by file.

Doctor (environment health check)

cartog doctor                            # check all requirements
cartog --json doctor                     # structured JSON output

Validates git repo, config, database, embedding provider, and reranker. Returns OK / Warn / Error per check and exits with code 1 if any error. Run this when commands fail unexpectedly or after first setup to verify everything is working.

Stats (index summary)

cartog stats

Watch (auto re-index on file changes)

cartog watch .                           # watch current directory
cartog watch . --rag                     # also re-embed symbols (deferred)
cartog watch . --debounce 3 --rag-delay 30  # custom timings

Watch always uses heuristic-only indexing (no LSP) for speed. Previously LSP-resolved edges are preserved in the DB.

Serve (MCP server)

cartog serve                    # MCP server over stdio
cartog serve --watch            # with background file watcher
cartog serve --watch --rag      # watcher + deferred RAG embedding

When an agent calls cartog_index via MCP, LSP servers are started once and kept warm for the session. Subsequent index calls reuse warm servers (~2s instead of a cold 2-15s startup). Background watch re-indexing stays heuristic-only.

Token Budget

Use --tokens N to limit output to approximately N tokens (human-readable only, ignored with --json):

cartog --tokens 500 search validate
cartog --tokens 200 outline src/db.rs
cartog --tokens 1000 changes --commits 10

JSON Output

All commands support --json for structured output:

cartog --json refs validate_token
cartog --json outline src/auth/tokens.py
cartog --json rag search "authentication"

Refactoring Workflow

Before changing any symbol (rename, extract, move, delete):

  1. cartog search <name> — confirm exact symbol name and file
  2. cartog refs <name> — find every usage
  3. cartog impact <name> --depth 3 — transitive blast radius
  4. cartog hierarchy <name> — if it's a class, check subclasses too
  5. Apply changes, then cartog index. --no-lsp to update the graph
  6. Re-run cartog refs <name> to confirm no stale references remain

For the full 3-phase workflow (heuristic → LSP upgrade → verify), see references/query_cookbook.md → "Assess refactoring scope".

Decision Heuristics

I need to...Use
Orient in an unfamiliar codebasecartog map (--tokens N for budget control) — start here
Find code by name, concept, or behaviorcartog rag search "query"
Search project documentationcartog rag search "query" --kind document
Search both code and docscartog rag search "query" --kind all
Get a symbol name for structural commandscartog search <name>
Know what's in a filecartog outline <file>
Find usages of a functioncartog refs <name> (--kind calls for just callers)
See what a function callscartog callees <name>
Check if a change is safecartog impact <name> --depth 3
Understand class hierarchycartog hierarchy <class>
See file dependenciescartog deps <file>
See what changed recentlycartog changes (--commits N for more history)
Improve graph precision for a refactoringcartog index. (with LSP auto-detected)
Fast re-index after code changescartog index. --no-lsp
Diagnose why something is brokencartog doctor
Read actual implementation logiccat <file> (cartog indexes structure, not content)
Search for string literals / configgrep (cartog doesn't index these)
Nothing from search or ragFall back to grep

Limitations

  • Heuristic resolution is name-based (~25% of edges resolved). With LSP enabled, ~42-81% resolved depending on language. Remaining unresolved edges are mostly calls to external libraries.
  • Code languages: Python, TypeScript/JavaScript, Rust, Go, Ruby, Java.
  • Documents: Markdown (.md) — indexed by heading sections for semantic search.
  • Does not index string literals, comments (except docstrings), or config values.
  • Method resolution is name-based without LSP — foo.bar() resolves bar, not Foo.bar specifically. LSP resolves to the exact type when a language server is available.

LSP limitations

  • Default feature: shipped by default. Installs with --no-default-features omit LSP entirely (equivalent to --no-lsp at runtime).
  • Auto-detected: if language servers are on PATH, they are used automatically during cartog index. Use --no-lsp to skip.
  • Startup latency: language servers typically reach ready in 2-15s on cold cache. The default ready-timeout is 20s — override via CARTOG_LSP_READY_TIMEOUT_SECS for very large projects. Day-to-day indexing should use --no-lsp.
  • CLI vs MCP: each cartog index. via Bash spawns and kills LSP servers (cold start). Use cartog serve (MCP mode) for sessions with multiple index calls — it keeps servers warm across tool calls.
  • Supported servers: rust-analyzer, pyright-langserver, typescript-language-server, gopls, ruby-lsp, solargraph, jdtls. Install hints shown when servers are missing.
  • External crate edges stay unresolved: LSP resolves definitions within the project. Calls to std/external crates remain unresolved regardless.

RAG search limitations

  • No substring matching: "valid" does NOT match validate_token. FTS5 is token-based. If rag search returns no results for a known symbol name, fall back to cartog search which supports substring matching.
  • Graceful degradation: rag search works without rag setup or rag index (FTS5-only). Quality improves with each setup tier (see Search quality tiers above).
  • Scores are relative: rrf_score and rerank_score values are only meaningful for ranking within a single query — don't compare scores across different queries.
  • Re-ranking latency: cross-encoder scores all candidates in a single batch ONNX call (up to 50 candidates). Expect ~150-500ms total overhead depending on candidate count.
  • Auto re-embed: when cartog upgrades its embedding format (e.g., AST-aware chunking), cartog rag index automatically detects the change and re-embeds all symbols. No --force needed.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38.44%
按下载量换算173

Claude

27.19%
按下载量换算122

Cursor

19.66%
按下载量换算88

Gemini CLI

8.71%
按下载量换算39

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/jrollin/cartog --skill cartog 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills