@scotthuang/agent-knock-knock 0.1.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,104 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ ### Added
6
+
7
+ - Added ACPX executor metadata so delegations can target Claude Code, Codex, or Cursor.
8
+ - Added CLI task management commands: `list`, `status`, `send`, and `close`.
9
+ - Added OpenClaw plugin tools for task listing, task status, follow-up sends, and local task close.
10
+ - Added the `/akk` OpenClaw command for direct delegation, task listing, status, follow-up sends, and task close from command-capable chat surfaces.
11
+ - Added manifest contracts and tool metadata for the new OpenClaw plugin tools.
12
+ - Added cooperative AKK cancellation through `agent-knock-knock cancel`, `agent_knock_knock_cancel`, and `/akk cancel <conversation-id>` for Codex, Claude, and Cursor ACPX sessions.
13
+ - Added Codex ACPX proxy and model configuration support for environments that require `ALL_PROXY` or a ChatGPT-compatible model id.
14
+ - Added lazy idle-timeout cleanup for idle AKK sessions, configurable with `idleTimeoutMinutes` and defaulting to 10080 minutes.
15
+ - Added runtime diagnostics logs under `~/.agent-knock-knock/logs`, with local timestamps, daily NDJSON files, secret redaction, log-level filtering, and retention cleanup.
16
+ - Added safe executor trace support through `agent-knock-knock status --trace` and the OpenClaw status tool's `trace` parameter, summarizing tool calls, permission requests, client events, monitor events, and redacted thinking markers.
17
+ - Added a coding-agent executor registry that centralizes Codex, Claude Code, and Cursor ACPX metadata, aliases, protocol actors, session naming, and proxy/model configuration.
18
+ - Added an explicit recovery-decision foundation with `needs_recovery`, `agent-knock-knock recover`, `agent-knock-knock restart`, `agent_knock_knock_recover`, `agent_knock_knock_restart`, `/akk recover`, and `/akk restart`.
19
+ - Added Cursor as a supported ACPX coding-agent executor with `AKK Cursor`, `/akk cursor`, `agent="cursor"`, Cursor session/model/proxy config keys, and conservative explicit recovery decisions.
20
+ - Added npm package metadata, public package file allowlist, and a tag-driven GitHub Actions release workflow for publishing `@scotthuang/agent-knock-knock`.
21
+ - Added `agent-knock-knock install-openclaw` for installing the packaged OpenClaw plugin and skill template locally.
22
+ - Added `agent-knock-knock doctor` for checking required local commands, available coding agents, and packaged runtime files.
23
+ - Added tests for Codex-backed delegation and task management flows.
24
+ - Added tests for the executor registry used by Codex, Claude Code, and Cursor.
25
+ - Added tests for explicit recovery decisions, AKK history replay recovery, and restart without history replay.
26
+ - Added tests for Cursor delegate, send, cancel, route metadata, and unavailable-session recovery decision behavior.
27
+ - Added tests for runtime diagnostics logging, redaction, retention cleanup, and CLI log emission.
28
+
29
+ ### Changed
30
+
31
+ - Changed actionable callback delivery from Gateway `sessions.send` to `chat.send` with `deliver: true`, so callbacks injected into channel-scoped OpenClaw sessions can use the original outbound channel route.
32
+ - Changed coding-agent `done` callbacks to move AKK conversations to `idle` instead of terminal `done`, allowing follow-up sends to continue the same session until manual close or idle timeout.
33
+ - Updated `done` callback messages to include concise AKK convenience commands such as `AKK list`, `AKK send <conversation-id>: <message>`, `AKK status`, and `AKK close`.
34
+ - Updated OpenClaw plugin routing descriptions so `AKK` and `akk` both indicate Agent Knock Knock, and unspecified AKK delegations default to Codex.
35
+ - Updated the OpenClaw skill template so follow-up language such as "continue", "再让它", or "给刚才那个" defaults to reusing the most recent matching open AKK session through `agent_knock_knock_send`.
36
+ - Updated the OpenClaw skill template with AKK cancel routing for stopping current in-flight work without closing the reusable AKK session.
37
+ - Updated the OpenClaw skill template with AKK/akk routing, configurable default-agent delegation, explicit agent routing, and task management tool usage.
38
+ - Updated follow-up sends from OpenClaw to launch the coding agent in the background so OpenClaw can continue to subsequent tool calls.
39
+ - Migrated the implementation source to TypeScript and moved runtime entrypoints to compiled `dist/src` output.
40
+ - Migrated the Node test suite to TypeScript and updated `npm test` to build before running compiled tests from `dist/test`.
41
+ - Updated `npm run build` to clean stale compiled output before TypeScript compilation, and added `prepack` so npm publish/pack builds fresh runtime files.
42
+ - Changed `delegate` to generate a unique ACPX session for each new coding-agent task unless a session is explicitly configured, preventing concurrent AKK tasks from sharing the same default Codex, Claude, or Cursor session.
43
+ - Added a background executor monitor that marks agent-waiting tasks `stalled` when the launched process exits without a callback or when the configurable `agentTimeoutMinutes` callback timeout is reached, then attempts to notify the original OpenClaw session.
44
+ - Renamed the OpenClaw skill template from `bidirectional-chat` to `agent-knock-knock` so the installed skill matches the project and plugin name.
45
+ - Updated documentation to describe local coding agents, task management, cooperative cancellation, and the home-directory conversation store.
46
+ - Updated documentation with the local update flow required to rebuild and reload the linked OpenClaw plugin after project changes.
47
+ - Updated the OpenClaw skill template and README with conservative recovery guidance for coding agents whose native session resume is unreliable.
48
+ - Updated the OpenClaw skill template, README, plugin manifest, and protocol docs for Cursor routing and task management.
49
+ - Updated README, plugin metadata, and skill guidance to document the configurable `defaultAgent` flow for unspecified AKK delegations.
50
+ - Documented ACPX approval behavior: Claude Code permission requests work with `--approve-all`, while some Codex sensitive operations can fail directly under AKK's non-interactive/background path instead of surfacing an approvable ACPX permission request.
51
+
52
+ ### Fixed
53
+
54
+ - Fixed OpenClaw plugin delegations generating `--record-only` callback commands even when Gateway callback delivery was configured, which caused completed Codex tasks to be logged locally without returning results to OpenClaw.
55
+ - Fixed chat-routed `/akk cursor ...`, `/akk claude ...`, and `/akk codex ...` requests being treated as unspecified delegations when OpenClaw called the delegate tool without an explicit `agent` parameter.
56
+
57
+ ### Verified
58
+
59
+ - `npm test` passes 53 tests.
60
+ - `npm --cache /private/tmp/akk-npm-cache pack --dry-run` verifies the scoped npm package contents.
61
+ - Local OpenClaw installation validated with the linked Agent Knock Knock plugin loaded, the updated `agent-knock-knock` skill installed, and the gateway restarted successfully.
62
+ - Live OpenClaw validation created a Claude task, listed Claude tasks, sent a follow-up message, and closed the task through plugin tools.
63
+ - Live OpenClaw validation created a Codex task with a configured `ALL_PROXY` value and `model=gpt-5.5/medium`, listed Codex tasks, sent a follow-up message, received Codex `done`, and closed the task through plugin tools.
64
+ - Live ACPX validation created smoke sessions for Codex and Claude Code, called AKK cancel for each, observed `executor_cancel_requested` events with status 0, and closed the smoke ACPX sessions.
65
+
66
+ ## 0.1.0 - 2026-05-16
67
+
68
+ Initial MVP for managed bidirectional agent delegation.
69
+
70
+ ### Added
71
+
72
+ - Added a minimal Node.js project with no runtime dependencies.
73
+ - Added structured bidirectional message protocol for OpenClaw manager and Claude Code developer roles.
74
+ - Added conversation state tracking with response-round budget support.
75
+ - Added budget thresholds:
76
+ - 50 response-round soft limit
77
+ - 100 response-round hard limit
78
+ - 30-round convergence warning
79
+ - 40-round completion/degrade/failure warning
80
+ - Added NDJSON event logging for conversations, messages, raw exchanges, and closure events.
81
+ - Added Claude Code bootstrap prompt generation.
82
+ - Added CLI commands for creating conversations, recording messages, generating bootstrap prompts, and delegating tasks.
83
+ - Added shell wrapper for delegation startup.
84
+ - Added OpenClaw skill template for bidirectional Claude Code delegation.
85
+ - Added protocol documentation.
86
+ - Added two-Claude simulation script for weather lookup and multi-round architecture decision scenarios.
87
+ - Added tests for response-round accounting, budget escalation, and done-message closure behavior.
88
+
89
+ ### Verified
90
+
91
+ - `npm test` passes.
92
+ - Conversation creation writes state and NDJSON logs.
93
+ - Message recording updates conversation state.
94
+ - Two-Claude architecture scenario completes with correct round accounting:
95
+ - `task`, `question`, `answer`, `question`, `answer` count as response rounds.
96
+ - `done` does not increment response rounds.
97
+ - Two-Claude weather scenario records blocked/failure flows when live weather lookup is unavailable.
98
+
99
+ ### Known Issues
100
+
101
+ - `blocked` handling was corrected after the first weather test; older logs may show `blocked` as `requires_response=false`.
102
+ - The two-Claude simulation currently stores full raw `acpx` output in logs, including client/tool status lines.
103
+ - The script does not yet parse the model's returned JSON into canonical message body fields.
104
+ - Real OpenClaw Gateway integration is not implemented yet; current implementation simulates OpenClaw with Manager Claude.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Agent Knock Knock contributors
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.
package/README.md ADDED
@@ -0,0 +1,397 @@
1
+ # agent-knock-knock
2
+
3
+ Agent Knock Knock lets OpenClaw delegate work to local coding agents such as Codex, Claude Code, and Cursor, keep those delegations alive as reusable tasks, and route follow-up messages or results back through OpenClaw.
4
+
5
+ The name is literal: OpenClaw knocks on the door of another coding agent, hands it a task, waits for the callback, and can knock again later with follow-up instructions. AKK provides the persistent task layer that makes that workflow practical across chat channels.
6
+
7
+ ## Why This Exists
8
+
9
+ OpenClaw already has built-in session spawning, but persistent ACP sessions can depend on thread-bound channels such as Discord or Telegram. That model works well when the external channel can attach replies to a stable thread.
10
+
11
+ Channels such as WeChat and many direct-message surfaces do not provide that same thread primitive. Without an external thread, OpenClaw needs another durable place to remember which coding agents are working, which task each agent owns, and where follow-up messages should go.
12
+
13
+ Agent Knock Knock fills that gap. It keeps local task state outside the chat channel, uses ACPX / ACP to talk to coding agents, and gives OpenClaw tools to delegate, list, inspect, continue, cancel, and close work without relying on any external channel feature.
14
+
15
+ ## What It Provides
16
+
17
+ - ACPX-backed delegation to Codex, Claude Code, and Cursor
18
+ - Reusable task sessions for follow-up messages after the first result
19
+ - Task listing, status inspection, follow-up send, cooperative cancellation, and local close
20
+ - Structured callbacks back into OpenClaw through the plugin Gateway method
21
+ - Conversation state stored in the user's home directory for recovery across OpenClaw turns
22
+ - Runtime diagnostics logs with local timestamps, redaction, and retention cleanup
23
+ - A short `AKK` routing convention for chat and `/akk` command surfaces
24
+
25
+ See [ROADMAP.md](ROADMAP.md) for planned reliability work and future orchestration features.
26
+
27
+ ## Project Status
28
+
29
+ Agent Knock Knock is an early public project. The core local OpenClaw delegation flow is usable, and the package can be installed globally from npm. The OpenClaw plugin and skill are still installed locally by the `agent-knock-knock install-openclaw` helper rather than through an OpenClaw plugin registry.
30
+
31
+ ## Architecture
32
+
33
+ OpenClaw is the top-level orchestrator. Agent Knock Knock runs as the OpenClaw plugin bridge, uses ACPX / ACP to communicate with local coding agents, and keeps enough local task state for OpenClaw to manage many concurrent coding-agent sessions.
34
+
35
+ ![Agent Knock Knock architecture](docs/assets/architecture.png)
36
+
37
+ ## Prerequisites
38
+
39
+ - Node.js 20+
40
+ - OpenClaw installed and running
41
+ - ACPX installed globally:
42
+
43
+ ```bash
44
+ npm install -g acpx
45
+ acpx --version
46
+ ```
47
+
48
+ - At least one local coding agent:
49
+ - Codex, if you want Codex delegation
50
+ - Claude Code, if you want Claude delegation
51
+ - Cursor, if you want Cursor delegation
52
+
53
+ Agent Knock Knock does not manage Codex, Claude Code, or Cursor authentication. Make sure the agent you want to use is already installed and logged in before delegating tasks.
54
+
55
+ ## Install
56
+
57
+ Install Agent Knock Knock globally:
58
+
59
+ ```bash
60
+ npm install -g @scotthuang/agent-knock-knock
61
+ agent-knock-knock install-openclaw
62
+ agent-knock-knock doctor
63
+ ```
64
+
65
+ `install-openclaw` installs and enables the OpenClaw plugin from the npm package, installs the Agent Knock Knock skill template, and restarts the OpenClaw Gateway by default. Use `--no-restart` if you want to restart the Gateway yourself.
66
+
67
+ If you are developing from a local checkout, you can ask OpenClaw to install it for you:
68
+
69
+ ```text
70
+ Install this Agent Knock Knock project into my local OpenClaw:
71
+ 1. Make sure Node.js 20+, OpenClaw, and at least one local coding agent such as Codex, Claude Code, or Cursor are installed.
72
+ 2. Install ACPX globally if it is missing: npm install -g acpx.
73
+ 3. Run npm install.
74
+ 4. Run npm run build.
75
+ 5. Link and enable the OpenClaw plugin from this repository.
76
+ 6. Install the Agent Knock Knock skill template into ~/.openclaw/skills/agent-knock-knock/SKILL.md.
77
+ 7. Restart the OpenClaw Gateway.
78
+ ```
79
+
80
+ Local development installation:
81
+
82
+ Install the plugin into OpenClaw during local development:
83
+
84
+ ```bash
85
+ npm install
86
+ npm run build
87
+ openclaw plugins install --link .
88
+ openclaw plugins enable agent-knock-knock
89
+ ```
90
+
91
+ Install the OpenClaw skill template so OpenClaw learns when to route chat requests to AKK:
92
+
93
+ ```bash
94
+ mkdir -p ~/.openclaw/skills/agent-knock-knock
95
+ cp templates/openclaw-skills/agent-knock-knock/SKILL.md ~/.openclaw/skills/agent-knock-knock/SKILL.md
96
+ ```
97
+
98
+ Apply local project updates to OpenClaw:
99
+
100
+ ```bash
101
+ npm install
102
+ npm run build
103
+ openclaw plugins install --link .
104
+ openclaw plugins enable agent-knock-knock
105
+ openclaw gateway restart
106
+ ```
107
+
108
+ Run this after pulling new code or editing TypeScript/plugin files. The OpenClaw plugin loads compiled files from `dist/`, so source changes do not take effect until `npm run build` has run and the Gateway has reloaded the linked plugin. If the skill template changes, copy `templates/openclaw-skills/agent-knock-knock/SKILL.md` to `~/.openclaw/skills/agent-knock-knock/SKILL.md` again.
109
+
110
+ ## OpenClaw Plugin
111
+
112
+ The native OpenClaw plugin registers tools that let OpenClaw delegate implementation work to Codex, Claude Code, or Cursor, list open sessions, send follow-up messages, inspect status, request cooperative cancellation, and close sessions without exposing raw terminal output as tool results.
113
+
114
+ Natural-language routing is designed around the short name `AKK`; lowercase `akk` should be treated the same way. When a user says `AKK` without naming an agent, OpenClaw should omit the agent parameter and let the plugin use `defaultAgent`. If `defaultAgent` is not configured, AKK falls back to Codex. Explicit requests such as `AKK Claude`, `AKK Cursor`, or `AKK Codex` override the default.
115
+
116
+ Configure the default coding agent in the plugin config:
117
+
118
+ ```json5
119
+ {
120
+ plugins: {
121
+ entries: {
122
+ "agent-knock-knock": {
123
+ config: {
124
+ defaultAgent: "codex" // "codex", "claude", or "cursor"
125
+ }
126
+ }
127
+ }
128
+ }
129
+ }
130
+ ```
131
+
132
+ Useful chat-style prompts:
133
+
134
+ ```text
135
+ akk: fix the failing tests in this project
136
+ AKK Codex: review the current branch and propose a small fix
137
+ AKK Claude: review the latest commit
138
+ AKK Cursor: fix the flaky UI test
139
+ akk list
140
+ akk send <conversation-id>: continue with the smaller implementation
141
+ akk cancel <conversation-id>
142
+ akk recover <conversation-id>
143
+ akk restart <conversation-id>
144
+ akk close <conversation-id>
145
+ ```
146
+
147
+ The plugin also registers the `/akk` slash command for channel surfaces that support OpenClaw native commands:
148
+
149
+ ```text
150
+ /akk <task>
151
+ /akk codex <task>
152
+ /akk claude <task>
153
+ /akk cursor <task>
154
+ /akk list
155
+ /akk status <conversation-id>
156
+ /akk send <conversation-id> <message>
157
+ /akk cancel <conversation-id>
158
+ /akk recover <conversation-id>
159
+ /akk restart <conversation-id>
160
+ /akk close <conversation-id> [reason]
161
+ ```
162
+
163
+ If your OpenClaw config uses a restrictive tool allowlist, allow the tool:
164
+
165
+ ```json5
166
+ {
167
+ tools: {
168
+ allow: [
169
+ "agent_knock_knock_delegate",
170
+ "agent_knock_knock_list",
171
+ "agent_knock_knock_status",
172
+ "agent_knock_knock_send",
173
+ "agent_knock_knock_cancel",
174
+ "agent_knock_knock_recover",
175
+ "agent_knock_knock_restart",
176
+ "agent_knock_knock_close"
177
+ ]
178
+ }
179
+ }
180
+ ```
181
+
182
+ The delegate tool launches the selected coding agent in the background and returns `status: "async_pending"`, `conversation_id`, `state_path`, `event_log_path`, launch status, and executor metadata. OpenClaw should yield after receiving this tool result and wait for the callback turn; follow-up communication should happen through structured protocol callbacks or `agent_knock_knock_send`, not by reading event logs, processes, files, session internals, stdout, or stderr.
183
+
184
+ The plugin also registers the Gateway method `agent-knock-knock.callback`. Coding-agent callback commands use this method to enqueue a durable next-turn injection for the OpenClaw session. Actionable callbacks such as `question`, `blocked`, `done`, `error`, or any message with `requires_response: true` are delivered into the OpenClaw session through Gateway `chat.send` with `deliver: true`, so OpenClaw receives only the structured protocol message and can route the final reply back through the original channel without polling the raw execution channel.
185
+
186
+ Coding-agent `done` callbacks mark the AKK conversation `idle`, not closed. Idle conversations remain visible in the default list and can receive `send` follow-ups until they are manually closed or lazily closed by the idle timeout. The default idle timeout is 10080 minutes.
187
+
188
+ New delegations create a fresh ACPX session by default, using a name like `akk-codex-20260620183511-88811e97`, `akk-claude-...`, or `akk-cursor-...`. This keeps concurrent AKK tasks isolated. Reuse happens through `AKK send <conversation-id>: <message>` against an existing AKK conversation, or by explicitly configuring/passing a fixed coding-agent session.
189
+
190
+ Background launches also start a small AKK monitor process. The monitor exits when the conversation receives a callback or otherwise leaves the agent-waiting state. If the executor process disappears before a callback, or if no callback arrives before `agentTimeoutMinutes`, the conversation is marked `stalled` and AKK attempts to notify the original OpenClaw session through the callback Gateway route. The default agent timeout is 60 minutes.
191
+
192
+ Some coding agents may not reliably resume a named ACPX session after their backing process disappears. Executors can opt into an explicit recovery decision flow. In that mode, a failed follow-up send marks the AKK conversation `needs_recovery` instead of automatically replaying history or starting a new session. The user can then choose:
193
+
194
+ - `AKK recover <conversation-id>`: start a new coding-agent session with AKK's saved protocol history summary plus the pending message.
195
+ - `AKK restart <conversation-id>`: start a new coding-agent session with only the pending message.
196
+ - `AKK close <conversation-id>`: close the AKK task without recovery.
197
+
198
+ Codex and Claude Code currently use native named-session recovery through ACPX. Cursor uses the explicit decision flow because its native session resume can be unreliable after the backing process disappears.
199
+
200
+ Task status can include a safe executor trace with `--trace` or the OpenClaw status tool's `trace: true` parameter. Trace summaries show client lifecycle events, tool call names and statuses, permission-request markers, monitor events, and short sanitized output previews. Agent thinking content is never returned; it is counted and marked as redacted.
201
+
202
+ ## CLI Examples
203
+
204
+ The CLI is useful for local debugging, tests, and scripting outside OpenClaw.
205
+
206
+ Create a conversation and print the task payload:
207
+
208
+ ```bash
209
+ node dist/src/cli.js new --request "Implement a small feature"
210
+ ```
211
+
212
+ Delegate a Codex task through ACPX:
213
+
214
+ ```bash
215
+ node dist/src/cli.js delegate \
216
+ --agent codex \
217
+ --request "Implement a small feature" \
218
+ --background
219
+ ```
220
+
221
+ Delegate a Cursor task through ACPX:
222
+
223
+ ```bash
224
+ node dist/src/cli.js delegate \
225
+ --agent cursor \
226
+ --request "Implement a small feature" \
227
+ --background
228
+ ```
229
+
230
+ List open coding-agent tasks:
231
+
232
+ ```bash
233
+ node dist/src/cli.js list
234
+ ```
235
+
236
+ Inspect a task with a safe executor trace:
237
+
238
+ ```bash
239
+ node dist/src/cli.js status \
240
+ --conversation <conversation-id> \
241
+ --trace
242
+ ```
243
+
244
+ Send a follow-up message to an existing task:
245
+
246
+ ```bash
247
+ node dist/src/cli.js send \
248
+ --conversation <conversation-id> \
249
+ --message "Use the smaller implementation."
250
+ ```
251
+
252
+ Request cooperative cancellation of the current in-flight prompt:
253
+
254
+ ```bash
255
+ node dist/src/cli.js cancel \
256
+ --conversation <conversation-id>
257
+ ```
258
+
259
+ Recover or restart a task that is waiting for an explicit recovery decision:
260
+
261
+ ```bash
262
+ node dist/src/cli.js recover \
263
+ --conversation <conversation-id>
264
+
265
+ node dist/src/cli.js restart \
266
+ --conversation <conversation-id>
267
+ ```
268
+
269
+ Close a task locally:
270
+
271
+ ```bash
272
+ node dist/src/cli.js close \
273
+ --conversation <conversation-id> \
274
+ --reason "No longer needed"
275
+ ```
276
+
277
+ ## Approval Behavior
278
+
279
+ AKK sends ACPX-backed coding-agent prompts with `--approve-all` so ACPX permission requests can proceed without an additional OpenClaw turn.
280
+
281
+ Claude Code permission requests work with this model. For example, a Claude Code write outside the repository workspace triggers ACPX `session/request_permission`; with `--approve-all`, ACPX approves the request and the write can complete.
282
+
283
+ Codex does not currently behave the same way for every sensitive operation under AKK. Some Codex sandbox-sensitive actions, such as writing outside the workspace in non-interactive execution, may fail directly with sandbox or permission errors instead of surfacing an ACPX permission request that AKK can approve. In those cases the action is currently unavailable through AKK's background Codex path; prefer Claude Code for tasks that require ACPX-approved filesystem access outside the workspace, or redesign the task to stay inside the configured workspace.
284
+
285
+ ## Development
286
+
287
+ Build TypeScript sources:
288
+
289
+ ```bash
290
+ npm run build
291
+ ```
292
+
293
+ Run type checking without writing `dist/`:
294
+
295
+ ```bash
296
+ npm run typecheck
297
+ ```
298
+
299
+ Run the full test suite. This builds first, then runs the compiled TypeScript tests from `dist/test` against the compiled `dist/src` output:
300
+
301
+ ```bash
302
+ npm test
303
+ ```
304
+
305
+ Run a two-Claude simulation:
306
+
307
+ ```bash
308
+ node scripts/two-claude-weather-test.js --location 广州
309
+ ```
310
+
311
+ Run named simulations:
312
+
313
+ ```bash
314
+ npm run simulate:architecture
315
+ npm run simulate:weather
316
+ ```
317
+
318
+ Print a readable transcript from an NDJSON log:
319
+
320
+ ```bash
321
+ npm run transcript -- --conversation .agent-knock-knock/conversations/<conversation-id>
322
+ ```
323
+
324
+ You can also read a specific event log file:
325
+
326
+ ```bash
327
+ npm run transcript -- --log .agent-knock-knock/conversations/<conversation-id>/events.ndjson
328
+ ```
329
+
330
+ Include raw model exchange events when debugging prompt/response payloads:
331
+
332
+ ```bash
333
+ npm run transcript -- --conversation .agent-knock-knock/conversations/<conversation-id> --include-raw
334
+ ```
335
+
336
+ ## Storage
337
+
338
+ Conversation state is stored under the user's home directory so a new OpenClaw session can recover the shared context independently from OpenClaw's own app state:
339
+
340
+ ```text
341
+ ~/.agent-knock-knock/
342
+ conversations/
343
+ <conversation-id>/
344
+ state.json
345
+ events.ndjson
346
+ <agent>-output.log
347
+ logs/
348
+ runtime-YYYY-MM-DD.ndjson
349
+ ```
350
+
351
+ Use `--store-dir <dir>` to override the conversation store location. `--log-dir <dir>` is still accepted as a compatibility alias. `<agent>-output.log` is diagnostic-only; OpenClaw should not read it as part of agent communication.
352
+
353
+ Runtime logs are diagnostic-only and are safe to use for local troubleshooting. They keep local timestamps, preserve useful absolute paths, redact common secrets, and are cleaned up by retention policy. Use `AKK_LOG_DIR`, `AKK_LOG_LEVEL`, and `AKK_LOG_RETENTION_DAYS` to override the defaults.
354
+
355
+ ## Defaults
356
+
357
+ - OpenClaw session: `agent:main:main`
358
+ - OpenClaw plugin default agent: configured with `defaultAgent`; fallback is `codex`
359
+ - Delegated ACPX session: generated per new task, unless explicitly configured with `session`, `codexSession`, `claudeSession`, or `cursorSession`
360
+ - CLI `new` fallback Claude session: `bidirectional`
361
+ - CLI `new` fallback Codex session: `codex`
362
+ - CLI `new` fallback Cursor session: `cursor`
363
+ - Codex model, when needed for ChatGPT-account compatibility: pass `model`/`codexModel` such as `gpt-5.5/medium`
364
+ - Cursor model, when needed: pass `model`/`cursorModel`
365
+ - Gateway URL: `ws://127.0.0.1:18789`
366
+ - Agent callback timeout: `60` minutes
367
+ - Soft response limit: `50`
368
+ - Hard response limit: `100`
369
+ - Store directory: `~/.agent-knock-knock/conversations`
370
+ - Runtime log directory: `~/.agent-knock-knock/logs`
371
+ - Runtime log retention: `14` days
372
+
373
+ ## Release
374
+
375
+ `package.json` is the version source. Create releases with npm's version command so the version commit and git tag stay aligned:
376
+
377
+ ```bash
378
+ npm version patch
379
+ git push
380
+ git push --tags
381
+ ```
382
+
383
+ Use `minor` for feature releases and `major` for breaking changes. Tags matching `v*` trigger the GitHub Actions release workflow, which runs the test suite, publishes `@scotthuang/agent-knock-knock` to npm with public access, and creates a GitHub Release from the tag notes.
384
+
385
+ The release workflow requires an `NPM_TOKEN` repository secret with permission to publish the npm package. GitHub's built-in `GITHUB_TOKEN` is used for creating the GitHub Release.
386
+
387
+ ## Contributing
388
+
389
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for local development, test, and pull request guidance.
390
+
391
+ ## Security
392
+
393
+ Please do not open public issues for sensitive security reports. See [SECURITY.md](SECURITY.md).
394
+
395
+ ## License
396
+
397
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,18 @@
1
+ import type { Actor } from "./protocol.js";
2
+ export declare function normalizeAcpxOutput({ conversationId, from, to, round, output, now }: {
3
+ conversationId: string;
4
+ from: Actor | string;
5
+ to: Actor | string;
6
+ round: number;
7
+ output: string;
8
+ now?: Date;
9
+ }): NormalizedAcpxEvent[];
10
+ export interface NormalizedAcpxEvent {
11
+ ts: string;
12
+ conversation_id: string;
13
+ event: string;
14
+ from?: string;
15
+ to?: string;
16
+ round?: number;
17
+ [key: string]: unknown;
18
+ }