You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Proposal] Worktree-centered development workflow
#6898
Scope update: Project Actions are specified and delivered independently in feature #6946. That issue owns Action configuration and execution requirements. This proposal owns their integration with worktree permissions and lifecycle. Action delivery is not a release prerequisite for this proposal, and Actions do not require the complete worktree workflow.
1. Background and goals
Maka currently uses sessions as its main interaction entry point. When users develop on independent branches in parallel, one task may require several sessions, terminals, and development processes. Directory ownership, initialization, running services, and cleanup are consequently spread across different entry points.
This proposal makes a worktree an independent unit of development work. It owns a task name, a code environment, a collection of sessions, and running resources. Its lifecycle is independent of any individual session.
The Session layout remains the default. Milestone M2 delivers the complete worktree workflow within that layout. Milestone M3 adds an optional Worktree layout. Both layouts use the same data, resource ownership, and lifecycle rules. They differ only in navigation. Whether to change the default or eventually use one layout will be discussed after evaluating actual use.
The goals are to:
Make the working directory of every session, terminal, and Action explicit.
Support resuming a discussion or starting a new discussion around the same worktree.
Cover creation, setup, execution, change review, commits, and deletion.
Preserve existing history, permissions, and code locations, with recoverable migration failures.
Delivery follows the milestones in section 15. Each milestone covers its corresponding operations in both the desktop and terminal interfaces. ACP remains compatible with existing sessions and enforces the same permission and lifecycle constraints. M2 can be released before the optional Worktree layout in M3.
Automatic discovery and import of external Git worktrees, cross-repository task orchestration, automatic resolution of concurrent code edits, and new automatic merge or deployment capabilities are outside this proposal. Worktrees do not isolate ports, databases, or external services.
2. Example development workflow
The following diagram shows the successful path for a new worktree. Setup and asynchronous naming can run in parallel. The first agent starts after both have finished.
flowchart TD
A["Select a project and create a worktree<br/>Use a temporary name and branch"] --> B["Run Setup to prepare the environment"]
A --> C["Send the first task message"]
C --> D["Generate and apply the task and branch names asynchronously"]
B --> E["Setup and naming complete<br/>Start a session and develop"]
D --> E
E <--> F["Run project Actions when available<br/>Start services, run tests, and build"]
E --> G["Verify changes, commit, and enter the PR workflow"]
G --> H["Finish the task and delete the worktree"]
H --> I["Stop sessions, terminals, and Actions"]
I --> J["Delete the directory and session history<br/>Keep the Git branch"]
Loading
Reusing an existing worktree enters the development stage through an existing or new session. It does not recreate the directory or automatically repeat setup or first-message naming.
3. Objects and resource ownership
Object
Responsibility
Project
Repository or ordinary-directory identity; default base ref, branch prefix, setup, and project Action configuration
Worktree
Task name, working directory, current branch, initialization state, sessions, and running resources
Session
Independent conversation context, permissions, and agent execution history
Terminal
An interactive environment running in its assigned directory
Action
A reusable terminal command configured for a project
Action run
The command, directory, output, and exit result of one execution
A worktree has a stable identity. Its display name, branch name, and directory path are stored separately and are not unique identities. Renaming the display name or branch does not move the directory.
The main checkout and linked worktrees of the same repository belong to one project. Separate clones are not merged into one project merely because their remote URLs match.
The main checkout appears as the Main working directory. Ordinary directories retain their existing project semantics and support sessions, terminals, and commands without branch-related controls. Both have stable directory identities for resource association; this does not give Maka permission to delete those user-owned directories.
Sessions originally scoped to a repository subdirectory retain their actual working directory and permission scope. Migration does not widen them to the repository root.
A worktree can exist without sessions. Closing its last session tab neither deletes it nor stops its terminals or development servers.
4. Navigation and new sessions
Settings offer Navigation layout: Session (default) / Worktree. Switching layouts preserves the current session, directory, running resources, and each layout's state. It does not create or delete resources.
In the Session layout, the new-conversation interface adds a working-directory selector with these choices:
Use the project's main working directory.
Continue in an existing Maka-managed worktree.
Create a worktree.
Use an ordinary-directory project.
When entry comes from an explicit session, worktree, or project-directory context, preselect that directory. Without a directory context, default to the selected project's main working directory. If no project is selected, select a project first. The selector always displays the current choice and does not silently create a worktree.
In the Worktree layout, the sidebar groups main working directories and Maka-managed worktrees by project. Selecting one displays its session tabs at the top of the conversation area. A new session must belong to the selected worktree, main working directory, or ordinary directory.
Switching between these entries restores their open tabs, selected session, and panel state.
5. Creating a worktree
Project entry points, the Worktree list, and the Session layout's directory selector provide New worktree. The dialog contains the project, base ref, workspace name, branch prefix, full branch-name preview, and whether to run setup.
The base ref defaults to the project setting. Without that setting, use the repository's default branch when it can be determined from local Git information. Otherwise, require a selection rather than guessing main or master.
Creation uses an existing local ref and does not implicitly fetch. Missing or unusable refs produce an explicit error. Record the resolved base commit. The new directory does not inherit uncommitted changes from another working directory.
The default is a temporary name, for example:
Workspace name: quiet-fox
Branch prefix: feat
Full branch name: feat/quiet-fox
Users may enter a final name directly. Check name collisions, branch-name validity, occupied directories, and repository support before creation, then revalidate during the operation.
Show the stages Create branch and directory → Run setup → Ready. Resolve an uncertain response through the original operation record; retrying must not create another branch or directory.
If the directory exists but setup fails, retain the worktree and provide logs, retry, and explicit skip controls. Retrying setup does not recreate the branch or directory.
Unsupported repository states or features fail explicitly. The implementation design must document support for empty repositories, detached HEAD, submodules, and sparse checkout.
6. Setup and the first task
Setup belongs to the project and is configured in settings. No dedicated repository configuration file is added. The command may invoke scripts already in the project.
Setup runs by default when creating a worktree, with an option to skip it. Reopening a worktree, restoring a session, or creating another session does not automatically run setup again.
Setup runs in the worktree directory and shows its command, output, state, and exit result. It starts immediately after creation and may observe the temporary branch name. A later branch rename does not rerun setup or rewrite files it produced.
Users can send a task while initialization is running. Maka saves the message, shows that it is waiting for initialization, and allows cancellation before execution. The first agent starts only after both conditions hold:
Setup succeeded, is not configured, or was explicitly skipped.
First-message naming completed, was inapplicable, or was abandoned after failure or timeout.
After setup fails, the saved task keeps waiting until a retry succeeds or the user explicitly skips setup.
If users edit the project's setup command and then retry, execute the current configuration and show the command that will run. Each attempt retains its own command, logs, and result. Changing configuration does not rewrite previous records.
Retry means executing the command again. It does not mean Maka has rolled back earlier file changes or other side effects.
7. Automatic naming from the first message
The first accepted user task message in a temporarily named worktree triggers one automatic naming attempt. For example, “Improve project management in settings” could produce the display name “Improve project management” and branch feat/improve-project-management.
The branch prefix is a separate project setting. AI generates the task display name and branch-name body; Maka combines the prefix and body.
Automatic branch renaming is limited to branches Maka named automatically, that the user has not manually renamed, and that have no configured upstream. If the upstream check fails, skip automatic renaming.
This rule does not detect every push made through external tools. The UI and documentation must not describe “no upstream configured” as proof that a branch has never been pushed.
Before applying a generated result, recheck that the worktree permits the operation, the user has not renamed it, the current branch is still the one observed at the start, no upstream is configured, and the proposed branch name is valid and available.
If a check fails, the name conflicts, generation fails, or the attempt times out, retain the original names and continue the task. Never force-overwrite an existing branch.
Concurrent first messages from multiple sessions claim only one naming attempt per worktree. Naming has a finite timeout. After the initial attempt fails or times out, do not retry in the background or apply a late result.
Users can always edit the display name manually. Manual branch renaming is a separate explicit operation with a visible result or failure reason. Neither operation moves the directory.
8. Continuing in an existing worktree
New worktree and Continue in an existing worktree are distinct entry points. The reuse list contains Maka-managed user worktrees and shows task name, branch, recent use, and necessary exception states. Paths and initialization logs appear in details.
Temporary worktrees created for internal isolated agent execution do not automatically enter this list just because Maka created them.
Users can reopen an existing session to resume its discussion or create a session to start a separate discussion around the same code. Neither choice recreates the branch or automatically repeats setup.
Main working directories and ordinary directories keep their own entry points. If a historical session is already bound to an external worktree, migration preserves its access and history without granting Maka ownership of directory deletion.
9. Session tabs, archives, and background state
Tabs support creation, switching, and closing. Closing hides a tab without stopping execution. Users can reopen it from the session list for that working directory.
Each working directory retains its open tabs and selection. After application restart, restore the layout and separately reconcile real execution records. Restored layout is not evidence of restored processes.
Distinguish running, waiting for user input, failed, and unread-result states. A background session waiting for input produces an indicator on its worktree and can be located after opening it. Terminal and Action state remains visible across conversation-tab switches.
Sessions retain individual archive and restore operations. Follow the existing lifecycle rule: refuse archive while execution, queued messages, pending interaction, or cleanup remains, and explain what must be handled first.
Archiving a session retains history, does not delete its worktree, and does not automatically stop worktree-owned terminals or Actions. Restoring a session does not rerun commands.
Worktrees have no archive or restore operation. Users keep a worktree to retain its environment and may archive individual sessions inside it.
10. Terminals, Action integration, and permissions
Project Actions are defined in feature #6946, including project settings, command snapshots, run controls, duplicate-run handling, and recovery. They can be delivered for existing project directories independently of this proposal.
When Actions are available, worktree integration shares project definitions while binding each run to its concrete directory. Worktrees do not isolate ports, databases, or external services.
Users can manage resources together from the worktree. Agent permissions to read output, send input, or stop resources remain separately authorized. Sharing a directory does not let a read-only session control another session's or the user's terminal.
User terminals, setup, Actions, and processes created by agent tools retain their respective execution constraints and cleanup ownership. Unified presentation does not change their authority.
Closing a tab, exiting a client, restarting the Host, and stopping a process are separate events. Reattach to resources when their live identity can be verified; otherwise show unavailable or unknown state. Do not rerun commands to simulate recovery.
11. Concurrent development, commits, and PRs
Multiple sessions may execute concurrently in one worktree. The UI explains that they share files, the branch, and the Git index.
Diffs, staging, and commits belong to the whole worktree. Maka does not promise to identify each session's contribution automatically. Commits remain available while other sessions run, but the commit entry shows the whole worktree's changes and warns that concurrent execution may continue to change them.
Create another worktree when code changes need isolation. Review, commit, and PR entry points always use the selected worktree's actual directory and current branch. Creation base, push destination, and PR target are separate choices rather than one assumed setting.
Refresh state when an external terminal or editor changes the branch, HEAD, index, or directory. Management operations that depend on an older observation must recheck it. Existing automatic merge and deployment capabilities are reused, not expanded by this proposal.
12. Project management in settings
Project management lists the main working directory and Maka-managed user worktrees, with open, create, details, and delete entry points. The same page maintains the default base ref, branch prefix, and setup command. Project Action settings are tracked separately in feature #6946.
Lists prioritize names and necessary states. Paths, branch details, initialization logs, and deletion failures belong in details.
The main working directory and ordinary directories do not offer directory deletion. Removing a management record and deleting a user-owned directory remain distinct operations.
13. Deleting a worktree
Deletion permanently removes the worktree directory and all sessions and conversation history belonging to it, including archived sessions. It keeps the Git branch.
The confirmation shows the name, branch, actual path, affected sessions and history, live sessions and processes, uncommitted and untracked files, and unpushed commits or an explicit unknown publication state. It also explains that ignored local files are removed with the directory.
If uncommitted content or unpushed commits exist, warn and offer an explicit Force delete entry. Keeping the branch does not preserve uncommitted content.
Deletion follows this order:
Mark the worktree as deleting and prevent new work, queued tasks, and other execution entry points from starting.
Stop running sessions, terminals, setup, and Actions.
Confirm managed resources have ended, then recheck directory identity and the content being removed.
Remove the directory and associated Git worktree registration.
Remove its session data and complete the deletion record.
A stop request is not proof of termination. If a resource cannot stop normally, keep deletion blocked, retain records, and identify the resource. Users may explicitly force-stop it and retry. Resources already stopped are not restarted because deletion was blocked.
Force deletion authorizes discarding confirmed directory contents; it does not bypass unfinished-resource checks. Maka does not claim to identify or stop every external program.
If content changed after confirmation, show the changes and obtain confirmation again. If directory identity is missing, replaced, or inconsistent, do not delete a replacement merely because its path matches.
If directory cleanup fails, retain sessions and management records. If the directory is gone but data cleanup fails, retain an explicit incomplete-deletion state and allow retry. After restart, reconcile the original operation rather than presenting a partially deleted worktree as usable.
Clean shared attachments and other referenced data according to their remaining references so that deleting one worktree does not damage retained sessions elsewhere.
The initial release has no recycle bin and does not promise recovery after successful deletion.
14. Data, execution constraints, and migration
Model lifecycle, initialization, directory availability, and running state separately.
State
Allowed behavior
Directory creation in progress
Show progress; do not start execution that depends on the directory
Setup running
Save tasks; agents wait
Setup failed
Show logs; retry or explicitly skip
Directory missing or identity mismatched
Read history; block new directory execution and offer repair
Deleting or deletion incomplete
Reject new execution; allow inspection and recovery
Ready
Start sessions, terminals, and Actions within their permissions
Shared services enforce lifecycle restrictions for every client. Disabled UI buttons alone are insufficient.
Creation, naming, setup launch, and deletion retain operation records that can resolve a lost reply. An unknown outcome is not equivalent to no execution and does not authorize duplicate resource creation.
Navigation reads persisted directory and state summaries. Refresh Git status on demand instead of scanning every repository or loading full chat histories on each render. Blocking Git and filesystem operations must not block asynchronous executor threads and must support cancellation with actual cleanup.
Group existing sessions by their actual directory while preserving history, session identity, selection, original cwd, and permissions. Migration does not move code, rename old branches, or create Git worktrees for ordinary directories. It must:
Avoid duplicate working units on repeated execution.
Continue after interruption or report a recoverable failure.
Avoid merging different directory identities solely by path.
Avoid granting deletion ownership over external directories.
Preserve each session's permission scope.
Retain history for missing directories without creating replacement directories automatically.
Reassign existing terminals only while preserving verifiable live associations. Do not restart commands. Mark resources unavailable when they cannot be reattached after a Host restart.
Before release, provide a backup and migration-failure recovery plan and document version compatibility. Switching back to the Session layout changes navigation, not the data model.
15. Delivery milestones and acceptance
Delivery follows three milestones. Each milestone has an independently usable result and its own acceptance criteria. A milestone may contain several PRs. The shared data and resource contracts remain consistent across milestones.
Milestone
User outcome
Completion criterion
M1. Independent project Actions
Configure and run common commands in existing project directories without first creating a session
Commands remain manageable across session switches and closures, and recovery never silently reruns them
M2. Complete worktree workflow in the Session layout
Create, select, name, initialize, use, and safely delete worktrees through the existing navigation
The entire worktree lifecycle works without the Worktree layout
M3. Worktree layout
Organize sessions and running resources by project and working directory
Switching layouts preserves sessions, history, directories, and resources without creating or rerunning anything
M1. Independent project Actions
Feature #6946 owns Action configuration and execution requirements. M1 records its place in the delivery roadmap, without moving those requirements back into this proposal. Actions remain independently deliverable and are not a release prerequisite for M2 or M3.
M1 covers Action settings, run controls, output, status, command snapshots, duplicate-run handling, and recovery for existing project directories. Action definitions belong to the project. Each run belongs to a concrete directory and retains the command actually executed. The minimal stable directory identity and resource ownership contract is established here. Worktree creation and the full worktree lifecycle belong to M2.
Acceptance requires that switching or closing a session does not lose control of an Action run. Editing the definition does not change an existing run. Repeated activation normally locates the active run in that directory, with an explicit option to start another. After restart, reconcile the real resource state instead of silently rerunning the command.
M2. Complete worktree workflow in the Session layout
M2 is one product milestone delivered through four separately verifiable steps. These are delivery steps. At runtime, setup and automatic naming may run concurrently.
Step
Deliverable
Acceptance criteria
M2.1. Directory model and migration
Complete the project, directory, session, and resource relationships. Distinguish main working directories, ordinary directories, external worktrees, and Maka-managed worktrees. Migrate existing sessions while preserving their cwd, history, and permissions
A directory can contain several sessions or no sessions. Repeated migration creates no duplicate records. Interrupted migration is recoverable. Migration does not rerun commands, widen permissions, or grant deletion ownership over external directories
M2.2. Creation, selection, reuse, and automatic naming
Add directory selection, worktree creation, resume-conversation, and new-conversation entry points to the Session layout. Support manual names and one automatic task-name and branch-name attempt triggered by the first accepted task
Creation retries do not duplicate branches or directories. Naming obeys the checks in section 7, including manual changes, upstream checks, conflicts, timeouts, and late results. Reusing a worktree does not repeat automatic naming
M2.3. Setup and execution constraints
Provide setup configuration, command and log display, results, retry with the current configuration, explicit skip, and restart recovery. Persist tasks submitted during initialization and enforce startup restrictions in shared Host services
The first agent waits until setup succeeds, is unnecessary, or is explicitly skipped, and naming finishes, is inapplicable, or is abandoned after failure or timeout. Setup failure keeps saved tasks waiting. Reopening a directory or creating another session does not automatically rerun setup
M2.4. Safe deletion
Show the deletion impact, block new work, stop and confirm termination of managed resources, then remove the directory and session history while retaining the Git branch. Preserve failed operations for recovery and retry
Unfinished resources block deletion. A replaced directory is not deleted because its path matches. Cleanup failures retain the required records. Main and ordinary user directories do not gain a directory-deletion entry point
M2 also makes file access, terminals, available Actions, change review, and commit entry points use the actual selected directory. Each session retains its own permission scope. A missing directory or an identity mismatch preserves history but blocks new directory execution.
M2 is complete when users can perform the entire worktree lifecycle through the Session layout, including creation, automatic naming, setup failure and retry, development, restart recovery, and safe cleanup. No part of that workflow depends on M3.
M3. Worktree layout
M3 adds the optional Worktree layout while keeping Session as the default. The sidebar groups main working directories and Maka-managed worktrees by project. Each directory provides session tabs, history, and a new-conversation entry point. It restores open tabs, the selected session, and panel state, and exposes background execution, input requests, failures, and unread results. Terminals, available Actions, files, and changes remain accessible from the directory.
Acceptance requires that switching between layouts preserves the current session, directory, history, and running resources. Closing a tab only changes presentation and does not stop execution. Switching layouts does not create resources, rerun setup, or launch extra commands. M3 reuses the directory and execution contracts completed in M2.
Acceptance across milestones
Each milestone covers its corresponding operations in both desktop and terminal interfaces. ACP follows the same permissions and lifecycle restrictions. Release verification applies to the behavior introduced by that milestone, including interruption recovery, concurrent clients, and migration where relevant. M2 does not wait for M3 to be released. Completion of one milestone does not imply completion of all proposal capabilities.
The full acceptance matrix is:
Scenario
Required behavior
Creation
Explicit ref, name, and directory errors; retries do not duplicate resources
Setup
Success, failure, retry with edited configuration, skip, and waiting-task startup
Naming
Manual names, upstream presence, failed checks, conflicts, timeouts, and late results never cause unintended overwrites
Multiple sessions
Concurrent work, closing tabs, and finding terminals and results after switching directories
Reuse
Distinct resume and new-discussion entry points without repeating setup
Commits
Real worktree-wide changes and branch, with concurrent-execution indicators
Session archives
Retained history and busy checks without changing directory lifecycle
Deletion
Normal and forced deletion, blocked stops, directory-cleanup failure, and data-cleanup failure
Migration
Existing sessions, ordinary directories, subdirectories, external worktrees, and missing directories
Clients
Switching layouts preserves resources; desktop, terminal, and ACP enforce the same execution constraints
Also test concurrent clients, successful operations whose replies are lost, restart at intermediate stages, and external directory or Git changes.
Performance verification specifies project, worktree, and session counts, the test environment, navigation latency, and Git refresh cost. Tests use the repository's shared CI entry points rather than a separate test scheduler.
16. Alternatives and follow-up evaluation
Alternative
Trade-off
Keep session-only resource management
Cannot fully represent an environment with no sessions or shared-resource lifecycle
Add directory selection without independent worktree lifecycle
Improves creation but leaves setup, running resources, and deletion fragmented
Independent worktree model with optional layouts
Selected approach: complete the workflow, then evaluate navigation preferences
Immediately require Worktree navigation
Not selected for the initial release because it changes both the data model and every user's default entry point
After release, evaluate whether users can identify their working directory and recover background sessions and resources, alongside the reliability of creation, setup, migration, and deletion recovery.
Whether to keep both layouts indefinitely or change the default is a separate community decision. This proposal does not commit to removing the Session layout.
flowchart TD
A["选择项目,创建 Worktree<br/>使用临时名称和分支"] --> B["执行 Setup,准备环境"]
A --> C["发送首条需求消息"]
C --> D["异步生成并应用任务名和分支名"]
B --> E["Setup 与命名完成<br/>启动 Session 开发"]
D --> E
E <--> F["Action 可用时运行项目命令<br/>启动服务、测试与构建"]
E --> G["验收改动,提交代码,进入 PR 流程"]
G --> H["需求完成,删除 Worktree"]
H --> I["停止 Session、终端与 Action"]
I --> J["删除目录和会话历史<br/>保留 Git 分支"]
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Status: Draft for community discussion.
Scope update: Project Actions are specified and delivered independently in feature #6946. That issue owns Action configuration and execution requirements. This proposal owns their integration with worktree permissions and lifecycle. Action delivery is not a release prerequisite for this proposal, and Actions do not require the complete worktree workflow.
1. Background and goals
Maka currently uses sessions as its main interaction entry point. When users develop on independent branches in parallel, one task may require several sessions, terminals, and development processes. Directory ownership, initialization, running services, and cleanup are consequently spread across different entry points.
This proposal makes a worktree an independent unit of development work. It owns a task name, a code environment, a collection of sessions, and running resources. Its lifecycle is independent of any individual session.
The Session layout remains the default. Milestone M2 delivers the complete worktree workflow within that layout. Milestone M3 adds an optional Worktree layout. Both layouts use the same data, resource ownership, and lifecycle rules. They differ only in navigation. Whether to change the default or eventually use one layout will be discussed after evaluating actual use.
The goals are to:
Delivery follows the milestones in section 15. Each milestone covers its corresponding operations in both the desktop and terminal interfaces. ACP remains compatible with existing sessions and enforces the same permission and lifecycle constraints. M2 can be released before the optional Worktree layout in M3.
Automatic discovery and import of external Git worktrees, cross-repository task orchestration, automatic resolution of concurrent code edits, and new automatic merge or deployment capabilities are outside this proposal. Worktrees do not isolate ports, databases, or external services.
2. Example development workflow
The following diagram shows the successful path for a new worktree. Setup and asynchronous naming can run in parallel. The first agent starts after both have finished.
flowchart TD A["Select a project and create a worktree<br/>Use a temporary name and branch"] --> B["Run Setup to prepare the environment"] A --> C["Send the first task message"] C --> D["Generate and apply the task and branch names asynchronously"] B --> E["Setup and naming complete<br/>Start a session and develop"] D --> E E <--> F["Run project Actions when available<br/>Start services, run tests, and build"] E --> G["Verify changes, commit, and enter the PR workflow"] G --> H["Finish the task and delete the worktree"] H --> I["Stop sessions, terminals, and Actions"] I --> J["Delete the directory and session history<br/>Keep the Git branch"]Reusing an existing worktree enters the development stage through an existing or new session. It does not recreate the directory or automatically repeat setup or first-message naming.
3. Objects and resource ownership
A worktree has a stable identity. Its display name, branch name, and directory path are stored separately and are not unique identities. Renaming the display name or branch does not move the directory.
The main checkout and linked worktrees of the same repository belong to one project. Separate clones are not merged into one project merely because their remote URLs match.
The main checkout appears as the Main working directory. Ordinary directories retain their existing project semantics and support sessions, terminals, and commands without branch-related controls. Both have stable directory identities for resource association; this does not give Maka permission to delete those user-owned directories.
Sessions originally scoped to a repository subdirectory retain their actual working directory and permission scope. Migration does not widen them to the repository root.
A worktree can exist without sessions. Closing its last session tab neither deletes it nor stops its terminals or development servers.
4. Navigation and new sessions
Settings offer Navigation layout: Session (default) / Worktree. Switching layouts preserves the current session, directory, running resources, and each layout's state. It does not create or delete resources.
In the Session layout, the new-conversation interface adds a working-directory selector with these choices:
When entry comes from an explicit session, worktree, or project-directory context, preselect that directory. Without a directory context, default to the selected project's main working directory. If no project is selected, select a project first. The selector always displays the current choice and does not silently create a worktree.
In the Worktree layout, the sidebar groups main working directories and Maka-managed worktrees by project. Selecting one displays its session tabs at the top of the conversation area. A new session must belong to the selected worktree, main working directory, or ordinary directory.
Switching between these entries restores their open tabs, selected session, and panel state.
5. Creating a worktree
Project entry points, the Worktree list, and the Session layout's directory selector provide New worktree. The dialog contains the project, base ref, workspace name, branch prefix, full branch-name preview, and whether to run setup.
The base ref defaults to the project setting. Without that setting, use the repository's default branch when it can be determined from local Git information. Otherwise, require a selection rather than guessing
mainormaster.Creation uses an existing local ref and does not implicitly fetch. Missing or unusable refs produce an explicit error. Record the resolved base commit. The new directory does not inherit uncommitted changes from another working directory.
The default is a temporary name, for example:
Users may enter a final name directly. Check name collisions, branch-name validity, occupied directories, and repository support before creation, then revalidate during the operation.
Show the stages Create branch and directory → Run setup → Ready. Resolve an uncertain response through the original operation record; retrying must not create another branch or directory.
If the directory exists but setup fails, retain the worktree and provide logs, retry, and explicit skip controls. Retrying setup does not recreate the branch or directory.
Unsupported repository states or features fail explicitly. The implementation design must document support for empty repositories, detached HEAD, submodules, and sparse checkout.
6. Setup and the first task
Setup belongs to the project and is configured in settings. No dedicated repository configuration file is added. The command may invoke scripts already in the project.
Setup runs by default when creating a worktree, with an option to skip it. Reopening a worktree, restoring a session, or creating another session does not automatically run setup again.
Setup runs in the worktree directory and shows its command, output, state, and exit result. It starts immediately after creation and may observe the temporary branch name. A later branch rename does not rerun setup or rewrite files it produced.
Users can send a task while initialization is running. Maka saves the message, shows that it is waiting for initialization, and allows cancellation before execution. The first agent starts only after both conditions hold:
After setup fails, the saved task keeps waiting until a retry succeeds or the user explicitly skips setup.
If users edit the project's setup command and then retry, execute the current configuration and show the command that will run. Each attempt retains its own command, logs, and result. Changing configuration does not rewrite previous records.
Retry means executing the command again. It does not mean Maka has rolled back earlier file changes or other side effects.
7. Automatic naming from the first message
The first accepted user task message in a temporarily named worktree triggers one automatic naming attempt. For example, “Improve project management in settings” could produce the display name “Improve project management” and branch
feat/improve-project-management.The branch prefix is a separate project setting. AI generates the task display name and branch-name body; Maka combines the prefix and body.
Automatic branch renaming is limited to branches Maka named automatically, that the user has not manually renamed, and that have no configured upstream. If the upstream check fails, skip automatic renaming.
This rule does not detect every push made through external tools. The UI and documentation must not describe “no upstream configured” as proof that a branch has never been pushed.
Before applying a generated result, recheck that the worktree permits the operation, the user has not renamed it, the current branch is still the one observed at the start, no upstream is configured, and the proposed branch name is valid and available.
If a check fails, the name conflicts, generation fails, or the attempt times out, retain the original names and continue the task. Never force-overwrite an existing branch.
Concurrent first messages from multiple sessions claim only one naming attempt per worktree. Naming has a finite timeout. After the initial attempt fails or times out, do not retry in the background or apply a late result.
Users can always edit the display name manually. Manual branch renaming is a separate explicit operation with a visible result or failure reason. Neither operation moves the directory.
8. Continuing in an existing worktree
New worktree and Continue in an existing worktree are distinct entry points. The reuse list contains Maka-managed user worktrees and shows task name, branch, recent use, and necessary exception states. Paths and initialization logs appear in details.
Temporary worktrees created for internal isolated agent execution do not automatically enter this list just because Maka created them.
Users can reopen an existing session to resume its discussion or create a session to start a separate discussion around the same code. Neither choice recreates the branch or automatically repeats setup.
Main working directories and ordinary directories keep their own entry points. If a historical session is already bound to an external worktree, migration preserves its access and history without granting Maka ownership of directory deletion.
9. Session tabs, archives, and background state
Tabs support creation, switching, and closing. Closing hides a tab without stopping execution. Users can reopen it from the session list for that working directory.
Each working directory retains its open tabs and selection. After application restart, restore the layout and separately reconcile real execution records. Restored layout is not evidence of restored processes.
Distinguish running, waiting for user input, failed, and unread-result states. A background session waiting for input produces an indicator on its worktree and can be located after opening it. Terminal and Action state remains visible across conversation-tab switches.
Sessions retain individual archive and restore operations. Follow the existing lifecycle rule: refuse archive while execution, queued messages, pending interaction, or cleanup remains, and explain what must be handled first.
Archiving a session retains history, does not delete its worktree, and does not automatically stop worktree-owned terminals or Actions. Restoring a session does not rerun commands.
Worktrees have no archive or restore operation. Users keep a worktree to retain its environment and may archive individual sessions inside it.
10. Terminals, Action integration, and permissions
Project Actions are defined in feature #6946, including project settings, command snapshots, run controls, duplicate-run handling, and recovery. They can be delivered for existing project directories independently of this proposal.
When Actions are available, worktree integration shares project definitions while binding each run to its concrete directory. Worktrees do not isolate ports, databases, or external services.
Users can manage resources together from the worktree. Agent permissions to read output, send input, or stop resources remain separately authorized. Sharing a directory does not let a read-only session control another session's or the user's terminal.
User terminals, setup, Actions, and processes created by agent tools retain their respective execution constraints and cleanup ownership. Unified presentation does not change their authority.
Closing a tab, exiting a client, restarting the Host, and stopping a process are separate events. Reattach to resources when their live identity can be verified; otherwise show unavailable or unknown state. Do not rerun commands to simulate recovery.
11. Concurrent development, commits, and PRs
Multiple sessions may execute concurrently in one worktree. The UI explains that they share files, the branch, and the Git index.
Diffs, staging, and commits belong to the whole worktree. Maka does not promise to identify each session's contribution automatically. Commits remain available while other sessions run, but the commit entry shows the whole worktree's changes and warns that concurrent execution may continue to change them.
Create another worktree when code changes need isolation. Review, commit, and PR entry points always use the selected worktree's actual directory and current branch. Creation base, push destination, and PR target are separate choices rather than one assumed setting.
Refresh state when an external terminal or editor changes the branch, HEAD, index, or directory. Management operations that depend on an older observation must recheck it. Existing automatic merge and deployment capabilities are reused, not expanded by this proposal.
12. Project management in settings
Project management lists the main working directory and Maka-managed user worktrees, with open, create, details, and delete entry points. The same page maintains the default base ref, branch prefix, and setup command. Project Action settings are tracked separately in feature #6946.
Lists prioritize names and necessary states. Paths, branch details, initialization logs, and deletion failures belong in details.
The main working directory and ordinary directories do not offer directory deletion. Removing a management record and deleting a user-owned directory remain distinct operations.
13. Deleting a worktree
Deletion permanently removes the worktree directory and all sessions and conversation history belonging to it, including archived sessions. It keeps the Git branch.
The confirmation shows the name, branch, actual path, affected sessions and history, live sessions and processes, uncommitted and untracked files, and unpushed commits or an explicit unknown publication state. It also explains that ignored local files are removed with the directory.
If uncommitted content or unpushed commits exist, warn and offer an explicit Force delete entry. Keeping the branch does not preserve uncommitted content.
Deletion follows this order:
A stop request is not proof of termination. If a resource cannot stop normally, keep deletion blocked, retain records, and identify the resource. Users may explicitly force-stop it and retry. Resources already stopped are not restarted because deletion was blocked.
Force deletion authorizes discarding confirmed directory contents; it does not bypass unfinished-resource checks. Maka does not claim to identify or stop every external program.
If content changed after confirmation, show the changes and obtain confirmation again. If directory identity is missing, replaced, or inconsistent, do not delete a replacement merely because its path matches.
If directory cleanup fails, retain sessions and management records. If the directory is gone but data cleanup fails, retain an explicit incomplete-deletion state and allow retry. After restart, reconcile the original operation rather than presenting a partially deleted worktree as usable.
Clean shared attachments and other referenced data according to their remaining references so that deleting one worktree does not damage retained sessions elsewhere.
The initial release has no recycle bin and does not promise recovery after successful deletion.
14. Data, execution constraints, and migration
Model lifecycle, initialization, directory availability, and running state separately.
Shared services enforce lifecycle restrictions for every client. Disabled UI buttons alone are insufficient.
Creation, naming, setup launch, and deletion retain operation records that can resolve a lost reply. An unknown outcome is not equivalent to no execution and does not authorize duplicate resource creation.
Navigation reads persisted directory and state summaries. Refresh Git status on demand instead of scanning every repository or loading full chat histories on each render. Blocking Git and filesystem operations must not block asynchronous executor threads and must support cancellation with actual cleanup.
Group existing sessions by their actual directory while preserving history, session identity, selection, original cwd, and permissions. Migration does not move code, rename old branches, or create Git worktrees for ordinary directories. It must:
Reassign existing terminals only while preserving verifiable live associations. Do not restart commands. Mark resources unavailable when they cannot be reattached after a Host restart.
Before release, provide a backup and migration-failure recovery plan and document version compatibility. Switching back to the Session layout changes navigation, not the data model.
15. Delivery milestones and acceptance
Delivery follows three milestones. Each milestone has an independently usable result and its own acceptance criteria. A milestone may contain several PRs. The shared data and resource contracts remain consistent across milestones.
M1. Independent project Actions
Feature #6946 owns Action configuration and execution requirements. M1 records its place in the delivery roadmap, without moving those requirements back into this proposal. Actions remain independently deliverable and are not a release prerequisite for M2 or M3.
M1 covers Action settings, run controls, output, status, command snapshots, duplicate-run handling, and recovery for existing project directories. Action definitions belong to the project. Each run belongs to a concrete directory and retains the command actually executed. The minimal stable directory identity and resource ownership contract is established here. Worktree creation and the full worktree lifecycle belong to M2.
Acceptance requires that switching or closing a session does not lose control of an Action run. Editing the definition does not change an existing run. Repeated activation normally locates the active run in that directory, with an explicit option to start another. After restart, reconcile the real resource state instead of silently rerunning the command.
M2. Complete worktree workflow in the Session layout
M2 is one product milestone delivered through four separately verifiable steps. These are delivery steps. At runtime, setup and automatic naming may run concurrently.
M2 also makes file access, terminals, available Actions, change review, and commit entry points use the actual selected directory. Each session retains its own permission scope. A missing directory or an identity mismatch preserves history but blocks new directory execution.
M2 is complete when users can perform the entire worktree lifecycle through the Session layout, including creation, automatic naming, setup failure and retry, development, restart recovery, and safe cleanup. No part of that workflow depends on M3.
M3. Worktree layout
M3 adds the optional Worktree layout while keeping Session as the default. The sidebar groups main working directories and Maka-managed worktrees by project. Each directory provides session tabs, history, and a new-conversation entry point. It restores open tabs, the selected session, and panel state, and exposes background execution, input requests, failures, and unread results. Terminals, available Actions, files, and changes remain accessible from the directory.
Acceptance requires that switching between layouts preserves the current session, directory, history, and running resources. Closing a tab only changes presentation and does not stop execution. Switching layouts does not create resources, rerun setup, or launch extra commands. M3 reuses the directory and execution contracts completed in M2.
Acceptance across milestones
Each milestone covers its corresponding operations in both desktop and terminal interfaces. ACP follows the same permissions and lifecycle restrictions. Release verification applies to the behavior introduced by that milestone, including interruption recovery, concurrent clients, and migration where relevant. M2 does not wait for M3 to be released. Completion of one milestone does not imply completion of all proposal capabilities.
The full acceptance matrix is:
Also test concurrent clients, successful operations whose replies are lost, restart at intermediate stages, and external directory or Git changes.
Performance verification specifies project, worktree, and session counts, the test environment, navigation latency, and Git refresh cost. Tests use the repository's shared CI entry points rather than a separate test scheduler.
16. Alternatives and follow-up evaluation
After release, evaluate whether users can identify their working directory and recover background sessions and resources, alongside the reliability of creation, setup, migration, and deletion recovery.
Whether to keep both layouts indefinitely or change the default is a separate community decision. This proposal does not commit to removing the Session layout.
Prepared and posted with OpenAI Codex assistance.
中文版(点击展开)
状态:Draft,供社区讨论。
范围调整:项目 Action 的配置与执行需求统一维护在独立 feature #6946。本提案保留 worktree 权限与生命周期集成要求。Action 交付不作为本提案的发布前提,Action 也不依赖完整 worktree 工作流。
1. 背景与目标
Maka 当前以 session 作为主要交互入口。围绕独立分支并行开发时,同一项任务可能需要多个 session、终端和开发进程共同完成。工作目录的归属、初始化状态、运行中的服务和任务收尾因此分散在不同入口。
本提案将 worktree 提升为独立的工作单元。一个 worktree 承载任务名称、代码环境、session 集合和运行资源,其生命周期独立于单个 session。
Session 保持默认导航布局。里程碑 M2 在该布局中交付完整 worktree 工作流,里程碑 M3 再提供可选的 Worktree 布局。两种布局共用同一套数据、资源归属和生命周期,只改变导航方式。是否调整默认布局或长期统一导航,在实际使用评估后另行讨论。
本提案的目标是:
按第 15 节的里程碑分批交付。每个里程碑覆盖桌面和终端界面的对应操作。ACP 保证现有会话可继续使用,并遵守相同的权限和生命周期约束。M2 可以在 M3 的可选 Worktree 布局完成前发布。
本提案不增加外部 Git worktree 的自动发现与导入、跨仓库任务编排、自动解决多 session 代码冲突、自动合并或发布能力。Worktree 也不提供端口、数据库和外部服务的隔离。
2. 需求开发流程示例
以下流程图展示新建 worktree 后的成功路径。Setup 与异步命名可以并行执行,首个 agent 在两者完成后启动。
flowchart TD A["选择项目,创建 Worktree<br/>使用临时名称和分支"] --> B["执行 Setup,准备环境"] A --> C["发送首条需求消息"] C --> D["异步生成并应用任务名和分支名"] B --> E["Setup 与命名完成<br/>启动 Session 开发"] D --> E E <--> F["Action 可用时运行项目命令<br/>启动服务、测试与构建"] E --> G["验收改动,提交代码,进入 PR 流程"] G --> H["需求完成,删除 Worktree"] H --> I["停止 Session、终端与 Action"] I --> J["删除目录和会话历史<br/>保留 Git 分支"]复用已有 worktree 时,通过已有 session 或新 session 进入开发阶段,不重复创建目录,也不自动重复 setup 或首条消息命名。
3. 对象与资源归属
Worktree 使用稳定身份。显示名、分支名和目录路径分别保存,不能作为唯一身份。显示名或分支名变化不会移动目录。
同一仓库的主 checkout 与关联 worktree 属于同一个项目。独立 clone 不因 remote URL 相同而自动合并为同一个项目。
主 checkout 显示为“主工作目录”。普通目录保留现有项目语义,支持 session、终端和命令操作,不展示 Git 分支功能。两者也具有稳定的工作目录身份,用于关联资源,但不因此获得删除用户目录的权限。
已有 session 选择的是仓库子目录时,保留其实际工作目录和权限范围,不自动扩大到整个仓库。
Worktree 可以没有 session。关闭最后一个 tab 不会删除 worktree,也不会停止其终端或开发服务器。
4. 导航与新建 Session
设置提供“导航布局:Session〔默认〕 / Worktree”。切换布局保留当前 session、工作目录、运行资源和各自的布局状态,不创建或删除资源。
在 Session 布局下,新建对话界面增加工作目录选择按钮,支持:
从明确的 session、worktree 或项目目录上下文进入时,预选对应工作目录。没有明确目录上下文时,默认选择所选项目的主工作目录;尚未选择项目时,先选择项目。按钮始终显示当前选择,不自动创建 worktree。
在 Worktree 布局下,左侧按项目展示主工作目录和 Maka 管理的 worktree。选择后,聊天区域顶部展示该工作单元的 session tabs。新建 session 必须发生在指定的 worktree、主工作目录或普通目录入口内。
切换工作单元时,恢复各自打开的 tabs、当前 session 和面板状态。
5. 新建 Worktree
项目入口、Worktree 列表及 Session 布局的目录选择器提供“新建 worktree”操作。创建窗口包含所属项目、基础引用、工作区名称、分支前缀、完整分支名预览,以及是否执行 setup。
基础引用默认使用项目配置;未配置时使用可从本地 Git 信息确定的仓库默认分支。无法确定时要求用户选择,不猜测为
main或master。创建使用本地已有引用,不隐式 fetch。引用不存在或不可用时,展示原因。创建记录保留实际解析出的基础 commit,新目录不继承其他工作目录中的未提交修改。
默认生成临时名称,例如:
用户可以直接填写正式名称。创建前检查名称冲突、分支名合法性、目录占用和仓库支持情况;实际创建时再次校验。
创建过程展示“创建分支和目录 → 执行 setup → 就绪”。创建结果不确定时,通过原操作记录核对结果。重试不能重复创建分支或目录。
目录已经创建但 setup 失败时,保留 worktree,提供日志、重试和明确跳过的入口。Setup 重试不会重新创建分支和目录。
不支持的仓库状态或特性必须明确拒绝。实现设计需列出空仓库、detached HEAD、submodule 和稀疏 checkout 等情况的支持范围。
6. Setup 与首次任务启动
Setup 属于项目,在设置中配置,不新增专用仓库配置文件。命令可以调用项目已有脚本。
新建 worktree 时默认执行 setup,用户可以在创建时选择跳过。已有 worktree 再次打开、恢复 session 或新建 session 时,不自动重复执行。
Setup 在 worktree 目录中运行,展示执行命令、输出、状态和退出结果。创建后立即执行,因此可能读取临时分支名。后续分支改名不会自动重跑 setup,也不会改写 setup 已经生成的文件。
初始化期间,用户可以发送任务。Maka 保存消息并显示“等待初始化”,待启动消息可以取消。首个 agent 只有在以下条件同时满足后才能启动:
Setup 失败时,已保存的消息继续等待。用户重试成功或明确跳过后,再继续启动流程。
用户修改项目 setup 配置后点击“重试”,执行当前配置,并显示将执行的命令。每次运行独立保存命令、日志和结果,旧记录不随配置变化而改变。
重试意味着重新执行命令,不意味着 Maka 已回滚上一次执行产生的文件或其他副作用。
7. 基于首条消息的自动命名
临时命名的 worktree 首条被接受的用户任务消息触发一次自动命名。例如,“调整设置页的项目管理”可以生成显示名“完善项目管理”,以及分支名
feat/improve-project-management。命名前缀作为独立的项目配置。AI 生成任务显示名和分支名称主体,完整分支名由前缀与名称主体组合。
自动分支改名仅适用于 Maka 自动命名、未被用户手动改名且未配置 upstream 的分支。Upstream 检查失败时跳过自动改名。
这一规则不保证识别所有通过外部工具完成的 push。界面和文档不能将“未配置 upstream”表述为“已确认从未 push”。
应用生成结果前,重新检查 worktree 仍允许执行改名、用户没有手动改名、当前分支仍是生成开始时的分支、分支仍未配置 upstream,以及新分支名合法且不存在冲突。
检查失败、名称冲突、生成失败或超时时,保留原名称并继续任务,不强制覆盖已有分支。
同一 worktree 的多个 session 同时发送首条消息时,只认领一次命名机会。命名处理有有限超时;首次尝试失败或超时后不后台补做,迟到结果也不应用。
用户始终可以手动修改显示名。手动修改分支名作为明确操作提供,展示结果和失败原因。显示名与分支名变化均不移动目录。
8. 在已有 Worktree 上继续工作
“新建 worktree”和“在已有 worktree 上继续”是两个明确入口。复用列表只展示 Maka 管理的用户 worktree,包含任务名称、分支、最近使用时间和必要的异常状态。路径与初始化日志放在详情中。
内部隔离执行产生的临时 worktree,不因由 Maka 创建就自动进入用户复用列表。
选择已有 worktree 后,用户可以打开已有 session,恢复原来的讨论;也可以创建新 session,围绕相同代码开启新的讨论。两者均不会重新创建分支,也不会自动重复 setup。
主工作目录和普通目录保留各自入口。历史 session 已绑定外部 worktree 时,迁移保留其访问和历史,不因此授予 Maka 删除该目录的权限。
9. Session Tabs、归档与后台状态
Session tabs 支持新建、切换和关闭。关闭只收起 tab,不停止执行。用户可以从所属工作单元的会话列表重新打开。
每个工作单元保存打开的 tabs 和当前选择。应用重新打开后恢复布局,运行状态则依据真实执行记录重新核对,不能把布局恢复视为进程已经恢复。
运行、等待用户回复、失败和未读结果分别展示。后台 session 等待回复时,所属 worktree 显示提示,进入后可以定位到具体 session。终端和 Action 状态不随聊天 tab 切换而丢失。
Session 保留单独归档与恢复能力。归档沿用现有生命周期规则:存在执行、排队消息、待处理交互或未完成清理时拒绝归档,提示用户先处理。
归档 session 保留历史,不删除所属 worktree,不自动停止 worktree 级终端或 Action。恢复 session 不自动重跑命令。
Worktree 不提供归档与恢复操作。用户需要保留代码环境时继续保留 worktree,可以单独归档其中的 session。
10. 终端、Action 集成与权限
项目 Action 的配置、命令快照、运行操作、重复运行处理及恢复规则统一维护在 feature #6946。它可以面向已有项目目录独立交付,无需依赖本提案。
Action 可用时,worktree 集成共用项目定义,每次运行绑定具体工作目录。Worktree 不隔离端口、数据库或外部服务。
用户可以在 worktree 内统一管理运行资源。Agent 的读取、输入和停止权限仍按原授权执行,共享目录不会使只读 session 获得其他 session 或用户终端的控制权。
用户启动的终端、setup、Action,以及 agent 工具调用产生的进程,保留各自的执行约束和收尾责任。统一展示资源不改变授权。
关闭 tab、退出客户端、Host 重启和停止进程分别处理。重新打开界面时,能够核实存活身份的资源恢复连接;无法确认的资源显示不可用或状态未知,不通过重跑命令模拟恢复。
11. 并发开发、提交与 PR
同一 worktree 允许多个 session 并发执行。界面明确提示它们共享文件、分支和 Git 暂存区。
Git 改动、暂存和提交始终属于整个 worktree,不承诺自动划分每个 session 的代码贡献。其他 session 正在执行时仍允许提交,但提交入口必须展示整个 worktree 的改动,并提示并发执行可能继续改变内容。
用户需要隔离代码改动时,应创建另一个 worktree。查看改动、提交和进入 PR 流程的入口绑定当前 worktree 的实际目录和当前分支。创建基础引用、push 目标和 PR 目标分别确认,不能默认视为同一个配置。
外部终端或编辑器改变分支、HEAD、暂存区或目录后,Maka 刷新相关状态。依赖旧状态的管理操作应重新检查。自动合并和发布复用既有能力,不在本提案中新增。
12. 设置中的项目管理
项目管理展示主工作目录和 Maka 管理的用户 worktree,提供打开、新建、查看详情和删除入口。同一页面维护默认基础引用、命名前缀和 setup 命令。项目 Action 设置由 feature #6946 单独维护。
列表优先展示名称和必要状态。路径、分支详情、初始化日志及删除失败原因进入详情查看。
普通目录和主工作目录不提供删除工作目录的操作。移除项目管理记录与删除用户目录必须保持明确区别。
13. 删除 Worktree
删除 worktree 会永久移除其工作目录,以及归属于该 worktree 的全部 session 和聊天历史,包括已归档的 session。Git 分支不随 worktree 自动删除。
删除确认展示名称、分支、实际路径、受影响的 session 与历史、运行资源、未提交及未跟踪文件,以及未推送提交或无法确定发布状态的说明。同时说明,被忽略的本地文件也会随目录删除。
存在未提交内容或未推送提交时,提示用户风险,并提供明确的“强制删除”入口。保留 Git 分支不等于保留未提交内容。
删除按以下顺序执行:
发送停止请求不等于资源已经结束。某个资源无法正常停止时,删除保持受阻,保留记录并列出原因。用户可以明确选择强制停止资源,再重试删除。已经停止的资源不会因为删除受阻而自动重启。
强制删除允许用户确认丢弃目录内容,但不能绕过运行资源尚未结束的检查。Maka 不承诺能识别或停止所有外部程序。
删除前发现确认后的内容变化时,重新展示变化并要求确认。目录缺失、被替换或归属不匹配时,不根据相同路径猜测并删除替代目录。
目录清理失败时保留会话和管理记录。目录已清理但数据清理失败时,保留“删除未完成”状态,允许重试。应用重启后继续核对原删除操作,不把部分完成的删除显示为普通可用 worktree。
共享附件或其他仍被保留会话引用的数据,按引用关系清理,不能因删除一个 worktree 而破坏其他会话。
首期不提供回收站,也不承诺恢复已完成的删除。
14. 数据、执行约束与迁移
生命周期、初始化状态、目录可用性和运行状态分别表达。
生命周期限制由共享服务执行,所有客户端遵守相同规则,不能只通过界面禁用按钮实现。
创建、命名、setup 启动和删除保留可核对的操作记录。请求回复丢失时查询原操作结果,不将未知结果当作未执行,也不通过新请求重复创建资源。
列表读取持久化的目录和状态摘要。Git 状态按需刷新,不在每次导航渲染时扫描所有仓库或加载全部聊天历史。Git 和文件系统耗时操作不得阻塞异步执行器,并需要支持取消与实际收尾。
已有 session 按实际目录归入对应工作单元,保留历史、session 身份、当前选择、原始工作目录和权限。迁移不搬迁代码,不自动重命名旧分支,也不为普通目录创建 Git worktree。迁移还须满足:
已有终端归属调整保留可验证的运行关联,不重新启动命令。跨 Host 重启无法继续连接的资源明确显示不可用。
发布前提供数据备份与迁移失败恢复方案,并说明升级后的版本兼容范围。切回 Session 布局只改变导航,不回退数据模型。
15. 交付里程碑与验收
按三个里程碑交付。每个里程碑提供可独立使用的结果,并有各自的验收标准。一个里程碑可以包含多个 PR,各阶段共用一致的数据和资源契约。
M1. 独立项目 Action
Action 配置与执行需求仍由 feature #6946 维护。M1 说明它在交付路线中的位置,不将需求重新并入本提案。Action 保持独立交付,不作为 M2 或 M3 的发布前提。
M1 覆盖已有项目目录中的 Action 设置、运行操作、输出、状态、命令快照、重复运行处理与恢复。Action 定义属于项目,每次运行属于具体目录,并保存实际执行的命令。本阶段建立最小稳定目录身份和资源归属契约。创建 worktree 和完整 worktree 生命周期留到 M2。
验收要求切换或关闭 session 后仍能管理 Action 运行实例。修改定义不改变已有运行。同一目录重复点击默认定位活跃实例,另开实例需要明确操作。重启后核对真实资源状态,不静默重跑命令。
M2. Session 布局下的完整 Worktree 工作流
M2 是一个产品里程碑,内部按四个可分别验证的步骤交付。以下是交付步骤,运行时 setup 与自动命名仍可并行。
M2 同时保证文件访问、终端、可用的 Action、改动查看和提交入口使用实际选中的目录。每个 session 保留自己的权限范围。目录缺失或身份不匹配时保留历史,阻止新的目录执行。
M2 的完成标准是用户仅通过 Session 布局就能完成整个 worktree 生命周期,包括创建、自动命名、setup 失败与重试、开发、重启恢复和安全清理。该工作流不依赖 M3。
M3. Worktree 布局
M3 增加可选 Worktree 布局,Session 仍为默认布局。左侧按项目展示主工作目录和 Maka 管理的 worktree。每个目录提供 session tabs、历史对话和新建对话入口,恢复已打开 tabs、当前 session 和面板状态,并展示后台执行、等待输入、失败及未读结果。终端、可用的 Action、文件和改动继续从目录访问。
验收要求切换布局后保留当前 session、目录、历史和运行资源。关闭 tab 只改变展示,不停止执行。切换布局不创建资源、不重跑 setup、不启动额外命令。M3 复用 M2 已完成的目录和执行契约。
各里程碑的验收要求
每个里程碑覆盖桌面和终端界面的对应操作,ACP 遵守相同的权限和生命周期限制。发布验证针对本里程碑引入的行为,覆盖相关的中断恢复、客户端并发和数据迁移。M2 无需等待 M3 即可发布。完成某个里程碑不代表本提案全部能力已经交付。
完整验收矩阵如下:
同时覆盖双客户端并发、操作成功但回复丢失、各阶段中断后重启,以及外部修改目录或 Git 状态的情况。
性能验收使用明确的项目、worktree 和 session 规模,记录测试环境、导航延迟和 Git 刷新成本。测试接入仓库统一 CI 入口,不另建独立测试调度体系。
16. 方案取舍与后续评估
发布后重点评估用户能否准确识别工作目录、找回后台会话和运行资源,以及创建、初始化、迁移和删除失败后的恢复效果。
两种布局是否长期并存、是否调整默认布局,通过后续社区讨论决定,不在本提案中承诺移除 Session 布局。
All reactions