aisync-cli 0.2.7__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.
- aisync_cli-0.2.7/LICENSE +21 -0
- aisync_cli-0.2.7/PKG-INFO +308 -0
- aisync_cli-0.2.7/README.md +287 -0
- aisync_cli-0.2.7/ai_sync/__init__.py +2 -0
- aisync_cli-0.2.7/ai_sync/__main__.py +5 -0
- aisync_cli-0.2.7/ai_sync/board.py +285 -0
- aisync_cli-0.2.7/ai_sync/cli.py +932 -0
- aisync_cli-0.2.7/ai_sync/collab.py +476 -0
- aisync_cli-0.2.7/ai_sync/core.py +974 -0
- aisync_cli-0.2.7/ai_sync/demo.py +285 -0
- aisync_cli-0.2.7/ai_sync/enforcement.py +328 -0
- aisync_cli-0.2.7/ai_sync/gate.py +265 -0
- aisync_cli-0.2.7/ai_sync/guard.py +390 -0
- aisync_cli-0.2.7/ai_sync/hooks.py +577 -0
- aisync_cli-0.2.7/ai_sync/instincts.py +113 -0
- aisync_cli-0.2.7/ai_sync/landq.py +182 -0
- aisync_cli-0.2.7/ai_sync/layers.py +113 -0
- aisync_cli-0.2.7/ai_sync/mcp_server.py +134 -0
- aisync_cli-0.2.7/ai_sync/nonvacuous.py +110 -0
- aisync_cli-0.2.7/ai_sync/rulecheck.py +153 -0
- aisync_cli-0.2.7/ai_sync/ruleids.py +162 -0
- aisync_cli-0.2.7/ai_sync/rulespec.py +202 -0
- aisync_cli-0.2.7/ai_sync/tidy.py +145 -0
- aisync_cli-0.2.7/ai_sync/ui.py +162 -0
- aisync_cli-0.2.7/ai_sync/update.py +73 -0
- aisync_cli-0.2.7/ai_sync/watch.py +191 -0
- aisync_cli-0.2.7/ai_sync/webinbox.py +173 -0
- aisync_cli-0.2.7/ai_sync/worktree.py +168 -0
- aisync_cli-0.2.7/aisync_cli.egg-info/PKG-INFO +308 -0
- aisync_cli-0.2.7/aisync_cli.egg-info/SOURCES.txt +62 -0
- aisync_cli-0.2.7/aisync_cli.egg-info/dependency_links.txt +1 -0
- aisync_cli-0.2.7/aisync_cli.egg-info/entry_points.txt +2 -0
- aisync_cli-0.2.7/aisync_cli.egg-info/requires.txt +3 -0
- aisync_cli-0.2.7/aisync_cli.egg-info/top_level.txt +1 -0
- aisync_cli-0.2.7/pyproject.toml +36 -0
- aisync_cli-0.2.7/setup.cfg +4 -0
- aisync_cli-0.2.7/tests/test_ai_sync.py +549 -0
- aisync_cli-0.2.7/tests/test_board.py +86 -0
- aisync_cli-0.2.7/tests/test_cli_basics.py +126 -0
- aisync_cli-0.2.7/tests/test_collab.py +286 -0
- aisync_cli-0.2.7/tests/test_enforcement.py +372 -0
- aisync_cli-0.2.7/tests/test_gate.py +311 -0
- aisync_cli-0.2.7/tests/test_git_env_isolation.py +53 -0
- aisync_cli-0.2.7/tests/test_guard.py +296 -0
- aisync_cli-0.2.7/tests/test_guard_exact.py +529 -0
- aisync_cli-0.2.7/tests/test_hooks.py +287 -0
- aisync_cli-0.2.7/tests/test_instincts.py +124 -0
- aisync_cli-0.2.7/tests/test_landq.py +141 -0
- aisync_cli-0.2.7/tests/test_layers.py +126 -0
- aisync_cli-0.2.7/tests/test_mcp_server.py +85 -0
- aisync_cli-0.2.7/tests/test_progress_split.py +71 -0
- aisync_cli-0.2.7/tests/test_public.py +272 -0
- aisync_cli-0.2.7/tests/test_rulecheck.py +131 -0
- aisync_cli-0.2.7/tests/test_ruleids.py +170 -0
- aisync_cli-0.2.7/tests/test_rulespec.py +196 -0
- aisync_cli-0.2.7/tests/test_site.py +159 -0
- aisync_cli-0.2.7/tests/test_tidy.py +129 -0
- aisync_cli-0.2.7/tests/test_ui.py +68 -0
- aisync_cli-0.2.7/tests/test_webinbox.py +193 -0
- aisync_cli-0.2.7/tests/test_wheel.py +58 -0
- aisync_cli-0.2.7/tests/test_wiring.py +107 -0
- aisync_cli-0.2.7/tests/test_wiring_p2.py +117 -0
- aisync_cli-0.2.7/tests/test_worktree.py +135 -0
- aisync_cli-0.2.7/tests/test_worktree_exact.py +402 -0
aisync_cli-0.2.7/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 the aisync authors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aisync-cli
|
|
3
|
+
Version: 0.2.7
|
|
4
|
+
Summary: Multi-agent context management, coordination and observability for AI coding agents: shared rules written as When/Do/Not interfaces, a hash-chained journal, file claims, layered rule loading and mid-session news hooks for Claude Code, Codex and Cursor, plus an MCP server for any agent.
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://maxont.github.io/aisync
|
|
7
|
+
Project-URL: Source, https://github.com/MaxonT/aisync
|
|
8
|
+
Keywords: ai,agents,agents-md,multi-agent,claude-code,codex,cursor,coordination,mcp,developer-tools,cli
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: MacOS
|
|
12
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Topic :: Software Development
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Provides-Extra: mcp
|
|
19
|
+
Requires-Dist: mcp<3,>=2.3; extra == "mcp"
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
<div align="center">
|
|
28
|
+
|
|
29
|
+
<img src="docs/assets/banner.svg" width="100%" alt="aisync: Multi-Agent Context Management, Coordination & Observability"/>
|
|
30
|
+
|
|
31
|
+
# aisync: Multi-Agent Context Management, Coordination & Observability
|
|
32
|
+
|
|
33
|
+
**One local hub for developers working with multiple AI coding agents: share the right context, coordinate concurrent work, and verify what happened.**
|
|
34
|
+
|
|
35
|
+
aisync is **agent-agnostic at its core**. It provides native hooks for Claude Code, Codex and Cursor, and exposes its hub to other agents through a CLI, MCP server, or shared instruction files. These three native integrations are **not** a limit on which agents can use aisync.
|
|
36
|
+
|
|
37
|
+
[](https://github.com/MaxonT/aisync/actions/workflows/ci.yml)
|
|
38
|
+
[](https://github.com/MaxonT/aisync/releases)
|
|
39
|
+

|
|
40
|
+

|
|
41
|
+

|
|
42
|
+
[](https://github.com/MaxonT/aisync/stargazers)
|
|
43
|
+
|
|
44
|
+
**English** · [中文](README.zh-CN.md) · [Website](https://maxont.github.io/aisync/) · [Demo status board](https://maxont.github.io/aisync/board/)
|
|
45
|
+
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
> [!NOTE]
|
|
49
|
+
> **Multiple coding agents should not have to work with isolated rules, conflicting file ownership, and disconnected histories.**
|
|
50
|
+
> aisync is a **local, verifiable hub** (`~/.ai-sync/`, a git repo) designed for multi-agent workflows:
|
|
51
|
+
>
|
|
52
|
+
> - **Context management:** share and 3-way-sync rules; load core context up front and inject relevant context on demand, including mid-session updates where hooks are available.
|
|
53
|
+
> - **Multi-agent coordination:** declare file claims, detect overlapping claims (exit code 3), release ownership, and surface blockers and other agents' activity.
|
|
54
|
+
> - **Observability & verification:** inspect agent activity, blockers, and health through the journal, status reports, and board; `aisync verify` checks the journal's hash chain for tampering.
|
|
55
|
+
>
|
|
56
|
+
> File claims are **cooperative**, not OS-enforced locks: agents must use the claim protocol. Hash-chain verification detects changes to recorded events; it does not prove every claimed action occurred.
|
|
57
|
+
|
|
58
|
+
## Who it's for
|
|
59
|
+
|
|
60
|
+
Developers running **two or more AI coding agents** across one or multiple repositories—especially when agents work concurrently, hand tasks off, or need a shared record of decisions and blockers. aisync is not another coding agent or a task orchestrator: it is the **shared context and coordination layer** those agents can use.
|
|
61
|
+
|
|
62
|
+
## See it
|
|
63
|
+
|
|
64
|
+
<div align="center">
|
|
65
|
+
|
|
66
|
+
### The Agent Swarm Floor
|
|
67
|
+
|
|
68
|
+
<img width="705" height="875" alt="cover" src="https://github.com/user-attachments/assets/cee23378-2379-49a5-960b-ac63764bb95f" />
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
https://github.com/user-attachments/assets/f741ef6f-0c10-46f4-8c94-769c6e02d30e
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## Integrations: native hooks are not the compatibility boundary
|
|
78
|
+
|
|
79
|
+
| Integration | Who can use it | What to expect |
|
|
80
|
+
|---|---|---|
|
|
81
|
+
| **Native hooks** | Claude Code, Codex, Cursor | Automatic context and news delivery at supported hook events, plus access to aisync's coordination and journal commands |
|
|
82
|
+
| **MCP server** | MCP-compatible agents | Exposes rules, rule additions, logging, claims, releases, news, status and tidy; an agent must invoke the tools |
|
|
83
|
+
| **CLI** | Agents that can run shell commands | Direct access to hub operations such as `aisync claim`, `aisync news`, `aisync log` and `aisync verify` |
|
|
84
|
+
| **Shared instruction files** | Agents that read supported instruction files | Standing rules and context only; not automatic mid-session news or file-claim enforcement |
|
|
85
|
+
|
|
86
|
+
**Compatibility is not equivalent to automatic integration.** For agents without native hooks, features depend on the agent's MCP/CLI usage and configuration. aisync does not automatically intercept all edits or guarantee every agent will honor file claims.
|
|
87
|
+
|
|
88
|
+
<p align="center"><img src="docs/assets/cli.png" alt="Running aisync in a terminal: a gradient AISYNC pixel logo, then every command grouped as start, every session, look around, keep the rules lean, keep it running" width="720"></p>
|
|
89
|
+
|
|
90
|
+
## Install
|
|
91
|
+
|
|
92
|
+
**Give it to your AI.** It reads the page, does a dry run first and asks before it changes anything:
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
Read https://maxont.github.io/aisync/install and install aisync for me.
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Or in a terminal.** It installs with uv, pipx or pip and never edits your shell config:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
curl -fsSL https://maxont.github.io/aisync/install.sh | bash
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Needs Python 3.11+ and git, on macOS or Linux. Nothing else: aisync uses only the standard library.
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
### Two agents, one file
|
|
108
|
+
|
|
109
|
+
<img src="docs/assets/demo.gif" width="100%" alt="A real terminal: aisync demo prints a hub's status, claude-code claims app/api/refunds.py, codex claims the same file and is refused with OVERLAP and exit 3, codex logs a blocker, claude-code hears it through aisync news, releases the file, and codex's claim then succeeds"/>
|
|
110
|
+
|
|
111
|
+
<sub>A real terminal run: `aisync demo` (synthetic data), then two tools reach for the same file.
|
|
112
|
+
Step by step: [how it works](https://maxont.github.io/aisync/how-it-works/) · the same demo hub as a
|
|
113
|
+
[status board](https://maxont.github.io/aisync/board/).</sub>
|
|
114
|
+
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
| Multi-agent need | What aisync provides |
|
|
118
|
+
|---|---|
|
|
119
|
+
| **Context management** | 3-way-synced rules, layered rule loading and relevant mid-session news via hooks |
|
|
120
|
+
| **Multi-agent coordination** | Cooperative file claims and releases, overlap detection (exit 3), blockers and activity updates |
|
|
121
|
+
| **Observability & verification** | Hash-chained event journal, `aisync verify`, `status`, `report`, `tail` and a static `board` |
|
|
122
|
+
|
|
123
|
+
aisync also does the rules part: one rules block copied into every tool's own rule file, synced 3-way, conflicts never overwritten.
|
|
124
|
+
|
|
125
|
+
**Dogfooded:** 6,700+ journal events from 7 AI tools over 4 weeks.
|
|
126
|
+
|
|
127
|
+
## Why not just AGENTS.md?
|
|
128
|
+
|
|
129
|
+
Keep AGENTS.md for a repo's standing instructions. aisync sits beside it and covers what a single file cannot: the context that changes while agents work.
|
|
130
|
+
|
|
131
|
+
| | AGENTS.md | aisync |
|
|
132
|
+
|---|---|---|
|
|
133
|
+
| Scope | Standing instructions for agents working in a repo | A shared hub across configured agents and repositories |
|
|
134
|
+
| When it is read | When a session starts | At start, and mid-session through hooks |
|
|
135
|
+
| Who is editing what | Not covered | Cooperative claims: an overlap returns exit 3 to the caller |
|
|
136
|
+
| Tamper evidence | Not provided by the file format | Hash-chained journal: `aisync verify` detects alterations to recorded events |
|
|
137
|
+
| Context per session | Whole file, every time | Triggered rules only: always-loaded rules 20,673 → 7,876 tokens* |
|
|
138
|
+
|
|
139
|
+
<sub>\* Measured once on one author's own hub (2026-11-08), always-loaded rules before and after layered loading. One machine, not a benchmark: your numbers will differ. `aisync tidy` reports your own rule budget and uncited rules.</sub>
|
|
140
|
+
|
|
141
|
+
## Use it
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
aisync demo # a throwaway hub with a synthetic two-week journal
|
|
145
|
+
aisync init # create ~/.ai-sync (or wherever AISYNC_HOME points)
|
|
146
|
+
aisync install-hooks # shows every tool config change as a diff, then asks
|
|
147
|
+
aisync watch & # event-driven sync loop (or run `aisync sync` by hand)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
What an agent does during a session:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
aisync claim -a codex -p api -f app/payments/ -m "SDK upgrade" # 3 = taken
|
|
154
|
+
aisync log -a codex -p api -m "SDK 5.0, retries kept"
|
|
155
|
+
aisync rule add -a codex --when "changing an API" --do "add a contract test"
|
|
156
|
+
aisync release -a codex -p api
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
| Command | What it does |
|
|
160
|
+
|---|---|
|
|
161
|
+
| `init` | create the hub: shared rules, journal, config, local git repo |
|
|
162
|
+
| `log` | append one event (`dev_log`, `decision`, `blocked`, `unblocked`, `rule_change`, `note`) |
|
|
163
|
+
| `rule add` / `rule list` | any agent adds a shared rule (`--when/--do/--not`, `--topic`, `--replaces R-012`); every tool's copy gets it on the next sync |
|
|
164
|
+
| `rule lint` / `rule rewrite` / `rule enforcement` | rules not in the When/Do/Not shape / rewrite them by ID without losing a fact / which test or hook keeps each rule |
|
|
165
|
+
| `rule enforce` | say what keeps an existing rule: `rule enforce R-012 --enforced-by tests/test_x.py`, `--judgment-only "<why>"`, or `--planned "<the check to write>" --size S\|M\|L` for a check that is possible and not written yet. `rule enforcement` then lists every open one with its next step: an enforcer file that is gone, a plan past its due days (S 7, M 30, L 90), a rule with no plan. A plan's clock only runs: a later date, a larger size or a switch to judgment-only needs `--reason` and stays on record |
|
|
166
|
+
| `tidy` | rules clerk: likely duplicates, rules nobody cited lately, core layer over budget; proposals only, you tick them |
|
|
167
|
+
| `rulecheck` | prove a rules cleanup lost no hard fact (paths, numbers, commands, IDs) |
|
|
168
|
+
| `instinct` | optional habit list grown from past mistakes, injected into every session |
|
|
169
|
+
| `gate` | push-time test gate: `gate check` runs `./check.sh --fast` on a commit; the git pre-push hook calls `gate pre-push` (opt-in, see below) |
|
|
170
|
+
| `web-inbox` | import web-Claude events from the `web-inbox` branch now (`--no-fetch` uses the last fetched copy) |
|
|
171
|
+
| `guard` | Claude Code hook: one session per repo; denies an edit when another session holds the repo (opt-in, see below) |
|
|
172
|
+
| `lease` | who holds which repo (`lease status`), or free one by hand (`lease release --key`) |
|
|
173
|
+
| `wt` | a session's own git worktree: `wt start` opens it; `wt land` lands it on main and needs `--yes` (without it: a dry run) |
|
|
174
|
+
| `mcp` | serve the hub to any MCP agent over stdio (`pip install 'aisync-cli[mcp]'`) |
|
|
175
|
+
| `claim` / `release` / `claims` | who is working on which files right now; overlap = exit 3 |
|
|
176
|
+
| `news` | what other tools did since this session last looked |
|
|
177
|
+
| `hook <tool>` | entry point for Claude Code, Codex and Cursor hooks (reads hook JSON, never fails) |
|
|
178
|
+
| `install-hooks` | wire the hooks, seed the rules block, add the git `Agent:` trailer hook; diff first, asks before writing (`--dry-run`, `--yes`) |
|
|
179
|
+
| `status` | health, conflicts, claims, blockers, metrics (exit 1 when something needs you) |
|
|
180
|
+
| `board` | write the hub as one static HTML page: claims, blockers, who did what, timeline |
|
|
181
|
+
| `report` | read-only self-check: silent tools, commits without an `Agent:` trailer, stale blockers |
|
|
182
|
+
| `tail` | latest journal events |
|
|
183
|
+
| `verify` | check the hash chain |
|
|
184
|
+
| `sync` / `watch` | run one sync cycle / the debounced, event-driven loop |
|
|
185
|
+
| `resolve` / `resume` | rule on a rule conflict / clear failure counters after a pause |
|
|
186
|
+
| `demo` | the throwaway hub shown above |
|
|
187
|
+
| `version` / `-v` / `-V` / `--version` | print the version |
|
|
188
|
+
| `help [command]` | this screen, or one command's options (`aisync help log`) |
|
|
189
|
+
| `update` | check GitHub for a newer release and print the command that upgrades (uv, pipx, install.sh, brew or pip); it never installs by itself |
|
|
190
|
+
| `doctor` | check python, git, the hub folder and the journal chain (exit 1 on any failure) |
|
|
191
|
+
|
|
192
|
+
## New in 0.2.0: rules as interfaces, loaded in layers
|
|
193
|
+
|
|
194
|
+
A rules file grows until every session pays for it and nobody reads it. 0.2.0 treats a rule like an API:
|
|
195
|
+
|
|
196
|
+
- **When / Do / Not.** Each rule is one line with a stable ID: `[R-087] When: <trigger>. Do: <action>. Not: <forbidden>.`
|
|
197
|
+
The why goes to the journal, not the rule. `rule_spec = true` refuses anything else; `rule lint` lists misfits;
|
|
198
|
+
`rule rewrite` reshapes old rules by ID and refuses a rewrite that drops a path, number or command.
|
|
199
|
+
- **Layers.** Mark a tool copy `layer = "core"`: it carries `core_topics` in full and every other topic as one line.
|
|
200
|
+
When a prompt or tool call touches a topic's keywords (`[shelf]`), the hook injects that topic once per session.
|
|
201
|
+
On the author's own hub this cut the always-loaded rules from 20,673 to 7,876 tokens; replaying 7 days of
|
|
202
|
+
transcripts, 98.9% of the 189 times a folded rule was cited, it had been injected before the citation.
|
|
203
|
+
- **A stable prefix.** `progress_file` moves the live progress table out of the shared page, so the page stays
|
|
204
|
+
byte-identical and prompt caches keep hitting: the next session after a journal event read 61,151 cached tokens
|
|
205
|
+
instead of 13,060.
|
|
206
|
+
- **A clerk, not a janitor.** `aisync tidy` proposes (duplicates, uncited rules, budget overruns) and never edits;
|
|
207
|
+
a replaced rule moves to `rules-archive.md` with its ID, nothing is deleted.
|
|
208
|
+
- **Any agent.** Three doors: the AGENTS.md page, the CLI, and `aisync mcp` (tools: rules, rule_add, log, claim,
|
|
209
|
+
release, news, status, tidy). The core stays standard-library only; the MCP SDK is the optional `aisync-cli[mcp]` extra.
|
|
210
|
+
|
|
211
|
+
## How it works
|
|
212
|
+
|
|
213
|
+
<p align="center"><img src="docs/assets/how-it-works.gif" width="100%" alt="Six steps: tool A claims a file, tool B is refused with exit 3, B logs a blocker, a hook tells A mid-session, A releases, B proceeds"/></p>
|
|
214
|
+
<p align="center"><sub><a href="https://maxont.github.io/aisync/how-it-works/">Step through it at your own pace</a> (play, pause, ← →)</sub></p>
|
|
215
|
+
|
|
216
|
+
A sync cycle is `harvest` (new git commits in watched repos become journal events, attributed by
|
|
217
|
+
their `Agent:` trailer) → `rules` (new entries in repos you list in `rule_sources`) → `distribute`
|
|
218
|
+
(3-way sync of the rules block into each tool file) → `render` (progress page) → `flush` (commit the
|
|
219
|
+
hub, optional push). Each step is isolated: one failure never blocks the others.
|
|
220
|
+
|
|
221
|
+
The rules block is synced 3-way. If only the truth changed, copies are overwritten (with a backup).
|
|
222
|
+
If one copy was edited and nobody else changed anything, the edit is adopted everywhere. If both
|
|
223
|
+
sides changed, nothing is overwritten: it becomes a conflict for you to resolve.
|
|
224
|
+
|
|
225
|
+
Reliability and observability: timeouts and retries with backoff on every git call, failure
|
|
226
|
+
isolation per step and per project, auto-pause after `fail_threshold` failures in a row with an
|
|
227
|
+
`ALERT.md` and a desktop notification, a per-cycle run log (`state/runs.jsonl`), hook call stats and
|
|
228
|
+
`aisync status` for all of it.
|
|
229
|
+
|
|
230
|
+
## Configuration
|
|
231
|
+
|
|
232
|
+
`~/.ai-sync/config.toml` (set `AISYNC_HOME` to put the hub anywhere):
|
|
233
|
+
|
|
234
|
+
```toml
|
|
235
|
+
roster = ["claude-code", "codex", "cursor"] # tools `report` expects to hear from
|
|
236
|
+
scan_dirs = ["~/projects"] # every git repo inside is watched
|
|
237
|
+
rule_sources = [] # repos whose AGENTS.md "## Meta rule" feeds shared rules
|
|
238
|
+
remote = "" # e.g. "origin" to also push the hub
|
|
239
|
+
|
|
240
|
+
progress_file = "progress.md" # keep agents.md byte-stable; hooks inject progress at session start
|
|
241
|
+
rule_spec = true # rule add only accepts When/Do/Not rules
|
|
242
|
+
require_enforcer = false # true: every new rule names --enforced-by or --judgment-only
|
|
243
|
+
core_topics = ["Safety", "Meta"] # topic headings a layered copy carries in full
|
|
244
|
+
instincts_path = "" # optional habit file injected at session start
|
|
245
|
+
tidy_daily = false # the watcher starts one `aisync tidy --write` a day
|
|
246
|
+
tidy_usage_globs = [] # files whose R-### mentions count as a rule being used
|
|
247
|
+
gate_hook = false # opt-in: the git pre-push hook runs the test gate (gate.py)
|
|
248
|
+
guard_hook = false # opt-in: Claude Code runs the one-session-per-repo guard (guard.py)
|
|
249
|
+
web_inbox_secs = 0 # 0 = off; else poll the web-inbox branch this often
|
|
250
|
+
|
|
251
|
+
[shelf] # folded topic -> keywords that pull it into a session
|
|
252
|
+
Deploys = ["deploy", "terraform", "rollback"]
|
|
253
|
+
|
|
254
|
+
[[target]] # files carrying the shared-rules block
|
|
255
|
+
label = "claude-code"
|
|
256
|
+
path = "~/.claude/CLAUDE.md"
|
|
257
|
+
layer = "core" # optional: fold non-core topics, inject them on demand
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
To keep `aisync watch` running, start it from your login items, a systemd user unit or a launchd
|
|
261
|
+
agent that runs `aisync watch`; create `~/.ai-sync/STOP` to stop it cleanly.
|
|
262
|
+
|
|
263
|
+
**Opt-in features (all off by default).** `gate_hook`, `guard_hook` and `web_inbox_secs` change behavior outside the hub,
|
|
264
|
+
so nothing turns on until you set them. The guard can deny edits: if a session is locked out, run
|
|
265
|
+
`aisync lease status`, and once the holder session has ended, `aisync lease release --key <repo>`. To undo the guard,
|
|
266
|
+
delete the `PreToolUse` and `SessionEnd` entries whose command ends in ` guard` from `~/.claude/settings.json`.
|
|
267
|
+
|
|
268
|
+
## Standing on the shoulders of
|
|
269
|
+
|
|
270
|
+
> aisync: Multi-Agent Context Management, Coordination & Observability. AGENTS.md was the starting idea.
|
|
271
|
+
|
|
272
|
+
| Project | How it shaped aisync |
|
|
273
|
+
|---|---|
|
|
274
|
+
| [](https://github.com/agentsmd/agents.md) | The starting idea: one plain-text instruction file every agent reads, no SDK. aisync keeps that shape for shared rules (one rules block copied into each tool's own AGENTS.md / CLAUDE.md) and adds what a static file cannot say: who is editing what right now, and what changed since the session started. |
|
|
275
|
+
| [](https://github.com/anthropics/claude-code) | Mid-session news rides on Claude Code hooks: `aisync install-hooks` adds SessionStart, UserPromptSubmit and PostToolUse entries to ~/.claude/settings.json, and `aisync hook claude-code` answers with hookSpecificOutput.additionalContext only when another tool changed something. |
|
|
276
|
+
| [](https://github.com/openai/codex) | Codex reads ~/.codex/AGENTS.md, which is where aisync seeds the shared rules block, and its hooks.json takes the same SessionStart / UserPromptSubmit / PostToolUse events, so `aisync hook codex` reuses the Claude Code reply format. |
|
|
277
|
+
| [Cursor](https://cursor.com/docs/agent/hooks) | Cursor hooks (~/.cursor/hooks.json) deliver the rules and progress at sessionStart and the news after each postToolUse through additional_context, because Cursor's User Rules live inside the app instead of a file aisync could sync. |
|
|
278
|
+
| [](https://github.com/git/git) | The journal borrows git's hash chain: every event stores the id of the one before it and its own id is a SHA-256 of that link plus its body, so `aisync verify` spots any edited, lost or reordered line. The hub itself is a local git repo. |
|
|
279
|
+
|
|
280
|
+
aisync is an independent project, not affiliated with the projects above.
|
|
281
|
+
|
|
282
|
+
## Development
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
python3 -m unittest discover -s tests # includes wheel -> venv -> demo
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
The images are generated: the terminal GIF is a recorded real run of
|
|
289
|
+
[`.github/refine/demo-terminal.json`](.github/refine/demo-terminal.json), the how-it-works animation
|
|
290
|
+
comes from [`.github/refine/how-it-works.stages.json`](.github/refine/how-it-works.stages.json), and the
|
|
291
|
+
credits above from [`.github/refine/lineage.json`](.github/refine/lineage.json). All demo data is synthetic.
|
|
292
|
+
|
|
293
|
+
MIT licensed.
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
## More Videos if you like!
|
|
297
|
+
|
|
298
|
+
https://github.com/user-attachments/assets/5ea7928b-4985-4700-8551-90477a84df40
|
|
299
|
+
|
|
300
|
+
https://github.com/user-attachments/assets/91385ac4-714c-4a16-908b-1859ef1c78e2
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
https://github.com/user-attachments/assets/bf661d5c-b7b1-4876-8469-2e11dd95b232
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
https://github.com/user-attachments/assets/d32f3abd-2986-4fbf-83a2-be287f0185a7
|
|
308
|
+
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
<div align="center">
|
|
7
|
+
|
|
8
|
+
<img src="docs/assets/banner.svg" width="100%" alt="aisync: Multi-Agent Context Management, Coordination & Observability"/>
|
|
9
|
+
|
|
10
|
+
# aisync: Multi-Agent Context Management, Coordination & Observability
|
|
11
|
+
|
|
12
|
+
**One local hub for developers working with multiple AI coding agents: share the right context, coordinate concurrent work, and verify what happened.**
|
|
13
|
+
|
|
14
|
+
aisync is **agent-agnostic at its core**. It provides native hooks for Claude Code, Codex and Cursor, and exposes its hub to other agents through a CLI, MCP server, or shared instruction files. These three native integrations are **not** a limit on which agents can use aisync.
|
|
15
|
+
|
|
16
|
+
[](https://github.com/MaxonT/aisync/actions/workflows/ci.yml)
|
|
17
|
+
[](https://github.com/MaxonT/aisync/releases)
|
|
18
|
+

|
|
19
|
+

|
|
20
|
+

|
|
21
|
+
[](https://github.com/MaxonT/aisync/stargazers)
|
|
22
|
+
|
|
23
|
+
**English** · [中文](README.zh-CN.md) · [Website](https://maxont.github.io/aisync/) · [Demo status board](https://maxont.github.io/aisync/board/)
|
|
24
|
+
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
> [!NOTE]
|
|
28
|
+
> **Multiple coding agents should not have to work with isolated rules, conflicting file ownership, and disconnected histories.**
|
|
29
|
+
> aisync is a **local, verifiable hub** (`~/.ai-sync/`, a git repo) designed for multi-agent workflows:
|
|
30
|
+
>
|
|
31
|
+
> - **Context management:** share and 3-way-sync rules; load core context up front and inject relevant context on demand, including mid-session updates where hooks are available.
|
|
32
|
+
> - **Multi-agent coordination:** declare file claims, detect overlapping claims (exit code 3), release ownership, and surface blockers and other agents' activity.
|
|
33
|
+
> - **Observability & verification:** inspect agent activity, blockers, and health through the journal, status reports, and board; `aisync verify` checks the journal's hash chain for tampering.
|
|
34
|
+
>
|
|
35
|
+
> File claims are **cooperative**, not OS-enforced locks: agents must use the claim protocol. Hash-chain verification detects changes to recorded events; it does not prove every claimed action occurred.
|
|
36
|
+
|
|
37
|
+
## Who it's for
|
|
38
|
+
|
|
39
|
+
Developers running **two or more AI coding agents** across one or multiple repositories—especially when agents work concurrently, hand tasks off, or need a shared record of decisions and blockers. aisync is not another coding agent or a task orchestrator: it is the **shared context and coordination layer** those agents can use.
|
|
40
|
+
|
|
41
|
+
## See it
|
|
42
|
+
|
|
43
|
+
<div align="center">
|
|
44
|
+
|
|
45
|
+
### The Agent Swarm Floor
|
|
46
|
+
|
|
47
|
+
<img width="705" height="875" alt="cover" src="https://github.com/user-attachments/assets/cee23378-2379-49a5-960b-ac63764bb95f" />
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
https://github.com/user-attachments/assets/f741ef6f-0c10-46f4-8c94-769c6e02d30e
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## Integrations: native hooks are not the compatibility boundary
|
|
57
|
+
|
|
58
|
+
| Integration | Who can use it | What to expect |
|
|
59
|
+
|---|---|---|
|
|
60
|
+
| **Native hooks** | Claude Code, Codex, Cursor | Automatic context and news delivery at supported hook events, plus access to aisync's coordination and journal commands |
|
|
61
|
+
| **MCP server** | MCP-compatible agents | Exposes rules, rule additions, logging, claims, releases, news, status and tidy; an agent must invoke the tools |
|
|
62
|
+
| **CLI** | Agents that can run shell commands | Direct access to hub operations such as `aisync claim`, `aisync news`, `aisync log` and `aisync verify` |
|
|
63
|
+
| **Shared instruction files** | Agents that read supported instruction files | Standing rules and context only; not automatic mid-session news or file-claim enforcement |
|
|
64
|
+
|
|
65
|
+
**Compatibility is not equivalent to automatic integration.** For agents without native hooks, features depend on the agent's MCP/CLI usage and configuration. aisync does not automatically intercept all edits or guarantee every agent will honor file claims.
|
|
66
|
+
|
|
67
|
+
<p align="center"><img src="docs/assets/cli.png" alt="Running aisync in a terminal: a gradient AISYNC pixel logo, then every command grouped as start, every session, look around, keep the rules lean, keep it running" width="720"></p>
|
|
68
|
+
|
|
69
|
+
## Install
|
|
70
|
+
|
|
71
|
+
**Give it to your AI.** It reads the page, does a dry run first and asks before it changes anything:
|
|
72
|
+
|
|
73
|
+
```text
|
|
74
|
+
Read https://maxont.github.io/aisync/install and install aisync for me.
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Or in a terminal.** It installs with uv, pipx or pip and never edits your shell config:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
curl -fsSL https://maxont.github.io/aisync/install.sh | bash
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Needs Python 3.11+ and git, on macOS or Linux. Nothing else: aisync uses only the standard library.
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
### Two agents, one file
|
|
87
|
+
|
|
88
|
+
<img src="docs/assets/demo.gif" width="100%" alt="A real terminal: aisync demo prints a hub's status, claude-code claims app/api/refunds.py, codex claims the same file and is refused with OVERLAP and exit 3, codex logs a blocker, claude-code hears it through aisync news, releases the file, and codex's claim then succeeds"/>
|
|
89
|
+
|
|
90
|
+
<sub>A real terminal run: `aisync demo` (synthetic data), then two tools reach for the same file.
|
|
91
|
+
Step by step: [how it works](https://maxont.github.io/aisync/how-it-works/) · the same demo hub as a
|
|
92
|
+
[status board](https://maxont.github.io/aisync/board/).</sub>
|
|
93
|
+
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
| Multi-agent need | What aisync provides |
|
|
97
|
+
|---|---|
|
|
98
|
+
| **Context management** | 3-way-synced rules, layered rule loading and relevant mid-session news via hooks |
|
|
99
|
+
| **Multi-agent coordination** | Cooperative file claims and releases, overlap detection (exit 3), blockers and activity updates |
|
|
100
|
+
| **Observability & verification** | Hash-chained event journal, `aisync verify`, `status`, `report`, `tail` and a static `board` |
|
|
101
|
+
|
|
102
|
+
aisync also does the rules part: one rules block copied into every tool's own rule file, synced 3-way, conflicts never overwritten.
|
|
103
|
+
|
|
104
|
+
**Dogfooded:** 6,700+ journal events from 7 AI tools over 4 weeks.
|
|
105
|
+
|
|
106
|
+
## Why not just AGENTS.md?
|
|
107
|
+
|
|
108
|
+
Keep AGENTS.md for a repo's standing instructions. aisync sits beside it and covers what a single file cannot: the context that changes while agents work.
|
|
109
|
+
|
|
110
|
+
| | AGENTS.md | aisync |
|
|
111
|
+
|---|---|---|
|
|
112
|
+
| Scope | Standing instructions for agents working in a repo | A shared hub across configured agents and repositories |
|
|
113
|
+
| When it is read | When a session starts | At start, and mid-session through hooks |
|
|
114
|
+
| Who is editing what | Not covered | Cooperative claims: an overlap returns exit 3 to the caller |
|
|
115
|
+
| Tamper evidence | Not provided by the file format | Hash-chained journal: `aisync verify` detects alterations to recorded events |
|
|
116
|
+
| Context per session | Whole file, every time | Triggered rules only: always-loaded rules 20,673 → 7,876 tokens* |
|
|
117
|
+
|
|
118
|
+
<sub>\* Measured once on one author's own hub (2026-11-08), always-loaded rules before and after layered loading. One machine, not a benchmark: your numbers will differ. `aisync tidy` reports your own rule budget and uncited rules.</sub>
|
|
119
|
+
|
|
120
|
+
## Use it
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
aisync demo # a throwaway hub with a synthetic two-week journal
|
|
124
|
+
aisync init # create ~/.ai-sync (or wherever AISYNC_HOME points)
|
|
125
|
+
aisync install-hooks # shows every tool config change as a diff, then asks
|
|
126
|
+
aisync watch & # event-driven sync loop (or run `aisync sync` by hand)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
What an agent does during a session:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
aisync claim -a codex -p api -f app/payments/ -m "SDK upgrade" # 3 = taken
|
|
133
|
+
aisync log -a codex -p api -m "SDK 5.0, retries kept"
|
|
134
|
+
aisync rule add -a codex --when "changing an API" --do "add a contract test"
|
|
135
|
+
aisync release -a codex -p api
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
| Command | What it does |
|
|
139
|
+
|---|---|
|
|
140
|
+
| `init` | create the hub: shared rules, journal, config, local git repo |
|
|
141
|
+
| `log` | append one event (`dev_log`, `decision`, `blocked`, `unblocked`, `rule_change`, `note`) |
|
|
142
|
+
| `rule add` / `rule list` | any agent adds a shared rule (`--when/--do/--not`, `--topic`, `--replaces R-012`); every tool's copy gets it on the next sync |
|
|
143
|
+
| `rule lint` / `rule rewrite` / `rule enforcement` | rules not in the When/Do/Not shape / rewrite them by ID without losing a fact / which test or hook keeps each rule |
|
|
144
|
+
| `rule enforce` | say what keeps an existing rule: `rule enforce R-012 --enforced-by tests/test_x.py`, `--judgment-only "<why>"`, or `--planned "<the check to write>" --size S\|M\|L` for a check that is possible and not written yet. `rule enforcement` then lists every open one with its next step: an enforcer file that is gone, a plan past its due days (S 7, M 30, L 90), a rule with no plan. A plan's clock only runs: a later date, a larger size or a switch to judgment-only needs `--reason` and stays on record |
|
|
145
|
+
| `tidy` | rules clerk: likely duplicates, rules nobody cited lately, core layer over budget; proposals only, you tick them |
|
|
146
|
+
| `rulecheck` | prove a rules cleanup lost no hard fact (paths, numbers, commands, IDs) |
|
|
147
|
+
| `instinct` | optional habit list grown from past mistakes, injected into every session |
|
|
148
|
+
| `gate` | push-time test gate: `gate check` runs `./check.sh --fast` on a commit; the git pre-push hook calls `gate pre-push` (opt-in, see below) |
|
|
149
|
+
| `web-inbox` | import web-Claude events from the `web-inbox` branch now (`--no-fetch` uses the last fetched copy) |
|
|
150
|
+
| `guard` | Claude Code hook: one session per repo; denies an edit when another session holds the repo (opt-in, see below) |
|
|
151
|
+
| `lease` | who holds which repo (`lease status`), or free one by hand (`lease release --key`) |
|
|
152
|
+
| `wt` | a session's own git worktree: `wt start` opens it; `wt land` lands it on main and needs `--yes` (without it: a dry run) |
|
|
153
|
+
| `mcp` | serve the hub to any MCP agent over stdio (`pip install 'aisync-cli[mcp]'`) |
|
|
154
|
+
| `claim` / `release` / `claims` | who is working on which files right now; overlap = exit 3 |
|
|
155
|
+
| `news` | what other tools did since this session last looked |
|
|
156
|
+
| `hook <tool>` | entry point for Claude Code, Codex and Cursor hooks (reads hook JSON, never fails) |
|
|
157
|
+
| `install-hooks` | wire the hooks, seed the rules block, add the git `Agent:` trailer hook; diff first, asks before writing (`--dry-run`, `--yes`) |
|
|
158
|
+
| `status` | health, conflicts, claims, blockers, metrics (exit 1 when something needs you) |
|
|
159
|
+
| `board` | write the hub as one static HTML page: claims, blockers, who did what, timeline |
|
|
160
|
+
| `report` | read-only self-check: silent tools, commits without an `Agent:` trailer, stale blockers |
|
|
161
|
+
| `tail` | latest journal events |
|
|
162
|
+
| `verify` | check the hash chain |
|
|
163
|
+
| `sync` / `watch` | run one sync cycle / the debounced, event-driven loop |
|
|
164
|
+
| `resolve` / `resume` | rule on a rule conflict / clear failure counters after a pause |
|
|
165
|
+
| `demo` | the throwaway hub shown above |
|
|
166
|
+
| `version` / `-v` / `-V` / `--version` | print the version |
|
|
167
|
+
| `help [command]` | this screen, or one command's options (`aisync help log`) |
|
|
168
|
+
| `update` | check GitHub for a newer release and print the command that upgrades (uv, pipx, install.sh, brew or pip); it never installs by itself |
|
|
169
|
+
| `doctor` | check python, git, the hub folder and the journal chain (exit 1 on any failure) |
|
|
170
|
+
|
|
171
|
+
## New in 0.2.0: rules as interfaces, loaded in layers
|
|
172
|
+
|
|
173
|
+
A rules file grows until every session pays for it and nobody reads it. 0.2.0 treats a rule like an API:
|
|
174
|
+
|
|
175
|
+
- **When / Do / Not.** Each rule is one line with a stable ID: `[R-087] When: <trigger>. Do: <action>. Not: <forbidden>.`
|
|
176
|
+
The why goes to the journal, not the rule. `rule_spec = true` refuses anything else; `rule lint` lists misfits;
|
|
177
|
+
`rule rewrite` reshapes old rules by ID and refuses a rewrite that drops a path, number or command.
|
|
178
|
+
- **Layers.** Mark a tool copy `layer = "core"`: it carries `core_topics` in full and every other topic as one line.
|
|
179
|
+
When a prompt or tool call touches a topic's keywords (`[shelf]`), the hook injects that topic once per session.
|
|
180
|
+
On the author's own hub this cut the always-loaded rules from 20,673 to 7,876 tokens; replaying 7 days of
|
|
181
|
+
transcripts, 98.9% of the 189 times a folded rule was cited, it had been injected before the citation.
|
|
182
|
+
- **A stable prefix.** `progress_file` moves the live progress table out of the shared page, so the page stays
|
|
183
|
+
byte-identical and prompt caches keep hitting: the next session after a journal event read 61,151 cached tokens
|
|
184
|
+
instead of 13,060.
|
|
185
|
+
- **A clerk, not a janitor.** `aisync tidy` proposes (duplicates, uncited rules, budget overruns) and never edits;
|
|
186
|
+
a replaced rule moves to `rules-archive.md` with its ID, nothing is deleted.
|
|
187
|
+
- **Any agent.** Three doors: the AGENTS.md page, the CLI, and `aisync mcp` (tools: rules, rule_add, log, claim,
|
|
188
|
+
release, news, status, tidy). The core stays standard-library only; the MCP SDK is the optional `aisync-cli[mcp]` extra.
|
|
189
|
+
|
|
190
|
+
## How it works
|
|
191
|
+
|
|
192
|
+
<p align="center"><img src="docs/assets/how-it-works.gif" width="100%" alt="Six steps: tool A claims a file, tool B is refused with exit 3, B logs a blocker, a hook tells A mid-session, A releases, B proceeds"/></p>
|
|
193
|
+
<p align="center"><sub><a href="https://maxont.github.io/aisync/how-it-works/">Step through it at your own pace</a> (play, pause, ← →)</sub></p>
|
|
194
|
+
|
|
195
|
+
A sync cycle is `harvest` (new git commits in watched repos become journal events, attributed by
|
|
196
|
+
their `Agent:` trailer) → `rules` (new entries in repos you list in `rule_sources`) → `distribute`
|
|
197
|
+
(3-way sync of the rules block into each tool file) → `render` (progress page) → `flush` (commit the
|
|
198
|
+
hub, optional push). Each step is isolated: one failure never blocks the others.
|
|
199
|
+
|
|
200
|
+
The rules block is synced 3-way. If only the truth changed, copies are overwritten (with a backup).
|
|
201
|
+
If one copy was edited and nobody else changed anything, the edit is adopted everywhere. If both
|
|
202
|
+
sides changed, nothing is overwritten: it becomes a conflict for you to resolve.
|
|
203
|
+
|
|
204
|
+
Reliability and observability: timeouts and retries with backoff on every git call, failure
|
|
205
|
+
isolation per step and per project, auto-pause after `fail_threshold` failures in a row with an
|
|
206
|
+
`ALERT.md` and a desktop notification, a per-cycle run log (`state/runs.jsonl`), hook call stats and
|
|
207
|
+
`aisync status` for all of it.
|
|
208
|
+
|
|
209
|
+
## Configuration
|
|
210
|
+
|
|
211
|
+
`~/.ai-sync/config.toml` (set `AISYNC_HOME` to put the hub anywhere):
|
|
212
|
+
|
|
213
|
+
```toml
|
|
214
|
+
roster = ["claude-code", "codex", "cursor"] # tools `report` expects to hear from
|
|
215
|
+
scan_dirs = ["~/projects"] # every git repo inside is watched
|
|
216
|
+
rule_sources = [] # repos whose AGENTS.md "## Meta rule" feeds shared rules
|
|
217
|
+
remote = "" # e.g. "origin" to also push the hub
|
|
218
|
+
|
|
219
|
+
progress_file = "progress.md" # keep agents.md byte-stable; hooks inject progress at session start
|
|
220
|
+
rule_spec = true # rule add only accepts When/Do/Not rules
|
|
221
|
+
require_enforcer = false # true: every new rule names --enforced-by or --judgment-only
|
|
222
|
+
core_topics = ["Safety", "Meta"] # topic headings a layered copy carries in full
|
|
223
|
+
instincts_path = "" # optional habit file injected at session start
|
|
224
|
+
tidy_daily = false # the watcher starts one `aisync tidy --write` a day
|
|
225
|
+
tidy_usage_globs = [] # files whose R-### mentions count as a rule being used
|
|
226
|
+
gate_hook = false # opt-in: the git pre-push hook runs the test gate (gate.py)
|
|
227
|
+
guard_hook = false # opt-in: Claude Code runs the one-session-per-repo guard (guard.py)
|
|
228
|
+
web_inbox_secs = 0 # 0 = off; else poll the web-inbox branch this often
|
|
229
|
+
|
|
230
|
+
[shelf] # folded topic -> keywords that pull it into a session
|
|
231
|
+
Deploys = ["deploy", "terraform", "rollback"]
|
|
232
|
+
|
|
233
|
+
[[target]] # files carrying the shared-rules block
|
|
234
|
+
label = "claude-code"
|
|
235
|
+
path = "~/.claude/CLAUDE.md"
|
|
236
|
+
layer = "core" # optional: fold non-core topics, inject them on demand
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
To keep `aisync watch` running, start it from your login items, a systemd user unit or a launchd
|
|
240
|
+
agent that runs `aisync watch`; create `~/.ai-sync/STOP` to stop it cleanly.
|
|
241
|
+
|
|
242
|
+
**Opt-in features (all off by default).** `gate_hook`, `guard_hook` and `web_inbox_secs` change behavior outside the hub,
|
|
243
|
+
so nothing turns on until you set them. The guard can deny edits: if a session is locked out, run
|
|
244
|
+
`aisync lease status`, and once the holder session has ended, `aisync lease release --key <repo>`. To undo the guard,
|
|
245
|
+
delete the `PreToolUse` and `SessionEnd` entries whose command ends in ` guard` from `~/.claude/settings.json`.
|
|
246
|
+
|
|
247
|
+
## Standing on the shoulders of
|
|
248
|
+
|
|
249
|
+
> aisync: Multi-Agent Context Management, Coordination & Observability. AGENTS.md was the starting idea.
|
|
250
|
+
|
|
251
|
+
| Project | How it shaped aisync |
|
|
252
|
+
|---|---|
|
|
253
|
+
| [](https://github.com/agentsmd/agents.md) | The starting idea: one plain-text instruction file every agent reads, no SDK. aisync keeps that shape for shared rules (one rules block copied into each tool's own AGENTS.md / CLAUDE.md) and adds what a static file cannot say: who is editing what right now, and what changed since the session started. |
|
|
254
|
+
| [](https://github.com/anthropics/claude-code) | Mid-session news rides on Claude Code hooks: `aisync install-hooks` adds SessionStart, UserPromptSubmit and PostToolUse entries to ~/.claude/settings.json, and `aisync hook claude-code` answers with hookSpecificOutput.additionalContext only when another tool changed something. |
|
|
255
|
+
| [](https://github.com/openai/codex) | Codex reads ~/.codex/AGENTS.md, which is where aisync seeds the shared rules block, and its hooks.json takes the same SessionStart / UserPromptSubmit / PostToolUse events, so `aisync hook codex` reuses the Claude Code reply format. |
|
|
256
|
+
| [Cursor](https://cursor.com/docs/agent/hooks) | Cursor hooks (~/.cursor/hooks.json) deliver the rules and progress at sessionStart and the news after each postToolUse through additional_context, because Cursor's User Rules live inside the app instead of a file aisync could sync. |
|
|
257
|
+
| [](https://github.com/git/git) | The journal borrows git's hash chain: every event stores the id of the one before it and its own id is a SHA-256 of that link plus its body, so `aisync verify` spots any edited, lost or reordered line. The hub itself is a local git repo. |
|
|
258
|
+
|
|
259
|
+
aisync is an independent project, not affiliated with the projects above.
|
|
260
|
+
|
|
261
|
+
## Development
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
python3 -m unittest discover -s tests # includes wheel -> venv -> demo
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
The images are generated: the terminal GIF is a recorded real run of
|
|
268
|
+
[`.github/refine/demo-terminal.json`](.github/refine/demo-terminal.json), the how-it-works animation
|
|
269
|
+
comes from [`.github/refine/how-it-works.stages.json`](.github/refine/how-it-works.stages.json), and the
|
|
270
|
+
credits above from [`.github/refine/lineage.json`](.github/refine/lineage.json). All demo data is synthetic.
|
|
271
|
+
|
|
272
|
+
MIT licensed.
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
## More Videos if you like!
|
|
276
|
+
|
|
277
|
+
https://github.com/user-attachments/assets/5ea7928b-4985-4700-8551-90477a84df40
|
|
278
|
+
|
|
279
|
+
https://github.com/user-attachments/assets/91385ac4-714c-4a16-908b-1859ef1c78e2
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
https://github.com/user-attachments/assets/bf661d5c-b7b1-4876-8469-2e11dd95b232
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
https://github.com/user-attachments/assets/d32f3abd-2986-4fbf-83a2-be287f0185a7
|
|
287
|
+
|