Skip to content

Agent instructions don't organize specs by domain (flat <capability>/ layout instead of <domain>/<capability/>) #1459

Description

@c4patino

Summary

Every agent-facing instruction in the codebase tells the agent to write specs at specs/<capability>/spec.md — a flat, one-level-deep layout. Human-facing documentation (docs/concepts.md, docs/existing-projects.md) describes organizing specs by domain (e.g., specs/auth/, specs/payments/), but that nested pattern is never surfaced in agent instructions.

The internal code already supports nested layouts (spec-discovery.ts, validator.ts, specs-apply.ts, change-parser.ts all handle specs/<area>/<capability>/spec.md), so the gap is purely in agent-facing guidance.

Affected files

  1. schemas/spec-driven/schema.yaml:62-64 — The authoritative schema instruction tells agents specs/<capability>/spec.md (flat, no domain).
  2. All skill templates (src/core/templates/workflows/propose.ts, explore.ts, sync-specs.ts, archive-change.ts) — Reference specs/<capability>/spec.md.
  3. All SKILL.md files (skills/openspec-propose/SKILL.md, openspec-explore/, openspec-sync-specs/, openspec-archive-change/) — Same flat pattern.
  4. openspec/specs/openspec-conventions/spec.md — Structure diagram shows [capability]/ without a [domain]/ level.
  5. src/core/validation/validator.ts:165 and src/core/parsers/spec-structure.ts:47 — User-facing error messages use the flat path pattern.

Expected behavior

Agents should be instructed to organize specs by domain under specs/<domain>/<capability>/spec.md. The schema instruction and all skill templates should reflect this.

Root cause

The schema instruction has been specs/<capability>/spec.md since spec-driven was introduced, and every skill template and skill file copied that pattern. The human docs show domain organization but the agent instructions never caught up.

Suggested approach

  1. Update schemas/spec-driven/schema.yaml instruction to tell agents to group specs by domain, look at existing domain directories, and create new ones as needed.
  2. Update the path patterns in all skill templates and SKILL.md files to use specs/<domain>/<capability>/spec.md.
  3. Update the conventions spec structure diagram to include the domain level.
  4. Update user-facing error messages in the validator and parser.
  5. Add guidance about how agents should determine the appropriate domain for a capability (existing domains take precedence; create a new short kebab-case domain if none fits).

Note: I have a local branch with all these changes applied that I can share if it would help kickstart the PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions