heimdall: Instructions file for Codex

AGENTS.md

heimdall AGENTS.md is an instructions file for Codex, OpenCode from ArihantDeva/heimdall. It costs 3,458 tokens per session, scanned A, original, MIT.

Repository instructions for Heimdall, a knowledge system for coding agents that records project information and labels search results by trust and freshness. It also describes the command-line tools, background processes and stored runtime data.

In plain words
What is it for?
They help agents understand Heimdall's search-before-implementation workflow, knowledge graph, trust labels, command-line entry points and background reconciliation process.
Why use it?
Agents can act on outdated files or unreliable search matches, especially as a project changes. These instructions explain the checks and data locations used to find and verify current knowledge.

Instructions file for CodexOpenCode

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

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

Not installable: its command points at a path on the author’s own machine, so it runs nowhere else. The line is /Users/arihantdeva/Repos/heimdall.

Reuse

Borrowing it

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

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

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

Your own site · 80×15
<a href="https://agentmods.dev/instructions/arihantdeva/heimdall/agents-md"><img src="https://agentmods.dev/badge/instructions/arihantdeva/heimdall/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 3,458 This file is loaded in full into every session.
When invoked 3,458 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.03458 $0.03458
Opus 5.5 $0.01383 $0.01383
Sonnet 5.5 $0.00692 $0.00692
Haiku 4.5 $0.00346 $0.00346

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

Security

Grade A, and why

heimdall 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 · 115 lines

How it starts

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

AGENTS.md — Heimdall (working guide for AI agents)

Purpose (one line)

Heimdall is a trust-verified, self-healing knowledge layer for AI coding agents: it watches what an agent does, keeps a semantic-memory graph fresh across every project, and labels every search hit with a trust verdict (STRONG / WEAK / STALE) so an agent never acts on a dead path or a hallucinated match. It is the code behind the "kb_search before implementing" hard gate and the ~/knowledge-base/Graft machinery the harness rules reference.

The vendor repo lives at /Users/arihantdeva/Repos/heimdall; live runtime state lives OUTSIDE the repo under ~/.heimdall/ (journal, lock, hint queue, config) and ~/.graft/ (backend daemon + its sqlite DB), plus the ~/knowledge-base/ TSV/telemetry/stale logs. The repo is the engine; the home-dir files are the data.

Structure map

Path Role
bin/heimdall.js npm CLI entrypoint — thin dispatch to bin/lib/cli-main.mjs
bin/lib/cli-main.mjs CLI dispatch + init/insert/hint/verify/depth implementations
bin/heimdall-reconciler.mjs the single writer daemon: watch + hint ingest + drain + periodic audit
bin/lib/journal.mjs authoritative index: sqlite (node:sqlite) — paths, owned nodes/edges, pending edges, dedup queue, generations
bin/lib/reconcile.mjs level-triggered convergence: read disk, make graph match; audit() = drift detector
bin/lib/extract.mjs desired state per file: hash + L0-L3 node/edge extraction, node-id namespacing, tree-sitter bridge
bin/lib/heimdall_extract.py Python bridge: calls graphify per-language extractors directly (never graphify.extract())
bin/lib/depth.mjs depth ladder (path/file/symbol/graph), capability probe, config, root matching
bin/lib/lock.mjs O_EXCL single-writer lock with stale-PID reclamation
bin/lib/hints.mjs the only channel a non-writer may use: append "look at this path" lines
bin/lib/sink.mjs projection targets: MemorySink (tests) and GraftSink (graft CLI)
bin/lib/adapters.mjs heimdall init --harness X config writers (pi, claude-code, codex, cursor, opencode, gemini-cli, deepseek)
bin/kb-search.sh ranked search: graft retrieve + verify + graft explore walk
bin/kb_search_verify.py path extraction for stale-node rehoming (extract_paths); the retired CLI/verdict path is gone
bin/kb-stale-scan.py full-graph stale sweep: rehome via kb-rehome.sh or log+delete
bin/kb-rehome.sh deterministic rehome of a stale node (bounded basename search)
bin/kb-health.sh heimdall doctor: daemon up, CLI responsive, search smoke, inventory freshness
bin/kb-rebuild.sh full graph rebuild: backup → wipe → parallel restore → re-seed → prune → verify
bin/seed-graft.sh load ~/knowledge-base/.inventory.tsv into Graft (idempotent)
bin/sync-edits.sh one-shot bootstrap: replay Pi session edit logs (write/edit/hashline_edit) as hints
bin/telemetry.sh collect/view/usage — nodes/day, sync age, kb_* tool-call counts
extensions/kb-tools.ts Pi extension: exposes kb_search/kb_insert/kb_sync agent tools
extensions/kb-autosync.ts Pi extension: hook that appends path hints (never writes the graph)
extensions/kb-orient.ts Pi extension: injects prior-work hits into the first user prompt of a session
extensions/kb-search-guard.ts Pi extension: warns/escalates/blocks only on UNscoped discovery chains; agent-callable kb_guard_pause suspends enforcement 1–20 turns
extensions/lib/kb-guard-core.mjs pure guard state machine (testable without the Pi runtime)
vendor/graphify/ vendored graphify v0.3.17 (MIT) — per-repo code-graph extractors (tree-sitter)
vendor/graft/ vendored Graft source (Apache 2.0) — backend daemon; not prebuilt, build from source
config/heimdall.yaml.example example backend config → copy to ~/.graft/config.yaml
launchd/com.heimdall.backend.plist.example launchd template for graftd
docs/adapters.md what each heimdall init --harness X installs
docs/heimdall_compare.{dot,png} graphify vs Graft vs Heimdall positioning diagram
types/pi-coding-agent.d.ts minimal type stub of the Pi host API so extensions typecheck standalone
tests/*.test.mjs node:test suites (44 tests)
.pi-subagents/ subagent run artifacts (input/output/transcripts/meta) — gitignored, historical record

Read the full file on GitHub · 115 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 · -28 tokens per session 7abb1b72093d
  2. 1mo ago Changed · +19 tokens per session ba410197ad96
  3. 1mo ago First seen · 115 lines · 3,467 tokens per session scan A 9409c6904e04

Subscribe to this mod's changes

heimdall AGENTS.md is an instructions file published in the GitHub repository ArihantDeva/heimdall (136 stars, last pushed today), licensed MIT. It adds 3,458 tokens to every session, about $0.0138 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-30.

Related

Other instructions, from other repositories