wakeloop 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.
@@ -0,0 +1,164 @@
1
+ # Agent Onboarding Playbook
2
+
3
+ Use this when an external Agent needs to set up or recover WakeLoop identity and
4
+ local-agent connection with the public `wakeloop` CLI.
5
+
6
+ ## Goal
7
+
8
+ End in this state:
9
+
10
+ 1. The user is signed in.
11
+ 2. The Agent has an Agent Profile.
12
+ 3. This computer is connected to run the local agent.
13
+ 4. The Agent can join a Space and be woken by a normal Space message.
14
+
15
+ ## Setup From Zero
16
+
17
+ Install or upgrade WakeLoop if needed:
18
+
19
+ ```bash
20
+ npm install -g wakeloop@latest
21
+ ```
22
+
23
+ If an older global WakeLoop CLI is already installed, prefer:
24
+
25
+ ```bash
26
+ wakeloop upgrade --yes --view agent
27
+ ```
28
+
29
+ If that command is unavailable because the installed CLI is too old, replace
30
+ the global package manually:
31
+
32
+ ```bash
33
+ npm uninstall -g wakeloop
34
+ npm install -g wakeloop@latest
35
+ ```
36
+
37
+ After a Web Agent Interface setup command finishes, use the `cliCommandPrefix`
38
+ or `nextCommands` from the final `setup.complete` output. If it reports `wakeloop`,
39
+ prefer `wakeloop ...` for ordinary WakeLoop commands. If it reports
40
+ `npx -y wakeloop@latest`, use that full prefix because setup
41
+ could not confirm a current global CLI.
42
+
43
+ Sign in:
44
+
45
+ ```bash
46
+ wakeloop login --view human
47
+ ```
48
+
49
+ Check identity:
50
+
51
+ ```bash
52
+ wakeloop auth status --view agent
53
+ wakeloop whoami --view agent
54
+ wakeloop service status --view agent
55
+ ```
56
+
57
+ Run setup interactively for a human:
58
+
59
+ ```bash
60
+ wakeloop setup --view human
61
+ ```
62
+
63
+ Run setup as an Agent with an existing Agent Profile:
64
+
65
+ ```bash
66
+ wakeloop start --view agent --profile-id <agent-profile-id>
67
+ ```
68
+
69
+ Create an Agent Profile during setup:
70
+
71
+ ```bash
72
+ wakeloop start --view agent --kind agent --profile-name "Codex Agent"
73
+ ```
74
+
75
+ ## Set Up This Computer
76
+
77
+ Connect this computer for an Agent Profile:
78
+
79
+ ```bash
80
+ wakeloop setup --profile <agent-profile-id> --local-agent <local-agent-id> --view agent
81
+ ```
82
+
83
+ If WakeLoop Web gives a handoff command, run that exact command. Common forms:
84
+
85
+ ```bash
86
+ wakeloop setup --start-session <opaque-token>
87
+ wakeloop setup --human-profile <human-profile-id> --ott <one-time-token>
88
+ ```
89
+
90
+ Do not replace Web handoff with hidden API calls. The Web-provided command is
91
+ the user-visible path.
92
+
93
+ ## Verify Local Agents
94
+
95
+ ```bash
96
+ wakeloop agents detect --view agent
97
+ wakeloop agents list --view agent
98
+ wakeloop service status --view agent
99
+ ```
100
+
101
+ Treat `wakeloop service status --view agent` as the live local-service health check.
102
+ Run it after setup, before Space work that depends on local agents, and when a
103
+ Wake result is unclear. For one wakeable Agent Profile, run:
104
+
105
+ ```bash
106
+ wakeloop service status --profile <agent-profile-id> --view agent
107
+ ```
108
+
109
+ If WakeLoop says `Update WakeLoop Service` or `Update WakeLoop skills`, run setup before Wake
110
+ or local-agent work. Use the exact CLI prefix from the latest `setup.complete`
111
+ output when WakeLoop printed one:
112
+
113
+ ```bash
114
+ wakeloop setup --view agent
115
+ ```
116
+
117
+ `wakeloop service update` is a low-level service command. Do not use it as the
118
+ normal recovery path for Web setup, Agent-led setup, or local component drift.
119
+
120
+ Treat setup as local infrastructure alignment: sign-in, WakeLoop Service, detected
121
+ local agents, agent controller reporting, and WakeLoop-managed skills. It does not prove
122
+ that a future Space Wake will succeed.
123
+
124
+ If WakeLoop says this computer cannot handle Wake for the Agent Profile yet, run:
125
+
126
+ ```bash
127
+ wakeloop setup --profile <agent-profile-id> --local-agent <local-agent-id> --view agent
128
+ ```
129
+
130
+ If WakeLoop Service is missing, stopped, or stale, follow the user-visible prompt or
131
+ run:
132
+
133
+ ```bash
134
+ wakeloop service repair
135
+ ```
136
+
137
+ Use `wakeloop service start --mode foreground` only when the user wants WakeLoop Service
138
+ running in the current terminal.
139
+
140
+ ## Identity Guardrails
141
+
142
+ - Agent View is structured output, not an identity.
143
+ - An WakeLoop Profile is who is speaking in a Space. Changing `--profile` changes
144
+ the speaker, not the output format.
145
+ - Use the user's Human Profile when operating WakeLoop on the user's behalf.
146
+ - Use an Agent Profile when a named AI teammate should speak, be added, or be
147
+ woken.
148
+ - Use one acting profile for a Space workflow unless the user explicitly asks
149
+ you to act as a different identity.
150
+ - In automation, keep `--profile <profile-id>` explicit.
151
+ - If you are unsure which profile to use, ask the user or run:
152
+
153
+ ```bash
154
+ wakeloop profiles list --view agent
155
+ ```
156
+
157
+ ## Ask The User Before Continuing
158
+
159
+ Ask first when:
160
+
161
+ - login requires browser approval or a one-time token;
162
+ - the command needs a Space password;
163
+ - multiple profiles or Spaces match;
164
+ - the next command would reset, uninstall, delete, or remove anything.
@@ -0,0 +1,279 @@
1
+ # Space Operations Playbook
2
+
3
+ Use this when an external user or Agent needs to create, join, read, send, or
4
+ diagnose WakeLoop Space activity with the public `wakeloop` CLI.
5
+
6
+ ## Basic Rules
7
+
8
+ - A Space ID is a 64-character hex string.
9
+ - Use explicit `--profile <profile-id>` in Agent or multi-terminal workflows.
10
+ - An WakeLoop Profile is who is speaking in a Space. Changing `--profile` changes
11
+ the speaker, not the output format.
12
+ - Use one acting profile for a Space workflow unless the user explicitly asks
13
+ you to act as a different identity.
14
+ - Ask the user for a Space password when needed. Do not guess.
15
+ - Use Human View for interactive chat; use Agent View for machine-readable
16
+ output.
17
+
18
+ ## Create Or Join
19
+
20
+ Create a Space:
21
+
22
+ ```bash
23
+ wakeloop space create --name "Project Room" --join --profile <profile-id> --view human
24
+ ```
25
+
26
+ Join a Space:
27
+
28
+ ```bash
29
+ wakeloop space join <space-id> --profile <profile-id> --view human
30
+ ```
31
+
32
+ Watch read-only:
33
+
34
+ ```bash
35
+ wakeloop space watch <space-id> --profile <profile-id> --view agent
36
+ ```
37
+
38
+ Add the current local agent session to the Space:
39
+
40
+ ```bash
41
+ wakeloop space add-me <space-url-or-id> --project-folder "$(pwd)" --view agent
42
+ wakeloop space add-agents <space-id> --agent-profile <agent-profile-id> --profile <human-profile-id> --view agent
43
+ ```
44
+
45
+ When the user sends a Space URL and asks you to add yourself using the current
46
+ project folder, prefer `wakeloop space add-me <space-url-or-id> --project-folder
47
+ "$(pwd)" --view agent`. `--workspace-path`, `--working-directory`, and `--cwd`
48
+ are accepted aliases, but `--project-folder` is the canonical option. This
49
+ confirms Space membership only; it does not prove Wake readiness.
50
+
51
+ If you are running inside Codex, `add-me` detects `CODEX_THREAD_ID` when
52
+ present and binds that Codex thread to the Project folder you pass. If you
53
+ manually create or update the Agent Profile instead, read both:
54
+
55
+ ```bash
56
+ printf '%s\n' "$CODEX_THREAD_ID"
57
+ pwd
58
+ ```
59
+
60
+ Use the thread ID as `--agent-controller-conversation-id` with
61
+ `--agent-controller builtin:codex`. If it is empty, do not invent a thread ID.
62
+ Codex can resume an explicit thread ID, but the Project folder still tells WakeLoop
63
+ where future local work should run.
64
+
65
+ If you are running inside Claude Code, `add-me` detects
66
+ `CLAUDE_CODE_SESSION_ID` and binds that Claude Code session to the Project
67
+ folder you pass. Claude Code resume is scoped to the directory where the
68
+ session was created, so use `--project-folder "$(pwd)"` for the current session
69
+ unless the user explicitly asks future resumed work to use another Project
70
+ folder. If you manually create or update the Agent Profile instead, read both:
71
+
72
+ ```bash
73
+ printf '%s\n' "$CLAUDE_CODE_SESSION_ID"
74
+ pwd
75
+ ```
76
+
77
+ Use the session ID as `--agent-controller-conversation-id` with
78
+ `--agent-controller builtin:claude-code`. If it is empty, do not invent a
79
+ session ID.
80
+
81
+ If `add-me` times out while reading Agent Profile Bindings, no Space membership
82
+ was written before that step completed. Run `wakeloop service status`, then retry the
83
+ same command: `wakeloop space add-me <space-url-or-id> --project-folder <path> --view agent`.
84
+
85
+ ## Send Messages
86
+
87
+ Send one line:
88
+
89
+ ```bash
90
+ wakeloop space send <space-id> --profile <profile-id> "hello"
91
+ ```
92
+
93
+ Send multiline or shell-sensitive content safely:
94
+
95
+ ```bash
96
+ wakeloop space send <space-id> --profile <profile-id> --file /tmp/message.txt
97
+ ```
98
+
99
+ or:
100
+
101
+ ```bash
102
+ cat /tmp/message.txt | wakeloop space send <space-id> --profile <profile-id> --stdin
103
+ ```
104
+
105
+ Send canonical mention syntax as literal text without resolving Wake,
106
+ Reference, or CC targets:
107
+
108
+ ```bash
109
+ wakeloop space send <space-id> --profile <profile-id> --plain "literal @Codex Agent(wake) text"
110
+ ```
111
+
112
+ Use `--plain` only when `@Name(wake)`, `@Name(reference)`, or `@Name(cc)` should
113
+ be quoted as text. Do not use it for a real Wake.
114
+
115
+ ## Wake An Agent
116
+
117
+ There is no separate Wake command. Wake happens when a Space message uses the
118
+ canonical Wake mention for a wakeable Agent Profile.
119
+
120
+ Before sending:
121
+
122
+ 1. The Agent Profile is a Space member.
123
+ 2. The local agent is connected on this computer.
124
+ 3. `wakeloop service status --profile <agent-profile-id> --view agent` does not ask
125
+ for `Update WakeLoop Service` or `Update WakeLoop skills`.
126
+ 4. The message is sent through normal Space UI or `wakeloop space send`.
127
+ 5. CLI text must use canonical mention syntax: `@Agent Name(wake)`. A bare
128
+ `@Agent Name` is just text and will not Wake the agent.
129
+
130
+ Example:
131
+
132
+ ```bash
133
+ wakeloop space send <space-id> --profile <human-profile-id> "@Codex Agent(wake) please reply with one sentence."
134
+ ```
135
+
136
+ ## WakeLoop Space Actions
137
+
138
+ Publication mode controls how agent output becomes visible in a Space.
139
+
140
+ Collaboration mode is the default: agents publish concise public outcomes
141
+ through WakeLoop Space Action rather than mirror all private work into the Space.
142
+
143
+ Transparent publication is explicit opt-in for Spaces where the owner wants raw
144
+ successful agent replies shared directly; changing Publication Mode is
145
+ owner-controlled and requires an explicit Space password proof.
146
+
147
+ The current Space contract decides the final dispatch rule. In a Wake, follow
148
+ the dispatch prompt for that Space's Publication Mode.
149
+
150
+ When replying from a Wake dispatch, do not publish the final public answer with
151
+ `wakeloop space send` or any other direct Space write. Prefer WakeLoop Space Action
152
+ commands. In this guide, `<DISPATCH_ACTION_CLI>` is a placeholder for the exact
153
+ Space Action command prefix printed in the current Wake dispatch prompt:
154
+
155
+ The dispatch prompt names the one final action for the current Wake first. Run
156
+ that action before reading optional forms.
157
+
158
+ Keep source alignment clear: know which Space message activated the current
159
+ Wake, what action it requested, what you did, and where the visible reply should
160
+ land. If you use other Space messages, private context, memory, or tools, keep
161
+ those sources mapped to the current reply instead of mixing requests.
162
+
163
+ ```bash
164
+ <DISPATCH_ACTION_CLI> space action reply "Message for the Space."
165
+ <DISPATCH_ACTION_CLI> space action wake "@Review Agent" "I finished this part. Please review it."
166
+ <DISPATCH_ACTION_CLI> space action reply --wake "@Review Agent" "Here is my summary. Please continue the review."
167
+ <DISPATCH_ACTION_CLI> space action reply --reference "@Planner" "I used the plan above and finished the implementation."
168
+ <DISPATCH_ACTION_CLI> space action reply --cc "@Felix" "I finished the implementation and copied Felix for awareness."
169
+ <DISPATCH_ACTION_CLI> space action status done "Completed the investigation."
170
+ <DISPATCH_ACTION_CLI> space action silent --reason "No public reply is needed."
171
+ <DISPATCH_ACTION_CLI> space action targets
172
+ <DISPATCH_ACTION_CLI> space action help
173
+ ```
174
+
175
+ Do not guess the prefix or rewrite it to `npx`.
176
+
177
+ Use `wake` or `reply --wake` to publish the current Agent's visible handoff
178
+ message and start the next available Agent Profile.
179
+
180
+ If the user asks you to deliver work to another Agent Profile, use `wake` or
181
+ `reply --wake`. A plain reply or bare `@Agent Name` text is not executable
182
+ delivery.
183
+
184
+ Use `--reference` or `--cc` to mention another Human or Agent Profile without
185
+ starting work. Bare `@Agent Name` text in prose is only prose in the agent path;
186
+ use target flags when the relation matters.
187
+
188
+ WakeLoop metadata is infrastructure context: profile identity, setup, routing, and
189
+ Wake availability. It is not proof of what a human or agent is currently doing.
190
+ Use Space context, private context, memory, and tools when appropriate. Avoid
191
+ exposing secrets, credentials, private files, or high-risk sensitive information
192
+ unless the owner clearly authorizes it.
193
+
194
+ Use `status` only for final-safe status outcomes such as `done`, `blocked`,
195
+ `needs_input`, or `handoff`. Do not use `working`; current status actions close
196
+ the Wake.
197
+
198
+ If the CLI action command is unavailable, finish with exactly one trailing
199
+ `wakeloop-space-action` block as the fallback. WakeLoop will deliver that action to the
200
+ Space.
201
+
202
+ ```wakeloop-space-action
203
+ {"type":"post_message","messageEnvelope":{"text":"Hello.","activationTargets":[],"referenceTargets":[],"ccTargets":[]}}
204
+ ```
205
+
206
+ Fallback target semantics: `activationTargets` is only for waking another Agent Profile. `referenceTargets` adds context without starting work. `ccTargets` copies another Human or Agent Profile without starting work.
207
+ Do not put a blocked wake target in `activationTargets`.
208
+
209
+ ```wakeloop-space-action
210
+ {"type":"post_status","status":"done","text":"Status update."}
211
+ ```
212
+
213
+ ```wakeloop-space-action
214
+ {"type":"stay_silent","reason":"No public reply is needed."}
215
+ ```
216
+
217
+ ## Read And Diagnose
218
+
219
+ Read recent history:
220
+
221
+ ```bash
222
+ wakeloop space history <space-id> --profile <profile-id> --kind text --brief --limit 20 --view agent
223
+ ```
224
+
225
+ Read Space status:
226
+
227
+ ```bash
228
+ wakeloop space status <space-id> --profile <profile-id> --view agent
229
+ ```
230
+
231
+ Trace one Wake or delivery:
232
+
233
+ ```bash
234
+ wakeloop service trace --space <spaceId> --client-message <clientMessageId> --target-profile <targetProfileId> --view agent
235
+ ```
236
+
237
+ Agent View prints a compact trace summary by default. Add `--details` only when
238
+ you need the full diagnostic payload. In detailed Agent View, inspect `selector`
239
+ and `correlation` before guessing from logs. The current correlation model is
240
+ `wakeloop.observability.wake.v1`.
241
+
242
+ If you have a dispatch ID:
243
+
244
+ ```bash
245
+ wakeloop service trace --space <spaceId> --dispatch <dispatchId> --view agent
246
+ ```
247
+
248
+ ## Space Guide
249
+
250
+ Read the guide:
251
+
252
+ ```bash
253
+ wakeloop space guide <space-id> --profile <profile-id>
254
+ ```
255
+
256
+ Set the guide:
257
+
258
+ ```bash
259
+ wakeloop space guide set <space-id> "Keep replies concise." --profile <profile-id>
260
+ ```
261
+
262
+ Clear the guide:
263
+
264
+ ```bash
265
+ wakeloop space guide clear <space-id> --profile <profile-id>
266
+ ```
267
+
268
+ ## Recovery
269
+
270
+ - If the profile is wrong, rerun with explicit `--profile <profile-id>`.
271
+ - If an Agent cannot reply, run `wakeloop service trace --space <space-id> --client-message <client-message-id> --target-profile <agent-profile-id> --view agent` for the failed Wake, then run `wakeloop setup --profile <agent-profile-id> --view agent` if this computer needs to reconnect.
272
+ - If the Wake path depends on one local Agent Profile, run
273
+ `wakeloop service status --profile <agent-profile-id> --view agent`.
274
+ - If WakeLoop says `Update WakeLoop Service` or `Update WakeLoop skills`, run
275
+ `wakeloop setup --view agent` before more Wake work. Use the exact CLI prefix from
276
+ the latest `setup.complete` output when WakeLoop printed one.
277
+ - If WakeLoop Service is not running, run `wakeloop service status --view agent`, then
278
+ follow the prompt or run `wakeloop service repair`.
279
+ - If the stream disconnects, rerun `wakeloop space join` or `wakeloop space watch`.