Repository navigation
Conversation
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/.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
…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/.
…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.
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.
Assessment after the third iterationI 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 shippingThe remaining work should be focused:
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. |
Mock release announcement: Introducing cross-repository spec updates
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 repositoriesImagine 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
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 it1. Reference your shared specs In your project's references:
- team-specsAlready using references? There's nothing else to configure. 2. Work as you normally would Ask your agent:
Your agent can now propose updates to both your project's own specs and the shared specs within the same change.
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:
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 parallelSeveral 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"]
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 independentlyYou 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 listOpenSpec 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-ssoOpenSpec 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?
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. UpgradingAfter upgrading the CLI, refresh your agent skills: openspec updateUsing 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-specsInitialize 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 resolveBefore publishing, we should make sure the actual experience supports what we're promising:
The feature should be an extension of changes and references, not Stores 2.0 or a new product abstraction. |
Release positioning and what to settle before shippingI 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
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. |
Implementation review: make the code as simple as the product modelI reviewed the production diff at 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. PrioritiesResolve before shipping:
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 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
left a comment
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
| @@ -505,6 +506,7 @@ program | |||
| json: options?.json, | |||
| archived: options?.archived, | |||
| all: options?.all, | |||
| ...(mode === 'changes' ? { openProposals: await findOpenProposals(root) } : {}), | |||
There was a problem hiding this comment.
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[] { |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
| if (owners.length === 0 && updates.length === 0) return report; | ||
|
|
||
| const issues: ValidationIssue[] = []; | ||
| const owning = await resolveOwningRoots(root, owners); |
There was a problem hiding this comment.
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} | |||
There was a problem hiding this comment.
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.`; |
There was a problem hiding this comment.
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).
| // 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; |
There was a problem hiding this comment.
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).
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: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.
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 itopenspec listshows what is still open, including updates in archived changes.How this differs from stores and references
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
specs/. Released CLI 1.13.2 ignores the folder.spec-updates/.openspec listworks it out from the files on every run.openspec archivewon't overwrite a requirement that changed after a delta's recorded revision.main.What it leaves to Git, your review tool and people
What changed from the previous version of this PR
specs/@<name>/spec-updates/<name>/mainspecs/means anything new.archiveopenspec listEvidence
The agent fixture replays two real pull requests that changed the same requirement of OpenSpec's
ai-tool-pathsspec within a day (#1672 and #1738). Applied as written, the second deletes what the first added.Is it ready?
To commit to the direction: yes. Two calls are the maintainer's:
To ship: not yet.
openspec listnot timed on very large archives.Read more
Checks
pnpm build,pnpm lintandtsc --noEmitpass. 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