.agents/skills/feature-codex-spectre-implementation/SKILL.md
Use when modifying the Codex SPECTRE install flow, SessionStart continuity, project skill syncing, registry injection, or Codex-specific runtime files.
npx skillsauth add codename-inc/spectre feature-codex-spectre-implementationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Trigger: codex, spectre, codex install, sessionstart, agents.override, registry, spectre-learn, spectre-recall, hooks.json, config.toml, doctor Confidence: high Created: 2026-03-30 Updated: 2026-03-30 Version: 1
The Codex SPECTRE implementation is the Codex-native port of the original Claude Code SPECTRE plugin. It replaces Claude slash-command/plugin behavior with a Codex install that writes workflow skills, subagent TOML configs, runtime hook/tool scripts, and project-local knowledge files so Codex can run the same SPECTRE workflow natively.
The important architectural point is that this is a hybrid system: shared Codex assets live under .codex/, while project-specific memory and learned knowledge live under .spectre/, docs/tasks/.../session_logs/, AGENTS.override.md, and .agents/skills/. That split is what makes SessionStart continuity and registry-driven knowledge loading work without stuffing the full payload into the visible Codex hook output.
Use this when you want spectre-scope, spectre-plan, spectre-execute, and the rest of the workflow available inside Codex. The CLI supports project scope for repo-local installs and user scope for global installs.
Example:
npx spectre install codex --scope project
Use this when you want the latest SPECTRE handoff from docs/tasks/{branch}/session_logs/*_handoff.json to be restored automatically at the start of a new Codex session.
The design intentionally uses a SessionStart hook for a one-line visible status and a managed AGENTS.override.md block for the full hidden continuity payload.
Use this when you want skills created by spectre-learn to be available to Codex, and when you want trigger keywords from the registry to be injected into startup context so the agent can match on triggers before searching the codebase.
This is the key difference between "a skill exists on disk" and "Codex knows what project knowledge exists right now."
spectre install codex.src/main.js parses install codex, resolves scope, and sets CODEX_HOME for project installs.installCodex() in src/lib/install.js writes:
CODEX_HOME/skills/CODEX_HOME/skills/CODEX_HOME/spectre/agents/CODEX_HOME/spectre/hooks/ and CODEX_HOME/spectre/tools/ensureSpectreHooksConfigured() in src/lib/config.js enables features.codex_hooks = true, features.skills = true, and features.multi_agent = true, and registers the SessionStart hook in hooks.json.installProjectFiles() creates .spectre/manifest.json, ensures .agents/skills/spectre-recall/ exists, and prepares the project for knowledge/session syncing.syncProjectSkillsConfigured() adds [[skills.config]] entries pointing at project skills under .agents/skills/.SessionStart hook from hooks.json..codex/spectre/hooks/session-start.mjs imports buildSessionStartOutput() from src/lib/project.js.buildSessionStartOutput() does two things every time:
syncSessionOverride() updates the managed <!-- spectre-session:start --> ... <!-- spectre-session:end --> block in AGENTS.override.md from the newest handoff JSON.syncKnowledgeOverride() updates the managed <!-- spectre-knowledge:start --> ... <!-- spectre-knowledge:end --> block in AGENTS.override.md.spectre-apply skill plus the project registry contents from .agents/skills/spectre-recall/references/registry.toon.systemMessage only, while Codex reads the full AGENTS.override.md content through normal instruction discovery.spectre-learn writes or updates a project skill under .agents/skills/{category}-{slug}/SKILL.md..agents/skills/spectre-recall/references/registry.toon..agents/skills/spectre-recall/SKILL.md.syncProjectSkillsConfigured() ensures those project skills are configured in Codex config.toml.syncKnowledgeOverride() embeds the registry into AGENTS.override.md, so Codex sees trigger keywords and descriptions before it starts searching.The implementation is split into four layers:
src/main.js is the entrypoint. It parses install, uninstall, update, and doctor, resolves the project directory, and switches CODEX_HOME to ./.codex for project installs. That means the rest of the code can write to "Codex home" generically without special-casing every path.
src/lib/install.js is the asset generator. It:
session-start.mjs, refresh-project-context.mjs, and sync-session-override.mjsThe key trade-off is that workflow skills wrap the original SPECTRE command content with a Codex translation layer instead of rewriting the prompts from scratch. That keeps one source of truth.
src/lib/config.js owns config.toml and hooks.json. It enables Codex features, writes [agents.spectre_*] tables, and registers/removes the SessionStart hook without clobbering unrelated existing hook handlers.
It also syncs project skills by scanning .agents/skills/*/SKILL.md and rendering them into [[skills.config]] entries. This is how project-learned skills become visible to Codex.
src/lib/project.js and src/lib/knowledge.js own the project-local side:
.spectre/manifest.json.agents/skills/spectre-recall/AGENTS.override.mddocs/tasks/{branch}/session_logs/The most important logic is in buildKnowledgeOverrideBody(): it starts from the shared spectre-apply skill and replaces the ## Registry Location section with the actual current registry contents or the "no knowledge yet" message. That means the startup context contains both the behavioral rule and the current trigger catalog.
src/main.js
CLI entrypoint. Parses commands, resolves scope, and switches CODEX_HOME for project installs.
src/lib/install.js
Main installer/uninstaller. Generates workflow skills, agent TOML configs, runtime scripts, and invokes project install logic.
src/lib/config.js
Owns config.toml and hooks.json mutation, including features.codex_hooks, multi_agent, SessionStart, and [[skills.config]] project-skill syncing.
src/lib/project.js
Owns session continuity and managed AGENTS.override.md blocks for both session state and knowledge injection.
src/lib/knowledge.js
Owns registry file creation, recall skill generation, knowledge status messages, and registry embedding into the knowledge override block.
src/lib/doctor.js
Verifies Codex version, installed runtime/config state, hook registration, and installed workflow/agent/skill coverage.
docs/codex-sessionstart-memory.md
Design rationale for the hybrid SessionStart + AGENTS.override.md approach, including why additionalContext was rejected.
src/install.test.js
End-to-end install/uninstall coverage for project installs, hook registration, generated files, and legacy cleanup.
Edit:
src/lib/project.jssrc/lib/install.jssrc/lib/config.jsWhat to change:
buildSessionOverrideContent() or how the knowledge block is built in syncKnowledgeOverride().sessionStartHook() in src/lib/install.js.ensureSpectreHooksConfigured() in src/lib/config.js.node --test src/config.test.js src/install.test.js
.agents/skills/{category}-{slug}/SKILL.md
.agents/skills/spectre-recall/references/registry.toon
.agents/skills/spectre-recall/SKILL.md
node .codex/spectre/tools/refresh-project-context.mjs --project-root "$PWD"
Check, in order:
.agents/skills/{name}/SKILL.md..agents/skills/spectre-recall/references/registry.toon.config.toml contains a [[skills.config]] entry for the skill path.AGENTS.override.md contains the <!-- spectre-knowledge:start --> block with the current registry embedded.hooks.json contains a SessionStart hook pointing at spectre/hooks/session-start.mjs.npx spectre doctor codex --scope project --verify-hooks
After npx spectre install codex --scope project, expect files like:
.codex/config.toml
.codex/hooks.json
.codex/skills/spectre-scope/SKILL.md
.codex/skills/spectre-apply/SKILL.md
.codex/spectre/hooks/session-start.mjs
.codex/spectre/tools/sync-session-override.mjs
.codex/spectre/agents/dev.toml
.spectre/manifest.json
.agents/skills/spectre-recall/SKILL.md
.agents/skills/spectre-recall/references/registry.toon
If you are tempted to put the full handoff into hook output, don't. The current design deliberately keeps the hook output short and writes the full continuity into managed AGENTS.override.md blocks instead.
SessionStart does not fire just because the Codex UI opens. It runs on the first real turn of a new/resumed session.session-start.mjs imports src/lib/project.js from the installed repo path. If that repo path disappears, the hook breaks..codex/skills/spectre-apply/SKILL.md is not the full startup knowledge payload. The live registry injection happens in AGENTS.override.md during SessionStart..spectre/manifest.json and project-local knowledge/session files. User installs write global Codex assets but do not create project-local continuity state on their own.testing
👻 | Independent multi-lens review of plan.md and/or tasks.md — finds overengineering, missing verification, hallucinated deps, weak references
data-ai
👻 | Unified planning entry point - researches, assesses complexity, routes to workflow - primary agent
data-ai
👻 | Transform requirements into executable tasks - primary agent
testing
👻 | Independent multi-lens review of plan.md and/or tasks.md — finds overengineering, missing verification, hallucinated deps, weak references