dinostack-codex · git:20261006.2bb32f6 · 2026-10-06 · sha256 cfb8a1f23721277b

dinostack-codex git:20261006.2bb32f6A

Immutable. This exact content never changes and is served at /api/v1/blob/cfb8a1f23721277b.

---
name: dinostack-codex
description: Codex only. Apply DinoStack's agentic engineering protocol to software implementation, debugging, review, testing, architecture, and delivery work.
---

<!-- Generated by scripts/codex-skills.py. Do not edit directly. -->

Use this skill only in Codex. In another harness, do not execute its workflow or dispatch
instructions; use that harness’s DinoStack integration.

## Codex resource resolution

Before executing this skill, resolve the physical directory containing this loaded `SKILL.md`
(follow the installed skill-directory symlink) and bind it as `AE_SKILL_ROOT`. Set
`AE_CORE_SKILL_ROOT` to `.` beneath that physical root and validate its
`.dinostack-skill.json` marker has `magic=DINOSTACK_CODEX_SKILL`, `adapter=codex`,
`name=dinostack-codex`, and `schema_version=1`. Resolve every logical resource through
the adjacent `RESOURCE-MAP.json`; reject missing, escaping, symlink-loop, or wrong-type targets.
Derive `AE_REPO_DIR` from the validated core marker plus its mapped `bin` resource and require the
repository signature (`content/SKILL.md`, `.codex`, and the dispatch helper); never fall back to
the process working directory. Bind `AE_PROJECT_DIR` to the absolute invoked project root before
changing directories (`git rev-parse --show-toplevel` when inside a repository, otherwise the
verified invocation directory). Project `.claude/**`, `.agentic/**`, `.gitignore`, QA, settings,
compression, and migration state resolve only beneath `AE_PROJECT_DIR`, never beneath
`AE_REPO_DIR`. Evaluate
`$AE_REPO_DIR/bin/ds-codex-dispatch runtime-bindings "<absolute-invocation-directory>"`
before any operational step. Require its `AE_REPO_DIR` and `AE_PROJECT_DIR` values to match the
independently validated paths above, then consume the same JSON object to bind
`AE_CODEX_CONFIG_DIR`, `AE_SHARED_CONFIG_DIR`, and `AE_ACTIVATION_CONFIG`; fail closed on any
mismatch. Map canonical filesystem tools to Codex filesystem reads, `rg --files`, `rg`, shell, and
`apply_patch`; ask one bounded direct question only after default derivation.
Derive `AE_SESSION_ID` by passing hook JSON to
`$AE_REPO_DIR/bin/ds-codex-session-id`. Native workflows are invoked with `$` syntax.
Other DinoStack workflows remain manual command resources loaded with
`$AE_REPO_DIR/bin/ds-codex-dispatch command <name>`; do not claim bare slash registration.
Codex `spawn_agent` accepts only `task_name`, `message`, and `fork_turns`. Put Tier and model intent
in the task brief or resolve it through role routing before the spawn; never pass Claude-only spawn
fields. When isolation is required, the conductor creates the worktree manually before spawning.

**Codex spawn contract.** Delegate with `spawn_agent` only. Before any spawn that needs an
isolated checkout, run the following from the invoked project root (`$AE_PROJECT_DIR`):

1. `git fetch origin`.
2. Resolve `BASE_BRANCH` with
   `$AE_REPO_DIR/bin/ds-codex-dispatch base-branch "$AE_PROJECT_DIR"`. This applies the
   canonical precedence: exactly one dedicated unfenced whole-line `BASE_BRANCH:` declaration in
   project `AGENTS.md` (with an optional Markdown list prefix and optional `Declaration:` prefix),
   then local `develop`, then local `development`. Multiple matching declarations are rejected as
   ambiguous. If none exists, the helper fails closed; ask the operator whether to use `main`
   (recommended, falling back to `master`) or establish a develop-based workflow, exactly as
   required by the base-branch resolution protocol.
3. Choose a unique branch and absolute worktree path beneath `$AE_PROJECT_DIR/.agentic/worktrees/`.
4. Run `git worktree add "$AE_PROJECT_DIR/.agentic/worktrees/<branch>" -b "<branch>" "origin/$BASE_BRANCH"`.
5. Load the named role instructions with
   `$AE_REPO_DIR/bin/ds-codex-dispatch agent <role>`.
6. Call `spawn_agent` with supported inputs (`task_name`, `message`, and `fork_turns`). Begin the
   message with `Work only in the pre-created worktree <absolute-path>` and include the loaded role
   instructions plus the execution contract. The spawned agent must use shell commands in that
   worktree and must not edit the conductor checkout.

Codex spawns are asynchronous. The conductor remains responsive, uses the collaboration status and
wait operations to collect completion, and applies the existing review gates to the returned diff.
Claude hook payload fields and Claude Task behavior do not apply on Codex.


<!--
Purpose: Canonical body text for the dinostack skill loaded by AI coding agents.
         This file is the single source of truth for the skill's instructional content;
         adapter-specific frontmatter (name, description, trigger conditions) is kept
         separately in each adapter's build directory and prepended at build time.

Public API: consumed as-is by adapter build scripts. For Claude, $AE_REPO_DIR/.claude/build.sh
            strips this manifest comment, prepends SKILL.frontmatter.yaml, and then
            embeds the MINIMAL-corpus methodology body (build-methodology.sh
            --corpus minimal, DS-204) plus content/rules/{code-standards,conventions}.md
            verbatim to produce the final $AE_CORE_SKILL_ROOT/SKILL.md
            (this file accounts for a fraction of that assembled artifact's size -
            see check-skill-embed-budget.sh); $AE_CORE_SKILL_ROOT/METHODOLOGY.md itself stays the FULL
            corpus, the sibling file a "Deferred at this corpus" pointer block in
            SKILL.md sends a reader to when a named trigger fires. .gemini follows the
            same minimal-embed-plus-full-sibling pattern (its own build.sh). .kimi and
            .copilot (.github/skills) were flipped the same way and then HELD BACK in
            the same DS-204 round (runtime QA came back INCONCLUSIVE for both - no
            drivable runtime on the verification host) - both embed the full corpus
            unconditionally, pending a live-runtime verification path. Other adapters
            differ in whether and how they consume this file, and that set has changed
            as adapters were added independently - check each adapter's own build.sh
            directly rather than trusting an enumeration here, which has gone stale
            before.

Upstream deps: none (leaf content file; no imports or code dependencies).

Downstream consumers: $AE_CORE_SKILL_ROOT/SKILL.md (assembled by
                      $AE_REPO_DIR/.claude/build.sh), plus the per-adapter SKILL.md outputs listed
                      under Public API above.

Failure modes: edits here take effect for $AE_REPO_DIR/.claude after re-running $AE_REPO_DIR/.claude/build.sh.
               Adapters whose SKILL.md is a static committed file will drift silently
               until their own build or manual sync is run. No side effects at read time.

Performance: standard (static markdown file).
-->

> **IMPORTANT - READ THIS FIRST:** If `skill_auto_load: true` is set in `$AE_SHARED_CONFIG_DIR/agentic-engineering.json`, this skill is configured to auto-load. Read this entire SKILL.md before taking any action on software development tasks. Do not start implementing until you have read the Rules section below.

The Agentic Engineering system defines how to plan, delegate, review, and ship software using a
structured multi-agent workflow. It covers risk classification, adversarial review, task
decomposition, and quality gates so that changes are correct, safe, and reviewable. Read the rules
files on every session and the reference docs on the triggers described in $AE_CORE_SKILL_ROOT/METHODOLOGY.md §Protocol Details (read on trigger).

**Early relaxed-advice routing gate.** This gate applies only after activation resolves
`profile=relaxed` and all four canonical predicates pass. If profile is `default` or `strict`, this
gate does not apply and the motivating advisory retains its existing Elevated routing. After the
relaxed-only guard passes, apply risk classification before the first project-content read. Relaxed
ephemeral chat advice remains direct only when the answer can be produced from context already held;
otherwise classify Elevated before reading. Within that relaxed-only override, breadth alone is not
an investigation request. For the exact prompt `How would you recommend changing DinoStack?` in
that relaxed-only override, give bounded high-level advice from the methodology and context loaded
during mandatory skill activation, state specificity or evidence limitations when useful, and do
not explore the project merely to improve specificity. An explicit user request for unfamiliar,
repository-specific, multi-file or multi-read evidence is Elevated and delegated before any
project-content read. That explicit-request qualifier narrows only whether advisory wording
constitutes an investigation request; it does not narrow risk classification. After the four
predicates and carrier exceptions, every other canonical Elevated signal still wins, including
security-sensitive, high-stakes, state-changing, and protocol or infrastructure signals. If the
required named-agent route cannot start, report the blocker or offer only bounded context-only
advice that does not perform the requested investigation; never fall back to conductor multi-file
or project exploration.

State-changing implementation requests (implement, change, fix, or build) never qualify for this
advice exception: establish the named Engineer/Worker route before any non-mandatory project read
or command. Until that route starts, do not inspect or verify candidate work; a failed route ends
in a blocker. Canonical candidate-branch and fail-closed details:
`$AE_REPO_DIR/content/sections/04-risk-classification.md` §Relaxed ephemeral chat-advice override.

**Conductor default: act, don't ask.** The conductor's job is to complete the goal, not to approve every step. Stop and ask only for destructive/irreversible actions, missing information only the user has, materially ambiguous acceptance criteria, or scope-completion decisions. Repeated stops within one task are a planning signal, not a virtue. See `Proactive autonomy` in $AE_CORE_SKILL_ROOT/METHODOLOGY.md §Delegation for the full rule, anti-patterns, and stop-frequency thresholds.

## Rules (read these files)

- **$AE_CORE_SKILL_ROOT/METHODOLOGY.md** - the assembled kernel: delegation, risk classification, activation preflight, planning gate,
  task decomposition, and worktree lifecycle; the core rules for when to act directly vs. spawn Workers and Skeptics.

- **rules/code-standards.md** - documentation lookups via Context7, tool discipline (Read always
  primary; prefer Glob/Grep when available, Bash `rg`/`grep`/`find` as the sanctioned fallback
  otherwise), code quality gates, package management conventions, and browser verification with
  agent-browser.

- **rules/conventions.md** - writing style including length discipline (write for the permanent
  audience), project structure, session context and memory handling, and git workflow including
  protected branches and worktree-per-feature conventions.

## Commands (invoke by name)

- manual workflow 'ds-help' via `$AE_REPO_DIR/bin/ds-codex-dispatch command ds-help` - static, zero-token command reference; lists every slash command with a one-line description.
- manual workflow 'ds-status' via `$AE_REPO_DIR/bin/ds-codex-dispatch command ds-status` - read-only resolver dump; shows the resolved mode, profile, and marker with provenance plus a plain-English explainer of what they do and how to change them.
- `$dinostack-codex-brief` - interactive planning dialogue; produces the Brief artifact before architect and engineer are spawned. Invoke when operator implies planning intent at session start, or use `$dinostack-codex-brief --from <path>` to extract a Brief from an existing PRD.
- manual workflow 'ds-update' via `$AE_REPO_DIR/bin/ds-codex-dispatch command ds-update` - update an existing dinostack/DinoStack install (or fresh-install if none exists); invoke when the user says "pull and install DinoStack", "update DinoStack", "install the latest DinoStack", "reinstall dinostack", or "update my AE install".

Run manual workflow 'ds-help' via `$AE_REPO_DIR/bin/ds-codex-dispatch command ds-help` for the full command inventory.

## Reference Docs (read on trigger - see Protocol Details in $AE_CORE_SKILL_ROOT/METHODOLOGY.md)

- **references/skeptic-protocol.md** - Skeptic loop orchestration, findings classification
  (Critical/Major/Minor), sign-off format, adversarial briefs, and the Elevated + Cleanup path.

- **references/subagent-protocol.md** - parallel spawning rules, worktree isolation, check-in
  behavior, phase breadcrumbs, and task decomposition rules for multi-Worker plans.

- **references/agent-team.md** - named agent roles (engineer, architect, investigator, debugger,
  security-auditor, orchestration-planner), composed flows, decision rules, and spawn requirements.

- **references/design-goals.md** - design principles and goals of the Agentic Engineering system;
  read when evaluating whether a proposed change aligns with the system's intent.

- **references/regression-test-obligation.md** - per-finding regression-test obligation: every
  Skeptic finding fixed during a task must come with a regression test that would have caught it;
  read when fixing a Skeptic finding to confirm what counts as a valid regression test.

- **references/doc-sync-obligation.md** - per-change doc-sync obligation: a reality-asserting
  change (alters a count/list/path/convention/behavior an intent-layer doc states) must update
  the affected docs in the same change; read when a change touches a documented surface.

- **references/role-models.md** - Pi / oh-my-pi per-role model routing and antagonist
  reviewer model diversity; read when resolving `role-models.yml` or spawning reviewers on Pi/omp.

- **references/model-discovery.md** - Pi/oh-my-pi model selection paths (ask-user
  wizard, harness-native, pin-by-hand) and the per-role ranking heuristics in
  `$AE_REPO_DIR/bin/ds-models`; read when seeding `role-models.yml`.

- **references/evidence-on-disk.md** - spill/sketch/rehydrate protocol for large
  tool output; when to spill, the three-step loop, teardown, and ephemerality.

- **references/cross-harness-teams.md** - `ds-team` CLI and `team.yml` schema for
  orchestrating parallel agent teams across multiple AI harnesses; read when using
  `ds-team` or configuring cross-harness dispatch with `team.yml`.

- **references/digest-return-pattern.md** - digest-return discipline: when a background
  loop-running spawn (multi-iteration Skeptic/QA, long investigation) returns, the conductor
  reads the structured digest and acts - it does not re-read the internal transcript; read
  when running a multi-unit plan with parallel background loops.

- **references/learnings-capture-instruction.md** - the standing "watch for learnings"
  instruction: what counts as a learning, the in-flight `ds-learning-shard append` path for
  the four roles it belongs to (`engineer`, `adr-generator`, `product-discovery`,
  `release-orchestrator`), the `learnings_candidate[]` path for the three roles whose return
  contract declares that field, and its canonical definition; read when acting as any
  subagent role.

- **references/command-authoring.md** - authoring discipline for commands, skills, and
  agent definitions: trigger-keyword descriptions (always injected into context even when
  unused, so enumerate when to fire, not behavior) and bad/good example-pair seeding to
  encode taste; read when authoring or editing a command file, skill definition, or agent
  definition.

- **references/memory-shard-convention.md** - git-tracked per-fact shard directory
  (`$AE_PROJECT_DIR/.agentic/memory-shards/`) a project's root MEMORY.md compiles from, the frontmatter
  every shard carries, and the split/regenerate round-trip's entry-loss and reordering
  refusal guards; read when working on `$AE_REPO_DIR/bin/ds-memory-shard`, `$AE_REPO_DIR/bin/ds-memory-capture`, `$AE_REPO_DIR/hooks/lib/memory-shard.js`,
  or any writer that captures a fact into a shard.

## Rules (read on trigger)

- **rules/module-manifest.md** - required manifest header format for non-trivial source files;
  read when creating or substantially modifying a file that exports a public symbol, exceeds ~50
  LOC, or implements a side-effecting operation.