3.0 KiB
3.0 KiB
MOPAC harness — design spec v0 (2026-08-28)
A Go headless agent harness for the RCEO/TSG org. Replaces bash/screen/file-hack inner loop. All patterns established 2026-08-28 STAY; only the substrate changes. References: ../reference/{crush,maki}; siblings to port: ../siblings/{KNEL-AIMiddleware, KNELSecretsManager}.
What it is NOT
- Not a TUI. Inner loop = pull Redmine -> run turn -> write Discourse/Redmine back -> chain next turn. Humans observe via files/Redmine/Discourse, not by attaching to the loop.
- Not a daemon. Bounded turns chaining (drip), same as dispatch-turn.sh today.
Core loop (from DESIGN-24x7-execution.md, carried over)
- INTAKE: poll released scope (Redmine query) + local inbox files.
- GATE: semaphore (LLM slots, class-aware: llm-heavy|compute-long|hybrid), budget from LiteLLM usage API (http://192.168.3.78:4001) — virtual key per stack, hard caps enforced at proxy.
- EXECUTE: bounded turn, fresh small context, tools below.
- WRITEBACK: REPORT file + Redmine issue note (SoR). Discourse for docs.
- CHAIN: completion triggers next conductor iteration. P1 first, grinders chunked, compute-long tasks run in non-LLM slots.
- ESCALATE: anything outside standing-release scope -> TASK file -> founder gate. Never auto-executes.
Tools (port from crush/KNEL, Go)
- bash exec, file edit (tree-sitter-aware parses; see maki's approach),
redmine-cli, discourse-cli, tea (gitea), docker, bitwarden (replace
KNELSecretsManager with Go bwraper around
bwCLI; secrets never in logs). - MCP client (crush's mcp plumbing is the reference; wrappers exist in siblings/KNEL-AIMiddleware — port config format for compat).
- LSP: port lsp-* wrappers or embed go.lsp devkit.
- Permission model: per-tool allow/deny, tree-sitter bash parsing (maki reference) — subshells/pipes handled; org preset: no sudo/ssh/network exfil; writes confined to declared roots.
Providers
- OpenAI-compatible only, pointed at LiteLLM (base_url + virtual key). OAuth flows (crush-style) OUT of scope for v1 — proxy key is enough.
- Retry/backoff on stream truncation (z.ai "Message content shorter than read bytes" seen 2x today) with turn resume.
Cross-host (5 onstage + 3 offstage)
- Each host runs harness instances; coordination via _crossfeed files (v1) and/or LiteLLM keys as the global budget broker. Event receiver (T1) later.
Build order (go slow, grinder TASKs, quota-aware)
- Reference studies: crush oauth/mcp/session code; maki permission parsing + token-reduction (index/tool_search). Deliverable: PORTING-NOTES.md each.
- harness skeleton: config, loop, redmine-pull, file writeback, exec tool.
- Permission layer + bitwarden wrapper.
- LiteLLM integration + semaphore/budget gates.
- MCP/LSP ports.
- Pilot: one RCEO stack on trivial released scope; compare vs drip loop.
Constraints
- Quota: grinder turns only, no idle polling loops, compact aggressively.
- Never log secret values; keys from bitwarden at runtime.
- Everything it does lands in git (tooling repos) or Redmine (work records).