agentleFS
GeoloeG-IsTGeoloeG-IsT/agents-reverse-engineer/hooks/AGENTS.md

agents-reverse-engineer / hooks

AGENTS.md20 starsChanged 10 months agoMITView on GitHub

Runtime integration layer providing background update checks and context injection hooks for Claude Desktop and OpenCode editors. Claude/Gemini hooks ship as .mjs so Node always parses them as ES modules, regardless of any "type": "commonjs" in the nearest package.json (e.g. .claude/package.json written by get-shit-done). OpenCode plugins stay .js. Hooks execute as extension points in editor lifecycles: 1. SessionStart/session.created: are-check-update.mjs and opencode-are-check-update.js fire asynchronous npm version checks on session initialization 2. PostToolUse: are-context-loader.mjs intercepts file read operations, traverses directories upward to…

The file

Files
AGENTS.md
<!-- Generated by agents-reverse-engineer v1.2.8 -->

hooks

Runtime integration layer providing background update checks and context injection hooks for Claude Desktop and OpenCode editors.

Contents

are-check-update.mjs

SessionStart hook that spawns detached child process via spawn(process.execPath, ['-e', inlineScript]) to check npm view agents-reverse-engineer version and cache results to ~/.claude/cache/are-update-check.json.

are-context-loader.mjs

PostToolUse hook (matcher Read|Edit|Write|MultiEdit|NotebookEdit|Bash|Agent|Task) that derives start directories from tool_input.file_path/notebook_path or scans them out of Bash command and Agent/Task prompt/description strings, walks each directory tree up to data.cwd, loads ARE-generated AGENTS.md files parent-first, and injects them as additionalContext with session-scoped deduplication via ${os.tmpdir()}/are-context-loader/${session_id}.json.

opencode-are-check-update.js

OpenCode plugin exporting AreCheckUpdate(ctx) factory triggering on session.created events, checks ~/.config/opencode/ARE-VERSION files, spawns background npm version check to ~/.config/opencode/cache/are-update-check.json.

Architecture

Claude/Gemini hooks ship as .mjs so Node always parses them as ES modules, regardless of any "type": "commonjs" in the nearest package.json (e.g. .claude/package.json written by get-shit-done). OpenCode plugins stay .js.

Hooks execute as extension points in editor lifecycles:

  1. SessionStart/session.created: are-check-update.mjs and opencode-are-check-update.js fire asynchronous npm version checks on session initialization
  2. PostToolUse: are-context-loader.mjs intercepts file read operations, traverses directories upward to inject relevant AGENTS.md documentation

File Relationships

  • are-check-update.mjs targets Claude Desktop SDK SessionStart event, reads .claude/ARE-VERSION files
  • opencode-are-check-update.js implements OpenCode plugin contract, reads .opencode/ARE-VERSION and ~/.config/opencode/ARE-VERSION files
  • are-context-loader.mjs depends on PostToolUse event payloads containing data.cwd plus either tool_input.file_path/notebook_path or scannable tool_input.command (Bash) / tool_input.prompt (Agent, Task) text

Both update checkers use identical cache format: {update_available: boolean, installed: string, latest: string, checked: number}.

Behavioral Contracts

Process spawning

spawn(process.execPath, ['-e', inlineScript], {
  stdio: 'ignore',
  detached: true,
  windowsHide: true
})

Version check command

execSync('npm view agents-reverse-engineer version', {timeout: 10000})

AGENTS.md marker detection

content.includes("Generated by agents-reverse-engineer")

Context output format

## ARE Context: {relDir}/AGENTS.md

{content}

Hook response schema

{
  "suppressOutput": false,
  "hookSpecificOutput": {
    "hookEventName": "PostToolUse",
    "additionalContext": "string"
  }
}

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.