doc/plans/workspace-product-model-and-work-product.md
Paperclip needs to support two very different but equally valid ways of working:
master, or in a folder that is not even a git repoToday, Paperclip already has the beginnings of this model:
projects can carry execution workspace policyproject_workspaces already exist as a durable project-scoped objectWhat is missing is a clear product model and UI that make these capabilities understandable and operable.
The main product risk is overloading one concept to do too much:
project lightweight enough to remain a planning container.A project remains the thing that groups work around a deliverable or initiative.
It may have:
Projects are not required to become heavyweight.
A project workspace is the durable codebase or root environment for a project.
Examples:
This is the stable anchor that operators configure once.
It should not be a top-level sidebar item in the main app. It should live under the project experience.
An execution workspace is where a specific run or issue actually executes.
Examples:
This object must be recorded explicitly so that Paperclip can:
A PR is an output of work, not the planning unit.
Paperclip should treat PRs as a type of work product linked back to:
Git-specific automation should live under workspace policy, not under the core issue abstraction.
Paperclip already has users and existing project/task data. Any new model must preserve continuity.
The product should default existing installs into a sensible compatibility mode:
project_workspaces become the durable project workspace objectsThis migration should feel additive, not like a mandatory re-onboarding flow.
Paperclip cannot assume that it is running on the same machine as the code.
In cloud deployments, Paperclip may:
The model therefore must be portable:
project workspace may be remote-managed, not localexecution workspace may have no local cwdruntime services may be tracked by provider reference and URL rather than a host processSubissues are for decomposition and parallel ownership.
They are not the same thing as:
They may correlate with those things, but they should not be overloaded to mean them.
Use these terms consistently in product copy:
Project: planning containerProject workspace: durable configured codebase/rootExecution workspace: actual runtime workspace used for issue executionIsolated issue workspace: user-facing term for an issue-specific derived workspaceWork product: previews, PRs, branches, commits, artifacts, docsRuntime service: a process or service Paperclip owns or tracks for a workspaceUse these terms consistently in migration and deployment messaging:
Compatible mode: existing behavior preserved without new workspace automationAdapter-managed workspace: workspace realized by a remote or cloud execution providerAvoid teaching users that "workspace" always means "git worktree on my machine".
Existing object. No fundamental change in role.
idcompanyIdnamedescriptionstatusgoalIdsleadAgentIdtargetDateexecutionWorkspacePolicyworkspaces[]primaryWorkspaceDurable, configured, project-scoped codebase/root object.
This should evolve from the current project_workspaces table into a more explicit product object.
This separates:
from:
That keeps the model simple for solo users while still supporting advanced automation. It also lets cloud-hosted Paperclip deployments point at codebases and remotes without pretending the Paperclip host has direct filesystem access.
idcompanyIdprojectIdnamesourceType
local_pathgit_reporemote_managednon_git_pathcwdrepoUrldefaultRefisPrimaryvisibility
defaultadvancedsetupCommandcleanupCommandmetadatacreatedAtupdatedAtsourceType=non_git_path is important so non-git projects are first-class.setupCommand and cleanupCommand should be allowed here for workspace-root bootstrap, even when isolated execution is not used.sourceType=remote_managed is important for cloud deployments where the durable codebase is defined by provider/repo metadata rather than a local checkout path.Project-level defaults for how issues execute.
This is the main operator-facing configuration surface.
This lets Paperclip support:
without forcing every issue or agent to expose low-level runtime configuration.
enabled: booleandefaultMode
shared_workspaceisolated_workspaceoperator_branchadapter_defaultallowIssueOverride: booleandefaultProjectWorkspaceId: uuid | nullworkspaceStrategy
type
project_primarygit_worktreeadapter_managedbaseRefbranchTemplateworktreeParentDirprovisionCommandteardownCommandbranchPolicy
namingTemplateallowReuseExistingpreferredOperatorBranchpullRequestPolicy
mode
disabledmanualagent_may_open_draftapproval_required_to_openapproval_required_to_mark_readybaseBranchtitleTemplatebodyTemplateruntimePolicy
allowWorkspaceServicesdefaultServicesProfileautoHarvestOwnedUrlscleanupPolicy
mode
manualwhen_issue_terminalwhen_pr_closedretention_windowretentionHourskeepWhilePreviewHealthykeepWhileOpenPrExistsIssue-level selection of execution behavior.
This should remain lightweight in the normal case and only surface richer controls when relevant.
Not every issue in a code project should create a new derived workspace.
Examples:
masterissuesprojectWorkspaceId: uuid | nullexecutionWorkspacePreference
inheritshared_workspaceisolated_workspaceoperator_branchreuse_existingpreferredExecutionWorkspaceId: uuid | nullexecutionWorkspaceSettings
reuse_existing is advanced-only and should target active execution workspaces, not the whole workspace universeinherit during migrationA durable record for a shared or derived runtime workspace.
This is the missing object that makes cleanup, previews, PRs, and branch reuse tractable.
Without an explicit execution workspace record, Paperclip has nowhere stable to attach:
execution_workspaces
idcompanyIdprojectIdprojectWorkspaceIdsourceIssueIdmode
shared_workspaceisolated_workspaceoperator_branchadapter_managedstrategyType
project_primarygit_worktreeadapter_managednamestatus
activeidlein_reviewarchivedcleanup_failedcwdrepoUrlbaseRefbranchNameproviderRefproviderType
local_fsgit_worktreeadapter_managedcloud_sandboxderivedFromExecutionWorkspaceIdlastUsedAtopenedAtclosedAtcleanupEligibleAtcleanupReasonmetadatacreatedAtupdatedAtsourceIssueId is the issue that originally caused the workspace to be created, not necessarily the only issue linked to it later.cwd may be null for remote execution workspaces; provider identity and work product links still make the object useful.An issue may need to link to one or more execution workspaces over time.
Examples:
issue_execution_workspaces
issueIdexecutionWorkspaceIdrelationType
currenthistoricalpreferredcreatedAtupdatedAtMost issues should only show one current workspace in the main UI. Historical links belong in advanced/history views.
User-facing umbrella concept for outputs of work.
Paperclip needs a single place to show:
without turning issues into a raw dump of adapter details.
issue_work_products
idcompanyIdprojectIdissueIdexecutionWorkspaceIdruntimeServiceIdtype
preview_urlruntime_servicepull_requestbranchcommitartifactdocumentprovider
paperclipgithubgitlabvercelnetlifycustomexternalIdtitleurlstatus
activeready_for_reviewmergedclosedfailedarchivedreviewState
noneneeds_board_reviewapprovedchanges_requestedisPrimaryhealthStatus
unknownhealthyunhealthysummarymetadatacreatedByRunIdcreatedAtupdatedAttype=pull_requesttype=preview_url or runtime_serviceDo not add Workspaces as a top-level sidebar item in V1.
That would make the whole product feel infra-heavy, even for companies that do not use code automation.
Workspaces and work product should be surfaced through project and issue detail views.
Add a project sub-navigation that keeps planning first and code second.
OverviewIssuesCodeActivityOptional future:
OutputsOverview tabPlanning-first summary:
Issues tabx/y doneShow subissuesCode tabThis is the main workspace configuration and visibility surface.
Project WorkspacesList durable project workspaces for the project.
Card/list columns:
Actions:
Add workspaceEditSet defaultArchiveExecution DefaultsFields:
Enable workspace automationDefault issue execution mode
Shared workspaceIsolated workspaceOperator branchAdapter defaultDefault codebaseAllow issue overrideProvisioningFields:
Setup commandCleanup commandImplementation
Shared workspaceGit worktreeAdapter-managedBase refBranch naming templateDerived workspace parent directoryHide git-specific fields when the selected workspace is not git-backed. Hide local-path-specific fields when the selected workspace is remote-managed.
Pull RequestsFields:
PR workflow
DisabledManualAgent may open draft PRApproval required to open PRApproval required to mark readyDefault base branchPR title templatePR body templatePreviews and RuntimeFields:
Allow workspace runtime servicesDefault services profileHarvest owned preview URLsTrack external preview URLsCleanupFields:
Cleanup mode
ManualWhen issue is terminalWhen PR closesAfter retention windowRetention windowKeep while preview is activeKeep while PR is openEntry point: Project > Code > Add workspace
NameSource type
Local folderGit repoNon-git folderRemote managedLocal pathRepository URLRemote providerRemote workspace referenceDefault refSet as default workspaceSetup commandCleanup commandIssue creation should stay simple by default.
If the selected project:
Workspace section only when relevantCodebase
Execution mode
Project defaultShared workspaceIsolated workspaceOperator branchReuse existing execution workspaceThis dropdown should show only active execution workspaces for the selected project workspace, with labels like:
dotta/integration-branchPAP-447-add-worktree-supportshared primary workspaceDo not show a picker containing every possible workspace object by default.
The normal flow should feel like:
not:
For existing users, issue creation should continue to look the same until a project explicitly enables richer workspace behavior.
Issue detail should expose workspace and work product clearly, but without becoming a code host UI.
Show compact summary chips near the title/status area:
Codebase: Web AppWorkspace: SharedWorkspace: PAP-447-add-worktree-supportPR: OpenPreview: HealthyCommentsSubissuesWork ProductActivityWork Product tabSections:
Current workspacePreviewsPull requestsBranches and commitsArtifacts and documentsFields:
Actions:
Open workspace detailsMark in reviewRequest cleanupFields:
Actions:
Open PRRefresh statusRequest board reviewFields:
Actions:
Open previewRefreshArchiveThis can be reached from a project code tab or an issue work product tab.
It does not need to be in the main sidebar.
This is where advanced users go when they need to inspect the mechanics. Most users should not need it in normal flow.
Inbox should surface actionable work product events, not every implementation detail.
If the inbox item is about a preview or PR, show issue context with it:
Keep list and board planning-first.
For issues with linked work product, show compact badges:
1 PR2 previewsshared workspaceisolated workspaceHas PRHas previewWorkspace modeCodebaseMigration must be silent-by-default and compatibility-preserving.
Existing users should not be forced to:
On upgrade:
project_workspaces records are retained and shown as Project WorkspacesProject Execution Workspace Policy surfaceOn upgrade:
executionWorkspacePreference=inheritOn upgrade:
Use additive language in the UI:
CodeWorkspace automationOptionalAdvancedAvoid migration copy that implies users were previously using the product "wrong".
Paperclip may run:
The workspace model must work in all three.
A cloud agent should be able to:
without the Paperclip host itself running local git or local preview processes.
The following must be optional, not required:
cwdThe UI should not split into "local mode" and "cloud mode" products.
Instead:
Worktrunk is a useful reference point because it is unapologetically focused on git-worktree-based developer workflows.
Paperclip should not copy its product framing wholesale, but there are several good patterns worth applying.
References:
https://worktrunk.dev/tips-patterns/https://github.com/max-sixty/worktrunkWorktrunk treats a derived workspace as something that can deterministically own:
This is a strong pattern for Paperclip.
Execution workspaces should be able to deterministically derive and expose:
This makes previews and local runtime services more predictable and easier to manage across many parallel workspaces.
Worktrunk uses practical lifecycle hooks such as create/start/remove/merge-oriented commands.
The main lesson is not to build a huge workflow engine. The lesson is to give users a few well-defined lifecycle moments to attach automation to.
Paperclip should keep workspace automation centered on a small set of hooks:
setupcleanupbefore_reviewafter_merge or after_closeThese should remain project/workspace policy concerns, not agent-prompt conventions.
Worktrunk's listing/status experience is doing important product work:
Paperclip should provide the equivalent visibility in the project Code surface:
This reinforces why execution workspace needs to be a first-class recorded object.
One of Worktrunk's strongest implicit ideas is that a worktree is not only code. It often owns an entire local runtime environment.
Paperclip should treat execution workspaces as the natural home for:
This supports the work product model and the preview/runtime service model proposed above.
Worktrunk exposes structured state that can be consumed by tools and automation.
Paperclip should ensure that execution workspaces and work product have clean structured API surfaces, not just UI-only representation.
That is important for:
Worktrunk makes create/remove/merge cleanup part of the workflow.
Paperclip should continue treating cleanup policy as part of the core workspace model:
This validates the explicit cleanup policy proposed earlier in this plan.
There are also important limits to the analogy.
Paperclip should not adopt these Worktrunk assumptions as universal product rules:
Paperclip should borrow Worktrunk's good execution patterns while keeping the broader Paperclip model:
in_reviewAgents may still use in_review, but cleanup behavior must be governed by policy and observed state.
Archived or idle workspaces should be hidden from default lists before they are hard-cleaned up.
This is how Paperclip supports:
This is the key reason not to force 1 issue = 1 workspace = 1 PR.
Even in a git-heavy project, isolated workspaces should be optional.
Examples where shared mode is valid:
PR automation decisions should be made at the project/workspace policy layer.
The issue should only:
Previews, PRs, commits, and artifacts should all be discoverable through one consistent issue-level affordance.
That keeps Paperclip focused on coordination and visibility instead of splitting outputs across many hidden subsystems.
Project > Code tabexecution_workspacescwd optional and ensure provider-managed remote workspaces are supported from day oneissue_work_productsWork Product tabreuse existing execution workspaceThis model keeps the product balanced:
Most importantly, it keeps the abstractions clean:
It also keeps the rollout practical:
That is a better fit for Paperclip than either extreme: