Quick answer: cd into the folder where your notes already live and let Codex build the map:

codex "Read this folder. Build wiki/index.md: group related files, link
them with relative paths, and describe what each cluster is for. Add topic
pages under wiki/ if the index gets long. Never move, rename, or rewrite
my files."

Codex treats the folder you launch it in as its workspace — the default permissions let it read everything there and write the wiki/ pages, no flags needed. (The full access model, including custom permission profiles, is in the Codex local-files guide.)

This is the Codex edition of the same pattern as the Claude Code second brain: raw notes stay untouched, a wiki/ of generated Markdown pages sits on top, and an agent — not a RAG pipeline — keeps the pages linked and current. Both guides work on the same folder; the pattern doesn’t care which agent runs it.

Put the contract in AGENTS.md

Codex reads AGENTS.md from the workspace at the start of a session — that’s where the rules live so you never repeat them:

# AGENTS.md
- wiki/ is yours: create, edit, reorganize freely.
- Everything else is mine: read it, link to it, never edit it.
- Keep wiki/index.md under one screen; split topic pages instead.

Since version 2.1.277, Claude Code reads the same AGENTS.md when the folder has no CLAUDE.md, so this one file covers both agents.

Three rules keep the thing from rotting: sources are read-only (one session that “reorganizes” your notes is how people quit), the wiki is disposable (it’s derived — regenerate it when it drifts), and you re-run on a schedule (codex "Update wiki/ for anything added or changed this week.").

Where the DIY version stops

Same four walls as with any coding agent, usually hit around week two:

  1. Search is grep. Codex finds what shares your wording — “that argument about switching costs” finds nothing if your note says “lock-in.”
  2. Non-text is invisible. PDFs, DOCX, screenshots, and recordings sit in the folder contributing nothing.
  3. Every session starts cold. The tree gets re-read each time; big folders burn context before your question.
  4. Agents don’t share. Run Claude Code on the same folder and it starts from zero — files transfer, understanding doesn’t.

The shared index

Codex is an MCP client, so the fix for all four is the same one: hand it a library that’s already searchable. StashBase indexes the folder in place (extracted text for PDFs and DOCX, OCR for images; recordings aren’t transcribed), keeps keyword plus semantic search current, and serves it over MCP — so Codex, Claude Code, and any other MCP client query one shared brain instead of each re-reading the folder. The Codex config is two lines of config.toml; the app is a free download.

Either way, start the same place: one folder, one prompt, one AGENTS.md.