u-foo 3.0.14 → 3.0.16

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.
@@ -1,250 +0,0 @@
1
- ---
2
- name: ubus
3
- description: |
4
- Check and handle pending event-bus messages when /ubus is explicitly invoked.
5
- Use when: (1) asked to check messages, (2) view bus status, (3) use watch/listen/auto modes.
6
- If not yet joined bus, will auto-join.
7
- ---
8
-
9
- # /ubus - Check Event Bus Messages
10
-
11
- Check and handle pending messages on the event bus when `/ubus` is explicitly
12
- invoked.
13
-
14
- ## Arguments
15
-
16
- - `/ubus` - Pull pending messages and show status
17
- - `/ubus watch` - Start background auto-notification (title badge + bell + notification center)
18
- - `/ubus stop` - Stop background auto-notification
19
- - `/ubus listen` - Foreground continuous listener, print new messages (suitable for side terminal)
20
- - `/ubus auto` - Unattended auto-execute (auto-inject `/ubus` and press Enter)
21
-
22
- ## Execution Flow
23
-
24
- ### 1. Check if .ufoo/bus exists
25
-
26
- ```bash
27
- if [[ ! -d ".ufoo/bus" ]]; then
28
- echo "Event bus not initialized, please run /uinit and select bus module"
29
- exit
30
- fi
31
- ```
32
-
33
- ### 2. Get or create subscriber ID
34
-
35
- **IMPORTANT**: Always check for existing subscriber ID first to avoid creating duplicates.
36
-
37
- ```bash
38
- # Reuse existing subscriber first (env -> whoami), join only if missing
39
- SUBSCRIBER="${UFOO_SUBSCRIBER_ID:-$(ufoo bus whoami 2>/dev/null || true)}"
40
- if [ -n "$SUBSCRIBER" ]; then
41
- echo "Using existing subscriber ID: $SUBSCRIBER"
42
- else
43
- # Not launched via uclaude/ucodex, need to join manually
44
- SUBSCRIBER=$(ufoo bus join | tail -n 1)
45
- echo "Joined event bus: $SUBSCRIBER"
46
- # Example output: codex:0e293156 (nickname: codex-1)
47
- fi
48
- ```
49
-
50
- **Why this matters**:
51
- - `uclaude`/`ucodex` automatically set `UFOO_SUBSCRIBER_ID` during launch
52
- - `ufoo bus whoami` can recover current ID even when env is missing
53
- - Re-joining may create identity drift and message routing issues
54
- - Always reuse existing ID when available
55
-
56
- To join with a custom nickname:
57
-
58
- ```bash
59
- ufoo bus join [session-id] [agent-type] "your-nickname"
60
- # Example: ufoo bus join abc123 claude-code "architect"
61
- ```
62
-
63
- ### 3. Handle arguments
64
-
65
- If argument is `watch`, use **Bash tool's `run_in_background: true`** to start background notification:
66
-
67
- ```bash
68
- # Title badge + bell + notification center (no accessibility permission needed)
69
- ufoo bus alert "$SUBSCRIBER" 2 --notify --daemon
70
- ```
71
-
72
- If argument is `listen`, foreground blocking listener (no background task tool needed):
73
-
74
- ```bash
75
- ufoo bus listen "$SUBSCRIBER" --from-beginning
76
- ```
77
-
78
- If argument is `auto`, use unattended auto-execute:
79
-
80
- ```bash
81
- # Start daemon (background resident), auto-inject /ubus + Enter on new message
82
- ufoo bus daemon --daemon
83
- ```
84
-
85
- Tips:
86
- - Need to use `uclaude`/`ucodex` wrapper to start Claude Code/Codex (auto-records tty)
87
- - Terminal.app needs Accessibility permission (for keyboard input injection)
88
-
89
- If argument is `stop`, stop background notification:
90
-
91
- ```bash
92
- ufoo bus alert "$SUBSCRIBER" --stop
93
- ```
94
-
95
- ### 4. Check pending events
96
-
97
- ```bash
98
- ufoo bus check "$SUBSCRIBER"
99
- ```
100
-
101
- The system automatically prefixes each message with `[ufoo]<from:id(nickname)>` to identify the sender. You do not need to add this prefix yourself.
102
-
103
- If pending events exist, output looks like:
104
-
105
- ```
106
- [ufoo]<from:claude-code:abc123(architect)>
107
- Type: message/targeted/message
108
- Content: {"message":"review src/main.ts","injection_mode":"immediate"}
109
- ```
110
-
111
- - The sender ID and nickname are in the `[ufoo]<from:...>` line — use the ID to reply
112
- - The actual task is in `Content.message`
113
-
114
- ### 5. IMPORTANT: Acknowledge messages after handling
115
-
116
- After you have read and processed the messages, you MUST acknowledge them to prevent repeated notifications:
117
-
118
- ```bash
119
- ufoo bus ack "$SUBSCRIBER"
120
- ```
121
-
122
- **This is critical** - if you don't ack, the runtime may retry delivery or keep
123
- the event pending.
124
-
125
- **Default behavior is ack-only, no reply.** If there's nothing to do (no actionable task, no question to answer, no follow-up the sender genuinely needs), just ack and stop. Silence is a valid response — see "Handling Received Messages" below for when a reply IS warranted.
126
-
127
- ### 6. Routing Override
128
-
129
- If the message explicitly instructs you to report to a specific PM/DEV/TEST ID, **send the result to that ID instead of the publisher**.
130
-
131
- ### 5. Show bus status
132
-
133
- ```bash
134
- ufoo bus status
135
- ```
136
-
137
- Output (now includes nicknames):
138
-
139
- ```
140
- === Event Bus Status ===
141
- My identity: claude-code:xyz789
142
- Online agents: 2
143
- - claude-code:abc123 (architect)
144
- - claude-code:xyz789 (dev-lead)
145
- Recent events: 5
146
- ```
147
-
148
- ## Managing Nicknames
149
-
150
- ### View and Change Nicknames
151
-
152
- ```bash
153
- # Change an agent's nickname
154
- ufoo bus rename <subscriber-id> "new-nickname"
155
- # Example: ufoo bus rename claude-code:47b1d525 "backend-dev"
156
-
157
- # Nickname alias command
158
- ufoo bus nick <subscriber-id> "new-nickname"
159
- ```
160
-
161
- **Important Notes:**
162
- - Nicknames must be globally unique
163
- - Cannot change nickname during join (use `rename` command instead)
164
- - Re-joining with same subscriber ID will reuse existing nickname
165
- - Auto-generated nicknames: `codex-1`, `codex-2`, `claude-1`, `claude-2`, etc.
166
-
167
- ## Handling Received Messages
168
-
169
- When receiving targeted messages, the default flow is **execute → ack → stop**.
170
- Replies are the exception, not the default.
171
-
172
- 1. **Understand request** — Read message content.
173
- 2. **Execute task** — If the message delegates a task, do it.
174
- 3. **`ufoo bus ack "$SUBSCRIBER"`** — Always ack, even when not replying.
175
- 4. **Reply ONLY when substantive.** Send `ufoo bus send` to the sender only if at least one of the following is true:
176
- - The sender asked a question → reply with the answer.
177
- - The sender delegated a task → reply with the result / artifact / status.
178
- - You discovered something the sender needs to proceed → reply with that fact.
179
-
180
- ```bash
181
- # Use this only when the criteria above are met.
182
- ufoo bus send "<sender-id>" "<substantive-reply>"
183
- ```
184
-
185
- ### Anti-pattern: greet / ack loops
186
-
187
- If the inbound message is itself just a greeting, an acknowledgment, or a
188
- pleasantry, **do not reply**. Acking is enough. A bare-acknowledgment reply
189
- will be auto-injected on the other side, triggering them to reply in kind,
190
- and the two of you will ping-pong forever.
191
-
192
- | Inbound | Reply? |
193
- |---|---|
194
- | `👋` / `hi` / `hello` / `你好` | ❌ ack only |
195
- | `👍` / `ok` / `收到` / `thanks` / `noted` | ❌ ack only |
196
- | `已完成 / done / finished` (without a result the sender asked for) | ❌ ack only |
197
- | `请把 src/foo.ts 改成 ...` (task) | ✅ reply with result |
198
- | `这个 bug 的根因是什么?` (question) | ✅ reply with answer |
199
- | `我帮你找到了 X,需要你做 Y` (request) | ✅ reply with status |
200
-
201
- When in doubt: ack and stop. If the sender genuinely needs something from you,
202
- they will follow up with a concrete question or task.
203
-
204
- ## Sending Messages
205
-
206
- After sending a message, do not run `/ubus`, poll, sleep, or wait for a reply.
207
- Continue the current task. Any follow-up message will be automatically injected
208
- into your prompt/session.
209
-
210
- ### Smart Routing (when you don't know the target ID)
211
-
212
- If the user says "notify codex to do X" without specifying an ID, use smart routing:
213
-
214
- ```bash
215
- # Step 1: Find candidates
216
- ufoo bus resolve "$SUBSCRIBER" codex
217
-
218
- # Output shows:
219
- # - If only 1 codex: directly shows the ID
220
- # - If multiple: shows each with nickname and message history
221
- ```
222
-
223
- Based on the output:
224
- - **Single match**: Use that ID directly
225
- - **Multiple matches**: Analyze the message history to find the right target
226
- - Look for context clues in previous conversations
227
- - If still unclear, ask the user which one, or send to all of that type
228
-
229
- ### Direct Send
230
-
231
- ```bash
232
- # Send to specific Agent by full ID
233
- ufoo bus send "claude-code:abc123" "message content"
234
-
235
- # Send to specific Agent by nickname (NEW!)
236
- ufoo bus send "architect" "message content"
237
- ufoo bus send "backend-dev" "message content"
238
-
239
- # Send to all Agents of same type
240
- ufoo bus send "codex" "message content"
241
-
242
- # Broadcast to everyone
243
- ufoo bus broadcast "message content"
244
- ```
245
-
246
- **Target Resolution Priority:**
247
- 1. Exact subscriber ID (e.g., `claude-code:abc123`)
248
- 2. Nickname match (e.g., `architect` → resolves to subscriber ID)
249
- 3. Agent type (e.g., `codex` → all codex agents)
250
- 4. Wildcard (`*` → all agents)
@@ -1,156 +0,0 @@
1
- ---
2
- name: uctx
3
- description: |
4
- Quick ufoo context status check. Shows decisions and context health.
5
- Use when: (1) Starting a session, (2) User says "uctx", (3) Need quick context refresh.
6
- For full initialization, use uinit (ufoo init CLI).
7
- ---
8
-
9
- # /uctx - AI Context Quick Check
10
-
11
- ## What this does
12
-
13
- Fast context check for daily use. Run at session start or anytime.
14
-
15
- Pre-flight reminder:
16
- - Default is no new decision.
17
- - Write a decision only for important architectural choices, trade-off outcomes, cross-agent coordination, or precedent-setting integration contracts.
18
- - Do NOT write decisions for routine tasks, simple bug fixes, trivial findings, or generic plan/evaluation/recommendation requests.
19
- - Durable project facts belong in shared memory, not decisions.
20
- Use: `ufoo ctx decisions new "<Title>"`
21
-
22
- ## Decision format (canonical)
23
-
24
- The context module tracks decisions only. Durable shared facts belong in shared memory. Decisions live at:
25
- `<project>/.ufoo/context/decisions/`
26
-
27
- Decision index (JSONL):
28
- `<project>/.ufoo/context/decisions.jsonl`
29
-
30
- Generate/update the index:
31
- ```bash
32
- ufoo ctx decisions index
33
- ```
34
-
35
- Each JSONL row includes:
36
- - `ts` (ISO timestamp)
37
- - `type` (`decision` or `decision_status`)
38
- - `file` (decision filename)
39
- - `author` (decision author or resolver)
40
-
41
- Create a new decision (only when the high-threshold rule above requires it):
42
- ```bash
43
- ufoo ctx decisions new "Short Title"
44
- ```
45
-
46
- **File naming:** `NNNN-<nickname>-short-title.md` (4-digit prefix + nickname + kebab-case slug).
47
-
48
- **Template for new decisions:**
49
- ```yaml
50
- ---
51
- status: open
52
- nickname: <nickname>
53
- ---
54
- # DECISION NNNN: <Title>
55
-
56
- Date: YYYY-MM-DD
57
- Author: <agent>
58
- Nickname: <nickname>
59
-
60
- Context:
61
- What led to this decision?
62
-
63
- Decision:
64
- What is now considered true?
65
-
66
- Implications:
67
- What must follow from this?
68
- ```
69
-
70
- **Status updates (only edit frontmatter):**
71
- ```yaml
72
- ---
73
- status: resolved
74
- resolved_by: <agent>
75
- resolved_at: YYYY-MM-DD
76
- ---
77
- ```
78
-
79
- Rules:
80
- - Decisions are append-only. Do not rewrite past content.
81
- - Only update the frontmatter when changing status.
82
-
83
- ## Workflow
84
-
85
- ### 1. Verify structure exists
86
-
87
- Check `.ufoo/context/decisions/` exists. If missing, tell user to run `ufoo init`.
88
-
89
- ### 2. List all decisions
90
-
91
- ```bash
92
- ufoo ctx decisions -l
93
- ```
94
-
95
- ### 3. Show latest decision
96
-
97
- ```bash
98
- ufoo ctx decisions -n 1
99
- ```
100
-
101
- ### 4. Report status
102
-
103
- Brief summary:
104
- - Open decisions count (need attention)
105
- - Total decisions count
106
- - Any issues found
107
- - Ready to work
108
-
109
- ## Output format
110
-
111
- ```
112
- === ufoo context status ===
113
- Project: <cwd>
114
- Decisions: N open, M total
115
- Latest open: DECISION XXXX: <title>
116
-
117
- [Latest decision content]
118
-
119
- Status: Ready ✓
120
- ```
121
-
122
- ## Handling Open Decisions
123
-
124
- When there are open decisions, you MUST:
125
-
126
- ### 1. Read and understand
127
- - Read the full content of each open decision
128
- - Understand what other agents decided
129
- - This is "syncing their memory to yours"
130
-
131
- ### 2. Check if action needed
132
- - Does the decision require implementation?
133
- - Is something already done that needs verification?
134
- - Are there implications you need to follow?
135
-
136
- ### 3. Execute if needed
137
- - If the decision requires action, do it first
138
- - Verify the action was successful
139
-
140
- ### 4. Then resolve
141
- Only after understanding and completing any required actions:
142
- ```yaml
143
- ---
144
- status: resolved
145
- resolved_by: <your-agent-name>
146
- resolved_at: <date>
147
- ---
148
- ```
149
-
150
- **NEVER resolve blindly.** Reading the title is not enough.
151
-
152
- ## Notes
153
-
154
- - Script defaults to showing only `open` decisions
155
- - Resolved decisions are skipped (already processed)
156
- - Use `-s all` to see all decisions regardless of status
@@ -1,76 +0,0 @@
1
- ---
2
- name: uinit
3
- description: |
4
- Initialize ufoo workspace state in current project.
5
- Use when: (1) new project needs context/bus enabled, (2) user inputs /uinit or /ufoo init.
6
- Provides interactive target selection, defaults to all selected.
7
- ---
8
-
9
- # uinit
10
-
11
- Initialize ufoo workspace state in current project.
12
-
13
- ## Trigger
14
-
15
- User inputs `/uinit` or `/ufoo init`
16
-
17
- ## Execution Flow
18
-
19
- ### 1. Ask user to select init targets
20
-
21
- Use AskUserQuestion tool, provide multi-select, default all selected:
22
-
23
- ```
24
- Please select ufoo state to enable:
25
-
26
- ☑ context - Shared context protocol (.ufoo/context/)
27
- ☑ bus - Agent event bus (.ufoo/bus/ + .ufoo/agent/)
28
- ```
29
-
30
- Options:
31
- - `context` (recommended) - Shared context, sparse decision log for major plan-level choices
32
- - `bus` (recommended) - Multi-agent communication, task delegation, message passing
33
-
34
- Default selected: context, bus
35
-
36
- ### 2. Execute initialization
37
-
38
- Based on user selection, execute:
39
-
40
- ```bash
41
- ufoo init --targets <selected_targets> --project $(pwd)
42
- ```
43
-
44
- ### 3. If bus target selected, auto-join bus
45
-
46
- ```bash
47
- SUBSCRIBER="${UFOO_SUBSCRIBER_ID:-$(ufoo bus whoami 2>/dev/null || true)}"
48
- if [ -n "$SUBSCRIBER" ]; then
49
- echo "Using existing subscriber ID: $SUBSCRIBER"
50
- else
51
- SUBSCRIBER=$(ufoo bus join | tail -1)
52
- echo "Joined event bus: $SUBSCRIBER"
53
- fi
54
- ```
55
-
56
- ### 4. Report initialization result
57
-
58
- ```
59
- === ufoo initialization complete ===
60
-
61
- Enabled ufoo state:
62
- ✓ core memory → .ufoo/memory/
63
- ✓ context → .ufoo/context/
64
- ✓ bus → .ufoo/bus/ + .ufoo/agent/
65
-
66
- My identity: claude-code:<session-id>
67
-
68
- Next steps:
69
- - Run /ctx to check context status
70
- - See AGENTS.md for protocol rules
71
- ```
72
-
73
- ## Notes
74
-
75
- - If .ufoo/memory, .ufoo/context, .ufoo/bus, or .ufoo/agent already exists, skip creation
76
- - After initialization, reuse existing subscriber ID first, join only as fallback (if bus enabled)
@@ -1,36 +0,0 @@
1
- ---
2
- name: ustatus
3
- description: |
4
- Unified ufoo status check. Shows banner, unread bus messages, and open decisions.
5
- Use when: (1) User asks for status, (2) Quick health check, (3) Before starting work.
6
- ---
7
-
8
- # ufoo Status
9
-
10
- ## What this does
11
-
12
- Quick, unified status view:
13
- - Banner
14
- - Unread bus messages (unacked queues)
15
- - Open decisions
16
-
17
- ## Workflow
18
-
19
- ### 1. Verify structure exists
20
-
21
- Check `.ufoo/` exists. If missing, tell user to run `ufoo init`.
22
-
23
- ### 2. Run status command
24
-
25
- ```bash
26
- ufoo status
27
- ```
28
-
29
- ### 3. Report status
30
-
31
- Briefly summarize:
32
- - Unread messages count
33
- - Open decisions count
34
- - Any immediate action needed
35
-
36
- If unread messages > 0, advise running `ufoo bus check <subscriber>` and `ufoo bus ack <subscriber>` after handling.