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/abdul-hamid-achik/cortex/agents-mdgit clone --depth 1 https://github.com/abdul-hamid-achik/cortexWrote 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.
[](https://agentmods.dev/instructions/abdul-hamid-achik/cortex/agents-md)<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="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.07605 | $0.07605 |
| Opus 5 | $0.03802 | $0.03802 |
| Sonnet 5 | $0.01521 | $0.01521 |
| Haiku 4.5 | $0.00760 | $0.00760 |
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 3d 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 — 440 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; CLAUDE.md defers to it. 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
--jsonmachine output for agents (Cobra + Charm v2 lipgloss). - MCP server —
cortex serve(stdio), a 17-toolagentprofile by default;--profile allexposes the full 24-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/ # 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
│ └── 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
│ ├── 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
│ ├── 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>/)
│ │ └── redact/ # secret-shape redaction (last-line filter before model output)
│ ├── mcp/server.go # stdio MCP server — THIN pass-through (17 agent / 24 all)
│ ├── 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
├── 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 CLAUDE.md CHANGELOG.md LICENSE
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.
- 3d ago First seen · 440 lines · 7,605 tokens per session scan A da5d55d4aae0
cortex AGENTS.md is an instructions file published in the GitHub repository abdul-hamid-achik/cortex (1 stars, last pushed 5d ago), licensed MIT. It adds 7,605 tokens to every session, about $0.0380 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
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
spec-kit AGENTS.md
AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
next.js AGENTS.md
Instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.