Skip to content

Commit 7238572

Browse files
authored
docs: define project scoping requirements and tasks (#5700)
1 parent efe3c5f commit 7238572

2 files changed

Lines changed: 353 additions & 0 deletions

File tree

docs/project-scoping/prd.md

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# Project scoping PRD
2+
3+
Status: agreed product scope, implementation pending.
4+
5+
Companion: [Implementation tasks](tasks.md).
6+
7+
## Problem
8+
9+
A creator working on multiple deliverables needs to know which work belongs
10+
together and resume each deliverable without rebuilding their working context.
11+
NodeTool groups project documents, but its shared tab list and inconsistently
12+
scoped resource surfaces allow unrelated work to appear together. A project
13+
selector must control resource ownership and execution context as well as
14+
navigation.
15+
16+
## Product outcome
17+
18+
One project represents one deliverable, such as a film, campaign, or app.
19+
Selecting it brings back its working session and makes its resources the
20+
default context for browsing, creation, and agent work. Personal provides the
21+
same capabilities for experiments and work without a named deliverable.
22+
23+
## Agreed decisions
24+
25+
The decision IDs preserve the product discussion's references.
26+
27+
| ID | Decision | Required behavior |
28+
| --- | --- | --- |
29+
| D1 | Project selection | A persistent selector sits above document tabs. It supports finding, switching, creating, and managing projects. Lists, search, pickers, and mentions use the selected project. |
30+
| D2 | Project session | Each project remembers its open tabs, order, active document, and selected chat. Switching preserves drafts. First opening shows the overview. Closing every tab leaves the project selected. |
31+
| D3 | Resource ownership | Documents, workflows, assets, entities, project files, chats, and generated outputs belong to a project. |
32+
| D4 | Creation and execution | New work inherits its originating project. Running generations and agents continue there after a switch. The selector shows background activity. |
33+
| D5 | Global resources | Account settings, credentials, installed models, and reusable templates remain global. Creating from a template produces project-owned work. |
34+
| D6 | Personal and migration | Personal is permanent and a project is always selected. A one-time migration assigns only unassigned resources to Personal. Existing project assignments remain intact. |
35+
| D7 | Project meaning | A named project represents one deliverable. Nested projects and client hierarchies are outside this release. |
36+
| D8 | Independent reuse | Copying into another project creates independent copies and includes referenced assets and entities. Edits never propagate between projects. |
37+
| D9 | Multiple conversations | Each project supports multiple chat threads. New threads receive project context and can work with its resources. |
38+
| D10 | Lifecycle | Finished projects can be archived. Deleting a project deletes its contents after confirmation. Personal cannot be deleted. |
39+
40+
## Experience
41+
42+
```text
43+
[ Project name v ] [ Account ]
44+
-----------------------------------------------------------
45+
Project navigation | This project's open document tabs
46+
| Active document
47+
| Project chat / inspector
48+
```
49+
50+
### Switching and resuming
51+
52+
The project name remains visible above the working area. Switching restores
53+
the destination's session rather than opening every document it owns. Returning
54+
to a project restores its drafts and focus. Reopening the application restores
55+
the selected project and its saved session, with Personal as the fallback.
56+
Tabs from other projects do not appear in the selected project's tab bar.
57+
58+
Opening a link to a document in another project switches to its owning project
59+
before displaying it. A failed or superseded switch must not leave the header,
60+
tabs, and resource panels showing different projects.
61+
62+
### Creating and finding work
63+
64+
Creating documents, importing files, uploading media, generating outputs, and
65+
starting chats use the originating project's identity. Asset browsing, entity
66+
selection, mentions, resource search, and agent resource tools use that same
67+
scope. Scope must be enforced through resource operations, not just hidden
68+
rows in the interface or instructions in an agent prompt.
69+
70+
Each supported resource type needs an explicit ownership path, including
71+
resource types missing from the existing project overview. Project files must
72+
use the workspace interface on both local and cloud storage.
73+
74+
### Background work and conversations
75+
76+
Switching projects does not cancel work. An upload, generation, or agent turn
77+
started in A continues to read and write A even while B is selected. Activity
78+
indicators identify the owning project and provide a route back to its work.
79+
80+
Projects have multiple independent conversation histories. Project context
81+
does not mean inserting another thread's full conversation into a new thread.
82+
Selecting a thread cannot silently redirect its resource operations to the
83+
project most recently selected elsewhere.
84+
85+
### Copying between projects
86+
87+
An explicit copy action selects a destination project. The copy includes the
88+
referenced assets and entities needed to use the document independently.
89+
References in the copied content point to the destination copies. Multiple
90+
references to the same dependency within one copy operation reuse its copied
91+
identity. Source resources remain unchanged.
92+
93+
The destination must remain usable after the source project is deleted.
94+
Missing dependencies or a failed copy must produce a clear failure rather
95+
than report a complete copy with broken references. Global prerequisites,
96+
such as installed models and credentials, remain global.
97+
98+
### Migration and lifecycle
99+
100+
On the first startup using this feature, create or resolve Personal for the
101+
resource owner and assign unassigned resources to it. Preserve IDs, content,
102+
references, and existing project assignments. Repeated startup or an
103+
interrupted migration must not duplicate Personal or move subsequently
104+
assigned resources. Existing tabs and conversation history remain reachable.
105+
106+
Archive retains project contents and supports restoring the project. Archived
107+
projects remain discoverable through project management without crowding the
108+
normal selector. Delete confirmation identifies the project and explains that
109+
its contents will be removed. Deletion must not remove another project's
110+
copies or permit background operations to recreate deleted contents.
111+
112+
## Release acceptance criteria
113+
114+
| ID | Scenario | Pass condition |
115+
| --- | --- | --- |
116+
| AC1 | Switch A to B and back | A restores its tab order, active document, selected chat, and unsaved draft. Only A's tabs appear. |
117+
| AC2 | First open and close all tabs | A new project opens its overview. Closing all tabs leaves its project context active. |
118+
| AC3 | Browse and select resources | Lists, search, pickers, mentions, and agent queries return the selected project's resources plus explicitly global resource types. |
119+
| AC4 | Create through different entry points | UI, API, and agent creation assign the intended project consistently. Invalid project ownership is rejected. |
120+
| AC5 | Switch during work | A generation and agent turn started in A finish in A after switching to B. An upload started in B belongs to B. Activity links return to the correct project. |
121+
| AC6 | Multiple chats | A can create and reopen multiple threads. Switching to B shows B's threads and uses B's resources. Returning to A restores its selected thread. |
122+
| AC7 | Copy with dependencies | Copy a document with repeated asset and entity references into B, edit the copies, and delete A. B still works and its internal references resolve. |
123+
| AC8 | Migrate existing content | Assigned resources keep their projects. Unassigned resources enter Personal without losing content or references. Rerunning migration produces no additional changes. |
124+
| AC9 | Archive and delete | Archive preserves contents and can be reversed. Confirmed deletion removes the project's contents without affecting independent copies. Personal cannot be deleted. |
125+
| AC10 | Interrupted navigation and restart | Rapid switches, failed loads, direct document links, and application restart keep the selector, session, and resource scope consistent. |
126+
| AC11 | Complete coverage | A resource and entry-point inventory has no unhandled project-owned type or unscoped creation path. Local and cloud workspace behavior follow the same ownership rules. |
127+
128+
## Scope boundaries
129+
130+
| ID | Outside this release |
131+
| --- | --- |
132+
| N1 | Team membership, project sharing permissions, and collaboration roles. |
133+
| N2 | Nested projects, client hierarchies, and synchronized shared asset or entity libraries. |
134+
| N3 | A redesign of individual document editors or migration of global credentials and model installations into projects. |
135+
136+
## Implementation questions
137+
138+
These details need resolution during the tasks below. They do not change the
139+
agreed ownership model.
140+
141+
| ID | Question | Resolve in |
142+
| --- | --- | --- |
143+
| Q10 | How should legacy references spanning assigned projects be preserved without breaking documents or introducing new shared ownership? | T1, T2 |
144+
| Q11 | Which linked document dependencies must also be copied, and how should unsupported external dependencies be reported? | T1, T8 |
145+
| Q12 | Should deletion wait for running work or explicitly cancel it, and how are retries prevented from writing afterward? | T9 |
146+
| Q13 | What existing move actions remain valid when moving a resource could break another document's references? | T1, T8 |
147+
148+
## Starting points in the codebase
149+
150+
These findings came from source inspection, not a live visual walkthrough.
151+
152+
| ID | Finding | Source |
153+
| --- | --- | --- |
154+
| F1 | Project opening adds all project documents to a shared tab list and selects the overview. | [WorkspaceTabsStore](../../web/src/stores/WorkspaceTabsStore.ts), [useProjects](../../web/src/hooks/useProjects.ts) |
155+
| F2 | The entity library query searches assets without a project filter, while the overview has a project-specific entity section. | [useEntities](../../web/src/serverState/useEntities.ts), [ProjectEntitiesSection](../../web/src/components/projects/ProjectEntitiesSection.tsx) |
156+
| F3 | Assets carry a project field, but the inspected upload payload does not carry project context. | [AssetStore](../../web/src/stores/AssetStore.ts), [asset schema](../../packages/models/src/schema/assets.ts) |
157+
| F4 | The project document summary union omits workflows, and project metadata has one agent-thread pointer. | [project-summary](../../packages/models/src/project-summary.ts), [project schema](../../packages/models/src/schema/projects.ts) |

docs/project-scoping/tasks.md

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
# Project scoping tasks
2+
3+
Companion: [PRD](prd.md). All tasks are pending. Task IDs identify dependencies,
4+
not separate agent assignments.
5+
6+
## Delivery order
7+
8+
| Phase | Tasks | Outcome |
9+
| --- | --- | --- |
10+
| A1 | T1–T3 | Complete ownership, Personal migration, and operations bound to their originating project. |
11+
| A2 | T4–T7 | Project selection, isolated sessions, scoped resource surfaces, and multiple chats. |
12+
| A3 | T8–T10 | Independent copying, archive and deletion, and release verification. |
13+
14+
## T1 — Inventory ownership and resource entry points
15+
16+
- [ ] Enumerate document types, workflows, assets and folders, entities,
17+
workspace files, threads, runs, and outputs. Record storage, ownership,
18+
references, creation paths, list/search paths, and deletion behavior.
19+
- [ ] Cover web, Electron renderer, API, agent tools, background jobs, and
20+
existing mobile consumers of affected contracts.
21+
- [ ] Classify each resource as project-owned or explicitly global using D3
22+
and D5. Identify gaps beyond the existing project summary union.
23+
- [ ] Resolve legacy cross-project references and dependency-copy coverage
24+
(Q10, Q11), and identify existing move behavior needing constraints (Q13).
25+
26+
Depends on: none.
27+
28+
Acceptance: a concrete file and entry-point inventory supports AC11. Every
29+
project-owned type has a planned owner, migration path, and resource boundary.
30+
31+
## T2 — Complete project ownership and Personal migration
32+
33+
- [ ] Add missing ownership fields and protocol contracts for the T1 inventory.
34+
Keep backend schemas and supported database variants consistent.
35+
- [ ] Create or resolve one permanent Personal space per resource owner.
36+
- [ ] Implement an idempotent, restartable migration of unassigned resources.
37+
Preserve existing assignments, IDs, content, and references.
38+
- [ ] Preserve access to existing tabs and threads after migration. Handle
39+
malformed or dangling legacy membership explicitly without silently
40+
moving valid assigned resources.
41+
- [ ] Add scoped model operations and project ownership validation. Preserve
42+
compatibility of existing resource operations during rollout.
43+
44+
Depends on: T1.
45+
46+
Acceptance: AC8 and ownership portions of AC4/AC11. Verify empty accounts,
47+
mixed assigned/unassigned content, repeat startup, and interrupted migration.
48+
49+
## T3 — Bind creation and execution to the originating project
50+
51+
- [ ] Carry project identity through document creation, imports, uploads,
52+
generation requests, runs, and agent sessions.
53+
- [ ] Capture scope when work starts. Persist enough context for delayed
54+
completions and retries to use the original project.
55+
- [ ] Scope agent resource operations through backend contracts rather than
56+
relying on prompts or the foreground tab.
57+
- [ ] Apply project file ownership through the workspace interface on local
58+
and virtual storage. Keep global prerequisites outside project storage.
59+
- [ ] Expose project-attributed activity for the selector and navigation back
60+
to running work.
61+
62+
Depends on: T2.
63+
64+
Acceptance: AC4, AC5, and AC11. Start work in A, switch to B before completion,
65+
and verify writes and resource reads still belong to A.
66+
67+
## T4 — Persist separate project sessions
68+
69+
- [ ] Store each project's open tabs, order, active document, and selected
70+
chat independently from its full resource list.
71+
- [ ] Switch sessions without discarding drafts or reopening every document.
72+
- [ ] Define first-open overview, empty-tab state, restart restoration, and
73+
Personal fallback.
74+
- [ ] Reconcile deleted or unavailable documents without changing another
75+
project's saved session. Migrate existing persisted tab state.
76+
- [ ] Make rapid switches and failed loads leave one consistent active scope.
77+
78+
Depends on: T2.
79+
80+
Acceptance: AC1, AC2, and session portions of AC10. Verify switching with dirty
81+
editors and restart with multiple saved project sessions.
82+
83+
## T5 — Put project selection above the tabs
84+
85+
- [ ] Replace the tab-group scope control with a persistent top-level selector.
86+
Add project search, creation, management access, and Personal.
87+
- [ ] Render only the selected project's tabs and project navigation.
88+
- [ ] Show activity from T3 and link it to the owning project's work.
89+
- [ ] Resolve direct document links to their owning project before opening.
90+
- [ ] Cover loading, failure, empty project, keyboard navigation, narrow
91+
layouts, and Electron window controls using existing UI primitives.
92+
93+
Depends on: T3, T4.
94+
95+
Acceptance: D1, AC2, AC5, and AC10. Project identity remains visible and agrees
96+
with the tabs and content during every navigation transition.
97+
98+
## T6 — Scope resource browsing and selection
99+
100+
- [ ] Apply project scope to every T1 list, search, folder browser, asset
101+
picker, entity picker, mention source, and project overview resource type.
102+
- [ ] Include project identity in query/cache and selection state where
103+
required. Clear or restore panel state when switching projects.
104+
- [ ] Keep explicitly global resources available with clear scope.
105+
- [ ] Ensure entity membership and its backing/reference assets follow the
106+
agreed ownership and migration rules.
107+
108+
Depends on: T2, T3, T5.
109+
110+
Acceptance: AC3 and AC11. Fixtures with identically named resources in A and B
111+
prove that browsing, selection, and mentions resolve the intended resource.
112+
113+
## T7 — Support multiple chat threads per project
114+
115+
- [ ] Replace the single-thread assumption with project-owned thread listing,
116+
creation, selection, and history loading.
117+
- [ ] Preserve existing project conversations through migration.
118+
- [ ] Supply project context to new threads without merging thread histories.
119+
- [ ] Restore the selected chat through T4 and retain the thread's project
120+
identity through background agent turns.
121+
122+
Depends on: T3, T4, T5.
123+
124+
Acceptance: AC6 and chat portions of AC1/AC5. Two threads in A and one in B
125+
retain their histories, selected state, and correct resource access.
126+
127+
## T8 — Copy documents with independent dependencies
128+
129+
- [ ] Implement destination selection and dependency discovery from the T1
130+
reference inventory. Resolve Q11 and Q13 before finalizing behavior.
131+
- [ ] Copy required assets and entities, assign destination ownership, and
132+
remap references. Handle repeated references and cycles without
133+
duplicating the same dependency within one operation.
134+
- [ ] Preserve independent lifetimes even if immutable storage bytes are
135+
internally deduplicated. Source deletion must not remove copied media.
136+
- [ ] Define failure and retry behavior so incomplete copies are not presented
137+
as successful. Report unavailable or unsupported dependencies clearly.
138+
- [ ] Verify dependency traversal on a large resource graph.
139+
140+
Depends on: T3, T6.
141+
142+
Acceptance: AC7. Edit destination copies and delete the source project, then
143+
open and use the destination document with its assets and entities intact.
144+
145+
## T9 — Archive and delete projects
146+
147+
- [ ] Add archive and restore actions plus archived-project discovery.
148+
- [ ] Add confirmation naming the project and explaining content deletion.
149+
- [ ] Replace the existing return-to-unassigned deletion behavior with the
150+
agreed content deletion behavior for the complete T1 inventory.
151+
- [ ] Protect Personal from deletion through both UI and backend operations.
152+
- [ ] Resolve Q12 and prevent active jobs, delayed responses, and retries from
153+
writing into a deleted project.
154+
- [ ] Reconcile selected project, sessions, and caches after deletion. Preserve
155+
independent copies and global resources.
156+
157+
Depends on: T5, T7, T8.
158+
159+
Acceptance: AC9 and deletion portion of AC7. Include deletion with active work,
160+
repeated deletion requests, and attempts to delete Personal.
161+
162+
## T10 — Verify the complete project experience
163+
164+
- [ ] Map every PRD acceptance criterion to a deterministic check or an
165+
explicit UI walkthrough. Extend the existing relevant verification
166+
surfaces and registry where needed.
167+
- [ ] Run the A/B scenario: restore A's tabs and chat, start work in A, switch
168+
to B and upload, return to A, and verify session and output ownership.
169+
- [ ] Verify migration, dependency copying followed by source deletion,
170+
archive/restore, direct links, rapid switching, and failed requests.
171+
- [ ] Check the final resource inventory for omitted types and entry points.
172+
- [ ] Perform web and Electron UI checks, including keyboard operation and
173+
narrow layouts. Verify affected mobile contracts retain ownership
174+
behavior without expanding this into a mobile navigation redesign.
175+
176+
Depends on: T6, T7, T8, T9.
177+
178+
Acceptance: AC1–AC11 have recorded evidence. Unresolved implementation
179+
questions are closed or explicitly returned for product decision before release.
180+
181+
## Verification for implementation changes
182+
183+
After each code change, run the repository's required checks:
184+
185+
```bash
186+
npm run test:affected
187+
npm run typecheck
188+
npm run lint
189+
npm run dev:nodetool -- harness gate --base origin/main
190+
```
191+
192+
Use meaningful regression fixtures for the boundaries each task changes.
193+
Prove any new validator can fail with a deliberately invalid fixture, and
194+
verify inventories contain actual entries. Follow the repository's additional
195+
requirements when a change crosses a dependency seam its affected-test
196+
selection cannot detect.

0 commit comments

Comments
 (0)