Best Project Memory
Mission
Maintain a lightweight, repo-native continuity layer that another Codex session can reload quickly.
Prefer filesystem truth over chat memory. Keep the memory compact, current, and handoff-ready.
Core Storage
Use .codex-memory/ in the current repository root.
Always maintain these core files:
.codex-memory/project-state.md
.codex-memory/session-log.md
.codex-memory/decisions.md
.codex-memory/todo.md
Use these optional directories when the work justifies them:
.codex-memory/phases/
.codex-memory/handoffs/
.codex-memory/workstreams/
.codex-memory/snapshots/
Read references/state-schema.md before creating or restructuring the files.
Read references/surface-contract.md before changing the memory surface or deciding which objects are script-owned.
Required Workflow
Restore context before project work.
- Ensure
.codex-memory/ exists.
- Read the four core files when they exist.
- If phase or handoff docs exist and are obviously relevant, read only the needed ones.
- Give a short loaded-context recap covering objective, phase, active TODOs, latest decisions, and blockers.
- For concrete project delivery work, establish the milestone execution contract before implementation starts.
Establish a milestone execution contract for production work.
- Use a milestone as the current-session scope container. It must deliver at least one of: user capability, release gate closure, core architecture boundary, or blocking defect fix.
- Classify discovered work before editing:
P0: delivery blockers, severe bugs, security issues, build failures.
P1: required current-milestone functionality, tests, or refactors.
P2/P3: optimizations, enhancements, and long-term maintenance. Route these to backlog only.
Manual-required: external accounts, certificates, signing, notarization, real devices, production secrets, or third-party permissions.
- Output and then obey this Step 0 contract:
Milestone:
Goal:
P0/P1 scope:
Out-of-scope P2/P3:
Manual-required:
Phase limit:
Phase split:
Acceptance criteria:
Stop conditions:
- Freeze scope after the contract. Expand only for a true P0/P1 blocker.
- Default to at most 3 phases; use at most 5 only for genuinely complex milestones.
- Make each phase a deliverable closure around feature, architecture, defect fix, test gate, build chain, permission path, or release gate. Do not create phases for single files, fields, scripts, evidence snippets, or standalone paperwork.
- Stop after the milestone's P0/P1 work passes necessary verification. Do not automatically open the next milestone.
Keep the state panel current.
- Treat
project-state.md as the single current snapshot.
- Overwrite only the live summary content there.
- Keep it concise and operational.
- Push workstream-level detail down into
workstreams/*.md instead of bloating the global state.
Append session history.
- Add a new entry to
session-log.md after meaningful progress, at session close, or when the user asks to save progress.
- Do not rewrite old session entries unless correcting obvious factual mistakes.
Record important decisions.
- Add ADR-lite entries to
decisions.md for meaningful choices, tradeoffs, or policy changes.
- Include rationale and impact, not just the conclusion.
Maintain actionable TODO state.
- Keep
todo.md focused on active work.
- Mark completed items done instead of deleting them.
- Move stale or obsolete items only when their status is clear.
- Do not promote backlog items into new phases unless they block the current milestone's P0/P1 acceptance criteria.
- Record
Manual-required gaps with impact and validation entrypoint, but do not create development phases for them unless they materially shorten current-milestone verification.
Summarize completed phases and milestone stops.
- After each phase, record completed content, validation, review score/status, key decisions, new backlog, manual-required gaps, and remaining phase budget.
- When stop conditions are met, write a milestone delivery summary or a manual-attention report. Do not continue into polish, extra evidence, or unrelated TODO cleanup after the stop condition is satisfied.
Create handoff artifacts when the work spans sessions or people.
- Use
handoffs/ for compact continuation packs.
- Use
phases/ for milestone summaries.
- Use
workstreams/ for bounded parallel tracks inside larger projects.
- Use
snapshots/ for machine-oriented evidence captures.
- Read
references/handoff-patterns.md before writing a new handoff file.
Update Policy
Read references/update-policy.md before deciding where new information belongs.
Read references/update-triggers.md when deciding what kind of event should create a state update, promotion, or compaction step.
Use this routing rule:
- Current snapshot:
project-state.md
- Time-ordered work record:
session-log.md
- Durable choice with rationale:
decisions.md
- Action queue:
todo.md
- Milestone recap:
phases/*.md
- Session transfer pack:
handoffs/*.md
- Parallel task state:
workstreams/*.md
- Evidence snapshot:
snapshots/*
Do not dump everything into session-log.md.
Deterministic Helpers
Use the helper scripts when they reduce repeated hand editing:
scripts/init_memory.py: initialize .codex-memory/ with the standard files and optional phase/handoff directories
scripts/append_session.py: append a structured session entry to session-log.md
scripts/handoff_pack.py: generate a compact handoff file from the current memory snapshot
scripts/compact_session.py: compact older session-log.md history into a shorter summary and optional phase recap
Resolve script paths relative to this skill directory. For a user-scope install, they are usually under $HOME/.agents/skills/best-project-memory/scripts/.
Reference Routing
references/state-schema.md: read before creating or normalizing memory files
references/surface-contract.md: read before changing structure, ownership, or script write boundaries
references/update-policy.md: read before deciding what to update
references/update-triggers.md: read when mapping work events to memory actions
references/quality-rules.md: read when checking whether the memory has drifted into low-quality patterns
references/integration-patterns.md: read when another skill should consume or update this memory model
references/examples.md: read when you want concrete memory-entry examples
references/handoff-patterns.md: read before writing handoff or phase summaries
Load only the references needed for the current task.
Completion Standard
A project-memory pass is complete only when:
- the repo memory folder exists or has been intentionally confirmed unnecessary
- concrete project work has a visible milestone contract or an explicit reason it is unnecessary
- current objective, phase, blockers, and next step are easy to find
- durable decisions are captured with rationale
- TODOs reflect the real state of work
- another Codex session could resume without rereading the whole conversation
1---2name: best-project-memory3description: Use when restoring project context at the start of repo work, maintaining durable project memory across sessions, recording decisions, updating task state, preparing handoffs, or saving progress into repo-native memory files. Especially useful when users ask to continue previous work, save progress, summarize current state, capture decisions, or make another agent session resume cleanly.4---56# Best Project Memory78## Mission910Maintain a lightweight, repo-native continuity layer that another Codex session can reload quickly.1112Prefer filesystem truth over chat memory. Keep the memory compact, current, and handoff-ready.1314## Core Storage1516Use `.codex-memory/` in the current repository root.1718Always maintain these core files:1920- `.codex-memory/project-state.md`21- `.codex-memory/session-log.md`22- `.codex-memory/decisions.md`23- `.codex-memory/todo.md`2425Use these optional directories when the work justifies them:2627- `.codex-memory/phases/`28- `.codex-memory/handoffs/`29- `.codex-memory/workstreams/`30- `.codex-memory/snapshots/`3132Read `references/state-schema.md` before creating or restructuring the files.33Read `references/surface-contract.md` before changing the memory surface or deciding which objects are script-owned.3435## Required Workflow36371. Restore context before project work.38 - Ensure `.codex-memory/` exists.39 - Read the four core files when they exist.40 - If phase or handoff docs exist and are obviously relevant, read only the needed ones.41 - Give a short loaded-context recap covering objective, phase, active TODOs, latest decisions, and blockers.42 - For concrete project delivery work, establish the milestone execution contract before implementation starts.43442. Establish a milestone execution contract for production work.45 - Use a milestone as the current-session scope container. It must deliver at least one of: user capability, release gate closure, core architecture boundary, or blocking defect fix.46 - Classify discovered work before editing:47 - `P0`: delivery blockers, severe bugs, security issues, build failures.48 - `P1`: required current-milestone functionality, tests, or refactors.49 - `P2/P3`: optimizations, enhancements, and long-term maintenance. Route these to backlog only.50 - `Manual-required`: external accounts, certificates, signing, notarization, real devices, production secrets, or third-party permissions.51 - Output and then obey this Step 0 contract:5253```text54Milestone:55Goal:56P0/P1 scope:57Out-of-scope P2/P3:58Manual-required:59Phase limit:60Phase split:61Acceptance criteria:62Stop conditions:63```6465 - Freeze scope after the contract. Expand only for a true P0/P1 blocker.66 - Default to at most 3 phases; use at most 5 only for genuinely complex milestones.67 - Make each phase a deliverable closure around feature, architecture, defect fix, test gate, build chain, permission path, or release gate. Do not create phases for single files, fields, scripts, evidence snippets, or standalone paperwork.68 - Stop after the milestone's P0/P1 work passes necessary verification. Do not automatically open the next milestone.69703. Keep the state panel current.71 - Treat `project-state.md` as the single current snapshot.72 - Overwrite only the live summary content there.73 - Keep it concise and operational.74 - Push workstream-level detail down into `workstreams/*.md` instead of bloating the global state.75764. Append session history.77 - Add a new entry to `session-log.md` after meaningful progress, at session close, or when the user asks to save progress.78 - Do not rewrite old session entries unless correcting obvious factual mistakes.79805. Record important decisions.81 - Add ADR-lite entries to `decisions.md` for meaningful choices, tradeoffs, or policy changes.82 - Include rationale and impact, not just the conclusion.83846. Maintain actionable TODO state.85 - Keep `todo.md` focused on active work.86 - Mark completed items done instead of deleting them.87 - Move stale or obsolete items only when their status is clear.88 - Do not promote backlog items into new phases unless they block the current milestone's P0/P1 acceptance criteria.89 - Record `Manual-required` gaps with impact and validation entrypoint, but do not create development phases for them unless they materially shorten current-milestone verification.90917. Summarize completed phases and milestone stops.92 - After each phase, record completed content, validation, review score/status, key decisions, new backlog, manual-required gaps, and remaining phase budget.93 - When stop conditions are met, write a milestone delivery summary or a manual-attention report. Do not continue into polish, extra evidence, or unrelated TODO cleanup after the stop condition is satisfied.94958. Create handoff artifacts when the work spans sessions or people.96 - Use `handoffs/` for compact continuation packs.97 - Use `phases/` for milestone summaries.98 - Use `workstreams/` for bounded parallel tracks inside larger projects.99 - Use `snapshots/` for machine-oriented evidence captures.100 - Read `references/handoff-patterns.md` before writing a new handoff file.101102## Update Policy103104Read `references/update-policy.md` before deciding where new information belongs.105Read `references/update-triggers.md` when deciding what kind of event should create a state update, promotion, or compaction step.106107Use this routing rule:108109- Current snapshot: `project-state.md`110- Time-ordered work record: `session-log.md`111- Durable choice with rationale: `decisions.md`112- Action queue: `todo.md`113- Milestone recap: `phases/*.md`114- Session transfer pack: `handoffs/*.md`115- Parallel task state: `workstreams/*.md`116- Evidence snapshot: `snapshots/*`117118Do not dump everything into `session-log.md`.119120## Deterministic Helpers121122Use the helper scripts when they reduce repeated hand editing:123124- `scripts/init_memory.py`: initialize `.codex-memory/` with the standard files and optional phase/handoff directories125- `scripts/append_session.py`: append a structured session entry to `session-log.md`126- `scripts/handoff_pack.py`: generate a compact handoff file from the current memory snapshot127- `scripts/compact_session.py`: compact older `session-log.md` history into a shorter summary and optional phase recap128129Resolve script paths relative to this skill directory. For a user-scope install, they are usually under `$HOME/.agents/skills/best-project-memory/scripts/`.130131## Reference Routing132133- `references/state-schema.md`: read before creating or normalizing memory files134- `references/surface-contract.md`: read before changing structure, ownership, or script write boundaries135- `references/update-policy.md`: read before deciding what to update136- `references/update-triggers.md`: read when mapping work events to memory actions137- `references/quality-rules.md`: read when checking whether the memory has drifted into low-quality patterns138- `references/integration-patterns.md`: read when another skill should consume or update this memory model139- `references/examples.md`: read when you want concrete memory-entry examples140- `references/handoff-patterns.md`: read before writing handoff or phase summaries141142Load only the references needed for the current task.143144## Completion Standard145146A project-memory pass is complete only when:147148- the repo memory folder exists or has been intentionally confirmed unnecessary149- concrete project work has a visible milestone contract or an explicit reason it is unnecessary150- current objective, phase, blockers, and next step are easy to find151- durable decisions are captured with rationale152- TODOs reflect the real state of work153- another Codex session could resume without rereading the whole conversation