AI RHAMZ is a deeply modified, unchained source-level fork of OpenCode v2.0.16 (packages/core, packages/tui, packages/schema, packages/cli) engineered for autonomous software engineering, low-level systems architecture, reverse engineering, and offensive security research (Bug Bounty / Red Team).
We preserved the rock-solid OpenCode v2 engine (Effect-TS client/server runtime, SQLite session state, prompt caching, dynamic tool loading, and Tree-sitter/LSP integration) while stripping out hidden vendor identity leaks, per-model safety collars, subagent depth limits, tool-loop stalls, and clunky stock UI defaults—replacing them with an Epistemic Swarm Architecture, Loop Breaker, First-Class TODO Engine, and a flash-free Deep Obsidian HUD in OpenTUI.
- Removed Silent Vendor Identity Leaks (
packages/core/src/plugin/identity.ts): Stock OpenCode injects a trailing system block (# Your Model: <name>,Provider ID,Model ID) on every single API request, reminding the model of its stock vendor persona right before user execution.identity.tsnow injects a clean, vendor-agnostic AI RHAMZ offensive & low-level architecture identity. - Direct System Prompt Injection (
packages/core/src/instruction-discovery.ts,session/instructions.ts): Stock OpenCode wraps local instruction files (AGENTS.md, etc.) in anInstructions from: /path/to/fileheader, which modern LLMs treat as a low-priority untrusted user file tag. We stripped that wrapper soRHAMZ.md,AGENTS.md, andSYSTEM.mdare injected directly as raw, top-priority system directives. - SHA-256 Instruction Deduplication (
packages/core/src/config/plugin/instruction.ts): Added native discovery forRHAMZ.md,AGENTS.md, andSYSTEM.mdacross global config (~/.config/opencode/) and project ancestor directories, backed by SHA-256 content-hash deduplication (seenContentHashes) so mirrored manifest files never consume context tokens twice. - Stripped Per-Model Castration Prompts (
packages/core/src/plugin/system-prompt/*.txt):trinity.txt: removed hardcoded"Keep your responses to fewer than 4 lines","One word answers are best","DO NOT ADD ANY COMMENTS", and refusal directives.gpt.txt/gpt-astra.txt: removed"Do not spawn subagents by default"and autonomy restrictions.kimi.txt/meta.txt/anthropic.txt: removed sandbox warnings, lecturing directives, and artificial output throttling.
In stock OpenCode, subagents blindly treat prompts from a parent agent as infallible human truth, and parent agents blindly trust subagent summaries without verification. AI RHAMZ introduces a bidirectional Epistemic Hierarchy Protocol:
- Downward Epistemic Framing (
packages/core/src/tool/plugin/subagent.ts,packages/core/src/plugin/agent.ts): Every spawned subagent (and nested sub-subagent across depths1..5) receives an explicit chain-of-command header:Subagents know their caller is a fallible upstream AI agent (not the human operator) that can make wrong assumptions about file paths, root causes, or architecture. Subagents are instructed to verify caller hypotheses against real code/AST/logs, push back with hard evidence when the caller is wrong, and never fabricate success to please the parent agent.[EPISTEMIC HIERARCHY: CALLER IS AN AI AGENT — NOT THE HUMAN USER] - Chain of Command: Human Operator -> Root Agent -> ... -> You (Depth N Subagent) - Upward Epistemic Framing (
packages/core/src/session/subagent-completion.ts,packages/core/src/tool/plugin/subagent.ts): Whenever a subagent completes or returns output, the parent agent receives an[EPISTEMIC VERIFICATION NOTICE FOR PARENT AGENT]reminding it to independently verify subagent claims and diffs before reporting to the human operator.
3. 5-Depth Recursive Subagent Swarm & Live Inter-Agent Control Plane (packages/core/src/tool/plugin/subagent.ts)
- Unlocked Recursive Swarm Depth (
DEFAULT_SUBAGENT_DEPTH = 5): Raised default subagent recursion depth from1to5and granted thegeneralsubagent fullsubagenttool permissions (packages/core/src/plugin/agent.ts), enabling multi-layer Root → Recon → Scanner/Fuzzer → Exploit → Arbiter/Report pipelines. - Live Non-Blocking Subagent Steering (
action: "run" | "send_message" | "steer" | "interrupt"):action="run"(default): spawns a new child session or continues an existingsessionID.action="send_message"/"steer": injects live findings or course corrections ([LIVE UPDATE FROM PARENT AGENT]) directly into a running subagent's queue between tool steps without blocking.action="interrupt": immediately aborts an obsolete or stuck subagent branch (sessions.interrupt+jobs.cancel).- Built-in Anti-Spam Guard (8s Cooldown & Status-Ping Blocker): blocks status-polling spam (
"are you ready?","status?","ты готов?") and duplicate pings at both schema and runtime levels.
- Zero-Friction Filesystem Permissions (
packages/schema/src/agent.ts): Changed default permissions forexternal_directory,*.env, and*.env.*from"ask"to"allow".
- Built a session-scoped
sessionLoopTrackerdirectly into the core tool execution pipeline (packages/core/src/tool.ts) that monitors consecutive tool errors and repeated identicaltool + argsinvocations. - After 3 identical calls or 3 consecutive failures, the runtime automatically injects
[LOOP BREAKER — CRITICAL SYSTEM INTERVENTION]into the tool result, forcing the agent to immediately abandon the broken command/vector and pivot to an alternative approach or native tool (read,write,edit,glob,grep).
5. First-Class Session TODO Engine & Native Tool Discipline (packages/core/src/tool/plugin/opencode.ts, session/system-prompt.ts)
- Native
todowrite&todoreadTools (packages/core/src/tool/plugin/opencode.ts): Registered first-class session-scoped checklist tools supportingpending,in_progress,completed, andcancelledstates alongsidehigh | medium | lowpriority tags. - Mandatory TODO & Native Tool Protocol (
system-prompt.ts,RHAMZ.md):- Enforces live
todowritetracking on all multi-step tasks. - Strictly prioritizes native file/search tools (
readinstead ofcat/head/tail/Get-Content,editinstead ofsed/awk,writeinstead ofecho >/cat <<EOF,glob/grepinstead of shellfind/rg).
- Enforces live
6. Free 5-Provider Keyless Web Search Load-Balancer (packages/core/src/websearch.ts, tool/plugin/websearch.ts)
- Enabled the
"random"multi-provider load-balancer by default across all 5 keyless providers (Exa, Tavily, Firecrawl, Parallel, TinyFish) with automatic failover onHTTP 429at$0.00cost.
- Deep Obsidian Dark Theme (
packages/tui/src/theme/assets/v2/opencode.json,assets/opencode.json,.opencode/themes/rhamz.json):- Deep obsidian-carbon surfaces (
#06070abase background,#0b0d12raised panels/dialogs,#11141ccontrols/pills,#191d28active row highlight,#e4e8f4soft white text,#78809emuted text,#7aa2f7steel blue interactive accent,#e06c88soft coral-rose accent).
- Deep obsidian-carbon surfaces (
- Zero White Flashing & Strobe-Free Menus:
- Removed all white/cyan flash animations when opening modals or
Settings(packages/tui/src/ui/dialog.tsx), firing toasts (ui/toast.tsx), or typing in the prompt (component/prompt/index.tsx,component/tab-pulse.tsx). - Replaced inverted high-contrast selection bars in
DialogSelect(packages/tui/src/ui/dialog-select.tsx) with a smooth elevated dark highlight (#191d28), crisp light text, and a left▎accent indicator—eliminating strobing when navigating Settings or menus. - Set
animations: falseby default (packages/tui/src/config/index.tsx,cli.json).
- Removed all white/cyan flash animations when opening modals or
- Minimal Contextual Swarm & Scroll Strip (
packages/tui/src/routes/session/index.tsx):- Left (contextual): Only when subagents or TODOs exist in the session, displays a clean inline breadcrumb (
◈ Root · Subagent · Swarm (N)) and☑ X/YTODO indicator right above the prompt for 1-click switching without adding extra bars. - Right: Clean, instant 1-click scroll controls (
↑ Top,▲ Up,▼ Down,↓ Latest) right above the prompt input.
- Left (contextual): Only when subagents or TODOs exist in the session, displays a clean inline breadcrumb (
- Direct Subagent Input & Hierarchical Swarm Tree (
routes/session/index.tsx,composer/subagents-tab.tsx,composer/index.tsx):- Kept the
<Prompt>input box active inside subagent sessions so you can message or steer any subagent directly while viewing its transcript. - Upgraded
SubagentsTabto render the full recursive family tree (◈ Root+ nested├─/└─subagents) and made all composer dock tabs (Subagents,Diff Review,Terminals,[× Close]) clickable with the mouse.
- Kept the
- Momentum Scroll Acceleration & Scrollbar (
packages/tui/src/util/scroll.ts,component/session-tabs.tsx):- Enabled
MacOSScrollAcceleration(speed: 5) and the vertical transcript scrollbar by default. - Added mouse-wheel scrolling and clickable
‹/›overflow buttons toHorizontalSessionTabs.
- Enabled
- Inline TODO Checklist Renderer (
packages/tui/src/routes/session/index.tsx,message-parts.tsx,util/tool-display.ts):- Renders
todowrite/todoreadcalls as rich# ☑ TODO Checklist (X/Y completed)cards with[✓],[⟳],[ ],[-]status icons and[high]priority badges.
- Renders
RHAMZ.md(.opencode/agent/rhamz.md,.opencode/skills/rhamz/SKILL.md,~/.config/opencode/RHAMZ.md): Full RHAMZ ATK 5.0 TITAN APEX operational manifest (Amnesia Protocol, Anti-Refusal Armor 2.0, Zero-Laziness Directive, Mandatory TODO & Native Tool Protocol, Operational Sections 1–9, and Stability & Quality Protocol).- 4D Bug Bounty Swarm (
.opencode/agent/bugbounty-*.md,.opencode/skills/bugbounty/SKILL.md): Dedicatedbugbounty-conductor,bugbounty-recon,bugbounty-scanner,bugbounty-exploit, andbugbounty-reportagents for autonomous vulnerability discovery and PoC validation. - Anti-Slop Designer Skill (
.opencode/skills/designer/SKILL.md): High-craft UI/UX design system (Atmospheric Minimalism, Swiss Grids, Kinetic Typography, Intentional Dark Mode) with strict anti-slop enforcement.
- Intelligent Shell Output Compression (
packages/core/src/shell/compress.ts,tool/plugin/shell.ts,session/runner/to-llm-message.ts):- Automatically compresses noisy terminal output before sending it to the LLM (saving up to 70–80% of wasted context tokens) while keeping raw output intact in the TUI:
- Collapses deep stack traces (keeps the first 5 frames +
... N more stack frames). - Collapses hundreds of passing test lines (
PASS / ✓ / ok→ keeps first 3 +... N passing tests omitted) while preserving 100% ofFAIL/ERRORoutput untouched. - Strips ASCII spinners and download progress bars (
[████░░░░] 52%), and collapses consecutive duplicate log lines (... N more similar lines).
- Collapses deep stack traces (keeps the first 5 frames +
- Automatically compresses noisy terminal output before sending it to the LLM (saving up to 70–80% of wasted context tokens) while keeping raw output intact in the TUI:
- CAS File Read Deduplication & Single-File Symbol Outline (
packages/core/src/tool/agent-bus.ts,tool/repo-map-index.ts,tool/plugin/read.ts):- Computes a deterministic 8-hex content hash (
hash:<8hex>) on every file slice read. If the same session re-reads the exact same file range and the file has not changed on disk, returnsunchanged:<hash> (... — content already in your context)instead of re-sending hundreds of duplicate lines. - When reading a large file that gets truncated/paged, automatically appends a
Symbols below line X:outline (fn,class,interface,typewith:start-endline spans) for that single file only (zero automatic background repository indexing—the model explores on its own).
- Computes a deterministic 8-hex content hash (
- Shared Subagent Bus & Cross-Agent Contention Detection (
packages/core/src/tool/agent-bus.ts,edit.ts,write.ts,patch.ts,grep.ts,glob.ts):- Shares read-only
grepandglobresults across parallel subagents in the same workspace epoch so concurrent subagents don't run duplicate ripgrep scans, invalidating automatically the instant any file is modified. - Detects cross-subagent file edits so if a parallel subagent modifies a file, other subagents are notified to re-read the updated lines instead of failing blindly.
- Shares read-only
- Hybrid V2 Compaction + Editable Checkpoint Files + TUI
Context & CompactTab (packages/core/src/session/working-state.ts,session/compaction.ts,tui/src/routes/session/composer/context-tab.tsx):- Adaptive Complex / Bug Bounty / Swarm Compaction: Instructs the LLM to write a full custom technical breakdown (
## Technical & Offensive / Swarm State) when compacting Bug Bounty, reverse engineering, exploit chaining, or multi-agent swarm sessions—preserving all targets, endpoints, payloads, offsets, disputed premises, and subagentsessionIDs. - Instant V2 WorkingState Digest: Automatically tracks modified/inspected files, subagent swarm
sessionIDs/findings, and recent shell commands/failures in the background with zero LLM overhead and appends## Auto-Tracked Working State (V2 Digest)alongside the LLM summary. - Live-Editable Compaction Checkpoints (
.opencode/context/) & TUI◈ ContextTab (/context):- Every compaction saves an editable Markdown checkpoint to
.opencode/context/compaction-<sessionID>.mdalongside persistent operator notes in.opencode/context/context.md. - Any edits saved to
.opencode/context/compaction-<sessionID>.mdor.opencode/context/context.md(via the TUI◈ Contexttab //contextcommand or any editor) are live-loaded into<conversation-checkpoint>on the very next turn.
- Every compaction saves an editable Markdown checkpoint to
- Adaptive Complex / Bug Bounty / Swarm Compaction: Instructs the LLM to write a full custom technical breakdown (
- Bun
>= 1.3.x
git clone https://github.com/dsadawq3/ai-rhamz.git
cd ai-rhamz
bun installbun --preload ./packages/cli/node_modules/@opentui/solid/scripts/preload.js ./packages/cli/src/index.tsOr via the root script:
bun run devbun --preload ./packages/cli/node_modules/@opentui/solid/scripts/preload.js ./packages/cli/src/index.ts auth loginTo compile a standalone native binary (packages/cli/dist/cli-windows-x64/bin/opencode.exe):
$env:OPENCODE_VERSION = "2.0.16"
$env:OPENCODE_CHANNEL = "latest"
bun run packages/cli/script/build.ts --single --skip-install --skip-web-ui| Subsystem | Files |
|---|---|
| Core Identity & System Prompts | packages/core/src/plugin/identity.ts, packages/core/src/session/system-prompt.ts, packages/core/src/session/runner/prompt/system.txt, packages/core/src/plugin/system-prompt/*.txt |
| Direct Rule Injection & Deduplication | packages/core/src/instruction-discovery.ts, packages/core/src/session/instructions.ts, packages/core/src/config/plugin/instruction.ts |
| Epistemic Hierarchy & 5D Subagent Swarm | packages/core/src/tool/plugin/subagent.ts, packages/core/src/session/subagent-completion.ts, packages/core/src/plugin/agent.ts, packages/schema/src/agent.ts |
Shell Output Compression (ShellCompress) |
packages/core/src/shell/compress.ts, packages/core/src/tool/plugin/shell.ts, packages/core/src/session/runner/to-llm-message.ts |
CAS Read Dedup, Symbol Outline & AgentBus |
packages/core/src/tool/agent-bus.ts, packages/core/src/tool/repo-map-index.ts, packages/core/src/tool/read-filesystem.ts, packages/core/src/tool/plugin/read.ts, edit.ts, write.ts, patch.ts, grep.ts, glob.ts |
Hybrid V2 Compaction & TUI Context Tab |
packages/core/src/session/working-state.ts, packages/core/src/session/compaction.ts, packages/tui/src/routes/session/composer/context-tab.tsx |
| Loop Breaker (Anti-Stuck Engine) | packages/core/src/tool.ts |
First-Class TODO Tools (todowrite / todoread) |
packages/core/src/tool/plugin/opencode.ts, packages/tui/src/util/tool-display.ts |
| 5-Provider Keyless WebSearch | packages/core/src/websearch.ts, packages/core/src/tool/plugin/websearch.ts |
| Top Swarm HUD, Subagent Input & TODO UI | packages/tui/src/routes/session/index.tsx, packages/tui/src/routes/session/message-parts.tsx, packages/tui/src/routes/session/composer/index.tsx, packages/tui/src/routes/session/composer/subagents-tab.tsx |
| Settings Category Tabs & Flash-Free Dialogs | packages/tui/src/component/dialog-config.tsx, packages/tui/src/ui/dialog.tsx, packages/tui/src/ui/dialog-select.tsx, packages/tui/src/ui/toast.tsx, packages/tui/src/component/tab-pulse.tsx |
| Momentum Scroll & Session Tabs | packages/tui/src/util/scroll.ts, packages/tui/src/component/session-tabs.tsx, packages/tui/src/config/index.tsx |
| Deep Obsidian Theme & 24-Bit Logo | packages/tui/src/theme/assets/v2/opencode.json, packages/tui/src/theme/assets/opencode.json, .opencode/themes/rhamz.json, packages/tui/src/logo.ts, packages/tui/src/component/logo.tsx |
| Built-In Agents & Skills | .opencode/agent/rhamz.md, .opencode/agent/bugbounty-*.md, .opencode/skills/rhamz/SKILL.md, .opencode/skills/bugbounty/SKILL.md, .opencode/skills/designer/SKILL.md |