kartograf: Instructions file for Codex

AGENTS.md

kartograf AGENTS.md is an instructions file for Codex, OpenCode from dev-manul/kartograf. It costs 1,422 tokens per session, scanned A, original, MIT.

Repository guidance for coding agents working on kartograf, a tool that builds a searchable map of a project's code and makes it available to AI agents.

In plain words
What is it for?
Building, testing, installing, and changing kartograf while following its Makefile, language-adapter layout, and SQLite requirements.
Why use it?
It records the project's build commands, structure, and hard-won rules so agents do not repeat known mistakes or run commands that are expected to fail.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions Claude Code; mentions AGENTS.md.

This is dev-manul/kartograf's own configuration. It tells Codex and OpenCode how to work on kartograf itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything kartograf configures →

Reuse

Borrowing it

Nothing to install: this file belongs to dev-manul/kartograf. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/dev-manul/kartograf/master/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/dev-manul/kartograf

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for kartograf AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/dev-manul/kartograf/agents-md/github.svg)](https://agentmods.dev/instructions/dev-manul/kartograf/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/dev-manul/kartograf/agents-md"><img src="https://agentmods.dev/badge/instructions/dev-manul/kartograf/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for kartograf AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/dev-manul/kartograf/agents-md"><img src="https://agentmods.dev/badge/instructions/dev-manul/kartograf/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,422 This file is loaded in full into every session.
When invoked 1,422 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What 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.

ModelPer sessionOnce invoked
Fable 5.1 $0.01422 $0.01422
Opus 5.5 $0.00569 $0.00569
Sonnet 5.5 $0.00284 $0.00284
Haiku 4.5 $0.00142 $0.00142

Measured 28d ago against content hash 1338d43f07f2, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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 28d 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.

AGENTS.md · 121 lines

How it starts

The opening of the file, as written. The whole thing — 121 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.
  • internal/taskctx — per-branch working notes in the git common dir, outside the index database. find_task walks nested git repos; .kartograf.yml task.branch is an optional {id} template (empty means the branch name contains the id).

Hard-won rules (do not relearn these the hard way)

  • Schema changes: any change to the SQLite schema requires bumping schemaVersion in internal/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(), Go module/pkg.Type.Method(), TS path/module#Class.method() (module = extensionless file path, trailing /index stripped). 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 outputSchema is 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 identifier kartograf.edge through --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>.jsonl is the source of truth — at the root and in every nested project directory (enrich.Discover walks the tree past .git/vendor/dot-dirs/excludes). ext_edges are keyed by origin (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 calls edges 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). Barrel re-exports (export { A } from, export * from) are reexports edges (barrel#* is a star of the whole module). References, callers, callees and impact follow them a few hops. Vendor files still skip those edges (SkipRefs).
  • 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.

Read the full file on GitHub · 121 lines

Changes

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.

  1. 28d ago Changed · +6 lines · +103 tokens per session 1338d43f07f2
  2. 2mo ago First seen · 115 lines · 1,319 tokens per session scan A 685ad82f518e

Subscribe to this mod's changes

kartograf AGENTS.md is an instructions file published in the GitHub repository dev-manul/kartograf (2 stars, last pushed 29d ago), licensed MIT. It adds 1,422 tokens to every session, about $0.0057 per session on Opus 5.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.

Related

kartograf AGENTS.md compared with instructions from other repositories

kartograf AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
kartograf AGENTS.mddev-manul/kartografInstructions file229d agoMITA1,422Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode