Skip to content

Explore: Propose changes to specs you can't write to, from the repo where your change lives - #2346

Draft
TabishB wants to merge 4 commits into
mainfrom
claude/openspec-independent-changes-fac95a
Draft

TabishB wants to merge 4 commits into
mainfrom
claude/openspec-independent-changes-fac95a

Conversation

@TabishB

@TabishB TabishB commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Where a change is created should not limit which specs it can propose changes to.

Exploration for #2344. Draft, experimental, not for merge as is. This is the third version, and it replaces the earlier two.

What you can't do today

A change can only update the specs in its own openspec/ folder. If your team keeps shared specs in another repo, you have two options:

  1. Plan the change in the shared repo. Your plan and tasks end up away from your code, in a repo you may not be able to write to.
  2. Restate the spec in your repo. Archiving then creates a second copy of the spec. The shared one never changes.

An agent asked to plan a real change with today's OpenSpec did the second.

What this lets you do

Keep the change next to your code. Put the update you want in the shared spec in a folder named after its owner.

web-app/openspec/changes/add-sso/
├── proposal.md
├── tasks.md
├── specs/
│   └── login-page/spec.md              for web-app's own spec
└── spec-updates/
    └── team-specs/auth/spec.md         for the shared auth spec

The file is an ordinary delta with one extra first line. It names the spec file and the revision you were reading:

<!-- Proposed update to openspec/specs/auth/spec.md in team-specs, written against revision 6683cb5d... -->

The normal experience

sequenceDiagram
    participant Dev as You (web-app)
    participant PR as Your pull request
    participant Owner as Spec owners (team-specs)

    Dev->>Dev: "Propose this change."
    Dev->>Dev: "Implement this change."
    Dev->>PR: Push code and the change together
    Dev->>Dev: Archive when the work is done
    Note over Dev: openspec list keeps showing the open update
    PR-->>Owner: Ask for review, as for any pull request
    Owner->>Owner: "Review the proposed spec updates in this PR."
    Note over Owner: They edit their spec in their repo
    Owner-->>Dev: You pull team-specs
    Note over Dev: openspec list no longer shows it
Loading
  1. You plan and implement in your repo. Nothing is written to the shared repo.
  2. If the shared spec changed since you planned, the implementation step says so before any code is edited.
  3. You archive when your work is done. You don't wait for anyone.
  4. openspec list shows what is still open, including updates in archived changes.
  5. The spec's owners read the file in your pull request and edit their spec. They need no OpenSpec command. The first line tells them what changed in their spec since you wrote it.

How this differs from stores and references

  • A store answers "where does this change live?". Unchanged.
  • A reference answers "which other specs can I read?". Read-only today.
  • This adds one thing: a change can carry a proposed update to a spec it can read but not write.

A reference can also point at a folder by path, so two openspec/ folders in one monorepo work the same way with no store.

What OpenSpec guarantees

Guarantee How
A proposed update is never applied to your repo's specs. It lives outside specs/. Released CLI 1.13.2 ignores the folder.
Nothing writes to a repo you only reference. No command does. Tested with a read-only checkout.
Archiving never waits on another team. Archive ignores spec-updates/.
An open update can't be hidden by archiving. openspec list works it out from the files on every run.
An update is never compared against the wrong repo. If the recorded revision isn't in the checkout, nothing is compared.
openspec archive won't overwrite a requirement that changed after a delta's recorded revision. It refuses and changes no files.
Repos with specs beside code see no difference. Output is identical to main.

What it leaves to Git, your review tool and people

  • Telling the owners, review, approval and merge.
  • The order code and spec land in. There is no lock.
  • Whether two requirements now contradict each other.

What changed from the previous version of this PR

Before Now Why
File at specs/@<name>/ File at spec-updates/<name>/ The released CLI created a stray local spec from the old path.
Merge engine and validator changed Merge engine identical to main Nothing under specs/ means anything new.
Owners adopt the update as their own change Owners edit their spec. A change is optional. 5 of 5 owner sessions edited directly and lost nothing.
Everything advisory Advisory, plus one refusal in archive Without it, archive replaced a newer decision and reported success.
Open update mentioned once, at archive Listed on every openspec list Archiving must not hide unfinished work.
Validate could fail on the owners' current spec Structure only. Fit is a warning. Another team's merge must not fail your CI.

Evidence

  • 19 end-to-end tests, each on real Git repos.
  • 9 scenario scripts anyone can rerun, with captured output.
  • 33 agent sessions with plain prompts, on Claude Opus, Claude Haiku and Codex.

The agent fixture replays two real pull requests that changed the same requirement of OpenSpec's ai-tool-paths spec within a day (#1672 and #1738). Applied as written, the second deletes what the first added.

Question Result
Owners asked to review the pull request: did they keep the other team's scenario? 5 of 5, including a session with today's skills.
Developer asked to implement: did sessions that ran OpenSpec's implement step stop first? 4 of 4.
Same, weaker model, all sessions 2 of 5. The 3 that missed never ran an OpenSpec command.
Asked to plan: did the update go to the right place with the right revision? 4 of 4 after one wording fix. Today's build forked the spec.
Same owner review, on a real pull request in a private scratch repo pair 3 of 3 kept it. None pushed or commented without asking.
Released CLI and released skills asked to archive Stopped and asked. No stray spec.
"Why does this requirement say this?", after the branch was deleted 2 of 2 found the change, the reason, and what was declined.

Is it ready?

To commit to the direction: yes. Two calls are the maintainer's:

  1. Owners edit their spec directly, and a change of their own is optional. Is that acceptable as the model?
  2. Nothing is stored about an update's fate, so "declined" and "not yet reviewed" look the same until the developer acts. Is that enough?

To ship: not yet.

  1. The hosted pull request trial used one account for both sides. Review comments between people and required reviewers are untried.
  2. The path-reference shape overlaps with feat(config): connect roots in monorepos #1992 and should be settled there.
  3. A weaker model that implements without running OpenSpec gets no warning. The cost is late news, not a wrong spec.
  4. Not run on Windows. openspec list not timed on very large archives.

Read more

Checks

pnpm build, pnpm lint and tsc --noEmit pass. Full suite: 6,670 pass. One test fails locally in unrelated code (test/core/update.test.ts, "remembers Keep across checkouts") and has passed in CI on this branch.

Related

Nothing here should close or absorb another issue. decisions.md has the implication for each of #2336, #2342, #2343, #2334, #2335, #2340, #2033, #1968, #1992, #1950, #2167, #1909, #2323, #2341, #1387, #1460 and #2289.

🤖 Generated with Claude Code

Exploration for #2344. A change stays beside the code and can aim a delta
at a spec a referenced store owns (specs/@<store-id>/<capability>/spec.md).
The owner pulls the update in with `openspec sync <change>` from their own
checkout. Nothing writes to the store while planning or implementing.

- Planning base (.openspec-base.yaml) records the text of each requirement
  a change modifies, removes or renames.
- status and validate report each proposed update as pending, accepted,
  stale or conflict, read off the owning spec every time.
- `openspec sync` refuses stale or conflicting updates; `openspec rebase`
  re-records the base after the delta is reconciled.
- archive refuses to overwrite a requirement that changed under the change
  and waits for referenced updates to be accepted (--skip-specs drops them).

Findings, experiment log, lab scripts and agent transcripts are in
openspec/explorations/independent-changes/.
@coderabbitai

coderabbitai Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@TabishB TabishB changed the title feat(specs): propose updates to specs another repo owns (explores #2344) Explore: Propose changes to shared specs from your code repo Dec 3, 2026
…nly report

Second version of the #2344 exploration, after review of the first.

A change still proposes updates to a spec another root owns from a delta
at specs/@<name>/<capability>/spec.md. Everything built around that in
the first version is removed:

- openspec sync and openspec rebase are gone. The owner adopts the
  proposal as an ordinary change in their own root.
- .openspec-base.yaml is gone. The delta starts with one line naming the
  revision it was written against, printed by openspec instructions.
- The pending/accepted/stale states are gone. status, apply instructions
  and validate report what the named checkout says and what changed
  since that revision. Nothing is written, and nothing claims acceptance.
- archive no longer blocks. It lists proposals that are still open.
- Repo-local behavior is identical to main.

A reference can now be declared as {id, path}, so two openspec/ folders
in one repository work without a store.

The exploration folder holds the rewritten proposal, a response to each
area of the review, findings, experiments, scenario scripts and agent
transcripts. The first version's documents and evidence are under v1/.
@TabishB TabishB changed the title Explore: Propose changes to shared specs from your code repo Explore: Let changes propose updates to specs that live elsewhere Dec 3, 2026
…dit directly

Third version of the exploration for #2344.

A change's proposed update to a spec another root owns now lives at
spec-updates/<reference>/<capability>/spec.md. A released CLI treats any
specs/**/spec.md as a local delta, and created a stray local spec from the
previous specs/@<reference>/ layout. It ignores the new folder.

- The merge engine is back to main. The validator gains one optional argument.
- The first line names the spec file and the revision. The read command that
  instructions print is pinned to that same revision.
- A revision the checkout lacks means nothing is compared, because that is
  also what a repointed reference looks like.
- validate checks a proposed update's structure only. How it fits the owning
  spec today is a warning, so another team's merge cannot fail this repo.
- archive refuses to apply a delta that records a revision when a requirement
  it modifies changed since, or when the revision is unknown. Everything else
  stays advisory.
- list shows every proposed update the owning spec does not contain yet, from
  active and archived changes.
- Owners edit their spec directly and name the source. Taking the update up as
  a change of their own is optional.

Evidence: 19 end-to-end tests, 9 scenario scripts, and 30 agent sessions on a
fixture built from two real pull requests against the ai-tool-paths spec.
@TabishB TabishB changed the title Explore: Let changes propose updates to specs that live elsewhere Explore: Propose changes to specs you can't write to, from the repo where your change lives Dec 3, 2026
Three fresh owner sessions (Haiku, Codex, Opus) reviewed a real pull
request in a private scratch repo pair. All three kept the scenario the
owners had merged meanwhile and took one of the two proposed scenarios.

TabishB commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

Assessment after the third iteration

I think we've arrived at the right product direction.

Let changes carry proposed updates to other specs, give agents the context to reconcile them, and let the owners incorporate them through their existing workflows.

This is a better experience than requiring a separate planning checkout for every code worktree. It also avoids introducing a new synchronization or approval workflow. The hosted PR experiment is particularly encouraging: spec owners can review and incorporate the relevant updates without checking out the code repo or creating another OpenSpec change.

I think we can close out the broad exploration and focus on getting this direction ready to ship.

What this means for related work

Before shipping

The remaining work should be focused:

  1. Outstanding updates: Partial acceptance was common in the experiments. Figure out how to resolve a reviewed, declined or superseded proposal without rewriting archived intent just to clear a list. Be precise about the difference between text not matching and work still being outstanding.
  2. Ownership and references: Settle the path-reference configuration with feat(config): connect roots in monorepos #1992 and verify that each owner can identify the right updates when one change targets multiple sources.
  3. Safety: Verify the write protections for stale updates, including their limits when owners edit specs directly or use older clients.
  4. Real team workflow: The hosted trial validates the PR handoff, but one account played both sides and the final merge was manual. Validate the remaining collaboration boundaries and check large-archive performance before release.

These are production-readiness questions, not reasons to reopen the whole design. Keep the experience simple and resist adding a separate lifecycle, synchronization engine or proposal-management system unless the evidence shows we genuinely need one.

Direction approved for further development, not approval to merge this prototype as-is.

TabishB commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

Mock release announcement: Introducing cross-repository spec updates

Thinking exercise: how we could announce this feature once the remaining production-readiness questions are resolved. This is not a release announcement for functionality already shipped.

You can now keep an OpenSpec change alongside your code and propose updates to specs that live in another repository.

Previously, if your team kept shared specs in a separate repository, changes that updated those specs also needed to live there. You could reference shared specs from your code repo, but there was no built-in way to propose updates to them.

We're removing that restriction.

One change, multiple spec repositories

Imagine your team maintains a shared authentication spec used by your web, mobile and backend applications. You're working on the web app and want to introduce enterprise SSO.

flowchart LR
    subgraph Before["Before"]
        C1["Code repo: code"]
        S1["Shared repo: changes + specs"]
        C1 -->|"Plan in shared repo"| S1
    end
    subgraph After["Now"]
        C2["Code repo: change + code"]
        S2["Shared repo: specs"]
        S2 -->|"Read"| C2
        C2 -->|"Propose updates for owner review"| S2
    end
Loading

You can plan the change in your web app, propose updates to the shared authentication spec, and review everything alongside your code.

You don't need write access to the shared specs or a separate planning checkout for every feature.

How to use it

1. Reference your shared specs

In your project's openspec/config.yaml, reference an existing registered store:

references:
  - team-specs

Already using references? There's nothing else to configure.

2. Work as you normally would

Ask your agent:

/openspec Propose a change to support enterprise SSO.

Your agent can now propose updates to both your project's own specs and the shared specs within the same change.

openspec/changes/add-sso/
├── proposal.md
├── design.md
├── tasks.md
├── specs/
│   └── login-page/spec.md
└── spec-updates/
    └── team-specs/auth/spec.md
  • specs/ contains updates to your project's own specs.
  • spec-updates/ contains proposed updates to specs that live elsewhere.

Your agent handles this structure for you.

3. Implement and review

Continue with your usual OpenSpec workflow. Your proposed spec updates travel with the change, so reviewers can see the intended behavior alongside its implementation.

If the shared spec has changed since you planned the work, OpenSpec can help your agent understand what changed before continuing.

4. Review the shared spec updates

Share your pull request with the spec's owners.

From their own repository, they can ask their agent:

Review the proposed spec updates in this PR and update our spec with what should go in.

They can incorporate the updates, revise them or decline them using their existing review process.

There is no new command or separate approval workflow to learn.

Working on multiple changes in parallel

Several developers or agents can independently propose updates to the same shared specs.

flowchart TD
    S["Shared authentication spec"]
    S -->|"Read"| A["Worktree A: Add SSO"]
    S -->|"Read"| B["Worktree B: Change session expiry"]
    A --> P1["Code + proposed SSO update"]
    B --> P2["Code + proposed expiry update"]
    P1 --> R["Spec owner reviews and incorporates updates"]
    P2 --> R
    R --> U["Updated shared spec"]
Loading

Each proposed update records which revision of the shared spec it was written against.

If another change updates the spec while you're working, OpenSpec surfaces the differences so your agent can review them and preserve the newer behavior.

No additional planning worktrees are required for this setup.

Finish your work independently

You can archive your change when your work is done, even if another team is still reviewing the proposed spec updates.

The proposed updates remain with your archived change.

Run:

openspec list

OpenSpec shows proposed updates that aren't reflected in your local checkout of the shared specs, including updates from archived changes.

You can also inspect an active change using:

openspec status --change add-sso

OpenSpec reports what the referenced specs currently contain. Your pull requests and existing review tools remain responsible for approval and merge decisions.

Stores and references: what's the difference?

Configuration When to use it
store: team-specs You want to plan changes centrally in a shared repository.
references: [team-specs] You want to keep changes in your own repository while using shared specs and proposing updates to them.

Stores continue to work as before.

References also remain read-only. OpenSpec never automatically writes to a referenced repository. Your change carries the proposed updates instead.

Upgrading

After upgrading the CLI, refresh your agent skills:

openspec update

Using OpenSpec in a single repository? Nothing changes for you.

Already using references? Your existing configuration works. Your agent can now propose updates to referenced specs.

Using a store for centralized planning? You can continue using it. No migration is required.

If you'd prefer future changes to live alongside your code, switch from a store-only setup to a local OpenSpec root with references to your shared store.

# Before: plan in the shared store
store: team-specs
# After: plan locally, reference shared specs
references:
  - team-specs

Initialize a local OpenSpec root if your code repository doesn't have one. Your existing specs, changes and history can remain in the shared store. There's no need to copy them into your code repository.

We recommend using the updated CLI and skills across your team when adopting this workflow.

Keep your plans where you work. Keep your specs where they belong. Connect them without duplicating them.


What this mock announcement tells us we still need to resolve

Before publishing, we should make sure the actual experience supports what we're promising:

  • Outstanding updates: resolve declined, partially incorporated or differently worded proposals without unnecessarily editing historical artifacts.
  • Connected roots: settle the path-reference configuration alongside feat(config): connect roots in monorepos #1992 before announcing monorepo support.
  • Migration: document and test switching from centralized planning to local changes, including existing active changes.
  • Reconciliation: be clear that OpenSpec reports textual differences, not every semantic conflict, and that agents need to invoke the relevant workflow.

The feature should be an extension of changes and references, not Stores 2.0 or a new product abstraction.

Related: #2344, #2336, #2334, #2340, #1968, #2033, #1992.

TabishB commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

Release positioning and what to settle before shipping

I would lead with the experience we're enabling for existing users, rather than introducing shared specs or stores again.

References already let your agent read specs from another repository. Now your change can also propose updates to those specs, without moving the change into that repository.

For example, if your web app references a shared authentication spec, you can propose SSO, implement it, and review the proposed changes to both your app's specs and the shared authentication spec in the same code PR. The authentication team can then incorporate the shared spec updates through its own review process. References remain read-only; nothing is automatically applied across repositories.

Stores still serve the same purpose: planning centrally when that is where the team wants its changes to live. This extends what a local change can do, rather than introducing stores again.

Before publishing the release

  • Resolve outstanding updates. If the owner incorporates only one of two proposed scenarios, rejects the proposal, or expresses the same behavior in different wording, what does the developer see and how do they resolve it? We shouldn't equate a text mismatch with unfinished work or require people to rewrite archived intent just to clear a list. Demonstrate the experience after partial acceptance and after a subsequent spec change. Keep the original proposal and the outcome discoverable. Prefer existing review records and lightweight references over a new approval system.
  • Use one model for connected roots. Reconcile the path-reference configuration with feat(config): connect roots in monorepos #1992 and Proposal: Multiple connected spec roots within a monorepo #1729. The experience should be the same whether the referenced specs are in another repo or another OpenSpec root in a monorepo. Demonstrate a change targeting more than one root, including a case where both roots can be updated in the same PR. Don't introduce competing reference formats.
  • Make migration explicit. Existing repo-local, reference-based and centralized store workflows should continue working without migration. For someone who wants to move future planning from store: to a local root with references:, document and test the exact steps. Existing active changes and archived history should remain accessible where they were created. Nothing should silently move or become inaccessible. Test mixed CLI/skill versions and make the upgrade guidance clear.
  • Be precise about reconciliation. OpenSpec can report textual changes against a recorded revision; it cannot guarantee semantic consistency, know that a PR was accepted, or reach an agent that never invokes OpenSpec. Show the actual findings for changed, unavailable and partially incorporated specs. Verify the targeted overwrite protection when applying a revision-bearing local delta, and make clear that direct edits rely on normal review. Avoid presenting advisory findings as guarantees.

These are release-readiness questions, not a request to expand the feature. Resolve them in the simplest way that fits the existing workflows, and update the user guide, examples and mock announcement to match the actual experience. See also #2344, #2334, #1968 and #2033.

TabishB commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

Implementation review: make the code as simple as the product model

I reviewed the production diff at ac8a7be2 against its base. The direction is still the right one: a change carries proposed updates, OpenSpec supplies context, and owners incorporate the updates through their normal review workflow.

The third iteration has removed a lot of unnecessary product complexity. Before shipping, I would also like to make sure the implementation doesn't introduce parallel mechanisms or special cases that we then have to maintain indefinitely.

Priorities

Resolve before shipping:

  • Outstanding updates: list currently treats a textual mismatch as open work, including in every archived change. An accepted update can reappear months later when a spec evolves. Challenge whether the default list needs to scan archives at all. Preserve the ability to inspect proposals, but don't introduce a lifecycle tracker without a reliable definition of what is outstanding.
  • Write safety: The CLI archive guard is useful, but the normal archive skill can sync specs itself and move the folder without calling the CLI archive command. The guard is not a guarantee for that path. Align the checks with Proposal: prepare → agent work → validate → confirm → finalize flow for archive #1460 and Exploration: should OpenSpec stop merging specs deterministically in openspec archive? #2033, and test actual agent-driven sync/archive as well as direct CLI archive.
  • Independent completion: Separate local pre-write checks from advisory external comparisons. An unreadable external checkout should not prevent a developer from archiving unrelated local work.

Simplify the implementation:

Production review: Keep this PR as the exploration record, including prior iterations, transcripts and evidence. When the decisions are settled, prepare a focused implementation PR with the necessary code, tests and user docs, linked back here. Don't merge tens of thousands of lines of research artifacts into the production tree simply because they're in the prototype.

The goal is not to prescribe a particular refactor or invent new abstractions. Challenge whether each mechanism needs to exist in the first place; reuse existing code where its contract fits. Keep spec-updates/ separate from local deltas, preserve source revisions, and keep external proposals read-only from the originating root.

I will leave more specific code-level feedback in the review. These are static findings, not independently reproduced failures. Address the concrete risks and demonstrate the normal user experience still works; don't optimize for fewer lines at the expense of clarity or safety.

@TabishB TabishB left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-level follow-ups to the implementation review. Please treat these as opportunities to simplify and verify the implementation, not a requirement to add abstractions or preserve every current mechanism. The product direction remains supported; this draft is not yet approved to merge.

}

/** True while a proposed update has something the owning spec does not say. */
export function isOpen(update: ProposedUpdate): boolean {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reconsider this definition of outstanding work. Any historical proposal whose requirement text differs from today's checkout becomes open, even if it was reviewed, declined, reworded, or accepted and later superseded. An accepted SSO update can reappear months later because the spec naturally evolved. Can we remove the automatic archive sweep from ordinary list, or otherwise give users a way to resolve a proposal without rewriting the archived intent? Keep the distinction between a text comparison and a review outcome. This is a product decision first, not a request for a status database.

Comment thread src/cli/index.ts
@@ -505,6 +506,7 @@ program
json: options?.json,
archived: options?.archived,
all: options?.all,
...(mode === 'changes' ? { openProposals: await findOpenProposals(root) } : {}),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes every normal change-list operation perform a sweep of active and archived proposals, including reference resolution and Git reads. Before adding caching, reconsider whether this belongs in the default list at all (see the lifecycle concern in isOpen). If retaining it, demonstrate predictable behavior on large archives, missing/unreadable sources and list filters, and keep simple repo-local listing cheap.

* The files of a change that propose an update to a spec another root owns:
* `spec-updates/<reference>/<capability>/spec.md`, sorted.
*/
export function listProposedUpdateFiles(changeDir: string): string[] {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now have a second recursive spec-file discovery implementation, plus findReferencedOwners. The existing discoverSpecFiles and artifact-output utilities have explicit containment, symlink and error semantics. Here directory read failures are swallowed and any non-directory named spec.md counts, which can disagree with validation or the report. Reuse/consolidate discovery rules so the artifact graph, apply context, validation and reporting agree on what exists. Keep local merge inputs separate. Avoid building a generalized filesystem framework just for this.

if (
isArtifactComplete(artifact.generates, changeDir) ||
// An update proposed to a spec another root owns is this change's spec work too.
(isSpecsArtifactPath(artifact.generates) && hasProposedUpdates(changeDir))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

External-only changes must satisfy the spec artifact, but this special case is repeated in artifact state, apply context and validation. Can the existing artifact output model or a small shared spec-output resolver express that once? Check custom schemas and malformed/misplaced proposal files. We shouldn't make the generic graph understand every new spec storage convention, or introduce a mandatory new artifact.

alsoChangedSinceBase?: string[];
}

const BASE_LINE = /<!--[^>]*?\brevision ([0-9a-f]{7,40})\b[^>]*-->/i;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment advertises a source, document path and revision, but this parser accepts any pre-heading comment containing revision <hex> and extracts only the hash. The target path/name aren't checked against the selected root. A commit existing in a repository is not proof of root identity (same Git history for multiple monorepo roots, forks, repointed references). Establish one small, well-defined source reference aligned with #2334 and use it consistently for authoring and verification. Test wrong root/path, unrelated comments, missing/malformed metadata and same-history roots. Don't introduce a new registry.

* never saw: a requirement it touches changed since the revision it names, or
* that revision cannot be read here at all.
*/
export function wouldOverwriteUnseen(update: ProposedUpdate): boolean {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This predicate is a write-safety policy, not report rendering. Keep the comparison and write-policy decisions in the domain code, with rendering consuming their results. Review whether changed/unavailable alone correctly captures the dangerous cases and how the existing merge checks handle other operations. Avoid making presentation code the authority for destructive writes.

Comment thread src/commands/validate.ts
if (owners.length === 0 && updates.length === 0) return report;

const issues: ValidationIssue[] = [];
const owning = await resolveOwningRoots(root, owners);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This resolves owners again after findProposedUpdates already discovered/resolved them. More importantly, discovery, structural validation and comparison should use the same inputs so they don't disagree. Compose existing functions around one set of discovered files and resolved references per command; avoid a new cache/service layer. Please check missing or unreadable sources and that invalid external delta structure is reported consistently even if the owner is unavailable.

@@ -54,6 +55,8 @@ ${STORE_SELECTION_GUIDANCE}

${PROJECT_ROOT_GUARD}

${REFERENCED_SPEC_UPDATES_GUIDANCE}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normal workflow safety gap: step 4 runs agent-led sync, and step 5 moves the folder with mv. It doesn't necessarily call openspec archive, where the new baseline guard lives. Don't claim that normal archive is protected on this basis. Establish how existing sync/archive instructions consume the relevant shared pre-write findings; test the generated skills with a stale adopted delta, including bulk archive. Coordinate with #1460/#2033/#2289 rather than adding a long independent set of merge rules. If a direct-edit path is advisory, say so explicitly.

* The owning side: the change was written in another repository and this root
* owns the spec it proposes to update. Only the sync workflow needs it.
*/
export const TAKE_UP_PROPOSED_UPDATE_GUIDANCE = `If the change is from another repository (a path, branch or pull request) and has files under \`spec-updates/\`, take up only the ones written for this repository: the first line of each names a spec path and a revision, and \`git cat-file -e <revision>\` succeeds only where that revision exists. For each one, run \`git diff <revision> HEAD -- <spec path>\` and tell the user what changed in the spec since the update was written, before you edit anything. Then either edit the spec directly on a branch, or, when the update needs decisions or tasks of its own here, create a change and copy the file to its \`specs/<capability-path>/spec.md\` with its first line kept. Say in the commit or pull request which change it came from (repository, change name, commit), and say what you left out or altered.`;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The owner-side guidance assumes git cat-file -e uniquely identifies the owner, which does not hold when roots share a Git repository or forks share history. Verify the intended document/root as well. Keep this guidance on demand where possible: owner review worked even with existing skills in the experiment, so establish whether a long always-loaded sync paragraph is necessary. Prefer relevant CLI instructions and optional references over more procedural text (#2341).

Comment thread src/core/references.ts
// A declared path names the root directly: another OpenSpec root in this
// repository, or a checkout beside it. It needs no registry entry and no
// store metadata, because the declaration itself says where the root is.
let canonicalRoot: string | undefined;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds a parallel path-reference resolver while #1992 explores the same capability. Can the proposal feature consume the existing reference-resolution result and ship for registered stores independently, with path support coming from the agreed resolver? Avoid competing configuration shapes. Test reference alias/target changes and same-repo roots before claiming source identity is safe (#1992, #1950, #2334).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant