Rikugan: Instructions file for Codex

AGENTS.md

Rikugan AGENTS.md is an instructions file for Codex, OpenCode from buzzer-re/Rikugan. It costs 15,403 tokens per session, scanned A, original, MIT.

Project instructions for Rikugan, a reverse-engineering assistant that runs inside IDA Pro and Binary Ninja. Reverse engineering means examining compiled software to understand how it works.

In plain words
What is it for?
Use them when developing Rikugan's agent behavior, host integrations, streaming chat, sessions, subagents, or reverse-engineering workflows.
Why use it?
They explain the agent loop, exploration and planning modes, tool coordination, and project structure so changes fit the plugin's architecture.

Instructions file for CodexOpenCode

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

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

Reuse

Borrowing it

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

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

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

Your own site · 80×15
<a href="https://agentmods.dev/instructions/buzzer-re/rikugan/agents-md"><img src="https://agentmods.dev/badge/instructions/buzzer-re/rikugan/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 15,403 This file is loaded in full into every session.
When invoked 15,403 The same file — it is already loaded in full.
Security scan A 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.15403 $0.15403
Opus 5.5 $0.06161 $0.06161
Sonnet 5.5 $0.03081 $0.03081
Haiku 4.5 $0.01540 $0.01540

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

Security

Grade A, and why

Rikugan AGENTS.md scanned grade A 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 2d 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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

- Blocked patterns (subprocess, os.system, etc.) are rejected before reaching the approval step
AGENTS.md · 1,244 lines

How it starts

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

AGENTS.md — Rikugan Developer Guide

Project Overview

Rikugan (六眼) is a multi-host reverse-engineering agent plugin that integrates an LLM-powered assistant directly inside IDA Pro and Binary Ninja. It has its own agentic loop, in-process tool orchestration, streaming UI, multi-tab chat, session persistence, MCP client support, and host-native tool sets.

Directory Structure

rikugan/
├── agent/                    # Agent loop & prompt logic (host-agnostic)
│   ├── loop.py               # AgentLoop: generator-based turn cycle
│   ├── turn.py               # TurnEvent / TurnEventType definitions
│   ├── context_window.py     # Context-window management (threshold compaction)
│   ├── exploration_mode.py   # Exploration state machine (4 phases)
│   ├── mutation.py           # build_reverse_record, capture_pre_state, _KNOWN_IRREVERSIBLE
│   ├── plan_mode.py          # Plan-mode step orchestration
│   ├── subagent.py           # SubagentRunner — isolated AgentLoop for tasks
│   ├── system_prompt.py      # build_system_prompt() dispatcher
│   └── prompts/              # Host-specific system prompts
│       ├── base.py           # Shared prompt sections (discipline, renaming, etc.)
│       ├── ida.py            # IDA Pro base prompt
│       └── binja.py          # Binary Ninja base prompt
│
├── core/                     # Shared infrastructure (host-agnostic)
│   ├── artifacts.py          # Oversized tool output: head/tail rendering, artifact:// store
│   ├── chat_context.py       # Which chat the current tool call belongs to (context variable)
│   ├── config.py             # RikuganConfig — settings, provider config, paths
│   ├── constants.py          # Constants (CONFIG_DIR_NAME, etc.)
│   ├── errors.py             # Exception hierarchy (ToolError, AgentError, etc.)
│   ├── host.py               # Host context (BV, address, navigate callback)
│   ├── logging.py            # Logging utilities
│   ├── thread_safety.py      # Thread-safety helpers (@idasync, etc.)
│   ├── types.py              # Core data types (Message, ToolCall, StreamChunk, etc.)
│   └── workspace.py          # Path confinement for file tools, atomic writes, undo backups
│
├── ida/                      # IDA Pro host package
│   ├── tools/
│   │   └── registry.py       # IDA create_default_registry() — imports rikugan.tools.*
│   └── ui/
│       ├── panel.py          # IDA PluginForm wrapper
│       ├── actions.py        # IDA UI hooks & context menu actions
│       └── session_controller.py  # IDA SessionController
│
├── binja/                    # Binary Ninja host package
│   ├── tools/
│   │   ├── registry.py       # BN create_default_registry() — imports rikugan.binja.tools.*
│   │   ├── common.py         # BN shared helpers (get_bv, get_function_at, etc.)
│   │   ├── navigation.py     # Navigation tools
│   │   ├── functions.py      # Function listing/search tools
│   │   ├── strings.py        # String tools
│   │   ├── database.py       # Segments, imports, exports, binary info
│   │   ├── disassembly.py    # Disassembly tools
│   │   ├── decompiler.py     # Decompiler/HLIL tools
│   │   ├── xrefs.py          # Cross-reference tools
│   │   ├── annotations.py    # Rename/comment/set_type tools
│   │   ├── types_tools.py    # Struct/enum/typedef tools
│   │   ├── il.py             # IL core tools (get_il, get_il_block, nop_instructions, redecompile_function)
│   │   ├── il_analysis.py    # IL analysis tools (get_cfg, track_variable_ssa)
│   │   ├── il_transform.py   # IL transform tools (il_replace_expr, il_set_condition, il_nop_expr, patch_branch, etc.)
│   │   └── scripting.py      # execute_python tool
│   └── ui/
│       ├── panel.py          # BN QWidget panel
│       ├── actions.py        # BN action handlers
│       └── session_controller.py  # BN BinaryNinjaSessionController
│
├── tools/                    # IDA tool implementations
│   ├── base.py               # @tool decorator, ToolDefinition, JSON schema generation
│   ├── registry.py           # Shared ToolRegistry class
│   ├── navigation.py         # IDA navigation tools
│   ├── functions.py          # IDA function tools
│   ├── strings.py            # IDA string tools
│   ├── database.py           # IDA database tools (segments, imports, exports)
│   ├── disassembly.py        # IDA disassembly tools
│   ├── decompiler.py         # IDA decompiler tools (Hex-Rays)
│   ├── xrefs.py              # IDA xref tools
│   ├── annotations.py        # IDA annotation tools (rename, comment, set type)
│   ├── types_tools.py        # IDA type tools (structs, enums, typedefs, TILs)
│   ├── microcode.py          # IDA Hex-Rays microcode tools
│   ├── microcode_format.py   # Microcode formatting helpers
│   ├── microcode_optim.py    # Microcode optimizer framework
│   ├── scripting.py          # IDA execute_python tool
│   ├── filesystem.py         # read_file, write_file, edit_file (both hosts)
│   ├── file_search.py        # search_files: ripgrep or Python scan (both hosts)
│   └── shell.py              # run_shell (both hosts)
│
├── hosts/                    # Backward-compat shims → rikugan.ida.ui.* / rikugan.binja.ui.*
│
├── providers/                # LLM provider integrations (host-agnostic)
│   ├── base.py               # LLMProvider ABC
│   ├── registry.py           # ProviderRegistry
│   ├── anthropic_provider.py # Claude (Anthropic) — supports OAuth auto-detection
│   ├── openai_provider.py    # OpenAI
│   ├── gemini_provider.py    # Google Gemini
│   ├── ollama_provider.py    # Ollama (local)
│   ├── minimax_provider.py   # MiniMax (subclasses OpenAICompatProvider)
│   └── openai_compat.py      # OpenAI-compatible endpoints
│
├── mcp/                      # MCP client (host-agnostic)
│   ├── config.py             # MCP server config loader
│   ├── client.py             # MCP protocol client
│   ├── bridge.py             # MCP ↔ ToolRegistry bridge
│   ├── manager.py            # MCPManager — lifecycle management
│   └── protocol.py           # MCP JSON-RPC protocol types
│
├── skills/                   # Skill system (host-agnostic)
│   ├── registry.py           # SkillRegistry — discovery & loading
│   ├── loader.py             # SKILL.md frontmatter parser (mode field support)
│   └── builtins/             # 12 built-in skills
│       ├── malware-analysis/
│       ├── linux-malware/
│       ├── deobfuscation/
│       ├── vuln-audit/
│       ├── driver-analysis/
│       ├── ctf/
│       ├── generic-re/
│       ├── ida-scripting/    # IDAPython API skill with full reference
│       ├── binja-scripting/  # Binary Ninja Python API skill with full reference
│       ├── modify/           # Exploration mode: autonomous binary modification
│       ├── smart-patch-ida/  # IDA-specific binary patching workflow
│       └── smart-patch-binja/ # Binary Ninja-specific patching workflow
│
├── state/                    # Session persistence (host-agnostic)
│   ├── session.py            # SessionState — message history, token tracking
│   └── history.py            # SessionHistory — auto-save/restore per file
│
└── ui/                       # Shared UI widgets (Qt, host-agnostic)
    ├── panel_core.py         # PanelCore — multi-tab chat, export, mutation log, event routing
    ├── session_controller_base.py  # SessionControllerBase — multi-session, fork support
    ├── chat_view.py          # Chat message display widget (queued message support)
    ├── input_area.py         # User input text area with skill autocomplete
    ├── context_bar.py        # Binary context status bar
    ├── message_widgets.py    # Message bubble widgets (tool calls, exploration, approval)
    ├── tool_review.py        # What a tool call will do, laid out for review (diffs, code, not JSON)
    ├── code_view.py          # Read-only code display: syntax scanner, gutter, diff tints
    ├── mutation_log_view.py  # MutationLogPanel — mutation history with undo
    ├── markdown.py           # Markdown rendering for assistant messages
    ├── plan_view.py          # Plan-mode UI
    ├── settings_dialog.py    # Settings dialog (screen-aware sizing)
    ├── styles.py             # Qt stylesheet constants
    └── qt_compat.py          # Qt compatibility layer (PySide6)

Read the full file on GitHub · 1,244 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. 2d ago Changed · +36 lines · +1,292 tokens per session d4e197e7f96b
  2. 2mo ago First seen · 1,208 lines · 14,111 tokens per session scan A 4562c8cb4b39

Subscribe to this mod's changes

Rikugan AGENTS.md is an instructions file published in the GitHub repository buzzer-re/Rikugan (706 stars, last pushed 2d ago), licensed MIT. It adds 15,403 tokens to every session, about $0.0616 per session on Opus 5.5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Rikugan AGENTS.md compared with instructions from other repositories

Rikugan AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
Rikugan AGENTS.mdbuzzer-re/RikuganInstructions file7062d agoMITA15,403Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode