Skip to content

Commit 8f7c5ab

Browse files
Antigravity Agentclaude
andcommitted
feat(diag): integrate Perplexity Bridge into /tri skill
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a92e9ea commit 8f7c5ab

28 files changed

Lines changed: 391 additions & 3 deletions

.claude/skills/tri/SKILL.md

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: tri
33
description: Full TRI swarm diagnostic — builds, binaries, issues, agent status, code metrics. Run for system health check.
44
argument-hint: [focus-area]
5-
allowed-tools: Bash(zig *), Bash(ls *), Bash(wc *), Bash(grep *), Bash(gh *), Bash(pgrep *), Bash(cat *), Bash(find *), Bash(git *), Bash(date *), Bash(test *), Bash(tail *), Bash(for *), Bash(python3 *), Bash(echo *), Read, Edit, Write
5+
allowed-tools: Bash(zig *), Bash(ls *), Bash(wc *), Bash(grep *), Bash(gh *), Bash(pgrep *), Bash(cat *), Bash(find *), Bash(git *), Bash(date *), Bash(test *), Bash(tail *), Bash(for *), Bash(python3 *), Bash(echo *), Bash(curl *), Read, Edit, Write
66
---
77

88
Run a complete diagnostic of the TRI system. Output a beautifully formatted
@@ -77,6 +77,17 @@ MUST be rendered in the chosen language. Technical terms (binary names, commands
7777
| Dirty files — commit or lose work! | Грязные файлы — закоммитьте или потеряете! |
7878
| tri-bot DOWN — no phone control | tri-bot УПАЛ — нет управления с телефона |
7979
| ralph-agent DOWN — no autonomous agent | ralph-agent УПАЛ — нет автономного агента |
80+
| PERPLEXITY BRIDGE — DIRECT CONTROL CHANNEL | МОСТ PERPLEXITY — КАНАЛ ПРЯМОГО УПРАВЛЕНИЯ |
81+
| Railway Server | Сервер Railway |
82+
| Mac Agent | Агент Mac |
83+
| Command Queue | Очередь команд |
84+
| claude: support | поддержка claude: |
85+
| pending | в ожидании |
86+
| Comms | Связь |
87+
| Direct control active | Прямое управление активно |
88+
| Railway UP but Mac agent DOWN | Railway работает, но агент Mac не запущен |
89+
| Bridge agent DOWN — no remote control | Агент моста УПАЛ — нет удалённого управления |
90+
| Railway server DOWN — bridge unreachable | Сервер Railway УПАЛ — мост недоступен |
8091
| Permissions MISSING — unprotected tools | Разрешения ОТСУТСТВУЮТ — инструменты не защищены |
8192
| tri-api never tested end-to-end | tri-api ни разу не протестирован end-to-end |
8293
| BUILD BROKEN — fix before anything else | СБОРКА СЛОМАНА — чините прежде всего |
@@ -394,9 +405,34 @@ Format ALL collected data into this report. Use REAL data — never placeholders
394405
└─────────────────────┴───────────┘
395406
```
396407

408+
### Perplexity Bridge Section
409+
410+
After SYSTEM STATUS, render the Bridge section using data from bridge checks:
411+
412+
```
413+
═══════════════════════════════════════════════════
414+
🌉 PERPLEXITY BRIDGE — DIRECT CONTROL CHANNEL
415+
═══════════════════════════════════════════════════
416+
417+
┌─────────────────┬────────┬──────────────────────────────┐
418+
│ Component │ Status │ Details │
419+
├─────────────────┼────────┼──────────────────────────────┤
420+
│ Railway Server │ {S} │ {url} — {BRIDGE_STATUS} │
421+
│ Mac Agent │ {S} │ {UP/DOWN from pgrep} │
422+
│ Command Queue │ {S} │ {pending} pending, {done} done│
423+
│ claude: support │ {S} │ urlDecode + 620s timeout │
424+
└─────────────────┴────────┴──────────────────────────────┘
425+
```
426+
427+
#### Bridge Status Logic:
428+
- **Railway Server**: 🟢 if BRIDGE_STATUS:ok. 🔴 if BRIDGE_STATUS:down.
429+
- **Mac Agent**: 🟢 if BRIDGE_AGENT:UP. 🔴 if BRIDGE_AGENT:DOWN.
430+
- **Command Queue**: 🟢 if BRIDGE_PENDING ≥ 0 and reachable. ⚪ if unreachable.
431+
- **claude: support**: Always 🟢 (built into perplexity_bridge.zig). ⚪ if BRIDGE_CODE:MISSING.
432+
397433
### Faculty Status Section
398434

399-
After SYSTEM STATUS, render the TRI University Faculty Board.
435+
After Bridge section, render the TRI University Faculty Board.
400436

401437
#### Faculty Data Collection — ALL LIVE
402438
```bash
@@ -431,6 +467,12 @@ echo "SWARM_OPEN_ISSUE:${SWARM_ISSUE:-NONE}"
431467

432468
# Linter: vibee binary check
433469
test -f zig-out/bin/vibee && echo "LINTER:UP" || echo "LINTER:DOWN"
470+
471+
# Bridge: check Railway endpoint + agent process + queue
472+
curl -sf "${RAILWAY_URL:-https://trinity-production-a1d4.up.railway.app}/px/status?token=${PX_BRIDGE_TOKEN}" 2>/dev/null | python3 -c "import json,sys; d=json.load(sys.stdin); print(f'BRIDGE_STATUS:{d.get(\"status\",\"down\")}')" 2>/dev/null || echo "BRIDGE_STATUS:down"
473+
pgrep -f tri-bridge-agent > /dev/null && echo "BRIDGE_AGENT:UP" || echo "BRIDGE_AGENT:DOWN"
474+
curl -sf "${RAILWAY_URL:-https://trinity-production-a1d4.up.railway.app}/px/jobs?token=${PX_BRIDGE_TOKEN}" 2>/dev/null | python3 -c "import json,sys; d=json.load(sys.stdin); print(f'BRIDGE_PENDING:{d.get(\"pending\",0)}'); print(f'BRIDGE_RUNNING:{d.get(\"running\",0)}'); print(f'BRIDGE_DONE:{d.get(\"done\",0)}')" 2>/dev/null || echo "BRIDGE_PENDING:0"
475+
test -f src/tri-api/perplexity_bridge.zig && echo "BRIDGE_CODE:READY" || echo "BRIDGE_CODE:MISSING"
434476
```
435477

436478
IMPORTANT: Faculty "Last Action" column MUST use live data:
@@ -456,9 +498,10 @@ IMPORTANT: Faculty "Last Action" column MUST use live data:
456498
│ 📐 Oracle │ φ-Analyst │ 🟢 UP │ {from compile rate} │
457499
│ 🐝 Swarm │ Coordinator │ {S} │ {from swarm_state tasks} │
458500
│ 🛡️ Linter │ QA Gate │ {S} │ {from compile rate} │
501+
│ 🌉 Bridge │ Comms │ {S} │ {from bridge checks} │
459502
└────────────┴──────────────┴────────┴──────────────────────────────┘
460503
461-
Faculty Active: {N}/6 ({%})
504+
Faculty Active: {N}/7 ({%})
462505
Next hire: {agent with highest impact among sleeping ones}
463506
```
464507

@@ -469,6 +512,7 @@ IMPORTANT: Faculty "Last Action" column MUST use live data:
469512
- **Oracle**: Always 🟢 UP (computed from compile_rate). From: REGENERATION_REPORT.md.
470513
- **Swarm**: 🟢 UP if SWARM_ASSIGNED > 0. ⚪ TBD if SWARM_TASKS > 0 but none assigned. ⬜ OFF if no tasks. From: swarm_state.json.
471514
- **Linter**: 🟢 UP if LINTER:UP. ❌ DOWN if LINTER:DOWN. From: `test -f zig-out/bin/vibee`.
515+
- **Bridge**: 🟢 UP if BRIDGE_STATUS:ok AND BRIDGE_AGENT:UP. ⚠️ PARTIAL if one is UP. ❌ DOWN if both DOWN. ⬜ TBD if BRIDGE_CODE:MISSING. From: curl + pgrep checks.
472516

473517
#### Faculty Commentary
474518

@@ -483,6 +527,7 @@ After the table, render dynamic commentary from each agent. Each agent speaks ON
483527
🧠 MU: "{dynamic based on MU status}"
484528
🔍 Scholar: "{dynamic based on Scholar status}"
485529
🐝 Swarm: "{dynamic based on Swarm status}"
530+
🌉 Bridge: "{dynamic based on bridge status}"
486531
```
487532

488533
#### Commentary Logic:
@@ -517,6 +562,12 @@ After the table, render dynamic commentary from each agent. Each agent speaks ON
517562
- IF no agents AND open Swarm issue exists: "🥚 EMBRYONIC. Tasks decomposed manually. With me: 1 issue → 5 subtasks → 3 agents → 5× faster. Activate: #{open_issue}."
518563
- IF no agents AND no open Swarm issue: "🥚 EMBRYONIC. Tasks decomposed manually. With me: 1 issue → 5 subtasks → 3 agents → 5× faster. Create an issue to activate."
519564

565+
**Bridge** (reads bridge checks):
566+
- IF BRIDGE_STATUS:ok AND BRIDGE_AGENT:UP: "🌉 ONLINE. Perplexity → Railway → Mac → Claude Code. Direct control active."
567+
- IF BRIDGE_STATUS:ok AND BRIDGE_AGENT:DOWN: "⚠️ Railway UP but Mac agent DOWN. Run: ./deploy/tri-bridge-agent.sh &"
568+
- IF BRIDGE_STATUS:down AND BRIDGE_CODE:READY: "❌ Railway DOWN. Code ready. Deploy: railway up"
569+
- IF BRIDGE_CODE:MISSING: "⬜ NOT DEPLOYED. Build perplexity_bridge.zig first."
570+
520571
#### Translation Table (additions for Faculty)
521572

522573
| EN | RU |
@@ -569,6 +620,8 @@ Flag any of these conditions:
569620
- Spec coverage < 50%: "Low spec coverage: {%} — many specs not generating code"
570621
- No pipeline jobs found: "No pipeline jobs found — pipeline never ran"
571622
- Compile rate < 80%: "🔴 Generator broken: {%} compile rate — see REGENERATION_REPORT.md"
623+
- Bridge agent DOWN: "🌉 Bridge agent DOWN — no remote control. Run: ./deploy/tri-bridge-agent.sh &"
624+
- Railway DOWN: "🌉 Railway server DOWN — bridge unreachable. Deploy: railway up"
572625

573626
Format:
574627
```
@@ -940,6 +993,7 @@ exists, show only the NOW column with a note "No historical data — first run".
940993
│ Pipeline (golden) │ {S} │ {N} jobs, {%} success │
941994
│ Telegram Bot │ {S} │ {UP/DOWN} │
942995
│ Sacred Math (φ) │ {S} │ φ²+1/φ²={computed} │
996+
│ Perplexity Bridge │ {S} │ Railway {UP/DOWN}, Agent {UP/DOWN} │
943997
└─────────────────────┴────────┴───────────────────────────────┘
944998
945999
Status: ✅ = working + tested, ⚠️ = working + untested, ❌ = broken, ⚪ = not started
@@ -973,6 +1027,7 @@ Map command outputs to statuses:
9731027
- **Pipeline**: ✅ if success_rate ≥ 80%, ⚠️ if > 0 jobs, ❌ if 0 jobs. Proof: "{completed}/{total} jobs, {%}%"
9741028
- **Telegram Bot**: ✅ if BOT:UP. ❌ if BOT:DOWN. Proof: "PID active" or "not running"
9751029
- **Sacred Math**: ✅ always (computed). Proof: "φ²+1/φ²={PHI_IDENTITY value}"
1030+
- **Perplexity Bridge**: ✅ if BRIDGE_STATUS:ok AND BRIDGE_AGENT:UP. ⚠️ if one is UP. ❌ if both DOWN. ⚪ if BRIDGE_CODE:MISSING. Proof: "Railway {UP/DOWN}, Agent {UP/DOWN}"
9761031

9771032
NEVER use "API ready", "working + untested" or similar vague phrases unless the
9781033
actual command returned inconclusive results.

.trinity/mu/errors/1773200000.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"timestamp": "1773200000",
3+
"spec": "specs/tri/swarm_coordinator.tri",
4+
"link": 7,
5+
"link_name": "code_generate",
6+
"error_category": "TYPE_MAPPING",
7+
"error_message": "use of undeclared identifier 'Int64'",
8+
"error_line": 53,
9+
"generated_file": "generated/swarm_coordinator.zig",
10+
"fix_attempted": false,
11+
"fix_result": ""
12+
}

.trinity/mu/errors/1773200001.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"timestamp": "1773200001",
3+
"spec": "specs/tri/neural_gamma.tri",
4+
"link": 7,
5+
"link_name": "code_generate",
6+
"error_category": "FORMAT_ERROR",
7+
"error_message": "formatting check failed",
8+
"error_line": 1,
9+
"generated_file": "generated/neural_gamma.zig",
10+
"fix_attempted": true,
11+
"fix_result": "auto-fix attempted"
12+
}

.trinity/mu/errors/mu5_gen_0.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"timestamp": "mu5_gen_0",
3+
"spec": "specs/tri/codegen_math_safety.tri",
4+
"link": 7,
5+
"link_name": "code_generate",
6+
"error_category": "GEN_FAILURE",
7+
"error_message": " Input: specs/tri/codegen_math_safety.tri\n Output: generated/codegen_math_safety.zig\n AGENT MU: Verification FAILED\n Error: duplicate struct member name 'MAX_ARRAY_SIZE'\n Attempts: 2\n",
8+
"error_line": 0,
9+
"generated_file": "",
10+
"fix_attempted": false,
11+
"fix_result": ""
12+
}

.trinity/mu/errors/mu5_gen_1.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"timestamp": "mu5_gen_1",
3+
"spec": "specs/tri/self_improving_formula_discovery.tri",
4+
"link": 7,
5+
"link_name": "code_generate",
6+
"error_category": "GEN_FAILURE",
7+
"error_message": " Input: specs/tri/self_improving_formula_discovery.tri\n Output: generated/self_improving_formula_discovery.zig\n AGENT MU: Verification FAILED\n Error: duplicate struct member name 'ELASTIC_WEIGH",
8+
"error_line": 0,
9+
"generated_file": "",
10+
"fix_attempted": false,
11+
"fix_result": ""
12+
}

.trinity/mu/errors/mu5_gen_10.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"timestamp": "mu5_gen_10",
3+
"spec": "specs/tri/codegen_engine_final_upgrade.tri",
4+
"link": 7,
5+
"link_name": "code_generate",
6+
"error_category": "UNDEFINED_IDENTIFIER",
7+
"error_message": " Input: specs/tri/codegen_engine_final_upgrade.tri\n Output: generated/codegen_engine_final_upgrade.zig\n AGENT MU: Verification FAILED\n Error: use of undeclared identifier 'eqlPrimitive'\n Att",
8+
"error_line": 0,
9+
"generated_file": "",
10+
"fix_attempted": false,
11+
"fix_result": ""
12+
}

.trinity/mu/errors/mu5_gen_11.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"timestamp": "mu5_gen_11",
3+
"spec": "specs/tri/trinity_fpga_core.tri",
4+
"link": 7,
5+
"link_name": "code_generate",
6+
"error_category": "GEN_FAILURE",
7+
"error_message": " Input: specs/tri/trinity_fpga_core.tri\n Output: trinity/output/fpga/trinity_fpga_core.v\n",
8+
"error_line": 0,
9+
"generated_file": "",
10+
"fix_attempted": false,
11+
"fix_result": ""
12+
}

.trinity/mu/errors/mu5_gen_12.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"timestamp": "mu5_gen_12",
3+
"spec": "specs/tri/coordinator_test.tri",
4+
"link": 7,
5+
"link_name": "code_generate",
6+
"error_category": "UNDEFINED_IDENTIFIER",
7+
"error_message": " Input: specs/tri/coordinator_test.tri\n Output: generated/coordinator_test.zig\n AGENT MU: Verification FAILED\n Error: use of undeclared identifier 'Config'\n Attempts: 2\n",
8+
"error_line": 0,
9+
"generated_file": "",
10+
"fix_attempted": false,
11+
"fix_result": ""
12+
}

.trinity/mu/errors/mu5_gen_13.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"timestamp": "mu5_gen_13",
3+
"spec": "specs/tri/autonomous_universe.tri",
4+
"link": 7,
5+
"link_name": "code_generate",
6+
"error_category": "SYNTAX_ERROR",
7+
"error_message": " Input: specs/tri/autonomous_universe.tri\n Output: generated/autonomous_universe.zig\n AGENT MU: Verification FAILED\n Error: unused local constant\n Attempts: 2\n",
8+
"error_line": 0,
9+
"generated_file": "",
10+
"fix_attempted": false,
11+
"fix_result": ""
12+
}

.trinity/mu/errors/mu5_gen_14.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"timestamp": "mu5_gen_14",
3+
"spec": "specs/tri/codegen_full_automation.tri",
4+
"link": 7,
5+
"link_name": "code_generate",
6+
"error_category": "UNDEFINED_IDENTIFIER",
7+
"error_message": " Input: specs/tri/codegen_full_automation.tri\n Output: generated/codegen_full_automation.zig\n AGENT MU: Verification FAILED\n Error: use of undeclared identifier 'Field'\n Attempts: 2\n",
8+
"error_line": 0,
9+
"generated_file": "",
10+
"fix_attempted": false,
11+
"fix_result": ""
12+
}

0 commit comments

Comments
 (0)