openspec/initiatives/context-store-and-initiatives/work-items/10-let-workspaces-open-initiatives/plan.md
Product decisions are locked. The remaining work is implementation design and delivery.
Start from ../../direction.md and the boundary:
Context stores sync truth.
Collections shape truth.
Initiatives coordinate work.
Workspaces open local views.
Changes implement repo-owned slices.
Item 9 rejected standalone initiative resolution. Initiative discovery belongs
to initiative show; local path mapping belongs to workspace local-view state.
A workspace does not contain the work. It remembers how this runtime opens the work.
private local view record
-> generated runtime files
-> opener-specific launch
-> initiative context + selected local repos/folders
The durable part is the user's private local view choice. The generated part is runtime support for agents and editors.
Let a user open a shared initiative in their own local runtime with the context and repos they care about.
Examples:
platform/billing-launch with local Repo A and Repo
B.changes/ the durable planning model.Status: decided.
Use workspace open for initiative local-view realization:
openspec workspace open --initiative platform/billing-launch
openspec workspace open --initiative billing-launch --store platform
openspec workspace open --initiative billing-launch
openspec workspace open team-a-billing --initiative platform/billing-launch
Rationale: the action being performed is local view realization, so the command
belongs under workspace open rather than initiative open.
Lookup behavior:
<store>/<initiative>, use that exact store selector.<initiative> --store <store>, use that exact store
selector.<initiative>, search registered context stores and
proceed when there is exactly one exact match.<store>/<initiative> or --store.openspec initiative list.Interactive UX may let a human choose from suggestions. JSON and non-interactive UX should return structured errors and suggestions without prompting.
Workspace-name behavior:
--initiative, create or reuse that
named local view.Status: decided.
Default to opening the initiative directory, not the whole context store.
User-facing behavior:
openspec workspace open --initiative billing-launch
opens a focused local view:
generated files in the workspace root
context-store/initiatives/billing-launch/
selected local repos/folders
It should not open the entire context store by default.
Rationale:
Generated guidance and JSON output should still report the context store root
and that broader context exists. A later explicit option may open the full
context store, for example --context-scope store or --include-store, but
broad store scope is not the default for Item 10.
Status: decided.
Use one private local view record: the root workspace.yaml file.
version: 1
name: billing-launch
context:
kind: initiative
store:
id: platform
selector:
kind: registry
id: platform
initiative:
id: billing-launch
links:
repo-a: /Users/me/repos/repo-a
repo-b: /Users/me/repos/repo-b
preferred_opener: codex
tools:
- codex
This decision covers the conceptual record shape and the fact that generated runtime files are not durable state.
If the user selected a context store by local path, the private workspace record can keep that runtime-local selector without changing checked-in repo metadata:
context:
kind: initiative
store:
id: platform
selector:
kind: path
path: /Users/me/context/platform
observed_id: platform
initiative:
id: billing-launch
The context binding is optional. A user can also create a workspace that is not linked to any initiative:
version: 1
name: team-a-local
context: null
links:
repo-a: /Users/me/repos/repo-a
repo-b: /Users/me/repos/repo-b
preferred_opener: codex
tools:
- codex
This is a first-class workspace shape, not only an edge case for initiative opening. Item 10 should preserve custom non-initiative workspaces while adding initiative-aware opening.
Status: decided.
Store each private workspace view under the user's OpenSpec global data directory, keyed by workspace name:
getGlobalDataDir()/workspaces/<workspace-name>/
The workspace name is the local identity. The selected store and initiative, if any, are data inside the private record; they do not define the storage path. This keeps the workspace API generic enough for custom local views that are not initiative-linked.
Initial shape:
getGlobalDataDir()/workspaces/<workspace-name>/
workspace.yaml
AGENTS.md
<workspace-name>.code-workspace
.codex/
skills/
.claude/
skills/
workspace.yaml is the durable private view record and the only view file in
Item 10. The other files are generated runtime support owned by OpenSpec. They
may be overwritten by workspace open, workspace update, or a future explicit
preparation surface.
Do not add a separate generated-output directory for Item 10. The managed workspace root is already the private generated view.
Initiative open defaults:
Status: decided.
Generate runtime files at the workspace root, next to workspace.yaml.
getGlobalDataDir()/workspaces/<workspace-name>/
The generated files can contain AGENTS.md, skills, launch prompts, and
generated editor workspace files.
Regeneration behavior:
workspace open regenerates the managed runtime files before launching the
opener.workspace update regenerates the managed runtime files without changing
durable local view choices unless the user asked for a state change.workspace.yaml is not generated output and should not be overwritten except
when the local view record itself changes.Status: decided.
Use getGlobalDataDir() as the runtime-local boundary. It is already
cross-platform and resolves to the appropriate user data directory for macOS,
Linux, Windows, Codespaces, WSL, SSH hosts, and containers.
Local paths in workspace.yaml are valid only in the runtime that wrote them.
If the same user opens the same initiative from another runtime, they create or
relink that runtime's workspace there. Item 10 should not add path translation,
shared machine identities, or an extra <runtime-id> path segment.
Status: decided.
Keep workspace open --json as a machine-facing receipt for the same open
operation. Do not add --prepare-only for Item 10.
The JSON response should be useful to agents and desktop integrations, not just a success boolean. It should include the workspace name, workspace root, generated file paths, selected context, opened roots, skipped or missing roots, opener, launch status, and warnings.
Human-facing behavior remains the normal workspace open output. JSON mode is
for tools that need structured facts after OpenSpec has prepared the workspace
root and attempted the requested open.
Status: decided.
Workspace opening should be strict about the selected initiative/context and forgiving about optional linked local paths.
workspace doctor or
relink guidance.Status: decided.
Open the generated workspace root as the Codex Desktop project. Surface the
attached initiative path and linked repo/folder paths through generated guidance
and the workspace open --json response.
Do not depend on Desktop multi-root automation for Item 10. If Desktop later has a clearer multi-root contract, it can become an enhancement without changing the workspace storage model.
Status: decided.
Item 10 emits advisory boundaries only. Generated context should distinguish coordination context from implementation targets, but it should not enforce write restrictions.
The generated view should label initiative/context-store files as shared coordination context and linked repos/folders as local implementation context when selected. Strong enforcement can come later.
Status: deferred beyond the first implementation slice.
This sketch captures the eventual human interactive flow. Item 10 should not depend on building a full guided setup wizard; the first implementation may use explicit flags and structured errors first.
Found initiative: platform/billing-launch
No local workspace view exists for this runtime.
Create a local view?
> Open context only
Link existing local repos/folders
Cancel
No option in this first-run flow should clone, branch, create worktrees, or create submodules.
workspace open --json is the machine-readable contract for the generated
runtime context. Item 10 should not create a separate machine-readable view
file; the durable view record is workspace.yaml.
The JSON response should tell agents:
workspace open --jsonIf no implementation target is selected, allowedEditRoots should be empty or
explicitly advisory.
The exact schema can evolve during implementation, but the JSON response should make the generated view self-describing enough for agents and desktop integrations without scraping human output.
The initial context record supports the selected context store and initiative.
Do not design the YAML parser so narrowly that future records cannot add fields
for configurable change homes, artifact homes, target bindings, or other
collection/view metadata.
The current beta workspace implementation creates a managed root with
changes/, AGENTS.md, .gitignore,
.openspec-workspace/workspace.yaml, .openspec-workspace/local.yaml, and a
durable .code-workspace file.
Item 10's intended new shape is a root workspace.yaml plus generated runtime
files at the managed workspace root. Existing beta workspaces should be treated
as compatibility inputs. Migration or removal of all beta internals is deferred
unless the implementation slice intentionally scopes that migration.
For the initiative-opening model, generated runtime files are derived artifacts, not workspace truth.