~/.config/codex-agents is a files-first, git-backed state layer for Codex.
It centralizes:
- agent operating policy
- reusable skills
- persistent memory
The goal is deterministic behavior with safe rollback.
- Codex Overview
- Codex CLI
- Codex IDE Extension
- Codex GitHub Integration
- AGENTS.md for Codex
- Codex Skills
- Codex Cloud Environments
Without a state layer, agents tend to:
- repeat decisions
- lose project continuity
- produce inconsistent runbooks
- drift from agreed constraints
This repository fixes that by making durable state explicit, structured, and versioned.
Authoritative state lives in this repo.
Codex-facing paths should be symlinks:
~/.codex/AGENTS.md->~/.config/codex-agents/AGENTS.md~/.codex/skills->~/.config/codex-agents/skills
This keeps Codex integration stable while all real state stays git-managed.
~/.config/codex-agents/
├── AGENTS.md
├── README.md
├── lib/
│ └── secret_scan.sh
├── memory/
│ ├── README.md
│ ├── index.md
│ ├── logs/
│ ├── decisions/
│ ├── projects/
│ ├── knowledge/
│ └── patterns/
├── skills/
│ ├── decision-check/
│ ├── context-bootstrap/
│ ├── decision-record/
│ ├── memory-index-update/
│ ├── memory-retrieve/
│ ├── memory-write/
│ ├── project-status/
│ ├── project-update/
│ ├── workflow-plan/
│ ├── runbook-create/
│ ├── secret-scan/
│ ├── security-best-practices/
│ └── gh-address-comments/
├── bin/
│ ├── doctor.sh
│ └── install.sh
└── templates/
Before architecture/workflow recommendations:
- Read
memory/index.md. - Check relevant decisions and project context.
- Summarize constraints before proposing changes.
Use decision-check before architecture/workflow changes.
If relevant decisions exist, they are constraints, not suggestions.
- logs and project logs: append-only
- decisions: immutable (new file when superseding)
- index: additive, minimal diff, no aggressive reordering
Index discoverability is now default behavior at creation time:
workflow-plan --to-pattern: auto-registers the new pattern plan inmemory/index.md(## Patterns)project-update: when first scaffoldingoverview.md, auto-registers under## Projectsmemory-write: when creating newproject,knowledge, orpatterndocs, auto-registers under the mapped section
All of the above route index writes through:
skills/memory-index-update/scripts/update_index.sh
If automatic index update cannot run, scripts print the exact fallback command to execute manually.
All write-side memory scripts enforce shared secret scanning.
Default behavior:
- high-confidence secrets: block write
- low-confidence secret-like content: redact and continue
Override (explicit):
--allow-redactallows blocked writes to proceed with in-place redaction
Shared scanner library:
lib/secret_scan.sh
Each skill has:
SKILL.mdcontract- optional
scripts/executables
Primary memory/continuity skills:
| Skill | Purpose | Script |
|---|---|---|
context-bootstrap |
Mandatory first pass for non-trivial tasks; orchestrates decision-check + project-status + memory-retrieve into one compact Context block | skills/context-bootstrap/scripts/bootstrap.sh |
decision-check |
Find applicable prior decisions before recommending changes | skills/decision-check/scripts/check.sh |
decision-record |
Create immutable one-decision-per-file records | skills/decision-record/scripts/record.sh |
memory-retrieve |
Pull minimal relevant memory context | skills/memory-retrieve/scripts/retrieve.sh |
memory-write |
Generic structured memory writer with automatic index registration for new anchors | skills/memory-write/scripts/write.sh |
memory-index-update |
Keep memory/index.md discoverable and idempotent |
skills/memory-index-update/scripts/update_index.sh |
project-status |
Summarize project state from overview + log | skills/project-status/scripts/status.sh |
project-update |
Append structured project log updates and auto-index first-time project scaffolding | skills/project-update/scripts/update.sh |
workflow-plan |
Generate executable plan artifacts with verification + rollback (auto-index in --to-pattern mode) |
skills/workflow-plan/scripts/plan.sh |
runbook-create |
Create reusable pattern/runbook docs and index them | skills/runbook-create/scripts/create.sh |
secret-scan |
Standalone pass/redact/block scanner utility | skills/secret-scan/scripts/scan.sh |
Additional utility skills:
security-best-practicesgh-address-comments
Memory root: memory/
README.md: operational conventions for cadence, naming, and index policyindex.md: table of contents for durable anchorslogs/: chronological notesdecisions/: architectural/workflow constraintsprojects/: continuity (overview.md+log.mdper project)knowledge/: stable reference notespatterns/: reusable procedures/runbooks
bin/install.shbin/install.sh runs bin/doctor.sh by default after symlink reconciliation.
bin/doctor.shln -sfn ~/.config/codex-agents/AGENTS.md ~/.codex/AGENTS.md
ln -sfn ~/.config/codex-agents/skills ~/.codex/skillsbash -n \
bin/install.sh \
bin/doctor.sh \
lib/secret_scan.sh \
skills/secret-scan/scripts/scan.sh \
skills/memory-retrieve/scripts/retrieve.sh \
skills/memory-write/scripts/write.sh \
skills/decision-check/scripts/check.sh \
skills/decision-record/scripts/record.sh \
skills/project-status/scripts/status.sh \
skills/project-update/scripts/update.sh \
skills/memory-index-update/scripts/update_index.sh \
skills/workflow-plan/scripts/plan.sh \
skills/runbook-create/scripts/create.shTMP_ROOT="$(mktemp -d)"
export MEMORY_ROOT="$TMP_ROOT/memory"
mkdir -p "$MEMORY_ROOT"- Use
bin/install.shto reconcile expected symlinks with backup-and-replace safety. - Use
bin/doctor.shto detect drift; it exits non-zero when checks fail. - Prefer
bin/install.sh --dry-runbefore first-time setup on unknown machines. - Use
bin/install.sh --skip-doctoronly when sequencing setup manually.
skills/decision-check/scripts/check.sh "skills directory and symlinks"skills/memory-retrieve/scripts/retrieve.sh "codex-agents current status" \
--scopes projects,decisions \
--project codex-agentsskills/workflow-plan/scripts/plan.sh \
--goal "Implement deterministic retrieval ranking" \
--project "codex-agents" \
--constraints "append-only logs,minimal diffs" \
--acceptance-criteria "tests pass,rollback documented"Pattern mode (--to-pattern) also updates memory/index.md automatically.
skills/project-update/scripts/update.sh \
--project "codex-agents" \
--title "Implemented workflow-plan" \
--status "in progress" \
--notes "Added script and report contract" \
--next "Implement runbook-create,Run smoke tests"If this is the first update for a project and scaffolding is created, index registration is automatic.
skills/memory-write/scripts/write.sh \
--type knowledge \
--title "Token handling" \
--body "Prefer env vars or secret manager; never commit credentials."New knowledge/pattern/project anchors are auto-indexed through memory-index-update.
skills/runbook-create/scripts/create.sh \
--title "Release Cutover" \
--when-to-use "When promoting a tested candidate to production" \
--steps "Validate artifacts,Deploy canary,Promote" \
--verification "Smoke tests pass,No elevated error rate" \
--failure-modes "Canary fails,Rollback incomplete"skills/secret-scan/scripts/scan.sh --text "token=abc123" --mode writeExit code conventions for secret-scan:
0: pass or redacted3: blocked2: argument/validation error
Write-side scripts inherit the same policy and support --allow-redact.
- Keep behavior deterministic and auditable.
- Favor append-only updates for logs/project logs.
- Never silently mutate prior decision files.
- Keep index updates idempotent and minimal-diff.
- Use relative memory paths in script reports.
- Do not commit secrets; redaction is required.
This repository is intended to be shareable, so personal memory entries are ignored by default.
.gitignoreignoresmemory/**content to avoid committing local logs, decisions, project notes, or knowledge entries by accident.- The memory scaffold stays tracked:
memory/README.md,memory/index.md, directory structure, and.gitkeepplaceholders. - Result: collaborators can clone a clean, reusable agent state layer while each user keeps private/local memory history out of git.
If you intentionally want to publish durable memory artifacts, add files explicitly with git add -f <path> and review them carefully before commit.
Typical cycle:
git status
git add <files>
git commit -m "feat(...): ..."Rollback is straightforward because state is file-based and versioned.
AGENTS.md is the runtime operating policy for agents.
README.md is the human/operator guide for understanding and contributing to this repository.
If there is ambiguity, follow AGENTS.md for behavior and update this README accordingly.
