@scotthuang/agent-knock-knock 0.2.0 → 0.2.2

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 CHANGED
@@ -1,8 +1,17 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## 0.2.2 - 2026-06-24
4
4
 
5
- No unreleased changes.
5
+ ### Added
6
+
7
+ - Added tmux-backed terminal-control takeover for native Codex sessions, including tmux pane metadata in active discovery, confirmed `terminal_control` attachment, direct follow-up sends to the existing pane, and a conservative `approve` command for the currently visible Codex approval prompt.
8
+
9
+ ## 0.2.1 - 2026-06-22
10
+
11
+ ### Changed
12
+
13
+ - Deprecated the standalone restart recovery path from the OpenClaw-facing tool, slash command, skill, and docs. Conversations that need recovery now present `recover`, `close`, or starting a new independent delegation.
14
+ - Changed `send` to automatically fall back to AKK replay recovery when the previous ACPX session is unavailable. Explicit recovery decisions remain available only through `--recovery-policy explicit`.
6
15
 
7
16
  ## 0.2.0 - 2026-06-22
8
17
 
package/README.md CHANGED
@@ -12,6 +12,8 @@ Channels such as WeChat and many direct-message surfaces do not provide that sam
12
12
 
13
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
14
 
15
+ BTW, it can also [take over a Codex task](#native-codex-takeover) you started in a terminal, so when you are away from your computer, OpenClaw can still pick it up and keep going.
16
+
15
17
  ## What It Provides
16
18
 
17
19
  - ACPX-backed delegation to Codex, Claude Code, and Cursor
@@ -24,10 +26,6 @@ Agent Knock Knock fills that gap. It keeps local task state outside the chat cha
24
26
 
25
27
  See [ROADMAP.md](ROADMAP.md) for planned reliability work and future orchestration features.
26
28
 
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
29
  ## Architecture
32
30
 
33
31
  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.
@@ -109,25 +107,7 @@ Run this after pulling new code or editing TypeScript/plugin files. The OpenClaw
109
107
 
110
108
  ## OpenClaw Plugin
111
109
 
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
- ```
110
+ Use `AKK` or `akk` in OpenClaw chat to delegate coding work. If no agent is named, AKK uses the plugin `defaultAgent`; if that is unset, it falls back to Codex. Explicit agent names override the default.
131
111
 
132
112
  Useful chat-style prompts:
133
113
 
@@ -139,12 +119,10 @@ AKK Cursor: fix the flaky UI test
139
119
  akk list
140
120
  akk send <conversation-id>: continue with the smaller implementation
141
121
  akk cancel <conversation-id>
142
- akk recover <conversation-id>
143
- akk restart <conversation-id>
144
122
  akk close <conversation-id>
145
123
  ```
146
124
 
147
- The plugin also registers the `/akk` slash command for channel surfaces that support OpenClaw native commands:
125
+ Surfaces that support OpenClaw native commands can use the same workflow through `/akk`:
148
126
 
149
127
  ```text
150
128
  /akk <task>
@@ -155,155 +133,62 @@ The plugin also registers the `/akk` slash command for channel surfaces that sup
155
133
  /akk status <conversation-id>
156
134
  /akk send <conversation-id> <message>
157
135
  /akk cancel <conversation-id>
158
- /akk recover <conversation-id>
159
- /akk restart <conversation-id>
160
136
  /akk close <conversation-id> [reason]
161
137
  ```
162
138
 
163
- If your OpenClaw config uses a restrictive tool allowlist, allow the tool:
139
+ Optional default-agent config:
164
140
 
165
141
  ```json5
166
142
  {
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
- ]
143
+ plugins: {
144
+ entries: {
145
+ "agent-knock-knock": {
146
+ config: {
147
+ defaultAgent: "codex" // "codex", "claude", or "cursor"
148
+ }
149
+ }
150
+ }
178
151
  }
179
152
  }
180
153
  ```
181
154
 
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.
155
+ ## Native Codex Takeover
185
156
 
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.
157
+ Experimental: AKK can discover and take over Codex CLI sessions that were started outside AKK. This is useful when you started Codex in a terminal, left the machine, and want OpenClaw to continue managing that work from chat.
187
158
 
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.
159
+ Discovery prompts:
189
160
 
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>
161
+ ```text
162
+ AKK Codex sessions
163
+ AKK Codex active
164
+ AKK Codex capabilities
257
165
  ```
258
166
 
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>
167
+ Takeover prompts:
264
168
 
265
- node dist/src/cli.js restart \
266
- --conversation <conversation-id>
169
+ ```text
170
+ AKK safe resume Codex <native-session-id>
171
+ AKK takeover Codex <native-session-id>
172
+ AKK terminal takeover Codex <native-session-id>
173
+ AKK fork takeover Codex <native-session-id>
174
+ AKK approve <conversation-id>
267
175
  ```
268
176
 
269
- Inspect and take over native Codex sessions that were started outside AKK:
177
+ Strategies:
270
178
 
271
- Experimental: native Codex takeover depends on best-effort local Codex session metadata, process scanning, and Codex CLI resume behavior. It may be unstable across Codex versions or unusual terminal states, so review the returned plan before confirming any takeover.
179
+ - `safe resume`: attach a stopped/inactive Codex session to AKK.
180
+ - `takeover`: stop an active matching Codex CLI after explicit confirmation, then resume it under AKK.
181
+ - `terminal takeover`: attach an active Codex CLI running inside tmux after explicit confirmation. AKK sends follow-ups directly to the tmux pane and can approve the currently visible Codex approval prompt.
182
+ - `fork takeover`: keep the original Codex CLI running, ask OpenClaw to summarize bounded source context, then create a new AKK-managed fork from that summary.
272
183
 
273
- ```bash
274
- node dist/src/cli.js agent discover \
275
- --agent codex \
276
- --scope active
277
-
278
- node dist/src/cli.js agent takeover \
279
- --agent codex \
280
- --session-id <native-codex-session-id> \
281
- --strategy terminate_then_resume
282
- ```
283
-
284
- `terminate_then_resume` is intentionally two-step. The first command returns the exact pid, cwd, and session that would be stopped. After confirming that plan, execute the takeover:
184
+ For long-running local Codex sessions that you may want OpenClaw to operate from WeChat, run Codex inside tmux. AKK does not require tmux, but tmux enables terminal-control takeover without stopping the original process:
285
185
 
286
186
  ```bash
287
- node dist/src/cli.js agent takeover \
288
- --agent codex \
289
- --session-id <native-codex-session-id> \
290
- --strategy terminate_then_resume \
291
- --create-conversation \
292
- --confirm-terminate \
293
- --expected-pid <confirmed-pid>
187
+ tmux new -s codex-work
188
+ codex
294
189
  ```
295
190
 
296
- AKK re-scans before terminating and only proceeds when the confirmed pid is still an exact match for the requested Codex session. After the process exits, AKK creates a managed conversation and future sends use native `codex exec resume`.
297
-
298
- Some Codex TUI processes do not expose the native session id in argv. In that case the default takeover remains blocked as ambiguous. For a deliberate local test or an operator-confirmed handoff, add `--allow-cwd-only` with `--expected-pid`; AKK will still re-scan and require that pid to be active in the target session cwd before terminating it.
299
-
300
- Close a task locally:
301
-
302
- ```bash
303
- node dist/src/cli.js close \
304
- --conversation <conversation-id> \
305
- --reason "No longer needed"
306
- ```
191
+ Avoid starting a second live client on the same active Codex session. It can mix session history in ways that neither live client sees until a later resume.
307
192
 
308
193
  ## Approval Behavior
309
194
 
@@ -385,21 +270,18 @@ Runtime logs are diagnostic-only and are safe to use for local troubleshooting.
385
270
 
386
271
  ## Defaults
387
272
 
388
- - OpenClaw session: `agent:main:main`
389
- - OpenClaw plugin default agent: configured with `defaultAgent`; fallback is `codex`
390
- - Delegated ACPX session: generated per new task, unless explicitly configured with `session`, `codexSession`, `claudeSession`, or `cursorSession`
391
- - CLI `new` fallback Claude session: `bidirectional`
392
- - CLI `new` fallback Codex session: `codex`
393
- - CLI `new` fallback Cursor session: `cursor`
394
- - Codex model, when needed for ChatGPT-account compatibility: pass `model`/`codexModel` using ACPX's bracket form such as `gpt-5.5[medium]`. AKK also normalizes the older slash shorthand `gpt-5.5/medium` to `gpt-5.5[medium]`.
395
- - Cursor model, when needed: pass `model`/`cursorModel`
396
- - Gateway URL: `ws://127.0.0.1:18789`
397
- - Agent callback timeout: `60` minutes
398
- - Soft response limit: `50`
399
- - Hard response limit: `100`
273
+ - Default agent: configured with `defaultAgent`; fallback is `codex`
274
+ - OpenClaw session: inherited from the current OpenClaw session; fallback is `agent:main:main`
275
+ - Delegated ACPX session: generated per new task, unless `session`, `codexSession`, `claudeSession`, or `cursorSession` is configured
276
+ - Agent callback timeout: `60` minutes before a waiting task is marked `stalled`
277
+ - Idle timeout: `10080` minutes before an idle task is lazily closed
278
+ - Soft response limit: `50` rounds
279
+ - Hard response limit: `100` rounds
400
280
  - Store directory: `~/.agent-knock-knock/conversations`
401
281
  - Runtime log directory: `~/.agent-knock-knock/logs`
402
282
  - Runtime log retention: `14` days
283
+ - Codex model: unset by default; configure `codexModel` only when your ACPX Codex setup requires one
284
+ - Cursor model: unset by default; configure `cursorModel` only when your ACPX Cursor setup requires one
403
285
 
404
286
  ## Release
405
287