# North Star workspace archive format
This reference describes the importer/exporter in the precise-anchor preview. It is separate from the [canvas walkthrough](/docs/canvas). New anchor objects and routing require archive manifest version 2. Live revision 1920c41 accepts manifest versions 1 and 2. This enhanced branch-state preview also supports manifest 3; do not send a version-3 archive to the live editor before that editor change is released.
## Container and validation
A .northstar file is gzip-compressed USTAR. It contains regular files named manifest.json, workspace.json, and, if referenced, assets/<UUID>. It does not contain directories, arbitrary paths, symlinks or a ZIP container. UTF-8 JSON is used. The importer rejects unsafe/duplicate entries, invalid tar headers/checksums/endings, unsupported manifests, file count/size/hash mismatches, invalid workspaces, and missing, wrongly typed or unreferenced assets.
The compressed file and expanded tar each have a 96 MiB limit. workspace.json has a 10 MiB limit. The manifest does not list itself. Each other file must appear once with its byte length and lowercase SHA-256 digest. Gzip metadata does not define workspace identity.
{"format":"northstar","version":2,"workspace":"workspace.json","files":[{"path":"workspace.json","size":1234,"sha256":"<SHA-256 of the exact UTF-8 bytes>"}]}
The size and digest above are placeholders, not a valid downloadable archive. The complete example below contains real values. The current exporter emits manifest 1 when no new anchor objects/routing are present, and manifest 2 when they are. The current importer accepts versions 1, 2 and 3. Manifest 3 is selected whenever a record has a branchState; version 1/2 archives must not contain that field. New geometry in a manifest-1 file is rejected rather than silently downgraded.
## Workspace document versions
The container manifest version is distinct from workspace.json.version.
- Document version 1 is the legacy map representation. Positions are directly in canvas coordinates. Existing exports remain accepted.
- Document version 2 is the shared workspace map.
workspaceMap.versionis 1; project origins and instance owners make local card coordinates explicit. A document-v2 workspace must not contain the old top-level viewport. Cameras are personal preferences; canvasinitialViewportmay provide a starting view. Opening as a copy assigns a new storage workspace identity and remaps IDs consistently; a file is not authority to merge into an existing cloud workspace.
Both require records, edges, positions and collapsed. Stable record IDs and map-instance IDs are distinct: a position's recordId identifies the underlying record; legacy positions may omit it when the instance ID equals the record ID. Use map-instance IDs for editable parent–child branch endpoints. Other logical relations can reference supported record/external IDs. A record reference does not choose between multiple map instances or grant grouping capabilities. Runtime validation checks references and duplicate IDs in both document versions. Use unique IDs throughout. Do not use a title as identity.
## Minimal legacy JSON example
{"version":1,"records":[{"id":"idea","type":"note","title":"One idea","status":"planned","confidence":"confirmed"}],"edges":[],"positions":{"idea":{"x":0,"y":0,"displayMode":"title-only"}},"collapsed":{}}
This is workspace JSON, not the gzip/tar container. A complete externally authored archive is linked below.
## Cards, dimensions and coordinates
Coordinates use canvas units, equal to CSS pixels at zoom 1, with x increasing right and y increasing down. Positions identify card centers, not top-left corners. Width and height are independent of camera zoom. Optional width must be 38–640; optional height 44–1000. Omitted dimensions use content measurement. Display mode is full, content-only or title-only. Keep existing authored dimensions/positions when adding new work.
For a version-2 instance owned by a project, world center = its saved local position + workspaceMap.projects[owner].origin. A null owner uses world coordinates directly. instanceOwners must have exactly the position keys and contain a project record ID or null. Each project requires an origin and a reservation {left,right,top,bottom} enclosing its local cards. A project anchor instance, if present, references that project and stays at local (0,0). Reservations are layout data, not semantic membership.
canvases has version 1, defaultId and items. Each canvas has an ID, name, template (blank, projects or funding) and explicit recordIds. Every record belongs to exactly one canvas. A record's optional projectId names explicit group membership on the same canvas. Proximity does not create membership. Group membership and contains edges are independent and must not be substituted for one another.
When a new record has no map instance and exactly one explicit contains parent, the importer can materialize it with the editor’s predictable branch spacing. Existing specified positions stay in place. Missing canvas membership and project membership for that new unplaced branch inherit from its parent; provide them explicitly when the intended membership differs. Legacy documents may migrate to version 2 as part of this placement. Ambiguous parents, missing parents and cycles are reported. An already-positioned record is not duplicated. Records without such an explicit branch can remain in the record library without a visible map instance.
## Relationships and independent anchors
An edge requires id, sourceId, targetId and type. note is optional. contains is an explicit parent–child relation; depends_on represents an actual dependency. A generic related relation is accepted as a generic connection. Geometry never implies a dependency or changes the edge's direction.
Each endpoint independently accepts an omitted anchor, { "mode": "auto" }, a legacy normalized direction { "x": -1, "y": 0 }, or a pinned anchor:
{"id":"opening-link","sourceId":"workshop-card","targetId":"opening-card","type":"contains","sourceAnchor":{"mode":"pinned","side":"left","offset":0.75},"targetAnchor":{"mode":"pinned","side":"top","offset":0.3}}
Pinned side is top, right, bottom or left. offset is finite and inclusive 0–1. Top/bottom offsets run left to right; left/right run top to bottom. A pin is the exact bounding-edge point; near rounded corners it need not be the legacy rounded perimeter. At width 200, height 100, center (300,200), bottom offset .25 resolves to (250,250). A pin follows the card's center and measured dimensions.
Omitted/automatic anchors keep the established defaults: contains lines use the left sides; generic lines start at the source right and enter the target left. Legacy vectors use the renderer's rounded perimeter intersection, x/y in [-1,1], excluding (0,0). They are retained without inventing side pins during migration.
Changing A must update sourceAnchor only. Do not write B's field as a side effect, fill an omitted B, rewrite IDs/types, alter card positions, or remove routing. The same rule applies symmetrically to B.
## Automatic and manual routing
Absent routing uses the established curved route. Optional routing distinguishes exact manual bends from derived automatic waypoints:
{"mode":"manual","bends":[{"x":1650,"y":-300},{"x":1650,"y":-100}]}
Bends are finite world-coordinate points, in source-to-target order, at most 64. The renderer draws straight segments from A through the bends to B. They are not local to either card and are not relationship data. Editing an anchor preserves them; external authors must deliberately move manual bends if moving the whole arrangement should move its route.
Tidy-generated routing uses mode: "auto", bends and endpoints: {a:{x,y}, b:{x,y}} storing the resolved world endpoints at generation. Those waypoints apply only while both endpoints match; moving/resizing a card redraws the ordinary automatic curve instead of retaining a stale detour. Tidy operates on a selected explicit branch and skips manual routes. The old derived snapshot may remain stored until tidied again; it is not a manual bend.
## Records and assets
Supported record types are area, project, goal, task, opportunity, benefit, event, note; each needs string id, title, status, confidence. The schema and runtime validator define optional fields, NST details/documents, schedules and attachments. checkable is optional; groups/parents are not made checkable by the editor. Never add auth tokens or personal client/student data to an example.
Attachments reference UUID asset IDs, the owning workspace ID, version 1, name, MIME type and byte size. Every referenced asset must exist in the tar and pass integrity/type checks. A fresh-copy import remaps storage ownership. A plain JSON sample does not embed binary assets. Do not invent external asset URLs as a replacement for archive entries.
## External authoring and acceptance
- Start with valid workspace JSON and explicit IDs, memberships and coordinates. An external author need not automate the UI or use an in-app AI feature.
- Validate against the [v2 JSON schema](/docs/workspace.v2.schema.json). Runtime
validateAppDataadditionally checks graph/reference and layout invariants; schema validation alone is insufficient. - UTF-8 encode the exact JSON. Compute byte length and SHA-256, create the manifest, pack regular USTAR files and gzip the result.
- Open through Open an archive in the matching preview build as a fresh local copy. Confirm canvases, groups, placements and anchors before editing.
- Export and import again. Compare references/geometry using the copy's consistent ID remapping. Editing only A should preserve B, routing and all card placements.
[Complete fictional workspace JSON](/examples/community-workshop.json) · [Externally authored archive](/examples/community-workshop.northstar) · [Minimal JSON](/examples/minimal-workspace.json). These examples use the same Community workshop as the walkthrough. The fixture writer is separate from the app exporter. Validation failures leave the existing workspace intact; keep and fix the source file rather than silently dropping a corrupted layout.
### Visible endpoints and logical references
A record-only reference without a matching key in positions retains a logical relationship. It does not choose one of that record’s other card instances or draw an inferred line. To draw and edit a line, give sourceId and targetId explicit position keys. A position key can be the same string as its record ID in older workspaces. The complete example deliberately retains one record-only generic relationship alongside its visible parent–child lines.
## Branch work state (enhanced preview; manifest 3)
A record may carry branchState: "not_started" | "active" | "paused". Omitted means Not started; legacy status: "active" does not implicitly activate a branch. The field describes planning work, never campaign publication or funding. checkable and completed continue to mean task completion independently. Groups are project records; a branch root also has explicit outgoing contains edges. Set Active, Pause and Not started are available in its context menu, from the visible state badge on touch, and through the existing keyboard context-menu action. Only an explicit contains edge into an Active destination is emphasized. Generic links, siblings and positions are unchanged.
AppData versions remain 1/2; the archive container uses manifest 3 to prevent older importers silently accepting or dropping this new field. Existing manifest 1/2 archives still import without inventing active work. Export/reopen preserves work state, completion, pins, manual bends, membership and IDs. Raw enhanced JSON is not a compatibility path for an older editor.