Quick Start
1
Default (No Isolation)
Every run shares the same directory — the behaviour you already have.
2
Concurrent Agents With Isolation
Give each agent its own git worktree — edits stay independent.
3
Reset or Remove
Restore a worktree to a clean state, or tear it down when the run ends.
How It Works
GitWorktreeAdapter runs real git worktree commands to provision a fresh branch and directory per run.
When the directory is not a git repository, every method degrades gracefully —
create and path return the original directory, and reset and remove do nothing.
Choosing an Adapter
Both adapters share the same interface, so you can swap them without changing your code.GitWorktreeAdapter is always safe — if the directory is not a git repo it falls back to NoIsolationAdapter behaviour automatically.
Configuration Options
GitWorktreeAdapter accepts three options.
available attribute is True only when root is inside a git repository and git is on the PATH.
NoIsolationAdapter accepts a single root option (str | Path | None, default Path.cwd()) that it returns from create and path.
Common Patterns
Give parallel sub-agents their own worktrees.create is idempotent.
Best Practices
Use GitWorktreeAdapter unconditionally
Use GitWorktreeAdapter unconditionally
It degrades gracefully outside git repos, so you can always reach for it. No need to detect git yourself —
available reports the state and non-git directories simply fall back to shared behaviour.Name worktrees by agent or run, not by task
Name worktrees by agent or run, not by task
Names are hashed into collision-resistant slugs, so
"agent one" and "agent-one" never share a worktree. Stable names keep create idempotent across retries.Clean up with remove() when the run ends
Clean up with remove() when the run ends
Each worktree lives under
.praisonai/worktrees/. Call remove() on completion to stop that directory from growing over long-running sessions.Requires git ≥ 2.5
Requires git ≥ 2.5
git worktree was introduced in git 2.5. On older git or non-git directories, isolation is unavailable and the adapter falls back to the shared directory.Related
Multi-Agent Context Safety
Isolate per-agent runtime and resolver state — the context half of concurrency.
Code & Workspace Access
Contain file operations to a workspace with read/write access controls.

