AGENTS.md — aidokit repository agent rules

Project-level rules for AI-assisted development of aidokit itself. This file is read by your AI coding agent (Claude Code, Codex, Copilot, …) at session start. Keep it lean, high-signal, and evergreen — pin durable conventions here, not transient task state.


1. What aidokit is

aidokit is a command-line tool that scaffolds a structured, adapter-agnostic, AI-assisted development workflow into any software project in one command. It is the productisation of the AI Dev Orchestrator Spec v2.0 — earlier internal iterations of which lived as claude-workflow-kit v2.1, v3, and v4.

aidokit itself:

One-line mental model

A monorepo of TypeScript packages whose CLI shell composes one Adapter + N Stack Packs + shared catalogs + shared docs into a complete workflow tree (.codex/, .copilot/, .claude/, …) in the user's project.


2. Read these before substantive work

The product is fully specified. Do not invent design — read first, draft second.

File When to read
.docs/README.md Always — orientation, vision, install story
.docs/ROADMAP.md Always — release scope by milestone, exit criteria, non-goals
.docs/ARCHITECTURE.md Always — 22-section system design, contracts, flows, principles
.docs/docs/specs/adapter-contract.md Before touching any adapter package
.docs/docs/specs/stack-pack-contract.md Before touching any stack pack
.docs/docs/specs/cli-reference.md Before adding or changing any CLI command/flag
.docs/docs/specs/mcp-catalog.md Before changing the MCP catalog
.docs/docs/specs/conformance-levels.md Before claiming a conformance level on any adapter
.docs/docs/specs/security-model.md Before adding shell execution, network calls, or new write paths
.docs/docs/architecture/decisions/*.md When the question touches runtime, monorepo, adapter shape, MCP shape
.docs/context/claude-workflow-kit-v4-base-part-1.md When emitting kit content — foundation & philosophy
.docs/context/claude-workflow-kit-v4-base-part-2.md When emitting kit content — architecture & specifications
.docs/context/claude-workflow-kit-v4-base-part-3.md When emitting kit content — exact code, templates, operations
.docs/context/claude-workflow-kit-v4-a-z.md When you need the complete v4 reference in one file

Path discrepancy — read this once

The on-disk path is .docs/ (hidden directory). The published docs reference paths as docs/. Treat .docs/ as the source of truth on disk; the dot prefix is an intentional Phase-0 choice to keep design docs out of the published package surface. A future cleanup may flatten this — until then, references in this AGENTS.md and in code comments use the actual on-disk path.


3. Current phase

Field Value
Release target v1.0 GA (in flight — v0.5 Beta shipped, see CHANGELOG.md [0.5.0])
Phase v1.0 — Codex + Copilot adapters landed; remaining: multi-adapter polish, dry-run, capability decls, search, signing
Scope Three adapters (codex Minimum, copilot Minimum, claude-code Strict). Five stack packs (node-ts, node-js, python, react, go). Min/Std/Strict conformance. Brownfield supported.
Audience Public launch cohort
Bar Stable contracts, signed packages, docs site, no P0/P1 bugs

What is in scope right now (v1.0 ROADMAP delta over v0.5): - Multi-adapter projects (.codex/ + .copilot/ + .claude/ from one init) - aidokit search adapter|stack-pack (npm-native discovery) - --dry-run on init and sync (enumerate without writing) - Capability declarations in adapter manifests + conformance verification - Signed npm packages (Sigstore / npm provenance) - Docs site, frozen adapter contract + CLI surface

What is still out of scope (post-v1.0): Third-party adapter/stack-pack SDK as standalone packages, curated marketplace site, additional first-party adapters or stack packs beyond the five listed, IDE plugins, LLM-assisted features, auto-install of prereqs (ADR-0008, permanent non-goal).

If you find yourself building anything still out of scope, stop.


4. Architecture cheat-sheet

Three layers, strict downward dependency:

Layer 3   @aidokit/cli                            (user-facing shell)
              │
Layer 2   @aidokit/adapter-*    @aidokit/stack-pack-*   (siblings; compose orthogonally)
              │                    │
Layer 1   @aidokit/core   @aidokit/shared-docs   @aidokit/stack-detect
          @aidokit/prereq-check   @aidokit/mcp-catalog   @aidokit/base-skills

Rules that are not negotiable:

For the full picture see .docs/ARCHITECTURE.md §1 and §4.


5. Repository layout (intended)

This is the target shape per .docs/ARCHITECTURE.md §3. Most of it does not exist yet — create directories and packages as the phases land them.

aidokit/
├── AGENTS.md                       ← this file (canonical agent rules)
├── CLAUDE.md                       ← Claude Code compatibility pointer → imports AGENTS.md
├── README.md                       ← currently at .docs/README.md, to be moved up
├── ROADMAP.md                      ← currently at .docs/ROADMAP.md, to be moved up
├── ARCHITECTURE.md                 ← currently at .docs/ARCHITECTURE.md, to be moved up
├── CONTRIBUTING.md
├── CHANGELOG.md
├── LICENSE                         ← Apache-2.0, drafted not legally reviewed (v0.1)
├── package.json                    ← workspace root
├── pnpm-workspace.yaml
├── turbo.json
├── tsconfig.base.json
├── .github/workflows/              ← lint, typecheck, unit, integration, publish
├── .changeset/                     ← already initialised per .gitignore
├── docs/                           ← currently .docs/ — see §2 note
│   ├── specs/
│   └── architecture/decisions/
├── packages/
│   ├── cli/                        ← @aidokit/cli
│   ├── core/                       ← @aidokit/core
│   ├── shared-docs/                ← @aidokit/shared-docs
│   ├── stack-detect/               ← @aidokit/stack-detect
│   ├── prereq-check/               ← @aidokit/prereq-check
│   ├── mcp-catalog/                ← @aidokit/mcp-catalog
│   ├── base-skills/                ← @aidokit/base-skills
│   ├── adapter-claude-code/        ← @aidokit/adapter-claude-code
│   └── stack-pack-node-ts/         ← @aidokit/stack-pack-node-ts
├── examples/                       ← bootstrapped sample projects used in CI
└── scripts/                        ← repo automation

Packages not in v0.1: adapter-codex, stack-pack-python, stack-pack-react, stack-pack-go. Do not create their directories yet.


6. Design principles to enforce

These come from .docs/ARCHITECTURE.md §2 and are load-bearing. Reject changes that violate them.

  1. Plain template files, no template engine. Templates are real files under src/files/ mirroring their target layout. Variable substitution uses a single thin interpolate(template, vars) helper with {{varName}} syntax. No Handlebars, EJS, Nunjucks, Mustache. If a template needs conditionals or loops, generate it programmatically instead.
  2. Contracts as TypeScript interfaces. Adapter and StackPack are TS interfaces in @aidokit/core. Not YAML schemas. Adapters are real packages with real code.
  3. Data-driven catalogs. The MCP catalog and prereq list are TypeScript const arrays. Adding an entry is a one-file edit. No runtime plugin discovery before v2.0.
  4. Zero LLM calls. Every decision is deterministic. Every CI run is hermetic.
  5. Conformance declared AND verified. Adapters declare a level in their manifest; the @aidokit/core harness verifies the claim. Drift fails CI.
  6. Adapters and stack packs are siblings. They never import each other.
  7. Migrations are first-class. Every breaking change ships with aidokit migrate. (Not v0.1 surface, but design with this in mind.)
  8. Read-before-write everywhere. No file is overwritten without diff + confirmation. --yes skips the prompt but never the diff computation (diff goes to logs).
  9. Fail loud, recover gracefully. Use the AidoError envelope (§16 of ARCHITECTURE.md). Partial writes go to a staging dir; on failure, staging is deleted and the project root is untouched.

7. Engineering conventions

7.1 Tooling

7.2 Open library choices

These are flagged in .docs/ARCHITECTURE.md §21. Do not silently pick one — open an ADR first and ask the maintainer for a decision:

7.3 Code conventions

7.4 Testing tiers (see ARCHITECTURE.md §18)

Tier What it tests Location Speed
Unit (Vitest) Pure logic: interpolation, schema validation, manifest parsing src/foo.test.ts next to source Fast
Integration Real aido <cmd> in temp dirs; assert on emitted tree packages/*/test/integration/ Medium
E2E Real target-CLI install; <cli> /intake end-to-end e2e/ (TBD) Slow, gated by pnpm test:e2e
Byte-compare reference Adapter output vs the v4-kit reference snapshot Integration tier Medium

Coverage targets (do not relax without an ADR): @aidokit/core 90%+, adapters 80%+, @aidokit/cli 70%+.

7.5 ADRs

Architecture-relevant decisions live in .docs/docs/architecture/decisions/ using the template at 0000-template.md. Numbering is monotonically increasing — do not renumber existing ADRs even if gaps appear. Existing ADRs:

When you introduce a non-trivial design choice, propose an ADR before writing the code.

7.6 Changesets

Every PR that changes published behavior MUST include a changeset. Run pnpm changeset and commit the generated file. Patch/minor/major follows the "pre-1.0 breaking changes allowed on minor bump" rule from .docs/ROADMAP.md.


8. Anti-patterns — refuse these

These are repeat-failure modes the architecture is explicitly written to avoid.


9. Working approach for agents in this repo

9.1 Before writing code

  1. Read the relevant spec section(s) in .docs/ first. Cite the file and section in your response when proposing a design.
  2. If the answer is genuinely undecided, ask one focused question rather than guessing. The product is precisely specified; do not invent.
  3. For changes touching the Adapter or StackPack contract: propose an ADR draft.
  4. For changes touching emitted kit content: cross-reference .docs/context/claude-workflow-kit-v4-base-part-*.md so the templates stay faithful to v4.

9.2 While writing code

  1. Stage work in small, reviewable commits.
  2. Co-locate tests with source. New code without tests blocks the PR.
  3. Update the relevant spec or ADR in the same PR — drift between .docs/docs/specs/* and code is a CI gate (will be, once Phase 0 lands).
  4. Touch only the package the task names. Cross-package refactors are their own PR.

9.3 Source-of-truth ordering when sources conflict

  1. The current target version of the kit content — v4 base parts (Parts 1/2/3).
  2. The product specs in .docs/docs/specs/.
  3. ADRs in .docs/docs/architecture/decisions/.
  4. .docs/README.md, .docs/ROADMAP.md, .docs/ARCHITECTURE.md.
  5. Predecessor kit versions (v3, v2.1) — context only, never overrides.
  6. The target CLI's official documentation — authoritative for any claim about that CLI's primitives (hooks, frontmatter, permission modes, slash commands, MCP behaviour).
  7. The user's instructions in the current session.
  8. General knowledge — lowest priority; flag explicitly when used.

If a v4 base document conflicts with a spec in .docs/docs/specs/, flag the conflict and ask — do not silently pick one.

9.4 When you're stuck


10. The dogfood gate (read once, remember always)

Per .docs/ARCHITECTURE.md §20, every first-party adapter ships with a permanent CI gate that compares its emitted file plan, byte-for-byte, against a committed reference fixture. Three gates run today, one per adapter:

Adapter Conformance Fixture Test
codex Minimum packages/cli/test/fixtures/codex-reference/ packages/cli/test/integration/byte-compare-multi-adapter.test.ts
copilot Minimum packages/cli/test/fixtures/copilot-reference/ packages/cli/test/integration/byte-compare-multi-adapter.test.ts
claude-code Strict packages/cli/test/fixtures/claude-code-reference/ packages/cli/test/integration/byte-compare.test.ts

All three fixtures are produced from the same fixed packages/cli/test/integration/reference-context.json paired with @aidokit/stack-pack-node-ts, so the only variable between the trees is the adapter under test. The generator is:

pnpm -r build
node scripts/generate-reference-snapshot.mjs              # regenerate all three
node scripts/generate-reference-snapshot.mjs --adapter codex   # one at a time

The byte-compare tests fail if the emitted plan diverges from the fixture in any byte. Drift fails CI. Intentional kit changes are landed by regenerating the affected fixture(s) and reviewing the diff before committing — an unreviewed regeneration silently launders a regression past the gate.

@aidokit/adapter-claude-code additionally honors named drift exceptions in byte-compare-exceptions.json for the rare cases where intentional Strict- conformance content cannot be expressed in the fixture. Codex and copilot have no exception list — at Minimum conformance the surface is small enough to keep strict. (The differing conformance levels are a consequence of target-CLI capability — Claude Code exposes deterministic hooks and output styles, so its adapter declares strict; Codex and Copilot expose neither, so theirs declare minimum. This is a capability outcome, not a ranking of adapters.)

Why this matters: if aidokit init produces a working project for one adapter, it produces this project's .codex/ / .copilot/ / .claude/ content. If it doesn't, we know on the next CI run.


11. Non-goals — pushback list

If a request asks for any of these, push back politely and cite the source:


12. Quick references


13. Editing this file

AGENTS.md is the canonical agent-rules surface and is read at every session start (Claude Code pulls it in via the @AGENTS.md import in CLAUDE.md). Keep it under ~400 lines. When this file grows, prefer extracting durable detail into a spec under .docs/docs/specs/ and linking from here. Transient state never belongs in AGENTS.md.