codegraph: Instructions file for Codex

AGENTS.md

codegraph AGENTS.md is an instructions file for Codex, OpenCode from colbymchenry/codegraph. It costs 9,436 tokens per session, scanned C, original, MIT.

A set of instructions for coding agents working in the CodeGraph repository. It explains the project, its architecture, and how to build, run, and test it.

In plain words
What is it for?
Use it to guide agents while developing CodeGraph, including running builds, tests, and individual test files.
Why use it?
It gives an agent the repository-specific rules and commands it needs before changing code. This reduces guesswork about the project and its checks.

Instructions file for CodexOpenCode

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

This is colbymchenry/codegraph's own configuration. It tells Codex and OpenCode how to work on codegraph 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 codegraph configures →

About the project

CodeGraph is a local, pre-indexed knowledge graph of a software codebase that helps AI coding agents understand relationships across files and symbols. Developers use it to retrieve focused code context, keep the graph synchronized with changes, and support agents such as Claude Code, Codex, Cursor, and Gemini. The catalogue entries provide CodeGraph skills and instructions for those agent workflows.

colbymchenry/codegraph · 75,627 stars · on GitHub · colbymchenry.github.io

Reuse

Borrowing it

Nothing to install: this file belongs to colbymchenry/codegraph. 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/colbymchenry/codegraph/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/colbymchenry/codegraph

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 codegraph AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/colbymchenry/codegraph/agents-md/github.svg)](https://agentmods.dev/instructions/colbymchenry/codegraph/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/colbymchenry/codegraph/agents-md"><img src="https://agentmods.dev/badge/instructions/colbymchenry/codegraph/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 codegraph AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/colbymchenry/codegraph/agents-md"><img src="https://agentmods.dev/badge/instructions/colbymchenry/codegraph/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 9,436 This file is loaded in full into every session.
When invoked 9,436 The same file — it is already loaded in full.
Security scan C 1 finding. 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.09436 $0.09436
Opus 5.5 $0.03774 $0.03774
Sonnet 5.5 $0.01887 $0.01887
Haiku 4.5 $0.00944 $0.00944

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

Security

Grade C, and why

codegraph AGENTS.md scanned grade C with 1 finding 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 7d 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

npm run clean # rm -rf dist
AGENTS.md · 291 lines

How it starts

The opening of the file, as written. The whole thing — 291 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md

Canonical project guidance for coding agents working in this repository (Codex/Astra, Claude Code via @AGENTS.md, Cursor, etc.).

Codex size note: root AGENTS.md is intentionally kept near ~35 KiB (critical build/test/arch/retrieval rules retained). Longer validation methodology + the Excalidraw worked example live in docs/AGENTS.md. This environment sets project_doc_max_bytes = 49152 so root (and root+docs/ when cwd is under docs/) are not silently truncated at the 32 KiB default.

Project Overview

CodeGraph is a local-first code intelligence library + CLI + MCP server. It parses any supported codebase with tree-sitter, stores symbols/edges/files in SQLite (FTS5), and exposes a knowledge graph to AI agents (Claude Code, Cursor, Codex CLI, opencode) over MCP. Per-project data lives in .codegraph/. Extraction is deterministic — derived from AST, not LLM-summarized.

Distributed as @colbymchenry/codegraph on npm; same binary serves as installer, indexer, and MCP server.

Build, Test, Run

npm run build           # tsc + copy schema.sql and *.wasm + build the viewer into dist/; chmods dist/bin/codegraph.js
npm run build:lib       # the viewer's components as @colbymchenry/codegraph-ui (ui/dist) — NOT part of `build`
npm run dev             # tsc --watch
npm run clean           # rm -rf dist

npm test                # vitest run (all)
npm run test:watch
npm run test:eval       # only __tests__/evaluation/
npm run eval            # build then run __tests__/evaluation/runner.ts via tsx

npm run cli             # build then run the local dist binary

# Single test file / pattern
npx vitest run __tests__/installer-targets.test.ts
npx vitest run __tests__/extraction.test.ts -t "TypeScript"

copy-assets (called from build) copies src/db/schema.sql and all src/extraction/wasm/*.wasm files into dist/. Any new SQL or grammar wasm must be copied or it won't ship.

One other build step writes into dist/ and is subject to the same rule: build:ui builds the browser viewer into dist/viewer/ (never dist/ui/ — that's the terminal ui). scripts/check-ui-build.mjs asserts both dist/viewer/ and the copied grammars in dist/extraction/wasm/ after every build and inside every release archive — the viewer's syntax highlighting reads a file with the same grammar the engine indexed it with, so a missing wasm is an unhighlighted screen as well as an extraction gap.

Read the full file on GitHub · 291 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. 7d ago Changed · +39 tokens per session 0260739809bb
  2. 17d ago Changed · +42 tokens per session e5242b2671d1
  3. 25d ago Changed · +3 lines · +261 tokens per session fff3c0f2a9f8
  4. 28d ago Changed · +4 lines · +153 tokens per session 23b4ae458ac0
  5. 1mo ago Changed · +26 tokens per session 1dbf6547d7fd
  6. 1mo ago Changed · +73 tokens per session 478680c9e967
  7. 1mo ago First seen · 284 lines · 8,842 tokens per session scan C 11df1a855701

Subscribe to this mod's changes

codegraph AGENTS.md is an instructions file published in the GitHub repository colbymchenry/codegraph (75,627 stars, last pushed today), licensed MIT. It adds 9,436 tokens to every session, about $0.0377 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-08.

Related

Other instructions, from other repositories