sinapse-ai 7.3.3 → 7.4.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/.sinapse-ai/data/entity-registry.yaml +763 -765
- package/.sinapse-ai/development/templates/chrome-brain/knowledge-base/chrome-brain.md +161 -0
- package/.sinapse-ai/development/templates/chrome-brain/rules/chrome-brain-autoload.md +56 -0
- package/.sinapse-ai/development/templates/chrome-brain/scripts/chrome-brain-log.sh +67 -0
- package/.sinapse-ai/development/templates/chrome-brain/scripts/chrome-debug.sh +232 -0
- package/.sinapse-ai/development/templates/chrome-brain/scripts/chrome-ensure.sh +210 -0
- package/.sinapse-ai/development/templates/chrome-brain/squad-integrations/squad-animations.md +50 -0
- package/.sinapse-ai/development/templates/chrome-brain/squad-integrations/squad-brand.md +42 -0
- package/.sinapse-ai/development/templates/chrome-brain/squad-integrations/squad-claude.md +49 -0
- package/.sinapse-ai/development/templates/chrome-brain/squad-integrations/squad-cloning.md +50 -0
- package/.sinapse-ai/development/templates/chrome-brain/squad-integrations/squad-commercial.md +41 -0
- package/.sinapse-ai/development/templates/chrome-brain/squad-integrations/squad-content.md +45 -0
- package/.sinapse-ai/development/templates/chrome-brain/squad-integrations/squad-copy.md +44 -0
- package/.sinapse-ai/development/templates/chrome-brain/squad-integrations/squad-cybersecurity.md +42 -0
- package/.sinapse-ai/development/templates/chrome-brain/squad-integrations/squad-design.md +50 -0
- package/.sinapse-ai/development/templates/chrome-brain/squad-integrations/squad-growth.md +45 -0
- package/.sinapse-ai/development/templates/chrome-brain/squad-integrations/squad-paidmedia.md +47 -0
- package/.sinapse-ai/development/templates/chrome-brain/squad-integrations/squad-product.md +49 -0
- package/.sinapse-ai/development/templates/chrome-brain/squad-integrations/squad-research.md +41 -0
- package/.sinapse-ai/development/templates/chrome-brain/squad-integrations/squad-storytelling.md +41 -0
- package/.sinapse-ai/install-manifest.yaml +81 -5
- package/CHROME-BRAIN-INSTALL.md +93 -0
- package/README.md +28 -1
- package/bin/modules/chrome-brain-installer.js +757 -0
- package/bin/sinapse.js +18 -0
- package/install-chrome-brain.sh +1328 -0
- package/package.json +3 -1
- package/packages/sinapse-install/src/capabilities/chrome-brain.js +962 -0
- package/packages/sinapse-install/src/installer.js +60 -2
- package/sinapse/agents/sinapse-orqx.md +27 -0
|
@@ -0,0 +1,1328 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
5
|
+
# Chrome Brain — Full Install Script for SINAPSE Framework
|
|
6
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
7
|
+
# Installs the entire Chrome Brain capability on a machine with ~/.sinapse/
|
|
8
|
+
# Idempotent: safe to run multiple times.
|
|
9
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
10
|
+
|
|
11
|
+
# Colors
|
|
12
|
+
RED='\033[0;31m'
|
|
13
|
+
GREEN='\033[0;32m'
|
|
14
|
+
YELLOW='\033[1;33m'
|
|
15
|
+
CYAN='\033[0;36m'
|
|
16
|
+
BOLD='\033[1m'
|
|
17
|
+
NC='\033[0m' # No Color
|
|
18
|
+
|
|
19
|
+
FAIL_COUNT=0
|
|
20
|
+
WARN_COUNT=0
|
|
21
|
+
OK_COUNT=0
|
|
22
|
+
|
|
23
|
+
ok() { echo -e " ${GREEN}[OK]${NC} $1"; OK_COUNT=$((OK_COUNT + 1)); }
|
|
24
|
+
fail() { echo -e " ${RED}[FAIL]${NC} $1"; FAIL_COUNT=$((FAIL_COUNT + 1)); }
|
|
25
|
+
warn() { echo -e " ${YELLOW}[WARN]${NC} $1"; WARN_COUNT=$((WARN_COUNT + 1)); }
|
|
26
|
+
info() { echo -e " ${CYAN}[INFO]${NC} $1"; }
|
|
27
|
+
step() { echo -e "\n${BOLD}$1${NC}"; }
|
|
28
|
+
|
|
29
|
+
echo ""
|
|
30
|
+
echo -e "${BOLD}${CYAN}"
|
|
31
|
+
echo " ╔══════════════════════════════════════════════════════════════╗"
|
|
32
|
+
echo " ║ Chrome Brain — SINAPSE Install Script ║"
|
|
33
|
+
echo " ║ Browser Automation Capability for All 17 Squads ║"
|
|
34
|
+
echo " ╚══════════════════════════════════════════════════════════════╝"
|
|
35
|
+
echo -e "${NC}"
|
|
36
|
+
|
|
37
|
+
SINAPSE_DIR="$HOME/.sinapse"
|
|
38
|
+
|
|
39
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
40
|
+
# STEP 1: Prerequisites
|
|
41
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
42
|
+
|
|
43
|
+
step "Step 1/15 — Checking prerequisites..."
|
|
44
|
+
|
|
45
|
+
# Check Node.js >= 20
|
|
46
|
+
if command -v node &>/dev/null; then
|
|
47
|
+
NODE_VERSION=$(node -v | sed 's/v//' | cut -d. -f1)
|
|
48
|
+
if [ "$NODE_VERSION" -ge 20 ]; then
|
|
49
|
+
ok "Node.js $(node -v) (>= 20)"
|
|
50
|
+
else
|
|
51
|
+
fail "Node.js $(node -v) — need >= 20"
|
|
52
|
+
fi
|
|
53
|
+
else
|
|
54
|
+
fail "Node.js not found"
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
# Check npm
|
|
58
|
+
if command -v npm &>/dev/null; then
|
|
59
|
+
ok "npm $(npm -v)"
|
|
60
|
+
else
|
|
61
|
+
fail "npm not found"
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
# Check Google Chrome
|
|
65
|
+
if [ -d "/Applications/Google Chrome.app" ]; then
|
|
66
|
+
ok "Google Chrome installed"
|
|
67
|
+
else
|
|
68
|
+
fail "Google Chrome not found at /Applications/Google Chrome.app"
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
# Check SINAPSE framework
|
|
72
|
+
if [ -d "$SINAPSE_DIR" ]; then
|
|
73
|
+
ok "SINAPSE framework at $SINAPSE_DIR"
|
|
74
|
+
else
|
|
75
|
+
fail "SINAPSE framework not found at $SINAPSE_DIR"
|
|
76
|
+
echo -e " ${RED}Cannot continue without SINAPSE. Aborting.${NC}"
|
|
77
|
+
exit 1
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
81
|
+
# STEP 2: Install dev-browser globally
|
|
82
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
83
|
+
|
|
84
|
+
step "Step 2/15 — Installing dev-browser globally..."
|
|
85
|
+
|
|
86
|
+
if npm list -g dev-browser &>/dev/null 2>&1; then
|
|
87
|
+
ok "dev-browser already installed globally"
|
|
88
|
+
else
|
|
89
|
+
if npm i -g dev-browser 2>/dev/null; then
|
|
90
|
+
ok "dev-browser installed globally"
|
|
91
|
+
else
|
|
92
|
+
warn "dev-browser install failed (may need sudo or already available via npx)"
|
|
93
|
+
fi
|
|
94
|
+
fi
|
|
95
|
+
|
|
96
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
97
|
+
# STEP 3: Create ~/.local/bin/
|
|
98
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
99
|
+
|
|
100
|
+
step "Step 3/15 — Ensuring ~/.local/bin/ exists..."
|
|
101
|
+
|
|
102
|
+
mkdir -p "$HOME/.local/bin"
|
|
103
|
+
ok "~/.local/bin/ exists"
|
|
104
|
+
|
|
105
|
+
# Add to PATH if not present
|
|
106
|
+
if ! echo "$PATH" | tr ':' '\n' | grep -q "$HOME/.local/bin"; then
|
|
107
|
+
warn "~/.local/bin not in PATH. Add to your shell profile: export PATH=\"\$HOME/.local/bin:\$PATH\""
|
|
108
|
+
fi
|
|
109
|
+
|
|
110
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
111
|
+
# STEP 4: Create scripts in ~/.local/bin/
|
|
112
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
113
|
+
|
|
114
|
+
step "Step 4/15 — Creating scripts in ~/.local/bin/..."
|
|
115
|
+
|
|
116
|
+
# --- chrome-ensure ---
|
|
117
|
+
cat > "$HOME/.local/bin/chrome-ensure" << 'SCRIPT_EOF'
|
|
118
|
+
#!/bin/bash
|
|
119
|
+
PORT="${1:-9222}"
|
|
120
|
+
PROFILE="$HOME/.chrome-debug-profile"
|
|
121
|
+
CDP="http://127.0.0.1:$PORT/json/version"
|
|
122
|
+
if curl -sf "$CDP" -o /dev/null --max-time 1; then
|
|
123
|
+
exit 0
|
|
124
|
+
fi
|
|
125
|
+
if ! lsof -iTCP:$PORT -sTCP:LISTEN &>/dev/null; then
|
|
126
|
+
pgrep -f "user-data-dir=$PROFILE" | xargs kill 2>/dev/null
|
|
127
|
+
sleep 1
|
|
128
|
+
fi
|
|
129
|
+
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
|
|
130
|
+
--remote-debugging-port="$PORT" \
|
|
131
|
+
--user-data-dir="$PROFILE" \
|
|
132
|
+
--no-first-run \
|
|
133
|
+
&>/dev/null &
|
|
134
|
+
for i in {1..20}; do
|
|
135
|
+
if curl -sf "$CDP" -o /dev/null --max-time 1; then
|
|
136
|
+
exit 0
|
|
137
|
+
fi
|
|
138
|
+
sleep 0.5
|
|
139
|
+
done
|
|
140
|
+
echo "BLOCKED: Chrome debug failed to start on port $PORT. Run 'chrome-debug' manually." >&2
|
|
141
|
+
exit 1
|
|
142
|
+
SCRIPT_EOF
|
|
143
|
+
chmod +x "$HOME/.local/bin/chrome-ensure"
|
|
144
|
+
ok "chrome-ensure created"
|
|
145
|
+
|
|
146
|
+
# --- chrome-debug ---
|
|
147
|
+
cat > "$HOME/.local/bin/chrome-debug" << 'SCRIPT_EOF'
|
|
148
|
+
#!/bin/bash
|
|
149
|
+
PORT="${1:-9222}"
|
|
150
|
+
PROFILE="$HOME/.chrome-debug-profile"
|
|
151
|
+
if curl -s "http://127.0.0.1:$PORT/json/version" &>/dev/null; then
|
|
152
|
+
echo "Chrome debug already running on port $PORT"
|
|
153
|
+
exit 0
|
|
154
|
+
fi
|
|
155
|
+
pkill -a "Google Chrome" 2>/dev/null
|
|
156
|
+
sleep 2
|
|
157
|
+
echo "Launching Chrome with remote debugging on port $PORT..."
|
|
158
|
+
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
|
|
159
|
+
--remote-debugging-port="$PORT" \
|
|
160
|
+
--user-data-dir="$PROFILE" \
|
|
161
|
+
--no-first-run \
|
|
162
|
+
&>/dev/null &
|
|
163
|
+
for i in {1..15}; do
|
|
164
|
+
if curl -s "http://127.0.0.1:$PORT/json/version" &>/dev/null; then
|
|
165
|
+
echo "Chrome ready on port $PORT"
|
|
166
|
+
exit 0
|
|
167
|
+
fi
|
|
168
|
+
sleep 1
|
|
169
|
+
done
|
|
170
|
+
echo "ERROR: Chrome failed to start with debugging"
|
|
171
|
+
exit 1
|
|
172
|
+
SCRIPT_EOF
|
|
173
|
+
chmod +x "$HOME/.local/bin/chrome-debug"
|
|
174
|
+
ok "chrome-debug created"
|
|
175
|
+
|
|
176
|
+
# --- chrome-brain-log ---
|
|
177
|
+
cat > "$HOME/.local/bin/chrome-brain-log" << 'SCRIPT_EOF'
|
|
178
|
+
#!/bin/bash
|
|
179
|
+
LOG_DIR="$HOME/.chrome-brain"
|
|
180
|
+
LOG_FILE="$LOG_DIR/session-$(date +%Y%m%d).log"
|
|
181
|
+
COUNTER_FILE="$LOG_DIR/.screenshot-count"
|
|
182
|
+
mkdir -p "$LOG_DIR"
|
|
183
|
+
TOOL_NAME="${HOOK_TOOL_NAME:-unknown}"
|
|
184
|
+
TIMESTAMP=$(date +%H:%M:%S)
|
|
185
|
+
echo "$TIMESTAMP $TOOL_NAME" >> "$LOG_FILE"
|
|
186
|
+
if echo "$TOOL_NAME" | grep -qE "take_screenshot|take_snapshot"; then
|
|
187
|
+
COUNT=$(cat "$COUNTER_FILE" 2>/dev/null || echo 0)
|
|
188
|
+
COUNT=$((COUNT + 1))
|
|
189
|
+
echo "$COUNT" > "$COUNTER_FILE"
|
|
190
|
+
if [ "$COUNT" -eq 12 ]; then
|
|
191
|
+
echo "WARNING: 12 screenshots in this session. Consider saving state and rotating." >&2
|
|
192
|
+
elif [ "$COUNT" -ge 15 ]; then
|
|
193
|
+
echo "CRITICAL: 15+ screenshots. Session at risk of exceeding 20MB API limit. Save state NOW." >&2
|
|
194
|
+
fi
|
|
195
|
+
fi
|
|
196
|
+
exit 0
|
|
197
|
+
SCRIPT_EOF
|
|
198
|
+
chmod +x "$HOME/.local/bin/chrome-brain-log"
|
|
199
|
+
ok "chrome-brain-log created"
|
|
200
|
+
|
|
201
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
202
|
+
# STEP 5: Merge hooks into ~/.claude/settings.json
|
|
203
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
204
|
+
|
|
205
|
+
step "Step 5/15 — Merging hooks into ~/.claude/settings.json..."
|
|
206
|
+
|
|
207
|
+
mkdir -p "$HOME/.claude"
|
|
208
|
+
|
|
209
|
+
python3 << 'PYEOF'
|
|
210
|
+
import json, os, sys
|
|
211
|
+
|
|
212
|
+
settings_path = os.path.expanduser("~/.claude/settings.json")
|
|
213
|
+
|
|
214
|
+
# Load existing settings
|
|
215
|
+
if os.path.exists(settings_path):
|
|
216
|
+
with open(settings_path, "r") as f:
|
|
217
|
+
settings = json.load(f)
|
|
218
|
+
else:
|
|
219
|
+
settings = {}
|
|
220
|
+
|
|
221
|
+
# Define hooks to merge
|
|
222
|
+
hooks = {
|
|
223
|
+
"PreToolUse": [
|
|
224
|
+
{"matcher": "mcp__chrome-devtools__*", "hooks": [{"type": "command", "command": "chrome-ensure"}]},
|
|
225
|
+
{"matcher": "mcp__claude-in-chrome__*", "hooks": [{"type": "command", "command": "chrome-ensure"}]}
|
|
226
|
+
],
|
|
227
|
+
"PostToolUse": [
|
|
228
|
+
{"matcher": "mcp__chrome-devtools__*", "hooks": [{"type": "command", "command": "chrome-brain-log"}]},
|
|
229
|
+
{"matcher": "mcp__claude-in-chrome__*", "hooks": [{"type": "command", "command": "chrome-brain-log"}]}
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
# Merge hooks (replace existing hook entries by matcher, keep others)
|
|
234
|
+
if "hooks" not in settings:
|
|
235
|
+
settings["hooks"] = {}
|
|
236
|
+
|
|
237
|
+
for hook_type, hook_list in hooks.items():
|
|
238
|
+
existing = settings["hooks"].get(hook_type, [])
|
|
239
|
+
# Build set of matchers we want to add
|
|
240
|
+
new_matchers = {h["matcher"] for h in hook_list}
|
|
241
|
+
# Keep existing entries that don't conflict
|
|
242
|
+
filtered = [e for e in existing if e.get("matcher") not in new_matchers]
|
|
243
|
+
# Add our hooks
|
|
244
|
+
filtered.extend(hook_list)
|
|
245
|
+
settings["hooks"][hook_type] = filtered
|
|
246
|
+
|
|
247
|
+
with open(settings_path, "w") as f:
|
|
248
|
+
json.dump(settings, f, indent=2)
|
|
249
|
+
|
|
250
|
+
print("OK")
|
|
251
|
+
PYEOF
|
|
252
|
+
|
|
253
|
+
if [ $? -eq 0 ]; then
|
|
254
|
+
ok "Hooks merged into ~/.claude/settings.json"
|
|
255
|
+
else
|
|
256
|
+
fail "Failed to merge hooks into ~/.claude/settings.json"
|
|
257
|
+
fi
|
|
258
|
+
|
|
259
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
260
|
+
# STEP 6: Create ~/.sinapse/.claude/settings.json (standalone hooks)
|
|
261
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
262
|
+
|
|
263
|
+
step "Step 6/15 — Creating ~/.sinapse/.claude/settings.json..."
|
|
264
|
+
|
|
265
|
+
mkdir -p "$SINAPSE_DIR/.claude"
|
|
266
|
+
|
|
267
|
+
cat > "$SINAPSE_DIR/.claude/settings.json" << 'JSON_EOF'
|
|
268
|
+
{
|
|
269
|
+
"hooks": {
|
|
270
|
+
"PreToolUse": [
|
|
271
|
+
{
|
|
272
|
+
"matcher": "mcp__chrome-devtools__*",
|
|
273
|
+
"hooks": [
|
|
274
|
+
{
|
|
275
|
+
"type": "command",
|
|
276
|
+
"command": "chrome-ensure"
|
|
277
|
+
}
|
|
278
|
+
]
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"matcher": "mcp__claude-in-chrome__*",
|
|
282
|
+
"hooks": [
|
|
283
|
+
{
|
|
284
|
+
"type": "command",
|
|
285
|
+
"command": "chrome-ensure"
|
|
286
|
+
}
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
],
|
|
290
|
+
"PostToolUse": [
|
|
291
|
+
{
|
|
292
|
+
"matcher": "mcp__chrome-devtools__*",
|
|
293
|
+
"hooks": [
|
|
294
|
+
{
|
|
295
|
+
"type": "command",
|
|
296
|
+
"command": "chrome-brain-log"
|
|
297
|
+
}
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"matcher": "mcp__claude-in-chrome__*",
|
|
302
|
+
"hooks": [
|
|
303
|
+
{
|
|
304
|
+
"type": "command",
|
|
305
|
+
"command": "chrome-brain-log"
|
|
306
|
+
}
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
]
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
JSON_EOF
|
|
313
|
+
ok "~/.sinapse/.claude/settings.json created"
|
|
314
|
+
|
|
315
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
316
|
+
# STEP 7: Add Chrome DevTools MCP to ~/.claude.json
|
|
317
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
318
|
+
|
|
319
|
+
step "Step 7/15 — Merging Chrome DevTools MCP into ~/.claude.json..."
|
|
320
|
+
|
|
321
|
+
python3 << 'PYEOF'
|
|
322
|
+
import json, os
|
|
323
|
+
|
|
324
|
+
config_path = os.path.expanduser("~/.claude.json")
|
|
325
|
+
|
|
326
|
+
if os.path.exists(config_path):
|
|
327
|
+
with open(config_path, "r") as f:
|
|
328
|
+
config = json.load(f)
|
|
329
|
+
else:
|
|
330
|
+
config = {}
|
|
331
|
+
|
|
332
|
+
if "mcpServers" not in config:
|
|
333
|
+
config["mcpServers"] = {}
|
|
334
|
+
|
|
335
|
+
config["mcpServers"]["chrome-devtools"] = {
|
|
336
|
+
"command": "npx",
|
|
337
|
+
"args": ["chrome-devtools-mcp@latest", "--browser-url=http://127.0.0.1:9222"]
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
with open(config_path, "w") as f:
|
|
341
|
+
json.dump(config, f, indent=2)
|
|
342
|
+
|
|
343
|
+
print("OK")
|
|
344
|
+
PYEOF
|
|
345
|
+
|
|
346
|
+
if [ $? -eq 0 ]; then
|
|
347
|
+
ok "Chrome DevTools MCP merged into ~/.claude.json"
|
|
348
|
+
else
|
|
349
|
+
fail "Failed to merge MCP into ~/.claude.json"
|
|
350
|
+
fi
|
|
351
|
+
|
|
352
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
353
|
+
# STEP 8: Create chrome-brain-autoload.md rule
|
|
354
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
355
|
+
|
|
356
|
+
step "Step 8/15 — Creating chrome-brain-autoload.md rule..."
|
|
357
|
+
|
|
358
|
+
mkdir -p "$SINAPSE_DIR/.claude/rules"
|
|
359
|
+
|
|
360
|
+
cat > "$SINAPSE_DIR/.claude/rules/chrome-brain-autoload.md" << 'RULE_EOF'
|
|
361
|
+
# Chrome Brain — Auto-Activation & Auto-Learning Rule
|
|
362
|
+
|
|
363
|
+
> CRITICAL: This capability auto-activates and auto-learns. No command needed.
|
|
364
|
+
|
|
365
|
+
## Auto-Activation
|
|
366
|
+
|
|
367
|
+
When the user's prompt matches ANY of these patterns, Chrome Brain is active:
|
|
368
|
+
|
|
369
|
+
- **Browser**: abrir/navegar/acessar site, URL, pagina, chrome, aba
|
|
370
|
+
- **Cloning**: clonar/replicar/copiar site, pagina, hero, layout, animacao
|
|
371
|
+
- **Forms**: preencher/cadastrar/signup/login formulario, form, conta
|
|
372
|
+
- **Audit**: auditar/analisar/inspecionar site, performance, Lighthouse
|
|
373
|
+
- **Scraping**: extrair/scrape/coletar dados, conteudo, HTML, CSS
|
|
374
|
+
- **Animation**: animacao 3D, Three.js, WebGL, shader, canvas
|
|
375
|
+
|
|
376
|
+
## Protocol
|
|
377
|
+
|
|
378
|
+
1. Chrome connection is guaranteed by PreToolUse hook (chrome-ensure)
|
|
379
|
+
2. Select tooling: CDP > dev-browser > claude-in-chrome
|
|
380
|
+
3. Execute with NSN Mode enabled (never say "I can't" — try 3+ alternatives)
|
|
381
|
+
4. Track screenshot count — max 15 per session
|
|
382
|
+
5. Handoff results to domain squad when applicable
|
|
383
|
+
|
|
384
|
+
## Auto-Learning — MANDATORY
|
|
385
|
+
|
|
386
|
+
After completing ANY browser automation task, evaluate:
|
|
387
|
+
|
|
388
|
+
1. **Did something unexpected happen?** (error, workaround, new pattern)
|
|
389
|
+
2. **Did NSN Mode activate?** (barrier encountered and resolved)
|
|
390
|
+
3. **Is the solution generalizable?** (useful for future sessions)
|
|
391
|
+
|
|
392
|
+
If YES to any:
|
|
393
|
+
- Append the learning to the `## Learnings Log` section in:
|
|
394
|
+
`~/.sinapse/sinapse/knowledge-base/chrome-brain.md`
|
|
395
|
+
- Format:
|
|
396
|
+
```
|
|
397
|
+
### YYYY-MM-DD — [Summary]
|
|
398
|
+
**Barreira:** [description]
|
|
399
|
+
**Tentativas:** [what was tried]
|
|
400
|
+
**Solucao:** [what worked]
|
|
401
|
+
**Generalizavel:** sim/nao
|
|
402
|
+
**Squad afetada:** [which]
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
This ensures every session makes the next session smarter.
|
|
406
|
+
|
|
407
|
+
## Session Management
|
|
408
|
+
|
|
409
|
+
Track screenshots mentally. When approaching 12:
|
|
410
|
+
1. Save current state to handoff file
|
|
411
|
+
2. Suggest session rotation to user
|
|
412
|
+
3. Never exceed 15 screenshots in a single session
|
|
413
|
+
|
|
414
|
+
## Knowledge Base
|
|
415
|
+
|
|
416
|
+
Full reference: `~/.sinapse/sinapse/knowledge-base/chrome-brain.md`
|
|
417
|
+
RULE_EOF
|
|
418
|
+
ok "chrome-brain-autoload.md created"
|
|
419
|
+
|
|
420
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
421
|
+
# STEP 9: Create master KB chrome-brain.md
|
|
422
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
423
|
+
|
|
424
|
+
step "Step 9/15 — Creating master KB chrome-brain.md..."
|
|
425
|
+
|
|
426
|
+
mkdir -p "$SINAPSE_DIR/sinapse/knowledge-base"
|
|
427
|
+
|
|
428
|
+
cat > "$SINAPSE_DIR/sinapse/knowledge-base/chrome-brain.md" << 'KB_EOF'
|
|
429
|
+
# Chrome Brain — Browser Automation Capability
|
|
430
|
+
|
|
431
|
+
> Cross-squad capability que da a TODOS os agents do SINAPSE o poder de
|
|
432
|
+
> navegar, clonar, preencher, auditar e scrape qualquer site via Chrome real.
|
|
433
|
+
> Auto-ativado. Sem comando manual. NSN Mode sempre ligado.
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
## Arquitetura
|
|
438
|
+
|
|
439
|
+
```
|
|
440
|
+
Chrome (porta 9222, perfil ~/.chrome-debug-profile)
|
|
441
|
+
├── Chrome DevTools MCP (29 tools) — acoes rapidas, screenshots, Lighthouse
|
|
442
|
+
├── dev-browser (Playwright) — scraping complexo, batch, headless
|
|
443
|
+
└── claude-in-chrome (Extension) — fallback visual, coordenadas de tela
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
**Prioridade de tooling:** CDP > dev-browser > claude-in-chrome
|
|
447
|
+
|
|
448
|
+
**Auto-launch:** Hook PreToolUse roda `chrome-ensure` antes de qualquer tool chrome.
|
|
449
|
+
Nao precisa rodar `chrome-debug` manualmente.
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
453
|
+
## Decisao de Tooling
|
|
454
|
+
|
|
455
|
+
| Cenario | Ferramenta |
|
|
456
|
+
|---------|-----------|
|
|
457
|
+
| Click, fill, navegar | Chrome DevTools MCP |
|
|
458
|
+
| Screenshot/snapshot | Chrome DevTools MCP |
|
|
459
|
+
| Performance/Lighthouse | Chrome DevTools MCP |
|
|
460
|
+
| Network/Console | Chrome DevTools MCP |
|
|
461
|
+
| Scraping com logica JS | dev-browser evaluate() |
|
|
462
|
+
| Batch/loops | dev-browser |
|
|
463
|
+
| Headless | dev-browser --headless |
|
|
464
|
+
| Iframe cross-origin | claude-in-chrome ou CDP Input.dispatchMouseEvent |
|
|
465
|
+
| CAPTCHA | CDP mouse events no iframe (funciona cross-origin) |
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
## Patterns Validados
|
|
470
|
+
|
|
471
|
+
### Form Filling
|
|
472
|
+
|
|
473
|
+
**Multi-step forms (testado em 9 steps):**
|
|
474
|
+
1. navigate_page → URL
|
|
475
|
+
2. click → botao que abre form/modal
|
|
476
|
+
3. wait_for → form renderizar
|
|
477
|
+
4. Para cada step: take_snapshot → identificar tipo → fill/click → avancar
|
|
478
|
+
5. Ultimo step: click enviar
|
|
479
|
+
|
|
480
|
+
**Gotchas:**
|
|
481
|
+
- Sempre take_snapshot ANTES de preencher (mapeia seletores)
|
|
482
|
+
- Email duplicado retorna erro inline — ter fallback
|
|
483
|
+
- `fill` aceita seletor CSS direto
|
|
484
|
+
- Dropdowns: click no dropdown → click na opcao (nao fill)
|
|
485
|
+
|
|
486
|
+
### Site Cloning
|
|
487
|
+
|
|
488
|
+
**Fase 1 — Captura:**
|
|
489
|
+
1. navigate_page → URL alvo
|
|
490
|
+
2. take_screenshot (1 referencia)
|
|
491
|
+
3. evaluate_script → document.documentElement.outerHTML
|
|
492
|
+
4. evaluate_script → extrair fontes, cores, layout, breakpoints
|
|
493
|
+
5. Scroll + screenshot nos pontos criticos (max 3-4)
|
|
494
|
+
|
|
495
|
+
**Fase 2 — Analise:**
|
|
496
|
+
- Identificar stack (Next.js? Vite? React? Vanilla?)
|
|
497
|
+
- Mapear componentes (hero, nav, sections, footer)
|
|
498
|
+
- Identificar animacoes (Three.js, GSAP, CSS, Framer Motion)
|
|
499
|
+
- Identificar assets (modelos 3D, texturas, SVGs, fontes)
|
|
500
|
+
|
|
501
|
+
**Fase 3 — Recriacao:**
|
|
502
|
+
1. HTML single-file (inline CSS + JS)
|
|
503
|
+
2. Clonar shaders se WebGL
|
|
504
|
+
3. Testar em nova aba → comparar com original → iterar
|
|
505
|
+
|
|
506
|
+
**Casos validados:**
|
|
507
|
+
- itsoffbrand.com hero (orb WebGL, parallax, blend-mode) — 15min
|
|
508
|
+
- sinapse.club face 3D (Three.js r183, WaltHead.obj, bloom) — 20min
|
|
509
|
+
|
|
510
|
+
### Animacoes 3D via AI
|
|
511
|
+
|
|
512
|
+
Workflow: navigate Gemini → prompt descritivo → aguardar geracao →
|
|
513
|
+
evaluate_script extrair HTML → salvar arquivo → abrir em nova aba → validar
|
|
514
|
+
|
|
515
|
+
### CAPTCHA
|
|
516
|
+
|
|
517
|
+
| Estrategia | Resultado |
|
|
518
|
+
|-----------|----------|
|
|
519
|
+
| CDP Input.dispatchMouseEvent em iframe | FUNCIONA (bypassa cross-origin) |
|
|
520
|
+
| evaluate_script em iframe CAPTCHA | NAO FUNCIONA (same-origin policy) |
|
|
521
|
+
| Audio challenge reCAPTCHA | PENDENTE (promissor) |
|
|
522
|
+
| Continue with Google | PENDENTE (pula CAPTCHA se logado) |
|
|
523
|
+
|
|
524
|
+
**IMPORTANTE:** Apos 3-4 resolucoes corretas, Google detecta automacao e entra
|
|
525
|
+
em loop. Parar e mudar estrategia. Nao insistir.
|
|
526
|
+
|
|
527
|
+
---
|
|
528
|
+
|
|
529
|
+
## NSN Mode — Nunca Diga Nunca
|
|
530
|
+
|
|
531
|
+
**Protocolo ativo em TODOS os agents com Chrome Brain.**
|
|
532
|
+
|
|
533
|
+
Quando encontrar barreira:
|
|
534
|
+
1. **Classificar** — permission? technical? knowledge? external?
|
|
535
|
+
2. **Buscar** — WebSearch/WebFetch por workaround/solucao
|
|
536
|
+
3. **Tentar alternativas** — minimo 3 abordagens diferentes
|
|
537
|
+
4. **Configurar e testar** — instalar deps, ajustar permissoes, validar
|
|
538
|
+
5. **Repetir** — voltar ao passo 2 com novo contexto (max 5 ciclos)
|
|
539
|
+
6. **Escalar** — apos 5 falhas, reportar ao usuario com detalhes
|
|
540
|
+
|
|
541
|
+
**Anti-patterns:**
|
|
542
|
+
- NUNCA dizer "nao consigo" sem ter tentado alternativas
|
|
543
|
+
- NUNCA parar no primeiro erro
|
|
544
|
+
- NUNCA assumir que algo e impossivel sem pesquisar
|
|
545
|
+
- NUNCA pedir pro usuario fazer algo que o agent pode automatizar
|
|
546
|
+
|
|
547
|
+
**Excecoes:** acoes destrutivas, pagamentos, violacao de leis → pedir confirmacao
|
|
548
|
+
|
|
549
|
+
---
|
|
550
|
+
|
|
551
|
+
## Session Management
|
|
552
|
+
|
|
553
|
+
**Limites (prevencao de crash):**
|
|
554
|
+
- Max 15 screenshots por sessao
|
|
555
|
+
- Max 10 snapshots por sessao
|
|
556
|
+
- Preferir evaluate_script sobre take_snapshot (mais leve)
|
|
557
|
+
- Nunca screenshot + snapshot do mesmo estado
|
|
558
|
+
- Fechar tabs desnecessarias
|
|
559
|
+
- Salvar outputs em arquivo ANTES de acumular mais
|
|
560
|
+
|
|
561
|
+
**Rotacao:** A cada ~12 screenshots, salvar handoff e sugerir nova sessao.
|
|
562
|
+
|
|
563
|
+
---
|
|
564
|
+
|
|
565
|
+
## Learnings Log
|
|
566
|
+
|
|
567
|
+
> Secao atualizada automaticamente quando NSN Mode resolve problemas novos.
|
|
568
|
+
> Formato: data, barreira, tentativas, solucao, generalizavel, squad.
|
|
569
|
+
|
|
570
|
+
### 2026-03-27 — CAPTCHA reCAPTCHA via CDP
|
|
571
|
+
**Barreira:** Iframe cross-origin do Google bloqueia evaluate_script
|
|
572
|
+
**Tentativas:** evaluate_script (falhou) → cliclick (precisa permissao) → AppleScript (precisa permissao)
|
|
573
|
+
**Solucao:** CDP Input.dispatchMouseEvent com coordenadas calculadas a partir da posicao do iframe
|
|
574
|
+
**Generalizavel:** Sim — qualquer iframe cross-origin pode ser interagido via CDP raw events
|
|
575
|
+
**Squad afetada:** Todas (form filling, signup flows)
|
|
576
|
+
|
|
577
|
+
### 2026-03-27 — Chrome normal vs debug profile
|
|
578
|
+
**Barreira:** chrome-ensure matava o Chrome normal do usuario
|
|
579
|
+
**Tentativas:** pkill generico (matava tudo)
|
|
580
|
+
**Solucao:** pgrep -f "user-data-dir=$PROFILE" — mata apenas instancias do debug profile
|
|
581
|
+
**Generalizavel:** Sim — pattern para convivencia Chrome normal + debug
|
|
582
|
+
**Squad afetada:** Todas
|
|
583
|
+
|
|
584
|
+
### 2026-03-27 — Session crash por acumulo de screenshots (65MB)
|
|
585
|
+
**Barreira:** 46 screenshots + 31 snapshots = 31.8 MB de imagens, request excedeu 20MB
|
|
586
|
+
**Tentativas:** N/A (crash irrecuperavel)
|
|
587
|
+
**Solucao:** Limitar a 15 screenshots/sessao, preferir evaluate_script, rotacionar sessoes
|
|
588
|
+
**Generalizavel:** Sim — regra universal para qualquer sessao com browser automation
|
|
589
|
+
**Squad afetada:** Todas
|
|
590
|
+
KB_EOF
|
|
591
|
+
ok "chrome-brain.md created"
|
|
592
|
+
|
|
593
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
594
|
+
# STEP 10: Create 13 squad integration files
|
|
595
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
596
|
+
|
|
597
|
+
step "Step 10/15 — Creating 13 squad integration files..."
|
|
598
|
+
|
|
599
|
+
# Define the standard footer used by ALL squad integration files
|
|
600
|
+
FOOTER='## Tools Disponiveis
|
|
601
|
+
|
|
602
|
+
1. **Chrome DevTools MCP** (29 tools) — acoes rapidas, screenshots, audit
|
|
603
|
+
2. **dev-browser** — scraping complexo, batch operations
|
|
604
|
+
3. **claude-in-chrome** — fallback visual
|
|
605
|
+
|
|
606
|
+
## Session Management
|
|
607
|
+
|
|
608
|
+
- Max 15 screenshots por sessao
|
|
609
|
+
- Salvar outputs em arquivo antes de acumular
|
|
610
|
+
- Rotacionar sessao a cada ~12 screenshots
|
|
611
|
+
|
|
612
|
+
## NSN Mode
|
|
613
|
+
|
|
614
|
+
Ativo. Se uma acao de browser falhar, tentar alternativas automaticamente.
|
|
615
|
+
Buscar solucao na internet. Configurar, testar, repetir. Max 5 ciclos.
|
|
616
|
+
|
|
617
|
+
## Auto-Learning
|
|
618
|
+
|
|
619
|
+
Ao descobrir novo pattern ou resolver barreira via NSN, atualizar:
|
|
620
|
+
`~/.sinapse/sinapse/knowledge-base/chrome-brain.md` → secao Learnings Log
|
|
621
|
+
|
|
622
|
+
## Referencia Completa
|
|
623
|
+
|
|
624
|
+
`~/.sinapse/sinapse/knowledge-base/chrome-brain.md`'
|
|
625
|
+
|
|
626
|
+
# --- squad-animations ---
|
|
627
|
+
mkdir -p "$SINAPSE_DIR/squad-animations/knowledge-base"
|
|
628
|
+
cat > "$SINAPSE_DIR/squad-animations/knowledge-base/chrome-brain-integration.md" << SQUAD_EOF
|
|
629
|
+
# Chrome Brain Integration — Squad Animations (Kinetic)
|
|
630
|
+
> Squad Animations tem acesso ao Chrome Brain para captura de DOM, extracao de shaders, clonagem de animacoes e inspecao de scene graphs Three.js em sites de referencia.
|
|
631
|
+
## Tier: 1
|
|
632
|
+
## Quando Ativar
|
|
633
|
+
- Usuario pede para clonar ou replicar uma animacao de um site externo
|
|
634
|
+
- Precisa extrair shaders GLSL, vertex/fragment, de um canvas WebGL em producao
|
|
635
|
+
- Analise de scene graph Three.js (geometrias, materiais, luzes, cameras) de referencia ao vivo
|
|
636
|
+
- Identificacao de assets (modelos 3D, texturas, SVGs, fontes) usados em animacoes de terceiros
|
|
637
|
+
- Extracao de CSS @keyframes ou timelines GSAP/Framer Motion de uma pagina
|
|
638
|
+
- Preview e validacao de animacao recem-criada diretamente no browser
|
|
639
|
+
## O Que Recebe do Chrome Brain
|
|
640
|
+
- DOM snapshot completo (HTML + inline styles + computed styles)
|
|
641
|
+
- Screenshots de referencia (estados de animacao: inicio, meio, fim)
|
|
642
|
+
- Codigo fonte de shaders GLSL extraido via evaluate_script no contexto WebGL
|
|
643
|
+
- Scene graph Three.js serializado (renderer.info, scene.children recursivo)
|
|
644
|
+
- CSS @keyframes parseados e timelines GSAP/ScrollTrigger extraidas
|
|
645
|
+
- Lista de assets externos (URLs de .glb, .obj, .gltf, texturas, spritesheets)
|
|
646
|
+
- Performance traces de animacoes (FPS, paint timing, composite layers)
|
|
647
|
+
## O Que Envia pro Chrome Brain
|
|
648
|
+
- Animacoes recem-criadas para preview em nova aba (HTML single-file)
|
|
649
|
+
- Requests de captura em pontos especificos de scroll ou tempo
|
|
650
|
+
- Scripts de extracao customizados para injecao via evaluate_script
|
|
651
|
+
- Resultados de validacao visual (comparacao original vs clone)
|
|
652
|
+
- Novos patterns de extracao descobertos durante clonagem
|
|
653
|
+
|
|
654
|
+
$FOOTER
|
|
655
|
+
SQUAD_EOF
|
|
656
|
+
ok "squad-animations/chrome-brain-integration.md"
|
|
657
|
+
|
|
658
|
+
# --- squad-design ---
|
|
659
|
+
mkdir -p "$SINAPSE_DIR/squad-design/knowledge-base"
|
|
660
|
+
cat > "$SINAPSE_DIR/squad-design/knowledge-base/chrome-brain-integration.md" << SQUAD_EOF
|
|
661
|
+
# Chrome Brain Integration — Squad Design (Nexus)
|
|
662
|
+
> Squad Design tem acesso ao Chrome Brain para captura responsiva, inspecao de layout, auditoria de acessibilidade, Lighthouse scores e extracao de design systems de sites de referencia.
|
|
663
|
+
## Tier: 1
|
|
664
|
+
## Quando Ativar
|
|
665
|
+
- Precisa capturar screenshots responsivos (mobile 375px, tablet 768px, desktop 1440px) de uma pagina
|
|
666
|
+
- Inspecao de layout com DOM snapshot para mapear grid, flexbox, spacing e hierarquia de componentes
|
|
667
|
+
- Auditoria de acessibilidade: ARIA roles, labels, contrast ratios, tab order, focus states
|
|
668
|
+
- Extracao de design tokens de um site de referencia (cores, tipografia, spacing, border-radius)
|
|
669
|
+
- Lighthouse audit completo (performance, accessibility, best practices, SEO)
|
|
670
|
+
- Validacao visual de componente recem-implementado contra design spec
|
|
671
|
+
## O Que Recebe do Chrome Brain
|
|
672
|
+
- Screenshots responsivos em 3+ breakpoints (mobile, tablet, desktop)
|
|
673
|
+
- DOM snapshot com computed CSS de qualquer elemento
|
|
674
|
+
- Lighthouse report completo (scores + oportunidades + diagnosticos)
|
|
675
|
+
- ARIA tree e accessibility audit (roles, labels, contrast, violations)
|
|
676
|
+
- Design tokens extraidos: paleta de cores, font stack, spacing scale, shadows
|
|
677
|
+
- Layout grid/flexbox inspecionado (gap, columns, breakpoints, media queries)
|
|
678
|
+
- Core Web Vitals medidos em tempo real (LCP, FID, CLS, INP)
|
|
679
|
+
## O Que Envia pro Chrome Brain
|
|
680
|
+
- Requests de captura em breakpoints especificos
|
|
681
|
+
- Scripts de extracao de design tokens via evaluate_script
|
|
682
|
+
- Componentes para validacao visual em nova aba
|
|
683
|
+
- Checklists de acessibilidade para auditoria automatizada
|
|
684
|
+
- Resultados de comparacao visual (esperado vs implementado)
|
|
685
|
+
|
|
686
|
+
$FOOTER
|
|
687
|
+
SQUAD_EOF
|
|
688
|
+
ok "squad-design/chrome-brain-integration.md"
|
|
689
|
+
|
|
690
|
+
# --- squad-cloning ---
|
|
691
|
+
mkdir -p "$SINAPSE_DIR/squad-cloning/knowledge-base"
|
|
692
|
+
cat > "$SINAPSE_DIR/squad-cloning/knowledge-base/chrome-brain-integration.md" << SQUAD_EOF
|
|
693
|
+
# Chrome Brain Integration — Squad Cloning (Helix)
|
|
694
|
+
> Squad Cloning tem acesso ao Chrome Brain para captura completa de paginas (DOM+CSS+JS), extracao de transcripts, mapeamento de navegacao e automacao de formularios para clonagem cognitiva.
|
|
695
|
+
## Tier: 1
|
|
696
|
+
## Quando Ativar
|
|
697
|
+
- Pipeline de clonagem requer captura completa de um site (HTML + CSS + JS + assets)
|
|
698
|
+
- Extracao de transcripts de video embedados (YouTube, Vimeo, Loom)
|
|
699
|
+
- Mapeamento de estrutura de navegacao e information architecture de um site alvo
|
|
700
|
+
- Extracao de conteudo textual estruturado (headings, paragrafos, listas, quotes)
|
|
701
|
+
- Automacao de formularios multi-step para cognitive profiling (signup, onboarding)
|
|
702
|
+
- Captura de padroes de interacao (hover states, modals, dropdowns, accordions)
|
|
703
|
+
## O Que Recebe do Chrome Brain
|
|
704
|
+
- Full page HTML (document.documentElement.outerHTML) com inline styles
|
|
705
|
+
- CSS completo (stylesheets parseados, computed styles, custom properties)
|
|
706
|
+
- JavaScript comportamental (event listeners, state management, routing logic)
|
|
707
|
+
- Transcripts de video extraidos via API ou captions
|
|
708
|
+
- Sitemap/navegacao mapeada (links internos, hierarquia de paginas, breadcrumbs)
|
|
709
|
+
- Cognitive profile data: formularios preenchidos, respostas capturadas, fluxos percorridos
|
|
710
|
+
- Assets identificados e catalogados (fontes, imagens, icones, modelos 3D)
|
|
711
|
+
## O Que Envia pro Chrome Brain
|
|
712
|
+
- URLs alvo para captura sequencial (batch cloning)
|
|
713
|
+
- Scripts de extracao customizados para contextos especificos
|
|
714
|
+
- Formularios para preenchimento automatizado (cognitive profiling)
|
|
715
|
+
- Clones recem-criados para validacao visual side-by-side
|
|
716
|
+
- Mapa de navegacao para crawling orientado
|
|
717
|
+
|
|
718
|
+
$FOOTER
|
|
719
|
+
SQUAD_EOF
|
|
720
|
+
ok "squad-cloning/chrome-brain-integration.md"
|
|
721
|
+
|
|
722
|
+
# --- squad-claude ---
|
|
723
|
+
mkdir -p "$SINAPSE_DIR/squad-claude/knowledge-base"
|
|
724
|
+
cat > "$SINAPSE_DIR/squad-claude/knowledge-base/chrome-brain-integration.md" << SQUAD_EOF
|
|
725
|
+
# Chrome Brain Integration — Squad Claude (Claude Code Mastery)
|
|
726
|
+
> Squad Claude tem acesso ao Chrome Brain para documentacao de novos patterns de automacao, solucoes NSN, discovery de MCP tools, gestao de configuracao e otimizacao de prompts para tarefas de browser.
|
|
727
|
+
## Tier: 1
|
|
728
|
+
## Quando Ativar
|
|
729
|
+
- Descoberta de novo pattern de automacao que precisa ser documentado e testado
|
|
730
|
+
- Solucao NSN encontrada que precisa ser validada em browser real antes de registrar
|
|
731
|
+
- Discovery de novos MCP tools ou capabilities via browser (docs, changelogs, APIs)
|
|
732
|
+
- Configuracao de MCP servers ou Chrome DevTools que requer teste interativo
|
|
733
|
+
- Otimizacao de prompts para tarefas de browser (testar variantes, medir resultados)
|
|
734
|
+
- Debug de integracao Chrome Brain com outros squads (reproduzir problema no browser)
|
|
735
|
+
## O Que Recebe do Chrome Brain
|
|
736
|
+
- Resultados de testes de novos patterns de automacao (funciona/nao funciona)
|
|
737
|
+
- Screenshots de documentacao oficial (Claude, MCP, Chrome DevTools Protocol)
|
|
738
|
+
- Changelogs e release notes extraidos de sites de ferramentas
|
|
739
|
+
- Configuracoes testadas e validadas (JSON, YAML, env vars)
|
|
740
|
+
- Metricas de performance de diferentes abordagens de automacao
|
|
741
|
+
- Error logs e stack traces capturados durante debug de integracoes
|
|
742
|
+
## O Que Envia pro Chrome Brain
|
|
743
|
+
- Novos patterns validados para registro no Learnings Log
|
|
744
|
+
- Scripts de teste para validacao de configuracoes MCP
|
|
745
|
+
- Documentacao de solucoes NSN para propagacao cross-squad
|
|
746
|
+
- Prompts otimizados para tarefas de browser recorrentes
|
|
747
|
+
- Regras de auto-activation atualizadas baseadas em novos patterns
|
|
748
|
+
|
|
749
|
+
$FOOTER
|
|
750
|
+
SQUAD_EOF
|
|
751
|
+
ok "squad-claude/chrome-brain-integration.md"
|
|
752
|
+
|
|
753
|
+
# --- squad-paidmedia ---
|
|
754
|
+
mkdir -p "$SINAPSE_DIR/squad-paidmedia/knowledge-base"
|
|
755
|
+
cat > "$SINAPSE_DIR/squad-paidmedia/knowledge-base/chrome-brain-integration.md" << SQUAD_EOF
|
|
756
|
+
# Chrome Brain Integration — Squad Paid Media (Apex)
|
|
757
|
+
> Squad Paid Media tem acesso ao Chrome Brain para captura de landing pages de concorrentes, extracao de criativos publicitarios, analise de lead forms e auditoria Lighthouse de paginas de destino.
|
|
758
|
+
## Tier: 2
|
|
759
|
+
## Quando Ativar
|
|
760
|
+
- Analise de landing page de concorrente (estrutura, copy, CTA, formulario)
|
|
761
|
+
- Extracao de criativos publicitarios visiveis em bibliotecas de anuncios (Meta Ad Library, Google Ads Transparency)
|
|
762
|
+
- Auditoria de lead forms de concorrentes (campos, UX, numero de steps, fricao)
|
|
763
|
+
- Lighthouse audit de landing pages proprias ou de clientes (performance impacta Quality Score)
|
|
764
|
+
- Captura de SERP ads para analise de headlines, descriptions e extensoes
|
|
765
|
+
## O Que Recebe do Chrome Brain
|
|
766
|
+
- Screenshots de landing pages de concorrentes em multiplos breakpoints
|
|
767
|
+
- Estrutura de landing page extraida (hero, beneficios, prova social, CTA, formulario)
|
|
768
|
+
- Criativos de anuncios capturados da Meta Ad Library e Google Ads Transparency Center
|
|
769
|
+
- Lead form analysis: campos, tipos de input, validacoes, numero de steps
|
|
770
|
+
- Lighthouse scores de landing pages (performance, mobile usability)
|
|
771
|
+
- SERP screenshots com anuncios pagos destacados
|
|
772
|
+
## O Que Envia pro Chrome Brain
|
|
773
|
+
- URLs de landing pages para captura batch
|
|
774
|
+
- Filtros para Meta Ad Library (anunciante, pais, plataforma)
|
|
775
|
+
- Landing pages proprias para auditoria Lighthouse
|
|
776
|
+
- Requests de captura mobile-first (375px) para analise de UX mobile
|
|
777
|
+
|
|
778
|
+
$FOOTER
|
|
779
|
+
SQUAD_EOF
|
|
780
|
+
ok "squad-paidmedia/chrome-brain-integration.md"
|
|
781
|
+
|
|
782
|
+
# --- squad-growth ---
|
|
783
|
+
mkdir -p "$SINAPSE_DIR/squad-growth/knowledge-base"
|
|
784
|
+
cat > "$SINAPSE_DIR/squad-growth/knowledge-base/chrome-brain-integration.md" << SQUAD_EOF
|
|
785
|
+
# Chrome Brain Integration — Squad Growth (Catalyst)
|
|
786
|
+
> Squad Growth tem acesso ao Chrome Brain para medicao de Core Web Vitals, analise de network waterfall, captura de console errors, screenshots de SERP e performance traces.
|
|
787
|
+
## Tier: 2
|
|
788
|
+
## Quando Ativar
|
|
789
|
+
- Medicao de Core Web Vitals (LCP, CLS, INP, FCP, TTFB) de pagina em producao
|
|
790
|
+
- Analise de network waterfall para identificar bottlenecks de carregamento
|
|
791
|
+
- Captura de console errors e warnings em ambiente de producao
|
|
792
|
+
- Screenshots de SERP para analise de posicionamento organico e featured snippets
|
|
793
|
+
- Performance trace completo para diagnostico de jank, layout shifts ou long tasks
|
|
794
|
+
## O Que Recebe do Chrome Brain
|
|
795
|
+
- Core Web Vitals medidos em tempo real via Lighthouse e Performance API
|
|
796
|
+
- Network waterfall completo (requests, timings, tamanhos, cache hits/misses)
|
|
797
|
+
- Console messages filtrados por nivel (errors, warnings, info)
|
|
798
|
+
- SERP screenshots com posicoes organicas e paid destacadas
|
|
799
|
+
- Performance traces com flame chart (main thread, compositing, painting)
|
|
800
|
+
## O Que Envia pro Chrome Brain
|
|
801
|
+
- URLs para auditoria de performance em serie
|
|
802
|
+
- Configuracoes de throttling (3G, 4G, desktop) para testes
|
|
803
|
+
- Scripts de medicao customizados via evaluate_script
|
|
804
|
+
|
|
805
|
+
$FOOTER
|
|
806
|
+
SQUAD_EOF
|
|
807
|
+
ok "squad-growth/chrome-brain-integration.md"
|
|
808
|
+
|
|
809
|
+
# --- squad-content ---
|
|
810
|
+
mkdir -p "$SINAPSE_DIR/squad-content/knowledge-base"
|
|
811
|
+
cat > "$SINAPSE_DIR/squad-content/knowledge-base/chrome-brain-integration.md" << SQUAD_EOF
|
|
812
|
+
# Chrome Brain Integration — Squad Content
|
|
813
|
+
> Squad Content tem acesso ao Chrome Brain para extracao de conteudo textual, analise de estrutura editorial de concorrentes, captura de meta tags, headings e schema markup.
|
|
814
|
+
## Tier: 2
|
|
815
|
+
## Quando Ativar
|
|
816
|
+
- Extracao de conteudo textual completo de artigo ou pagina de concorrente
|
|
817
|
+
- Analise de estrutura editorial: hierarquia de headings, tamanho de secoes, densidade de keywords
|
|
818
|
+
- Captura de meta tags (title, description, OG tags, Twitter cards) para benchmark
|
|
819
|
+
- Inspecao de schema markup (JSON-LD, microdata) para rich snippets
|
|
820
|
+
- Mapeamento de content hub ou topic cluster de concorrente
|
|
821
|
+
## O Que Recebe do Chrome Brain
|
|
822
|
+
- Texto completo extraido com estrutura preservada (headings, paragrafos, listas)
|
|
823
|
+
- Meta tags parseados: title, description, canonical, OG, Twitter Card
|
|
824
|
+
- Schema markup extraido e validado (JSON-LD completo)
|
|
825
|
+
- Hierarquia de headings (H1-H6) com contagem e distribuicao
|
|
826
|
+
- Links internos mapeados (anchor text, destino, contexto)
|
|
827
|
+
## O Que Envia pro Chrome Brain
|
|
828
|
+
- URLs de artigos/paginas para extracao batch
|
|
829
|
+
- Scripts de extracao customizados para formatos especificos
|
|
830
|
+
- Seletores CSS para conteudo principal
|
|
831
|
+
|
|
832
|
+
$FOOTER
|
|
833
|
+
SQUAD_EOF
|
|
834
|
+
ok "squad-content/chrome-brain-integration.md"
|
|
835
|
+
|
|
836
|
+
# --- squad-copy ---
|
|
837
|
+
mkdir -p "$SINAPSE_DIR/squad-copy/knowledge-base"
|
|
838
|
+
cat > "$SINAPSE_DIR/squad-copy/knowledge-base/chrome-brain-integration.md" << SQUAD_EOF
|
|
839
|
+
# Chrome Brain Integration — Squad Copy (Quill Prime)
|
|
840
|
+
> Squad Copy tem acesso ao Chrome Brain para extracao de copy de landing pages, analise de headlines/CTAs/bullets, mapeamento de sales pages e teste de copy via injecao de scripts.
|
|
841
|
+
## Tier: 2
|
|
842
|
+
## Quando Ativar
|
|
843
|
+
- Extracao de copy completa de landing page ou sales page de concorrente
|
|
844
|
+
- Analise de headlines, subheadlines, CTAs e bullet points de paginas de alta conversao
|
|
845
|
+
- Mapeamento de estrutura de sales page (hook, problema, agitacao, solucao, prova, oferta, urgencia, CTA)
|
|
846
|
+
- Teste de variantes de copy via evaluate_script (injectar headline alternativa)
|
|
847
|
+
- Benchmark de copy patterns em multiplas paginas do mesmo nicho
|
|
848
|
+
## O Que Recebe do Chrome Brain
|
|
849
|
+
- Copy completa extraida com hierarquia preservada
|
|
850
|
+
- Headlines e subheadlines isolados para analise de patterns
|
|
851
|
+
- CTAs capturados com contexto (posicao, cor, tamanho, texto)
|
|
852
|
+
- Estrutura de sales page mapeada por funcao persuasiva
|
|
853
|
+
## O Que Envia pro Chrome Brain
|
|
854
|
+
- URLs de sales pages para extracao batch
|
|
855
|
+
- Scripts de injecao de copy alternativa para teste visual A/B
|
|
856
|
+
- Seletores para captura de secoes especificas
|
|
857
|
+
|
|
858
|
+
$FOOTER
|
|
859
|
+
SQUAD_EOF
|
|
860
|
+
ok "squad-copy/chrome-brain-integration.md"
|
|
861
|
+
|
|
862
|
+
# --- squad-research ---
|
|
863
|
+
mkdir -p "$SINAPSE_DIR/squad-research/knowledge-base"
|
|
864
|
+
cat > "$SINAPSE_DIR/squad-research/knowledge-base/chrome-brain-integration.md" << SQUAD_EOF
|
|
865
|
+
# Chrome Brain Integration — Squad Research (Prism)
|
|
866
|
+
> Squad Research tem acesso ao Chrome Brain para coleta de dados de sites concorrentes, precos publicos, portfolios e case studies.
|
|
867
|
+
## Tier: 3
|
|
868
|
+
## Quando Ativar
|
|
869
|
+
- Coleta de dados publicos de concorrentes (servicos, precos, equipe, localizacoes)
|
|
870
|
+
- Captura de portfolios e case studies de empresas de referencia
|
|
871
|
+
- Extracao de informacoes de mercado de fontes publicas
|
|
872
|
+
- Mapeamento de presenca digital de concorrentes
|
|
873
|
+
## O Que Recebe do Chrome Brain
|
|
874
|
+
- Dados estruturados de sites concorrentes
|
|
875
|
+
- Portfolios e case studies extraidos com texto e screenshots
|
|
876
|
+
- Rankings e listas de diretories do setor
|
|
877
|
+
- Reviews e depoimentos publicos
|
|
878
|
+
## O Que Envia pro Chrome Brain
|
|
879
|
+
N/A para esta squad
|
|
880
|
+
|
|
881
|
+
$FOOTER
|
|
882
|
+
SQUAD_EOF
|
|
883
|
+
ok "squad-research/chrome-brain-integration.md"
|
|
884
|
+
|
|
885
|
+
# --- squad-cybersecurity ---
|
|
886
|
+
mkdir -p "$SINAPSE_DIR/squad-cybersecurity/knowledge-base"
|
|
887
|
+
cat > "$SINAPSE_DIR/squad-cybersecurity/knowledge-base/chrome-brain-integration.md" << SQUAD_EOF
|
|
888
|
+
# Chrome Brain Integration — Squad Cybersecurity (Fortress)
|
|
889
|
+
> Squad Cybersecurity tem acesso ao Chrome Brain para inspecao de HTTP headers, console security errors, network requests suspeitas e cookies/storage.
|
|
890
|
+
## Tier: 3
|
|
891
|
+
## Quando Ativar
|
|
892
|
+
- Inspecao de HTTP headers de seguranca (CSP, HSTS, X-Frame-Options)
|
|
893
|
+
- Captura de console security errors e mixed content warnings
|
|
894
|
+
- Analise de network requests para identificar chamadas inseguras
|
|
895
|
+
- Auditoria de cookies (Secure, HttpOnly, SameSite) e storage
|
|
896
|
+
## O Que Recebe do Chrome Brain
|
|
897
|
+
- HTTP response headers completos
|
|
898
|
+
- Console messages de seguranca
|
|
899
|
+
- Network requests com detalhes de protocol e headers
|
|
900
|
+
- Cookies listados com flags e validade
|
|
901
|
+
- Lighthouse best practices score
|
|
902
|
+
## O Que Envia pro Chrome Brain
|
|
903
|
+
N/A para esta squad
|
|
904
|
+
|
|
905
|
+
$FOOTER
|
|
906
|
+
SQUAD_EOF
|
|
907
|
+
ok "squad-cybersecurity/chrome-brain-integration.md"
|
|
908
|
+
|
|
909
|
+
# --- squad-commercial ---
|
|
910
|
+
mkdir -p "$SINAPSE_DIR/squad-commercial/knowledge-base"
|
|
911
|
+
cat > "$SINAPSE_DIR/squad-commercial/knowledge-base/chrome-brain-integration.md" << SQUAD_EOF
|
|
912
|
+
# Chrome Brain Integration — Squad Commercial (Pipeline)
|
|
913
|
+
> Squad Commercial tem acesso ao Chrome Brain para analise de formularios, pricing pages e funis de conversao de concorrentes.
|
|
914
|
+
## Tier: 3
|
|
915
|
+
## Quando Ativar
|
|
916
|
+
- Analise de formularios de concorrentes (campos, steps, UX, microcopy)
|
|
917
|
+
- Captura de paginas de pricing (planos, precos, features, comparativos)
|
|
918
|
+
- Mapeamento de funil de conversao da landing ate o contato/compra
|
|
919
|
+
- Benchmark de UX comercial (checkout, onboarding, trial signup)
|
|
920
|
+
## O Que Recebe do Chrome Brain
|
|
921
|
+
- Formularios analisados com campos, tipos, validacoes
|
|
922
|
+
- Pricing pages capturadas com dados estruturados
|
|
923
|
+
- Funil mapeado: paginas, CTAs, steps, redirects
|
|
924
|
+
- Trust signals identificados
|
|
925
|
+
## O Que Envia pro Chrome Brain
|
|
926
|
+
N/A para esta squad
|
|
927
|
+
|
|
928
|
+
$FOOTER
|
|
929
|
+
SQUAD_EOF
|
|
930
|
+
ok "squad-commercial/chrome-brain-integration.md"
|
|
931
|
+
|
|
932
|
+
# --- squad-brand ---
|
|
933
|
+
mkdir -p "$SINAPSE_DIR/squad-brand/knowledge-base"
|
|
934
|
+
cat > "$SINAPSE_DIR/squad-brand/knowledge-base/chrome-brain-integration.md" << SQUAD_EOF
|
|
935
|
+
# Chrome Brain Integration — Squad Brand (Meridian)
|
|
936
|
+
> Squad Brand tem acesso ao Chrome Brain para extracao de design systems visuais, captura de identidade de concorrentes e coleta de visual assets.
|
|
937
|
+
## Tier: 3
|
|
938
|
+
## Quando Ativar
|
|
939
|
+
- Extracao de design system visual (paleta de cores, tipografia, spacing, shadows)
|
|
940
|
+
- Captura de identidade visual de concorrentes (logo, cores, tom, estilo fotografico)
|
|
941
|
+
- Screenshots de referencia de brand identity em contexto digital
|
|
942
|
+
- Coleta de visual assets para mood board
|
|
943
|
+
## O Que Recebe do Chrome Brain
|
|
944
|
+
- Paleta de cores extraida via computed styles
|
|
945
|
+
- Font stack completo (familias, pesos, tamanhos)
|
|
946
|
+
- Spacing scale e sizing tokens
|
|
947
|
+
- Screenshots de paginas-chave
|
|
948
|
+
- Logo e favicon capturados
|
|
949
|
+
## O Que Envia pro Chrome Brain
|
|
950
|
+
N/A para esta squad
|
|
951
|
+
|
|
952
|
+
$FOOTER
|
|
953
|
+
SQUAD_EOF
|
|
954
|
+
ok "squad-brand/chrome-brain-integration.md"
|
|
955
|
+
|
|
956
|
+
# --- squad-storytelling ---
|
|
957
|
+
mkdir -p "$SINAPSE_DIR/squad-storytelling/knowledge-base"
|
|
958
|
+
cat > "$SINAPSE_DIR/squad-storytelling/knowledge-base/chrome-brain-integration.md" << SQUAD_EOF
|
|
959
|
+
# Chrome Brain Integration — Squad Storytelling (Arc)
|
|
960
|
+
> Squad Storytelling tem acesso ao Chrome Brain para captura de apresentacoes web, analise de estrutura narrativa de landing pages e storytelling patterns.
|
|
961
|
+
## Tier: 3
|
|
962
|
+
## Quando Ativar
|
|
963
|
+
- Captura de apresentacoes HTML publicadas na web
|
|
964
|
+
- Analise de estrutura narrativa de landing pages (arco emocional, pacing)
|
|
965
|
+
- Extracao de storytelling patterns de paginas de alta conversao
|
|
966
|
+
- Captura de narrative flow de onboarding ou product tours
|
|
967
|
+
## O Que Recebe do Chrome Brain
|
|
968
|
+
- HTML de apresentacoes web (slides + transicoes)
|
|
969
|
+
- Estrutura narrativa mapeada por funcao na historia
|
|
970
|
+
- Sequencia de CTAs no arco narrativo
|
|
971
|
+
- Screenshots de momentos-chave
|
|
972
|
+
## O Que Envia pro Chrome Brain
|
|
973
|
+
N/A para esta squad
|
|
974
|
+
|
|
975
|
+
$FOOTER
|
|
976
|
+
SQUAD_EOF
|
|
977
|
+
ok "squad-storytelling/chrome-brain-integration.md"
|
|
978
|
+
|
|
979
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
980
|
+
# STEP 11: Update sinapse-orqx.md (append chrome_brain_capability if missing)
|
|
981
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
982
|
+
|
|
983
|
+
step "Step 11/15 — Updating sinapse-orqx.md..."
|
|
984
|
+
|
|
985
|
+
AGENT_FILE="$SINAPSE_DIR/sinapse/agents/sinapse-orqx.md"
|
|
986
|
+
if [ -f "$AGENT_FILE" ]; then
|
|
987
|
+
if grep -q "chrome_brain_capability" "$AGENT_FILE"; then
|
|
988
|
+
ok "chrome_brain_capability already present in sinapse-orqx.md — skipped"
|
|
989
|
+
else
|
|
990
|
+
# Find the line after ambiguity_resolution section ends and append
|
|
991
|
+
warn "chrome_brain_capability section not found — but file structure may have changed. Checking..."
|
|
992
|
+
# The section was already there based on our read. Double-check.
|
|
993
|
+
if grep -q "chrome_brain_capability" "$AGENT_FILE"; then
|
|
994
|
+
ok "chrome_brain_capability already present (re-check)"
|
|
995
|
+
else
|
|
996
|
+
fail "Could not find chrome_brain_capability in sinapse-orqx.md and could not append safely"
|
|
997
|
+
fi
|
|
998
|
+
fi
|
|
999
|
+
else
|
|
1000
|
+
fail "sinapse-orqx.md not found at $AGENT_FILE"
|
|
1001
|
+
fi
|
|
1002
|
+
|
|
1003
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
1004
|
+
# STEP 12: Update squad.yaml (add chrome-brain.md to knowledge_bases if missing)
|
|
1005
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
1006
|
+
|
|
1007
|
+
step "Step 12/15 — Updating squad.yaml..."
|
|
1008
|
+
|
|
1009
|
+
SQUAD_YAML="$SINAPSE_DIR/sinapse/squad.yaml"
|
|
1010
|
+
if [ -f "$SQUAD_YAML" ]; then
|
|
1011
|
+
if grep -q "chrome-brain.md" "$SQUAD_YAML"; then
|
|
1012
|
+
ok "chrome-brain.md already in squad.yaml knowledge_bases — skipped"
|
|
1013
|
+
else
|
|
1014
|
+
# Add chrome-brain.md after the last knowledge_bases entry
|
|
1015
|
+
python3 << PYEOF
|
|
1016
|
+
import re
|
|
1017
|
+
|
|
1018
|
+
with open("$SQUAD_YAML", "r") as f:
|
|
1019
|
+
content = f.read()
|
|
1020
|
+
|
|
1021
|
+
# Add chrome-brain.md to knowledge_bases list
|
|
1022
|
+
if "chrome-brain.md" not in content:
|
|
1023
|
+
# Find the last KB entry and add after it
|
|
1024
|
+
content = content.replace(
|
|
1025
|
+
" - cross-squad-patterns.md",
|
|
1026
|
+
" - cross-squad-patterns.md\n - chrome-brain.md"
|
|
1027
|
+
)
|
|
1028
|
+
# Update count
|
|
1029
|
+
content = re.sub(
|
|
1030
|
+
r"knowledge_bases_count: \d+",
|
|
1031
|
+
"knowledge_bases_count: 3",
|
|
1032
|
+
content
|
|
1033
|
+
)
|
|
1034
|
+
|
|
1035
|
+
with open("$SQUAD_YAML", "w") as f:
|
|
1036
|
+
f.write(content)
|
|
1037
|
+
|
|
1038
|
+
print("OK")
|
|
1039
|
+
PYEOF
|
|
1040
|
+
if [ $? -eq 0 ]; then
|
|
1041
|
+
ok "chrome-brain.md added to squad.yaml"
|
|
1042
|
+
else
|
|
1043
|
+
fail "Failed to update squad.yaml"
|
|
1044
|
+
fi
|
|
1045
|
+
fi
|
|
1046
|
+
else
|
|
1047
|
+
fail "squad.yaml not found at $SQUAD_YAML"
|
|
1048
|
+
fi
|
|
1049
|
+
|
|
1050
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
1051
|
+
# STEP 13: Update routing-catalog.md (append Chrome Brain entry if missing)
|
|
1052
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
1053
|
+
|
|
1054
|
+
step "Step 13/15 — Updating routing-catalog.md..."
|
|
1055
|
+
|
|
1056
|
+
ROUTING_FILE="$SINAPSE_DIR/sinapse/knowledge-base/routing-catalog.md"
|
|
1057
|
+
if [ -f "$ROUTING_FILE" ]; then
|
|
1058
|
+
if grep -q "Chrome Brain (Capability" "$ROUTING_FILE"; then
|
|
1059
|
+
ok "Chrome Brain already in routing-catalog.md — skipped"
|
|
1060
|
+
else
|
|
1061
|
+
cat >> "$ROUTING_FILE" << 'APPEND_EOF'
|
|
1062
|
+
|
|
1063
|
+
---
|
|
1064
|
+
|
|
1065
|
+
## Chrome Brain (Capability — Cross-Squad)
|
|
1066
|
+
|
|
1067
|
+
- **Domain:** Browser automation, site cloning, form filling, web scraping, performance audit, animation extraction, CAPTCHA resolution
|
|
1068
|
+
- **Type:** Capability (nao squad) — integrada em todas as squads
|
|
1069
|
+
- **Activation:** Automatica via prompt trigger patterns — nao precisa de comando
|
|
1070
|
+
- **Tools:** Chrome DevTools MCP (29 tools), dev-browser (Playwright), claude-in-chrome (fallback)
|
|
1071
|
+
- **Auto-Launch:** Hook PreToolUse roda `chrome-ensure` antes de qualquer tool chrome
|
|
1072
|
+
- **NSN Mode:** Sempre ativo — 3+ alternativas antes de escalar
|
|
1073
|
+
- **Session Limits:** Max 15 screenshots, rotacao a cada 12
|
|
1074
|
+
- **Keywords:** browser, chrome, site, navegar, clonar, preencher, screenshot, lighthouse, scrape, formulario, animacao, DOM, CDP, Three.js, WebGL
|
|
1075
|
+
- **Full KB:** `~/.sinapse/sinapse/knowledge-base/chrome-brain.md`
|
|
1076
|
+
APPEND_EOF
|
|
1077
|
+
ok "Chrome Brain appended to routing-catalog.md"
|
|
1078
|
+
fi
|
|
1079
|
+
else
|
|
1080
|
+
fail "routing-catalog.md not found"
|
|
1081
|
+
fi
|
|
1082
|
+
|
|
1083
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
1084
|
+
# STEP 14: Update cross-squad-patterns.md (append Browser-Powered Workflow if missing)
|
|
1085
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
1086
|
+
|
|
1087
|
+
step "Step 14/15 — Updating cross-squad-patterns.md..."
|
|
1088
|
+
|
|
1089
|
+
PATTERNS_FILE="$SINAPSE_DIR/sinapse/knowledge-base/cross-squad-patterns.md"
|
|
1090
|
+
if [ -f "$PATTERNS_FILE" ]; then
|
|
1091
|
+
if grep -q "Browser-Powered Workflow" "$PATTERNS_FILE"; then
|
|
1092
|
+
ok "Browser-Powered Workflow already in cross-squad-patterns.md — skipped"
|
|
1093
|
+
else
|
|
1094
|
+
cat >> "$PATTERNS_FILE" << 'APPEND_EOF'
|
|
1095
|
+
|
|
1096
|
+
---
|
|
1097
|
+
|
|
1098
|
+
### 8. Browser-Powered Workflow (Chrome Brain)
|
|
1099
|
+
|
|
1100
|
+
**When:** Any task that requires interacting with the web browser — navigating sites, cloning pages, filling forms, auditing performance, scraping data, extracting animations.
|
|
1101
|
+
|
|
1102
|
+
**Capability:** Chrome Brain (cross-squad, auto-activated)
|
|
1103
|
+
**Squads envolvidas:** Any — depends on the domain task
|
|
1104
|
+
|
|
1105
|
+
**Activation:** Automatic via prompt triggers. No command needed. Chrome auto-launches via PreToolUse hook.
|
|
1106
|
+
|
|
1107
|
+
**Sequence:**
|
|
1108
|
+
```
|
|
1109
|
+
Phase 1: Connection (automatic)
|
|
1110
|
+
Hook PreToolUse → chrome-ensure → Chrome debug on port 9222
|
|
1111
|
+
Zero user intervention required
|
|
1112
|
+
|
|
1113
|
+
Phase 2: Task Execution
|
|
1114
|
+
Chrome Brain executes action (navigate, clone, fill, audit, scrape)
|
|
1115
|
+
Tooling selected automatically: CDP > dev-browser > claude-in-chrome
|
|
1116
|
+
|
|
1117
|
+
Phase 3: Handoff to Domain Squad
|
|
1118
|
+
Results (screenshots, DOM, data) delivered to domain squad
|
|
1119
|
+
Domain squad processes with its expertise
|
|
1120
|
+
Example: Chrome Brain captures site → animations-orqx recreates
|
|
1121
|
+
|
|
1122
|
+
Phase 4: NSN Loop (if barrier)
|
|
1123
|
+
If blocked: classify barrier → search web → try 3+ alternatives
|
|
1124
|
+
Configure, test, repeat. Max 5 cycles → escalate to user
|
|
1125
|
+
|
|
1126
|
+
Phase 5: Auto-Learning
|
|
1127
|
+
If new pattern/solution discovered → append to chrome-brain.md Learnings Log
|
|
1128
|
+
Knowledge propagates to all agents in next session automatically
|
|
1129
|
+
```
|
|
1130
|
+
|
|
1131
|
+
**Tier Integration:**
|
|
1132
|
+
| Tier | Squads | Usage Level |
|
|
1133
|
+
|------|--------|-------------|
|
|
1134
|
+
| 1 (Heavy) | animations, design, cloning, claude | Every session with browser tasks |
|
|
1135
|
+
| 2 (Regular) | paidmedia, growth, content, copy | Competitor analysis, auditing |
|
|
1136
|
+
| 3 (Occasional) | research, cyber, commercial, brand, storytelling | On-demand data extraction |
|
|
1137
|
+
|
|
1138
|
+
**Anti-Patterns:**
|
|
1139
|
+
| Anti-Pattern | Problem | Correct Approach |
|
|
1140
|
+
|-------------|---------|-----------------|
|
|
1141
|
+
| Using browser for API-accessible data | Slow, wastes screenshots | Use API/WebFetch when possible |
|
|
1142
|
+
| Taking screenshot + snapshot of same state | Doubles context size | Choose one per state |
|
|
1143
|
+
| Exceeding 15 screenshots/session | Risk of 20MB crash | Rotate sessions at 12 |
|
|
1144
|
+
| Giving up at first error | Misses NSN solutions | Try 3+ alternatives |
|
|
1145
|
+
| Not logging new patterns | Knowledge lost | Always update Learnings Log |
|
|
1146
|
+
APPEND_EOF
|
|
1147
|
+
ok "Browser-Powered Workflow appended to cross-squad-patterns.md"
|
|
1148
|
+
fi
|
|
1149
|
+
else
|
|
1150
|
+
fail "cross-squad-patterns.md not found"
|
|
1151
|
+
fi
|
|
1152
|
+
|
|
1153
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
1154
|
+
# STEP 15: Full Validation
|
|
1155
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
1156
|
+
|
|
1157
|
+
step "Step 15/15 — Running full validation..."
|
|
1158
|
+
|
|
1159
|
+
echo ""
|
|
1160
|
+
info "Validating scripts..."
|
|
1161
|
+
|
|
1162
|
+
# Check scripts exist and are executable
|
|
1163
|
+
for script in chrome-ensure chrome-debug chrome-brain-log; do
|
|
1164
|
+
SPATH="$HOME/.local/bin/$script"
|
|
1165
|
+
if [ -x "$SPATH" ]; then
|
|
1166
|
+
ok "$script is executable"
|
|
1167
|
+
else
|
|
1168
|
+
fail "$script missing or not executable at $SPATH"
|
|
1169
|
+
fi
|
|
1170
|
+
done
|
|
1171
|
+
|
|
1172
|
+
info "Validating hooks in settings.json..."
|
|
1173
|
+
|
|
1174
|
+
# Check hooks parse as valid JSON
|
|
1175
|
+
if python3 -c "import json; json.load(open('$HOME/.claude/settings.json'))" 2>/dev/null; then
|
|
1176
|
+
ok "~/.claude/settings.json is valid JSON"
|
|
1177
|
+
else
|
|
1178
|
+
fail "~/.claude/settings.json is invalid JSON"
|
|
1179
|
+
fi
|
|
1180
|
+
|
|
1181
|
+
if python3 -c "import json; json.load(open('$SINAPSE_DIR/.claude/settings.json'))" 2>/dev/null; then
|
|
1182
|
+
ok "~/.sinapse/.claude/settings.json is valid JSON"
|
|
1183
|
+
else
|
|
1184
|
+
fail "~/.sinapse/.claude/settings.json is invalid JSON"
|
|
1185
|
+
fi
|
|
1186
|
+
|
|
1187
|
+
# Check hooks contain expected matchers
|
|
1188
|
+
if python3 -c "
|
|
1189
|
+
import json
|
|
1190
|
+
s = json.load(open('$HOME/.claude/settings.json'))
|
|
1191
|
+
h = s.get('hooks', {})
|
|
1192
|
+
pre = [x['matcher'] for x in h.get('PreToolUse', [])]
|
|
1193
|
+
post = [x['matcher'] for x in h.get('PostToolUse', [])]
|
|
1194
|
+
assert 'mcp__chrome-devtools__*' in pre, 'Missing PreToolUse chrome-devtools'
|
|
1195
|
+
assert 'mcp__claude-in-chrome__*' in pre, 'Missing PreToolUse claude-in-chrome'
|
|
1196
|
+
assert 'mcp__chrome-devtools__*' in post, 'Missing PostToolUse chrome-devtools'
|
|
1197
|
+
assert 'mcp__claude-in-chrome__*' in post, 'Missing PostToolUse claude-in-chrome'
|
|
1198
|
+
print('OK')
|
|
1199
|
+
" 2>/dev/null; then
|
|
1200
|
+
ok "All 4 hook matchers present in ~/.claude/settings.json"
|
|
1201
|
+
else
|
|
1202
|
+
fail "Missing hook matchers in ~/.claude/settings.json"
|
|
1203
|
+
fi
|
|
1204
|
+
|
|
1205
|
+
info "Validating MCP config..."
|
|
1206
|
+
|
|
1207
|
+
if python3 -c "
|
|
1208
|
+
import json
|
|
1209
|
+
c = json.load(open('$HOME/.claude.json'))
|
|
1210
|
+
cd = c.get('mcpServers', {}).get('chrome-devtools', {})
|
|
1211
|
+
assert cd.get('command') == 'npx', 'Missing npx command'
|
|
1212
|
+
assert 'chrome-devtools-mcp@latest' in cd.get('args', []), 'Missing chrome-devtools-mcp'
|
|
1213
|
+
print('OK')
|
|
1214
|
+
" 2>/dev/null; then
|
|
1215
|
+
ok "Chrome DevTools MCP configured in ~/.claude.json"
|
|
1216
|
+
else
|
|
1217
|
+
fail "Chrome DevTools MCP not properly configured in ~/.claude.json"
|
|
1218
|
+
fi
|
|
1219
|
+
|
|
1220
|
+
info "Validating autoload rule..."
|
|
1221
|
+
|
|
1222
|
+
if [ -f "$SINAPSE_DIR/.claude/rules/chrome-brain-autoload.md" ]; then
|
|
1223
|
+
ok "chrome-brain-autoload.md exists"
|
|
1224
|
+
else
|
|
1225
|
+
fail "chrome-brain-autoload.md missing"
|
|
1226
|
+
fi
|
|
1227
|
+
|
|
1228
|
+
info "Validating master KB..."
|
|
1229
|
+
|
|
1230
|
+
if [ -f "$SINAPSE_DIR/sinapse/knowledge-base/chrome-brain.md" ]; then
|
|
1231
|
+
ok "chrome-brain.md KB exists"
|
|
1232
|
+
if grep -q "Learnings Log" "$SINAPSE_DIR/sinapse/knowledge-base/chrome-brain.md"; then
|
|
1233
|
+
ok "chrome-brain.md has Learnings Log section"
|
|
1234
|
+
else
|
|
1235
|
+
fail "chrome-brain.md missing Learnings Log section"
|
|
1236
|
+
fi
|
|
1237
|
+
else
|
|
1238
|
+
fail "chrome-brain.md KB missing"
|
|
1239
|
+
fi
|
|
1240
|
+
|
|
1241
|
+
info "Validating squad integration files..."
|
|
1242
|
+
|
|
1243
|
+
SQUADS=(
|
|
1244
|
+
squad-animations squad-design squad-cloning squad-claude
|
|
1245
|
+
squad-paidmedia squad-growth squad-content squad-copy
|
|
1246
|
+
squad-research squad-cybersecurity squad-commercial squad-brand squad-storytelling
|
|
1247
|
+
)
|
|
1248
|
+
|
|
1249
|
+
for squad in "${SQUADS[@]}"; do
|
|
1250
|
+
IFILE="$SINAPSE_DIR/$squad/knowledge-base/chrome-brain-integration.md"
|
|
1251
|
+
if [ -f "$IFILE" ]; then
|
|
1252
|
+
ok "$squad/chrome-brain-integration.md"
|
|
1253
|
+
else
|
|
1254
|
+
fail "$squad/chrome-brain-integration.md missing"
|
|
1255
|
+
fi
|
|
1256
|
+
done
|
|
1257
|
+
|
|
1258
|
+
info "Validating sinapse-orqx.md..."
|
|
1259
|
+
|
|
1260
|
+
if grep -q "chrome_brain_capability" "$SINAPSE_DIR/sinapse/agents/sinapse-orqx.md" 2>/dev/null; then
|
|
1261
|
+
ok "chrome_brain_capability in sinapse-orqx.md"
|
|
1262
|
+
else
|
|
1263
|
+
fail "chrome_brain_capability missing from sinapse-orqx.md"
|
|
1264
|
+
fi
|
|
1265
|
+
|
|
1266
|
+
info "Validating squad.yaml..."
|
|
1267
|
+
|
|
1268
|
+
if grep -q "chrome-brain.md" "$SINAPSE_DIR/sinapse/squad.yaml" 2>/dev/null; then
|
|
1269
|
+
ok "chrome-brain.md in squad.yaml"
|
|
1270
|
+
else
|
|
1271
|
+
fail "chrome-brain.md missing from squad.yaml"
|
|
1272
|
+
fi
|
|
1273
|
+
|
|
1274
|
+
info "Validating routing-catalog.md..."
|
|
1275
|
+
|
|
1276
|
+
if grep -q "Chrome Brain" "$SINAPSE_DIR/sinapse/knowledge-base/routing-catalog.md" 2>/dev/null; then
|
|
1277
|
+
ok "Chrome Brain in routing-catalog.md"
|
|
1278
|
+
else
|
|
1279
|
+
fail "Chrome Brain missing from routing-catalog.md"
|
|
1280
|
+
fi
|
|
1281
|
+
|
|
1282
|
+
info "Validating cross-squad-patterns.md..."
|
|
1283
|
+
|
|
1284
|
+
if grep -q "Browser-Powered Workflow" "$SINAPSE_DIR/sinapse/knowledge-base/cross-squad-patterns.md" 2>/dev/null; then
|
|
1285
|
+
ok "Browser-Powered Workflow in cross-squad-patterns.md"
|
|
1286
|
+
else
|
|
1287
|
+
fail "Browser-Powered Workflow missing from cross-squad-patterns.md"
|
|
1288
|
+
fi
|
|
1289
|
+
|
|
1290
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
1291
|
+
# SUMMARY
|
|
1292
|
+
# ══════════════════════════════════════════════════════════════════════════════
|
|
1293
|
+
|
|
1294
|
+
echo ""
|
|
1295
|
+
echo -e "${BOLD}══════════════════════════════════════════════════════════════${NC}"
|
|
1296
|
+
echo -e "${BOLD} Installation Summary${NC}"
|
|
1297
|
+
echo -e "${BOLD}══════════════════════════════════════════════════════════════${NC}"
|
|
1298
|
+
echo ""
|
|
1299
|
+
echo -e " ${GREEN}OK:${NC} $OK_COUNT"
|
|
1300
|
+
echo -e " ${YELLOW}WARN:${NC} $WARN_COUNT"
|
|
1301
|
+
echo -e " ${RED}FAIL:${NC} $FAIL_COUNT"
|
|
1302
|
+
echo ""
|
|
1303
|
+
|
|
1304
|
+
if [ "$FAIL_COUNT" -gt 0 ]; then
|
|
1305
|
+
echo -e " ${RED}${BOLD}Chrome Brain installation completed with $FAIL_COUNT failure(s).${NC}"
|
|
1306
|
+
echo -e " ${RED}Review the FAIL items above and re-run after fixing.${NC}"
|
|
1307
|
+
echo ""
|
|
1308
|
+
exit 1
|
|
1309
|
+
else
|
|
1310
|
+
echo -e " ${GREEN}${BOLD}Chrome Brain installed successfully!${NC}"
|
|
1311
|
+
echo ""
|
|
1312
|
+
echo -e " ${CYAN}What was installed:${NC}"
|
|
1313
|
+
echo " - 3 scripts in ~/.local/bin/ (chrome-ensure, chrome-debug, chrome-brain-log)"
|
|
1314
|
+
echo " - Hooks in ~/.claude/settings.json (PreToolUse + PostToolUse)"
|
|
1315
|
+
echo " - Hooks in ~/.sinapse/.claude/settings.json (standalone)"
|
|
1316
|
+
echo " - Chrome DevTools MCP in ~/.claude.json"
|
|
1317
|
+
echo " - Autoload rule at ~/.sinapse/.claude/rules/chrome-brain-autoload.md"
|
|
1318
|
+
echo " - Master KB at ~/.sinapse/sinapse/knowledge-base/chrome-brain.md"
|
|
1319
|
+
echo " - 13 squad integration files"
|
|
1320
|
+
echo " - Updated sinapse-orqx.md, squad.yaml, routing-catalog.md, cross-squad-patterns.md"
|
|
1321
|
+
echo ""
|
|
1322
|
+
echo -e " ${CYAN}To test:${NC}"
|
|
1323
|
+
echo " chrome-debug # Launch Chrome with debug port"
|
|
1324
|
+
echo " chrome-ensure # Auto-launch (used by hooks)"
|
|
1325
|
+
echo " chrome-brain-log # Session logger (used by hooks)"
|
|
1326
|
+
echo ""
|
|
1327
|
+
exit 0
|
|
1328
|
+
fi
|