@scotthuang/agent-knock-knock 0.1.2 → 0.2.1
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 +17 -2
- package/README.md +36 -9
- package/dist/src/agent-session-provider.d.ts +25 -0
- package/dist/src/agent-session-provider.js +2 -0
- package/dist/src/agent-session-provider.js.map +1 -0
- package/dist/src/cli.js +1184 -57
- package/dist/src/cli.js.map +1 -1
- package/dist/src/codex-local-session-provider.d.ts +18 -0
- package/dist/src/codex-local-session-provider.js +87 -0
- package/dist/src/codex-local-session-provider.js.map +1 -0
- package/dist/src/codex-session-provider.d.ts +95 -0
- package/dist/src/codex-session-provider.js +304 -0
- package/dist/src/codex-session-provider.js.map +1 -0
- package/dist/src/codex-store-adapter.d.ts +27 -0
- package/dist/src/codex-store-adapter.js +124 -0
- package/dist/src/codex-store-adapter.js.map +1 -0
- package/dist/src/executors.d.ts +0 -6
- package/dist/src/executors.js +0 -6
- package/dist/src/executors.js.map +1 -1
- package/dist/src/openclaw-plugin.js +165 -19
- package/dist/src/openclaw-plugin.js.map +1 -1
- package/dist/src/protocol.d.ts +1 -1
- package/dist/src/session-takeover-planner.d.ts +49 -0
- package/dist/src/session-takeover-planner.js +80 -0
- package/dist/src/session-takeover-planner.js.map +1 -0
- package/openclaw.plugin.json +1 -5
- package/package.json +1 -1
- package/templates/openclaw-skills/agent-knock-knock/SKILL.md +36 -8
|
@@ -5,7 +5,7 @@ description: Delegate OpenClaw tasks to local Codex, Claude Code, and Cursor age
|
|
|
5
5
|
|
|
6
6
|
# Agent Knock Knock
|
|
7
7
|
|
|
8
|
-
Use this skill when the user says `AKK`, `akk`, `Agent Knock Knock`, asks OpenClaw to delegate coding work to Codex, Claude, or Cursor, asks what agent tasks are running, sends a follow-up to an agent task,
|
|
8
|
+
Use this skill when the user says `AKK`, `akk`, `Agent Knock Knock`, asks OpenClaw to delegate coding work to Codex, Claude, or Cursor, asks what agent tasks are running, sends a follow-up to an agent task, discovers existing local coding-agent sessions, takes over an existing native Codex session, recovers an unavailable agent session, cancels a running agent task, or closes an agent task.
|
|
9
9
|
|
|
10
10
|
Treat `AKK` and `akk` the same way.
|
|
11
11
|
|
|
@@ -38,7 +38,6 @@ Slash command forms:
|
|
|
38
38
|
- `/akk send <conversation-id> <message>`: send a follow-up to one open AKK session.
|
|
39
39
|
- `/akk cancel <conversation-id>`: request cooperative cancellation of the current in-flight prompt for one AKK session without closing it.
|
|
40
40
|
- `/akk recover <conversation-id>`: recover a session that is waiting for a recovery decision by starting a new agent session with AKK's saved protocol history summary.
|
|
41
|
-
- `/akk restart <conversation-id>`: restart a session that is waiting for a recovery decision by starting a new agent session with only the pending message.
|
|
42
41
|
- `/akk close <conversation-id> [reason]`: close one AKK session.
|
|
43
42
|
|
|
44
43
|
Natural-language forms:
|
|
@@ -52,15 +51,20 @@ Natural-language forms:
|
|
|
52
51
|
- `AKK send <conversation-id>: <message>` or follow-up requests for an existing open agent session: call `agent_knock_knock_send`.
|
|
53
52
|
- `AKK cancel <conversation-id>` or requests to stop the current running work without closing the session: call `agent_knock_knock_cancel`.
|
|
54
53
|
- `AKK recover <conversation-id>`: call `agent_knock_knock_recover`.
|
|
55
|
-
- `AKK restart <conversation-id>`: call `agent_knock_knock_restart`.
|
|
56
54
|
- `AKK close <conversation-id>`: call `agent_knock_knock_close`.
|
|
55
|
+
- `AKK Codex sessions`, `AKK Codex history`, or requests to list existing native Codex sessions outside AKK: call `agent_knock_knock_agent_discover` with `agent="codex"` and `scope="sessions"`.
|
|
56
|
+
- `AKK Codex active` or requests to list currently running local Codex CLI processes: call `agent_knock_knock_agent_discover` with `agent="codex"` and `scope="active"`.
|
|
57
|
+
- `AKK Codex capabilities` or requests to inspect Codex takeover support: call `agent_knock_knock_agent_discover` with `agent="codex"` and `scope="capabilities"`.
|
|
58
|
+
- `AKK takeover Codex <session-id>` or requests to take over an active Codex CLI session: call `agent_knock_knock_agent_takeover` with `agent="codex"` and `strategy="terminate_then_resume"`.
|
|
59
|
+
- `AKK safe resume Codex <session-id>` or requests to resume only after the original Codex CLI has already exited: call `agent_knock_knock_agent_takeover` with `agent="codex"` and `strategy="safe_resume"`.
|
|
60
|
+
- `AKK takeover Codex <session-id> with fork`, `AKK fork takeover Codex <session-id>`, or requests to take over without stopping the original Codex CLI: call `agent_knock_knock_agent_takeover` with `agent="codex"` and `strategy="fork"`.
|
|
57
61
|
|
|
58
62
|
Session reuse rule:
|
|
59
63
|
|
|
60
64
|
- If the user asks to continue, add, follow up, "send another task", "let it also", "tell it", "ask Codex/Claude/Cursor to also", "再让它", "继续让它", "给刚才那个", or otherwise refers to an existing AKK agent, reuse the most recent matching open AKK session instead of creating a new delegation.
|
|
61
65
|
- When the user gives a follow-up without a `conversation_id`, first call `agent_knock_knock_list`, choose the most recent open session that matches the requested agent if one is named, and then call `agent_knock_knock_send` with that `conversation_id`.
|
|
62
66
|
- `idle` means the agent completed the previous round but the AKK session is still open and should be reused for follow-ups.
|
|
63
|
-
- `
|
|
67
|
+
- `send` automatically falls back to AKK replay recovery when the previous coding-agent session is unavailable. If AKK still reports `needs_recovery`, ask the user to choose `AKK recover <conversation-id>`, `AKK close <conversation-id>`, or starting a new independent AKK delegation.
|
|
64
68
|
- Call `agent_knock_knock_delegate` only when the user clearly asks for a new independent AKK task/session, names a different agent that does not already have a suitable open session, or there is no matching open session to reuse.
|
|
65
69
|
|
|
66
70
|
Useful examples:
|
|
@@ -75,8 +79,10 @@ akk send task-20260618T010203Z-abcdef12: continue with the smaller implementatio
|
|
|
75
79
|
再让刚才那个 Codex 分析 ~/chrome-debug 为什么占空间
|
|
76
80
|
akk cancel task-20260618T010203Z-abcdef12
|
|
77
81
|
akk recover task-20260618T010203Z-abcdef12
|
|
78
|
-
akk restart task-20260618T010203Z-abcdef12
|
|
79
82
|
akk close task-20260618T010203Z-abcdef12
|
|
83
|
+
akk codex sessions
|
|
84
|
+
akk codex active
|
|
85
|
+
akk takeover codex 019ee559-7bb8-7fd1-970c-0f7b6978c44e
|
|
80
86
|
```
|
|
81
87
|
|
|
82
88
|
## Start A Conversation
|
|
@@ -118,15 +124,37 @@ If the plugin tool and delegation script are unavailable, stop and report that A
|
|
|
118
124
|
|
|
119
125
|
## Recovery Decisions
|
|
120
126
|
|
|
121
|
-
|
|
127
|
+
`AKK send <conversation-id>: <message>` automatically falls back to AKK replay recovery when the previous ACPX session is unavailable. This starts a fresh ACPX session, gives the coding agent AKK's saved protocol history summary, and includes the pending message.
|
|
128
|
+
|
|
129
|
+
When AKK still reports that a conversation is `needs_recovery`, do not automatically recover, start a replacement task, or close it. Explain the options and let the user choose:
|
|
122
130
|
|
|
123
131
|
- `AKK recover <conversation-id>`: use `agent_knock_knock_recover` to start a new coding-agent session with AKK's saved protocol history summary plus the pending message.
|
|
124
|
-
- `AKK restart <conversation-id>`: use `agent_knock_knock_restart` to start a new coding-agent session with only the pending message.
|
|
125
132
|
- `AKK close <conversation-id>`: use `agent_knock_knock_close` to close the task.
|
|
133
|
+
- Start a new independent `AKK <task>` delegation if the old task should not be recovered.
|
|
126
134
|
|
|
127
135
|
Make clear that `recover` is AKK replay recovery, not guaranteed native coding-agent session resume.
|
|
128
136
|
|
|
129
|
-
|
|
137
|
+
Do not start a replacement task without the user's explicit choice.
|
|
138
|
+
|
|
139
|
+
## Native Session Takeover
|
|
140
|
+
|
|
141
|
+
Native session takeover is for Codex sessions that were created outside AKK, such as a user-run terminal Codex CLI. It is separate from AKK managed conversation recovery.
|
|
142
|
+
|
|
143
|
+
Use `agent_knock_knock_agent_discover`, not `agent_knock_knock_list`, when the user asks about native Codex sessions outside AKK:
|
|
144
|
+
|
|
145
|
+
- `scope="sessions"` lists historical native Codex sessions from the local Codex store.
|
|
146
|
+
- `scope="active"` lists currently running local Codex CLI processes that AKK can identify.
|
|
147
|
+
- `scope="capabilities"` explains the supported takeover strategies.
|
|
148
|
+
|
|
149
|
+
Use `agent_knock_knock_agent_takeover` when the user wants AKK to take over an existing native Codex session. By default this tool is side-effect-free and returns a plan. When the plan is ready and the user explicitly wants AKK to manage the session, call it with `createConversation=true` to create an AKK conversation bound to the native session:
|
|
150
|
+
|
|
151
|
+
- `safe_resume`: allowed only when no active Codex CLI matches the session. If the result is `ready`, explain that this is safe to resume because AKK did not find an active conflicting CLI. If the user confirms attaching it to AKK, call again with `createConversation=true`, then use the returned `conversation_id` for `AKK send`, `AKK status`, and `AKK close`.
|
|
152
|
+
- `terminate_then_resume`: use when the user wants to take over an active native Codex CLI. The first call is side-effect-free. If the result is `requires_confirmation`, explain the exact pid, cwd, and session that would be stopped. Only after explicit user confirmation, call `agent_knock_knock_agent_takeover` again with `strategy="terminate_then_resume"`, `createConversation=true`, `confirmTerminate=true`, and `expectedPid=<confirmed pid>`. AKK will re-scan before terminating and will only stop an exact session match. If Codex does not expose a session id and the user still explicitly confirms a specific pid in the target cwd, you may add `allowCwdOnly=true`; explain that this is higher risk because it relies on pid and cwd rather than a visible session id.
|
|
153
|
+
- `fork`: use when the user wants to avoid stopping the original Codex CLI. First call returns a bounded context package plus `summaryPrompt` and `nextAction`; use that prompt to summarize as OpenClaw, ask the user to confirm, and do not inject raw full rollout history directly. After the user confirms the summary, call `agent_knock_knock_agent_takeover` again with `strategy="fork"`, `createConversation=true`, and `forkSummary=<approved summary>` to create the forked AKK-managed session. Then use the returned `conversation_id` with `AKK send` for follow-up work.
|
|
154
|
+
|
|
155
|
+
Do not present `fork` as a standalone command or standalone feature. It is a takeover strategy.
|
|
156
|
+
|
|
157
|
+
Do not use `resume-anyway` or start a second live client on the same native Codex session while another Codex CLI is active. That can create mixed session history where multiple clients do not see each other's live context until a later resume.
|
|
130
158
|
|
|
131
159
|
## Message Rules
|
|
132
160
|
|