Leetcoder
Enables Hermes agents to delegate bounded coding tasks to persistent oh-my-pi sessions with isolated git worktrees, live steering, and durable follow-ups, requiring explicit user confirmation before each task.
README
Leetcoder
Leetcoder lets a live Hermes agent hand a bounded job to a native
oh-my-pi session without surrendering
control of the conversation. Each delegation gets an isolated git worktree,
its own persistent OMP root session, a visible title, live steering, durable
follow-ups, native Advisor review, an electable OMP task/hub swarm, and a
mandatory Librarian handoff.
Nothing starts on the first tool call. Hermes receives the proposed scope and every active Leetcoder title, checks for duplicate work itself, and confirms on the second call. This is agent lifecycle control, not a human permission prompt.
flowchart LR
H["Hermes conversation"] -->|"delegate proposal"| M["Leetcoder MCP"]
M -->|"active titles + confirmation token"| H
H -->|"agent confirms no duplicate"| G["Leetcoder gateway"]
G --> W["isolated git worktree"]
G --> O["persistent OMP RPC root"]
O --> A["native read-only Advisor"]
O --> F["Firecrawl / Camofox / Retrieval / Codebase Memory"]
O -->|"elects bounded delegation"| S["OMP task + hub"]
S --> C["isolated native subagents"]
C --> R["agent:// artifacts + history:// transcripts"]
O -->|"mandatory memory_add"| L["Librarian OKF handoff"]
Hermes elects whether a bounded assignment deserves Leetcoder. The persistent OMP root then elects whether to work directly or use native subagents. OMP owns child concurrency, isolation, lifecycle, revival, and merging; Leetcoder owns the cross-harness root, durable control contract, outer draft, recovery, and final knowledge handoff.
What it owns
- two-stage, one-use agent confirmation before a task begins, with an exact duplicate check at confirmation time;
- up to three concurrent root workers by default, each continuously reviewed by OMP's native Advisor; three worker/Advisor pairs plus Hermes and Librarian fit the configured eight-sequence local model ceiling;
- native OMP protocol v2 root sessions, steering, follow-ups, and resumption;
- OMP-native
taskbatching, bounded concurrency, isolated child edits, andhubreuse without exposing another Hermes management surface; - one git branch and worktree per delegation, preserved after completion;
- SQLite root/child lifecycle, event history, transcript offsets, and compact
transcript excerpts under
~/.local/share/leetcoder; - nested subagent status trees with live intent/tool activity plus durable
agent://andhistory://references after Hermes compaction; - automatic recovery of interrupted turns after a service restart;
- graceful and force-close semantics with truthful handoff status;
- a required
mcp__librarian_memory_addOKF handoff after every completed implementation or follow-up turn.
Leetcoder does not parse a TUI, call an OpenAI-compatible endpoint, create a second model configuration, or copy uncommitted source-checkout changes. OMP receives its ordinary tools and MCP integrations through an isolated profile cloned from the user's current OMP configuration.
Requirements
- Debian or another systemd-user Linux environment;
- Bun or Sandwich on
PATH; - native
omp,hermes, andgitcommands; - Librarian registered in OMP before setup. The handoff is a hard completion condition, not an optional integration.
Install
git clone https://github.com/CommanderTurtle/leetcoder.git ~/Hermes/leetcoder
cd ~/Hermes/leetcoder
bun install
bun run setup
Setup performs a frozen Bun install, builds local artifacts, creates the
leetcoder OMP profile, installs the user service, registers the Hermes MCP,
installs the small Hermes routing skill, and restarts the Hermes gateway.
The generated paths are deliberately outside git:
~/.config/leetcoder/config.json lifecycle configuration
~/.config/leetcoder/token loopback API bearer token
~/.local/share/leetcoder/ database and isolated worktrees
~/.omp/profiles/leetcoder/ autonomous OMP profile
Hermes tools
| Tool | Contract |
|---|---|
leetcoder_delegate |
prepare reports scope and active sessions; confirm starts the non-duplicate task with the returned token. |
leetcoder_status |
Restore awareness after compaction or inspect one session, including its native subagent tree, child artifacts/transcripts, objective, current activity, and draft location. |
leetcoder_steer |
Steer live work immediately or durably resume/queue direction; the root reuses relevant native children through hub. |
leetcoder_stop |
Stop while preserving branch/worktree; graceful by default. |
Templates cover implementation, bug fixes, audits, refactors, tests, research, interactive web work, and source comparisons. They provide execution shape, not canned answers; the full delegation remains authoritative.
Operations
bun run doctor
bun dist/cli.js health
bun dist/cli.js sessions --all
bun dist/cli.js service status
bun dist/cli.js service restart
An interrupted gateway marks in-flight roots paused and running children
interrupted, preserves their OMP session paths and artifact identities, and
automatically queues a recovery turn after restart. Steering and follow-up
messages are stored before deferred execution and survive service restarts.
leetcoder_status refreshes the live OMP registry through RPC, reads child
transcripts incrementally, and reconstructs the complete control view after
Hermes compaction from SQLite rather than relying on conversation memory. A
detailed session inspection also reports the live root's model, streaming and
compaction state, queued messages, todos, throughput, and context utilization.
The Leetcoder profile enables OMP's native Advisor at the persisted profile and every headless RPC launch. The runtime flag matters because OMP intentionally resets workflow-altering Advisor/task/memory settings to safe defaults in RPC mode. Advisor subagents remain disabled: each root worker gets one passive, read-only reviewer rather than an uncontrolled review tree. Native task recursion remains one level and concurrency remains one child per root by default. Inner async execution is disabled because Leetcoder itself already runs the root in the background; a child therefore replaces rather than overlaps its parent's generation slot. This keeps three root/Advisor pairs, Hermes, and Librarian inside the configured eight-sequence local model ceiling.
Closing never deletes a branch or worktree. Review, merge, archive, or remove them explicitly with ordinary git commands after the parent Hermes session has accepted the result.
Updating
cd ~/Hermes/leetcoder
git pull --ff-only
bun install --frozen-lockfile
bun run build
bun dist/cli.js service restart
hermes gateway restart
Run bun run setup again only when profile, MCP registration, or durable paths
change. It is idempotent and keeps the token and existing Leetcoder state.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。