ctxkeep: Instructions file for Codex

AGENTS.md

ctxkeep AGENTS.md is an instructions file for Codex, OpenCode from danish-119/ctxkeep. It costs 1,146 tokens per session, scanned A, original, MIT.

A project instruction set for keeping generated parts of AGENTS.md, architecture notes, and other documentation aligned with the source code. It separates generated text from notes written by people.

In plain words
What is it for?
Use it when maintaining a TypeScript project whose code structure, module APIs, or architecture documents need regular synchronization.
Why use it?
Project documentation can become outdated as code changes. This workflow refreshes code-derived sections without overwriting human-written explanations.

Instructions file for CodexOpenCode

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

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

Reuse

Borrowing it

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

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

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

Your own site · 80×15
<a href="https://agentmods.dev/instructions/danish-119/ctxkeep/agents-md"><img src="https://agentmods.dev/badge/instructions/danish-119/ctxkeep/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,146 This file is loaded in full into every session.
When invoked 1,146 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.01146 $0.01146
Opus 5.5 $0.00458 $0.00458
Sonnet 5.5 $0.00229 $0.00229
Haiku 4.5 $0.00115 $0.00115

Measured 1mo ago against content hash 2e6fb5203dec, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

ctxkeep 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 1mo 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 · 75 lines

How it starts

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

ctxkeep

Keeps AGENTS.md, ARCHITECTURE.md, and other project docs in sync with the code: generated from tree-sitter analysis, patched incrementally, never touching human-written text.

  • Languages: TypeScript
  • Stack: Node.js, Vitest (package.json); npm (package-lock.json)
  • More context (read on demand): module dependencies and key files: ARCHITECTURE.md; each module's public API: .ai/manifest.md

Sections between ctxkeep markers are generated from the code by CtxKeep and refreshed by ctxkeep sync — edit outside them.

Working on CtxKeep

Hand-written: things the code alone won't tell you. CtxKeep checks that everything below still exists.

  • Run the CLI from source with npm run dev -- <command> <path> (e.g. npm run dev -- check .). dist/ is build output from npm run build; never edit it.
  • Every write to a generated doc goes through applyRegions in src/compiler/apply.ts, which provides hand-edit protection, region placement and line-ending preservation. Never write artifact files directly.
  • Changed what the parser extracts? Bump PARSER_VERSION in src/analysis/refresh.ts so existing graphs re-parse once.
  • Golden snapshots in test/fixtures/*/__golden__/ are byte-exact. After an intentional output change, regenerate them with UPDATE_GOLDEN=1 npx vitest run test/goldenFiles.spec.ts and review the diff like code.
  • The full test suite takes 1–2 minutes on Windows because CLI tests spawn real subprocesses. While iterating, run one file: npx vitest run test/drift.spec.ts.
  • tree-sitter and better-sqlite3 are pinned on purpose (native prebuilds, Node 20 support). Read DECISIONS.md before bumping either.
  • Record any non-obvious design choice in DECISIONS.md: what was chosen, what was rejected, and why.
  • Detection stays deterministic: CtxKeep never calls an LLM to decide what's true. Any AI integration only rewrites text that a deterministic check has flagged.

Read the full file on GitHub · 75 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. 1mo ago First seen · 75 lines · 1,146 tokens per session scan A 2e6fb5203dec

Subscribe to this mod's changes

ctxkeep AGENTS.md is an instructions file published in the GitHub repository danish-119/ctxkeep (2 stars, last pushed 1mo ago), licensed MIT. It adds 1,146 tokens to every session, about $0.0046 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-10-04.

Related

ctxkeep AGENTS.md compared with instructions from other repositories

ctxkeep AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
ctxkeep AGENTS.mddanish-119/ctxkeepInstructions file21mo agoMITA1,146Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,516GitHub Copilot
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file275k3d agoMITA4,313Codex, OpenCode