Cloud project collaboration architecture
The current V4 UI source of truth is
/Users/hongyu9/Downloads/wework-delivery-v4-TODO.pen. Implement the interaction from that design instead of deriving page layout from this document.
Goalβ
A cloud project is the shared collaboration and storage boundary for a team. Members may select the same cloud project as the default destination of their own local projects, execute work in Wework, and submit selected conversations, files, and Markdown as immutable delivery snapshots.
A cloud project is not the existing Project model:
Projectis a user-owned local execution workspace containing device, path, Git, and runtime configuration.CloudProjectis a shared aggregate containing membership, TODOs, shared files, and a MinIO namespace.- Local projects owned by different members may independently select the same cloud project; the cloud project stores no reverse link.
- One TODO may link to many Wework Tasks, while one Task may process at most one active TODO at a time.
Domain relationshipsβ
CloudProject
βββ ResourceMember(resource_type=CloudProject)
βββ ShareLink(resource_type=CloudProject)
βββ LoopItem
βββ LoopItemTaskBinding
β βββ TaskResource
β βββ Project (local execution workspace)
βββ Delivery
βββ DeliveryAsset
Data ownershipβ
| Data | Source of truth |
|---|---|
| Cloud projects, members, TODOs, task links, delivery metadata | Backend MySQL |
| Local paths, devices, Git, execution configuration, and default project-space reference | Device-local Codex project state |
| Shared files, Markdown, conversations, and delivery snapshots | MinIO/S3 |
| AI access to cloud data | MCP authorized by the Backend |
Objects are isolated by the cloud project's public ID:
projects/{cloud-project-public-id}/
shared/
loop-items/{loop-item-id}/
deliveries/{delivery-id}/
markdown.md
chat.json
manifest.json
files/
Finalized delivery prefixes are immutable. Later tasks may only read or copy them.
Data modelβ
CloudProjectβ
cloud_projects stores the shared project and never stores local runtime configuration.
id, public_id, project_key, name, description
created_by_user_id, storage_prefix, next_item_number
status, version, created_at, updated_at
Local-project default spaceβ
A local Codex project may store one { projectStore, projectId } default project-space reference. The reference belongs to device-local project state, never enters the Backend, and creates no reverse index on the project space. A new conversation may override or clear the default before its first message is sent.
LoopItemβ
The existing loop_items table stores cloud TODOs. cloud_project_id references cloud_projects, and sequence_number produces display identifiers such as WEG-18.
The initial fixed workflow is:
inbox β pending β in_progress β in_review β completed
Completed TODOs may be reopened into in_progress. Updates carry a version value and use optimistic locking.
LoopItemTaskBindingβ
loop_item_task_bindings stores the historical many-to-many relationship between a TODO and concrete Wework Tasks. A runtime Task is identified by task_user_id + device_id + task_id, because a locally executed Task may not exist in the Backend tasks table; backend_task_id is only an optional index. Unlinking sets unlinked_at so execution provenance remains auditable.
Deliveryβ
deliveries and delivery_assets store immutable snapshot metadata. The nullable Delivery.source_task_binding_id points to a verified TODO/Task binding for local delivery and is null when a TODO is completed directly in the cloud UI.
Authorizationβ
Reuse resource_members and share_links with a new CloudProject resource type.
| Role | Read | Edit TODOs/files | Manage members | Archive project |
|---|---|---|---|---|
| Reporter | Yes | No | No | No |
| Developer | Yes | Yes | No | No |
| Maintainer | Yes | Yes | Yes | No |
| Owner | Yes | Yes | Yes | Yes |
Every TODO, delivery, file, and MCP request resolves the caller's cloud-project role first. Inaccessible resources return 404 to avoid disclosing their existence.
Service boundariesβ
cloud_projects/ projects and members
loop_items/ TODOs, state transitions, and Task bindings
delivery/ immutable delivery snapshots
cloud_files/ mutable shared files
mcp_server/tools/delivery.py authorized AI access to cloud references
Delivery services do not own TODO CRUD. LoopItem services do not access MinIO directly. MCP never holds or returns S3 credentials.
Delivery transactionβ
- Create a draft Delivery and write its Markdown and optional conversation object.
- Upload assets in bounded chunks and record size and SHA-256 metadata.
finalizelocks the Delivery and LoopItem and validates that the source Task is still linked to the TODO.- Write
manifest.json. - In one database transaction, mark the Delivery delivered, complete the TODO, and update
current_delivery_id. - If the database commit fails, remove the new manifest while keeping the draft retryable.
APIβ
/v1/cloud-projects
/v1/cloud-projects/{id}/members
/v1/cloud-projects/{id}/members/{user_id}
/v1/cloud-projects/{id}/files
/v1/cloud-projects/{id}/folders
/v1/cloud-projects/files/{file_id}
/v1/cloud-projects/{id}/loop-items
/v1/loop-items/{id}
/v1/loop-items/{id}/tasks
/v1/loop-items/{id}/start-task
/v1/loop-items/{id}/deliveries
/v1/deliveries/{id}
/v1/cloud-work-items/my-work
/v1/runtime-tasks/loop-item
Creation and updates use separate endpoints rather than PUT upsert. Shared files support folder creation, upload, rename/move, short-lived access, and recursive deletion. A move copies MinIO objects first, commits metadata, and only then removes the old objects; failed moves clean up newly copied objects.
When Wework adds a new runtime task to a cloud project space, it composes the existing primitives: create a LoopItem, then bind the runtime task; when execution status changes, read the task context and update the linked TODO. The Backend intentionally has no aggregate tracking endpoint dedicated to that orchestration. This allows the desktop app and Backend to be released independently while the stable TODO-creation, task-binding, and optimistic-locking APIs preserve the same behavior. The desktop app deduplicates concurrent association requests for the same runtime task and reuses a created TODO after a temporary binding failure to avoid duplicate cards.
The Wework Composer encodes cloud projects, directories, files, TODOs, and deliveries as atomic cloud:// references. Tasks carrying cloud-project context receive the Delivery MCP, and resolve_cloud_reference authorizes and resolves every reference in Backend so neither clients nor AI receive S3 credentials. The TODO board refreshes periodically while visible, while writes continue to use version optimistic locking for concurrent collaborators.
Delivery sequenceβ
- Add CloudProject, membership authorization, and local-project bindings.
- Move LoopItem ownership to CloudProject and add the state machine and optimistic locking.
- Add Task bindings and start-a-task-from-TODO.
- Migrate delivery authorization, source Task references, and MinIO paths.
- Add shared files and the cloud workspace MCP.