ai-memory: Instructions file for Codex

AGENTS.md

ai-memory AGENTS.md is an instructions file for Codex, OpenCode from hyxnj666-creator/ai-memory. It costs 4,126 tokens per session, scanned A, original, MIT.

Repository instructions for ai-memory, a Node.js command-line tool and MCP server that extracts knowledge from AI editor conversations and saves it as version-controlled Markdown files.

In plain words
What is it for?
Use them when modifying the CLI, MCP server, memory extraction, deduplication, editor integrations, scheduling, or memory-to-commit linking.
Why use it?
They provide the project’s architecture, naming constraints, supported editors, and current feature context before code changes are made.

Instructions file for CodexOpenCode

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

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

Reuse

Borrowing it

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

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 ai-memory AGENTS.md

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

Your own site · 80×15
<a href="https://agentmods.dev/instructions/hyxnj666-creator/ai-memory/agents-md"><img src="https://agentmods.dev/badge/instructions/hyxnj666-creator/ai-memory/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 4,126 This file is loaded in full into every session.
When invoked 4,126 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.04126 $0.04126
Opus 5.5 $0.01650 $0.01650
Sonnet 5.5 $0.00825 $0.00825
Haiku 4.5 $0.00413 $0.00413

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

Security

Grade A, and why

ai-memory 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 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.

Runs shell commandslowCapability

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

- **External-process pattern** — when a command shells out (`git`, `clip`, `xdg-open`, etc.), keep the parser pure and isolate `execFile` / `execSync` in a thin IO wrapper. Always set a bounded `timeout` and `maxBuffer`,
AGENTS.md · 182 lines

How it starts

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

AI Agent Instructions

This file is for AI coding assistants (Cursor, Claude Code, Codex, GitHub Copilot) working on the ai-memory codebase. Read this first before touching code.

Project Overview

ai-memory is a CLI tool + MCP server that extracts structured knowledge from AI editor conversations and saves it as git-trackable Markdown files. Targets Node.js >= 18.

  • npm package name: ai-memory-cli (DO NOT rename — see docs/decisions/2026-04-24-naming.md)
  • Binary name: ai-memory
  • GitHub owner: hyxnj666-creator
  • Current version: 2.5.0 (in tree; 2.4.0 last published on npm — see ROADMAP.md and CHANGELOG.md)
  • v2.5 features in tree: ai-memory try (no-key demo), rules --target skills (Anthropic Skills), --redact at LLM call sites, Codex CLI as 5th editor, CCEB v1.1 F1 64.1%, LongMemEval-50 adapter, README "1M-context FAQ", dedup quality improvements
  • v2.6 features in tree (also not yet on npm): ai-memory link (memory↔commit linking, weighted Jaccard scorer, <!--links> frontmatter), init --schedule (cross-platform daily cron: launchd/crontab/schtasks), single-chunk dedup fix + cross-type TODO subsumption (targets F1 75%+), dashboard graph enhancements (edge type differentiation, type filter toggles, hover highlight). Test suite 585.
  • Before publishing v2.5.0: read docs/v2.5-maintainer-handoff.md — two maintainer-only tasks remain (v2.5-03 marketplace submissions + v2.5-07 AGENTS.md downstream eval).
  • Runtime deps: @modelcontextprotocol/sdk (for serve) and zod (for bundle import validation). NO other runtime deps.

Architecture

src/
├── index.ts              # CLI entry, sets emitWarning filter, dispatches to commands
├── cli.ts                # Argument parser (manual, no library)
├── types.ts              # ALL shared types live here
├── config.ts             # Loads .ai-memory/.config.json
├── public.ts             # Library entry (exports for programmatic use)
├── commands/             # One file per CLI command (14 commands)
│   ├── extract.ts        # Orchestrates extraction pipeline
│   ├── list.ts           # Lists conversations with status
│   ├── search.ts         # Keyword + hybrid search
│   ├── recall.ts         # Git-history time-travel retrieval (v2.4) — uses git/log-reader
│   ├── rules.ts          # Exports rules: Cursor .mdc and/or AGENTS.md (--target, v2.4)
│   ├── resolve.ts        # Marks memories resolved/active
│   ├── summary.ts        # LLM-generated project summary (supports --source-id / --convo)
│   ├── context.ts        # Generates continuation prompt (supports --source-id / --convo)
│   ├── init.ts           # Project initialization
│   ├── reindex.ts        # Rebuild embeddings; --dedup retroactive cleanup (v2.2)
│   ├── watch.ts          # Auto-extract on conversation changes
│   ├── dashboard.ts      # Launch local web UI
│   ├── export.ts         # Portable JSON bundle (v2.3)
│   ├── import.ts         # Import portable JSON bundle (v2.3)
│   ├── doctor.ts         # Health check (runtime/editors/LLM/store/embeddings/MCP, v2.4)
│   ├── try.ts            # No-API-key demo: bundled scenario → AGENTS.md inline (v2.5-02)
│   └── link.ts           # Scan git commits → auto-link to memories (weighted Jaccard, v2.6)
├── sources/              # Conversation parsers (one per editor)
│   ├── cursor.ts         # ~/.cursor/projects/*/agent-transcripts/
│   ├── claude-code.ts    # ~/.claude/projects/*/*.jsonl
│   ├── windsurf.ts       # Windsurf state.vscdb (SQLite via node:sqlite, Node 22+)
│   ├── copilot.ts        # VS Code chatSessions/*.json
│   └── detector.ts       # Auto-detects available sources
├── extractor/
│   ├── ai-extractor.ts   # Chunking, LLM calls, dedup, quality filter
│   ├── llm.ts            # OpenAI-compatible API client with retry + concurrency
│   └── prompts.ts        # All LLM prompts + buildDirectContext
├── embeddings/           # Semantic search (v2.0 phase 2)
│   ├── embed.ts          # Embedding API client
│   ├── vector-store.ts   # Flat-file .embeddings.json
│   ├── indexer.ts        # Auto-index on `remember`
│   └── hybrid-search.ts  # Semantic + keyword + time decay
├── mcp/                  # MCP server (v2.0 phase 1) + config writer (v2.4)
│   ├── server.ts         # stdio transport, handler wiring
│   ├── tools.ts          # remember / recall / search_memories tools
│   ├── resources.ts      # project-context resource
│   └── config-writer.ts  # idempotent merge into .cursor/mcp.json + .windsurf/mcp.json (init --with-mcp)
├── rules/                # Multi-target rules export (v2.4)
│   └── agents-md-writer.ts  # Pure idempotent merge into AGENTS.md (managed-section markers)
├── git/                  # Thin wrappers around the user's `git` binary (v2.4)
│   └── log-reader.ts     # parseGitLog / parseBulkLog (pure) + isGitRepo / getFileHistory / getRecentCommits / isPathTracked (execFile)
├── dashboard/            # Local web UI (v2.1)
│   ├── server.ts         # node:http API (/api/stats, /api/memories, /api/conversations, /api/quality, /api/graph)
│   └── html.ts           # Embedded SPA (Tailwind + D3.js)
├── bundle/               # Portable export/import (v2.3)
│   └── bundle.ts         # Versioned JSON schema v1 + Zod validation
├── store/
│   ├── memory-store.ts   # Read/write Markdown memory files
│   └── state.ts          # Tracks which conversations were processed
├── output/
│   └── terminal.ts       # ANSI colors (respects NO_COLOR), formatting
└── utils/
    ├── author.ts         # Author resolution: CLI > config > git > OS
    └── scheduler.ts      # Cross-platform scheduled-task registration (launchd/crontab/schtasks, v2.6)

bench/
└── cceb/                 # Cursor Conversation Extraction Benchmark (v2.4)
    ├── types.ts          # Pure types: Fixture / ExpectedMemory / Scorecard
    ├── scorer.ts         # Pure scoring (greedy keyword match → P/R/F1) + Markdown render
    ├── loader.ts         # Read + validate fixtures/*.json (hand-rolled, no Zod)
    ├── runner.ts         # Glue: fixture → real extractMemories() → scoreFixture
    ├── run.ts            # CLI entry (`tsx bench/cceb/run.ts [--dry-run] [--filter ...]`)
    ├── fixtures/         # 9 hand-curated annotated conversations (5 types + CJK + 2 noise)
    └── README.md         # Methodology + how to author fixtures

docs/assets/demo/        # Hero GIF source of truth (v2.4) — vhs-rendered, deterministic
├── demo.tape            # 5-frame ≈30s vhs cassette (rendered by `npm run demo:render`)
├── scenario/            # Hand-curated .ai-memory/ store the cassette runs against
│   └── .ai-memory/      # 1 decision + 1 convention + 1 architecture, 2 authors, English-pinned
├── RECORDING.md         # Install matrix (macOS / Linux / Windows / Docker) + pre-commit checklist
└── demo.gif             # Rendered output — committed by maintainer, not CI

Read the full file on GitHub · 182 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 First seen · 182 lines · 4,126 tokens per session scan A cb7635877738

Subscribe to this mod's changes

ai-memory AGENTS.md is an instructions file published in the GitHub repository hyxnj666-creator/ai-memory (44 stars, last pushed 5mo ago), licensed MIT. It adds 4,126 tokens to every session, about $0.0165 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

Other instructions, from other repositories