Remove claude-agent's Matrix presence entirely — Hermes is the only agent in Matrix

By request: one agent in Matrix, not several. Removes matrixBot.js,
router.js (chat-vs-code-task classifier), litellm.js (claude-agent's own
LiteLLM client), the matrix-bot-sdk dependency, runChatTask() and its
gitea.js branch/PR helpers (createBranch/createPullRequest — only ever
called from the now-removed chat flow), and every Matrix/LiteLLM env var
from claude-agent's compose service.

claude-agent already left the control room manually before this merge.
It keeps its Gitea-webhook-triggered PR review, which never touched Matrix
or LiteLLM to begin with.

Makes PR #12 (the claude-bot/Hermes cross-reply cascade fix) moot — the
bug can't happen once claude-agent has no Matrix client at all. Close #12
without merging once this lands.
This commit is contained in:
2026-08-23 16:16:19 +00:00
parent fff021283d
commit 6bc862e051
10 changed files with 42 additions and 283 deletions
+25 -21
View File
@@ -1,21 +1,25 @@
# gitops-automation
Claude Code automation wired into Gitea + Portainer + Matrix on this VPS. See
`~/.claude/plans/cozy-honking-lantern.md` on the host for the full design rationale.
Claude Code + Hermes automation wired into Gitea + Portainer + Matrix on this VPS. See
`~/.claude/plans/cozy-honking-lantern.md` on the host for the original design rationale
(some of it — the Matrix chat bot on claude-agent — has since been superseded, see below).
Three things this gives you:
What this gives you today:
- **PR review**: opening/updating a PR in a watched Gitea repo gets a Claude-authored
review comment.
review comment (`claude-agent`, triggered by a Gitea webhook — nothing to do with Matrix).
- **GitOps redeploy**: pushing to `main` on this repo rebuilds the `claude-agent` image
(Gitea Actions) and redeploys the stack (Portainer webhook).
- **Chat-driven coding agent**: `!claude owner/repo <instruction>` in the Matrix control
room clones the repo, runs Claude Code, and opens a PR with the result.
- **Ask other models**: `!ai <prompt>` (default model) or `!ai provider/model <prompt>`
(e.g. `!ai google/gemini-2.0-flash-001 explain this error`) queries any model on
OpenRouter and replies in the room. No repo/file access — just a chat reply, unlike
`!claude` which is the only command that can edit files and open PRs.
(Gitea Actions) and redeploys the stack, chained as the last step of that same workflow.
- **Matrix**: **Hermes is the only agent present in Matrix.** `claude-agent` used to also
run a Matrix bot (`!claude`/`!ai` commands, then no-prefix auto-routing) — that's been
removed entirely (by request: one agent in Matrix, not several). Hermes has its own
native Matrix connection, responds to `@hermes <message>` in shared rooms (no mention
needed in DMs), and has its own tools (terminal, code execution, web search, etc.) — see
its docs at https://hermes-agent.nousresearch.com for what it can do. It does not (yet)
have the old branch/PR-opening workflow the Matrix bot used to have; that logic still
exists in git history if it's worth reviving as a Hermes tool/skill later.
Nothing here auto-merges. Every path stops at a comment or an open PR — a human clicks merge.
Nothing here auto-merges PRs. Every path stops at a comment or an open PR — a human clicks
merge (enforced by branch protection on `main`, not just by convention — see below).
## Prerequisites (one-time, on the VPS)
@@ -125,17 +129,17 @@ docker network create web
## Smoke test
- Open a throwaway PR on a repo with the PR webhook set → expect a Claude review comment.
- In the Matrix control room: `!claude owner/repo add a comment to the README` → expect a
"working on it" reply, then a PR link.
- `git push` to `main` on this repo → expect a Gitea Actions run, then a Portainer redeploy.
- In the Matrix control room: `@hermes hello` → expect a reply from Hermes.
- `git push` to `main` on this repo (touching `agent/**`) → expect a Gitea Actions run,
then a chained Portainer redeploy at the end of that same workflow.
## Notes
- `agent/src/runner.js` is the only thing that ever runs `git commit`/`git push`/`git
checkout` — Claude Code itself is explicitly denied those tools (`--disallowedTools`),
so even a misbehaving prompt can't push directly or touch `main`.
- The Matrix bot only reacts inside `MATRIX_CONTROL_ROOM_ID`; keep that room invite-only.
- `agent/src/runner.js` only ever runs read-only `git clone`/`fetch`/`checkout` for the PR
diff it reviews — Claude Code itself is denied `Edit`/`Write`/commit/push tools
(`--disallowedTools`), so this path can never modify a repo, only comment on it.
- `.gitea/workflows/build.yml` assumes the act_runner label `docker` — check
`GITEA_RUNNER_LABELS` in `docker-compose.yml` matches what you actually registered.
<!-- gitops loop smoke test 2026-08-23T11:23:34Z -->
- Hermes's own config/memory/skills live in `/home/william/hermes-data` on the host
(bind-mounted, not in this repo) — back that up separately if it accumulates anything
worth keeping.