aiwg-regenerate-codex
Regenerate Codex context file (CODEX.md or ~/.codex/instructions.md) with AIWG framework content
What this skill does
# Regenerate Codex Context
Regenerate the Codex context file (`CODEX.md` or `~/.codex/instructions.md`) for OpenAI Codex integration. Performs an **intelligent merge** — preserving team-written content while updating AIWG context.
## Core Principle
**Team content is preserved. AIWG content is updated. Full injection used (Codex does not support @-link directives).**
## Important: No @-Link Support
Codex context files do not support `@filename` style includes. AIWG content is embedded directly using injection markers:
```markdown
<!-- BEGIN AIWG -->
[AIWG content]
<!-- END AIWG -->
```
This is different from other providers that use the hook file approach.
## Parameters
| Flag | Description |
|------|-------------|
| `--no-backup` | Skip creating backup file |
| `--dry-run` | Preview changes without writing |
| `--user-level` | Update `~/.codex/instructions.md` instead of project-level `CODEX.md` |
| `--migrate` | Extract injection to `AIWG-codex.md` and reference from CODEX.md (future-proofing) |
## Context File Locations
| Scope | Path | Use case |
|-------|------|----------|
| Project-level | `CODEX.md` | Project-specific AIWG context |
| User-level | `~/.codex/instructions.md` | User-wide context across all projects |
Default: project-level `CODEX.md`. Use `--user-level` for user-wide context.
## Execution Steps
### Step 1: Create Backup
Unless `--no-backup` specified, create `CODEX.md.backup-{YYYYMMDD-HHMMSS}`.
### Step 2: Analyze Existing Content
Read `CODEX.md` if it exists and categorize:
- **Team content** (PRESERVE): Project rules, conventions, business logic, above or below AIWG block
- **AIWG content** (UPDATE): Content between `<!-- BEGIN AIWG -->` and `<!-- END AIWG -->`
### Step 3: Generate AIWG Content
Generate AIWG content from installed framework manifests. Same content as other providers' hook files, but embedded inline.
Also write `AIWG-codex.md` as a side file for reference and for potential future migration if Codex adds @-link support.
### Step 4: Inject Content
**If AIWG markers found**: Replace content between markers with freshly generated content.
**If no markers found**: Append AIWG block to end of file (before `<!-- TEAM DIRECTIVES -->` marker if present).
```markdown
[team content preserved above]
<!-- BEGIN AIWG -->
<!-- Managed by aiwg — regenerate with: aiwg-regenerate-codex -->
[AIWG content]
<!-- END AIWG -->
<!-- TEAM DIRECTIVES: Add project-specific guidance below -->
```
### Step 5: Report
```
Codex Context Regenerated
==========================
Backup: CODEX.md.backup-20260322-190000
AIWG content: 312 lines (injected between markers)
Side file: AIWG-codex.md (312 lines, written for reference)
Team content preserved: 22 lines
Note: Codex does not support @-link directives.
Content embedded directly with <!-- BEGIN/END AIWG --> markers.
To update: aiwg-regenerate-codex
```
## Examples
```bash
# Default (project-level CODEX.md)
/aiwg-regenerate-codex
# Update user-level instructions
/aiwg-regenerate-codex --user-level
# Preview without writing
/aiwg-regenerate-codex --dry-run
# Skip backup
/aiwg-regenerate-codex --no-backup
```
## Related Commands
| Command | Regenerates |
|---------|-------------|
| `/aiwg-regenerate` | Auto-detect and delegate |
| `/hook-status` | Check hook state (shows "full inject" for Codex) |
| `/hook-regenerate --provider codex` | Rebuild AIWG-codex.md side file |
## References
- #439 — AIWG.md hook file architecture
- #444 — Multi-provider @-link support research (Codex confirmed no @-link support)
- #446 — Regenerate command suite update
Related in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.