Skip to content

Add Codex adapter generator#3

Open
chrisl10 wants to merge 7 commits into
legioncodeinc:mainfrom
chrisl10:codex-adapter-autopilot
Open

Add Codex adapter generator#3
chrisl10 wants to merge 7 commits into
legioncodeinc:mainfrom
chrisl10:codex-adapter-autopilot

Conversation

@chrisl10

@chrisl10 chrisl10 commented Jun 24, 2026

Copy link
Copy Markdown

Summary

  • add a Codex adapter generator for project-local .agents/skills, .codex/agents, hooks, runtime scripts, and guidance files
  • add validation and deterministic smoke tooling for generated Codex installs
  • document Codex profiles, guidance modes, hook trust, validation levels, and the autopilot flow
  • update cross-harness docs to include Codex alongside the existing Cursor, Claude Code, and Cowork assets

Validation

  • for f in scripts/*.mjs; do node --check "$f" >/dev/null; done
  • git diff --cached --check
  • generated and validated core, autopilot, and all profiles
  • ran generated git diff --cached --check for each profile
  • node scripts/smoke-codex-adapter.mjs --profile autopilot

Notes

This PR keeps the source Stingers and Bees as the source of truth. The Codex adapter translates them into Codex-compatible project-local assets so downstream repos can install a deterministic snapshot.

Summary by CodeRabbit

  • New Features
    • Added a Codex adapter bundle generator and supporting CLI scripts to scaffold/validate docs, manage work lifecycle (backlog/in-work/completed), and generate repo artifacts like code maps and execution ledgers.
    • Added Codex-focused health checks and hook policy/audit support for runtime verification.
  • Documentation
    • Updated documentation framework templates and core repo guides to standardize IRD/PRD/ADR conventions and lifecycle folder rules, and extended cross-harness compatibility to include Codex.
  • Tests/Validation
    • Added Codex adapter smoke tests, fixtures, and validator tooling across multiple install modes.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds Codex adapter generation and validation, new TGL lifecycle/reporting scripts, updated documentation templates, and Codex-aware repository docs.

Changes

Codex Adapter Feature

Layer / File(s) Summary
Documentation template updates
.claude/skills/library-stinger/templates/documentation-framework.md, .cursor/skills/library-stinger/templates/documentation-framework.md
Replaces the document taxonomy, header scope, filename conventions, and folder layout rules for IRDs, PRDs, QA reports, ADRs, knowledge docs, and standards docs.
Codex entries in repo docs
AGENTS.md, HOOKS.md, RULES.md, SKILLS.md, README.md
Adds Codex to the harness mappings and updates the repo-facing descriptions of assets, hooks, compatibility, and adapter usage.
Shared CLI utilities
scripts/tgl-utils.mjs
Adds shared parsing, path, filesystem, template, numbering, command, markdown, and JSON helpers used by the other scripts.
Artifact lifecycle scripts
scripts/tgl-new-prd.mjs, scripts/tgl-new-ird.mjs, scripts/tgl-new-adr.mjs, scripts/tgl-backwards-prd.mjs, scripts/tgl-start-work.mjs, scripts/tgl-complete-work.mjs, scripts/tgl-link-pr.mjs
Adds scripts that create, move, status-update, and PR-link PRD/IRD/ADR artifacts and related QA files.
Analysis and reporting scripts
scripts/tgl-bootstrap-library.mjs, scripts/tgl-ledger.mjs, scripts/tgl-code-map.mjs, scripts/tgl-inspect-project.mjs, scripts/tgl-gate-status.mjs, scripts/tgl-hook-policy.mjs, scripts/tgl-ship-preflight.mjs
Adds scripts for bootstrapping the library tree, generating ledgers and code maps, inspecting repository state, checking gate/preflight status, and writing hook policy records.
Codex adapter builder
scripts/build-codex-adapter.mjs
Builds the Codex adapter bundle, including copied skills and agents, generated guidance, hook scaffolding, runtime scripts, and the manifest.
Adapter validation
scripts/validate-codex-adapter.mjs
Validates generated skills, agents, hooks, guidance, manifest, runtime scripts, and text formatting in adapter output.
Smoke test runner
scripts/smoke-codex-adapter.mjs
Creates a seeded repo, runs the adapter build and TGL script chain, executes tests, and reports the result as JSON.
Codex adapter documentation
codex/README.md
Documents the adapter mapping, build and install modes, runtime behavior, autopilot flow, smoke tests, validation steps, E2E scenarios, and design notes.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~90 minutes

Poem

🐇 I hop through Codex, swift and bright,
With PRDs, ledgers, and hooks in sight.
From backlog burrows to shipped-file gleam,
This repo now hums a four-harness dream.
Thump-thump! The adapter sings hooray —
That Git Life leaps a broader way.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a Codex adapter generator.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.claude/skills/library-stinger/templates/documentation-framework.md:
- Line 19: The markdown table entry for Public Knowledge Doc currently uses
unescaped pipe characters inside the location pattern, which can break column
parsing in renderers. Update the documentation-framework template so the pattern
in that cell renders the alternatives without raw table-breaking pipes, and keep
the change localized to the Public Knowledge Doc row in the table.

In @.cursor/skills/library-stinger/templates/documentation-framework.md:
- Line 19: The “Public Knowledge Doc” location pattern in the
documentation-framework table is breaking markdown column parsing because the
pipe characters inside the path are not escaped. Update the table entry to
escape the pipes in the `<overview|guides|faqs>` segment within the
documentation-framework template so the row remains a valid single cell and
renders correctly in markdown.

In `@scripts/tgl-code-map.mjs`:
- Around line 3-4: Reject unsafe --scope values in tgl-code-map.mjs by
validating the scope path before passing it into listFilesRecursive. In the main
argument handling around parseArgs/rel and the repository-root check, ensure any
resolved scope stays within the repo root and does not allow parent-directory
traversal like ../..; if it escapes, fail fast with an error. Use the existing
scope resolution flow in tgl-code-map.mjs and keep the fix centered on the scope
validation logic that feeds listFilesRecursive.

In `@scripts/tgl-inspect-project.mjs`:
- Around line 92-106: The PRD/IRD directory matching in countDirs and the
similar check in tgl-hook-policy currently tests full paths with slash-based
regexes, which breaks on Windows path separators. Update the matching logic in
scripts/tgl-inspect-project.mjs and scripts/tgl-hook-policy.mjs to run the
PRD/IRD regex against basename(p) instead of the full path, using the existing
countDirs helper and the affected PRD/IRD directory filters as the reference
points.

In `@scripts/tgl-ledger.mjs`:
- Around line 3-4: The `--from` handling in `tgl-ledger.mjs` can escape the
`--root` boundary via traversal-style paths, so tighten the path resolution in
the argument parsing and file-selection flow used around `parseArgs`,
`listFilesRecursive`, and the `from` path check. Normalize and resolve the
user-supplied `--from` against the resolved `--root`, then verify the final
target still starts within that root before reading markdown or building the
file list; reject invalid inputs instead of allowing `../`-style traversal.

In `@scripts/tgl-link-pr.mjs`:
- Around line 23-33: The Ship Links block in `scripts/tgl-link-pr.mjs` is being
built and then passed directly into `text.replace`, which can treat `$`
sequences in `args["pr-url"]` or `merge-sha` as replacement tokens; update the
`block`/`text.replace` flow so the replacement is inserted verbatim via a
function replacer. Also fix the `block` construction around `.filter(Boolean)`
so it does not strip the intentional blank lines, preserving the spacing between
the header, PR line, optional merge SHA, and linked timestamp.

In `@scripts/tgl-new-prd.mjs`:
- Line 36: The replacement in tgl-new-prd.mjs is using String.prototype.replace
with args.summary as a raw replacement string, so any $ sequences in
user-provided summaries can be expanded incorrectly. Update the replacement
around the summary placeholder to use a function replacer (or equivalent
verbatim insertion) so args.summary is inserted literally, and keep the fallback
placeholder text behavior unchanged.

In `@scripts/tgl-utils.mjs`:
- Around line 19-20: The option parsing in parseArgs currently defaults missing
values to an empty string, which lets value options like --root silently fall
back to cwd. Update the parser so it fails fast when a value-bearing flag has no
following value instead of assigning "", and make sure the behavior is enforced
in the args handling around args[key] and any callers that rely on the parsed
root path.
- Around line 159-160: The rel() helper currently returns platform-specific
separators, which breaks callers that split on "/" in tgl-code-map.mjs and
tgl-inspect-project.mjs. Update rel() in tgl-utils.mjs to normalize the relative
path to POSIX style before returning it by converting backslashes to forward
slashes, while preserving the "." fallback behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 78371e26-3bd7-4d3c-8091-66879e76aa8f

📥 Commits

Reviewing files that changed from the base of the PR and between e157be6 and 8b0f72d.

📒 Files selected for processing (26)
  • .claude/skills/library-stinger/templates/documentation-framework.md
  • .cursor/skills/library-stinger/templates/documentation-framework.md
  • AGENTS.md
  • HOOKS.md
  • README.md
  • RULES.md
  • SKILLS.md
  • codex/README.md
  • scripts/build-codex-adapter.mjs
  • scripts/smoke-codex-adapter.mjs
  • scripts/tgl-backwards-prd.mjs
  • scripts/tgl-bootstrap-library.mjs
  • scripts/tgl-code-map.mjs
  • scripts/tgl-complete-work.mjs
  • scripts/tgl-gate-status.mjs
  • scripts/tgl-hook-policy.mjs
  • scripts/tgl-inspect-project.mjs
  • scripts/tgl-ledger.mjs
  • scripts/tgl-link-pr.mjs
  • scripts/tgl-new-adr.mjs
  • scripts/tgl-new-ird.mjs
  • scripts/tgl-new-prd.mjs
  • scripts/tgl-ship-preflight.mjs
  • scripts/tgl-start-work.mjs
  • scripts/tgl-utils.mjs
  • scripts/validate-codex-adapter.mjs

Comment thread .claude/skills/library-stinger/templates/documentation-framework.md Outdated
Comment thread .cursor/skills/library-stinger/templates/documentation-framework.md Outdated
Comment thread scripts/tgl-code-map.mjs Outdated
Comment thread scripts/tgl-inspect-project.mjs Outdated
Comment thread scripts/tgl-ledger.mjs Outdated
Comment thread scripts/tgl-link-pr.mjs Outdated
Comment thread scripts/tgl-new-prd.mjs Outdated
Comment thread scripts/tgl-utils.mjs Outdated
Comment thread scripts/tgl-utils.mjs Outdated
@chrisl10 chrisl10 force-pushed the codex-adapter-autopilot branch from ed33483 to 8d2393f Compare June 24, 2026 08:02

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/build-codex-adapter.mjs`:
- Around line 668-682: The local-only ignore block added by
appendLocalOnlyGitExclude is never removed when the install mode switches, so a
later committed-project rebuild still leaves .agents/, .codex/, and
AGENTS.that-git-life.md ignored. Update the build flow around
appendLocalOnlyGitExclude and the committed-project path to detect mode changes
and clean those entries back out of .git/info/exclude before regenerating the
adapter, using the same helper names to locate the logic.
- Around line 628-665: `writeRunSummaryTemplate()` is overwriting the
accumulated `.codex/that-git-life/run-summary.json` state on every adapter
rebuild, which loses existing branch/PR/proof data. Update the template write
path in `writeRunSummaryTemplate()` so it only creates the file when it does not
already exist, or otherwise preserves an existing run-summary during reinstall.
Use the existing run-summary handling in `scripts/tgl-run-summary.mjs` as the
source of truth and make sure the adapter setup flow respects previously
recorded data.

In `@scripts/smoke-codex-adapter.mjs`:
- Around line 147-150: The smoke check in smoke-codex-adapter.mjs currently
treats tgl-doctor as passing based only on runJson success, which misses JSON
results with ok: false. Update the logic around the doctor invocation in the
smoke flow to parse the returned doctor payload and explicitly fail the run when
tgl-doctor reports blockers, while keeping the existing
validation/inspect/bootstrap calls intact. Use the tgl-doctor.mjs result shape
and the doctor variable in this script as the key place to add the ok check so
broken installs can no longer report a successful smoke run.

In `@scripts/tgl-run-summary.mjs`:
- Around line 27-31: The count parsing in parseCount currently coerces malformed
inputs to 0, which hides bad CLI values and can incorrectly mark the summary as
valid. Update parseCount and the call sites in the summary update flow to
distinguish missing values from invalid ones: keep undefined for absent flags so
existing totals remain unchanged, but when a provided value is not a finite
non-negative number, fail fast instead of defaulting to 0. Make sure the logic
in the functions that use parseCount and compute the final ok status rejects bad
inputs explicitly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 31b23f67-3154-466d-ab60-a152c3a09227

📥 Commits

Reviewing files that changed from the base of the PR and between aa2c496 and ed33483.

📒 Files selected for processing (8)
  • codex/README.md
  • scripts/build-codex-adapter.mjs
  • scripts/smoke-codex-adapter.mjs
  • scripts/test-codex-adapter.mjs
  • scripts/tgl-doctor.mjs
  • scripts/tgl-run-summary.mjs
  • scripts/tgl-utils.mjs
  • scripts/validate-codex-adapter.mjs
✅ Files skipped from review due to trivial changes (1)
  • scripts/test-codex-adapter.mjs
🚧 Files skipped from review as they are similar to previous changes (3)
  • codex/README.md
  • scripts/validate-codex-adapter.mjs
  • scripts/tgl-utils.mjs

Comment thread scripts/build-codex-adapter.mjs
Comment thread scripts/build-codex-adapter.mjs
Comment thread scripts/smoke-codex-adapter.mjs
Comment thread scripts/tgl-run-summary.mjs
@chrisl10

Copy link
Copy Markdown
Author

Follow-up from the TrademarkAura Codex adapter smoke: tightened post-merge closeout so completed PRDs/IRDs move from in-work/backlog to completed, and tgl-complete-work now rewrites EXECUTION_LEDGER.md and run-summary paths. Added focused regression coverage and smoke coverage for this path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant