ai-memex-cli AGENTS.md

Repository guidance for ai-memex-cli, a command-line tool for building and maintaining a lasting knowledge wiki for language models. It describes the project, code rules, technologies, and file layout.

In plain words
What is it for?
Use it when asking an agent to work on ai-memex-cli, including its commands, TypeScript modules, tests, builds, or file structure.
Why use it?
It gives coding agents the project context and conventions they need before changing the code. This reduces guesses about how the repository is organized or how code should be written.

Instructions file for CodexOpenCode

Install

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.

agentmods
npx agentmods add instructions/zelixag/ai-memex-cli/agents-md
Clone the repo
git clone --depth 1 https://github.com/zelixag/ai-memex-cli

Made for: Codex, OpenCode.

Per session 2,380 This file is loaded in full into every session.
When invoked 2,380 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.02380 $0.02380
Opus 5 $0.01190 $0.01190
Sonnet 5 $0.00476 $0.00476
Haiku 4.5 $0.00238 $0.00238

Measured 2d ago against content hash 8922dba70963, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ai-memex-cli 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 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.

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 · 174 lines

How it starts

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

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

项目概述

ai-memex-cli(命令名 memex)是一个用于构建和维护持久化 LLM wiki 的 CLI 工具。它的核心定位是“机械层”:只做文件操作、frontmatter 校验、关键词匹配、链接检查等纯机械工作;所有语义决策(写什么内容、如何综合知识)都交给外部 LLM agent 通过 shell 调用来完成。

技术栈

  • 运行时:Node.js >= 20
  • 语言:TypeScript 5.4(严格模式 strict: true
  • 模块系统:ES Modules("type": "module"),内置模块导入需带 node: 前缀
  • CLI 框架cac
  • 测试框架vitestglobals: trueenvironment: 'node'
  • 依赖库gray-matterchokidarpicocolors
  • 包管理器:pnpm
  • 构建工具tsc 直接编译,输出到 dist/

编码规范

  • 文件命名:命令文件使用 kebab-case(如 link-check.ts),模块文件使用 camelCase(如 wiki-index.ts
  • 导出约定:每个命令文件导出 *Command 异步函数(如 distillCommand);核心模块导出具体函数而非默认导出
  • 类型命名:接口/类型使用 PascalCase(如 DistillOptionsWikiPage
  • 导入顺序:Node 内置模块(带 node: 前缀)→ 第三方依赖 → 项目内部模块
  • 路径风格:内部统一使用正斜杠(/),normalizePath() 处理 Windows 反斜杠
  • 禁止项:禁止引入与现有设计重复的大型框架

项目结构

src/
  cli.ts              # CLI 入口,使用 cac 注册所有命令
  commands/           # 各命令实现(init、distill、ingest、watch、glob、inject、lint、search、new、log、install-hooks、status、link-check)
  core/               # 核心领域逻辑(无 side effect 的纯函数优先)
    vault.ts          # Vault 路径解析
    config.ts         # 配置读写(~/.llmwiki/config.json)
    schema.ts         # Frontmatter 解析与校验
    wiki-index.ts     # Wiki 页面索引构建、[[link]] 提取
    globber.ts        # 关键词评分与页面筛选
    linker.ts         # 孤儿页、断链检测
    distiller.ts      # JSONL 解析与机械提取
    injector.ts       # @include 指令解析
  utils/
    fs.ts             # 文件系统封装(readFileUtf8、writeFileUtf8、listMarkdownFiles 等)
    exec.ts           # 子进程调用封装
    logger.ts         # 终端日志(info / success / warn / error)
templates/            # AGENTS.md 与 wiki 页面模板(concept、entity、source、summary)
tests/
  core/               # 核心模块单元测试
  fixtures/
    mock-vault/       # 完整 mock vault 结构,供测试使用
docs/                 # PRD 与设计文档
dist/                 # tsc 编译输出(.gitignore 忽略)

Vault 目录规范

Vault 分两层:默认 wiki(~/.llmwiki/,旧版可能仍为 ~/.llmwiki/global/)与 local(<project>/.llmwiki/local/)。所有路径在 CLI 内部统一归一化为正斜杠。

Read the full file on GitHub · 174 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 First seen · 174 lines · 2,380 tokens per session scan A 8922dba70963

Subscribe to this mod's changes

ai-memex-cli AGENTS.md is an instructions file published in the GitHub repository zelixag/ai-memex-cli (9 stars, last pushed 3mo ago), licensed MIT. It adds 2,380 tokens to every session, about $0.0119 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.