[2026-05-14] kraken-access.md: fix CF tunnel config (HTTP→8642, not SSH)

This commit is contained in:
Alexey Martemyanov
2026-05-14 13:12:46 +06:00
parent ebe7f684c6
commit 22b207be41
3 changed files with 189 additions and 19 deletions
+60 -14
View File
@@ -1,8 +1,8 @@
# Plan: (no topic) Thread Routing
**Date**: 2026-05-14
**Status**: Planning
**Priority**: Medium
**Status**: In Progress — plugin being implemented
**Priority**: High
## Problem
@@ -59,20 +59,66 @@ Eagle may have multiple instances running in different Zulip topics simultaneous
Each Eagle instance should know its own Zulip topic context. When spawned in a topic, it registers itself in `zulip_thread_locks`. Eagle reads this to avoid double-posting.
## Implementation
### Mechanism: `pre_gateway_dispatch` plugin
Hermes plugins support a `pre_gateway_dispatch` hook that fires **before** auth
and agent dispatch, can intercept, rewrite, or skip any incoming `MessageEvent`.
Plugin location: `~/.hermes/plugins/zulip-topic-routing/`
In Zulip adapter (`gateway/platforms/zulip.py`):
- `event.source.thread_id` = Zulip topic name (set at line ~610)
- `event.source.chat_id` = `"stream_name::topic_name"`
- `(no topic)` messages have `thread_id == "(no topic)"`
### Auth for Zulip API calls
From `~/.hermes/.env`:
```
ZULIP_URL=https://zulip.qentra.top
ZULIP_BOT_EMAIL=eagle-bot@zulip.local
ZULIP_API_KEY=BT7zzT...XqAE
```
Topic rename API (confirmed working via curl in prior session):
```
PATCH /api/v1/messages/{message_id}?propagate_mode=change_all&topic={new_topic}
```
Create message in topic (effectively creates topic):
```
POST /api/v1/messages type=stream to=stream_name topic=new_topic content=...
```
### Plugin Flow
1. `pre_gateway_dispatch` fires → check `event.source.thread_id == "(no topic)"`
2. Get stream name from `chat_id.split("::")[0]`
3. Query Zulip API: `GET /api/v1/messages?narrow=[{"operator":"stream","operand":"<stream>"}]&num_before=0&num_after=20&anchor=newest`
4. Filter out `(no topic)` messages → get most recent topic name + last N messages
5. LLM relevance check (fast, cheap): is `event.text` related to recent topic context?
6. If **related** → rewrite event, prepend `[routed from (no topic)]`, change `event.source.thread_id`
7. If **not related** → rename `(no topic)` thread → descriptive 2-5 word topic, return `allow`
### Multi-instance Coordination
Dropped for v1 — single Eagle instance in practice. Can add mutex later if needed.
## Implementation Steps
1. Add Zulip stream message history query to Eagle's toolkit (REST API call via hermes)
2. Create `zulip_thread_locks` table in `personal_os` DB
3. Write topic routing logic as a function in the Eagle prompt or as a cron-triggered script
4. Test: send message in `(no topic)`, verify routing + rename behavior
## Questions
- Does Eagle get invoked *automatically* for every (no topic) message, or only when mentioned?
- Is Eagle a single process or multiple instances per stream? (affects coordination complexity)
- What's the stream scope? Only `master`? Or all streams?
- [x] Confirmed curl approach works for topic creation
- [x] Identified `pre_gateway_dispatch` as correct hook
- [x] Confirmed `thread_id == "(no topic)"` detection pattern
- [ ] Create `~/.hermes/plugins/zulip-topic-routing/plugin.yaml`
- [ ] Create `~/.hermes/plugins/zulip-topic-routing/__init__.py`
- [ ] Enable plugin in `~/.hermes/config.yaml`
- [ ] Test: send `(no topic)` message, verify routing
## Notes
- Current session: this `(no topic)` thread in `master` stream should be renamed to something like `planning: system improvements 2026-05`
- Zulip topic rename API: `PATCH /api/v1/messages/{message_id}` with `topic` param (requires first message ID of the thread)
- Topic rename API requires `propagate_mode=change_all` to rename all messages in thread
- Zulip uses `subject` field internally, `thread_id` in Hermes maps to it
- Free streams setting: `ZULIP_FREE_STREAMS=master,daily-brief,inbox,executor,personal,focus`
- Plugin lives in `~/.hermes/plugins/` (user plugins, override bundled)