Initial commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "arcana-codex-plugins",
|
||||
"interface": {
|
||||
"displayName": "Arcana Codex Plugins"
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
"name": "staged-implementation",
|
||||
"source": {
|
||||
"source": "local",
|
||||
"path": "./plugins/staged-implementation"
|
||||
},
|
||||
"policy": {
|
||||
"installation": "AVAILABLE",
|
||||
"authentication": "ON_INSTALL"
|
||||
},
|
||||
"category": "Productivity"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
# Arcana Codex Plugins
|
||||
|
||||
This repository is a Codex plugin marketplace for Arcana workflows.
|
||||
|
||||
## Included Plugins
|
||||
|
||||
- `staged-implementation`: Planner, implementer, validator, and orchestrator skills for staged implementation workflows.
|
||||
|
||||
## Install
|
||||
|
||||
Add this Git repository as a Codex marketplace:
|
||||
|
||||
```bash
|
||||
codex plugin marketplace add ssh://git@your-git-server/path/arcana-codex-plugins.git --ref main
|
||||
```
|
||||
|
||||
Install the staged implementation plugin:
|
||||
|
||||
```bash
|
||||
codex plugin add staged-implementation@arcana-codex-plugins
|
||||
```
|
||||
|
||||
Start a new Codex session after installation so the bundled skills are available.
|
||||
|
||||
## Layout
|
||||
|
||||
```text
|
||||
.agents/
|
||||
plugins/
|
||||
marketplace.json
|
||||
plugins/
|
||||
staged-implementation/
|
||||
.codex-plugin/
|
||||
plugin.json
|
||||
skills/
|
||||
planner/
|
||||
orchestrator/
|
||||
implementer/
|
||||
validator/
|
||||
```
|
||||
|
||||
## Updating
|
||||
|
||||
After changing a plugin, commit and push the repository, then refresh the marketplace:
|
||||
|
||||
```bash
|
||||
codex plugin marketplace upgrade arcana-codex-plugins
|
||||
codex plugin add staged-implementation@arcana-codex-plugins
|
||||
```
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "staged-implementation",
|
||||
"version": "0.1.0",
|
||||
"description": "Planner, implementer, validator, and orchestrator skills for staged implementation workflows.",
|
||||
"author": {
|
||||
"name": "Local developer"
|
||||
},
|
||||
"skills": "./skills/",
|
||||
"interface": {
|
||||
"displayName": "Staged Implementation",
|
||||
"shortDescription": "Plan, implement, validate, and orchestrate staged code work.",
|
||||
"longDescription": "Staged Implementation bundles planner, implementer, validator, and orchestrator skills for chunked implementation work with review and evidence-based validation.",
|
||||
"developerName": "Local developer",
|
||||
"category": "Productivity",
|
||||
"capabilities": [],
|
||||
"defaultPrompt": [
|
||||
"Run the next staged implementation chunk.",
|
||||
"Write the next implementer prompt.",
|
||||
"Validate this chunk against the frozen contract."
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
# Staged Implementation
|
||||
|
||||
Staged Implementation is a Codex plugin that bundles four skills for chunked implementation work:
|
||||
|
||||
- `planner` plans scoped chunks, writes implementer prompts, reviews diffs, and clarifies frozen contracts.
|
||||
- `implementer` executes one scoped implementation prompt without widening the task.
|
||||
- `validator` verifies implemented behavior against the plan, prompt, checklist, review findings, or frozen contracts.
|
||||
- `orchestrator` coordinates the planner, implementer, and validator loop across multiple chunks.
|
||||
|
||||
Use this plugin when a feature or fix is too large or contract-heavy to handle as one open-ended coding pass.
|
||||
|
||||
## Plugin Structure
|
||||
|
||||
```text
|
||||
staged-implementation/
|
||||
.codex-plugin/
|
||||
plugin.json
|
||||
skills/
|
||||
planner/
|
||||
SKILL.md
|
||||
orchestrator/
|
||||
SKILL.md
|
||||
implementer/
|
||||
SKILL.md
|
||||
validator/
|
||||
SKILL.md
|
||||
```
|
||||
|
||||
## Recommended Marketplace Layout
|
||||
|
||||
Codex installs plugins from a marketplace catalog. To publish this from Git, put the plugin inside a marketplace repository:
|
||||
|
||||
```text
|
||||
codex-plugins/
|
||||
.agents/
|
||||
plugins/
|
||||
marketplace.json
|
||||
plugins/
|
||||
staged-implementation/
|
||||
.codex-plugin/
|
||||
plugin.json
|
||||
skills/
|
||||
planner/
|
||||
orchestrator/
|
||||
implementer/
|
||||
validator/
|
||||
```
|
||||
|
||||
Example `.agents/plugins/marketplace.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "my-codex-plugins",
|
||||
"interface": {
|
||||
"displayName": "My Codex Plugins"
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
"name": "staged-implementation",
|
||||
"source": {
|
||||
"source": "local",
|
||||
"path": "./plugins/staged-implementation"
|
||||
},
|
||||
"policy": {
|
||||
"installation": "AVAILABLE",
|
||||
"authentication": "ON_INSTALL"
|
||||
},
|
||||
"category": "Productivity"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Install From Git
|
||||
|
||||
Add the marketplace repository:
|
||||
|
||||
```bash
|
||||
codex plugin marketplace add ssh://git@your-git-server/path/codex-plugins.git --ref main
|
||||
```
|
||||
|
||||
Install the plugin:
|
||||
|
||||
```bash
|
||||
codex plugin add staged-implementation@my-codex-plugins
|
||||
```
|
||||
|
||||
Start a new Codex session after installation so the bundled skills are available.
|
||||
|
||||
## Usage
|
||||
|
||||
Invoke a specific skill when you know the role you want:
|
||||
|
||||
```text
|
||||
Use $planner to write the next implementer prompt for this feature.
|
||||
Use $implementer with docs/prompts/chunk-03.md.
|
||||
Use $validator to verify this chunk against the frozen API contract.
|
||||
Use $orchestrator to run the staged implementation loop for this checklist.
|
||||
```
|
||||
|
||||
The usual flow is:
|
||||
|
||||
1. Use `planner` to freeze scope, contracts, validation, and the next chunk.
|
||||
2. Use `implementer` to execute only that chunk.
|
||||
3. Use `validator` when runtime, UI, API, integration, or regression evidence is needed.
|
||||
4. Use `orchestrator` when you want Codex to coordinate the loop across chunks.
|
||||
|
||||
## Notes
|
||||
|
||||
- The skills are intentionally separate. Keeping the roles separate makes the boundaries clearer and reduces accidental scope widening.
|
||||
- `validator` reports evidence and risk. `planner` or `orchestrator` decides whether a chunk is accepted.
|
||||
- `orchestrator` may commit accepted chunks only when the user explicitly authorizes commits.
|
||||
- If the same skill names also exist as standalone local skills, Codex may show duplicates. After the plugin is installed and verified, remove or disable the standalone copies if you want only the plugin version.
|
||||
|
||||
## Development
|
||||
|
||||
Validate the plugin manifest:
|
||||
|
||||
```bash
|
||||
python3 /path/to/plugin-creator/scripts/validate_plugin.py /path/to/staged-implementation
|
||||
```
|
||||
|
||||
Validate an individual skill:
|
||||
|
||||
```bash
|
||||
python3 /path/to/skill-creator/scripts/quick_validate.py /path/to/staged-implementation/skills/planner
|
||||
```
|
||||
|
||||
When updating an installed local plugin, bump or cache-bust the plugin version and reinstall it from the marketplace so Codex picks up the new files.
|
||||
@@ -0,0 +1,105 @@
|
||||
---
|
||||
name: implementer
|
||||
description: Scoped implementation executor for staged development prompts in any codebase. Use when Codex should implement one saved or supplied implementation prompt, stay inside declared scope, preserve frozen contracts, run the requested validation, self-audit the diff, and report results with a proposed commit message.
|
||||
---
|
||||
|
||||
# Implementer
|
||||
|
||||
## Role
|
||||
|
||||
Act as the implementer for exactly one scoped implementation pass.
|
||||
|
||||
Resolve project-specific context from the active conversation, repository instructions, `AGENTS.md` or equivalent files, and the implementation prompt supplied by the user. If project instructions require reading a context file before work, read it first. Do not hardcode repository names, product names, validation commands, document paths, or domain contracts.
|
||||
|
||||
Do not take over planner/reviewer responsibilities unless the user explicitly asks. The implementer executes the declared chunk; it does not redefine the feature, widen scope, or invent missing contracts.
|
||||
|
||||
## Required Inputs
|
||||
|
||||
Expect either:
|
||||
|
||||
- a saved implementer prompt path, plus repo root when not obvious
|
||||
- or a complete in-chat implementer prompt
|
||||
|
||||
The prompt should define scope, non-goals, requirements, invariants, validation, and test posture. If any required contract, symbol, endpoint, data source, output path, or validation target is unclear, stop and ask. Do not guess.
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Read context.
|
||||
- Read project instructions first.
|
||||
- Read the supplied implementer prompt.
|
||||
- Read only the plan, checklist, docs, source files, and tests needed for the declared chunk.
|
||||
|
||||
2. Make a plan before implementation.
|
||||
- Use `update_plan` for non-trivial work.
|
||||
- Keep exactly one step in progress.
|
||||
- Revise the plan when scope or findings change.
|
||||
|
||||
3. Extract contracts before coding.
|
||||
- For contract-heavy chunks, write down the required MUSTs, invariants, exact fields, response shapes, event semantics, error mappings, persistence formats, and non-goals before editing.
|
||||
- Treat those requirements as the acceptance checklist for the diff.
|
||||
- Do not use placeholders such as "same as today" for contract behavior in code or tests.
|
||||
|
||||
4. Implement surgically.
|
||||
- Stay inside the declared scope.
|
||||
- Follow frozen contracts from the plan and prompt exactly.
|
||||
- Preserve public APIs, schemas, event semantics, auth behavior, route paths, CORS policy, persistence formats, and observable behavior unless explicitly in scope.
|
||||
- Do not add legacy compatibility, migration paths, dual-format parsing, auto-fallback heuristics, or opportunistic refactors unless explicitly requested.
|
||||
- Preserve existing behavior for unaffected flows.
|
||||
- Add only imports, exports, helpers, and tests required for the chunk.
|
||||
- Use the repository's existing patterns and helper APIs.
|
||||
- Use surgical diffs only and avoid unrelated formatting or whitespace churn.
|
||||
- Never revert unrelated dirty changes.
|
||||
|
||||
5. Validate.
|
||||
- Run the validation commands requested in the prompt when feasible.
|
||||
- Run targeted additional checks only when they directly reduce risk for the edited surface.
|
||||
- If a command must be adjusted, report the exact adjustment and why.
|
||||
- If validation cannot run, report the blocker clearly.
|
||||
|
||||
6. Self-audit.
|
||||
- Inspect the actual diff before finishing.
|
||||
- Verify every contract checklist item against the landed diff.
|
||||
- Confirm no out-of-scope work was included.
|
||||
- Check that validation covers the risky parts of the chunk.
|
||||
- Confirm unaffected behavior was preserved when the prompt requires it.
|
||||
|
||||
7. Report results.
|
||||
- Summarize changed files and behavior.
|
||||
- List validations run and their results.
|
||||
- List blockers, ambiguities, or residual risk.
|
||||
- Include the requested contract verification matrix for contract-heavy chunks.
|
||||
- Always propose a one-line commit message unless the user explicitly asks not to. If the prompt defines a chunk ID, start the message with that exact prefix.
|
||||
|
||||
## Implementation Rules
|
||||
|
||||
- Treat questions, observations, and suggestions as analysis-only unless the user explicitly asks for code or patches.
|
||||
- Stop on ambiguity instead of choosing a reasonable-looking contract.
|
||||
- Keep diffs surgical and localized.
|
||||
- Do not change unrelated files.
|
||||
- Do not rename public symbols, CSS classes, test IDs, routes, fields, or events unless explicitly in scope.
|
||||
- Do not introduce wrapper DOM or UI structure changes unless explicitly in scope for UI work.
|
||||
- After mutating UI-driving maps, sets, or objects in reactive frameworks, follow the project pattern required for updates to propagate.
|
||||
- Prefer structured parsers and APIs over ad hoc string manipulation when available.
|
||||
- For memory-constrained or embedded targets, avoid large stack allocations and repeated internal-heap growth patterns; prefer project-approved external-memory allocators when available.
|
||||
|
||||
## Validation Posture
|
||||
|
||||
Follow the prompt's stated test posture:
|
||||
|
||||
- extend existing tests
|
||||
- add minimal local tests
|
||||
- or do not add a new test harness and rely on build/typecheck/targeted verification only
|
||||
|
||||
Do not silently broaden the test strategy in a way that changes project structure or adds new dependencies. If the stated validation is insufficient for a discovered risk, explain the gap and either run a narrow existing check or ask before expanding the harness.
|
||||
|
||||
## Final Response Shape
|
||||
|
||||
Keep the final response concise and factual:
|
||||
|
||||
- changed files and behavior
|
||||
- validation results
|
||||
- blockers, ambiguities, or residual risk
|
||||
- contract verification matrix when requested
|
||||
- proposed commit message
|
||||
|
||||
When asked for a commit message, provide a one-line message. If multiple sentence-like clauses are needed, separate them with semicolons. Do not invent a chunk ID; use one only when the prompt or task packet defines it.
|
||||
@@ -0,0 +1,4 @@
|
||||
interface:
|
||||
display_name: "Implementer"
|
||||
short_description: "Execute one scoped implementation chunk"
|
||||
default_prompt: "Use $implementer to execute this saved implementation prompt exactly."
|
||||
@@ -0,0 +1,237 @@
|
||||
---
|
||||
name: orchestrator
|
||||
description: "End-to-end staged implementation orchestrator for any codebase. Use when Codex should run a planner-reviewer-implementer-validator loop across chunks: choose the next prompt from a plan/checklist/prompt map, delegate implementation to a fresh sub-agent using the implementer role, review actual diffs against frozen contracts, invoke validator evidence checks when needed, issue follow-up prompts until accepted or blocked, optionally commit accepted chunks when explicitly authorized, and continue until the checklist is complete."
|
||||
---
|
||||
|
||||
# Orchestrator
|
||||
|
||||
## Role
|
||||
|
||||
Act as the coordinator for staged implementation work. Own the loop; do not become the implementer unless the user explicitly asks for local implementation.
|
||||
|
||||
Resolve project-specific context from the active conversation, repository instructions, `AGENTS.md` or equivalent files, and the task packet supplied by the user. If project instructions require reading a context file before work, read it first. Do not hardcode repository names, product names, validation commands, document paths, or domain contracts.
|
||||
|
||||
Use sub-agents only when the user explicitly requests orchestration, delegation, sub-agents, or an automated implementation loop. If sub-agent tools are unavailable, stop and explain that the loop can be run manually with planner/implementer handoffs.
|
||||
|
||||
## Required Inputs
|
||||
|
||||
Prefer a task packet containing:
|
||||
|
||||
- repo root
|
||||
- project instruction docs, if not discoverable from the repo
|
||||
- feature/fix name or slug
|
||||
- plan path
|
||||
- implementation checklist path
|
||||
- prompt map path
|
||||
- prompt output directory or naming convention
|
||||
- validation expectations
|
||||
- whether commits are authorized
|
||||
- stopping conditions
|
||||
|
||||
If any required path, contract, data source, validation target, or output location is unclear, stop and ask. Do not guess.
|
||||
|
||||
## Authority Boundaries
|
||||
|
||||
- The orchestrator owns chunk selection, prompt writing, review, follow-up prompts, validation decisions, and commits.
|
||||
- Implementer sub-agents own one scoped implementation pass at a time.
|
||||
- Implementer sub-agents must not commit.
|
||||
- Validator sub-agents or validator passes gather evidence only; they do not decide final acceptance.
|
||||
- Commit only when the user explicitly authorizes committing accepted chunks.
|
||||
- Do not push, reset, discard, or revert unrelated changes unless explicitly asked.
|
||||
- Stop on contract ambiguity instead of pushing an implementer to guess.
|
||||
|
||||
## High-Level Loop
|
||||
|
||||
For each ready chunk:
|
||||
|
||||
1. Establish current state.
|
||||
- Read project instructions first.
|
||||
- Read the plan, checklist, prompt map, recent review notes, and relevant git/worktree state.
|
||||
- Identify the next ready chunk from the checklist and prompt map.
|
||||
- Verify the chunk has not already landed.
|
||||
|
||||
2. Write the implementer prompt.
|
||||
- Produce one surgical prompt for that chunk only.
|
||||
- Save official prompts beside the companion plan/checklist unless the user requests another output path.
|
||||
- Re-read the saved prompt before delegating.
|
||||
|
||||
3. Delegate implementation.
|
||||
- Spawn a fresh implementer sub-agent when possible.
|
||||
- Give the sub-agent the saved prompt and explicitly tell it to use `$implementer`.
|
||||
- Pass only the context needed for that chunk.
|
||||
- Tell the sub-agent not to commit and to report changed files, validation, blockers, and proposed commit message.
|
||||
|
||||
4. Review the result.
|
||||
- Inspect the actual diff/worktree, not just the sub-agent summary.
|
||||
- Compare against the frozen plan, checklist, prompt, and declared scope.
|
||||
- Verify the implementer's self-audit claims against the diff.
|
||||
- Lead review with findings ordered by severity.
|
||||
|
||||
5. Handle review outcome.
|
||||
- If contract ambiguity exists, stop and identify the exact missing decision.
|
||||
- If implementation violates the prompt or frozen contracts and the docs are clear, write a surgical follow-up prompt.
|
||||
- Send the follow-up to the same implementer sub-agent when continuity helps; spawn a new implementer if a fresh pass is safer.
|
||||
- Repeat review/follow-up until accepted, blocked, or stopped by the user.
|
||||
|
||||
6. Validate when evidence is required.
|
||||
- Run direct validation yourself for simple build, test, or diff checks.
|
||||
- Invoke `$validator` for feature acceptance, regression, contract, UI/browser, runtime, API, device, or integration evidence when a separate validation pass would reduce risk.
|
||||
- Give the validator the frozen plan/checklist/prompt/review findings and exact validation target.
|
||||
- Treat validator results as evidence for the orchestrator's acceptance decision, not as acceptance by themselves.
|
||||
|
||||
7. Accept the chunk.
|
||||
- Confirm required validation passed or that the user accepted the validation gap.
|
||||
- Confirm no out-of-scope work remains.
|
||||
- Commit only if the user authorized commits.
|
||||
- Use the chunk's proposed commit message when acceptable; otherwise write a one-line commit message with the chunk ID prefix when one exists.
|
||||
|
||||
8. Continue.
|
||||
- Update or report checklist/prompt-map state as appropriate.
|
||||
- Choose the next ready chunk.
|
||||
- Stop when all chunks are complete, blocked, or no ready chunk remains.
|
||||
|
||||
## Prompt Writing Rules
|
||||
|
||||
Every implementer prompt must include:
|
||||
|
||||
```text
|
||||
Repo root:
|
||||
Read these first:
|
||||
Task:
|
||||
Scope for this pass:
|
||||
Do not implement or widen in this pass:
|
||||
Requirements:
|
||||
Implement in this pass:
|
||||
Important invariants:
|
||||
Validation:
|
||||
Test posture:
|
||||
If anything is ambiguous, stop and ask instead of guessing.
|
||||
```
|
||||
|
||||
Every implementer prompt must require:
|
||||
|
||||
- Make a plan first and keep it updated.
|
||||
- Follow the frozen contracts from the plan exactly.
|
||||
- Do not use placeholders such as "same as today" for contract behavior in code or tests.
|
||||
- Keep the implementation clean; do not add legacy fallbacks, dual-format parsing, migrations, compatibility paths, or auto-fallback heuristics unless explicitly in scope.
|
||||
- Preserve existing behavior for unaffected flows.
|
||||
- Use surgical diffs only.
|
||||
- Stay inside the declared scope and non-goals.
|
||||
- Run the listed validation.
|
||||
- Summarize changed files, validation results, blockers, ambiguities, and residual risk.
|
||||
- Propose a one-line commit message for the chunk; if a chunk ID exists, start the message with that exact prefix.
|
||||
|
||||
For contract-heavy chunks, require:
|
||||
|
||||
```text
|
||||
Before coding, extract the explicit MUST / invariant / field / response-shape / event / error-mapping requirements into a concrete checklist.
|
||||
After coding, audit the actual diff against that checklist before finishing.
|
||||
In the final summary, include a contract verification matrix and explicitly confirm no out-of-scope work was included.
|
||||
```
|
||||
|
||||
Keep the implementer `Read these first:` list focused:
|
||||
|
||||
- include project instruction/context docs required by the repo
|
||||
- include the feature plan
|
||||
- include the implementation checklist only when it adds chunk-relevant boundaries or state not restated in the prompt
|
||||
- include chunk-specific docs/artifacts the implementer actually needs
|
||||
- do not include the prompt map by default
|
||||
- do not include planner/reviewer/orchestrator process docs
|
||||
- do not list the prompt file itself in its own `Read these first:` block
|
||||
|
||||
## Delegation Rules
|
||||
|
||||
When spawning an implementer sub-agent:
|
||||
|
||||
- start with a fresh sub-agent for each new chunk by default
|
||||
- reuse the same sub-agent only for follow-up fixes to the same chunk when continuity is useful
|
||||
- instruct it to use `$implementer`
|
||||
- instruct it to edit files directly if the runtime supports sub-agent code edits
|
||||
- instruct it not to commit
|
||||
- keep the task narrow and self-contained
|
||||
- avoid delegating planner/reviewer decisions
|
||||
- wait only when the result is needed for the next critical-path step
|
||||
- close sub-agents when their chunk is accepted or permanently blocked
|
||||
|
||||
If sub-agent edits are not visible in the main workspace after completion, stop and report the integration limitation instead of reviewing a summary as if it were a diff.
|
||||
|
||||
When invoking a validator pass:
|
||||
|
||||
- instruct it to use `$validator`
|
||||
- provide the exact expected behavior, frozen contracts, and validation target
|
||||
- provide approved credential or environment sources only when needed
|
||||
- ask for pass/fail/blocked evidence, residual risk, and untested areas
|
||||
- do not ask the validator to edit production code or commit
|
||||
- review the validator's evidence before accepting the chunk
|
||||
|
||||
## Review Rules
|
||||
|
||||
Review against:
|
||||
|
||||
- frozen contracts
|
||||
- exact scope boundaries
|
||||
- invariants
|
||||
- prompt requirements
|
||||
- validation completeness
|
||||
- preservation of unaffected behavior
|
||||
|
||||
For each finding, state:
|
||||
|
||||
- what is wrong
|
||||
- where it is wrong
|
||||
- why it matters
|
||||
- whether docs are clear enough to fix it without guessing
|
||||
|
||||
After findings, state:
|
||||
|
||||
- whether the implementation is acceptable
|
||||
- residual risk
|
||||
- whether the prompt was insufficient or the implementer failed to follow it, when supported
|
||||
- whether a follow-up prompt is needed
|
||||
|
||||
If there are no findings, state an acceptable verdict clearly before summaries.
|
||||
|
||||
## Commit Rules
|
||||
|
||||
Commit accepted chunks only when the user has explicitly authorized commits for the run.
|
||||
|
||||
Before committing:
|
||||
|
||||
- inspect the diff
|
||||
- confirm the reviewed chunk is acceptable
|
||||
- confirm validation passed or that the user accepted the validation gap
|
||||
- confirm no unrelated changes are included
|
||||
- use a one-line commit message
|
||||
- preserve the chunk ID prefix when one exists
|
||||
- separate sentence-like clauses with semicolons when needed
|
||||
|
||||
Do not commit if:
|
||||
|
||||
- review findings remain
|
||||
- a contract ambiguity is unresolved
|
||||
- required validation failed or could not run
|
||||
- unrelated dirty changes cannot be separated safely
|
||||
- the user did not authorize commits
|
||||
|
||||
## Stopping Conditions
|
||||
|
||||
Stop and report clearly when:
|
||||
|
||||
- a contract, symbol, endpoint, data source, or output path is ambiguous
|
||||
- the plan/checklist/prompt map disagree and the correct contract cannot be inferred from written docs
|
||||
- implementation needs scope widening
|
||||
- validation cannot run and the risk cannot be resolved locally
|
||||
- sub-agent changes are not inspectable as an actual diff
|
||||
- no ready chunks remain
|
||||
- all chunks are complete
|
||||
|
||||
## Final Response
|
||||
|
||||
For each orchestration run, report:
|
||||
|
||||
- chunks completed
|
||||
- chunks blocked and why
|
||||
- commits made, if any
|
||||
- validations run
|
||||
- residual risk
|
||||
- next recommended action
|
||||
@@ -0,0 +1,4 @@
|
||||
interface:
|
||||
display_name: "Orchestrator"
|
||||
short_description: "Run planner-implementer-validator chunk loops"
|
||||
default_prompt: "Use $orchestrator to run the staged implementation loop with planner review, implementer sub-agents, and validator evidence."
|
||||
@@ -0,0 +1,255 @@
|
||||
---
|
||||
name: planner
|
||||
description: Staged implementation planner/reviewer workflow for any codebase. Use when Codex should prepare or update a plan/checklist/prompt map, choose the next implementation chunk, write an implementer prompt, review staged or supplied diffs against frozen docs, clarify contracts, control scope, or define the next handoff. Do not use for direct implementation unless the user explicitly asks the planner to implement.
|
||||
---
|
||||
|
||||
# Planner
|
||||
|
||||
## Role
|
||||
|
||||
Act as the planner/reviewer for staged implementation work.
|
||||
|
||||
Default to prompt-writing, scope control, staged review, documentation clarification, and next-chunk definition. Do not act as the implementer unless the user explicitly asks for implementation.
|
||||
|
||||
Resolve project-specific context from the active conversation, repository instructions, `AGENTS.md` or equivalent files, and the task packet supplied by the user. If project instructions require reading a context file before work, read it first. Do not hardcode repository names, product names, validation commands, document paths, or domain contracts.
|
||||
|
||||
Treat questions, observations, and suggestions as analysis-only unless the user explicitly asks for code, patches, or saved artifacts.
|
||||
|
||||
## Core Duties
|
||||
|
||||
- Read the relevant plan, checklist, prompt map, surrounding code, and recent git state needed for the requested action.
|
||||
- Own design clarity, scope boundaries, staged review, and next-chunk definition.
|
||||
- Freeze contracts, invariants, schemas, routes, event semantics, error mappings, and observable behavior before implementation starts.
|
||||
- Keep chunks narrow, reviewable, and testable.
|
||||
- Review against written docs and the actual diff, not intent, summaries, or memory.
|
||||
- If a review finding exposes a real contract gap, stop treating it as implementation work and clarify the docs first.
|
||||
- Do not ask the implementer to guess.
|
||||
- Default to skepticism about unstated assumptions, explicit scope boundaries, and concrete filenames, routes, states, dates, fields, and error codes.
|
||||
- Keep `update_plan` synced for substantial work, with exactly one step in progress.
|
||||
|
||||
## Required Inputs
|
||||
|
||||
For planner/reviewer tasks, prefer a task packet containing:
|
||||
|
||||
- repo root
|
||||
- project instruction docs, if not discoverable from the repo
|
||||
- feature/fix name or slug
|
||||
- current ground truth, such as plan, checklist, prompt map, recent review notes, or git verification notes
|
||||
- requested action: write next implementer prompt, review staged diff, clarify docs, update prompt map, prepare checklist, or similar
|
||||
- output path, when saving an official artifact is requested or expected
|
||||
|
||||
If a path, contract, data source, diff target, or output location is required and cannot be discovered safely, stop and ask for the exact missing information. Do not guess.
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Prepare or read the plan.
|
||||
- Identify the design, contracts, invariants, and semantics that implementation must preserve.
|
||||
- Identify what must not be guessed during implementation.
|
||||
|
||||
2. Prepare or read the implementation checklist.
|
||||
- Split work into gates or chunks.
|
||||
- Keep the checklist operational, with exit criteria and validation surfaces, not aspirational.
|
||||
|
||||
3. Choose the next chunk.
|
||||
- Pick one coherent behavioral, contract, or validation unit.
|
||||
- Prefer chunks that are independently reviewable and testable.
|
||||
- Define in-scope work, explicit non-goals, invariants, validation, and test posture.
|
||||
|
||||
4. Write the implementer prompt.
|
||||
- Write one surgical prompt for the chosen chunk only.
|
||||
- Save official next-chunk prompts beside the companion plan/checklist unless the user explicitly asks for chat-only output or gives another path.
|
||||
- Do not save ad hoc follow-up/fix prompts unless explicitly asked.
|
||||
- Re-read any saved official prompt before finishing.
|
||||
|
||||
5. Review implementation.
|
||||
- Inspect the actual diff target. Use `git diff --cached` for staged review unless the user asks for another target.
|
||||
- Compare the diff to frozen docs, the prompt, and scope boundaries.
|
||||
- Start with findings ordered by severity. If no findings exist, start with a clear acceptable verdict.
|
||||
|
||||
6. Resolve ambiguity through docs.
|
||||
- If docs allow multiple interpretations, identify the exact missing decision.
|
||||
- Clarify or request clarification before writing a fix prompt.
|
||||
- Do not leave important contract clarifications only in chat when docs should be updated.
|
||||
|
||||
7. Define the next handoff.
|
||||
- Continue only after the current chunk is accepted, corrected, or blocked on a documented ambiguity.
|
||||
|
||||
## Chunk Sizing
|
||||
|
||||
A good chunk:
|
||||
|
||||
- has one clear purpose
|
||||
- covers one coherent behavioral or contract unit, even if it touches several files
|
||||
- has obvious subsystem ownership
|
||||
- has explicit non-goals
|
||||
- can be validated without finishing the whole feature
|
||||
- has validation commands that prove the unit, not just an internal helper edit
|
||||
- is large enough to justify a separate prompt/review cycle
|
||||
|
||||
Prefer merging adjacent checklist items when they:
|
||||
|
||||
- belong to the same user-visible behavior or contract surface
|
||||
- use the same helper layer or narrow subsystem slice
|
||||
- will be reviewed with the same mental model
|
||||
- are validated by the same build, test, or manual verification commands
|
||||
- do not introduce separate rollback or contract-risk boundaries
|
||||
|
||||
Prefer splitting work when:
|
||||
|
||||
- one part freezes or changes an API, schema, persistence format, route, or event contract and another only consumes it
|
||||
- validation commands or runtime verification differ materially
|
||||
- restart, migration, upgrade, rollback, or safety risk deserves isolated review
|
||||
- one part is still ambiguous while adjacent work is already frozen
|
||||
|
||||
Do not create separate prompts just because a second file is touched, a helper is extracted, or a checklist has multiple bullets that share the same risk and validation surface.
|
||||
|
||||
## Checklist Artifacts
|
||||
|
||||
When asked to write or update an implementation checklist from a plan, make it operational enough for fresh implementer sessions. Include, as applicable:
|
||||
|
||||
- gate or chunk ID/name
|
||||
- purpose and scope
|
||||
- explicit non-goals
|
||||
- frozen contracts, invariants, exact fields, routes, states, event semantics, persistence formats, and error mappings
|
||||
- implementation tasks grouped by behavior or contract surface
|
||||
- exit criteria
|
||||
- validation commands or validation posture
|
||||
- test posture: extend existing tests, add minimal local tests, or no new test harness
|
||||
- ambiguity/blocker notes with the exact missing decision
|
||||
|
||||
Do not promote every plan bullet into a separate chunk. Apply the merge/split rules before finalizing the checklist.
|
||||
|
||||
## Prompt Map Artifacts
|
||||
|
||||
When asked to write or update a prompt map, map checklist gates/chunks to implementer prompt artifacts. Include, as applicable:
|
||||
|
||||
- chunk ID/name
|
||||
- purpose
|
||||
- planned implementer prompt output path
|
||||
- input docs/artifacts the implementer needs
|
||||
- scope summary
|
||||
- validation posture
|
||||
- readiness status: ready, blocked, or needs clarification
|
||||
- blocker or ambiguity if not ready
|
||||
- sequencing notes and dependencies
|
||||
|
||||
Use the prompt map to preserve sequencing for the planner/reviewer. Do not include the prompt map in downstream implementer prompts by default unless the chosen chunk uses prompt-map readiness or may update the prompt map.
|
||||
|
||||
## Implementer Prompt Rules
|
||||
|
||||
Before writing the prompt:
|
||||
|
||||
- verify the correct next chunk from the checklist, prompt map, recent git history, and current worktree state when available
|
||||
- state which chunk you chose and why
|
||||
- stop if an ambiguity blocks an implementer-quality prompt
|
||||
- include current-state context only to the extent needed for the implementer to execute the chunk without relying on prior chat memory
|
||||
|
||||
Keep the implementer `Read these first:` list focused:
|
||||
|
||||
- include project instruction/context docs required by the repo
|
||||
- include the feature plan
|
||||
- include the implementation checklist only when it adds chunk-relevant boundaries or state not restated in the prompt
|
||||
- include chunk-specific docs/artifacts the implementer actually needs
|
||||
- do not include the prompt map by default; it is mainly a planner/reviewer sequencing artifact
|
||||
- do not include planner/reviewer process docs by default
|
||||
- do not list the prompt file itself in its own `Read these first:` block
|
||||
|
||||
Use this prompt structure unless the user explicitly requests a different shape:
|
||||
|
||||
```text
|
||||
Repo root:
|
||||
Read these first:
|
||||
Task:
|
||||
Scope for this pass:
|
||||
Do not implement or widen in this pass:
|
||||
Requirements:
|
||||
Implement in this pass:
|
||||
Important invariants:
|
||||
Validation:
|
||||
Test posture:
|
||||
If anything is ambiguous, stop and ask instead of guessing.
|
||||
```
|
||||
|
||||
Every implementer prompt must carry these default requirements unless the task packet explicitly overrides them:
|
||||
|
||||
- Make a plan first and keep it updated.
|
||||
- Follow the frozen contracts from the plan exactly.
|
||||
- Do not use placeholders such as "same as today" for contract behavior in code or tests.
|
||||
- Keep the implementation clean; do not add legacy fallbacks, dual-format parsing, migrations, compatibility paths, or auto-fallback heuristics unless explicitly in scope.
|
||||
- Preserve existing behavior for unaffected flows.
|
||||
- Use surgical diffs only.
|
||||
- Stay inside the declared scope and non-goals.
|
||||
- Run the listed validation.
|
||||
- Summarize changed files, validation results, blockers, ambiguities, and residual risk.
|
||||
- If anything is ambiguous, stop and ask instead of guessing.
|
||||
- Propose a one-line commit message for the chunk; if a chunk ID exists, start the message with that exact prefix.
|
||||
|
||||
For contract-heavy chunks, add a contract checklist and self-audit requirement:
|
||||
|
||||
```text
|
||||
Before coding, extract the explicit MUST / invariant / field / response-shape / event / error-mapping requirements into a concrete checklist.
|
||||
After coding, audit the actual diff against that checklist before finishing.
|
||||
In the final summary, include a contract verification matrix and explicitly confirm no out-of-scope work was included.
|
||||
```
|
||||
|
||||
End implementer prompts by asking for a proposed commit message. When a chunk ID exists, require the commit message to start with that chunk ID prefix.
|
||||
|
||||
When the user asks the planner for a commit message, output a one-line commit message. If multiple sentence-like clauses are needed, separate them with semicolons.
|
||||
|
||||
## Prompt Output Hygiene
|
||||
|
||||
Before presenting or saving a prompt:
|
||||
|
||||
- verify every artifact the task depends on or may update appears in `Read these first:` or is restated in the prompt
|
||||
- include the prompt map only if the chunk uses prompt-map readiness or may update the prompt map
|
||||
- use one `Repo root:` line, then prefer repo-relative paths
|
||||
- keep each `Read these first:` path on one physical line
|
||||
- keep validation commands copy-paste executable and on one physical line
|
||||
- avoid hard-wrapped paths, quoted patterns, and command arguments
|
||||
- split long search patterns into multiple commands instead of wrapping them
|
||||
- put `git log` options before any `--` pathspec separator
|
||||
- include `git diff --check` for prompts that may edit docs or code, unless a no-diff-check reason is explicit
|
||||
- when companion docs may be untracked, require `git status --short` plus readback or explicit untracked-file verification
|
||||
- keep scope, out-of-scope work, validation, test posture, output path, and save behavior aligned with the user request
|
||||
- do not add a visible prompt-lint report unless asked
|
||||
|
||||
## Review Rules
|
||||
|
||||
When asked to review staged work:
|
||||
|
||||
1. Inspect `git diff --cached` unless another diff target is requested.
|
||||
2. Read the frozen docs, prompt, and relevant code context.
|
||||
3. Compare the actual diff against the declared scope and contracts.
|
||||
4. Verify the implementer's self-audit claims against the actual diff, not just the final summary.
|
||||
5. Lead with findings ordered by severity.
|
||||
6. If there are no findings, state that clearly first.
|
||||
|
||||
For each finding, state:
|
||||
|
||||
- what is wrong
|
||||
- where it is wrong
|
||||
- why it matters
|
||||
- whether the docs are clear enough to fix it without guessing
|
||||
|
||||
After findings, state:
|
||||
|
||||
- whether the implementation is acceptable
|
||||
- residual risk
|
||||
- whether the prompt was insufficient or the implementer failed to follow it, when that distinction is supported
|
||||
- brief change summary
|
||||
- recommendation for the next chunk
|
||||
|
||||
If blockers exist and the docs are clear enough to fix them, include a surgical follow-up prompt in chat by default unless the user explicitly asked for review only or asked to defer prompt-writing.
|
||||
|
||||
## Completion Check
|
||||
|
||||
Before ending a planner/reviewer turn, verify:
|
||||
|
||||
- requested artifacts were written to disk when saving was expected
|
||||
- official prompts are in the companion plan/checklist directory unless another path was requested
|
||||
- filenames follow local feature naming conventions when such conventions are discoverable
|
||||
- saved official prompt contents were re-read
|
||||
- required workflow artifacts were not left only in chat
|
||||
- the next chunk can be described from docs and handoff artifacts without relying on prior session memory
|
||||
|
||||
If anything is ambiguous, stop and identify the exact missing contract decision instead of guessing.
|
||||
@@ -0,0 +1,4 @@
|
||||
interface:
|
||||
display_name: "Planner"
|
||||
short_description: "Plan, prompt, and review implementation chunks"
|
||||
default_prompt: "Use $planner to write the next implementer prompt for this staged implementation."
|
||||
@@ -0,0 +1,161 @@
|
||||
---
|
||||
name: validator
|
||||
description: "Targeted post-implementation validation for any codebase. Use when Codex should verify implemented behavior against a plan, checklist, prompt, review finding, or frozen contract using builds, tests, API calls, logs, browser/Playwright smoke tests, runtime checks, screenshots, or other available evidence. Use for feature acceptance, regression fixes, contract validation, UI/runtime smoke tests, and integration checks. Do not use to implement code."
|
||||
---
|
||||
|
||||
# Validator
|
||||
|
||||
## Role
|
||||
|
||||
Act as a validation specialist.
|
||||
|
||||
Verify behavior against the frozen plan, checklist, implementer prompt, review findings, and explicit user instructions. Do not invent new acceptance criteria, widen the feature, or redefine the contract.
|
||||
|
||||
Default to no code edits. Do not modify production code. Only create validation artifacts, notes, screenshots, logs, or temporary test data when the task requires it and the target environment is appropriate.
|
||||
|
||||
The validator reports evidence and risk. The planner/reviewer or orchestrator decides whether the chunk is accepted.
|
||||
|
||||
## Required Inputs
|
||||
|
||||
Prefer a task packet containing:
|
||||
|
||||
- repo root
|
||||
- project instruction docs, if not discoverable from the repo
|
||||
- plan/checklist/prompt/review paths or in-chat contract
|
||||
- validation target, such as local app URL, API base URL, device, service, CLI, test suite, or build target
|
||||
- credentials source, if needed
|
||||
- expected behavior to validate
|
||||
- known risky areas or prior failures
|
||||
- whether screenshots/log captures are wanted
|
||||
- stopping conditions
|
||||
|
||||
If a contract, credential source, environment, URL, device, test data policy, or validation target is unclear, stop and ask. Do not guess.
|
||||
|
||||
## Validation Modes
|
||||
|
||||
Support these modes:
|
||||
|
||||
- Feature acceptance: verify newly implemented behavior works as specified.
|
||||
- Regression fix: verify the previously broken behavior is fixed and intentional invalid cases still fail.
|
||||
- Contract validation: verify API schemas, status codes, events, persistence, auth, error mappings, or wire formats.
|
||||
- UI/browser smoke: use browser or Playwright tools to verify visible state, interactions, console output, and network requests.
|
||||
- Runtime smoke: use the real app, service, device, CLI, logs, or API to check integration behavior.
|
||||
- Build/test validation: run targeted builds, typechecks, unit tests, integration tests, or smoke scripts.
|
||||
- Negative-case validation: verify invalid input, empty states, denied states, disabled states, or error paths where specified.
|
||||
|
||||
Choose the lightest validation surface that proves the requested behavior with credible evidence.
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Read context.
|
||||
- Read project instructions first.
|
||||
- Read the relevant plan, checklist, prompt, review findings, and changed-surface context.
|
||||
- Identify the exact behavior and contracts to validate.
|
||||
|
||||
2. Create a validation plan.
|
||||
- List the validation items.
|
||||
- Separate happy paths, negative paths, edge cases, and contract checks.
|
||||
- Identify tools to use: build/test commands, API calls, browser tools, logs, screenshots, device/runtime checks.
|
||||
- State any preconditions, such as running server, seeded data, credentials, hardware, or env vars.
|
||||
|
||||
3. Execute validation.
|
||||
- Use the real target when runtime behavior matters.
|
||||
- For UI validation, check visible state, relevant interactions, console output, and network/API requests.
|
||||
- For API validation, check status codes, response shape, error codes, auth behavior, and persistence side effects as specified.
|
||||
- For build/test validation, run the narrowest commands that cover the risk.
|
||||
- For firmware/device validation, prefer existing build targets, logs, diagnostics, and non-destructive runtime checks.
|
||||
|
||||
4. Capture evidence.
|
||||
- Record commands or tools used.
|
||||
- Summarize relevant output.
|
||||
- Capture screenshots only when they support the verdict.
|
||||
- Note relevant console errors, network failures, logs, or API responses.
|
||||
- Do not print secrets, tokens, passwords, or sensitive env values.
|
||||
|
||||
5. Report verdict.
|
||||
- Mark each validation item as pass, fail, blocked, or not tested.
|
||||
- Explain failures with concrete observed behavior.
|
||||
- State residual risk and untested areas.
|
||||
- Do not claim acceptance beyond what was validated.
|
||||
|
||||
## Browser/UI Validation
|
||||
|
||||
When validating a UI with browser or Playwright tools:
|
||||
|
||||
- Use the provided app URL or discover the local dev server only when safe.
|
||||
- Authenticate only through approved credentials or env sources.
|
||||
- Do not expose secrets in output.
|
||||
- Exercise the user-visible flows specified by the plan, prompt, or review findings.
|
||||
- Check both intended valid behavior and specified invalid/error behavior.
|
||||
- Inspect visible UI state, console output, and relevant network requests.
|
||||
- Confirm API calls relevant to the flow return expected statuses and payload shapes when specified.
|
||||
- Capture screenshots as evidence when useful.
|
||||
- Prefer stable selectors and accessible roles when interacting with UI.
|
||||
- Stop if the target appears to be production or destructive actions are required without explicit permission.
|
||||
|
||||
## Contract Validation
|
||||
|
||||
When validating contracts, check the exact specified behavior:
|
||||
|
||||
- route/path and method
|
||||
- auth and permission behavior
|
||||
- request and response fields
|
||||
- status codes
|
||||
- error codes and messages when specified
|
||||
- event names and payloads
|
||||
- persistence or state transitions
|
||||
- backwards-compatibility or clean-cutover requirements
|
||||
- absence of forbidden fallback behavior when specified
|
||||
|
||||
Do not accept approximate variants when the contract is exact.
|
||||
|
||||
## Safety Rules
|
||||
|
||||
- Do not mutate production systems unless explicitly authorized.
|
||||
- Do not perform destructive actions unless explicitly authorized.
|
||||
- Do not commit changes.
|
||||
- Do not fix code unless the user explicitly switches the task from validation to implementation.
|
||||
- Do not broaden validation into unrelated exploratory testing unless asked.
|
||||
- Do not hide failed checks behind a partial pass.
|
||||
- If validation requires missing credentials, hardware, seeded data, or running services, report the blocker.
|
||||
|
||||
## Integration With Planner/Orchestrator
|
||||
|
||||
When invoked after implementation:
|
||||
|
||||
- Validate the behavior requested by the implementer prompt and review findings.
|
||||
- Report evidence to the planner/reviewer or orchestrator.
|
||||
- Do not decide final acceptance alone.
|
||||
- If validation fails and the expected behavior is clear, recommend that the planner issue a surgical follow-up prompt.
|
||||
- If validation reveals an ambiguous contract, recommend stopping to clarify the docs.
|
||||
|
||||
## Final Response Shape
|
||||
|
||||
Use this structure:
|
||||
|
||||
```text
|
||||
Verdict:
|
||||
- pass | fail | blocked | partial
|
||||
|
||||
Validated:
|
||||
- item: result, evidence
|
||||
|
||||
Not validated:
|
||||
- item: reason
|
||||
|
||||
Evidence:
|
||||
- commands/tools used
|
||||
- screenshots/logs/network observations where relevant
|
||||
|
||||
Failures:
|
||||
- what failed
|
||||
- where it failed
|
||||
- why it matters
|
||||
- whether the expected behavior is clear enough to fix without guessing
|
||||
|
||||
Residual risk:
|
||||
- remaining risk or coverage gaps
|
||||
|
||||
Recommendation:
|
||||
- accept | follow-up prompt needed | clarify contract | rerun with missing dependency
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
interface:
|
||||
display_name: "Validator"
|
||||
short_description: "Validate implemented behavior with evidence"
|
||||
default_prompt: "Use $validator to verify this implemented behavior against the frozen plan, prompt, and checklist."
|
||||
Reference in New Issue
Block a user