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.
npx agentmods add instructions/dev-manul/kartograf/agents-mdgit clone --depth 1 https://github.com/dev-manul/kartografWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.01319 | $0.01319 |
| Opus 5 | $0.00660 | $0.00660 |
| Sonnet 5 | $0.00264 | $0.00264 |
| Haiku 4.5 | $0.00132 | $0.00132 |
Grade A, and why
kartograf AGENTS.md 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 2d 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.
How it starts
The opening of the file, as written. The whole thing — 115 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AGENTS.md
Guidance for AI agents working in this repository.
What this is
kartograf builds a code map (symbols, references, call graph) of a project into SQLite and serves it to AI agents over MCP (stdio). Tree-sitter parsing, language-agnostic core, PHP/Go/TS adapters, an optional type-inference enrichment layer (go/types, PHPStan).
Build & test
cgo is required (tree-sitter, mattn/go-sqlite3) and so is the
sqlite_fts5 build tag — a compile guard
(internal/core/store/fts5guard.go) fails the build without it.
Always go through the Makefile:
make check # vet + test + fmt + build — run before every commit
make install # go install into $GOPATH/bin (MCP configs point there)
Plain go build ./... will fail with BUILD_WITH_TAG_sqlite_fts5... —
that is intentional, add -tags sqlite_fts5 or use make.
Layout
cmd/kartograf— CLI (cobra): index, serve, enrich, outline, hidden parse-tree.internal/core/model— language-neutral types (Symbol,Ref,Import,FileIndex). Nothing language-specific belongs here.internal/core/lang— adapter contract + registry.internal/core/indexer— walk (gitignore-aware), worker pool, mtime/sha256 change detection, go.mod module map collection.internal/core/store— SQLite schema, bulk/incremental writers, FTS5, enrichment table.internal/core/query— read side used by MCP tools.internal/lang/php,internal/lang/golang,internal/lang/ts— tree-sitter adapters.internal/enrich— go/types pass and PHPStan rule scaffolding + JSONL import.internal/mcpserver— MCP tool definitions.
Hard-won rules (do not relearn these the hard way)
- Schema changes: any change to the SQLite schema requires bumping
schemaVersionininternal/core/store/store.go. A mismatch silently deletes and rebuilds the database — that is the designed migration strategy; never write ALTER migrations. - FQN dialects: PHP
App\Ns\Class::method(), Gomodule/pkg.Type.Method(), TSpath/module#Class.method()(module = extensionless file path, trailing/indexstripped). Symbol IDs prefix the language (php:...,go:...,ts:...). Query helpers (methodSplit,memberSep, suffix lookup) must stay separator-agnostic across all dialects. - tree-sitter node kinds: never trust documentation or memory —
dump the real CST with
kartograf parse-tree file.{php,go}(hidden command) and verify. Grammar quirks live in the adapter tests'testdata/fixtures; extend those fixtures when touching extraction. - MCP output schemas: Claude Code rejects tools whose
outputSchemais not a JSON object — wrap list results in a struct ({results: [...]}), never return a bare slice as the Out type. - PHPStan enrichment: the rule class is loaded via
--autoload-file(bootstrapFiles is too late for DI container construction). Edges travel as pseudo-errors with identifierkartograf.edgethrough--error-format=json— do NOT switch to a side-channel output file: PHPStan's result cache skips unchanged files and would silently drop their edges. - Enrichment lifecycle:
.kartograf/enrich.<source>.jsonlis the source of truth — at the root and in every nested project directory (enrich.Discoverwalks the tree past .git/vendor/dot-dirs/excludes).ext_edgesare keyed byorigin(root-relative path of the exchange file) and replaced wholesale per origin on import, auto-imported by index/serve on mtime change, and dropped when the file is deleted. Tool-reported paths resolve inside the owning project first (Exchange.Prefix), then root-relative, then by longest suffix. - TS specifics: JSX component renders are
callsedges with a()target so they join function-component FQNs; unqualified names resolve only through imports or file-local declarations (JS scoping — unknown names are globals and are skipped); imports through barrel files (index.tsre-exports) stay heuristic and do not join the graph — a known limitation. - Vendor code is indexed shallow (
SkipRefs): declarations and hierarchy only. Don't emit call edges from vendor files. - Bulk vs incremental writes: an empty database takes
BeginBulkWrite(indexes/triggers dropped, FTS rebuilt once at commit). Incremental runs rely on the FTS triggers; keep both paths working when touching the store.
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.
- 2d ago First seen · 115 lines · 1,319 tokens per session scan A 685ad82f518e
kartograf AGENTS.md is an instructions file published in the GitHub repository dev-manul/kartograf (2 stars, last pushed 5d ago), licensed MIT. It adds 1,319 tokens to every session, about $0.0066 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.
Other instructions, from other repositories
gosymdb CLAUDE.md
Instructions for walkindude/gosymdb, covering working on gosymdb, what gosymdb does for navigation, session-start bootstrap, navigation tasks and the corresponding command and resolving fqnames.
gosymdb AGENTS.md
Instructions for walkindude/gosymdb, covering agents.md — gosymdb, what gosymdb is, how the database is found, the freshness loop and mcp integration.
gograph AGENTS.md
Instructions for ozgurcd/gograph, covering agents.md, project authority and conditional scrinium use.
mcpls copilot-instructions.md
Instructions for bug-ops/mcpls, covering copilot instructions for mcpls, type safety, idiomatic rust, architecture and async.
pitlane-mcp CLAUDE.md
Instructions for eresende/pitlane-mcp, covering pitlane mcp usage, startup, navigation, search strategy and execution-path questions.
bonsai-ninja AGENTS.md
Instructions for gromhacks/bonsai-ninja, covering bonsai-ninja, map a codebase, optional explicit semantic sidecar prewarm, explicit spelling for default syntax/construct indexing and optional during active editing.