mutai 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mutai-0.1.0/PKG-INFO +220 -0
- mutai-0.1.0/README.md +198 -0
- mutai-0.1.0/mut/__init__.py +3 -0
- mutai-0.1.0/mut/__main__.py +4 -0
- mutai-0.1.0/mut/cli.py +324 -0
- mutai-0.1.0/mut/core/__init__.py +0 -0
- mutai-0.1.0/mut/core/diff.py +45 -0
- mutai-0.1.0/mut/core/ignore.py +27 -0
- mutai-0.1.0/mut/core/manifest.py +33 -0
- mutai-0.1.0/mut/core/merge.py +375 -0
- mutai-0.1.0/mut/core/object_store.py +160 -0
- mutai-0.1.0/mut/core/protocol.py +286 -0
- mutai-0.1.0/mut/core/scope.py +37 -0
- mutai-0.1.0/mut/core/snapshot.py +165 -0
- mutai-0.1.0/mut/core/tree.py +132 -0
- mutai-0.1.0/mut/foundation/__init__.py +0 -0
- mutai-0.1.0/mut/foundation/config.py +93 -0
- mutai-0.1.0/mut/foundation/credentials.py +58 -0
- mutai-0.1.0/mut/foundation/error.py +66 -0
- mutai-0.1.0/mut/foundation/fs.py +166 -0
- mutai-0.1.0/mut/foundation/hash.py +16 -0
- mutai-0.1.0/mut/foundation/transport.py +199 -0
- mutai-0.1.0/mut/ops/__init__.py +0 -0
- mutai-0.1.0/mut/ops/checkout_op.py +23 -0
- mutai-0.1.0/mut/ops/clone_op.py +90 -0
- mutai-0.1.0/mut/ops/commit_op.py +31 -0
- mutai-0.1.0/mut/ops/diff_op.py +16 -0
- mutai-0.1.0/mut/ops/init_op.py +22 -0
- mutai-0.1.0/mut/ops/log_op.py +8 -0
- mutai-0.1.0/mut/ops/notify_op.py +173 -0
- mutai-0.1.0/mut/ops/pull_op.py +129 -0
- mutai-0.1.0/mut/ops/push_op.py +109 -0
- mutai-0.1.0/mut/ops/repo.py +24 -0
- mutai-0.1.0/mut/ops/rollback_op.py +32 -0
- mutai-0.1.0/mut/ops/show_op.py +33 -0
- mutai-0.1.0/mut/ops/stats_op.py +13 -0
- mutai-0.1.0/mut/ops/status_op.py +21 -0
- mutai-0.1.0/mut/ops/tree_op.py +14 -0
- mutai-0.1.0/mut/server/__init__.py +0 -0
- mutai-0.1.0/mut/server/__main__.py +132 -0
- mutai-0.1.0/mut/server/audit.py +53 -0
- mutai-0.1.0/mut/server/auth/__init__.py +16 -0
- mutai-0.1.0/mut/server/auth/api_key.py +137 -0
- mutai-0.1.0/mut/server/auth/base.py +37 -0
- mutai-0.1.0/mut/server/auth/no_auth.py +35 -0
- mutai-0.1.0/mut/server/graft.py +98 -0
- mutai-0.1.0/mut/server/handlers.py +475 -0
- mutai-0.1.0/mut/server/history.py +402 -0
- mutai-0.1.0/mut/server/notification.py +152 -0
- mutai-0.1.0/mut/server/repo.py +369 -0
- mutai-0.1.0/mut/server/scope_manager.py +155 -0
- mutai-0.1.0/mut/server/server.py +657 -0
- mutai-0.1.0/mut/server/sync_queue.py +96 -0
- mutai-0.1.0/mut/server/websocket.py +218 -0
- mutai-0.1.0/mutai.egg-info/PKG-INFO +220 -0
- mutai-0.1.0/mutai.egg-info/SOURCES.txt +86 -0
- mutai-0.1.0/mutai.egg-info/dependency_links.txt +1 -0
- mutai-0.1.0/mutai.egg-info/entry_points.txt +3 -0
- mutai-0.1.0/mutai.egg-info/top_level.txt +1 -0
- mutai-0.1.0/pyproject.toml +42 -0
- mutai-0.1.0/setup.cfg +4 -0
- mutai-0.1.0/tests/test_async_server.py +297 -0
- mutai-0.1.0/tests/test_auth.py +134 -0
- mutai-0.1.0/tests/test_auth_enhanced.py +163 -0
- mutai-0.1.0/tests/test_diff.py +80 -0
- mutai-0.1.0/tests/test_error_hierarchy.py +62 -0
- mutai-0.1.0/tests/test_fs.py +118 -0
- mutai-0.1.0/tests/test_graft.py +100 -0
- mutai-0.1.0/tests/test_handlers.py +220 -0
- mutai-0.1.0/tests/test_history.py +122 -0
- mutai-0.1.0/tests/test_ignore.py +39 -0
- mutai-0.1.0/tests/test_integration_v4.py +313 -0
- mutai-0.1.0/tests/test_manifest.py +52 -0
- mutai-0.1.0/tests/test_merge.py +95 -0
- mutai-0.1.0/tests/test_merge_strategies.py +257 -0
- mutai-0.1.0/tests/test_notification.py +240 -0
- mutai-0.1.0/tests/test_object_store.py +70 -0
- mutai-0.1.0/tests/test_ops.py +283 -0
- mutai-0.1.0/tests/test_protocol.py +164 -0
- mutai-0.1.0/tests/test_rollback.py +169 -0
- mutai-0.1.0/tests/test_scope.py +40 -0
- mutai-0.1.0/tests/test_scope_migration.py +154 -0
- mutai-0.1.0/tests/test_server_repo.py +151 -0
- mutai-0.1.0/tests/test_snapshot.py +105 -0
- mutai-0.1.0/tests/test_storage_backend.py +130 -0
- mutai-0.1.0/tests/test_sync_queue.py +143 -0
- mutai-0.1.0/tests/test_tree.py +87 -0
- mutai-0.1.0/tests/test_v4_features.py +338 -0
mutai-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mutai
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Managed Unified Tree — version management for AI agents
|
|
5
|
+
Author-email: PuppyOne <hello@puppyone.ai>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/puppyone-ai/mut
|
|
8
|
+
Project-URL: Repository, https://github.com/puppyone-ai/mut
|
|
9
|
+
Project-URL: Issues, https://github.com/puppyone-ai/mut/issues
|
|
10
|
+
Keywords: version-control,ai-agents,context-management,multi-agent,mut
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Version Control
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
<p align="center">
|
|
24
|
+
<img src="assets/MUT.svg" alt="Mut Logo" width="200">
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
# Mut
|
|
28
|
+
|
|
29
|
+
Mut is version control for context - built for multi-agent collaboration.
|
|
30
|
+
|
|
31
|
+
- **Centralized context** — the server holds the single source of truth. All agents push to and pull from one place. No diverging copies, no conflicts.
|
|
32
|
+
- **Per-agent scopes** — each agent has its own scope (e.g. Agent A on `/src/`, Agent B on `/docs/`). Agents collaborate on the same project, but each one only sees and writes the context it's permitted to access.
|
|
33
|
+
|
|
34
|
+
## Old World vs New World
|
|
35
|
+
|
|
36
|
+
| | Old World (Git) | New World (Mut) |
|
|
37
|
+
|---|---|---|
|
|
38
|
+
| **For whom** | Humans | AI Agents |
|
|
39
|
+
| **Branches** | Decentralized — every branch is equal, no single truth | Centralized — one source-of-truth branch, agents sync from it |
|
|
40
|
+
| **Conflicts** | Surface on merge / push — require human resolution | Auto-resolved by the server — push never fails |
|
|
41
|
+
| **Access** | All developers see the full repo | Each agent only sees the files within its scope |
|
|
42
|
+
|
|
43
|
+
### 1. One Source of Truth, Not Scattered Branches
|
|
44
|
+
|
|
45
|
+
**Old World (Git)**
|
|
46
|
+
|
|
47
|
+
Two agents update the same `customers.json` — one collects from calls, the other from emails. Each works on its own branch. Which branch has the full list? Neither. The data splits, conflicts follow.
|
|
48
|
+
|
|
49
|
+
**New World (Mut)**
|
|
50
|
+
|
|
51
|
+
There's one context on the server. Both agents push to the same place. The server merges automatically. No branches to choose from, no data drift.
|
|
52
|
+
|
|
53
|
+
### 2. Per-Agent Scopes, Not Full Access
|
|
54
|
+
|
|
55
|
+
**Old World (Git)**
|
|
56
|
+
|
|
57
|
+
A company runs two agents on the same project: a customer-facing chatbot that reads product docs, and an internal BI agent that reads financial reports. Both get full repo access — the chatbot can see revenue numbers, the BI agent can overwrite customer content. Sensitive data leaks across boundaries that should never be crossed.
|
|
58
|
+
|
|
59
|
+
**New World (Mut)**
|
|
60
|
+
|
|
61
|
+
Each agent gets a scope. The chatbot reads `/docs/`, the BI agent reads `/reports/`. Same project, naturally isolated.
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
## Quick Start
|
|
65
|
+
|
|
66
|
+
### Architecture Overview
|
|
67
|
+
|
|
68
|
+
Mut has two components that run separately:
|
|
69
|
+
|
|
70
|
+
- **Server** (`mut-server`) — the centralized source of truth. Hosts the project context and handles merges. Typically runs on a dedicated machine or cloud instance so all agents can reach it. Creates a `.mut-server/` directory to store objects, scopes, and history.
|
|
71
|
+
- **Client** (`mut`) — runs wherever your agent runs. Clones the context, commits changes locally, and pushes/pulls to/from the server. Creates a `.mut/` directory inside your workspace to track local state.
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
┌─────────────┐ ┌─────────────────┐
|
|
75
|
+
│ Agent A │ push → │ │
|
|
76
|
+
│ (client) │ ← pull │ Server │
|
|
77
|
+
└─────────────┘ │ (source of │
|
|
78
|
+
│ truth) │
|
|
79
|
+
┌─────────────┐ │ │
|
|
80
|
+
│ Agent B │ push → │ │
|
|
81
|
+
│ (client) │ ← pull │ │
|
|
82
|
+
└─────────────┘ └─────────────────┘
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Example: Two OpenClaw Agents Sharing Context
|
|
86
|
+
|
|
87
|
+
You have two [OpenClaw](https://github.com/openclawx/openclaw) agents. Agent A handles customer conversations via WhatsApp. Agent B runs BI analysis on internal data. Each has its own workspace folder — that folder is its context.
|
|
88
|
+
|
|
89
|
+
**Without Mut:** Each OpenClaw workspace is a plain folder — no version history, no rollback. If an agent corrupts a file, it's gone. You can't see what all your agents are working on in one place. There's no way to govern or audit agent context across machines.
|
|
90
|
+
|
|
91
|
+
**With Mut:** You run `mut-server` on a VPS (or one of the machines) as the single source of truth. Every change is versioned — you can roll back anytime. All agent context is visible in one place. With scopes, Agent A can only write to `/conversations/`, Agent B can only write to `/reports/`. Version control, visibility, and governance — built in.
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
┌─────────────────┐ ┌─────────────────────┐
|
|
95
|
+
│ OpenClaw #1 │ push → │ Server │
|
|
96
|
+
│ workspace-1/ │ ← pull │ ├── workspace-1/ │
|
|
97
|
+
│ ├── convos/ │ │ │ ├── convos/ │
|
|
98
|
+
│ └── reports/ │ │ │ └── reports/ │
|
|
99
|
+
│ └── .mut/ │ │ ├── workspace-2/ │
|
|
100
|
+
└─────────────────┘ │ │ ├── tasks/ │
|
|
101
|
+
│ │ └── logs/ │
|
|
102
|
+
┌─────────────────┐ │ └── .mut-server/ │
|
|
103
|
+
│ OpenClaw #2 │ push → │ │
|
|
104
|
+
│ workspace-2/ │ ← pull │ │
|
|
105
|
+
│ ├── tasks/ │ │ │
|
|
106
|
+
│ └── logs/ │ │ │
|
|
107
|
+
│ └── .mut/ │ │ │
|
|
108
|
+
└─────────────────┘ └─────────────────────┘
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
> **Tip:** For local development or testing, you can run both `mut-server` and `mut` on the same machine — the server just uses a local folder as its store.
|
|
112
|
+
|
|
113
|
+
### 1. Install
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
pip install mutai
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
This installs both `mut` (client) and `mut-server` (server) commands.
|
|
120
|
+
|
|
121
|
+
### 2. Setup (One-Time)
|
|
122
|
+
|
|
123
|
+
**Server — on the machine that hosts the source of truth:**
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
mut-server init ./my-project --name my-project
|
|
127
|
+
mut-server add-scope ./my-project --id scope-src --scope-path "/src/"
|
|
128
|
+
mut-server issue-credential ./my-project --scope scope-src --agent agent-1 --mode rw
|
|
129
|
+
# → prints a credential key, save it for the agent
|
|
130
|
+
mut-server serve ./my-project --port 9742
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Client — on the machine where your agent runs:**
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
mut clone http://<server-host>:9742 --credential <CREDENTIAL>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Done. The agent now has a local copy of the context in `my-project/`.
|
|
140
|
+
|
|
141
|
+
### 3. Daily Usage
|
|
142
|
+
|
|
143
|
+
**Sync local changes to server:**
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
mut commit -m "update customer records"
|
|
147
|
+
mut push
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Pull latest context from server (other agents' changes):**
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
mut pull
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Check what changed locally:**
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
mut status
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**View history:**
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
mut log
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Roll back to a previous version:**
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
mut checkout <snapshot-id>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
**Core concepts:**
|
|
176
|
+
|
|
177
|
+
- **Content-addressable storage** — files are stored by SHA-256 hash, identical content stored once
|
|
178
|
+
- **Merkle tree** — directory structure is a hash tree; changing one file recomputes hashes up to the root
|
|
179
|
+
- **Scopes** — each agent gets a path prefix (e.g. `/src/`) with read/write permissions
|
|
180
|
+
- **Server-side merge** — when two agents modify the same scope, the server runs three-way merge (line-level, JSON key-level, then LWW fallback)
|
|
181
|
+
- **Grafting** — after a push, the server replaces the agent's subtree in the full project tree and recomputes the root hash
|
|
182
|
+
|
|
183
|
+
## Commands
|
|
184
|
+
|
|
185
|
+
### Agent CLI (`mut`)
|
|
186
|
+
|
|
187
|
+
| Command | Description |
|
|
188
|
+
|---|---|
|
|
189
|
+
| `mut clone <url>` | Clone from server (supports invite URLs) |
|
|
190
|
+
| `mut register <invite-url>` | Register with a server using an invite |
|
|
191
|
+
| `mut status` | Show uncommitted changes |
|
|
192
|
+
| `mut commit -m "msg"` | Snapshot the working directory |
|
|
193
|
+
| `mut push` | Push commits to server |
|
|
194
|
+
| `mut pull` | Pull changes from server |
|
|
195
|
+
| `mut log` | Show commit history |
|
|
196
|
+
| `mut diff <id1> <id2>` | Compare two snapshots |
|
|
197
|
+
| `mut checkout <id>` | Restore to a previous snapshot |
|
|
198
|
+
| `mut show <id>:<path>` | Show a file at a specific snapshot |
|
|
199
|
+
| `mut tree <id>` | Show Merkle tree structure |
|
|
200
|
+
| `mut stats` | Repository statistics |
|
|
201
|
+
|
|
202
|
+
### Server CLI (`mut-server`)
|
|
203
|
+
|
|
204
|
+
| Command | Description |
|
|
205
|
+
|---|---|
|
|
206
|
+
| `mut-server init <path>` | Initialize a server repository |
|
|
207
|
+
| `mut-server create-invite <path>` | Generate an invite URL for agents |
|
|
208
|
+
| `mut-server add-scope <path>` | Manually add a scope + assign agents |
|
|
209
|
+
| `mut-server issue-token <path>` | Manually issue an API key |
|
|
210
|
+
| `mut-server serve <path>` | Start the HTTP server |
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
## Requirements
|
|
214
|
+
|
|
215
|
+
- Python 3.9+
|
|
216
|
+
- No external dependencies (stdlib only)
|
|
217
|
+
|
|
218
|
+
## License
|
|
219
|
+
|
|
220
|
+
MIT
|
mutai-0.1.0/README.md
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/MUT.svg" alt="Mut Logo" width="200">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# Mut
|
|
6
|
+
|
|
7
|
+
Mut is version control for context - built for multi-agent collaboration.
|
|
8
|
+
|
|
9
|
+
- **Centralized context** — the server holds the single source of truth. All agents push to and pull from one place. No diverging copies, no conflicts.
|
|
10
|
+
- **Per-agent scopes** — each agent has its own scope (e.g. Agent A on `/src/`, Agent B on `/docs/`). Agents collaborate on the same project, but each one only sees and writes the context it's permitted to access.
|
|
11
|
+
|
|
12
|
+
## Old World vs New World
|
|
13
|
+
|
|
14
|
+
| | Old World (Git) | New World (Mut) |
|
|
15
|
+
|---|---|---|
|
|
16
|
+
| **For whom** | Humans | AI Agents |
|
|
17
|
+
| **Branches** | Decentralized — every branch is equal, no single truth | Centralized — one source-of-truth branch, agents sync from it |
|
|
18
|
+
| **Conflicts** | Surface on merge / push — require human resolution | Auto-resolved by the server — push never fails |
|
|
19
|
+
| **Access** | All developers see the full repo | Each agent only sees the files within its scope |
|
|
20
|
+
|
|
21
|
+
### 1. One Source of Truth, Not Scattered Branches
|
|
22
|
+
|
|
23
|
+
**Old World (Git)**
|
|
24
|
+
|
|
25
|
+
Two agents update the same `customers.json` — one collects from calls, the other from emails. Each works on its own branch. Which branch has the full list? Neither. The data splits, conflicts follow.
|
|
26
|
+
|
|
27
|
+
**New World (Mut)**
|
|
28
|
+
|
|
29
|
+
There's one context on the server. Both agents push to the same place. The server merges automatically. No branches to choose from, no data drift.
|
|
30
|
+
|
|
31
|
+
### 2. Per-Agent Scopes, Not Full Access
|
|
32
|
+
|
|
33
|
+
**Old World (Git)**
|
|
34
|
+
|
|
35
|
+
A company runs two agents on the same project: a customer-facing chatbot that reads product docs, and an internal BI agent that reads financial reports. Both get full repo access — the chatbot can see revenue numbers, the BI agent can overwrite customer content. Sensitive data leaks across boundaries that should never be crossed.
|
|
36
|
+
|
|
37
|
+
**New World (Mut)**
|
|
38
|
+
|
|
39
|
+
Each agent gets a scope. The chatbot reads `/docs/`, the BI agent reads `/reports/`. Same project, naturally isolated.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
### Architecture Overview
|
|
45
|
+
|
|
46
|
+
Mut has two components that run separately:
|
|
47
|
+
|
|
48
|
+
- **Server** (`mut-server`) — the centralized source of truth. Hosts the project context and handles merges. Typically runs on a dedicated machine or cloud instance so all agents can reach it. Creates a `.mut-server/` directory to store objects, scopes, and history.
|
|
49
|
+
- **Client** (`mut`) — runs wherever your agent runs. Clones the context, commits changes locally, and pushes/pulls to/from the server. Creates a `.mut/` directory inside your workspace to track local state.
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
┌─────────────┐ ┌─────────────────┐
|
|
53
|
+
│ Agent A │ push → │ │
|
|
54
|
+
│ (client) │ ← pull │ Server │
|
|
55
|
+
└─────────────┘ │ (source of │
|
|
56
|
+
│ truth) │
|
|
57
|
+
┌─────────────┐ │ │
|
|
58
|
+
│ Agent B │ push → │ │
|
|
59
|
+
│ (client) │ ← pull │ │
|
|
60
|
+
└─────────────┘ └─────────────────┘
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Example: Two OpenClaw Agents Sharing Context
|
|
64
|
+
|
|
65
|
+
You have two [OpenClaw](https://github.com/openclawx/openclaw) agents. Agent A handles customer conversations via WhatsApp. Agent B runs BI analysis on internal data. Each has its own workspace folder — that folder is its context.
|
|
66
|
+
|
|
67
|
+
**Without Mut:** Each OpenClaw workspace is a plain folder — no version history, no rollback. If an agent corrupts a file, it's gone. You can't see what all your agents are working on in one place. There's no way to govern or audit agent context across machines.
|
|
68
|
+
|
|
69
|
+
**With Mut:** You run `mut-server` on a VPS (or one of the machines) as the single source of truth. Every change is versioned — you can roll back anytime. All agent context is visible in one place. With scopes, Agent A can only write to `/conversations/`, Agent B can only write to `/reports/`. Version control, visibility, and governance — built in.
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
┌─────────────────┐ ┌─────────────────────┐
|
|
73
|
+
│ OpenClaw #1 │ push → │ Server │
|
|
74
|
+
│ workspace-1/ │ ← pull │ ├── workspace-1/ │
|
|
75
|
+
│ ├── convos/ │ │ │ ├── convos/ │
|
|
76
|
+
│ └── reports/ │ │ │ └── reports/ │
|
|
77
|
+
│ └── .mut/ │ │ ├── workspace-2/ │
|
|
78
|
+
└─────────────────┘ │ │ ├── tasks/ │
|
|
79
|
+
│ │ └── logs/ │
|
|
80
|
+
┌─────────────────┐ │ └── .mut-server/ │
|
|
81
|
+
│ OpenClaw #2 │ push → │ │
|
|
82
|
+
│ workspace-2/ │ ← pull │ │
|
|
83
|
+
│ ├── tasks/ │ │ │
|
|
84
|
+
│ └── logs/ │ │ │
|
|
85
|
+
│ └── .mut/ │ │ │
|
|
86
|
+
└─────────────────┘ └─────────────────────┘
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
> **Tip:** For local development or testing, you can run both `mut-server` and `mut` on the same machine — the server just uses a local folder as its store.
|
|
90
|
+
|
|
91
|
+
### 1. Install
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pip install mutai
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
This installs both `mut` (client) and `mut-server` (server) commands.
|
|
98
|
+
|
|
99
|
+
### 2. Setup (One-Time)
|
|
100
|
+
|
|
101
|
+
**Server — on the machine that hosts the source of truth:**
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
mut-server init ./my-project --name my-project
|
|
105
|
+
mut-server add-scope ./my-project --id scope-src --scope-path "/src/"
|
|
106
|
+
mut-server issue-credential ./my-project --scope scope-src --agent agent-1 --mode rw
|
|
107
|
+
# → prints a credential key, save it for the agent
|
|
108
|
+
mut-server serve ./my-project --port 9742
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Client — on the machine where your agent runs:**
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
mut clone http://<server-host>:9742 --credential <CREDENTIAL>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Done. The agent now has a local copy of the context in `my-project/`.
|
|
118
|
+
|
|
119
|
+
### 3. Daily Usage
|
|
120
|
+
|
|
121
|
+
**Sync local changes to server:**
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
mut commit -m "update customer records"
|
|
125
|
+
mut push
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Pull latest context from server (other agents' changes):**
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
mut pull
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Check what changed locally:**
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
mut status
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**View history:**
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
mut log
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Roll back to a previous version:**
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
mut checkout <snapshot-id>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
**Core concepts:**
|
|
154
|
+
|
|
155
|
+
- **Content-addressable storage** — files are stored by SHA-256 hash, identical content stored once
|
|
156
|
+
- **Merkle tree** — directory structure is a hash tree; changing one file recomputes hashes up to the root
|
|
157
|
+
- **Scopes** — each agent gets a path prefix (e.g. `/src/`) with read/write permissions
|
|
158
|
+
- **Server-side merge** — when two agents modify the same scope, the server runs three-way merge (line-level, JSON key-level, then LWW fallback)
|
|
159
|
+
- **Grafting** — after a push, the server replaces the agent's subtree in the full project tree and recomputes the root hash
|
|
160
|
+
|
|
161
|
+
## Commands
|
|
162
|
+
|
|
163
|
+
### Agent CLI (`mut`)
|
|
164
|
+
|
|
165
|
+
| Command | Description |
|
|
166
|
+
|---|---|
|
|
167
|
+
| `mut clone <url>` | Clone from server (supports invite URLs) |
|
|
168
|
+
| `mut register <invite-url>` | Register with a server using an invite |
|
|
169
|
+
| `mut status` | Show uncommitted changes |
|
|
170
|
+
| `mut commit -m "msg"` | Snapshot the working directory |
|
|
171
|
+
| `mut push` | Push commits to server |
|
|
172
|
+
| `mut pull` | Pull changes from server |
|
|
173
|
+
| `mut log` | Show commit history |
|
|
174
|
+
| `mut diff <id1> <id2>` | Compare two snapshots |
|
|
175
|
+
| `mut checkout <id>` | Restore to a previous snapshot |
|
|
176
|
+
| `mut show <id>:<path>` | Show a file at a specific snapshot |
|
|
177
|
+
| `mut tree <id>` | Show Merkle tree structure |
|
|
178
|
+
| `mut stats` | Repository statistics |
|
|
179
|
+
|
|
180
|
+
### Server CLI (`mut-server`)
|
|
181
|
+
|
|
182
|
+
| Command | Description |
|
|
183
|
+
|---|---|
|
|
184
|
+
| `mut-server init <path>` | Initialize a server repository |
|
|
185
|
+
| `mut-server create-invite <path>` | Generate an invite URL for agents |
|
|
186
|
+
| `mut-server add-scope <path>` | Manually add a scope + assign agents |
|
|
187
|
+
| `mut-server issue-token <path>` | Manually issue an API key |
|
|
188
|
+
| `mut-server serve <path>` | Start the HTTP server |
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
## Requirements
|
|
192
|
+
|
|
193
|
+
- Python 3.9+
|
|
194
|
+
- No external dependencies (stdlib only)
|
|
195
|
+
|
|
196
|
+
## License
|
|
197
|
+
|
|
198
|
+
MIT
|