Skip to content

refactor(openspec): split big capabilities into nested ones #4622

Closed

Description

@dan-petty

Problem or Motivation

Owner decision (2026-11-11): split the big OpenSpec capabilities into nested capabilities to cut merge conflicts, with no rule change. The archive stays in the closing PR (AGENTS.md rule 1, ADR 0010).

Measured in the conflict census of 2026-11-04 to 2026-11-11 (all 460 topic PRs):

  • 130 base updates of topic PRs had a real merge conflict. 97 of them (75%) include a file under openspec/specs/, and 62 are only in such files.
  • openspec/specs/roadmap-stage/spec.md alone had 81 conflicts. In 74 of 91 spec-file conflicts, both sides only added requirements at the end of the same file. openspec 1.14.3 always appends ADDED requirements at the end of the capability file (dist/core/specs-apply.js about lines 464-467), so two PRs that archive into one capability always conflict.
  • Size today: roadmap-stage 335 requirements (4,290 lines), roadmap-implement-job 142, roadmap-implement-step 90, roadmap-refine 79.
  • Each conflict costs a rebase push and a full CI run (about 45 runner-minutes). The 56 spec-only conflict pushes of the week cost about 2,240 runner-minutes.

Proposed Solution & Architectural Design

Use the nested layout that openspec 1.14.3 supports: openspec/specs/<area>/<id>/spec.md. Checked on the pinned install (~/.local/share/devops-cli/tools/openspec/1.14.3, dist/utils/spec-discovery.js:7): openspec list --specs --json lists a nested folder as the capability area-a/cap-one next to the flat ones.

  1. Split roadmap-stage, roadmap-implement-job, roadmap-implement-step and roadmap-refine into nested capabilities under an area of the same name (for example roadmap-stage/paths-gate, roadmap-stage/trace-gate, roadmap-stage/selection). Group the requirements by the module or gate that they describe, so that concurrent PRs about different gates append to different files. Move each requirement word for word: change no requirement text and no scenario.
  2. Move the deltas of every open change folder under openspec/changes/ that names a split capability to the new ids in the same PR, and say in the PR how an open PR or plan PR moves its delta after the merge (one git mv of its specs/<old>/spec.md).
  3. Make every reader of spec paths take the nested layout. Replace the flat folder walk of read_base_specs (src/devops_cli/roadmap/stage/stage_specs.py about lines 62-74) with openspec list --specs --json, which the stage tools already read (stage_tools.py about line 291). Check the other modules that name openspec/specs: stage_change.py, stage_references.py, stage_validate.py, refine/refine.py, commands/pr.py, openspec/archive.py, openspec/skills.py, github/defect_classifier.py, config/constants.py and lang/en/messages.py.
  4. Write the nested layout and the size limit of a capability into openspec/config.yaml (the rules for a new capability), so that a capability that grows past the limit gets split.

Merge it at a quiet time and say so on the open PRs that change these specs, because the split conflicts once with each of them.

Target Subsystem

openspec/specs (the four capabilities), openspec/changes (open deltas), src/devops_cli/roadmap/stage, src/devops_cli/roadmap/refine, src/devops_cli/openspec, src/devops_cli/commands/pr.py, openspec/config.yaml.

Existing Tool Considered

The openspec CLI 1.14.3 itself: its nested capability layout and openspec list --specs --json. The change deletes the custom folder walk and adds no code. Rejected: a git union merge driver (GitHub ignores .gitattributes merge drivers in its own merge and conflict check, so it saves no push, and ADR 0010 showed that it hides a lost edit), archiving after the merge (needs a rule change; the owner chose this split), and a GitHub merge queue (not available to a repository that a user account owns).

Acceptance criteria

  • No capability under openspec/specs/ holds more than 80 requirements.
  • A test compares the requirements before and after: the same set of requirement titles and texts and the same scenarios, with none lost, added or changed. The total stays equal (626 in the four capabilities today).
  • openspec validate --specs --strict passes, and openspec list --specs --json lists the new ids.
  • The stage job reads the base specs of a nested capability: a test with a nested fixture tree passes, and the flat walk is gone.
  • Every open change folder on main validates against the new ids.
  • One week after the merge, a comment on this issue gives the number of conflicting base updates that touch openspec/specs/ (the census method of 2026-11-11), against 97 in the week before.

Activity

  1. added
    source/agent
    type/refactor
    scope/openspec
    status/new
    value/medium
    effort/high
    on Nov 11, 2026
  2. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/refactor. The refactor prefix of the title gives the type.
    • Scope: scope/openspec. The (openspec) scope of the title gives the scope.
    • Priority: P2-Medium. It saves CI time and reduces conflict friction, but the system works today and the merge needs quiet timing.
    • Value: Medium. It removes the top source of merge conflicts and saves roughly 2,240 runner-minutes per week.
    • Effort: High. It moves hundreds of requirements, updates at least ten code readers, relocates open deltas, and coordinates with in-flight PRs.
    • Related: docs(adr): evaluate OpenSpec as the spec and change-proposal layer for agents and task files #1753, which asks for a different change. Both concern the OpenSpec layer; #1753 adopted OpenSpec, the candidate restructures its spec files to cut merge conflicts.
  3. added
    priority/p2-medium
    on Nov 11, 2026
  4. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Scope from the iteration lane plan (2026-11-11)

    This issue is child 1 of #4667. The plan keeps the scope as filed. The nested split is the main lever on late conflicts: the cluster gate of the plan removes no late conflict, because 45-46 of the 52 late conflicts in the census week came from a main change after the last own push.

  5. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 12, 2026
  6. removed
    status/in-review
    owner/agent
    on Nov 12, 2026
  7. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor
  8. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-12 12:40 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/highpriority/p2-mediumscope/openspecsource/agenttype/refactorvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions