ai-memex-cli CLAUDE.md

ai-memex-cli CLAUDE.md is an instructions file for coding agents from zelixag/ai-memex-cli. It costs 2,818 tokens per session, scanned A, original, MIT.

Project instructions for ai-memex-cli, a command-line tool for maintaining a persistent LLM wiki—a knowledge base that an AI updates over time.

In plain words
What is it for?
Use them when developing or reviewing ai-memex-cli, especially its wiki files, command-line features, TypeScript code, and tests.
Why use it?
They give an agent the project's purpose, technology choices, file structure, and coding conventions before it changes the code.

Instructions file

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/claude-md
Clone the repo
git clone --depth 1 https://github.com/zelixag/ai-memex-cli

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-memex-cli CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/zelixag/ai-memex-cli/claude-md.svg)](https://agentmods.dev/instructions/zelixag/ai-memex-cli/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/zelixag/ai-memex-cli/claude-md"><img src="https://agentmods.dev/badge/instructions/zelixag/ai-memex-cli/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 2,818 This file is loaded in full into every session.
When invoked 2,818 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.02818 $0.02818
Opus 5 $0.01409 $0.01409
Sonnet 5 $0.00564 $0.00564
Haiku 4.5 $0.00282 $0.00282

Measured 4d ago against content hash 9a8d77d11b61, 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 CLAUDE.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 4d 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.

CLAUDE.md · 187 lines

How it starts

The opening of the file, as written. The whole thing — 187 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 调用来完成。

核心理念(区别于 RAG):wiki 是 compounding artifact(累积产物),不是查询时即兴重组的检索结果。LLM 在 ingest 时把新源整合进现有 wiki(更新 entity/concept 页、修订 summary、标注矛盾),知识编译一次后持续保持现行;查询时不再从零拼接。Agent 拥有 wiki/——人几乎不手写 wiki,LLM 写并维护交叉引用、矛盾标注、综合页;CLI 守住 raw/ 的不可变性与机械正确性。该模式源自 Karpathy 的 LLM Wiki pattern,精神承自 Vannevar Bush 的 Memex(1945)。

技术栈

  • 运行时: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 忽略)

Read the full file on GitHub · 187 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. 4d ago First seen · 187 lines · 2,818 tokens per session scan A 9a8d77d11b61

Subscribe to this mod's changes

ai-memex-cli CLAUDE.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,818 tokens to every session, about $0.0141 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.