openspec/work/simplify-context-and-workspace-model/slices/assemble-working-context/spec.md
From any root, one command produces the OpenSpec working context its
declarations describe: the resolved OpenSpec root plus referenced stores.
The result is consumable as an agent brief (JSON), human listing, or optional
.code-workspace file. Unresolvable references are reported, not guessed.
The earlier code-repo declaration/map experiment is removed. openspec context
does not infer implementation repos; users compose code folders explicitly with
personal worksets.
{
"root": { "path": "/abs/root", "source": "store|declared|nearest", "store_id": "...", "role": "openspec_root" },
"members": [
{ "role": "referenced_store", "id": "upstream-context", "path": "/abs/store", "fetch": "openspec show <spec-id> --type spec --store upstream-context", "status": [] },
{ "role": "referenced_store", "id": "design-system", "status": [{ "code": "reference_unresolved" }] }
],
"status": []
}
Available members have path and empty status. Unavailable members are kept
in the brief with their diagnostics and fixes. The top-level status carries
cross-cutting degradation such as an unreadable registry.
$ openspec context
Working context for team-context (/Users/dev/src/team-context)
OpenSpec root
team-context /Users/dev/src/team-context
Referenced stores
upstream-context /Users/dev/openspec/upstream-context
Fetch: openspec show <spec-id> --type spec --store upstream-context
Not available on this machine
- design-system: not registered
Fix: git clone -- https://github.com/acme/design-system.git /Users/dev/openspec/design-system && openspec store register '/Users/dev/openspec/design-system' --id design-system
.code-workspace Emission--code-workspace <path> writes {folders: [{name, path}...]} with the root
first, then available referenced stores named ref:<id>. Existing files refuse
without --force; missing parent directories fail; JSON mode keeps stdout as a
single brief and sends write confirmation to stderr.
In scope:
src/core/working-set.ts: pure working-set assembly and workspace JSON
builder.src/commands/context.ts and src/commands/shared-gather.ts: root
relationship data gather, human/JSON output, code-workspace write handling.Out of scope:
.code-workspace; terminal session launchers.openspec context runs in human and JSON modesmembers: [], and human output says
the working set is this root aloneopenspec context --code-workspace out.code-workspace runs--force, and no other files or registry state change