cortex: Instructions file for Codex

AGENTS.md

cortex AGENTS.md is an instructions file for Codex, OpenCode from abdul-hamid-achik/cortex. It costs 9,511 tokens per session, scanned A, original, MIT.

A project guide for coding agents and developers working on the Cortex codebase, a local tool that helps software-engineering agents investigate, change, and verify code.

In plain words
What is it for?
Use it to understand Cortex’s directories, reasoning process, specialist tools, and development commands before modifying the project.
Why use it?
It keeps important architecture, rules, commands, evidence, and uncertainty in one durable place, so long coding tasks are less likely to lose context or skip verification.

Instructions file for CodexOpenCode

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

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

Reuse

Borrowing it

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

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

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

Your own site · 80×15
<a href="https://agentmods.dev/instructions/abdul-hamid-achik/cortex/agents-md"><img src="https://agentmods.dev/badge/instructions/abdul-hamid-achik/cortex/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 9,511 This file is loaded in full into every session.
When invoked 9,511 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.09511 $0.09511
Opus 5.5 $0.03804 $0.03804
Sonnet 5.5 $0.01902 $0.01902
Haiku 4.5 $0.00951 $0.00951

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

Security

Grade A, and why

cortex 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 · 532 lines

How it starts

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

AGENTS.md

Instructions for AI agents (and humans) working on the cortex codebase. This is the canonical source-of-truth doc. README.md is the public-facing intro. Architecture, behavior, and contributor rules that must remain durable belong here. Design rationale and working notes belong in the Obsidian vault at ~/notes/projects/cortex/, not the repo.

Project Overview

cortex is a local-first, evidence-guided agent kernel for software-engineering agents. It sits between an LLM and a set of specialist tools (Bob, codemap, vecgrep, cairntrace, glyphrun, fcheap, vidtrace, tvault, veclite) and enforces a stateful reasoning loop:

orient → investigate → form hypotheses → declare a boundary → change → verify → preserve evidence

Cortex does not replace the model's planning or coding ability. It supplies what models are bad at preserving across long tool-using tasks: a durable case file, explicit evidence and uncertainty, disciplined tool routing, bounded changes, and verification tied to user-visible behavior.

Two surfaces over one kernel (the ecosystem pattern — cf. codemap/vecgrep):

  • CLI — human commands and --json machine output for agents (Cobra + Charm v2 lipgloss).
  • MCP server — cortex serve (stdio), a 23-tool agent profile by default; --profile all exposes the full 30-tool operator surface.

Product docs: docs/quick-start.md (humans), docs/mcp.md (agents). Monitor sessions with cortex sessions / cortex show --json instead of the removed Studio TUI (docs/studio.md).

Directory Structure

cortex/
├── cmd/cortex-trajectory/    # opt-in trusted empirical harness; separate from runtime/release CLI
├── cmd/cortex-trajectory-claude/ # reference arm launcher (Claude Code CLI, isolated raw_tools/cortex arms)
├── cmd/cortex/               # Cobra CLI, split per-command. Each RunE is THIN → builds a
│                             #   kernel (kernelFor) → calls internal/kernel. Files carry the
│                             #   header `/* Copyright © 2026 abdul hamid <[email protected]> */`.
│   ├── main.go               #   root command, persistent --workspace/-C and --json flags
│   ├── open / start / investigate / plan / change / verify / remember / status .go
│   ├── note / decision / handoff / doctor / serve .go
│   ├── longrunning.go        #   finding / dossier / coverage / workplan / resume / job command groups
│   └── render.go             #   lipgloss v2 styled view + --json emit (TTY-gated color)
├── internal/
│   ├── domain/               # core types — NO deps on adapters/store/transport
│   │   ├── case.go           #   CaseFile + Phase machine (transitions, invariants)
│   │   ├── acceptance.go     #   optional immutable criteria + transport-independent bounds
│   │   ├── evidence.go       #   Evidence, EvidenceKind, Confidence, Sensitivity
│   │   ├── hypothesis.go     #   Hypothesis + Disproof (the disproof-path gate)
│   │   ├── plan.go           #   Plan + planning-gate validation
│   │   ├── verification.go   #   typed claims + VerificationRecord + statuses
│   │   ├── lease.go decision.go # change ownership + resumable human decisions
│   │   ├── envelope.go       #   the shared MCP/CLI result envelope
│   │   ├── policy.go         #   routing matrix, budget, surface→verifier map
│   │   └── finding.go dossier.go coverage.go workplan.go job.go # long-running work records
│   ├── kernel/               # SHARED SERVICE LAYER — CLI + MCP both call this
│   │   ├── kernel.go         #   Kernel struct, evidence stamping, phase transition helper
│   │   ├── orient.go open.go #   new task + idempotent open/resume
│   │   ├── investigate.go    #   Investigate (route → discovery → candidates → structural expansion → record evidence)
│   │   ├── plan.go           #   Plan (rejects no-disproof / no-boundary plans)
│   │   ├── change.go lease.go #  explicit begin-change + bounded ownership
│   │   ├── verify.go assessment.go # typed verification + canonical task assessment
│   │   ├── persist.go        #   Remember (durable memory + summary.md + completion invariant)
│   │   ├── resolve.go        #   Resolve (confirm/challenge/reject a hypothesis)
│   │   ├── recall.go         #   Cross-case disproof recall: index hooks + recall
│   │   ├── observe.go decision.go handoff.go actions.go artifact.go # human/agent collaboration + projections
│   │   ├── status.go         #   Status / AbortTask / ReadEvidence / ListTasks
│   │   ├── scope.go          #   scope-drift detection vs the declared boundary
│   │   ├── freshness.go      #   evidence `commit` stamping + stale detection (git ChangedSince, bounded)
│   │   ├── finding.go dossier.go survey.go workplan.go checkpoint.go jobs.go # long-running work (docs/long-running.md)
│   │   └── jobs_unix.go jobs_other.go # detached worker spawn (Setsid) + terminate
│   ├── adapters/             # one file per tool; flat package sharing exec/redact plumbing
│   │   ├── adapter.go        #   Adapter interface, Request/Result/Fact, Capability/Status
│   │   ├── exec.go           #   runner (fakeable), timeout, redaction, ErrToolMissing
│   │   ├── registry.go       #   Registry + concurrent Health probe
│   │   ├── bob.go codemap.go vecgrep.go fcheap.go cairntrace.go glyphrun.go vidtrace.go tvault.go veclite.go command.go
│   │   └── util.go           #   pluralize / decodeJSON / clip helpers
│   ├── store/
│   │   ├── casefs/           #   JSON/JSONL case-file persistence ($XDG_STATE_HOME/cortex/sessions/<repo>/<id>/)
│   │   │                     #   + findings/coverage/workplan/jobs/checkpoint files and RepoStore (repos/<slug>/dossier.json)
│   │   └── redact/           #   secret-shape redaction (last-line filter before model output)
│   ├── mcp/server.go         # stdio MCP server — THIN pass-through (23 agent / 30 all; longrunning.go holds the six long-running tools)
│   ├── tui/board.go          # Legacy Charm v2 board (not wired to the CLI)
│   ├── config/               # XDG paths + cortex.yaml (budget/redact/cases_dir/recall/verifiers) + env
│   ├── ids/                  # time-sortable Crockford-base32 IDs (task_/ev_/hyp_/vr_/dec_/raw_)
│   ├── eval/                 # deterministic scorecard + separate opt-in trajectory runner contract
│   ├── forge/forge.go        # PR review action (ModeReview: PR fetch + APPROVE/REQUEST CHANGES verdict)
│   └── version/version.go    # Version/Commit/Date (ldflags-injected)
├── docs/                     # VitePress site (product docs ONLY) → deploy to Vercel
├── desktop/                  # Cortex Deck — Electron operator console over CLI+MCP+case store;
│                             #   no bundler/framework; own README, tests (node --test) and a
│                             #   headless smoke pass that screenshots every view
├── contracts/v1/             # public deterministic JSON/MCP conformance schema + fixtures
├── evaluations/              # trusted empirical manifests, repository fixtures, and independent oracles
├── specs/                    # glyphrun E2E specs (*.yml)
├── .github/workflows/        # ci.yml (test+race+build+lint+docs) · release.yml (goreleaser on tags)
├── Taskfile.yml .golangci.yml .goreleaser.yaml
└── README.md AGENTS.md CHANGELOG.md LICENSE

Read the full file on GitHub · 532 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 Changed · +17 lines · +409 tokens per session 5344735e3bc2
  2. 1mo ago Changed · +13 lines · +231 tokens per session ac62cfec0cf4
  3. 2mo ago Changed · +62 lines · +1,266 tokens per session 53250ff4ec86
  4. 2mo ago First seen · 440 lines · 7,605 tokens per session scan A da5d55d4aae0

Subscribe to this mod's changes

cortex AGENTS.md is an instructions file published in the GitHub repository abdul-hamid-achik/cortex (1 stars, last pushed 1mo ago), licensed MIT. It adds 9,511 tokens to every session, about $0.0380 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

cortex AGENTS.md compared with instructions from other repositories

cortex AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
cortex AGENTS.mdabdul-hamid-achik/cortexInstructions file11mo agoMITA9,511Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,516GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
vscode model-prompts.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA2,022GitHub Copilot