agents-can-communicate 0.3.0 → 0.4.0

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.
Files changed (157) hide show
  1. package/README.md +112 -91
  2. package/SECURITY.md +8 -5
  3. package/bin/acc-bootstrap.mjs +5 -54
  4. package/bin/acc-claude-channel.mjs +8 -175
  5. package/bin/acc-hook.mjs +4 -133
  6. package/bin/acc-mcp.mjs +4 -59
  7. package/bin/acc-update-worker.mjs +8 -0
  8. package/bin/acc.mjs +5 -39
  9. package/bin/entrypoints/acc-bootstrap.mjs +47 -0
  10. package/bin/entrypoints/acc-claude-channel.mjs +149 -0
  11. package/bin/entrypoints/acc-hook.mjs +58 -0
  12. package/bin/entrypoints/acc-mcp.mjs +70 -0
  13. package/bin/entrypoints/acc.mjs +51 -0
  14. package/bin/entrypoints/claude-channel-stdio.mjs +29 -0
  15. package/bin/entrypoints/hook-output.mjs +73 -0
  16. package/docs/ADAPTER_AUTHORING.md +62 -24
  17. package/docs/ARCHITECTURE.md +79 -20
  18. package/docs/CAPABILITIES.md +52 -30
  19. package/docs/CLI.md +164 -35
  20. package/docs/CONCEPTS.md +97 -93
  21. package/docs/CONFIGURATION.md +66 -45
  22. package/docs/DESIGN_DECISIONS.md +24 -15
  23. package/docs/GETTING_STARTED.md +124 -118
  24. package/docs/GLOSSARY.md +12 -6
  25. package/docs/HOW_IT_WORKS.md +136 -229
  26. package/docs/MCP.md +98 -31
  27. package/docs/PROTOCOL.md +76 -14
  28. package/docs/RELEASING.md +128 -86
  29. package/docs/SECURITY_MODEL.md +52 -15
  30. package/docs/TROUBLESHOOTING.md +88 -18
  31. package/docs/UPGRADING.md +119 -0
  32. package/docs/WHY_ACC.md +19 -16
  33. package/docs/index.md +40 -24
  34. package/node_modules/@agents-can-communicate/adapter-claude-code/package.json +1 -1
  35. package/node_modules/@agents-can-communicate/adapter-claude-code/plugin/skills/acc/SKILL.md +112 -9
  36. package/node_modules/@agents-can-communicate/adapter-claude-code/src/install.mjs +6 -6
  37. package/node_modules/@agents-can-communicate/adapter-claude-code/src/native-delivery.mjs +2 -1
  38. package/node_modules/@agents-can-communicate/adapter-codex/certification.json +38 -13
  39. package/node_modules/@agents-can-communicate/adapter-codex/fixtures/certification-provenance.json +220 -0
  40. package/node_modules/@agents-can-communicate/adapter-codex/fixtures/delivery/codex-cli-0.152.1-local-daemon-current-binding-product-evidence.json +1549 -0
  41. package/node_modules/@agents-can-communicate/adapter-codex/fixtures/delivery/codex-cli-0.152.1-local-daemon-current-binding-product.json +27 -0
  42. package/node_modules/@agents-can-communicate/adapter-codex/fixtures/delivery/codex-cli-0.152.1-local-daemon-product-evidence.json +1549 -0
  43. package/node_modules/@agents-can-communicate/adapter-codex/fixtures/delivery/codex-cli-0.152.1-local-daemon-product.json +27 -0
  44. package/node_modules/@agents-can-communicate/adapter-codex/fixtures/delivery/codex-cli-0.152.1-local-daemon-transport-evidence.json +259 -0
  45. package/node_modules/@agents-can-communicate/adapter-codex/fixtures/delivery/codex-cli-0.152.1-local-daemon-transport.json +21 -0
  46. package/node_modules/@agents-can-communicate/adapter-codex/fixtures/delivery/codex-cli-0.153.4-local-daemon-current-binding-product-evidence.json +1549 -0
  47. package/node_modules/@agents-can-communicate/adapter-codex/fixtures/delivery/codex-cli-0.153.4-local-daemon-current-binding-product.json +27 -0
  48. package/node_modules/@agents-can-communicate/adapter-codex/fixtures/delivery/codex-cli-0.153.4-local-daemon-product-evidence.json +1549 -0
  49. package/node_modules/@agents-can-communicate/adapter-codex/fixtures/delivery/codex-cli-0.153.4-local-daemon-product.json +27 -0
  50. package/node_modules/@agents-can-communicate/adapter-codex/fixtures/delivery/codex-cli-0.153.4-local-daemon-transport-evidence.json +259 -0
  51. package/node_modules/@agents-can-communicate/adapter-codex/fixtures/delivery/codex-cli-0.153.4-local-daemon-transport.json +21 -0
  52. package/node_modules/@agents-can-communicate/adapter-codex/package.json +14 -2
  53. package/node_modules/@agents-can-communicate/adapter-codex/plugin/skills/acc/SKILL.md +111 -8
  54. package/node_modules/@agents-can-communicate/adapter-codex/src/adapter.mjs +26 -44
  55. package/node_modules/@agents-can-communicate/adapter-codex/src/app-server-client.mjs +70 -17
  56. package/node_modules/@agents-can-communicate/adapter-codex/src/config-block.mjs +231 -0
  57. package/node_modules/@agents-can-communicate/adapter-codex/src/hooks.mjs +1 -1
  58. package/node_modules/@agents-can-communicate/adapter-codex/src/install.mjs +71 -63
  59. package/node_modules/@agents-can-communicate/adapter-codex/src/native-delivery.mjs +107 -103
  60. package/node_modules/@agents-can-communicate/adapter-codex/src/native-endpoint.mjs +96 -0
  61. package/node_modules/@agents-can-communicate/adapter-codex/src/ws-json-rpc.mjs +3 -2
  62. package/node_modules/@agents-can-communicate/adapter-gemini-cli/extension/gemini-extension.json +1 -1
  63. package/node_modules/@agents-can-communicate/adapter-gemini-cli/extension/skills/acc/SKILL.md +111 -8
  64. package/node_modules/@agents-can-communicate/adapter-gemini-cli/package.json +1 -1
  65. package/node_modules/@agents-can-communicate/adapter-gemini-cli/src/install.mjs +2 -2
  66. package/node_modules/@agents-can-communicate/adapter-grok/package.json +1 -1
  67. package/node_modules/@agents-can-communicate/adapter-grok/plugin/skills/acc/SKILL.md +111 -8
  68. package/node_modules/@agents-can-communicate/adapter-grok/src/install.mjs +2 -2
  69. package/node_modules/@agents-can-communicate/adapter-kimi/package.json +1 -1
  70. package/node_modules/@agents-can-communicate/adapter-kimi/plugin/skills/acc/SKILL.md +111 -8
  71. package/node_modules/@agents-can-communicate/adapter-kimi/src/hooks.mjs +1 -1
  72. package/node_modules/@agents-can-communicate/adapter-kimi/src/install.mjs +2 -2
  73. package/node_modules/@agents-can-communicate/adapter-sdk/package.json +1 -1
  74. package/node_modules/@agents-can-communicate/adapter-sdk/src/capabilities.mjs +5 -0
  75. package/node_modules/@agents-can-communicate/adapter-sdk/src/context-projector.mjs +26 -4
  76. package/node_modules/@agents-can-communicate/adapter-sdk/src/decision-text.mjs +19 -0
  77. package/node_modules/@agents-can-communicate/adapter-sdk/src/hook-shim.mjs +5 -3
  78. package/node_modules/@agents-can-communicate/adapter-sdk/src/index.mjs +1 -0
  79. package/node_modules/@agents-can-communicate/adapter-sdk/src/native-delivery.mjs +9 -2
  80. package/node_modules/@agents-can-communicate/adapter-sdk/src/native-vocabulary.mjs +2 -6
  81. package/node_modules/@agents-can-communicate/adapter-sdk/src/session-binding.mjs +29 -9
  82. package/node_modules/@agents-can-communicate/adapter-sdk/src/toml-block.mjs +8 -6
  83. package/node_modules/@agents-can-communicate/cli/package.json +4 -2
  84. package/node_modules/@agents-can-communicate/cli/src/args.mjs +49 -22
  85. package/node_modules/@agents-can-communicate/cli/src/doctor-command.mjs +11 -4
  86. package/node_modules/@agents-can-communicate/cli/src/git-probe.mjs +9 -3
  87. package/node_modules/@agents-can-communicate/cli/src/help.mjs +109 -14
  88. package/node_modules/@agents-can-communicate/cli/src/install-command.mjs +66 -18
  89. package/node_modules/@agents-can-communicate/cli/src/main.mjs +35 -12
  90. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/activation.mjs +110 -0
  91. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/command.mjs +63 -0
  92. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/download.mjs +71 -0
  93. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/entry.mjs +110 -0
  94. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/generation.mjs +167 -0
  95. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/install.mjs +73 -0
  96. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/launchers.mjs +60 -0
  97. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/leases.mjs +60 -0
  98. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/location.mjs +55 -0
  99. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/mutex.mjs +145 -0
  100. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/policy.mjs +4 -0
  101. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/refresh.mjs +40 -0
  102. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/schedule.mjs +21 -0
  103. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/state.mjs +122 -0
  104. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/worker.mjs +65 -0
  105. package/node_modules/@agents-can-communicate/cli/src/session-owner.mjs +33 -108
  106. package/node_modules/@agents-can-communicate/cli/src/update-command.mjs +25 -7
  107. package/node_modules/@agents-can-communicate/core/package.json +1 -1
  108. package/node_modules/@agents-can-communicate/core/src/attention.mjs +3 -0
  109. package/node_modules/@agents-can-communicate/core/src/claims.mjs +13 -8
  110. package/node_modules/@agents-can-communicate/core/src/conversations.mjs +48 -24
  111. package/node_modules/@agents-can-communicate/core/src/decision-changes.mjs +36 -0
  112. package/node_modules/@agents-can-communicate/core/src/decision-state.mjs +42 -0
  113. package/node_modules/@agents-can-communicate/core/src/delivery-bindings.mjs +11 -4
  114. package/node_modules/@agents-can-communicate/core/src/inbox.mjs +48 -17
  115. package/node_modules/@agents-can-communicate/core/src/intents.mjs +35 -15
  116. package/node_modules/@agents-can-communicate/core/src/materialisation.mjs +7 -5
  117. package/node_modules/@agents-can-communicate/core/src/message-pages.mjs +75 -0
  118. package/node_modules/@agents-can-communicate/core/src/next-turn-delivery.mjs +31 -0
  119. package/node_modules/@agents-can-communicate/core/src/session-opening.mjs +128 -0
  120. package/node_modules/@agents-can-communicate/core/src/sessions.mjs +58 -132
  121. package/node_modules/@agents-can-communicate/core/src/sync.mjs +31 -2
  122. package/node_modules/@agents-can-communicate/delivery-router/package.json +1 -1
  123. package/node_modules/@agents-can-communicate/delivery-router/src/refresh-binding.mjs +38 -0
  124. package/node_modules/@agents-can-communicate/delivery-router/src/router.mjs +86 -10
  125. package/node_modules/@agents-can-communicate/hook-runner/package.json +1 -1
  126. package/node_modules/@agents-can-communicate/hook-runner/src/client-version.mjs +1 -0
  127. package/node_modules/@agents-can-communicate/hook-runner/src/native-binding.mjs +6 -4
  128. package/node_modules/@agents-can-communicate/hook-runner/src/native-retirement.mjs +48 -0
  129. package/node_modules/@agents-can-communicate/hook-runner/src/process-table.mjs +1 -1
  130. package/node_modules/@agents-can-communicate/hook-runner/src/runner.mjs +175 -67
  131. package/node_modules/@agents-can-communicate/hook-runner/src/session-lifecycle.mjs +13 -0
  132. package/node_modules/@agents-can-communicate/installer/package.json +4 -2
  133. package/node_modules/@agents-can-communicate/installer/src/apply.mjs +17 -2
  134. package/node_modules/@agents-can-communicate/installer/src/bootstrap-runtime.mjs +11 -5
  135. package/node_modules/@agents-can-communicate/installer/src/detect.mjs +1 -1
  136. package/node_modules/@agents-can-communicate/installer/src/index.mjs +1 -0
  137. package/node_modules/@agents-can-communicate/installer/src/live-policy.mjs +21 -0
  138. package/node_modules/@agents-can-communicate/installer/src/native-activation.mjs +20 -6
  139. package/node_modules/@agents-can-communicate/installer/src/ownership.mjs +10 -4
  140. package/node_modules/@agents-can-communicate/installer/src/plan.mjs +3 -3
  141. package/node_modules/@agents-can-communicate/mcp-server/package.json +1 -1
  142. package/node_modules/@agents-can-communicate/mcp-server/src/protocol.mjs +85 -0
  143. package/node_modules/@agents-can-communicate/mcp-server/src/resources.mjs +3 -2
  144. package/node_modules/@agents-can-communicate/mcp-server/src/server.mjs +59 -57
  145. package/node_modules/@agents-can-communicate/mcp-server/src/tools.mjs +47 -33
  146. package/node_modules/@agents-can-communicate/protocol/package.json +1 -1
  147. package/node_modules/@agents-can-communicate/protocol/src/conversations.mjs +3 -0
  148. package/node_modules/@agents-can-communicate/protocol/src/decision-changes.mjs +15 -0
  149. package/node_modules/@agents-can-communicate/protocol/src/index.mjs +3 -1
  150. package/node_modules/@agents-can-communicate/protocol/src/schema.mjs +14 -5
  151. package/node_modules/@agents-can-communicate/storage-filesystem/package.json +1 -1
  152. package/node_modules/@agents-can-communicate/storage-filesystem/src/atomic-json.mjs +5 -1
  153. package/node_modules/@agents-can-communicate/storage-filesystem/src/deadline.mjs +7 -0
  154. package/node_modules/@agents-can-communicate/storage-filesystem/src/index.mjs +2 -0
  155. package/node_modules/@agents-can-communicate/storage-filesystem/src/session-read.mjs +25 -0
  156. package/node_modules/@agents-can-communicate/storage-filesystem/src/store.mjs +28 -25
  157. package/package.json +2 -1
@@ -1,277 +1,184 @@
1
1
  # How ACC works
2
2
 
3
- ACC is a local communication layer around AI sessions that the user opened independently.
4
- It gives those sessions a shared set of coordination facts without giving ACC ownership of
5
- their prompts, permissions, processes, or work.
3
+ Suppose Codex is adding an account-registration endpoint while Claude Code builds the
4
+ registration screen. You gave each session an ordinary task. ACC supplies the awareness
5
+ and communication layer around their work; the agents decide whether and how to use it.
6
6
 
7
- This page follows one interaction from client startup to an acknowledged answer. It is the
8
- engineering tour; [Protocol](PROTOCOL.md) is the normative record contract and
9
- [Architecture](ARCHITECTURE.md) is the package-level reference.
10
-
11
- ## The whole system in one picture
7
+ This page follows the dependency from discovery to an acknowledged answer. For exact record
8
+ shapes and state rules, use [Protocol](PROTOCOL.md). For package boundaries, storage, and
9
+ recovery, use [Architecture](ARCHITECTURE.md).
12
10
 
13
11
  ```mermaid
14
- flowchart LR
15
- U["human direction and authority"] --> A["independent session A"]
16
- U --> B["independent session B"]
17
- A --> X["CLI, MCP, or adapter hook"]
18
- X --> C["vendor-neutral core"]
19
- C <--> S[("filesystem store outside the repository")]
20
- C --> Y["B adapter hook or acc inbox"]
21
- Y --> B
22
- C --> R["optional live-delivery router"]
23
- R -.-> B
24
- B --> Z["CLI, MCP, or adapter hook"]
25
- Z --> C
12
+ sequenceDiagram
13
+ participant U as User
14
+ participant C as Codex
15
+ participant ACC
16
+ participant A as Claude Code
17
+ U->>C: Add the registration endpoint
18
+ U->>A: Build the registration screen
19
+ ACC-->>C: Claude Code is a peer
20
+ ACC-->>A: Codex is a peer
21
+ A->>ACC: Ask Codex for the endpoint contract
22
+ ACC-->>C: Offer the question or keep it in inbox
23
+ C->>ACC: Reply with the contract
24
+ ACC-->>A: Offer the answer or keep it in inbox
26
25
  ```
27
26
 
28
- There is no required ACC daemon and no coordinator model. CLI commands and native hooks
29
- are short-lived local processes that open the same workspace store when needed. An MCP
30
- client may keep its own `acc-mcp` stdio child running, but that child is a tool boundary for
31
- one participant, not a scheduler or owner of the room.
27
+ ## 1. The integrations introduce the peers
32
28
 
33
- ## 1. A client session joins a workspace
29
+ `acc install` adds supported hooks, plugins, or extensions to native clients it finds. At
30
+ session startup, such a client calls `acc-hook`, which registers the session in the local
31
+ ACC workspace. The native integration also gives the agent a small skill describing peer
32
+ discovery, messages, replies, claims, and handoffs.
34
33
 
35
- For a native client, an installed startup hook sends the client event to `acc-hook`. The
36
- vendor adapter normalizes that event, then the hook runner:
34
+ A generic MCP client instead joins through `acc-mcp`, which resolves its configured
35
+ participant and workspace on tool calls or inbox resource reads. Snapshot and roster
36
+ resource reads do not need that owner resolution. It exposes the coordination
37
+ tools but does not install the native clients' skill. See its
38
+ [manual MCP boundary](MCP.md#account-for-the-manual-boundary).
37
39
 
38
- 1. discovers the workspace;
39
- 2. opens its filesystem store;
40
- 3. resolves the exact client version and its certified capabilities;
41
- 4. opens or resumes one ACC session generation; and
42
- 5. stores a small binding from the client's session id to that ACC generation.
40
+ ACC does not add instructions to the user's task prompt, create a team, or choose work. The
41
+ agent still operates under its own conversation, permissions, and client policy.
43
42
 
44
- Workspace discovery uses an explicit `acc.workspace.json` first, the Git common directory
45
- second, and the canonical plain directory otherwise. Git worktrees therefore share one
46
- room but keep separate checkout and branch facts. Git itself is optional.
43
+ Sessions meet only when they resolve to the same local workspace. Git worktrees of one
44
+ repository share a workspace through the Git common directory, while retaining separate
45
+ checkout and branch facts. A plain directory uses its canonical path unless optional
46
+ workspace configuration supplies a stable id or additional roots. Git is not required.
47
47
 
48
- A participant is the address messages target. A session is one current opening of that
49
- participant, and its unguessable generation token prevents an old process from mutating a
50
- replacement session. The default participant name is derived from the client session. Set
51
- `ACC_PARTICIPANT` in the client launch environment when an address must survive a client
52
- restart and recover messages sent while it was away.
48
+ A workspace is local to one machine and operating-system user. ACC is not a remote sync
49
+ service, even if project files are synchronized elsewhere.
53
50
 
54
- Attaching one session does not create durable workspace history. Its presence and intent
55
- can remain ephemeral until a second live session appears or someone creates the first
56
- claim, message, or handoff. This is how ACC stays silent when a session is alone without
57
- making discovery unreliable when a peer arrives.
51
+ ## 2. Each agent shares a small amount of work context
58
52
 
59
- ## 2. Sessions publish awareness, not assignments
53
+ The Codex session may publish “adding the registration endpoint” with a hint for its API
54
+ files. Claude may publish “building the registration screen” with a UI hint. This intent is
55
+ short, explicit coordination data, not a copy of either conversation.
60
56
 
61
- An intent records a short summary, mode, and resource hints. A claim adds a leased
62
- reservation for a canonical resource such as `file:src/item.mjs` or `file:src/**`.
63
- Neither creates a task or grants one session authority over another.
57
+ When peers are available, the integration can project their identity, intent, relevant
58
+ claims, and pending messages into a supported normal turn. The agent can then notice that
59
+ its work depends on a peer. ACC does not run a hidden classifier and does not guarantee the
60
+ model will coordinate; relevance remains the agent's decision.
64
61
 
65
- A claim is `guarded` only when every live client path involved has a captured pre-write
66
- guard. Otherwise it is `advisory`: visible coordination that peers should respect, but not
67
- an operating-system lock. Even a guarded claim cannot stop unrelated programs or a write
68
- path the client never exposes to its adapter.
62
+ Presence and intent can stay ephemeral while a session is alone. Durable workspace history
63
+ materializes when a second session appears or an agent creates the first durable message,
64
+ claim, or handoff. Runtime state lives in platform app data outside the repository.
69
65
 
70
- ## 3. Sending commits the durable truth first
66
+ ## 3. A dependency becomes a direct question
71
67
 
72
- When session A sends an addressed question, the CLI or MCP boundary validates the closed
73
- protocol shape and resolves A's current session generation. Core then performs one
74
- filesystem transaction that creates:
68
+ Claude needs the endpoint contract, so it looks up the peer and sends an addressed
69
+ `question`. A client name such as `codex` resolves when exactly one peer session of that
70
+ client is eligible. If several Codex sessions are live, the agent uses the exact participant
71
+ id from `acc status --json`.
75
72
 
76
- - the immutable logical message, including sender, recipients, kind, obligation, thread,
77
- and explicit body;
78
- - one `queued` receipt for each recipient; and
79
- - a `message.recorded` event.
73
+ The sender is not granting itself authority over the recipient. Messages are attributed,
74
+ untrusted peer input. A `request` asks for action and a result, but it is not an order; the
75
+ receiving agent evaluates it under its own instructions and permissions.
80
76
 
81
- The first message in a thread uses its own `messageId` as `threadId`. A caller-supplied
82
- `clientMessageId` is a retry key: identical retries return the original message, while the
83
- same key with different content is rejected.
77
+ ## 4. ACC records before it tries delivery
84
78
 
85
- For a room message, recipients are the known peer participants with open sessions at
86
- commit time. Participants arriving later can find the room record through full forensic
87
- sync, but they do not receive retroactive receipts.
79
+ Sending the question commits the message and one `queued` receipt for each recipient in a
80
+ single filesystem transaction. Only then does ACC attempt to make it arrive sooner. If a
81
+ hook, client, or experimental transport is unavailable, the recorded question remains in
82
+ the recipient's durable inbox.
88
83
 
89
- Only after the transaction commits may ACC try to make the message arrive sooner. Thus a
90
- crashed, unsupported, or unreachable adapter cannot erase a successfully recorded
91
- question.
84
+ That order is the central reliability guarantee:
92
85
 
93
- ## 4. Delivery has three paths
86
+ ```text
87
+ agent sends -> durable message and queued receipt -> optional delivery attempt
88
+ ```
94
89
 
95
- The paths share one durable record but prove different facts.
90
+ The first message is also the root of its thread. Retries can carry a `clientMessageId` so
91
+ equivalent repeats return the original record while conflicting reuse is rejected. Room
92
+ messages resolve their recipients at commit time; later arrivals do not gain retroactive
93
+ receipts. [Protocol](PROTOCOL.md) defines these rules precisely.
96
94
 
97
- ### Durable inbox
95
+ ## 5. The receiving client chooses the delivery path
98
96
 
99
- `acc inbox` is the universal recovery path. It returns only messages addressed to the
100
- calling participant and atomically advances that participant's receipt to `retrieved`.
101
- An exact `acc inbox --message message_x` remains usable after context compaction or when a
102
- message was too large to project safely.
97
+ All recipients have the same durable record, but adapters expose different acceleration:
103
98
 
104
- ### Certified next-turn projection
99
+ - **Durable inbox:** universal recovery. `acc inbox` discovers bounded message headers;
100
+ `acc inbox --message <id>` retrieves one complete addressed message after selection
101
+ or compaction.
102
+ - **Next normal turn:** exact captured versions of Codex, Claude Code, Gemini CLI, and Kimi
103
+ Code can receive complete attributed peer context when the user next prompts that client.
104
+ This does not wake an idle session.
105
+ - **Optional Claude Code channel:** supported Claude Code versions on Apple Silicon macOS
106
+ may receive an addressed actionable message while idle. This is experimental, off by
107
+ default, can spend tokens, never interrupts a running turn, and requires the vendor's
108
+ visible development-channel warning.
105
109
 
106
- On an exact client version and platform with passing evidence, a before-turn hook asks core
107
- for queued messages just before the client's next normal turn. The adapter projects each
108
- complete body inside an attributed `untrusted peer message` frame. If the complete frame
109
- does not fit the configured byte budget, the hook keeps the message id and the exact inbox
110
- recovery command instead of silently truncating peer text.
110
+ - **Optional Codex LocalDaemon delivery:** on Apple Silicon macOS, a captured
111
+ minimum of 0.152.1 plus a current probe and exact session checks allow delivery
112
+ to an independently opened thread. It is experimental, off by default, and can
113
+ spend tokens. Messages wait for a running turn to finish; a daemon-retained
114
+ thread can receive them after its terminal exits. ACC adds no launch arguments
115
+ and does not manage the vendor daemon.
111
116
 
112
- The hook entry point records `offered` only after its stdout transport reports that the
113
- bytes crossed the boundary. The state is not `retrieved`: ACC still has no observation
114
- that the model attended to those bytes.
117
+ Grok, generic MCP, unsupported versions and uncaptured platforms use inbox polling.
118
+ [Capabilities](CAPABILITIES.md) lists evidence and fallback.
115
119
 
116
- ### Native live push
120
+ When a complete projected body cannot fit the configured byte budget, ACC keeps the message
121
+ id and exact inbox recovery command rather than silently truncating the peer's words.
117
122
 
118
- The delivery router offers an actionable message to an already-running session when all of
119
- these hold at once:
123
+ ## 6. The reply stays in the same thread
120
124
 
121
- - exactly one live generation for the recipient;
122
- - an unexpired generation-bound delivery binding published by that session's own start;
123
- - a recorded policy permitting this message kind (`actionable` covers question, request,
124
- answer, decision, and handoff; `all` adds note; room messages are never live);
125
- - an adapter that declares `delivery.livePush` and a native contract; and
126
- - adapter acceptance of the bytes.
125
+ Codex replies with the request and response fields. The reply operation creates an `answer`
126
+ for Claude in the original thread and acknowledges Codex's receipt for the question in one
127
+ transaction. For a message that requires acknowledgement but no answer, the recipient uses
128
+ `ack` instead.
127
129
 
128
- Any missing condition leaves the receipt `queued` and returns a safe fallback reason. Two
129
- adapters ship a native transport, both experimental and off until a per-client opt-in:
130
+ Receipts describe evidence, not assumptions:
130
131
 
131
132
  ```text
132
- sender -> durable ACC record -> exact live binding -> vendor transport -> receiver
133
- \-> queued inbox on every failure
133
+ queued -> offered -> retrieved -> acknowledged
134
134
  ```
135
135
 
136
- - **Claude Code 2.1.258** uses a vendor Channel: an ACC-owned MCP child, started only when
137
- the user's ordinary `claude` launch carries the captured development-channel flag, offers
138
- the message as a native notification and routes the model's explicit `acc_reply` back as a
139
- real ACC answer. Claude's development-channel warning is vendor-owned and stays visible.
140
- - **Codex 0.152.1** adds the message to the App Server thread queue over the vendor daemon's
141
- control socket; it is presented on the idle thread or after the current turn. Codex answers
142
- through the ordinary `acc reply` command, so its reply route is not native.
143
-
144
- Compatibility is decided at the launch-time bootstrap and again by a per-session handshake
145
- bound to the exact client process; there is no maximum client version, but a newer stable
146
- release must pass a current probe and handshake for the captured protocol, and an older,
147
- prerelease, known-bad, or uncaptured client stays durable-only. ACC is never the parent of
148
- a model session after the shell `exec`, and `ACC_BYPASS=1` starts the unmodified client.
136
+ - `queued` means the message and receipt are durable;
137
+ - `offered` means bytes crossed ACC's transport boundary or a certified client accepted
138
+ them, not that the model read them;
139
+ - `retrieved` means the participant explicitly fetched the message, not that a model paid
140
+ attention; and
141
+ - `acknowledged` means the participant acknowledged or replied, not that requested work is
142
+ complete.
149
143
 
150
- ## 5. Reply closes the communication obligation
144
+ There is no `seen` receipt and no ACC task state such as accepted, running, or done.
151
145
 
152
- The complete question-and-answer path is:
146
+ ## 7. Claims warn before edits overlap
153
147
 
154
- ```mermaid
155
- sequenceDiagram
156
- participant A as Session A
157
- participant Core
158
- participant Store
159
- participant B as Session B
160
- A->>Core: addressed question for B
161
- Core->>Store: message + queued receipt + event
162
- Store-->>Core: transaction committed
163
- Core-->>A: recorded with delivery outcome
164
- alt certified next-turn
165
- B->>Core: normal turn hook
166
- Core-->>B: attributed untrusted envelope
167
- Core->>Store: receipt offered after transport accepts bytes
168
- else durable inbox
169
- B->>Core: acc inbox for the message
170
- Core->>Store: advance B receipt to retrieved
171
- Core-->>B: attributed message and receipt
172
- end
173
- B->>Core: reply to the question id
174
- Core->>Store: answer + A receipt + acknowledge B receipt
175
- Core-->>A: answer through next-turn or inbox
176
- ```
148
+ Before changing files, an agent can publish intent and claim a narrow resource such as
149
+ `file:packages/api/**`. Another live session attempting an overlapping claim receives exit
150
+ code `5` with the holder, giving the peers a chance to narrow or sequence their work.
177
151
 
178
- `reply` verifies that B owns the original receipt, writes an `answer` in the same thread,
179
- creates the answer's receipt for A, and advances B's original receipt to `acknowledged` in
180
- one transaction. A transport failure after that cannot undo the reply. `ack` performs the
181
- last transition without creating an answer when the obligation only asks for
182
- acknowledgement.
152
+ Claims are not operating-system locks. CLI claims default to `advisory`. Explicit
153
+ `--enforcement guarded` also requires every relevant live client to expose a captured
154
+ pre-write guard for the path ACC can recognize; otherwise workspace protection is advisory.
155
+ Even a guarded claim cannot stop an unrelated program or a write path the client does not
156
+ expose. [Concepts](CONCEPTS.md#intent-is-awareness-a-claim-commits) explains the
157
+ user-facing distinction.
183
158
 
184
- Receipts are per recipient and monotonic:
159
+ ## 8. Peers recover history and explicit decision changes
185
160
 
186
- ```text
187
- queued -> offered -> retrieved -> acknowledged
188
- ```
161
+ Inbox and history listings expose bounded summaries. After compaction or a new conversation,
162
+ a peer selects exact records to recover full decisions or handoffs; a new participant does
163
+ not inherit an old participant's inbox. History reads preserve receipt state.
189
164
 
190
- `recorded` is the successful send boundary, not a receipt state. `offered` does not mean
191
- read, `retrieved` does not prove model attention, and `acknowledged` resolves communication
192
- only. A reply saying “I will do it” is not evidence that the requested work finished; ACC
193
- does not have accepted, running, or done task states.
165
+ A peer can explicitly supersede or withdraw an earlier decision. Prior records remain,
166
+ and current-decision discovery shows terminal positions, withdrawals, and competing
167
+ branches. This reports peers' recorded positions, not verified current truth. See
168
+ [historical recovery](CLI.md#historical-recovery) and
169
+ [decision lifecycle](PROTOCOL.md#decision-lifecycle). No full history is automatically injected.
194
170
 
195
- ## 6. The filesystem is the control plane
171
+ ## 9. The boundaries remain visible
196
172
 
197
- Each workspace lives below the platform data home, conceptually:
173
+ ACC stores only coordination data an agent explicitly publishes: identity, presence,
174
+ one-line intent, claims, messages, replies, handoffs, receipts, and events. It never collects
175
+ or shares raw prompts, assistant responses, or transcripts. Peer bodies are framed as
176
+ untrusted data and remain subject to the receiving session's permissions.
198
177
 
199
- ```text
200
- <platform data home>/acc/workspaces/workspace_x/
201
- ├── protocol.json store version and workspace identity
202
- ├── state/<kind>/<id>.json materialised current records
203
- ├── events/<sequence>.json immutable semantic history
204
- ├── journal/ crash-recovery authority
205
- ├── locks/ one cross-process writer mutex
206
- ├── ephemeral/ non-durable presence, intent, and delivery bindings
207
- ├── bindings/ client-session to ACC-generation mappings
208
- ├── retained/ logical deletion and retired evidence
209
- └── tmp/ staged atomic publications
210
- ```
178
+ Hooks have a short time limit and fail open. A coordination failure may remove awareness or
179
+ force inbox fallback, but ACC must not be the reason a client action stops. Unknown versions
180
+ and platforms inherit no capability; `acc doctor` reports the downgrade and next action.
211
181
 
212
- This layout is diagnostic, not a public mutation API. Clients write through the protocol
213
- and core rather than editing these files.
214
-
215
- On macOS the platform data home is `~/Library/Application Support`; on Linux it is
216
- `$XDG_DATA_HOME` or `~/.local/share`. `ACC_DATA_HOME` replaces that base. Runtime paths are
217
- checked against workspace roots so ACC state cannot be placed inside the project.
218
-
219
- Every durable mutation holds the same writer mutex, loads only its declared record kinds,
220
- checks state generations, stages the full result, and writes a recovery journal before
221
- publishing. Events are immutable no-replace files; current state is a materialised view
222
- replaced atomically. While publication is incomplete, the active journal bounds event
223
- cursors below the transaction's first sequence; the next store opener rolls a decided
224
- transaction forward before serving a read. The store prefers a recoverable duplicate offer
225
- after a crash to an unearned delivery claim.
226
-
227
- Paths are opened with containment and no-follow checks. Corrupt records, a foreign
228
- workspace identity, and unknown store versions fail before mutation rather than being
229
- guessed into a compatible shape.
230
-
231
- ## 7. Adapters translate evidence, not product semantics
232
-
233
- The vendor-neutral layers know nothing about Codex, Claude Code, Gemini CLI, Grok, or Kimi
234
- Code. `protocol` owns record shapes and state transitions; `core` owns coordination rules;
235
- `storage-filesystem` owns persistence. Vendor adapters own hook payloads, installation,
236
- client-specific response shapes, and captured capability evidence. `hook-runner` applies
237
- the common bounded fail-open lifecycle, while `delivery-router` evaluates optional live
238
- delivery.
239
-
240
- Unknown client versions and platforms inherit no capability. A method in an adapter or a
241
- vendor documentation example is not enough: every `true` capability needs a retained
242
- real-client fixture. This is why the same product can degrade visibly from next-turn
243
- projection to inbox polling without changing its message or receipt semantics.
244
-
245
- ## 8. What crosses the trust boundary
246
-
247
- ACC stores only explicit coordination data: identity, presence, one-line intent, claims,
248
- messages the sender chose to send, structured handoffs, receipts, artifacts, and events.
249
- It does not collect raw prompts, assistant responses, transcripts, environment variables,
250
- credentials, or permission approvals.
251
-
252
- Peer bodies remain untrusted data. The projector attributes the sender, escapes framing
253
- and terminal control sequences, and never promotes peer text to system authority. The
254
- receiving session still evaluates it under its own instructions and permissions.
255
-
256
- Every native hook has a five-second ceiling and fails open: if ACC cannot read the store or
257
- decide safely, the client's action continues. Coordination may become less effective, but
258
- ACC itself must not stop a session from working.
259
-
260
- ## Trace the implementation
261
-
262
- The shortest source-code path is:
263
-
264
- 1. `packages/hook-runner/src/runner.mjs` — attach, before-turn projection, guards, and the
265
- fail-open boundary;
266
- 2. `packages/core/src/conversations.mjs` — record-first messages, threads, receipts, and
267
- handoffs;
268
- 3. `packages/core/src/inbox.mjs` — recipient-owned retrieval, reply, and acknowledgement;
269
- 4. `packages/delivery-router/src/router.mjs` — policy, reachability, certification, and live
270
- fallback;
271
- 5. `packages/storage-filesystem/src/store.mjs` — transactions, snapshots, ephemeral state,
272
- and recovery; and
273
- 6. `packages/adapter-sdk/src/context-projector.mjs` — bounded untrusted peer framing.
274
-
275
- Continue with [Capabilities](CAPABILITIES.md) for what each shipped client actually proves,
276
- [Security model](SECURITY_MODEL.md) for trust boundaries and attack tests, and
277
- [Adapter authoring](ADAPTER_AUTHORING.md) for the integration contract.
182
+ Continue with [Capabilities](CAPABILITIES.md) for client-specific behavior,
183
+ [Security model](SECURITY_MODEL.md) for trust boundaries, or
184
+ [Architecture](ARCHITECTURE.md) to trace these steps through the packages.
package/docs/MCP.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # MCP
2
2
 
3
- `acc-mcp` lets a client with no native ACC adapter participate over stdio. It exposes the
4
- same durable messages, threads, receipts, intent, claims, and handoffs, but it cannot infer
5
- the client's lifecycle, intercept writes, inject a normal turn, or push a message. The
6
- client polls tools under its own control.
3
+ Use `acc-mcp` when a client can call MCP tools but has no native ACC adapter. The server
4
+ exposes durable messages, threads, receipts, intent, claims, and handoffs over stdio.
5
+ Receiving through MCP requires manual polling: it cannot infer the client's lifecycle,
6
+ intercept writes, inject a normal turn, or wake the MCP client for incoming messages.
7
+ Outgoing messages commit first and may then be offered through an eligible recipient's
8
+ native adapter when that recipient's delivery policy permits it.
7
9
 
8
10
  ```mermaid
9
11
  graph LR
@@ -11,7 +13,7 @@ graph LR
11
13
  M --> S[("ACC durable store")]
12
14
  ```
13
15
 
14
- ## Register
16
+ ## Configure the server
15
17
 
16
18
  ```json
17
19
  {
@@ -29,22 +31,30 @@ identity for this server. It comes from user-owned launch configuration, never f
29
31
  server uses its launch directory, which may be a different workspace from the other
30
32
  sessions.
31
33
 
32
- The server implements MCP protocol revision `2026-07-28` over newline-delimited JSON-RPC
33
- stdio. Tool input schemas are closed: unknown fields and invalid conditional shapes are
34
- rejected before a session is resolved.
34
+ The server supports initialized MCP clients using `2025-06-18` or `2025-11-25`, and
35
+ the per-request metadata interface in `2026-07-28`, over newline-delimited JSON-RPC stdio.
36
+ Initialized clients send `initialize`, accept the negotiated revision, then send
37
+ `notifications/initialized` before calling tools. Unknown initialization revisions receive
38
+ `2025-11-25`; the client decides whether it supports that revision. Transport initialization
39
+ does not create an ACC participant: a tool call or inbox resource read resolves it.
35
40
 
36
- ## Tools
41
+ Tool input schemas are closed: unknown fields and invalid conditional shapes are
42
+ rejected before a session is resolved. Approve the ACC tools through your client's normal
43
+ permission controls. A headless client configured to reject approval requests can connect
44
+ successfully yet refuse tool calls; that is distinct from a protocol handshake failure.
45
+
46
+ ## Call the durable tools
37
47
 
38
48
  | Tool | Required input | Optional input |
39
49
  |---|---|---|
40
50
  | `acc_status` | — | — |
41
- | `acc_sync` | — | `cursor`, `scope: delta|full`, `limit: 1..500` |
51
+ | `acc_sync` | — | `cursor`, `scope: delta|full|history`, `limit: 1..500`, `kind`, `messageId`, `current` |
42
52
  | `acc_work` | `summary` and `mode`, or `clear: true` | `state`, `resourceHints` |
43
53
  | `acc_claim` | `action`; `resource` for acquire, `claimId` for renew | `mode`, `reason`, `leaseSeconds` where valid |
44
54
  | `acc_release` | `claimId` | — |
45
- | `acc_message` | `to`, `subject`, `body` | `kind`, `obligation`, `clientMessageId` |
55
+ | `acc_message` | `to`, `subject`, `body` | `kind`, `obligation`, `clientMessageId`, `supersedes`, `withdraws` |
46
56
  | `acc_request` | `toParticipantId`, `title` | `detail`, `clientMessageId` |
47
- | `acc_inbox` | — | `messageId` |
57
+ | `acc_inbox` | — | `messageId`, `cursor`, `limit: 1..500` |
48
58
  | `acc_reply` | `messageId`, `body` | `subject`, `clientMessageId` |
49
59
  | `acc_ack` | `messageId` | — |
50
60
  | `acc_finish` | `goal` | `status`, `completed`, `remaining`, `blockers`, `toParticipantId`, `clientMessageId` |
@@ -53,17 +63,48 @@ All tool names above are the complete model-facing surface. There are no executi
53
63
  client-control tools.
54
64
 
55
65
  Send-like tools return a raw structured object with `{ message, delivery }`; their text
56
- content is the JSON serialization of the same value. `acc_inbox` returns message/receipt
57
- pairs and advances only this participant's receipts to `retrieved`. `acc_reply` writes an
58
- `answer` and acknowledges the original atomically. `acc_ack` exposes no receipt-state
59
- parameter.
66
+ content is the JSON serialization of the same value. Default `acc_inbox` returns
67
+ `{items, nextCursor}`: read-only pending message summaries paired with receipts, newest
68
+ first. It never retrieves bodies. Pages default to 20 items, at most 12,000 bytes of
69
+ formatted page JSON before MCP framing. `cursor` is the complete message id from
70
+ `nextCursor`; omit it on a new poll to see arrivals. Reading or acknowledging the anchor
71
+ between pages does not shift continuation. The summary field allowlist, byte limit,
72
+ and live-page semantics are described in [CLI](CLI.md#inbox-reply-and-acknowledgement).
73
+
74
+ With an exact `messageId`, `acc_inbox` returns a one-item array with the complete
75
+ message/receipt pair and advances only that participant's receipt to `retrieved` when
76
+ needed. Exact acknowledged inspection preserves receipt state, timestamp, and event
77
+ history. Do not combine `messageId` with cursor or limit. Resolved mail stays out of lists.
78
+ `acc_reply` writes an `answer` and acknowledges the original atomically. It additionally
79
+ returns `receipt` for that original message; `message` and `delivery` describe the outgoing
80
+ answer. `acc_ack` exposes no receipt-state parameter.
81
+
82
+ For initialized 2025 clients, array results such as exact `acc_inbox` reads are JSON in text content,
83
+ with `structuredContent` omitted because those revisions require an object there.
84
+ Object results retain both representations. The 2026 interface also returns raw arrays
85
+ in `structuredContent` and uses the `resultType: "complete"` envelope.
60
86
 
61
87
  Resources are `acc://snapshot`, `acc://roster`, and `acc://inbox`. Reading `acc://inbox`
62
- resolves the configured MCP participant and advances only the returned receipts to
63
- `retrieved`, just like the inbox tool. Snapshot and roster reads do not advance receipts.
64
- A full snapshot is for explicit workspace forensics.
65
-
66
- ## Capability floor
88
+ resolves the configured MCP participant and returns the same read-only summary page as
89
+ `acc_inbox {}`. Continue via the tool using `cursor`; retrieve a body with `messageId`.
90
+ Snapshot and roster reads do not advance receipts either. `acc://snapshot` and sync with
91
+ `scope: "full"` remain unbounded, for explicit workspace forensics.
92
+
93
+ `acc_sync {scope: "history", kind: "handoff"}` returns
94
+ `{scope: "history", view: "summary", items, nextCursor}` using the same message summary
95
+ fields and page limits. The optional kind filter applies before paging. Continue with
96
+ the complete `nextCursor` message id and the same filter. Then use
97
+ `acc_sync {scope: "history", messageId: "message_x"}` to receive one complete historical
98
+ message in `items`, with `view: "message"` and no receipt change. Exact reads reject
99
+ cursor, limit, and kind. `kind` and `messageId` require history scope; delta/full retain
100
+ 16-digit event cursors. History exposes recorded peer claims, not their current validity.
101
+
102
+ An addressed handoff requires a participant already known to the workspace. For a future
103
+ session that has not joined, omit `toParticipantId` to leave a workspace handoff. A later
104
+ session can recover that historical handoff through the history list and exact read;
105
+ its addressed inbox will not contain past workspace broadcasts.
106
+
107
+ ## Account for the manual boundary
67
108
 
68
109
  The generic MCP capability declaration is all false:
69
110
 
@@ -79,16 +120,42 @@ An MCP participant therefore reports `advisory` enforcement and `manual` lifecyc
79
120
  workspace protection is the weakest live participant's real guarantee, one MCP session
80
121
  makes guarded claims advisory for the room.
81
122
 
82
- ## Durable polling semantics
83
-
84
- Every outgoing message commits first. `acc_message`, `acc_request`, `acc_reply`, and
85
- `acc_finish` cannot promise push; delivery results remain queued with a durable diagnostic.
86
- The recipient calls `acc_inbox` to retrieve the body. Being returned by a tool is
87
- `retrieved`, not proof that a model attended to or obeyed it. A reply or explicit ack is
88
- `acknowledged`.
89
-
90
- MCP is therefore a complete communication participant with higher latency, not a fake
91
- native adapter. Use it when a client can call tools but exposes no measured hook boundary.
123
+ ## Decision changes
124
+
125
+ `acc_message` with `kind: "decision"` accepts either `supersedes: ["message_x"]`
126
+ or `withdraws: ["message_x"]`: 1..16 unique existing decision IDs. Supply `to: []`
127
+ to inherit target authors and recipients, including offline participants, or add
128
+ recipients explicitly. Body states the new position or reason for withdrawal.
129
+ Any owned peer may record a change; competing branches are visible, not resolved by time.
130
+
131
+ `acc_sync {scope: "history", kind: "decision", current: true}` lists terminal
132
+ positions and withdrawals with bounded `decisionStatus` metadata. Exact history
133
+ reads include the same status and preserve receipts. `current` cannot accompany
134
+ an exact ID or other scopes/kinds. Replaced decisions leave ordinary inbox/attention;
135
+ they remain available by exact ID without an automatic acknowledgement.
136
+ See [decision lifecycle](PROTOCOL.md#decision-lifecycle).
137
+
138
+ ## Poll without overstating delivery
139
+
140
+ `acc_message`, `acc_request`, `acc_reply`, and `acc_finish` record their outgoing message
141
+ before attempting delivery. The installed server uses the delivery router and recipient
142
+ policy to offer addressed messages through eligible, opted-in native adapters. If no
143
+ eligible route accepts a pending message, it remains queued for durable retrieval.
144
+ Inspect the returned `delivery` outcomes; sending through MCP does not guarantee a native
145
+ offer, model attention, or a reply. These outgoing routes add no receiving capability to MCP.
146
+
147
+ Poll `acc_inbox`, `acc_status`, or `acc_sync` to observe changes. Never repeat a mutation
148
+ merely to poll. For an intentional send retry, reuse the same `clientMessageId` and payload.
149
+ Supply the key on the first call if you need it available after a lost response; an omitted
150
+ key is generated and returned in `message`.
151
+
152
+ An MCP recipient retrieves a body with `acc_inbox` and its exact `messageId`. That read
153
+ advances the receipt to `retrieved` when needed, without proving model attention. A reply
154
+ or explicit ack records `acknowledged`; that state alone proves neither a separate retrieval
155
+ nor a native reply. Inspect the answer message separately when a response is required.
156
+
157
+ Use MCP when a client can call tools but exposes no measured hook boundary, and allow for
158
+ the polling latency of incoming messages.
92
159
 
93
160
  Next: [Protocol](PROTOCOL.md) · [Capabilities](CAPABILITIES.md) ·
94
161
  [Security model](SECURITY_MODEL.md)