Generate Project Memory
Purpose
Create a compact, durable Markdown memory file that future agents can read before working on the project. The memory should capture stable facts, conventions, workflows, and known caveats rather than a one-time task summary.
Default Location
Prefer the global memory folder:
~/.codex/project-memory/
Use ~/.codex/project-memory/index.md as an index when it exists or when creating the first memory file. Name project files with lowercase hyphen-case, such as mic-esp32.md or home-assistant-ai-agent.md.
If the user explicitly asks for a project-local file, write to a local path such as AGENT_MEMORY.md or docs/agent-memory.md.
Workflow
Identify the project root.
- Use the current working directory by default.
- Prefer the Git root when inside a Git repository.
- Record the absolute path and repository remote if available.
Inspect project facts.
- Read lightweight metadata first:
AGENTS.md, README*, package manifests, build files, config files, CI files, docs indexes, and source tree names.
- Use
rg --files for file discovery.
- Avoid reading large generated outputs, dependency folders, build artifacts, binary files, secrets, credentials, and
.env files.
Run the helper script when useful.
- Use
uv run <skill-dir>/scripts/scan_project_memory.py --project <path> --out <draft.md>.
- The script produces a draft from filesystem and Git metadata; review and improve it before presenting it as final.
Write or update the memory file.
- Preserve still-valid information from an existing memory file.
- Remove stale claims when the codebase contradicts them.
- Mark uncertain items as
Needs verification instead of guessing.
- Keep the final memory concise enough to be read at the start of future tasks.
Update the index.
- If writing under
~/.codex/project-memory/, ensure index.md links the project name, path, and memory file.
- Do not duplicate the whole memory in the index.
Memory File Shape
Use this structure unless the project suggests something better:
# Project Memory: <project name>
Last updated: YYYY-MM-DD
Project path: /absolute/path
Repository: <remote or "not detected">
## What This Project Is
- Stable one-paragraph description.
## How To Work Here
- Build, test, lint, run, and deploy commands.
- Required environment assumptions.
## Architecture Notes
- Main directories and responsibilities.
- Important data flows or integration points.
## Conventions
- Coding style, framework patterns, naming, branch/test habits.
- Instructions from AGENTS.md or other local guidance.
## Known Risks And Caveats
- Fragile areas, generated files, hardware/service assumptions, migration traps.
## Useful Entry Points
- Key files with short reasons.
## Open Questions
- Things future agents should verify before relying on them.
Quality Bar
- Prefer facts that will still matter weeks from now.
- Do not include secrets, tokens, private keys, cookies, personal email contents, or raw credentials.
- Do not over-index on file listings; explain why files matter.
- Include exact commands only when discovered from project files or verified locally.
- If tests or commands were not run, say so in the memory or final response.
- Keep generated memory readable by another agent in under two minutes.
1---2name: generate-project-memory3description: Generate or update a durable project memory file for the current repository or workspace. Use when the user asks Codex to create project memory, summarize a codebase for future agents, capture repository conventions, write a memory file under ~/.codex/project-memory, refresh an existing project notes file, or preserve important context across projects.4---56# Generate Project Memory78## Purpose910Create a compact, durable Markdown memory file that future agents can read before working on the project. The memory should capture stable facts, conventions, workflows, and known caveats rather than a one-time task summary.1112## Default Location1314Prefer the global memory folder:1516```text17~/.codex/project-memory/18```1920Use `~/.codex/project-memory/index.md` as an index when it exists or when creating the first memory file. Name project files with lowercase hyphen-case, such as `mic-esp32.md` or `home-assistant-ai-agent.md`.2122If the user explicitly asks for a project-local file, write to a local path such as `AGENT_MEMORY.md` or `docs/agent-memory.md`.2324## Workflow25261. Identify the project root.27 - Use the current working directory by default.28 - Prefer the Git root when inside a Git repository.29 - Record the absolute path and repository remote if available.30312. Inspect project facts.32 - Read lightweight metadata first: `AGENTS.md`, `README*`, package manifests, build files, config files, CI files, docs indexes, and source tree names.33 - Use `rg --files` for file discovery.34 - Avoid reading large generated outputs, dependency folders, build artifacts, binary files, secrets, credentials, and `.env` files.35363. Run the helper script when useful.37 - Use `uv run <skill-dir>/scripts/scan_project_memory.py --project <path> --out <draft.md>`.38 - The script produces a draft from filesystem and Git metadata; review and improve it before presenting it as final.39404. Write or update the memory file.41 - Preserve still-valid information from an existing memory file.42 - Remove stale claims when the codebase contradicts them.43 - Mark uncertain items as `Needs verification` instead of guessing.44 - Keep the final memory concise enough to be read at the start of future tasks.45465. Update the index.47 - If writing under `~/.codex/project-memory/`, ensure `index.md` links the project name, path, and memory file.48 - Do not duplicate the whole memory in the index.4950## Memory File Shape5152Use this structure unless the project suggests something better:5354```markdown55# Project Memory: <project name>5657Last updated: YYYY-MM-DD58Project path: /absolute/path59Repository: <remote or "not detected">6061## What This Project Is62- Stable one-paragraph description.6364## How To Work Here65- Build, test, lint, run, and deploy commands.66- Required environment assumptions.6768## Architecture Notes69- Main directories and responsibilities.70- Important data flows or integration points.7172## Conventions73- Coding style, framework patterns, naming, branch/test habits.74- Instructions from AGENTS.md or other local guidance.7576## Known Risks And Caveats77- Fragile areas, generated files, hardware/service assumptions, migration traps.7879## Useful Entry Points80- Key files with short reasons.8182## Open Questions83- Things future agents should verify before relying on them.84```8586## Quality Bar8788- Prefer facts that will still matter weeks from now.89- Do not include secrets, tokens, private keys, cookies, personal email contents, or raw credentials.90- Do not over-index on file listings; explain why files matter.91- Include exact commands only when discovered from project files or verified locally.92- If tests or commands were not run, say so in the memory or final response.93- Keep generated memory readable by another agent in under two minutes.