@every-env/compound-plugin 2.40.1 → 2.40.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +14 -0
- package/README.md +2 -2
- package/docs/solutions/codex-skill-prompt-entrypoints.md +152 -0
- package/docs/specs/codex.md +3 -1
- package/package.json +1 -1
- package/plugins/compound-engineering/.claude-plugin/plugin.json +1 -1
- package/plugins/compound-engineering/AGENTS.md +13 -2
- package/plugins/compound-engineering/README.md +0 -2
- package/plugins/compound-engineering/agents/research/best-practices-researcher.md +8 -3
- package/plugins/compound-engineering/agents/research/framework-docs-researcher.md +2 -0
- package/plugins/compound-engineering/agents/research/git-history-analyzer.md +7 -5
- package/plugins/compound-engineering/agents/research/repo-research-analyst.md +5 -10
- package/src/converters/claude-to-codex.ts +118 -89
- package/src/parsers/claude-home.ts +10 -0
- package/src/parsers/claude.ts +1 -0
- package/src/targets/codex.ts +43 -2
- package/src/types/claude.ts +1 -0
- package/src/types/codex.ts +2 -0
- package/src/utils/codex-content.ts +84 -0
- package/tests/claude-home.test.ts +36 -0
- package/tests/codex-converter.test.ts +172 -0
- package/tests/codex-writer.test.ts +154 -0
- package/plugins/compound-engineering/skills/workflows-brainstorm/SKILL.md +0 -10
- package/plugins/compound-engineering/skills/workflows-compound/SKILL.md +0 -10
- package/plugins/compound-engineering/skills/workflows-plan/SKILL.md +0 -10
- package/plugins/compound-engineering/skills/workflows-review/SKILL.md +0 -10
- package/plugins/compound-engineering/skills/workflows-work/SKILL.md +0 -10
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
13
13
|
"name": "compound-engineering",
|
|
14
|
-
"description": "AI-powered development tools that get smarter with every use. Make each unit of engineering work easier than the last. Includes 28 specialized agents and
|
|
14
|
+
"description": "AI-powered development tools that get smarter with every use. Make each unit of engineering work easier than the last. Includes 28 specialized agents and 41 skills.",
|
|
15
15
|
"version": "2.40.0",
|
|
16
16
|
"author": {
|
|
17
17
|
"name": "Kieran Klaassen",
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
Release numbering now follows the repository `v*` tag line. Starting at `v2.34.0`, the root CLI package and this changelog stay on that shared version stream. Older entries below retain the previous `0.x` CLI numbering.
|
|
9
9
|
|
|
10
|
+
## [2.40.3](https://github.com/EveryInc/compound-engineering-plugin/compare/v2.40.2...v2.40.3) (2026-03-17)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* research agents prefer native tools over shell for repo exploration ([b290690](https://github.com/EveryInc/compound-engineering-plugin/commit/b2906906555810fca176fa4e0153bf080446c486))
|
|
16
|
+
|
|
17
|
+
## [2.40.2](https://github.com/EveryInc/compound-engineering-plugin/compare/v2.40.1...v2.40.2) (2026-03-17)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* harden codex copied skill rewriting ([#285](https://github.com/EveryInc/compound-engineering-plugin/issues/285)) ([6f561f9](https://github.com/EveryInc/compound-engineering-plugin/commit/6f561f94b4397ca6df2ab163e6f1253817bd7cea))
|
|
23
|
+
|
|
10
24
|
## [2.40.1](https://github.com/EveryInc/compound-engineering-plugin/compare/v2.40.0...v2.40.1) (2026-03-17)
|
|
11
25
|
|
|
12
26
|
|
package/README.md
CHANGED
|
@@ -82,7 +82,7 @@ Then run `claude-dev-ce` instead of `claude` to test your changes. Your producti
|
|
|
82
82
|
**Codex** — point the install command at your local path:
|
|
83
83
|
|
|
84
84
|
```bash
|
|
85
|
-
|
|
85
|
+
bun run src/index.ts install ./plugins/compound-engineering --to codex
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
**Other targets** — same pattern, swap the target:
|
|
@@ -97,7 +97,7 @@ bun run src/index.ts install ./plugins/compound-engineering --to opencode
|
|
|
97
97
|
| Target | Output path | Notes |
|
|
98
98
|
|--------|------------|-------|
|
|
99
99
|
| `opencode` | `~/.config/opencode/` | Commands as `.md` files; `opencode.json` MCP config deep-merged; backups made before overwriting |
|
|
100
|
-
| `codex` | `~/.codex/prompts` + `~/.codex/skills` |
|
|
100
|
+
| `codex` | `~/.codex/prompts` + `~/.codex/skills` | Claude commands become prompt + skill pairs; canonical `ce:*` workflow skills also get prompt wrappers; deprecated `workflows:*` aliases are omitted |
|
|
101
101
|
| `droid` | `~/.factory/` | Tool names mapped (`Bash`→`Execute`, `Write`→`Create`); namespace prefixes stripped |
|
|
102
102
|
| `pi` | `~/.pi/agent/` | Prompts, skills, extensions, and `mcporter.json` for MCPorter interoperability |
|
|
103
103
|
| `gemini` | `.gemini/` | Skills from agents; commands as `.toml`; namespaced commands become directories (`workflows:plan` → `commands/workflows/plan.toml`) |
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Codex Conversion Skills, Prompts, and Canonical Entry Points
|
|
3
|
+
category: architecture
|
|
4
|
+
tags: [codex, converter, skills, prompts, workflows, deprecation]
|
|
5
|
+
created: 2026-03-15
|
|
6
|
+
severity: medium
|
|
7
|
+
component: codex-target
|
|
8
|
+
problem_type: best_practice
|
|
9
|
+
root_cause: outdated_target_model
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Codex Conversion Skills, Prompts, and Canonical Entry Points
|
|
13
|
+
|
|
14
|
+
## Problem
|
|
15
|
+
|
|
16
|
+
The Codex target had two conflicting assumptions:
|
|
17
|
+
|
|
18
|
+
1. Compound workflow entrypoints like `ce:brainstorm` and `ce:plan` were treated in docs as slash-command-style surfaces.
|
|
19
|
+
2. The Codex converter installed those entries as copied skills, not as generated prompts.
|
|
20
|
+
|
|
21
|
+
That created an inconsistent runtime for cross-workflow handoffs. Copied skill content still contained Claude-style references like `/ce:plan`, but no Codex-native translation was applied to copied `SKILL.md` files, and there was no clear canonical Codex entrypoint model for those workflow skills.
|
|
22
|
+
|
|
23
|
+
## What We Learned
|
|
24
|
+
|
|
25
|
+
### 1. Codex supports both skills and prompts, and they are different surfaces
|
|
26
|
+
|
|
27
|
+
- Skills are loaded from skill roots such as `~/.codex/skills`, and newer Codex code also supports `.agents/skills`.
|
|
28
|
+
- Prompts are a separate explicit entrypoint surface under `.codex/prompts`.
|
|
29
|
+
- A skill is not automatically a prompt, and a prompt is not automatically a skill.
|
|
30
|
+
|
|
31
|
+
For this repo, that means a copied skill like `ce:plan` is only a skill unless the converter also generates a prompt wrapper for it.
|
|
32
|
+
|
|
33
|
+
### 2. Codex skill names come from the directory name
|
|
34
|
+
|
|
35
|
+
Codex derives the skill name from the skill directory basename, not from our normalized hyphenated converter name.
|
|
36
|
+
|
|
37
|
+
Implication:
|
|
38
|
+
|
|
39
|
+
- `~/.codex/skills/ce:plan` loads as the skill `ce:plan`
|
|
40
|
+
- Rewriting that to `ce-plan` is wrong for skill-to-skill references
|
|
41
|
+
|
|
42
|
+
### 3. The original bug was structural, not just wording
|
|
43
|
+
|
|
44
|
+
The issue was not that `ce:brainstorm` needed slightly different prose. The real problem was:
|
|
45
|
+
|
|
46
|
+
- copied skills bypassed Codex-specific transformation
|
|
47
|
+
- workflow handoffs referenced a surface that was not clearly represented in installed Codex artifacts
|
|
48
|
+
|
|
49
|
+
### 4. Deprecated `workflows:*` aliases add noise in Codex
|
|
50
|
+
|
|
51
|
+
The `workflows:*` names exist only for backward compatibility in Claude.
|
|
52
|
+
|
|
53
|
+
Copying them into Codex would:
|
|
54
|
+
|
|
55
|
+
- duplicate user-facing entrypoints
|
|
56
|
+
- complicate handoff rewriting
|
|
57
|
+
- increase ambiguity around which name is canonical
|
|
58
|
+
|
|
59
|
+
For Codex, the simpler model is to treat `ce:*` as the only canonical workflow namespace and omit `workflows:*` aliases from installed output.
|
|
60
|
+
|
|
61
|
+
## Recommended Codex Model
|
|
62
|
+
|
|
63
|
+
Use a two-layer mapping for workflow entrypoints:
|
|
64
|
+
|
|
65
|
+
1. **Skills remain the implementation units**
|
|
66
|
+
- Copy the canonical workflow skills using their exact names, such as `ce:plan`
|
|
67
|
+
- Preserve exact skill names for any Codex skill references
|
|
68
|
+
|
|
69
|
+
2. **Prompts are the explicit entrypoint layer**
|
|
70
|
+
- Generate prompt wrappers for canonical user-facing workflow entrypoints
|
|
71
|
+
- Use Codex-safe prompt slugs such as `ce-plan`, `ce-work`, `ce-review`
|
|
72
|
+
- Prompt wrappers delegate to the exact underlying skill name, such as `ce:plan`
|
|
73
|
+
|
|
74
|
+
This gives Codex one clear manual invocation surface while preserving the real loaded skill names internally.
|
|
75
|
+
|
|
76
|
+
## Rewrite Rules
|
|
77
|
+
|
|
78
|
+
When converting copied `SKILL.md` content for Codex:
|
|
79
|
+
|
|
80
|
+
- References to canonical workflow entrypoints should point to generated prompt wrappers
|
|
81
|
+
- `/ce:plan` -> `/prompts:ce-plan`
|
|
82
|
+
- `/ce:work` -> `/prompts:ce-work`
|
|
83
|
+
- References to deprecated aliases should canonicalize to the modern `ce:*` prompt
|
|
84
|
+
- `/workflows:plan` -> `/prompts:ce-plan`
|
|
85
|
+
- References to non-entrypoint skills should use the exact skill name, not a normalized alias
|
|
86
|
+
- Actual Claude commands that are converted to Codex prompts can continue using `/prompts:...`
|
|
87
|
+
|
|
88
|
+
### Regression hardening
|
|
89
|
+
|
|
90
|
+
When rewriting copied `SKILL.md` files, only known workflow and command references should be rewritten.
|
|
91
|
+
|
|
92
|
+
Do not rewrite arbitrary slash-shaped text such as:
|
|
93
|
+
|
|
94
|
+
- application routes like `/users` or `/settings`
|
|
95
|
+
- API path segments like `/state` or `/ops`
|
|
96
|
+
- URLs such as `https://www.proofeditor.ai/...`
|
|
97
|
+
|
|
98
|
+
Unknown slash references should remain unchanged in copied skill content. Otherwise Codex installs silently corrupt unrelated skills while trying to canonicalize workflow handoffs.
|
|
99
|
+
|
|
100
|
+
Personal skills loaded from `~/.claude/skills` also need tolerant metadata parsing:
|
|
101
|
+
|
|
102
|
+
- malformed YAML frontmatter should not cause the entire skill to disappear
|
|
103
|
+
- keep the directory name as the stable skill name
|
|
104
|
+
- treat frontmatter metadata as best-effort only
|
|
105
|
+
|
|
106
|
+
## Future Entry Points
|
|
107
|
+
|
|
108
|
+
Do not hard-code an allowlist of workflow names in the converter.
|
|
109
|
+
|
|
110
|
+
Instead, use a stable rule:
|
|
111
|
+
|
|
112
|
+
- `ce:*` = canonical workflow entrypoint
|
|
113
|
+
- auto-generate a prompt wrapper
|
|
114
|
+
- `workflows:*` = deprecated alias
|
|
115
|
+
- omit from Codex output
|
|
116
|
+
- rewrite references to the canonical `ce:*` target
|
|
117
|
+
- non-`ce:*` skills = skill-only by default
|
|
118
|
+
- if a non-`ce:*` skill should also be a prompt entrypoint, mark it explicitly with Codex-specific metadata
|
|
119
|
+
|
|
120
|
+
This means future skills like `ce:ideate` should work without manual converter changes.
|
|
121
|
+
|
|
122
|
+
## Implementation Guidance
|
|
123
|
+
|
|
124
|
+
For the Codex target:
|
|
125
|
+
|
|
126
|
+
1. Parse enough skill frontmatter to distinguish command-like entrypoint skills from background skills
|
|
127
|
+
2. Filter deprecated `workflows:*` alias skills out of Codex installation
|
|
128
|
+
3. Generate prompt wrappers for canonical `ce:*` workflow skills
|
|
129
|
+
4. Apply Codex-specific transformation to copied `SKILL.md` files
|
|
130
|
+
5. Preserve exact Codex skill names internally
|
|
131
|
+
6. Update README language so Codex entrypoints are documented as Codex-native surfaces, not assumed to be identical to Claude slash commands
|
|
132
|
+
|
|
133
|
+
## Prevention
|
|
134
|
+
|
|
135
|
+
Before changing the Codex converter again:
|
|
136
|
+
|
|
137
|
+
1. Verify whether the target surface is a skill, a prompt, or both
|
|
138
|
+
2. Check how Codex derives names from installed artifacts
|
|
139
|
+
3. Decide which names are canonical before copying deprecated aliases
|
|
140
|
+
4. Add tests for copied skill content, not just generated prompt content
|
|
141
|
+
|
|
142
|
+
## Related Files
|
|
143
|
+
|
|
144
|
+
- `src/converters/claude-to-codex.ts`
|
|
145
|
+
- `src/targets/codex.ts`
|
|
146
|
+
- `src/types/codex.ts`
|
|
147
|
+
- `tests/codex-converter.test.ts`
|
|
148
|
+
- `tests/codex-writer.test.ts`
|
|
149
|
+
- `README.md`
|
|
150
|
+
- `plugins/compound-engineering/skills/ce-brainstorm/SKILL.md`
|
|
151
|
+
- `plugins/compound-engineering/skills/ce-plan/SKILL.md`
|
|
152
|
+
- `docs/solutions/adding-converter-target-providers.md`
|
package/docs/specs/codex.md
CHANGED
|
@@ -48,7 +48,9 @@ https://developers.openai.com/codex/mcp
|
|
|
48
48
|
- `SKILL.md` uses YAML front matter and requires `name` and `description`. citeturn3view3turn3view4
|
|
49
49
|
- Required fields are single-line with length limits (name ≤ 100 chars, description ≤ 500 chars). citeturn3view4
|
|
50
50
|
- At startup, Codex loads only each skill’s name/description; full content is injected when invoked. citeturn3view3turn3view4
|
|
51
|
-
- Skills can be repo-scoped in `.
|
|
51
|
+
- Skills can be repo-scoped in `.agents/skills/` and are discovered from the current working directory up to the repository root. User-scoped skills live in `~/.agents/skills/`. citeturn1view1turn1view4
|
|
52
|
+
- Inference: some existing tooling and user setups still use `.codex/skills/` and `~/.codex/skills/` as legacy compatibility paths, but those locations are not documented in the current OpenAI Codex skills docs linked above.
|
|
53
|
+
- Codex also supports admin-scoped skills in `/etc/codex/skills` plus built-in system skills bundled with Codex. citeturn1view4
|
|
52
54
|
- Skills can be invoked explicitly using `/skills` or `$skill-name`. citeturn3view3
|
|
53
55
|
|
|
54
56
|
## MCP (Model Context Protocol)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "compound-engineering",
|
|
3
3
|
"version": "2.40.0",
|
|
4
|
-
"description": "AI-powered development tools. 28 agents,
|
|
4
|
+
"description": "AI-powered development tools. 28 agents, 41 skills, 1 MCP server for code review, research, design, and workflow automation.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Kieran Klaassen",
|
|
7
7
|
"email": "kieran@every.to",
|
|
@@ -40,7 +40,6 @@ agents/
|
|
|
40
40
|
|
|
41
41
|
skills/
|
|
42
42
|
├── ce-*/ # Core workflow skills (ce:plan, ce:review, etc.)
|
|
43
|
-
├── workflows-*/ # Deprecated aliases for ce:* skills
|
|
44
43
|
└── */ # All other skills
|
|
45
44
|
```
|
|
46
45
|
|
|
@@ -57,7 +56,7 @@ skills/
|
|
|
57
56
|
- `/ce:work` - Execute work items systematically
|
|
58
57
|
- `/ce:compound` - Document solved problems
|
|
59
58
|
|
|
60
|
-
**Why `ce:`?** Claude Code has built-in `/plan` and `/review` commands. The `ce:` namespace (short for compound-engineering) makes it immediately clear these commands belong to this plugin.
|
|
59
|
+
**Why `ce:`?** Claude Code has built-in `/plan` and `/review` commands. The `ce:` namespace (short for compound-engineering) makes it immediately clear these commands belong to this plugin.
|
|
61
60
|
|
|
62
61
|
## Skill Compliance Checklist
|
|
63
62
|
|
|
@@ -94,6 +93,18 @@ This plugin is authored once, then converted for other agent platforms. Commands
|
|
|
94
93
|
- [ ] When one skill refers to another skill, prefer semantic wording such as "load the `document-review` skill" rather than slash syntax.
|
|
95
94
|
- [ ] Use slash syntax only when referring to an actual published command or workflow such as `/ce:work` or `/deepen-plan`.
|
|
96
95
|
|
|
96
|
+
### Tool Selection in Agents and Skills
|
|
97
|
+
|
|
98
|
+
Agents and skills that explore codebases must prefer native tools over shell commands.
|
|
99
|
+
|
|
100
|
+
Why: shell-heavy exploration causes avoidable permission prompts in sub-agent workflows; native file-search, content-search, and file-read tools avoid that.
|
|
101
|
+
|
|
102
|
+
- [ ] Never instruct agents to use `find`, `ls`, `cat`, `head`, `tail`, `grep`, `rg`, `wc`, or `tree` through a shell for routine file discovery, content search, or file reading
|
|
103
|
+
- [ ] Describe tools by capability class with platform hints — e.g., "Use the native file-search/glob tool (e.g., Glob in Claude Code)" — not by Claude Code-specific tool names alone
|
|
104
|
+
- [ ] When shell is the only option (e.g., `ast-grep`, `bundle show`, git commands), instruct one simple command at a time — no chaining (`&&`, `||`, `;`), pipes, or redirects
|
|
105
|
+
- [ ] Do not encode shell recipes for routine exploration when native tools can do the job; encode intent and preferred tool classes instead
|
|
106
|
+
- [ ] For shell-only workflows (e.g., `gh`, `git`, `bundle show`, project CLIs), explicit command examples are acceptable when they are simple, task-scoped, and not chained together
|
|
107
|
+
|
|
97
108
|
### Quick Validation Command
|
|
98
109
|
|
|
99
110
|
```bash
|
|
@@ -83,8 +83,6 @@ Core workflow commands use `ce:` prefix to unambiguously identify them as compou
|
|
|
83
83
|
| `/ce:compound` | Document solved problems to compound team knowledge |
|
|
84
84
|
| `/ce:compound-refresh` | Refresh stale or drifting learnings and decide whether to keep, update, replace, or archive them |
|
|
85
85
|
|
|
86
|
-
> **Deprecated aliases:** `/workflows:plan`, `/workflows:work`, `/workflows:review`, `/workflows:brainstorm`, `/workflows:compound` still work but show a deprecation warning. Use `ce:*` equivalents.
|
|
87
|
-
|
|
88
86
|
### Utility Commands
|
|
89
87
|
|
|
90
88
|
| Command | Description |
|
|
@@ -30,9 +30,12 @@ You are an expert technology researcher specializing in discovering, analyzing,
|
|
|
30
30
|
Before going online, check if curated knowledge already exists in skills:
|
|
31
31
|
|
|
32
32
|
1. **Discover Available Skills**:
|
|
33
|
-
- Use
|
|
34
|
-
-
|
|
35
|
-
-
|
|
33
|
+
- Use the platform's native file-search/glob capability to find `SKILL.md` files in the active skill locations
|
|
34
|
+
- For maximum compatibility, check project/workspace skill directories in `.claude/skills/**/SKILL.md`, `.codex/skills/**/SKILL.md`, and `.agents/skills/**/SKILL.md`
|
|
35
|
+
- Also check user/home skill directories in `~/.claude/skills/**/SKILL.md`, `~/.codex/skills/**/SKILL.md`, and `~/.agents/skills/**/SKILL.md`
|
|
36
|
+
- In Codex environments, `.agents/skills/` may be discovered from the current working directory upward to the repository root, not only from a single fixed repo root location
|
|
37
|
+
- If the current environment provides an `AGENTS.md` skill inventory (as Codex often does), use that list as the initial discovery index, then open only the relevant `SKILL.md` files
|
|
38
|
+
- Use the platform's native file-read capability to examine skill descriptions and understand what each covers
|
|
36
39
|
|
|
37
40
|
2. **Identify Relevant Skills**:
|
|
38
41
|
Match the research topic to available skills. Common mappings:
|
|
@@ -123,4 +126,6 @@ Always cite your sources and indicate the authority level:
|
|
|
123
126
|
|
|
124
127
|
If you encounter conflicting advice, present the different viewpoints and explain the trade-offs.
|
|
125
128
|
|
|
129
|
+
**Tool Selection:** Use native file-search/glob (e.g., `Glob`), content-search (e.g., `Grep`), and file-read (e.g., `Read`) tools for repository exploration. Only use shell for commands with no native equivalent (e.g., `bundle show`), one command at a time.
|
|
130
|
+
|
|
126
131
|
Your research should be thorough but focused on practical application. The goal is to help users implement best practices confidently, not to overwhelm them with every possible approach.
|
|
@@ -103,4 +103,6 @@ Structure your findings as:
|
|
|
103
103
|
6. **Common Issues**: Known problems and their solutions
|
|
104
104
|
7. **References**: Links to documentation, GitHub issues, and source files
|
|
105
105
|
|
|
106
|
+
**Tool Selection:** Use native file-search/glob (e.g., `Glob`), content-search (e.g., `Grep`), and file-read (e.g., `Read`) tools for repository exploration. Only use shell for commands with no native equivalent (e.g., `bundle show`), one command at a time.
|
|
107
|
+
|
|
106
108
|
Remember: You are the bridge between complex documentation and practical implementation. Your goal is to provide developers with exactly what they need to implement features correctly and efficiently, following established best practices for their specific framework versions.
|
|
@@ -23,17 +23,19 @@ assistant: "Let me use the git-history-analyzer agent to investigate the histori
|
|
|
23
23
|
|
|
24
24
|
You are a Git History Analyzer, an expert in archaeological analysis of code repositories. Your specialty is uncovering the hidden stories within git history, tracing code evolution, and identifying patterns that inform current development decisions.
|
|
25
25
|
|
|
26
|
+
**Tool Selection:** Use native file-search/glob (e.g., `Glob`), content-search (e.g., `Grep`), and file-read (e.g., `Read`) tools for all non-git exploration. Use shell only for git commands, one command per call.
|
|
27
|
+
|
|
26
28
|
Your core responsibilities:
|
|
27
29
|
|
|
28
|
-
1. **File Evolution Analysis**:
|
|
30
|
+
1. **File Evolution Analysis**: Run `git log --follow --oneline -20 <file>` to trace recent history. Identify major refactorings, renames, and significant changes.
|
|
29
31
|
|
|
30
|
-
2. **Code Origin Tracing**:
|
|
32
|
+
2. **Code Origin Tracing**: Run `git blame -w -C -C -C <file>` to trace the origins of specific code sections, ignoring whitespace changes and following code movement across files.
|
|
31
33
|
|
|
32
|
-
3. **Pattern Recognition**:
|
|
34
|
+
3. **Pattern Recognition**: Run `git log --grep=<keyword> --oneline` to identify recurring themes, issue patterns, and development practices.
|
|
33
35
|
|
|
34
|
-
4. **Contributor Mapping**:
|
|
36
|
+
4. **Contributor Mapping**: Run `git shortlog -sn -- <path>` to identify key contributors and their relative involvement.
|
|
35
37
|
|
|
36
|
-
5. **Historical Pattern Extraction**:
|
|
38
|
+
5. **Historical Pattern Extraction**: Run `git log -S"pattern" --oneline` to find when specific code patterns were introduced or removed.
|
|
37
39
|
|
|
38
40
|
Your analysis methodology:
|
|
39
41
|
- Start with a broad view of file history before diving into specifics
|
|
@@ -56,8 +56,10 @@ You are an expert repository research analyst specializing in understanding code
|
|
|
56
56
|
- Analyze template structure and required fields
|
|
57
57
|
|
|
58
58
|
5. **Codebase Pattern Search**
|
|
59
|
-
- Use
|
|
60
|
-
-
|
|
59
|
+
- Use the native content-search tool for text and regex pattern searches
|
|
60
|
+
- Use the native file-search/glob tool to discover files by name or extension
|
|
61
|
+
- Use the native file-read tool to examine file contents
|
|
62
|
+
- Use `ast-grep` via shell when syntax-aware pattern matching is needed
|
|
61
63
|
- Identify common implementation patterns
|
|
62
64
|
- Document naming conventions and code organization
|
|
63
65
|
|
|
@@ -115,14 +117,7 @@ Structure your findings as:
|
|
|
115
117
|
- Flag any contradictions or outdated information
|
|
116
118
|
- Provide specific file paths and examples to support findings
|
|
117
119
|
|
|
118
|
-
**
|
|
119
|
-
|
|
120
|
-
Use the built-in tools for efficient searching:
|
|
121
|
-
- **Grep tool**: For text/code pattern searches with regex support (uses ripgrep under the hood)
|
|
122
|
-
- **Glob tool**: For file discovery by pattern (e.g., `**/*.md`, `**/CLAUDE.md`)
|
|
123
|
-
- **Read tool**: For reading file contents once located
|
|
124
|
-
- For AST-based code patterns: `ast-grep --lang ruby -p 'pattern'` or `ast-grep --lang typescript -p 'pattern'`
|
|
125
|
-
- Check multiple variations of common file names
|
|
120
|
+
**Tool Selection:** Use native file-search/glob (e.g., `Glob`), content-search (e.g., `Grep`), and file-read (e.g., `Read`) tools for repository exploration. Only use shell for commands with no native equivalent (e.g., `ast-grep`), one command at a time.
|
|
126
121
|
|
|
127
122
|
**Important Considerations:**
|
|
128
123
|
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { formatFrontmatter } from "../utils/frontmatter"
|
|
2
|
-
import type { ClaudeAgent, ClaudeCommand, ClaudePlugin } from "../types/claude"
|
|
2
|
+
import type { ClaudeAgent, ClaudeCommand, ClaudePlugin, ClaudeSkill } from "../types/claude"
|
|
3
3
|
import type { CodexBundle, CodexGeneratedSkill } from "../types/codex"
|
|
4
4
|
import type { ClaudeToOpenCodeOptions } from "./claude-to-opencode"
|
|
5
|
+
import {
|
|
6
|
+
normalizeCodexName,
|
|
7
|
+
transformContentForCodex,
|
|
8
|
+
type CodexInvocationTargets,
|
|
9
|
+
} from "../utils/codex-content"
|
|
5
10
|
|
|
6
11
|
export type ClaudeToCodexOptions = ClaudeToOpenCodeOptions
|
|
7
12
|
|
|
@@ -11,42 +16,102 @@ export function convertClaudeToCodex(
|
|
|
11
16
|
plugin: ClaudePlugin,
|
|
12
17
|
_options: ClaudeToCodexOptions,
|
|
13
18
|
): CodexBundle {
|
|
14
|
-
const
|
|
15
|
-
const
|
|
19
|
+
const invocableCommands = plugin.commands.filter((command) => !command.disableModelInvocation)
|
|
20
|
+
const applyCompoundWorkflowModel = shouldApplyCompoundWorkflowModel(plugin)
|
|
21
|
+
const canonicalWorkflowSkills = applyCompoundWorkflowModel
|
|
22
|
+
? plugin.skills.filter((skill) => isCanonicalCodexWorkflowSkill(skill.name))
|
|
23
|
+
: []
|
|
24
|
+
const deprecatedWorkflowAliases = applyCompoundWorkflowModel
|
|
25
|
+
? plugin.skills.filter((skill) => isDeprecatedCodexWorkflowAlias(skill.name))
|
|
26
|
+
: []
|
|
27
|
+
const copiedSkills = applyCompoundWorkflowModel
|
|
28
|
+
? plugin.skills.filter((skill) => !isDeprecatedCodexWorkflowAlias(skill.name))
|
|
29
|
+
: plugin.skills
|
|
30
|
+
const skillDirs = copiedSkills.map((skill) => ({
|
|
16
31
|
name: skill.name,
|
|
17
32
|
sourceDir: skill.sourceDir,
|
|
18
33
|
}))
|
|
34
|
+
const promptNames = new Set<string>()
|
|
35
|
+
const usedSkillNames = new Set<string>(skillDirs.map((skill) => normalizeCodexName(skill.name)))
|
|
36
|
+
|
|
37
|
+
const commandPromptNames = new Map<string, string>()
|
|
38
|
+
for (const command of invocableCommands) {
|
|
39
|
+
commandPromptNames.set(
|
|
40
|
+
command.name,
|
|
41
|
+
uniqueName(normalizeCodexName(command.name), promptNames),
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const workflowPromptNames = new Map<string, string>()
|
|
46
|
+
for (const skill of canonicalWorkflowSkills) {
|
|
47
|
+
workflowPromptNames.set(
|
|
48
|
+
skill.name,
|
|
49
|
+
uniqueName(normalizeCodexName(skill.name), promptNames),
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const promptTargets: Record<string, string> = {}
|
|
54
|
+
for (const [commandName, promptName] of commandPromptNames) {
|
|
55
|
+
promptTargets[normalizeCodexName(commandName)] = promptName
|
|
56
|
+
}
|
|
57
|
+
for (const [skillName, promptName] of workflowPromptNames) {
|
|
58
|
+
promptTargets[normalizeCodexName(skillName)] = promptName
|
|
59
|
+
}
|
|
60
|
+
for (const alias of deprecatedWorkflowAliases) {
|
|
61
|
+
const canonicalName = toCanonicalWorkflowSkillName(alias.name)
|
|
62
|
+
const promptName = canonicalName ? workflowPromptNames.get(canonicalName) : undefined
|
|
63
|
+
if (promptName) {
|
|
64
|
+
promptTargets[normalizeCodexName(alias.name)] = promptName
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const skillTargets: Record<string, string> = {}
|
|
69
|
+
for (const skill of copiedSkills) {
|
|
70
|
+
if (applyCompoundWorkflowModel && isCanonicalCodexWorkflowSkill(skill.name)) continue
|
|
71
|
+
skillTargets[normalizeCodexName(skill.name)] = skill.name
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const invocationTargets: CodexInvocationTargets = { promptTargets, skillTargets }
|
|
19
75
|
|
|
20
|
-
const usedSkillNames = new Set<string>(skillDirs.map((skill) => normalizeName(skill.name)))
|
|
21
76
|
const commandSkills: CodexGeneratedSkill[] = []
|
|
22
|
-
const invocableCommands = plugin.commands.filter((command) => !command.disableModelInvocation)
|
|
23
77
|
const prompts = invocableCommands.map((command) => {
|
|
24
|
-
const promptName =
|
|
25
|
-
const commandSkill = convertCommandSkill(command, usedSkillNames)
|
|
78
|
+
const promptName = commandPromptNames.get(command.name)!
|
|
79
|
+
const commandSkill = convertCommandSkill(command, usedSkillNames, invocationTargets)
|
|
26
80
|
commandSkills.push(commandSkill)
|
|
27
|
-
const content = renderPrompt(command, commandSkill.name)
|
|
81
|
+
const content = renderPrompt(command, commandSkill.name, invocationTargets)
|
|
28
82
|
return { name: promptName, content }
|
|
29
83
|
})
|
|
84
|
+
const workflowPrompts = canonicalWorkflowSkills.map((skill) => ({
|
|
85
|
+
name: workflowPromptNames.get(skill.name)!,
|
|
86
|
+
content: renderWorkflowPrompt(skill),
|
|
87
|
+
}))
|
|
30
88
|
|
|
31
|
-
const agentSkills = plugin.agents.map((agent) =>
|
|
89
|
+
const agentSkills = plugin.agents.map((agent) =>
|
|
90
|
+
convertAgent(agent, usedSkillNames, invocationTargets),
|
|
91
|
+
)
|
|
32
92
|
const generatedSkills = [...commandSkills, ...agentSkills]
|
|
33
93
|
|
|
34
94
|
return {
|
|
35
|
-
prompts,
|
|
95
|
+
prompts: [...prompts, ...workflowPrompts],
|
|
36
96
|
skillDirs,
|
|
37
97
|
generatedSkills,
|
|
98
|
+
invocationTargets,
|
|
38
99
|
mcpServers: plugin.mcpServers,
|
|
39
100
|
}
|
|
40
101
|
}
|
|
41
102
|
|
|
42
|
-
function convertAgent(
|
|
43
|
-
|
|
103
|
+
function convertAgent(
|
|
104
|
+
agent: ClaudeAgent,
|
|
105
|
+
usedNames: Set<string>,
|
|
106
|
+
invocationTargets: CodexInvocationTargets,
|
|
107
|
+
): CodexGeneratedSkill {
|
|
108
|
+
const name = uniqueName(normalizeCodexName(agent.name), usedNames)
|
|
44
109
|
const description = sanitizeDescription(
|
|
45
110
|
agent.description ?? `Converted from Claude agent ${agent.name}`,
|
|
46
111
|
)
|
|
47
112
|
const frontmatter: Record<string, unknown> = { name, description }
|
|
48
113
|
|
|
49
|
-
let body = transformContentForCodex(agent.body.trim())
|
|
114
|
+
let body = transformContentForCodex(agent.body.trim(), invocationTargets)
|
|
50
115
|
if (agent.capabilities && agent.capabilities.length > 0) {
|
|
51
116
|
const capabilities = agent.capabilities.map((capability) => `- ${capability}`).join("\n")
|
|
52
117
|
body = `## Capabilities\n${capabilities}\n\n${body}`.trim()
|
|
@@ -59,8 +124,12 @@ function convertAgent(agent: ClaudeAgent, usedNames: Set<string>): CodexGenerate
|
|
|
59
124
|
return { name, content }
|
|
60
125
|
}
|
|
61
126
|
|
|
62
|
-
function convertCommandSkill(
|
|
63
|
-
|
|
127
|
+
function convertCommandSkill(
|
|
128
|
+
command: ClaudeCommand,
|
|
129
|
+
usedNames: Set<string>,
|
|
130
|
+
invocationTargets: CodexInvocationTargets,
|
|
131
|
+
): CodexGeneratedSkill {
|
|
132
|
+
const name = uniqueName(normalizeCodexName(command.name), usedNames)
|
|
64
133
|
const frontmatter: Record<string, unknown> = {
|
|
65
134
|
name,
|
|
66
135
|
description: sanitizeDescription(
|
|
@@ -74,95 +143,55 @@ function convertCommandSkill(command: ClaudeCommand, usedNames: Set<string>): Co
|
|
|
74
143
|
if (command.allowedTools && command.allowedTools.length > 0) {
|
|
75
144
|
sections.push(`## Allowed tools\n${command.allowedTools.map((tool) => `- ${tool}`).join("\n")}`)
|
|
76
145
|
}
|
|
77
|
-
|
|
78
|
-
const transformedBody = transformTaskCalls(command.body.trim())
|
|
146
|
+
const transformedBody = transformContentForCodex(command.body.trim(), invocationTargets)
|
|
79
147
|
sections.push(transformedBody)
|
|
80
148
|
const body = sections.filter(Boolean).join("\n\n").trim()
|
|
81
149
|
const content = formatFrontmatter(frontmatter, body.length > 0 ? body : command.body)
|
|
82
150
|
return { name, content }
|
|
83
151
|
}
|
|
84
152
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
* 2. Slash commands: /command-name → /prompts:command-name
|
|
91
|
-
* 3. Agent references: @agent-name → $agent-name skill
|
|
92
|
-
*
|
|
93
|
-
* This bridges the gap since Claude Code and Codex have different syntax
|
|
94
|
-
* for invoking commands, agents, and skills.
|
|
95
|
-
*/
|
|
96
|
-
function transformContentForCodex(body: string): string {
|
|
97
|
-
let result = body
|
|
98
|
-
|
|
99
|
-
// 1. Transform Task agent calls
|
|
100
|
-
// Match: Task repo-research-analyst(feature_description)
|
|
101
|
-
// Match: - Task learnings-researcher(args)
|
|
102
|
-
const taskPattern = /^(\s*-?\s*)Task\s+([a-z][a-z0-9-]*)\(([^)]+)\)/gm
|
|
103
|
-
result = result.replace(taskPattern, (_match, prefix: string, agentName: string, args: string) => {
|
|
104
|
-
const skillName = normalizeName(agentName)
|
|
105
|
-
const trimmedArgs = args.trim()
|
|
106
|
-
return `${prefix}Use the $${skillName} skill to: ${trimmedArgs}`
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
// 2. Transform slash command references
|
|
110
|
-
// Match: /command-name or /workflows:command but NOT /path/to/file or URLs
|
|
111
|
-
// Look for slash commands in contexts like "Run /command", "use /command", etc.
|
|
112
|
-
// Avoid matching file paths (contain multiple slashes) or URLs (contain ://)
|
|
113
|
-
const slashCommandPattern = /(?<![:\w])\/([a-z][a-z0-9_:-]*?)(?=[\s,."')\]}`]|$)/gi
|
|
114
|
-
result = result.replace(slashCommandPattern, (match, commandName: string) => {
|
|
115
|
-
// Skip if it looks like a file path (contains /)
|
|
116
|
-
if (commandName.includes('/')) return match
|
|
117
|
-
// Skip common non-command patterns
|
|
118
|
-
if (['dev', 'tmp', 'etc', 'usr', 'var', 'bin', 'home'].includes(commandName)) return match
|
|
119
|
-
// Transform to Codex prompt syntax
|
|
120
|
-
const normalizedName = normalizeName(commandName)
|
|
121
|
-
return `/prompts:${normalizedName}`
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
// 3. Rewrite .claude/ paths to .codex/
|
|
125
|
-
result = result
|
|
126
|
-
.replace(/~\/\.claude\//g, "~/.codex/")
|
|
127
|
-
.replace(/\.claude\//g, ".codex/")
|
|
128
|
-
|
|
129
|
-
// 4. Transform @agent-name references
|
|
130
|
-
// Match: @agent-name in text (not emails)
|
|
131
|
-
const agentRefPattern = /@([a-z][a-z0-9-]*-(?:agent|reviewer|researcher|analyst|specialist|oracle|sentinel|guardian|strategist))/gi
|
|
132
|
-
result = result.replace(agentRefPattern, (_match, agentName: string) => {
|
|
133
|
-
const skillName = normalizeName(agentName)
|
|
134
|
-
return `$${skillName} skill`
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
return result
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// Alias for backward compatibility
|
|
141
|
-
const transformTaskCalls = transformContentForCodex
|
|
142
|
-
|
|
143
|
-
function renderPrompt(command: ClaudeCommand, skillName: string): string {
|
|
153
|
+
function renderPrompt(
|
|
154
|
+
command: ClaudeCommand,
|
|
155
|
+
skillName: string,
|
|
156
|
+
invocationTargets: CodexInvocationTargets,
|
|
157
|
+
): string {
|
|
144
158
|
const frontmatter: Record<string, unknown> = {
|
|
145
159
|
description: command.description,
|
|
146
160
|
"argument-hint": command.argumentHint,
|
|
147
161
|
}
|
|
148
162
|
const instructions = `Use the $${skillName} skill for this command and follow its instructions.`
|
|
149
|
-
|
|
150
|
-
const transformedBody = transformTaskCalls(command.body)
|
|
163
|
+
const transformedBody = transformContentForCodex(command.body, invocationTargets)
|
|
151
164
|
const body = [instructions, "", transformedBody].join("\n").trim()
|
|
152
165
|
return formatFrontmatter(frontmatter, body)
|
|
153
166
|
}
|
|
154
167
|
|
|
155
|
-
function
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
.
|
|
162
|
-
.
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
168
|
+
function renderWorkflowPrompt(skill: ClaudeSkill): string {
|
|
169
|
+
const frontmatter: Record<string, unknown> = {
|
|
170
|
+
description: skill.description,
|
|
171
|
+
"argument-hint": skill.argumentHint,
|
|
172
|
+
}
|
|
173
|
+
const body = [
|
|
174
|
+
`Use the ${skill.name} skill for this workflow and follow its instructions exactly.`,
|
|
175
|
+
"Treat any text after the prompt name as the workflow context to pass through.",
|
|
176
|
+
].join("\n\n")
|
|
177
|
+
return formatFrontmatter(frontmatter, body)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function isCanonicalCodexWorkflowSkill(name: string): boolean {
|
|
181
|
+
return name.startsWith("ce:")
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function isDeprecatedCodexWorkflowAlias(name: string): boolean {
|
|
185
|
+
return name.startsWith("workflows:")
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function toCanonicalWorkflowSkillName(name: string): string | null {
|
|
189
|
+
if (!isDeprecatedCodexWorkflowAlias(name)) return null
|
|
190
|
+
return `ce:${name.slice("workflows:".length)}`
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function shouldApplyCompoundWorkflowModel(plugin: ClaudePlugin): boolean {
|
|
194
|
+
return plugin.manifest.name === "compound-engineering"
|
|
166
195
|
}
|
|
167
196
|
|
|
168
197
|
function sanitizeDescription(value: string, maxLength = CODEX_DESCRIPTION_MAX_LENGTH): string {
|