@iamdevlinph/codex-kit 1.0.10 → 1.0.12

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/README.md CHANGED
@@ -5,6 +5,7 @@ Portable Codex setup for new devices and multiple projects. It provides:
5
5
  - three automatically routed roles plus a manual quick implementer
6
6
  - automatic global role routing
7
7
  - a reusable, stack-neutral `AGENTS.md` template
8
+ - a package-owned `codex-kit-reconcile-agents` skill for semantic reconciliation
8
9
  - safe commands for global setup, project synchronization, and reconciliation
9
10
 
10
11
  The package contains no credentials. Global installation does not modify the
@@ -28,9 +29,13 @@ that they run the installed `${CODEX_HOME:-~/.codex}/codex-kit/routing-hook.js`.
28
29
  For one-off use without a global installation, prefix a command with
29
30
  `pnpm dlx @iamdevlinph/codex-kit@latest`.
30
31
 
31
- `global install` copies reusable agents to `${CODEX_HOME:-~/.codex}`, maintains
32
- a marked routing section in the global `AGENTS.md`, and adds package-owned
33
- handlers to the global `hooks.json` without replacing existing hooks.
32
+ `global install` copies reusable agents and the
33
+ `skills/codex-kit-reconcile-agents` skill to `${CODEX_HOME:-~/.codex}`, maintains
34
+ the package routing section in global `AGENTS.md`, and adds package-owned
35
+ handlers to `hooks.json` without replacing existing hooks. `global list` shows
36
+ the reconciliation skill's ownership status. Install and uninstall preserve
37
+ modified or user-owned skill files using the same backup/restore semantics as
38
+ other package files.
34
39
 
35
40
  The Sol root plans, routes, coordinates, and validates. On every prompt, the
36
41
  routing hook supplies the current `SUBAGENT_ROUTING.md`; the root classifies the
@@ -41,6 +46,25 @@ read-only checks, documentation, bookkeeping, and clear changes spanning up to
41
46
  roughly three files. Automatic delegation is reserved for broad discovery,
42
47
  large multi-file implementation or debugging, and high-risk review.
43
48
 
49
+ ## Available subagents
50
+
51
+ | Subagent | Routing | Model and effort | Used for |
52
+ | --- | --- | --- | --- |
53
+ | `code-explorer` | Automatic | `gpt-5.6-terra`, medium | Read-only broad repository discovery, contract tracing, and multi-file searches |
54
+ | `implementer` | Automatic | `gpt-5.6-luna`, high | Large behavior changes, non-obvious debugging, migrations, and substantial tests |
55
+ | `code-reviewer` | Automatic | `gpt-5.6-sol`, high | Read-only review of security-sensitive, architectural, public-API, concurrency, migration, or difficult-to-validate changes |
56
+ | `quick-implementer` | Manual only | `gpt-5.6-luna`, medium | Small, mechanical, well-specified changes limited to one or two files |
57
+
58
+ The root orchestrator is not a subagent. It owns planning, routing, integration,
59
+ and final validation.
60
+
61
+ For a substantial task that splits into genuinely independent slices, the root
62
+ may run multiple `implementer` instances concurrently. Each receives exclusive
63
+ file or module ownership and separate validation scope. Work that shares types,
64
+ schemas, configuration, generated artifacts, migrations, lockfiles, or dependency
65
+ ordering stays with one implementer or runs sequentially; multiple files alone
66
+ do not justify duplicate agents.
67
+
44
68
  `quick-implementer` remains installed for explicit manual delegation but is not
45
69
  selected by the default automatic route. The root reuses delegated test evidence
46
70
  and normally performs only lightweight integration checks.
@@ -62,11 +86,6 @@ codex-kit global configure \
62
86
  --plan-reasoning-effort high
63
87
  ```
64
88
 
65
- Automatic role models are tuned by task shape: Terra-medium performs broad
66
- repository exploration, Luna-high performs large implementation slices, and
67
- Sol-high reviews consequential changes. Luna-medium `quick-implementer` remains
68
- manual-only.
69
-
70
89
  Delegation is time-bounded. The root waits once for up to 60 seconds, requests
71
90
  one progress update, and then enforces a three-minute read/review/manual-quick
72
91
  deadline or five-minute implementation deadline. Validation commands that make
@@ -94,8 +113,8 @@ pnpm dlx @iamdevlinph/codex-kit@latest global list
94
113
  ```
95
114
 
96
115
  The summary shows the Codex home, orchestrator, normal and Plan-mode reasoning
97
- effort, routing-file and routing-hook status, and installed custom agents without
98
- dumping unrelated configuration.
116
+ effort, routing-file and routing-hook status, reconciliation-skill status, and
117
+ installed custom agents without dumping unrelated configuration.
99
118
 
100
119
  Uninstall package-managed global files:
101
120
 
@@ -133,13 +152,12 @@ pnpm dlx @iamdevlinph/codex-kit@latest project init
133
152
 
134
153
  This creates:
135
154
 
136
- - `AGENTS.md`, containing the reusable defaults and a project-specific section
155
+ - `AGENTS.md`, containing a project-specific section ready for reconciliation
137
156
  - `TEMPLATE_AGENTS.md`, a local reference copy used for future comparisons
138
157
  - `.codex-kit-state.json`, reconciliation bookkeeping
139
158
 
140
- The template reference is not an active Codex instruction file. Add repository
141
- commands, paths, architecture, integrations, and exceptions to the
142
- project-specific section of `AGENTS.md`.
159
+ Add repository commands, paths, architecture, integrations, and exceptions to
160
+ the project-specific section of `AGENTS.md`.
143
161
 
144
162
  ### Generate project-specific guidance
145
163
 
@@ -168,13 +186,14 @@ pnpm dlx @iamdevlinph/codex-kit@latest project sync
168
186
  codex-kit project status
169
187
  ```
170
188
 
171
- `project sync` never edits `AGENTS.md` or project skills. It prints a prompt
172
- asking Codex to merge only applicable reusable changes while preserving local
173
- adaptations. Reconciliation keeps always-on rules in `AGENTS.md` and may create
174
- or update task-specific workflows under `.agents/skills` when the updated
175
- template warrants them. Critical safety and authorization rules remain in
176
- `AGENTS.md`, and speculative skills are avoided. After reviewing the semantic
177
- merge and any skill changes, record the applied template hash:
189
+ `project sync` never edits `AGENTS.md` or project skills. It routes Codex to the
190
+ global `codex-kit-reconcile-agents` skill, which inspects project state and
191
+ existing skills, merges only applicable reusable changes, preserves local
192
+ adaptations and organization, and may create or update a concrete conditional
193
+ workflow under `.agents/skills`. Critical safety, authorization, secrets,
194
+ database, deployment, and destructive-operation rules remain in `AGENTS.md`;
195
+ do not copy the complete template or introduce managed markers. After semantic
196
+ reconciliation and validation, record the applied template hash:
178
197
 
179
198
  ```sh
180
199
  codex-kit project mark-applied
@@ -26,8 +26,17 @@ Select custom agents by exact name:
26
26
  For tasks with multiple phases, sequence only the roles that add value. For
27
27
  example, use `code-explorer` before implementation only when broad discovery is
28
28
  actually needed, and use `code-reviewer` after implementation only when the
29
- change meets its risk threshold. Avoid parallel write-heavy work and never assign
30
- overlapping files to multiple agents.
29
+ change meets its risk threshold. Avoid parallel write-heavy work by default and
30
+ never assign overlapping files to multiple agents.
31
+
32
+ Multiple `implementer` instances may run concurrently only when a substantial
33
+ task divides into genuinely independent slices. Give each instance exclusive
34
+ ownership of named files or modules and a separate validation scope. Do not
35
+ parallelize slices that share schemas, types, configuration, lockfiles, generated
36
+ artifacts, migrations, or dependency ordering. If ownership overlaps or one
37
+ slice depends on another, use one implementation agent or sequence the agents.
38
+ The parent performs final integration validation after all slices return. Do not
39
+ spawn duplicate agents merely because multiple files are involved.
31
40
 
32
41
  Prefer the parent fast path when delegation would cost more than the work. Do not
33
42
  spawn a subagent solely because a tool will write a file. Delegate based on task
@@ -1,8 +1,7 @@
1
1
  # Shared Agent Defaults
2
2
 
3
3
  Reusable defaults for coding agents. Adapt stack details, commands, paths,
4
- product context, and local conventions in the project-specific section outside
5
- the managed markers.
4
+ product context, and local conventions in the project's active `AGENTS.md`.
6
5
 
7
6
  ## Context And Instruction Scope
8
7
 
@@ -37,15 +36,21 @@ the managed markers.
37
36
 
38
37
  ## Template Maintenance
39
38
 
40
- - Projects normally use `AGENTS.md` as the active instruction file. The source
41
- template is `assets/TEMPLATE_AGENTS.md` in the private `codex-kit` repository
42
- and public package.
43
- - A project-local `TEMPLATE_AGENTS.md` is an optional temporary sync/reference
44
- copy, not an active file or automatic update path. Updating `AGENTS.md` does
45
- not update either template, and an updated `AGENTS.md` need not be copied back
46
- to its local reference.
47
- - Keep project-specific context outside the managed `AGENTS.md` block; keep only
48
- reusable cross-project rules in the packaged template.
39
+ - `TEMPLATE_AGENTS.md` is a staged reference copy of codex-kit's reusable
40
+ instructions, not active project guidance. Active repository guidance lives
41
+ in `AGENTS.md` and applicable project skills under `.agents/skills`.
42
+ - When the template is refreshed, `codex-kit project status` reports
43
+ `reconciliation required`, or a user requests template sync or mark-applied,
44
+ use the global `$codex-kit-reconcile-agents` skill. It compares the template
45
+ with `AGENTS.md`, project state, and existing skills; preserves local rules;
46
+ applies only relevant reusable changes; validates them; and marks applied
47
+ only after success.
48
+ - Keep project-specific rules out of `TEMPLATE_AGENTS.md`. Treat local template
49
+ edits as candidates that must be generalized and promoted to the canonical
50
+ `assets/TEMPLATE_AGENTS.md` in the codex-kit repository. Updating `AGENTS.md`
51
+ does not update either template automatically.
52
+ - Keep project-specific context out of the packaged template; keep only
53
+ reusable cross-project rules here.
49
54
  - When a request introduces a reusable workflow preference, convention, agent
50
55
  behavior, tooling default, or safety rule, tell the user it appears
51
56
  template-level and update the current project's active instructions when
@@ -62,25 +67,16 @@ the managed markers.
62
67
  - Merge template updates into other projects without overwriting project-specific
63
68
  context.
64
69
 
65
- ## Template Sync Prompt
66
-
67
- When `codex-kit project sync` stages `TEMPLATE_AGENTS.md` beside an existing
68
- unmanaged `AGENTS.md`, use this prompt:
69
-
70
- ```txt
71
- Convert this repository to the codex-kit managed AGENTS.md layout. Put the exact
72
- contents of TEMPLATE_AGENTS.md between
73
- <!-- BEGIN codex-kit:shared-template --> and
74
- <!-- END codex-kit:shared-template -->. Preserve every repository-specific
75
- instruction from the current AGENTS.md after the managed block under
76
- # Project-Specific Instructions, remove only duplicate shared rules, and do not
77
- change project behavior. Review existing project skills under .agents/skills and
78
- move conditionally relevant, repeatable procedures out of AGENTS.md only when a
79
- skill is warranted. Preserve critical safety and authorization rules in
80
- AGENTS.md, preserve existing relevant skills, avoid speculative skills, and
81
- validate any skill you create or modify. Afterward, summarize what was preserved,
82
- what moved into a skill, and whether any local rules appear template-worthy.
83
- ```
70
+ ## Template reconciliation
71
+
72
+ Do not copy the complete template into `AGENTS.md`, replace it wholesale, or
73
+ introduce managed markers. If a legacy shared-template marker is present,
74
+ preserve local content and reconcile its meaning safely without creating new
75
+ markers. Summarize added, updated, skipped, adapted, and skill-moved guidance,
76
+ including local/template conflicts and any generalized template-worthy
77
+ promotion. Keep critical safety, authorization, secrets, database, deployment,
78
+ and destructive-operation rules always-on in `AGENTS.md`; extract only concrete
79
+ conditional procedures into validated project skills.
84
80
 
85
81
  ## Core Behavior
86
82
 
@@ -110,6 +106,13 @@ what moved into a skill, and whether any local rules appear template-worthy.
110
106
  - Avoid broad commands. After changes, run the smallest targeted verification
111
107
  that meaningfully validates them when practical, then report the command and
112
108
  result. Use the repository's documented package manager and scripts.
109
+ - For behavior changes and bug fixes, add or update the smallest focused
110
+ automated tests that meaningfully prevent regression when the repository has
111
+ an established test setup.
112
+ - Do not introduce a test framework or create low-value tests solely to satisfy
113
+ this rule. If automated coverage is impractical, explain why and perform the
114
+ strongest targeted verification available.
115
+ - Run the relevant focused tests after changing tested behavior.
113
116
  - Do not change dependencies, global tools, or the environment by default.
114
117
  - Do not run local or remote database inspection, generation, migration, or SQL
115
118
  commands unless the task requires them.
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: codex-kit-reconcile-agents
3
+ description: Reconcile a refreshed TEMPLATE_AGENTS.md with a project's AGENTS.md and applicable skills while preserving local adaptations. Use when project status requires reconciliation, the template was refreshed, or the user requests an agent-template sync or mark-applied.
4
+ ---
5
+
6
+ # Reconcile codex-kit agent guidance
7
+
8
+ ## Procedure
9
+
10
+ 1. Inspect `AGENTS.md`, `TEMPLATE_AGENTS.md`, `.codex-kit-state.json`, the
11
+ project's existing `.agents/skills`, and `codex-kit project status`. If a
12
+ codex-kit template backup exists, compare it with the refreshed template to
13
+ isolate the actual template change.
14
+ 2. Preserve the existing `AGENTS.md` organization and all project-specific
15
+ adaptations. Merge only reusable template guidance that applies to this
16
+ repository; report conflicts between local and template rules, and do not
17
+ replace `AGENTS.md` wholesale or copy the complete template into it.
18
+ 3. Keep critical always-on safety, authorization, secrets, database,
19
+ deployment, and destructive-operation rules in `AGENTS.md`.
20
+ 4. Extract only concrete, conditional, repeatable project procedures into a
21
+ focused skill under `.agents/skills/<skill-name>/SKILL.md`. Preserve relevant
22
+ existing skills, use valid YAML frontmatter, and do not create speculative
23
+ skills or duplicate detailed instructions.
24
+ 5. Review the final instruction diff for preserved local rules, duplicates, and
25
+ unintended template edits. Validate every created or modified project skill
26
+ with an available skill validator and run the repository's documented checks.
27
+ Do not mark the template applied until reconciliation and validation succeed.
28
+ 6. Run `codex-kit project mark-applied` only after successful reconciliation and
29
+ validation, then confirm `codex-kit project status` is up to date.
30
+ 7. Summarize added, updated, skipped, adapted, and skill-moved guidance, with
31
+ reasons. Identify genuinely reusable, generalized changes that should be
32
+ promoted to codex-kit's canonical template and report the target section and
33
+ wording.
34
+
35
+ If legacy `codex-kit:shared-template` markers are present, preserve local
36
+ content and reconcile their meaning semantically. Do not add, recreate, or
37
+ depend on managed markers, and do not discard local adaptations.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Reconcile Codex Agent Guidance"
3
+ short_description: "Semantically reconcile templates and project skills"
4
+ default_prompt: "Use $codex-kit-reconcile-agents to reconcile this project's agent guidance."
package/bin/codex-kit.js CHANGED
@@ -9,6 +9,10 @@ const isRecord = (value) => typeof value === "object" && value !== null;
9
9
  const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
10
10
  const ASSETS = join(ROOT, "assets");
11
11
  const AGENTS_DIR = join(ASSETS, "agents");
12
+ const SKILLS_DIR = join(ASSETS, "skills");
13
+ const RECONCILE_SKILL = "codex-kit-reconcile-agents";
14
+ const RECONCILE_SKILL_FILE = join(SKILLS_DIR, RECONCILE_SKILL, "SKILL.md");
15
+ const RECONCILE_SKILL_METADATA_FILE = join(SKILLS_DIR, RECONCILE_SKILL, "agents", "openai.yaml");
12
16
  const ROUTING_FILE = join(ASSETS, "SUBAGENT_ROUTING.md");
13
17
  const ROUTING_HOOK_FILE = join(ROOT, "bin", "routing-hook.js");
14
18
  const TEMPLATE_FILE = join(ASSETS, "TEMPLATE_AGENTS.md");
@@ -266,29 +270,15 @@ function saveProjectState(cwd, state) {
266
270
  write(join(cwd, PROJECT_STATE_FILE), `${JSON.stringify(state, null, 2)}\n`);
267
271
  }
268
272
  function templatePrompt() {
269
- return `Template reference updated. Ask Codex:
273
+ return `Template reference updated. Use the global $${RECONCILE_SKILL} skill to reconcile it semantically.
270
274
 
271
- The project's TEMPLATE_AGENTS.md was refreshed from codex-kit. Compare it with
272
- AGENTS.md and merge only new or changed reusable guidelines that apply to this
273
- repository.
274
-
275
- Keep durable, always-applicable repository rules in AGENTS.md. When the updated
276
- template identifies a repeatable, task-specific procedure, inspect existing
277
- project skills under .agents/skills and create or update a skill only when it
278
- would reduce conditional detail in AGENTS.md. Preserve existing relevant skills
279
- and avoid duplicating detailed instructions between AGENTS.md and SKILL.md.
280
-
281
- Keep critical safety, authorization, database, deployment, and destructive-
282
- operation restrictions in AGENTS.md even when a skill contains the detailed
283
- workflow. Do not create speculative skills.
284
-
285
- Preserve project-specific instructions and existing adaptations. Do not replace
286
- AGENTS.md wholesale. If a template rule conflicts with a local rule, keep the
287
- local rule and report the conflict.
288
-
289
- Summarize what was added, updated, skipped, adapted, or moved into a skill, and
290
- why. Validate any created or modified skills. When finished, run codex-kit
291
- project mark-applied.`;
275
+ Inspect TEMPLATE_AGENTS.md, AGENTS.md, .codex-kit-state.json, existing
276
+ .agents/skills, and codex-kit project status. Preserve local adaptations and
277
+ AGENTS.md organization; merge only applicable reusable guidance. Keep critical
278
+ always-on safety and authorization rules in AGENTS.md, extract only concrete
279
+ conditional procedures into validated skills, and do not copy the complete
280
+ template or introduce managed markers. Mark applied only after reconciliation
281
+ and validation, then report any template-worthy generalized promotion.`;
292
282
  }
293
283
  function managedBlock(content, begin, end) {
294
284
  return `${begin}\n${content.trimEnd()}\n${end}`;
@@ -367,6 +357,12 @@ function installGlobal(options) {
367
357
  const routingRecord = installFile(ROUTING_FILE, join(home, "SUBAGENT_ROUTING.md"), "routing", prior, options.force);
368
358
  if (routingRecord)
369
359
  next.files.routing = routingRecord;
360
+ const reconciliationSkill = installFile(RECONCILE_SKILL_FILE, join(home, "skills", RECONCILE_SKILL, "SKILL.md"), `skills/${RECONCILE_SKILL}/SKILL.md`, prior, options.force);
361
+ if (reconciliationSkill)
362
+ next.files[`skills/${RECONCILE_SKILL}/SKILL.md`] = reconciliationSkill;
363
+ const reconciliationSkillMetadata = installFile(RECONCILE_SKILL_METADATA_FILE, join(home, "skills", RECONCILE_SKILL, "agents", "openai.yaml"), `skills/${RECONCILE_SKILL}/agents/openai.yaml`, prior, options.force);
364
+ if (reconciliationSkillMetadata)
365
+ next.files[`skills/${RECONCILE_SKILL}/agents/openai.yaml`] = reconciliationSkillMetadata;
370
366
  const hookRecord = installFile(ROUTING_HOOK_FILE, join(home, "codex-kit", "routing-hook.js"), "routing-hook", prior, options.force);
371
367
  if (hookRecord)
372
368
  next.files["routing-hook"] = hookRecord;
@@ -491,6 +487,16 @@ function listGlobal(options) {
491
487
  existsSync(routingHook.target) &&
492
488
  readText(routingHook.target).includes(routingHook.command));
493
489
  console.log(`Routing hook: ${hooksInstalled ? "installed" : "not installed"}`);
490
+ const skillTargets = [
491
+ [join(home, "skills", RECONCILE_SKILL, "SKILL.md"), state.files[`skills/${RECONCILE_SKILL}/SKILL.md`]],
492
+ [join(home, "skills", RECONCILE_SKILL, "agents", "openai.yaml"), state.files[`skills/${RECONCILE_SKILL}/agents/openai.yaml`]],
493
+ ];
494
+ const skillStatus = skillTargets.every(([target, record]) => existsSync(target) && record && sha256(read(target)) === record.hash)
495
+ ? "installed"
496
+ : skillTargets.some(([target]) => existsSync(target))
497
+ ? "modified or incomplete"
498
+ : "missing";
499
+ console.log(`Reconciliation skill: ${skillStatus}`);
494
500
  console.log("Custom agents:");
495
501
  const agents = existsSync(agentsDir)
496
502
  ? readdirSync(agentsDir).filter((name) => name.endsWith(".toml")).sort()
@@ -574,6 +580,14 @@ function uninstallGlobal(options) {
574
580
  }
575
581
  if (state.hooks)
576
582
  uninstallRoutingHooks(state.hooks);
583
+ const skillDir = join(home, "skills", RECONCILE_SKILL);
584
+ const skillMetadataDir = join(skillDir, "agents");
585
+ if (existsSync(skillMetadataDir) && statSync(skillMetadataDir).isDirectory() && !readdirSync(skillMetadataDir).length) {
586
+ rmSync(skillMetadataDir, { recursive: true });
587
+ }
588
+ if (existsSync(skillDir) && statSync(skillDir).isDirectory() && !readdirSync(skillDir).length) {
589
+ rmSync(skillDir, { recursive: true });
590
+ }
577
591
  const allowancesDir = join(home, "codex-kit", "allowances");
578
592
  if (existsSync(allowancesDir))
579
593
  rmSync(allowancesDir, { recursive: true, force: true });
@@ -622,7 +636,10 @@ function syncProject(options) {
622
636
  };
623
637
  saveProjectState(cwd, state);
624
638
  if (!existsSync(agentsFile)) {
625
- const contents = "# Project-Specific Instructions\n\n<!-- Add repository-specific commands, architecture, and exceptions here. -->\n";
639
+ const contents = `# Project-Specific Instructions
640
+
641
+ <!-- Add repository-specific commands, architecture, and exceptions here. -->
642
+ `;
626
643
  write(agentsFile, contents);
627
644
  console.log(`created project instructions file: ${agentsFile}`);
628
645
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iamdevlinph/codex-kit",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "Portable Codex subagents and project AGENTS.md defaults.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,6 +10,7 @@
10
10
  "assets/agents",
11
11
  "assets/SUBAGENT_ROUTING.md",
12
12
  "assets/TEMPLATE_AGENTS.md",
13
+ "assets/skills",
13
14
  "bin"
14
15
  ],
15
16
  "scripts": {