@softspark/ai-toolkit 4.14.0 → 4.15.0

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +11 -10
  3. package/app/.claude-plugin/plugin.json +1 -1
  4. package/app/CLAUDE.md.template +3 -0
  5. package/app/agents/fact-checker.md +1 -1
  6. package/app/hooks/_search-capability.sh +3 -2
  7. package/app/hooks/stop-search-check.sh +2 -1
  8. package/benchmarks/ecosystem-doctor-snapshot.json +73 -31
  9. package/kb/procedures/maintenance-sop.md +26 -13
  10. package/kb/procedures/release-verification-sop.md +41 -36
  11. package/kb/reference/architecture-overview.md +23 -7
  12. package/kb/reference/codex-cli-compatibility.md +96 -36
  13. package/kb/reference/extension-api.md +52 -9
  14. package/kb/reference/global-install-model.md +53 -21
  15. package/kb/reference/hooks-catalog.md +44 -8
  16. package/kb/reference/mcp-editor-compatibility.md +27 -6
  17. package/kb/reference/mcp-templates.md +12 -6
  18. package/kb/reference/opencode-compatibility.md +13 -7
  19. package/kb/reference/plugin-pack-conventions.md +7 -7
  20. package/kb/reference/skills-catalog.md +3 -3
  21. package/kb/reference/supported-tools-registry.md +19 -17
  22. package/kb/reference/windows-support.md +26 -3
  23. package/llms-full.txt +443 -180
  24. package/llms.txt +1 -1
  25. package/manifest.json +1 -1
  26. package/package.json +2 -2
  27. package/scripts/codex_skill_adapter.py +448 -198
  28. package/scripts/dir_rules_shared.py +2 -11
  29. package/scripts/ecosystem_tools.json +29 -8
  30. package/scripts/emission.py +5 -91
  31. package/scripts/generate_agents_md.py +4 -87
  32. package/scripts/generate_codex.py +5 -95
  33. package/scripts/generate_codex_agents.py +242 -0
  34. package/scripts/generate_codex_hooks.py +648 -55
  35. package/scripts/generate_codex_skills.py +15 -6
  36. package/scripts/generate_copilot.py +771 -74
  37. package/scripts/generate_copilot_hooks.py +606 -0
  38. package/scripts/generate_cursor_hooks.py +453 -121
  39. package/scripts/generate_opencode_commands.py +4 -6
  40. package/scripts/inject_hook_cli.py +770 -205
  41. package/scripts/injection.py +102 -23
  42. package/scripts/install_steps/ai_tools.py +123 -83
  43. package/scripts/instruction_core.py +95 -0
  44. package/scripts/mcp_editors.py +934 -80
  45. package/scripts/mcp_manager.py +46 -26
  46. package/scripts/plugin.py +291 -114
  47. package/scripts/secure_fs.py +538 -0
  48. package/scripts/uninstall.py +1279 -208
@@ -3,10 +3,10 @@ title: "SOP: Release Verification"
3
3
  category: procedures
4
4
  service: ai-toolkit
5
5
  tags: [sop, verification, release, smoke-test, install, update, qa, provenance, sarif]
6
- version: "1.6.0"
6
+ version: "1.7.0"
7
7
  created: "2026-04-08"
8
- last_updated: "2026-07-02"
9
- description: "End-to-end smoke test after installing or updating @softspark/ai-toolkit verifies CLI, installs, Claude app plugin export, doctor, validation, tests, eject, npm provenance attestation, SARIF audit, and per-skill permissions. v1.6.0 adds the Claude Chat/Cowork plugin validation and replaces the retired Cascade hook surface with Devin hooks."
8
+ last_updated: "2026-07-14"
9
+ description: "End-to-end smoke test after installing or updating @softspark/ai-toolkit. Verifies CLI, native Codex and GitHub Copilot surfaces, Claude app export, doctor, validation, tests, eject, provenance, SARIF, and per-skill permissions."
10
10
  ---
11
11
 
12
12
  # SOP: Release Verification
@@ -31,31 +31,31 @@ Verifies all critical paths from the user's perspective.
31
31
 
32
32
  ## Quick Checklist (TL;DR)
33
33
 
34
- 13 commands — if all pass, the release is ready:
34
+ 14 commands — if all pass, the release is ready:
35
35
 
36
36
  ```bash
37
37
  # Pre-commit (Phase 0)
38
38
  python3 scripts/generate_agents_md.py > AGENTS.md # 1. Regenerate AGENTS.md
39
39
  python3 scripts/generate_llms_txt.py > llms.txt # 2. Regenerate llms.txt
40
40
  python3 scripts/validate.py --strict # 3. Validation passed?
41
- npm test > /tmp/npm-test.log 2>&1 && grep -c '^ok ' /tmp/npm-test.log && ! grep -q '^not ok' /tmp/npm-test.log # 5. All tests passed? (single run, cached)
41
+ npm test > /tmp/npm-test.log 2>&1 && grep -c '^ok ' /tmp/npm-test.log && ! grep -q '^not ok' /tmp/npm-test.log # 4. All tests passed? (single run, cached)
42
42
 
43
43
  # Post-install verification (Phases 1-7)
44
- ai-toolkit --version # 6. Version OK?
45
- ai-toolkit status # 7. Status OK?
46
- ai-toolkit doctor # 8. Health check passed?
47
- ai-toolkit install --dry-run # 9. Global install OK?
48
- python3 scripts/audit_skills.py --ci # 10. Security audit clean?
44
+ ai-toolkit --version # 5. Version OK?
45
+ ai-toolkit status # 6. Status OK?
46
+ ai-toolkit doctor # 7. Health check passed?
47
+ ai-toolkit install --dry-run # 8. Global install OK?
48
+ python3 scripts/audit_skills.py --ci # 9. Security audit clean?
49
49
 
50
50
  # Supply-chain verification (Phase 8, v2.8.0+)
51
- python3 scripts/audit_skills.py --sarif | python3 -c "import json,sys; assert json.load(sys.stdin)['version']=='2.1.0'; print('SARIF OK')" # 11. SARIF 2.1.0 well-formed?
52
- python3 scripts/audit_skills.py --permissions | head -30 # 12. Broad-access skills reviewed?
53
- npm view @softspark/ai-toolkit@X.Y.Z --json | python3 -c "import json,sys; d=json.load(sys.stdin); assert d['dist']['attestations']['provenance']['predicateType']=='https://slsa.dev/provenance/v1'; print('PROVENANCE OK')" # 13. Provenance attested on npm?
54
- python3 scripts/claude_app.py verify # 14. Claude Chat/Cowork plugin contract valid?
51
+ python3 scripts/audit_skills.py --sarif | python3 -c "import json,sys; assert json.load(sys.stdin)['version']=='2.1.0'; print('SARIF OK')" # 10. SARIF 2.1.0 well-formed?
52
+ python3 scripts/audit_skills.py --permissions | head -30 # 11. Broad-access skills reviewed?
53
+ npm view @softspark/ai-toolkit@X.Y.Z --json | python3 -c "import json,sys; d=json.load(sys.stdin); assert d['dist']['attestations']['provenance']['predicateType']=='https://slsa.dev/provenance/v1'; print('PROVENANCE OK')" # 12. Provenance attested on npm?
54
+ python3 scripts/claude_app.py verify # 13. Claude Chat/Cowork plugin contract valid?
55
55
 
56
56
  # Deep-coverage verification (Phase 9, v3.0.0+)
57
57
  META="generate_agents_md.py|generate_llms_txt.py|generate_language_rules_skills.py"
58
- diff <(grep -oE 'scripts/generate_[a-z_]+\.py' kb/reference/supported-tools-registry.md | sort -u) <(ls scripts/generate_*.py | grep -vE "$META" | sort -u) && echo "OK: registry matches" # 15. Registry <-> generators drift?
58
+ diff <(grep -oE 'scripts/generate_[a-z_]+\.py' kb/reference/supported-tools-registry.md | sort -u) <(ls scripts/generate_*.py | grep -vE "$META" | sort -u) && echo "OK: registry matches" # 14. Registry <-> generators drift?
59
59
  ```
60
60
 
61
61
  ---
@@ -123,10 +123,10 @@ ai-toolkit status
123
123
  ```
124
124
 
125
125
  **Verify `--dry-run`:**
126
- - [ ] Agents >= 44
127
- - [ ] Skills >= 99
126
+ - [ ] Agents: 44
127
+ - [ ] Skills: 108
128
128
  - [ ] Hooks merged into settings.json
129
- - [ ] "Other AI Tools" section lists documented global targets (with `--editors`): aider, antigravity, augment, cline, codex, copilot, cursor, gemini, opencode, roo, windsurf. Scope varies (v4.12.0+): cursor = `~/.cursor/hooks.json` only, copilot = `~/.copilot/` instructions, antigravity = `~/.gemini/*/skills` pointer; Cursor and Antigravity RULES still install only via `--local` (no mergeable global rules file)
129
+ - [ ] "Other AI Tools" lists documented global targets (with `--editors`): aider, antigravity, augment, cline, codex, copilot, cursor, gemini, opencode, roo, windsurf. Scope varies: Codex uses `$CODEX_HOME` (default `~/.codex`) plus `$HOME/.agents/skills`; Copilot uses `$COPILOT_HOME` (default `~/.copilot`); cursor has only `~/.cursor/hooks.json`; antigravity has the `~/.gemini/*/skills` pointer. Cursor and Antigravity rules remain project-only.
130
130
 
131
131
  **Verify `status`:**
132
132
  - [ ] Version matches expected
@@ -195,7 +195,7 @@ python3 scripts/audit_skills.py --ci
195
195
  ```
196
196
 
197
197
  **Verify validate.py:**
198
- - [ ] Agents >= 44, Skills >= 99, Tests >= 900
198
+ - [ ] Agents: 44, Skills: 108, Tests: exactly the current README badge count
199
199
  - [ ] Hook events: 14, Hook scripts: >= 30
200
200
  - [ ] Plugin packs >= 10, KB documents >= 20
201
201
  - [ ] `Errors: 0 | Warnings: 0` → `VALIDATION PASSED`
@@ -340,9 +340,9 @@ These verify the native-surface generators shipped in v3.0.0 actually emit the r
340
340
 
341
341
  ```bash
342
342
  D=/tmp/aitk-profile-full-${RANDOM} && mkdir -p "$D" && cd "$D" && git init -q
343
- ai-toolkit install --local --editors cursor,windsurf,gemini,augment,codex \
344
- --profile full --codex-skills --dry-run 2>&1 \
345
- | grep -E "\\.cursor/(hooks\\.json|agents)|\\.devin/hooks\\.v1\\.json|\\.gemini/(settings\\.json|commands)|\\.augment/(agents|commands)|\\.agents/skills"
343
+ ai-toolkit install --local --editors cursor,windsurf,gemini,augment,codex,copilot \
344
+ --profile full --dry-run 2>&1 \
345
+ | grep -E "\\.cursor/(hooks\\.json|agents)|\\.devin/hooks\\.v1\\.json|\\.gemini/(settings\\.json|commands)|\\.augment/(agents|commands)|\\.codex/(agents|hooks)|\\.agents/skills|\\.github/(agents|skills|instructions|prompts|hooks)"
346
346
  ```
347
347
 
348
348
  **Verify** — at least the following lines appear:
@@ -350,26 +350,29 @@ ai-toolkit install --local --editors cursor,windsurf,gemini,augment,codex \
350
350
  - [ ] `.devin/hooks.v1.json`
351
351
  - [ ] `.gemini/settings.json` hooks AND `.gemini/commands/`
352
352
  - [ ] `.augment/agents/` + `.augment/commands/` + `$HOME/.augment/settings.json`
353
- - [ ] `.agents/skills/` (Codex native discovery path; refreshed by `--codex-skills`)
353
+ - [ ] `.codex/hooks.json` + `.codex/hooks/` + `.codex/agents/`
354
+ - [ ] `.agents/skills/` (Codex native discovery path)
355
+ - [ ] `.github/agents/` + `.github/skills/` + `.github/instructions/` + `.github/prompts/` + `.github/hooks/`
354
356
 
355
- ### 9.2 `--codex-skills` is orthogonal to `--profile`
357
+ ### 9.2 Codex skills are profile-independent
356
358
 
357
359
  ```bash
358
360
  D=/tmp/aitk-codex-skills-${RANDOM} && mkdir -p "$D" && cd "$D" && git init -q
361
+ ai-toolkit install --local --editors codex --profile minimal --dry-run 2>&1 \
362
+ | grep -q "Would generate: .agents/skills" && echo "OK: Codex skills emit at minimal"
359
363
  ai-toolkit install --local --editors codex --profile standard --codex-skills --dry-run 2>&1 \
360
- | grep -q "Would refresh: .agents/skills" && echo "OK: --codex-skills refreshes .agents/skills without --profile full"
361
- ai-toolkit install --local --editors codex --profile full --dry-run 2>&1 \
362
- | grep -q "Would generate: .agents/skills" && echo "OK: Codex skills use .agents/skills at profile full"
364
+ | grep -q "Would refresh: .agents/skills" && echo "OK: legacy flag explicitly refreshes the same catalog"
363
365
  ```
364
366
 
365
367
  **Verify:**
366
- - [ ] `--codex-skills` refreshes `.agents/skills/` at any profile
367
- - [ ] `--profile full` never emits `.codex/skills/`; Codex skills use `.agents/skills/`
368
+ - [ ] Selecting Codex emits all skills under `.agents/skills/` at every profile
369
+ - [ ] `--codex-skills` remains an explicit refresh alias; it is not required for installation
370
+ - [ ] No profile emits `.codex/skills/`
368
371
 
369
372
  ### 9.3 Breaking-change surfaces land on `--profile standard`
370
373
 
371
- v3.0.0 moved two surfaces from opt-in to default:
372
- - Copilot directory layout (`.github/instructions/`, `.github/prompts/`)
374
+ The standard profile must include:
375
+ - Copilot scoped instructions, prompts, custom agents, portable skills, and hooks
373
376
  - Gemini hooks (`.gemini/settings.json`)
374
377
 
375
378
  ```bash
@@ -377,10 +380,12 @@ D=/tmp/aitk-breaking-${RANDOM} && mkdir -p "$D" && cd "$D" && git init -q
377
380
  ai-toolkit install --local --editors copilot,gemini --profile standard --dry-run 2>&1 \
378
381
  | tee /tmp/aitk-breaking.log
379
382
  grep -q "\\.github/instructions/" /tmp/aitk-breaking.log && echo "OK: Copilot dir layout at standard"
383
+ grep -q "\\.github/agents/.*\\.github/skills/" /tmp/aitk-breaking.log && echo "OK: Copilot agents and skills at standard"
384
+ grep -q "\\.github/hooks/" /tmp/aitk-breaking.log && echo "OK: Copilot hooks at standard"
380
385
  grep -q "\\.gemini/settings\\.json hooks" /tmp/aitk-breaking.log && echo "OK: Gemini hooks at standard"
381
386
  ```
382
387
 
383
- **Verify both lines print `OK:`**. If either is missing, a regression has unwound the v3.0.0 breaking change.
388
+ **Verify all four lines print `OK:`**. If any is missing, native Copilot or Gemini coverage has regressed.
384
389
 
385
390
  ### 9.4 Install is idempotent
386
391
 
@@ -404,8 +409,8 @@ The bats suite validates JSON shape at generation time. This re-checks that what
404
409
 
405
410
  ```bash
406
411
  D=/tmp/aitk-json-${RANDOM} && mkdir -p "$D" && cd "$D" && git init -q
407
- ai-toolkit install --local --editors cursor,windsurf,gemini,augment --profile full >/dev/null 2>&1
408
- for f in .cursor/hooks.json .devin/hooks.v1.json .gemini/settings.json $HOME/.augment/settings.json; do
412
+ ai-toolkit install --local --editors cursor,windsurf,gemini,augment,codex,copilot --profile full >/dev/null 2>&1
413
+ for f in .cursor/hooks.json .devin/hooks.v1.json .gemini/settings.json .codex/hooks.json .github/hooks/ai-toolkit.json "$HOME/.augment/settings.json"; do
409
414
  [ -f "$f" ] && python3 -c "import json; json.load(open('$f'))" && echo "OK: $f"
410
415
  done
411
416
  ```
@@ -493,8 +498,8 @@ ai-toolkit eject /tmp/test # retry
493
498
  | Tests | `npm test`: N/N passed, 0 failures |
494
499
  | Eject | Standalone `.claude/` with real files AND `output-styles/` directory |
495
500
  | Guards | Destructive commands blocked |
496
- | Deep coverage | `--profile full` emits all 9 v3.0.0 native surfaces; `--codex-skills` works orthogonally |
497
- | Breaking changes | Copilot directory layout + Gemini hooks emit at `--profile standard` (v3.0.0 contract) |
501
+ | Deep coverage | `--profile full` emits every documented native surface, including Codex agents/skills/hooks and Copilot agents/skills/hooks |
502
+ | Profile contract | Codex skills emit at every profile without `--codex-skills`; Copilot standard emits agents, skills, instructions, prompts, and hooks |
498
503
  | Idempotence | Second `install` run produces byte-identical output in every managed path |
499
504
  | Live JSON | Every generated `.json` file on disk parses as valid JSON |
500
505
  | Registry | `supported-tools-registry.md` enumerates every `scripts/generate_*.py` we ship |
@@ -3,9 +3,9 @@ title: "AI Toolkit - Architecture Overview"
3
3
  category: reference
4
4
  service: ai-toolkit
5
5
  tags: [architecture, overview, design, structure]
6
- version: "1.4.6"
6
+ version: "1.4.7"
7
7
  created: "2026-03-23"
8
- last_updated: "2026-06-10"
8
+ last_updated: "2026-07-14"
9
9
  description: "Architecture of ai-toolkit: directory layout, Claude app export, global install model, editor-aware MCP install, Codex translation layer, skill tiers, and integration with projects."
10
10
  ---
11
11
 
@@ -55,7 +55,8 @@ ai-toolkit/
55
55
  generate_agents_md.py # Regenerates AGENTS.md
56
56
  generate_cursor_rules.py # Generates .cursorrules (sources _common.py)
57
57
  generate_windsurf.py # Generates .windsurfrules (sources _common.py)
58
- generate_copilot.py # Generates Copilot .github/* surfaces; install also injects AGENTS.md
58
+ generate_copilot.py # Generates Copilot instructions, agents, and portable skills
59
+ generate_copilot_hooks.py # Generates native Copilot hooks + self-contained runtime
59
60
  generate_gemini.py # Generates GEMINI.md (sources _common.py)
60
61
  generate_cline.py # Generates .clinerules (sources _common.py)
61
62
  generate_roo_modes.py # Generates .roomodes
@@ -112,11 +113,26 @@ Machine (global) Project (local)
112
113
  - `--editors cursor,aider` — install only selected editors
113
114
  - (no flag) — auto-detect from existing project files; `update --local` picks up whatever editors already have configs
114
115
 
115
- Each editor gets directory-based format (`.cursor/rules/*.mdc`, `.devin/rules/*.md` + `.windsurf/rules/*.md` (dual-emit since the Devin Desktop rebrand), `.github/instructions/*.instructions.md` + `.github/prompts/*.prompt.md` + root `AGENTS.md` for Copilot agent instructions, `.clinerules/*.md`, `.roo/rules/*.md`, `.augment/rules/ai-toolkit-*.md`, `.agents/rules/*.md`, `CONVENTIONS.md`). Full-profile installs also emit native skill pointer catalogues for Cursor, Windsurf, and Cline. Codex local install additionally generates `AGENTS.md` (universal coding rules inlined — Codex reads only AGENTS.md, not `.agents/rules/`), `.agents/skills/*`, and `.codex/hooks.json`. Hooks are global-only — not merged into project settings except for editor-native local hook files such as Codex `.codex/hooks.json`. Experimental plugin packs can also layer a global Codex target in `HOME` (`~/AGENTS.md`, `~/.agents/`, `~/.codex/hooks.json`) when installed with `ai-toolkit plugin install --editor codex`.
116
+ Each editor gets its documented directory-based format. Copilot receives root
117
+ `AGENTS.md`, `.github/copilot-instructions.md`, native `.github/agents`, and
118
+ self-contained `.github/skills` in every profile. Profile `standard` and above
119
+ also emits `.github/instructions`, `.github/prompts`, and native
120
+ `.github/hooks`. The user target writes the supported personal surfaces below
121
+ `$COPILOT_HOME` (default `~/.copilot`) and does not generate prompt files there.
122
+ Full-profile installs also emit native skill pointer catalogues for Cursor,
123
+ Windsurf, and Cline. Codex local install generates `AGENTS.md`,
124
+ `.agents/skills/*`, `.codex/agents/*.toml`, `.codex/hooks.json`, and
125
+ self-contained `.codex/hooks/*`. Global Codex install writes its user-owned
126
+ surfaces below `$CODEX_HOME` (default `~/.codex`) while user skills remain in
127
+ the documented shared `$HOME/.agents/skills/` directory. Experimental plugin
128
+ packs can layer their rules, skills, and hooks onto that Codex user target.
116
129
 
117
130
  Claude Chat/Desktop/Cowork is deliberately outside `--editors`: the app does not scan filesystem configuration under `~/.claude`. `ai-toolkit claude-app export` creates a self-contained plugin ZIP with skills, agents, Cowork hooks, app-native rules, and bundled hook dependencies. It also emits the compact text that users paste into Cowork global instructions. Updating requires re-export and re-upload because the app owns its plugin store.
118
131
 
119
- If a project already has `.mcp.json`, local install mirrors its `mcpServers` entries into `.claude/settings.local.json` plus any selected editors with project-scoped native MCP files (`.cursor/mcp.json`, `.github/mcp.json`).
132
+ If a project already has `.mcp.json`, local install mirrors its `mcpServers`
133
+ entries into `.claude/settings.local.json` plus any selected editors with
134
+ project-scoped native MCP files: `.cursor/mcp.json`, `.github/mcp.json`,
135
+ `.roo/mcp.json`, and `.codex/config.toml`.
120
136
 
121
137
  ## CLI Commands
122
138
 
@@ -226,12 +242,12 @@ See `kb/reference/codex-cli-compatibility.md` for the detailed mapping.
226
242
  Current native adapters:
227
243
  - Claude Code: `.claude/settings.local.json` and `~/.claude/settings.json`
228
244
  - Cursor: `.cursor/mcp.json` and `~/.cursor/mcp.json`
229
- - GitHub Copilot: `.github/mcp.json` and `~/.copilot/mcp-config.json`
245
+ - GitHub Copilot: `.github/mcp.json` and `$COPILOT_HOME/mcp-config.json` (default `~/.copilot/mcp-config.json`)
230
246
  - Gemini CLI: `.gemini/settings.json` and `~/.gemini/settings.json`
231
247
  - Windsurf: `~/.codeium/windsurf/mcp_config.json`
232
248
  - Cline: `~/.cline/data/settings/cline_mcp_settings.json`
233
249
  - Augment: `~/.augment/settings.json`
234
- - Codex CLI: `~/.codex/config.toml`
250
+ - Codex CLI: `.codex/config.toml` and `$CODEX_HOME/config.toml` (default `~/.codex/config.toml`)
235
251
 
236
252
  See `kb/reference/mcp-editor-compatibility.md` for the support matrix and scope rules.
237
253
 
@@ -3,9 +3,9 @@ title: "AI Toolkit - Codex CLI Compatibility"
3
3
  category: reference
4
4
  service: ai-toolkit
5
5
  tags: [codex, compatibility, install, skills, hooks]
6
- version: "1.0.3"
6
+ version: "1.0.4"
7
7
  created: "2026-04-12"
8
- last_updated: "2026-05-25"
8
+ last_updated: "2026-07-14"
9
9
  description: "Reference for how ai-toolkit maps Claude-oriented skills, hooks, and plugin packs to Codex CLI."
10
10
  ---
11
11
 
@@ -15,15 +15,16 @@ description: "Reference for how ai-toolkit maps Claude-oriented skills, hooks, a
15
15
 
16
16
  Codex CLI now receives the full `ai-toolkit` skill catalog during local install.
17
17
 
18
- Native Codex-compatible skills are linked directly into `.agents/skills/`. Skills
19
- that depend on Claude-only orchestration primitives are generated as Codex
20
- wrappers that preserve the original workflow intent while translating execution
21
- to Codex subagents and plan tracking.
18
+ Native Codex-compatible skills are linked directly into `.agents/skills/`.
19
+ Skills that contain Claude-only tools, prompt placeholders, or skill-directory
20
+ variables are generated as Codex wrappers. The wrappers preserve workflow intent
21
+ using semantic subagent and planning guidance instead of version-specific tool
22
+ signatures.
22
23
 
23
- Experimental plugin packs can also target a global Codex surface with
24
+ Experimental plugin packs can also target the Codex user surface with
24
25
  `ai-toolkit plugin install --editor codex`, which layers plugin-specific skills,
25
- rules, and hooks into `HOME` without changing the project-local core install
26
- model.
26
+ rules, and hooks onto the active `CODEX_HOME` without changing project-local
27
+ configuration.
27
28
 
28
29
  ## Local Install Outputs
29
30
 
@@ -32,18 +33,46 @@ model.
32
33
  - `AGENTS.md` (project root; universal coding rules inlined — Codex reads instructions only from AGENTS.md, not `.agents/rules/`)
33
34
  - `.agents/skills/*`
34
35
  - `.codex/hooks.json`
36
+ - `.codex/hooks/*` (self-contained executable hook assets)
37
+ - `.codex/agents/*.toml`
38
+ - `.codex/config.toml` when project MCP servers are selected
39
+
40
+ Project-local Codex paths never follow `CODEX_HOME`; the variable selects the
41
+ user configuration root only.
42
+
43
+ ## Global Core Install Outputs
44
+
45
+ `ai-toolkit install --editors codex` writes Codex-owned user files below the
46
+ active `CODEX_HOME` (default `~/.codex`):
47
+
48
+ - `$CODEX_HOME/AGENTS.md`
49
+ - `$CODEX_HOME/agents/*.toml`
50
+ - `$CODEX_HOME/hooks.json`
51
+ - `$CODEX_HOME/ai-toolkit-hooks/*`
52
+
53
+ The portable user skill catalog intentionally remains under
54
+ `$HOME/.agents/skills/*`. This is Codex's documented shared user-skill discovery
55
+ path, not a Codex-owned config-root path. A configured `CODEX_HOME` must be an
56
+ existing absolute directory; the installer preserves user guidance, custom
57
+ agents, and unrelated hook handlers inside it.
58
+
59
+ Sources: [Codex environment variables](https://learn.chatgpt.com/codex/config-file/environment-variables),
60
+ [AGENTS.md discovery](https://learn.chatgpt.com/codex/agent-configuration/agents-md),
61
+ [Codex skills](https://developers.openai.com/codex/skills).
35
62
 
36
63
  ## Global Plugin Outputs
37
64
 
38
65
  `ai-toolkit plugin install --editor codex <pack>` bootstraps or reuses:
39
66
 
40
- - `~/.codex/AGENTS.md` (the documented global instruction file; pack rules are marker-injected here, not written as unread `~/.agents/rules/` files)
41
- - `~/.agents/skills/*`
42
- - `~/.codex/hooks.json`
67
+ - `$CODEX_HOME/AGENTS.md` (default `~/.codex/AGENTS.md`; pack rules are marker-injected here, not written as unread `.agents/rules/` files)
68
+ - `$HOME/.agents/skills/*`
69
+ - `$CODEX_HOME/hooks.json`
70
+ - `$CODEX_HOME/ai-toolkit-hooks/*`
43
71
 
44
72
  Plugin packs only add their own runtime-specific layer on top of the generated
45
- Codex base. Shared hook scripts and plugin scripts still live in
46
- `~/.softspark/ai-toolkit/`.
73
+ Codex base. Codex hooks no longer depend on executable paths under
74
+ `~/.softspark/ai-toolkit/`; project assets live beside `.codex/hooks.json`, and
75
+ user assets live under `$CODEX_HOME/ai-toolkit-hooks/`.
47
76
 
48
77
  ## Skill Translation Model
49
78
 
@@ -51,43 +80,46 @@ Two delivery modes are used for Codex:
51
80
 
52
81
  | Mode | How it is installed | Use case |
53
82
  |------|----------------------|----------|
54
- | Native | Symlink to `app/skills/<name>/` | Skills whose `allowed-tools` are already supported in Codex |
55
- | Adapted | Generated wrapper directory in `.agents/skills/<name>/` | Skills that rely on Claude-only `Agent`, `Team*`, or `Task*` primitives |
83
+ | Native | Symlink to `app/skills/<name>/` | Skills with portable tools, prompts, and paths |
84
+ | Adapted | Generated wrapper directory in `.agents/skills/<name>/` | Skills with Claude-only tools, prompt placeholders, path variables, or orchestration APIs |
56
85
 
57
86
  Adapted skills keep the same support assets (`reference/`, `scripts/`, `assets/`)
58
87
  via symlinks, but rewrite `SKILL.md` to Codex-native guidance.
59
88
 
60
- ## Claude-to-Codex Tool Mapping
89
+ ## Claude-to-Codex Semantic Mapping
61
90
 
62
- The adapter rewrites Claude-specific delegation guidance to the closest Codex
63
- runtime primitives:
91
+ The adapter deliberately avoids embedding runtime function names or guessed
92
+ signatures. Generated guidance describes stable intent:
64
93
 
65
- | Claude-oriented primitive | Codex replacement |
66
- |---------------------------|------------------|
67
- | `Agent(...)` | `spawn_agent(..., fork_context=True, ...)` |
68
- | `SendMessage` | `send_input` |
69
- | `TaskCreate` / `TaskList` / `TaskUpdate` | `update_plan` or explicit checklist tracking |
70
- | `TaskGet` / `TaskOutput` | `wait_agent` |
71
- | `TaskStop` / `TeamDelete` | `close_agent` |
72
- | Agent teams | Multiple spawned subagents with explicit file ownership |
94
+ | Claude-oriented concept | Codex guidance |
95
+ |-------------------------|----------------|
96
+ | Delegated agent call | Delegate a narrow task to a suitable Codex-native subagent |
97
+ | Agent redirection | Use the subagent controls available in the current client |
98
+ | Task bookkeeping | Use the planning mechanism available in the current client or an explicit checklist |
99
+ | Waiting for a task | Wait only when the next critical-path step depends on the delegated result |
100
+ | Agent teams | Coordinate subagents with explicit, non-overlapping ownership |
101
+ | Prompt input placeholder | Use the task details supplied by the user |
102
+ | Claude skill-directory variable | Use the installed skill directory containing `SKILL.md` |
73
103
 
74
104
  ## Adapted Skill Classes
75
105
 
76
- The main adapted group is multi-agent orchestration:
106
+ The adapted group includes multi-agent orchestration:
77
107
 
78
108
  - `/orchestrate`
79
109
  - `/workflow`
80
110
  - `/swarm`
81
111
  - `/subagent-development`
82
112
 
83
- The adapter also covers skills that previously depended only on Claude's
84
- `Agent` primitive, such as:
113
+ It also includes any skill that contains Claude-only prompt or path variables,
114
+ even when its tool list is otherwise portable. Examples include:
85
115
 
86
116
  - `/tdd`
87
117
  - `/write-a-prd`
88
118
  - `/qa-session`
89
119
  - `/triage-issue`
90
120
  - `/architecture-audit`
121
+ - `/build`
122
+ - `/cve-scan`
91
123
 
92
124
  ## Hook Compatibility
93
125
 
@@ -111,11 +143,26 @@ environment-snapshot probe). Claude-only events such as `TaskCompleted`,
111
143
  are not available in `.codex/hooks.json`. Handler types: only `command` runs;
112
144
  `prompt` and `agent` are parsed by Codex but not yet executed.
113
145
 
114
- `inject-hook` automatically propagates these 9 Codex-compatible events to
115
- `~/.codex/hooks.json` (global layer). Non-Codex events are silently skipped.
116
- `remove-hook` cleans both Claude and Codex targets.
117
-
118
- Generated Codex hook commands include `AI_TOOLKIT_HOOK_QUIET=1`. The generated
146
+ The generator merges these Codex-compatible events into project or user
147
+ `hooks.json`, preserving unrelated user handlers and replacing only commands
148
+ marked as ai-toolkit-owned. Project commands resolve their assets from the git
149
+ root; core user commands use `$CODEX_HOME/ai-toolkit-hooks/`.
150
+
151
+ Hook JSON is parsed from the snapshot held by the same secure transaction that
152
+ writes generated handlers, installs executable assets, and removes stale
153
+ managed assets. A failure in any of those stages rolls back the whole upgrade.
154
+ Existing file permissions are retained; new `hooks.json` files use a secure
155
+ `0600` base filtered by umask, while new executable hook assets are explicitly
156
+ installed as `0755`.
157
+
158
+ After installation or any hook change, open `/hooks` in Codex and review/trust
159
+ the exact definitions. Project hooks additionally require a trusted `.codex`
160
+ project layer. The installer never bypasses hook trust.
161
+
162
+ Generated Codex hook commands include `AI_TOOLKIT_HOOK_QUIET=1`. Native
163
+ `SessionStart`, `PreCompact`, and MCP-health adapters use Codex instruction and
164
+ config terminology (`AGENTS.md`, `.codex/config.toml`) instead of Claude-only
165
+ paths. The generated
119
166
  `UserPromptSubmit` governance hook does not set `AI_TOOLKIT_HOOK_FORMAT=json`
120
167
  by default because Codex currently renders `additionalContext` as visible hook
121
168
  context in the TUI. This keeps prompt-submit output quiet while preserving hook
@@ -147,6 +194,18 @@ Plain-text informational hook context is also silent by default in the shared
147
194
  hook helper. Set `AI_TOOLKIT_HOOK_VERBOSE=1` only when debugging hook output
148
195
  outside the Codex UI.
149
196
 
197
+ ## MCP Configuration
198
+
199
+ Codex MCP servers are supported at both documented scopes:
200
+
201
+ - project: `.codex/config.toml` (trusted project layers only)
202
+ - user: `$CODEX_HOME/config.toml` (default `~/.codex/config.toml`)
203
+
204
+ The adapter renders `[mcp_servers.<name>]` for STDIO and Streamable HTTP
205
+ transports. It validates documented transport, timeout, tool-filter, and
206
+ approval fields, preserves unrelated TOML bytes/comments, and owns only its
207
+ marker-bounded block. Invalid TOML and symlinked roots are rejected unchanged.
208
+
150
209
  ## Behavioral Limits
151
210
 
152
211
  Codex wrappers preserve workflow intent, but not every Claude runtime behavior
@@ -158,7 +217,8 @@ Known limits:
158
217
  - No separate task object model equivalent to Claude `Task*` APIs
159
218
  - Hook event coverage is narrower than Claude Code
160
219
  - MCP search tool calls may not fire the shared `PostToolUse` search tracker,
161
- so `stop-search-check.sh` also checks `~/.codex/log/codex-tui.log` for
220
+ so `stop-search-check.sh` also checks `$CODEX_HOME/log/codex-tui.log` (default
221
+ `~/.codex/log/codex-tui.log`) for
162
222
  `smart_query`, `hybrid_search_kb`, `crag_search`, `multi_hop_search`, and
163
223
  `verify_answer` calls after the search-first flag timestamp before blocking.
164
224
  The scan is bounded to a recent log window, but sized to tolerate noisy Codex
@@ -3,9 +3,9 @@ title: "Extension API Reference"
3
3
  category: reference
4
4
  service: ai-toolkit
5
5
  tags: [extension-api, inject-rule, inject-hook, inject-mcp, mcp-templates, integration, editors]
6
- version: "1.5.0"
6
+ version: "1.8.0"
7
7
  created: "2026-04-07"
8
- last_updated: "2026-05-12"
8
+ last_updated: "2026-07-14"
9
9
  description: "Reference for ai-toolkit's extension API: inject-rule, inject-hook, inject-mcp, remove-* variants, and editor-aware MCP template management."
10
10
  ---
11
11
 
@@ -23,8 +23,8 @@ This design is intentional: ai-toolkit is a generic toolkit. Consumers (MCP serv
23
23
  |---------|-------------|-----------|------------|
24
24
  | `inject-rule <file.md>` | `~/.claude/CLAUDE.md` | Legacy HTML comment markers (`<!-- TOOLKIT:name -->`) | Yes |
25
25
  | `remove-rule <name>` | `~/.softspark/ai-toolkit/rules/` + `~/.claude/rules/` | Unregister and remove generated Claude rule file | Yes |
26
- | `inject-hook <file.json\|url> [name]` | `~/.claude/settings.json` | JSON `_source` tag per entry, URL cached + registered | Yes |
27
- | `remove-hook <name>` | `~/.claude/settings.json` | Strip all entries with matching `_source`, unregister URL source | Yes |
26
+ | `inject-hook <file.json\|url> [name]` | `~/.claude/settings.json` + `$CODEX_HOME/hooks.json` | Claude `_source` ownership plus native Codex command translation | Yes |
27
+ | `remove-hook <name>` | `~/.claude/settings.json` + `$CODEX_HOME/hooks.json` | Strip exact source ownership in both schemas, unregister URL source | Yes |
28
28
  | `inject-mcp <file.json\|url> [name] [--force]` | `~/.mcp.json` + every editor with `global_path` | JSON `_source` tag per server, URL cached + registered, full editor propagation | Yes |
29
29
  | `remove-mcp <name>` | `~/.mcp.json` + every editor with `global_path` | Strip all servers with matching `_source`, clean editor configs, unregister URL | Yes |
30
30
  | `add-rule <file.md\|url>` | `~/.softspark/ai-toolkit/rules/` | File copy + sync to `~/.claude/rules/ai-toolkit-registered-*.md` on next `update` | Yes |
@@ -73,6 +73,9 @@ npx @softspark/ai-toolkit inject-hook https://example.com/my-tool-hooks.json
73
73
 
74
74
  # With explicit source name
75
75
  npx @softspark/ai-toolkit inject-hook https://example.com/hooks.json my-tool-hooks
76
+
77
+ # Local source name plus explicit target directory
78
+ npx @softspark/ai-toolkit inject-hook ./hooks.json my-tool-hooks /custom/target
76
79
  ```
77
80
 
78
81
  **Implementation:** `scripts/inject_hook_cli.py`, `scripts/hook_sources.py`, `scripts/url_fetch.py`.
@@ -103,13 +106,45 @@ npx @softspark/ai-toolkit inject-hook https://example.com/hooks.json my-tool-hoo
103
106
 
104
107
  **Idempotency:** Re-running strips all existing entries with the same source name, then appends the new ones. No duplicates accumulate.
105
108
 
106
- **Safety:** Entries tagged `"_source": "ai-toolkit"` are never modified or removed by this command. External tools cannot affect the toolkit's own hooks. Only HTTPS URLs are accepted.
107
-
108
- **Codex propagation:** Codex-compatible events (`SessionStart`, `PreToolUse`, `PostToolUse`, `UserPromptSubmit`, `Stop`) are automatically propagated to `~/.codex/hooks.json`. Non-Codex events are silently skipped. No extra flags needed.
109
+ **Safety:** Entries tagged `"_source": "ai-toolkit"` are never modified or
110
+ removed by this command. External tools cannot affect the toolkit's own hooks.
111
+ Only HTTPS URLs are accepted. Claude settings, the source registry/cache, and
112
+ Codex hooks are parsed from the byte snapshots captured after their trusted
113
+ roots and parent directories are pinned. Every create, write, replace, unlink,
114
+ and rollback runs relative to those descriptors with `O_NOFOLLOW`; a swapped
115
+ ancestor cannot redirect the transaction, and an inode change after snapshot
116
+ capture aborts instead of overwriting concurrent work. A later failure restores
117
+ every touched file byte-for-byte. Existing file modes are preserved. New JSON
118
+ configuration files are created with a secure `0600` base filtered by the
119
+ current umask. Mutation requires POSIX `dir_fd` support. Native Windows Python
120
+ fails closed before changing any file; use WSL for `inject-hook` and
121
+ `remove-hook`. Read-only parsing and validation remain available.
122
+
123
+ **Codex propagation:** command handlers for Codex's 10 documented events are
124
+ translated into the native schema and merged into `$CODEX_HOME/hooks.json`
125
+ (default `~/.codex/hooks.json`). The translated document never contains
126
+ Claude's private `_source` key. Each command carries an exact, collision-resistant
127
+ `AI_TOOLKIT_HOOK_OWNER=ai-toolkit-external-<source>-<digest>` marker; update and
128
+ remove operations match only that owner. Existing core, plugin, and user
129
+ handlers are preserved through the same validator and atomic writer used by the
130
+ Codex generator.
131
+
132
+ Only fields shared unambiguously by native command hooks are propagated:
133
+ `matcher`, `type: command`, `command`, `commandWindows`, `timeout`,
134
+ `statusMessage`, and `async`. Unsupported events, non-command handlers, and
135
+ schema-specific extra fields are reported as skipped instead of being guessed.
136
+ `command` must be non-empty. `timeout`, when present, is a positive integer in
137
+ seconds; Codex defaults it to 600 seconds when omitted.
138
+ `UserPromptSubmit` and `Stop` matchers are omitted only when empty; a non-empty
139
+ matcher is skipped because Codex does not support it. `CODEX_HOME` must be an
140
+ existing absolute non-symlink directory when configured.
109
141
 
110
142
  ## remove-hook
111
143
 
112
- Strips all hook entries from `~/.claude/settings.json` that carry a given `_source` tag. If the hook was URL-sourced, also unregisters the URL from `sources.json` and removes the cached file.
144
+ Strips all hook entries from `~/.claude/settings.json` that carry a given
145
+ `_source` tag and removes only the matching native command owner from the active
146
+ Codex `hooks.json`. If the hook was URL-sourced, it also unregisters the URL
147
+ from `sources.json` and removes the cached file.
113
148
 
114
149
  ```bash
115
150
  npx @softspark/ai-toolkit remove-hook my-tool-hooks
@@ -160,7 +195,15 @@ npx @softspark/ai-toolkit inject-mcp ./conflict.json --force
160
195
 
161
196
  **URL support:** When an HTTPS URL is provided, the JSON is fetched, validated, cached in `~/.softspark/ai-toolkit/mcp-templates/external/<name>.json`, and registered in `sources.json`. On every `ai-toolkit update`, URL-sourced templates are re-fetched and re-injected automatically. If the fetch fails during update, the cached version is used.
162
197
 
163
- **Editor propagation:** Every editor with a `global_path` in `EDITOR_SPECS` is updated -- Claude (`~/.claude.json`), Cursor (`~/.cursor/mcp.json`), GitHub Copilot (`~/.copilot/mcp-config.json`), Gemini CLI (`~/.gemini/settings.json`), Windsurf (`~/.codeium/windsurf/mcp_config.json`), Cline (`~/.cline/data/settings/cline_mcp_settings.json`), Augment (`~/.augment/settings.json`), Codex CLI (`~/.codex/config.toml`). Per-editor failures are non-fatal -- the command reports a warning and continues.
198
+ **Editor propagation:** Every editor with a `global_path` in `EDITOR_SPECS` is
199
+ updated: Claude (`~/.claude.json`), Cursor (`~/.cursor/mcp.json`), GitHub
200
+ Copilot (`$COPILOT_HOME/mcp-config.json`, default
201
+ `~/.copilot/mcp-config.json`), Gemini CLI (`~/.gemini/settings.json`), Windsurf
202
+ (`~/.codeium/windsurf/mcp_config.json`), Cline
203
+ (`~/.cline/data/settings/cline_mcp_settings.json`), Augment
204
+ (`~/.augment/settings.json`), and Codex CLI (`$CODEX_HOME/config.toml`, default
205
+ `~/.codex/config.toml`). Per-editor failures are non-fatal; the command reports
206
+ a warning and continues.
164
207
 
165
208
  **Idempotency:** Re-running with the same source overwrites entries for that source cleanly -- no duplicates accumulate.
166
209