# BooCode Lift Analysis — What Can We Lift Into BooCode? Date: 2026-06-07 Scope: 30+ repos scanned across 2 passes. Pass 1 (14 repos): opencode, agentic, hcom, oh-my-openagent, oh-my-pi, OpenAgentsControl, Codex-CLI-Compact, conductor, measuring-ai-proficiency, boocontext, opencode-pty, pskoett-skills, paseo, additional-forks (openspec, codesight, tree-sitter-analyzer, etc.) Pass 2 (16 repos): bun, claudish, cline, goose, han, happy, openchamber, llama.cpp, unsloth, SkillOpt, subtask2, superset, pi-acp, qwen-code, opencode-background-agents, opencode-sentry-monitor, opencode-skillful, opencode-wakatime, opencode-worktree, opencode-zellij-namer --- ## BooCode Architecture (for context mapping) ``` apps/server — Fastify API + inference loop + file-read tools + MCP client + codecontext client apps/web — React 18 + Vite + Tailwind v4 + shadcn/ui apps/booterm — Fastify + node-pty + tmux (browser terminal panes) apps/coder — BooCoder: write tools + ACP/PTY dispatcher + provider snapshot + Arena + MCP server packages/contracts — Cross-app wire contracts (WsFrame, provider-snapshot, message-metadata) codecontext/ — Go sidecar (codegraph MCP server, v3.2.1) conductor/ — 22 read-only Han flows via local Qwen data/AGENTS.md — 8 agent personas (Code Reviewer, Debugger, Refactorer, etc.) data/skills/ — Skills system (SKILL.md + optional eval.yaml) orchestrator — Multi-agent conductor (Paseo-style run pane, evidence-disciplined reports) ``` --- ## LIFT MATRIX — Capability Domain × Source Repo × BooCode Target ### Domain 1: Multi-Provider Model Routing & LLM Abstraction | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | Route/protocol abstraction layer (4-axis: route=protocol+endpoint+auth+framing) | **opencode** `packages/llm/` → `Route.make({provider, protocol, endpoint, auth, framing})` | apps/server inference loop → replace hardcoded provider dispatch | Large | High | | 40+ provider plugins with model discovery + fallback chains | **oh-my-pi** `packages/ai/` | apps/coder provider-registry.ts (currently 5 providers) | Med | High | | Provider priority chains, capability detection, availability checking, model normalization | **oh-my-openagent** `packages/model-core/` → pure TS, no harness deps | apps/coder provider-registry.ts → abstract model resolution | Small | High | | Config-backed provider lifecycle with overrides | **opencode** `packages/core/src/plugin/provider/` | apps/coder provider-registry.ts + data/coder-providers.json | Med | Med | ### Domain 2: Codebase Context & Code Intelligence | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | Replace Go codecontext sidecar with TS boocontext (7 tools, session cache, wiki) | **boocontext** (this fork `boocontext/`) | codecontext/ sidecar → replace HTTP shim with MCP client | Med | Critical | | Call graph analysis (callers/callees with depth) | **tree-sitter-analyzer** via boocontext | apps/server codecontext_client.ts → new tool | Med | High | | Health grades (A-F per file, 7 dimensions) | **tree-sitter-analyzer** via boocontext | apps/server → new tool for Refactorer/Architect agents | Med | High | | BM25-ranked symbol search | **tree-sitter-analyzer** via boocontext | codecontext_client.ts → replace search_symbols | Med | High | | Impact analysis (symbol trace + file blast radius merged) | **boocontext** `src/tools/impact.ts` | apps/server → new tool for change planning | Med | High | | Wiki mode (targeted articles: auth.md, database.md, etc.) | **codesight** `--wiki` mode | apps/server → generate persistent codebase wiki | Med | Med | | Semantic codebase graph (info_graph + chat_action_graph) | **Codex-CLI-Compact** `bin/dual_graph_launch.sh` (proprietary core) | apps/server → build own dual-graph system | Large | High | | Token-efficient scanning (7-12x reduction vs manual exploration) | **codesight** | codecontext/ → adopt codesight's scanner | Small | High | ### Domain 3: Multi-Agent Orchestration | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | Declarative workflow definitions (JSON DAGs) | **conductor** `schemas/WorkflowDef.json` | conductor/ orchestrator → flow format | Med | High | | Task state machine (SCHEDULED → IN_PROGRESS → COMPLETED/FAILED/TIMED_OUT with retriable flag) | **conductor** `TaskModel.java` | conductor/ flows → step state model | Small | High | | DO_WHILE loop for agent iteration | **conductor** `DoWhile.java` | conductor/ → loop support | Med | High | | FORK_JOIN parallel execution with Join synchronization | **conductor** `Fork.java` + `Join.java` | conductor/ → parallel step execution | Med | High | | SWITCH task for conditional branching | **conductor** `Switch.java` | conductor/ → conditional flow routes | Small | Med | | Parallel execution with batch batching (independent tasks run concurrently) | **OpenAgentsControl** `.opencode/agent/subagents/core/task-manager.md` | conductor/ → parallel batch execution | Small | High | | Subagent tool restriction schema (YAML frontmatter: read/grep/glob/bash bools) | **agentic** `agent/*.md` frontmatter | data/AGENTS.md + conductor/agents → tool permissions per agent | Small | High | | Structured phased workflow lifecycle (ticket → research → plan → execute → commit → review) | **agentic** `command/ticket.md`, `command/research.md`, etc. | conductor/ or new workflow | Med | Med | | Multi-agent orchestration hub daemon | **paseo** (this fork `paseo/`) | apps/coder → multi-agent lifecycle management | Large | Med | ### Domain 4: Inter-Agent Communication & Coordination | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | Inter-agent messaging via shared DB + delivery | **hcom** `src/delivery.rs` + `src/db.rs` | apps/server → message queue between Orchestrator + BooCoder | Large | High | | Per-tool hook normalization (10 tools: Claude, Codex, Gemini, etc.) | **hcom** `src/hooks/` | apps/coder → normalized hook payload format | Med | Med | | Event subscription system (agents subscribe to status/file-edit events) | **hcom** `src/commands/` (`hcom events --wait --sql`) | apps/server → reactive event triggers | Med | High | | Collision detection (two agents editing same file within 30s) | **hcom** `src/` (codex_file_edits.rs) | apps/coder → concurrent edit warnings | Small | Med | | Multi-agent topologies (worker-reviewer, ensemble, cascade pipeline) | **hcom** `docs/` 6 documented patterns | conductor/ → expand beyond read-only Qwen flows | Large | High | | Cross-device relay (MQTT with E2E encryption) | **hcom** `src/relay/` | net-new network layer | Large | Low | ### Domain 5: PTY / Terminal | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | Exit notifications (`` with exit code, last line) | **opencode-pty** (this fork) | apps/booterm → notify AI on process completion | Small | High | | Pattern-based log search with offset/limit pagination | **opencode-pty** `pty_read` with regex pattern | apps/booterm → grep within PTY buffer | Small | High | | Per-session timeouts | **opencode-pty** `timeoutSeconds` parameter | apps/booterm → runaway process protection | Small | Med | | Rich session metadata (title, description, parent agent) | **opencode-pty** PTYSession metadata | apps/booterm → AI context about background tasks | Small | Med | | In-process native PTY (Rust bun-pty vs node-pty+tmux) | **oh-my-pi** `crates/pi-shell/` (embedded bash) | apps/booterm → alternative PTY backend | Large | Med | ### Domain 6: Code Editing & Execution | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | Hashline editing (content hash anchors, hash mismatch = reject) | **oh-my-openagent** `packages/hashline-core/` | apps/coder edit_file → line anchors with content hashes | Small | High | | AST-based structural editing (ast_edit with preview) | **oh-my-pi** `packages/coding-agent/` tools | apps/coder → structural rewrite tool | Med | High | | ast-grep pattern matching across 50+ language grammars | **oh-my-pi** `crates/pi-ast/` | apps/coder → ast_grep_search/replace tools | Med | High | | Built-in eval kernels (persistent Python + JS cells) | **oh-my-pi** `packages/coding-agent/` eval tool | apps/coder → code execution sandbox | Large | Med | | Fuzzy edit matching (exact → whitespace → unicode → Levenshtein ladder) | Already in BooCode (`apps/coder/src/fuzzy-match.ts`) | — (already shipped) | — | — | ### Domain 7: AI Proficiency & Metrics | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | MCP server with 13 proficiency scanning tools | **measuring-ai-proficiency** `measure-ai-proficiency-mcp` CLI | apps/server MCP client → register as MCP server | Small | Med | | Maturity level (1-8) scoring + recommendations | **measuring-ai-proficiency** `scanner.py` | apps/server → agent "skill level" awareness | Small | Med | | 2026 context-engineering signals (verification, hooks, primitive discipline, eval loops) | **measuring-ai-proficiency** `signals.py` | apps/server → track AI readiness | Small | Med | | Validation warnings (STALE, TEMPLATE, BLOAT, MISSING REF) | **measuring-ai-proficiency** `scanner.py` validation | apps/server → alert on broken context files | Small | Low | | Cross-session context store (decisions, tasks, blockers persist between sessions) | **Codex-CLI-Compact** `context-store.json` pattern | apps/server → project memory | Med | High | | Token tracking dashboard (per-model, per-project costs) | **Codex-CLI-Compact** `dashboard/server.py` | apps/web → token usage UI | Med | Med | ### Domain 8: Context Engineering & Skills | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | Two-loop continuous improvement (inner: detect→verify→recover, outer: inspect→encode→regress-test) | **pskoett-skills** — 19 skills | data/skills/ → architecture pattern | Med | High | | Self-healing with mandatory verify-before-persist | **pskoett-skills** `skills/self-healing/` | data/skills/ → add healing skill | Small | High | | Verify-gate (compile → test → lint, fix loop on failure) | **pskoett-skills** `skills/verify-gate/` | apps/server/conductor → add verify step | Small | High | | Pre-flight check (session-start learning visibility) | **pskoett-skills** `skills/pre-flight-check/` | apps/server → session initiation context | Small | Med | | Context system with project-specific patterns (markdown files agents load proactively) | **OpenAgentsControl** `.opencode/context/` | data/skills/ or new context/ dir | Small | High | | ContextScout (discover relevant context files) + ExternalScout (live docs via Context7) | **OpenAgentsControl** `.opencode/agent/subagents/core/` | apps/server → dual discovery | Med | High | | Plugin hook system (chat params, tool execution, auth, provider, shell env) | **opencode** `packages/plugin/` | apps/server → extensible hook architecture | Large | Med | | Skills with embedded MCPs (per-session lifecycle, spun up on demand) | **oh-my-openagent** `src/features/skill-mcp-manager/` | data/skills/ → MCP-per-skill | Med | High | | Skill pipeline (task classifier: Trivial/Small/Medium/Large/Long-running/Batch) | **pskoett-skills** `skills/skill-pipeline/` | conductor → depth-calibrated routing | Med | Med | ### Domain 9: Memory & Session Continuity | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | System Context / Context Epoch model (typed context sources, immutable baselines, snapshots) | **opencode** `packages/core/src/system-context/` | apps/server inference → context lifecycle | Large | High | | Persistent cross-session memory (Supermemory: project habits, conventions) | **opencode-supermemory** (this fork) | apps/server → long-term agent memory | Med | Med | | Hindsight memory (agent-curated between sessions) | **oh-my-pi** `packages/agent/` recall/retain tools | apps/server → memory persistence | Med | Med | | Boulder state (work tracking across sessions with automatic resumption) | **oh-my-openagent** `packages/boulder-state/` | conductor → plan execution persistence | Small | Med | | Context compression (range/message dedup, purge errors, turn protection) | **opencode-dynamic-context-pruning** (this fork) | apps/server inference → compaction | Med | High | | Morph Fast Apply (10,500+ tok/s with lazy markers) | **opencode-morph-plugin**, **opencode-morph-fast-apply** | apps/coder edit_file → fast apply backend | Med | Med | ### Domain 10: Development Workflow | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | Spec-first development (spec.md → tasks → implementation) | **openspec** (this fork `openspec/`) | Already partially in BooCode (`openspec/` directory) | — | — | | Context-driven dev lifecycle (Context → Spec → Plan → Implement → Revert tracks) | **opencode-conductor** (this fork) | conductor → structured dev tracks | Med | Med | | Undo Shield (PreToolUse hook blocking destructive ops on high-attention files) | **Codex-CLI-Compact** `bin/undo_shield.py` | apps/coder → edit safety guard | Small | Med | | Vibe Code Auditor (7 health checks: dead exports, coverage, circular deps, etc.) | **Codex-CLI-Compact** `audit.py` | apps/server → technical debt awareness | Med | Med | --- ## RANKED INTEGRATION RECOMMENDATIONS Ordered by **value/cost ratio** for BooCode. ### Tier 1: High Value, Low Effort (Do First) | # | What | Source | BooCode Target | Why | |---|------|--------|----------------|-----| | 1 | **Replace Go codecontext with boocontext** | `boocontext/` | codecontext/ sidecar | Direct drop-in. 7 tools instead of 5. Session caching. Call graph, health grades, impact analysis. Written in TS (BooCode's stack). Fixes 0% TypeScript recovery. | | 2 | **PTY exit notifications** | `opencode-pty/` | apps/booterm | `` structured messages on process completion. Low-effort, enables AI to react to long-running tasks. | | 3 | **Self-healing skill** | `pskoett-skills/` | data/skills/ | Verify-before-persist discipline. HEAL entries to `.learnings/`. Pattern-Key dedup. Brings the two-loop inner loop to BooCode. | | 4 | **Verify-gate skill** | `pskoett-skills/` | conductor/ | Compile → test → lint gate with auto-discovery. Fix loop on failure. Universal value for a dev chat app. | | 5 | **Subagent tool restriction schema** | `agentic/` | data/AGENTS.md + conductor/agents | YAML frontmatter defining tool permissions per agent. Currently all BooCode agents have same tool set. | | 6 | **Hashline editing** | `oh-my-openagent/` | apps/coder | Content hash anchors for edit targets. Rejects stale patches. Pure TS, no harness deps. Proven 10× success rate improvement. | | 7 | **Model resolution core** | `oh-my-openagent/` `packages/model-core/` | apps/coder | Provider priority chains, fallback chains, model normalization. Pure TS, no deps. | | 8 | **Fuzzy edit matching** | Already in BooCode | apps/coder | Already shipped in v2.7.1. Listed for completeness. | ### Tier 2: High Value, Medium Effort (Next) | # | What | Source | BooCode Target | Why | |---|------|--------|----------------|-----| | 9 | **Context system (project patterns)** | `OpenAgentsControl/` | data/ or new context/ | Learn project patterns proactively instead of relying on agent discovery. MVI principle (<200 line files, 80% token reduction). | | 10 | **ContextScout + ExternalScout** | `OpenAgentsControl/` | apps/server | Discover relevant context files + fetch live library docs via Context7. | | 11 | **Task state machine + FORK_JOIN** | `conductor/` | conductor/ | SCHEDULED → IN_PROGRESS → COMPLETED/FAILED state model. Parallel step execution with Join sync. | | 12 | **Session metadata for PTY panes** | `opencode-pty/` | apps/booterm | Track title, description, parent agent per terminal pane. Enables AI context awareness. | | 13 | **Context compression (DCP)** | `opencode-dynamic-context-pruning/` | apps/server inference | Range/message dedup, purge errors. More surgical than current compaction. | | 14 | **Boulder state (work tracking)** | `oh-my-openagent/` `packages/boulder-state/` | conductor/ | Cross-session plan execution with automatic resumption. Framework-agnostic. | | 15 | **AST-based editing (ast_grep + ast_edit)** | `oh-my-pi/` `crates/pi-ast/` | apps/coder | Structural code editing with AST patterns. 50+ language grammars. | | 16 | **Event subscription system** | `hcom/` `src/commands/` | apps/server | Reactive event triggers ("when file X changes, re-run flow Y"). | ### Tier 3: High Value, Large Effort (Architecture Projects) | # | What | Source | BooCode Target | Why | |---|------|--------|----------------|-----| | 17 | **Declarative workflow DAGs** | `conductor/` | conductor/ | Replace procedural flow definitions with JSON DAGs. LLM-friendly. Versioned. | | 18 | **Inter-agent messaging** | `hcom/` | apps/server + apps/coder | DB-backed message queue for Orchestrator → BooCoder messaging. | | 19 | **System Context model** | `opencode/` | apps/server | Typed context sources, immutable epoch baselines, reconciliation. Foundation for long-session quality. | | 20 | **Multi-provider routing abstraction** | `opencode/` `packages/llm/` | apps/server | 4-axis route composition. Decouples provider selection from inference loop. | | 21 | **Plugin hook system** | `opencode/` `packages/plugin/` | apps/server | Extensible lifecycle hooks (chat params, tool execution, auth, provider). | | 22 | **Multi-agent topologies** | `hcom/` | conductor/ | Expand beyond read-only Qwen flows to general multi-agent patterns. | | 23 | **Skills with embedded MCPs** | `oh-my-openagent/` | data/skills/ | Per-skill MCP servers, spun up on demand, scoped per session. | --- ## BOOCODE'S CURRENT STATE — What's Already Strong Before lifting, acknowledge what BooCode already does well that the forks don't: | BooCode Strength | Not matched by | |-----------------|----------------| | Postgres-backed session storage (queryable, indexed) | hcom (SQLite), opencode (JSONL) | | Multi-pane workspace (chat/coder/terminal/orchestrator) | All forks — single-pane or terminal-only | | Provider snapshot system (probe status, UI toggle, cold refresh) | opencode (no status UI), oh-my-pi (no toggle) | | Pending-changes queue + diff panel (approval gating) | None of the forks have this UX | | Arena (same task → N models → analysis) | Unique to BooCode | | Fuzzy edit matching (Levenshtein ladder) | opencode (exact only), oh-my-openagent (hashline only) | | Persistent agent sessions (warm ACP resumable) | hcom (per-session only), opencode (cold per turn) | | Codecontext sidecar (Go, containerized) | boocontext (TS, but no container) | --- ## DEPENDENCY GRAPH — What Depends On What ``` Replace codecontext with boocontext (Tier 1) ├── Enables: Call graph → Impact analysis → Health grades ├── Enables: Wiki generation → Cross-session codebase knowledge └── Needs: tree-sitter-analyzer as child MCP server PTY exit notifications (Tier 1) └── Enables: AI reaction to long-running task completion Self-healing + Verify-gate (Tier 1) ├── Prerequisite: .learnings/ directory convention └── Enables: Full two-loop CI (with learning-aggregator → eval-creator) Context system + ContextScout (Tier 2) ├── Prerequisite: MVI context file format └── Enables: ExternalScout → live doc fetching Conductor flow enhancements (Tier 2) ├── Task state machine → Prerequisite for: DO_WHILE, FORK_JOIN, SWITCH └── Enables: Declarative DAGs (Tier 3) System Context model (Tier 3) └── Prerequisite for: Plugin hook system → MCP-per-skill ``` --- ## IMMEDIATE NEXT ACTIONS (If we start today) ### Week 1: Quick wins 1. **Swap codecontext** — Replace Go sidecar HTTP client with boocontext MCP client. Adds 2 new tools (health, callgraph) with zero architectural change. 2. **Add PTY exit notifications** — Extend booterm's WS protocol to send structured exit payloads. 3. **Add self-healing + verify-gate skills** — Copy skill directories from pskoett-skills, adapt prompts to BooCode's agent format. ### Week 2: Context system 4. **Add ContextScout** — New agent that discovers relevant context files (from new `context/` directory). 5. **Add model-core** — Extract provider priority/fallback logic from oh-my-openagent's model-core package. ### Week 2-3: Conductor upgrades 6. **Task state machine** — Add SCHEDULED/IN_PROGRESS/FAILED/COMPLETED states to flow steps. 7. **FORK_JOIN support** — Allow parallel branch execution in conductor flows. ### Week 3-4: Memory & context 8. **Boulder state** — Add cross-session work tracking/auto-resumption. 9. **Context compression** — Integrate DCP patterns into inference loop compaction. --- ## COMPLETE REPO REFERENCE | Repo | Path | Key Capability | Lift Priority | |------|------|---------------|---------------| | boocontext | `/opt/forks/boocontext/` | Code intelligence MCP (7 tools, health, callgraph, impact) | **Tier 1** | | opencode-pty | `/opt/forks/opencode-pty/` | PTY exit notifications, log search, session metadata | **Tier 1** | | pskoett-skills | `/opt/forks/pskoett-skills/` | Self-healing, verify-gate, two-loop skills | **Tier 1** | | agentic | `/opt/forks/agentic/` | Subagent tool permissions, structured workflow lifecycle | **Tier 1** | | oh-my-openagent | `/opt/forks/oh-my-openagent/` | Hashline editing, model-core, boulder state, skills+MCP | **Tier 1-2** | | oh-my-pi | `/opt/forks/oh-my-pi/` | 40+ providers, AST editing, eval kernels, hindsight memory | **Tier 2** | | OpenAgentsControl | `/opt/forks/OpenAgentsControl/` | Context system, ContextScout, ExternalScout, task manager | **Tier 2** | | conductor | `/opt/forks/conductor/` | Workflow DAGs, task state machine, FORK_JOIN, DO_WHILE | **Tier 2** | | opencode | `/opt/forks/opencode/` | System Context model, plugin hooks, LLM routing, MCP | **Tier 3** | | hcom | `/opt/forks/hcom/` | Inter-agent messaging, event system, multi-agent topologies | **Tier 3** | | opencode-dynamic-context-pruning | `/opt/forks/opencode-dynamic-context-pruning/` | Context compression | Tier 2 | | opencode-supermemory | `/opt/forks/opencode-supermemory/` | Persistent memory | Tier 2 | | Codex-CLI-Compact | `/opt/forks/Codex-CLI-Compact/` | Context store, undo shield, token dashboard, vibe audit | Tier 2 | | measuring-ai-proficiency | `/opt/forks/measuring-ai-proficiency/` | AI proficiency MCP, maturity scoring | Tier 2 | | opencode-morph-plugin | `/opt/forks/opencode-morph-plugin/` | Fast code editing, WarpGrep | Tier 2 | | opencode-conductor | `/opt/forks/opencode-conductor/` | Context-driven dev lifecycle | Tier 3 | | paseo | `/opt/forks/paseo/` | Multi-agent orchestration hub | Tier 3 | | opencode-tokenscope | `/opt/forks/opencode-tokenscope/` | Token usage analysis | Low | | opencode-skillful | `/opt/forks/opencode-skillful/` | Skill system (SKILL.md, lazy load, model-aware formatting) | **Tier 1** | | llama.cpp | `/opt/forks/llama.cpp/` | LLM inference engine (BooCode's inference backend) | **Tier 1** | | claudish | `/opt/forks/claudish/` | Claude Code multi-provider proxy (580+ models) | Tier 2 | | cline | `/opt/forks/cline/` | Full agent platform (SDK, hub, connectors, cron) | Tier 2 | | goose | `/opt/forks/goose/` | Block's Rust agent (MCP, 15+ providers, desktop+CLI+API) | Tier 2 | | han | `/opt/forks/han/` | 18 skills + 23 agents (evidence-based planning, review, TDD) | Tier 2 | | openchamber | `/opt/forks/openchamber/` | OpenCode UI runtime (Electron, web, branching timeline) | Tier 2 | | qwen-code | `/opt/forks/qwen-code/` | Full coding agent (daemon mode, skills, hooks, subagents, cron) | Tier 2 | | subtask2 | `/opt/forks/subtask2/` | Enhanced subtask control (return, loop, parallel, $RESULT) | Tier 2 | | opencode-background-agents | `/opt/forks/opencode-background-agents/` | Async background delegation with persistence | Tier 2 | | pi-acp | `/opt/forks/pi-acp/` | ACP adapter for pi (structured diffs, terminal auth) | Tier 2 | | opencode-worktree | `/opt/forks/opencode-worktree/` | Git worktree + 15-terminal spawning + lifecycle hooks | Tier 2 | | bun | `/opt/forks/bun/` | JS/TS runtime, bundler, test runner, bun:sqlite, Bun.serve | Tier 3 | | happy | `/opt/forks/happy/` | Mobile remote control (E2EE, QR auth, voice) | Tier 3 | | superset | `/opt/forks/superset/` | "Code Editor for AI Agents" - Electron desktop app | Tier 3 | | unsloth | `/opt/forks/unsloth/` | Efficient LLM fine-tuning (2-5x faster, 70% less VRAM) | Tier 3 | | SkillOpt | `/opt/forks/SkillOpt/` | Skill document optimization training loop | Tier 3 | | opencode-sentry-monitor | `/opt/forks/opencode-sentry-monitor/` | Sentry observability (token usage, spans, metrics) | Tier 3 | | opencode-wakatime | `/opt/forks/opencode-wakatime/` | WakaTime coding activity tracking | Tier 3 | | opencode-zellij-namer | `/opt/forks/opencode-zellij-namer/` | AI-powered terminal session naming | Tier 3 | --- ## DEEP DIVE FINDINGS — 5 Audit Agents (2026-06-07) This section captures the results of deep-dive audits across 5 focus areas: llama.cpp server features, boocontext architecture, conductor/agents/workflows, hooks/skills/prompt library, and inference configuration. --- ### 1. llama.cpp Server: 14 Feature Categories Not Used BooCode uses llama-server via llama-swap (default) or llama-sidecar (per-agent flags). The sidecar base args are: `-ngl 999 -c 32768 --flash-attn on --no-mmap`. Here's what's available but not enabled: **High Impact (config only, no code changes):** | Feature | Flag | Impact | Activation | |---------|------|--------|------------| | KV cache quantization | `--cache-type-k q4_0` | ~4× VRAM savings for KV cache | Sidecar `baseArgs` or unshadow in validator | | Ngram speculative decoding | `--spec-type ngram-mod` | 2-3× tokens/sec, ~16MB memory, no draft model | Sidecar `baseArgs` or unshadow in validator | | Context checkpointing | `--ctx-checkpoints 32` | Prevents overflow on long conversations | Via `llama_extra_args` in AGENTS.md | | Context shift | `--context-shift` | Infinite text generation | Via `llama_extra_args` | | Slot save/restore | `POST /slots/{id}?action=save\|restore` | Persist KV cache across restarts | New API call in compaction.ts | | Prometheus metrics | `--metrics` | `/metrics` for token rates, latency, decode stats | Add to sidecar base args | | Sleep mode | `--sleep-idle-seconds 600` | Auto-shutdown when idle, saves GPU memory | Add to sidecar base args | **Key Finding — Shadowing Architecture** (both `llama-args-validator.ts` and sidecar `validator.go`): - `denyFlags`: model, listen, credentials, webui (hard blocked) - `shadowFlags`: context size, cache types, spec flags, template flags (auto-stripped from agent args) - `acceptFlags`: everything else passes through To enable cache/spec features: remove from `shadowFlags` in BOTH files, or override via `BASE_ARGS` env var on the sidecar. **Medium Impact (via `llama_extra_args`):** - LoRA adapters (`--lora `) - Custom chat templates (`--chat-template-file`) - Reasoning budget (`--reasoning-budget`) - Multi-GPU tensor split (`--tensor-split`) - NUMA awareness (`--numa`) **Full API surface available at the inference endpoint:** `/v1/chat/completions` (main), `/v1/completions`, `/v1/embeddings`, `/v1/rerank`, `/v1/messages` (Anthropic-compatible), `/infill`, `/tokenize`, `/detokenize`, `/v1/audio/transcriptions` --- ### 2. Boocontext Architecture: 20 Tools in 2 Layers **Integration target** (`codecontext_client.ts` does not yet exist — must be created). **Option A (Recommended): MCP subprocess — zero code change:** ```json { "mcpServers": { "boocontext": { "command": "npx", "args": ["boocontext-mcp"] } } } ``` **Architecture:** - **13 codesight tools**: scan, get_summary, get_routes, get_schema, get_blast_radius, get_env, get_hot_files, refresh, get_wiki_index, get_wiki_article, lint_wiki, get_events, get_coverage, get_knowledge - **7 boocontext tools**: overview, map, health (A-F grades), symbols (BM25 search), callgraph (callers/callees), impact (trace + blast radius merged), types (TS type recovery) - **VerdictEnvelope**: SAFE/CAUTION/UNSAFE/INFO wrapper → `{ verdict, summary, details, metadata }` - **Child MCP servers**: tree-sitter-analyzer (via `uvx`) + type-inject (via `npx`) - **Session cache**: in-memory, per-directory, `clearCache()` on project switch **Fixes needed before production integration:** 1. Hardcoded type-inject path (`/opt/forks/type-inject/...`) → switch to `npx @nick-vi/type-inject-mcp` 2. Missing `uvx` requirement for tree-sitter-analyzer → document or bundle 3. No request concurrency (serial `processing` flag) → enable parallel for independent tools 4. No graceful degradation on child server failure → retry + fallback to codesight-only 5. No tool result caching per-call → add memoization for expensive operations (health, callgraph) --- ### 3. Conductor/Workflows/Agents: Static Wave Scheduler **BooCode has TWO layers:** - `conductor/` — standalone CLI, deterministic wave scheduler, 22 flows, 23 agents - `apps/coder/` — in-app orchestrator, DB-persisted flow runs, dispatcher with 4 execution paths - `data/AGENTS.md` — 9 personas (Code Reviewer, Debugger, Refactorer, etc.) - `conductor/agents/` — 23 Han personas with frontmatter + tool permissions **Execution model** (`flow.ts`): ``` while (done.size + skipped.size < total): ready = steps whose deps all satisfied await Promise.all(ready.map(s => s.run())) ``` **Gaps to Claude Code's Dynamic Workflows/Sub-agents/Teams:** | Capability | Current | Target | Structural Change Needed | |------------|---------|--------|------------------------| | Step graph | Static `Step[]` array | Mutable `FlowGraph` with add/remove/loop | `flow.ts` — Step[] → FlowGraph with WhileStep/UntilStep | | Result streaming | `Promise` | `AsyncIterable` with partial results | Step.run() signature change | | Agent spawning | Conductor calls dispatchAgent | Steps call `ctx.spawn(agent, prompt)` | New spawn protocol | | Shared state | `Record` | Structured SharedState with message-passing channels | ctx.results → SharedState | | Inter-agent comms | None | Mailbox pattern (send/receive by agent ID) | New message transport | | Human-in-loop | None | Pause-for-input mid-flow | Flow runner → user prompt gate | | Workflow composition | None | `flow.invoke(subflow)` | New compose mechanism | **Dispatcher** (`dispatcher.ts`, 1726 lines): 4 execution paths (Native, PTY, ACP, OpenCode Server). Polls `tasks` table, LISTEN `tasks_new`. Per-session in-flight tracking prevents concurrent turns. **Worktree isolation**: Per-task (`/tmp/booworktrees/`) and session-persistent (`/tmp/booworktrees/sess-`). Diff baseline from `base_commit`. **Agent pool** (`agent-pool.ts`): Idle-TTL (30min default) + LRU cap (10 default). Busy backends never evicted. Periodic sweep. --- ### 4. Hooks System: 5 Events Defined, 0 Wired **Location**: `apps/coder/src/plugins/host.ts` **State**: Shipped dead code. The hook infrastructure exists (handler registry, stdin/stdout protocol, exit codes for allow/deny) but NO `emitHook()` calls exist in `turn.ts`, `tool-phase.ts`, or `stream-phase.ts`. **The 5 dead events**: `tool.execute.before`, `tool.execute.after`, `turn.start`, `turn.end`, `task.terminal` **What BooCode DOES have (that's active):** - `broker.ts` — in-memory pub/sub for WS frames (session + user channels) - `lifecycle.ts` — chat/session close/archive/delete handlers - `flow-runner.ts` — `handleTaskTerminal` callback (the one wired hook) **Claude Code's hook architecture (target — 32+ events):** | Category | Events | |----------|--------| | Session | SessionStart, SessionEnd, Setup | | Turn | UserPromptSubmit, Stop, StopFailure, PreCompact, PostCompact | | Tool | PreToolUse, PostToolUse, PostToolUseFailure, PostToolBatch | | Permission | PermissionRequest, PermissionDenied | | Agent | SubagentStart, SubagentStop, TeammateIdle | | File | FileChanged, CwdChanged, WorktreeCreate, WorktreeRemove | | Config | ConfigChange, InstructionsLoaded | | MCP | Elicitation, ElicitationResult | | Notify | Notification, MessageDisplay, TaskCreated, TaskCompleted | **BooCode inference lifecycle points** (from `turn.ts` `runAssistantTurn`): 1. loadContext — session/project loaded 2. Doom-loop check 3. Budget check 4. Compaction check 5. Message payload build 6. executeStreamPhase — LLM streaming 7. executeToolPhase — tool execution 8. MistakeTracker integration 9. Step cap summary on exit These are natural hook insertion points. --- ### 5. Prompt Library: None **Current state**: No central prompt library. Skills contain prompts (41 files in `data/skills/`) but not organized as a user-facing library. `openspec/` has per-batch docs. `data/AGENTS.md` has system prompts. **Target**: 20-30 prompts organized by SDLC phase (discover, design, build, ship, operate), filterable by role, with fillable slots and "Why this works" explanations. Markdown files with YAML frontmatter in `data/prompts/`. --- ### 6. Inference Configuration: Two Paths, Shadowing Architecture **Default path**: BooCode → `LLAMA_SWAP_URL` → llama-swap → llama-server **Per-agent path**: BooCode → `LLAMA_SIDECAR_URL` → llama-sidecar (proxy) → per-model llama-server process **Sidecar** spawns per-agent llama-server processes via LRU pool (max 2, ports 8500-8599). Configuration env vars: ``` LLAMA_SERVER_BIN, MODEL_DIR_MAP_FILE, LLAMA_SIDECAR_BIND (127.0.0.1:8402), MAX_SIDECARS (2), PORT_RANGE (8500-8599), BASE_ARGS (["-ngl","999","-c","32768","--flash-attn","on","--no-mmap"]), HEALTH_TIMEOUT_SECONDS (60), HEALTH_INTERVAL_SECONDS (30) ``` **AI SDK integration**: `@ai-sdk/openai-compatible` wrapping `createOpenAICompatible({ baseURL: LLAMA_SWAP_URL/v1 })`. Sampler options passed via `providerOptions.openaiCompatible` extraBody (top_k, min_p, top_n_sigma, dry_* family). **Model context discovery**: `GET /upstream//props` → `n_ctx` from `default_generation_settings`. Cached forever on success, 60s on failure. **Task model**: Non-streaming `POST ${TASK_MODEL_URL}/v1/chat/completions` with `FAST_MODEL` model name. Currently hardcoded to `gemma-3-270m-it`. **Key env vars**: `LLAMA_SWAP_URL`, `LLAMA_SIDECAR_URL`, `TASK_MODEL_URL`, `FAST_MODEL`, `DEFAULT_MODEL` --- --- ## PASS 3 — EXTENSION: Repos Missed in Initial Analysis (2026-06-07, evening) After the original lift analysis was written, a second pass identified additional repos in `/forks` that were not covered. This section documents the findings from analyzing those repos for patterns liftable into BooCode. --- ### Domain 11: Claude Code Plugin Architecture (Official) **Source**: `claude-code/plugins/` — 14 official Anthropic plugins | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | **Plugin packaging structure** (`.claude-plugin/plugin.json` + commands/agents/skills/hooks/.mcp.json — standard layout) | `claude-code/plugins/` — `plugin-dev/` | `data/plugins/` or enhance `data/skills/` | Small | High | | **Parallel PR review agents** (5 agents: bug-finder, comment-analyzer, test-analyzer, type-designer, code-simplifier — parallel execution) | `claude-code/plugins/pr-review-toolkit/` | `conductor/` — PR review workflow | Med | High | | **Feature dev workflow agents** (3 agents: code-explorer, code-architect, code-reviewer — 7-phase structured process) | `claude-code/plugins/feature-dev/` | `conductor/` — feature development flows | Med | High | | **Self-referential agent loop** (Ralph Loop: agent runs same task repeatedly until completion, Stop hook intercepts exit) | `claude-code/plugins/ralph-wiggum/` | `apps/coder` → `/ralph-loop` command | Small | High | | **Security guidance hook** (PreToolUse scanning 9 security patterns: command injection, XSS, eval, pickle deserialization, os.system, etc.) | `claude-code/plugins/security-guidance/` | `apps/coder` → PreToolUse security scan | Small | High | | **Hookify rule system** (analyze conversations → auto-create hook rules to prevent unwanted behaviors) | `claude-code/plugins/hookify/` | `apps/coder` → behavior prevention rules | Med | High | | **Agent SDK verifier plugins** (Python + TS SDK validation agents) | `claude-code/plugins/agent-sdk-dev/` | `apps/coder` → SDK compliance checking | Med | Med | | **Frontend design skill** (production-grade UI design guidance, auto-invoked) | `claude-code/plugins/frontend-design/` | `data/skills/` → frontend design skill | Small | Med | | **PR toolkit type design analyzer** (specialized agent for API design review) | `claude-code/plugins/pr-review-toolkit/agents/` | `conductor/agents/` → type review agent | Small | Med | | **Agent tool permission schemas** (YAML frontmatter in agent `.md` files with `tools:` restrict list) | `claude-code/plugins/feature-dev/agents/*.md` frontmatter | `data/AGENTS.md` → tool restriction per agent | Small | High | **Key insight**: Claude Code plugin architecture is the most mature reference for how BooCode's skill/plugin system should work. The `plugin.json` → commands/agents/skills/hooks/ `.mcp.json` layout is the de facto standard. The `code-architect.md` agent frontmatter (name, description, tools, model, color) shows exactly how agent metadata should be structured. --- ### Domain 12: Behavioral Compliance Engine (boocontext-audit) **Source**: `boocontext-audit/` — TypeScript audit + behavioral rules engine (Way more than just "audit extraction") **What it actually is**: A full **Parlant-inspired behavioral compliance engine** ported to TypeScript, wrapping: - **Guideline system**: `condition`/`action` natural language rules with criticality (low/medium/high/critical) - **Multi-batch matcher**: observational, actionable, previously-applied, disambiguation, response analysis, low-criticality batches - **Relational resolver**: DEPENDS_ON, PRIORITIZES, ENTAILS, TAG_ALL, TAG_PRIORITIZES relationship types with iterative convergence loop - **Schematic generator**: abstract LLM batch caller for structured output per match type - **Full audit trail**: PostToolUse/Stop/UserPromptSubmit middleware, JSONL buffer, session lifecycle, graded context recovery (L0-L4) | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | **Guideline condition/action model** (natural language rules with criticality, priority, labels, tags) | `boocontext-audit/src/guideline.ts` | `apps/coder` → behavioral rules engine | Small | Critical | | **Multi-batch matcher** (6 batch types: Observational, Actionable, PreviouslyApplied, Disambiguation, ResponseAnalysis, LowCriticality — each with LLM structured output) | `boocontext-audit/src/matching.ts` (371 lines) | `apps/coder` → context-relevant rule matching | Med | High | | **Relational resolver** (Dependency/Priority/Entailment resolution with iterative convergence, max 100 iterations) | `boocontext-audit/src/resolver.ts` (299 lines) | `apps/coder` → rule conflict resolution | Med | High | | **Relationship store** (5 relationship kinds: DEPENDS_ON, PRIORITIZES, ENTAILS, TAG_ALL, TAG_PRIORITIZES) | `boocontext-audit/src/relationship.ts` (190 lines) | `apps/coder` → rule relationships | Small | High | | **Schematic generator** (abstract LLM batch caller with temperature retry, structured output per batch type) | `boocontext-audit/src/generation.ts` (183 lines) | `apps/coder` → structured LLM calls | Med | High | | **Full audit middleware** (PostToolUse, Stop, UserPromptSubmit hooks with JSONL buffer, session handoff, graded recovery) | `boocontext-audit/src/middleware.ts`, `buffer.ts`, `session.ts` | `apps/coder` → audit trail system | Med | High | | **User correction tracking** (detect corrections in conversations, persist as priority records, load first on recovery) | `boocontext-audit/src/correction.ts` | `apps/coder` → learn from user corrections | Small | High | | **Anomaly detection** (configurable alert rules with lambdas, CRITICAL/WARNING levels) | `boocontext-audit/src/anomaly.ts` | `apps/coder` → runtime monitoring | Med | Med | | **Ambient context via AsyncLocalStorage** | `boocontext-audit/src/ambient-context.ts` | `apps/server` → parameter pollution reduction | Small | High | | **Graded context recovery** (L0 index → L1 session → L2 corrections → L3 full → L4 cross-day) | `boocontext-audit/src/recovery.ts` | `apps/server` → context restoration | Med | High | **Key insight**: `boocontext-audit` is the single most undervalued repo in `/forks`. It's a complete behavioral compliance system already ported to TypeScript with zero external dependencies (only `@modelcontextprotocol/sdk`). The Guideline + MultiBatch + RelationalResolver stack is directly usable by BooCode's agent system to enforce agent behavior rules with structured LLM evaluation. The audit middleware is production-ready and can be wired into BooCode's inference lifecycle in days. --- ### Domain 13: TypeScript Type Intelligence (type-inject) **Source**: `type-inject/` — TypeScript type context for AI coding assistants | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | **Type extraction pipeline** (ts-morph-based: parse tsconfig, load files, extract types/signatures/JSDoc/import depth) | `type-inject/packages/core/lib/extractor.ts` (1070 lines) | `apps/coder` → type-aware editing | Med | High | | **Type lookup MCP tools** (`lookup_type` + `list_types` — query types by name regex, source, kind) | `type-inject/packages/mcp/src/` | `apps/server` → MCP type server | Small | High | | **Auto-type injection** (PostToolUse hook on Read injects type signatures into file reads) | `type-inject/packages/claude-hook/` | `apps/coder` → type context on file reads | Small | High | | **Type checking on write** (PostToolUse hook on Write runs type checker, reports errors) | `type-inject/packages/claude-hook/` | `apps/coder` → type error feedback | Small | High | | **Type prioritizer** (rank types by relevance: used types first, direct imports over transitive, exported over private) | `type-inject/packages/core/lib/prioritizer.ts` | `apps/coder` → relevant type ordering | Small | Med | | **Token-budgeted type injection** (configurable maxTokens, skipBarrelFiles, onlyUsed filtering) | `type-inject/packages/core/lib/config.ts` | `apps/coder` → context budget management | Small | Med | | **Svelte support** (extract types from `.svelte` files via optional svelte compiler) | `type-inject/packages/core/lib/svelte-utils.ts` | `apps/coder` → Svelte type awareness | Small | Low | | **OpenCode plugin** (full plugin with auto-injection on reads and MCP tools) | `type-inject/packages/opencode/` | `apps/coder` → direct integration point | Small | High | **Key insight**: type-inject directly solves the "TypeScript type information is missing from context" problem that the lift analysis identified as codecontext's biggest gap (0% TS recovery). Instead of building it, BooCode can use type-inject as an MCP server or direct plugin. The `@nick-vi/type-inject-mcp` package is published and installable via `npx`. This is a **direct port** — add to BooCode's MCP servers config. --- ### Domain 14: Claude Agent SDK (Official Anthropic) **Source**: `claude-agent-sdk-typescript/` — Anthropic's official Agent SDK | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | **Agent lifecycle as SDK** (construct → generate → stream → saveSession — standard agent loop) | `claude-agent-sdk-typescript/` | `apps/server` → standardized agent API | Large | Med | | **Session store abstraction** (pluggable session persistence backends) | `claude-agent-sdk-typescript/examples/session-stores/` | `apps/server` → session store interface | Small | High | | **Streaming agent results** (structured stream events for tool calls, text deltas, results) | `claude-agent-sdk-typescript/` | `apps/coder` → streaming agent pattern | Med | Med | | **Tool use with structured output** (JSON schema enforcement for tool results) | `claude-agent-sdk-typescript/` | `apps/coder` → structured tool results | Small | High | **Key insight**: The Claude Agent SDK is less valuable for direct code lift (it's a high-level API wrapper) than for its **design patterns** — the session store abstraction and streaming event protocol are clean references for BooCode's existing agent loop. --- ### Domain 15: LLM Inference Sidecar Architecture (llama-sidecar) **Source**: `llama-sidecar/` — BooCode's own per-agent llama-server process pool (Go) | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | **Process pool with LRU eviction** (max 2 sidecars, port range 8500-8599, LRU eviction of idle) | `llama-sidecar/internal/pool/` (pool.go, sidecar.go) | (already BooCode's) | — | — | | **Flag validator** (deny groups: model identity, network, auth/TLS, server UI — blocks security-critical flags) | `llama-sidecar/internal/validator/validator.go` (156 lines) | `apps/coder` → llama-args-validator.ts (already ported) | — | — | | **Arg hash for sidecar dedup** (hash(modelID, flags) → reuse existing sidecar for same config) | `llama-sidecar/internal/pool/hash.go` | (already BooCode's) | — | — | | **Windows service support** (NSSM integration for Windows daemon) | `llama-sidecar/internal/winsvc/` | (already BooCode's) | — | — | | **Health check system** (background health checks every 30s, 60s timeout) | `llama-sidecar/internal/pool/` | (already BooCode's) | — | — | | **X-Agent-Flags header** (per-request flag overrides via HTTP header) | `llama-sidecar/README.md` → `X-Agent-Flags: --top-k 20` | `apps/server` → per-agent flag routing | Small | High | | **Slot management (coming soon?)** (save/restore KV cache slots — not implemented yet) | (potential) | `apps/server` → cross-turn KV persistence | Large | High | **Key insight**: llama-sidecar is already BooCode's own code. The main lift opportunity is the **`X-Agent-Flags` header pattern** — enabling per-agent llama-server parameter overrides (top-k, temperature, cache types) without spawning new sidecar processes. Currently, all agent flags are compiled into the BASE_ARGS. Adding header-based per-request override would enable agent-specific inference tuning. --- ### Domain 16: LangGraph Python Ecosystem (Supervisor + Swarm Patterns) **Source**: `langchain/langgraph-supervisor-py/` + `langchain/langgraph-swarm-py/` (Python — patterns only) | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | **Supervisor agent pattern** (central coordinator delegates to specialized agents via handoff tools) | `langgraph-supervisor-py/langgraph_supervisor/supervisor.py` (469 lines) | `conductor/` → supervisor orchestration | Med | High | | **Swarm agent pattern** (agents dynamically hand off control based on specialization, no central coordinator) | `langgraph-swarm-py/langgraph_swarm/swarm.py` (289 lines) | `conductor/` → swarm orchestration | Med | High | | **Handoff tool mechanism** (agents transfer control + context via `create_handoff_tool(agent_name, description)`) | `langgraph-supervisor-py/langgraph_supervisor/handoff.py` | `conductor/` → agent-to-agent handoff | Small | High | | **Agent name normalization + routing** (Literal-based active_agent enum for type-safe routing) | `langgraph-swarm-py/langgraph_swarm/swarm.py` | `conductor/` → typed agent routing | Small | Med | **Key insight**: The supervisor and swarm patterns from LangGraph are the two canonical multi-agent architectures. LangGraph supervisor = central coordinator pattern (like BooCode's conductor but more structured). LangGraph swarm = distributed handoff pattern (agents choose who to delegate to). Both are well-specified <500-line Python modules. The `create_handoff_tool()` mechanism is the critical pattern — a tool that transfers context between agents with a description the source agent can reason about. --- ### Domain 17: Sim Studio — Full AI Agent Workspace **Source**: `sim/` — SimStudio open-source AI agent workspace (Next.js + monorepo) | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | **Visual workflow builder** (drag-and-drop block-based agent design with canvas) | `sim/apps/sim/blocks/` | `apps/web` → visual agent builder | Large | High | | **Block execution engine** (executor orchestrating block DAGs with variable resolution) | `sim/apps/sim/executor/` | `conductor/` → visual flow execution | Large | High | | **1,000+ tool integrations** via standardized tool config pattern | `sim/apps/sim/tools/` + `tools/registry.ts` | `data/skills/` → integration framework | Large | High | | **Knowledge base** (document upload, vector RAG, query from agents) | `sim/apps/sim/` (knowledge base feature) | `apps/server` → RAG system | Large | High | | **Realtime collaborative canvas** (Socket.IO, room-based multi-user) | `sim/apps/realtime/` | `apps/web` → collaborative workspace | Large | Med | | **Workflow persistence layer** (load/save/subflow, raw block state) | `sim/packages/workflow-persistence/` | `conductor/` → flow persistence | Med | High | | **Audit action recording** (`recordAudit + AuditAction + AuditResourceType`) | `sim/packages/audit/` | `apps/server` → audit framework | Small | Med | | **Better Auth shared session** (cross-service auth via shared DB + secret) | `sim/packages/auth/` | `apps/server` → multi-service auth | Small | High | **Key insight**: Sim is a full production AI agent workspace — orders of magnitude more complex than anything else in `/forks`. Its value for BooCode is primarily as a **reference architecture** for the visual workflow builder and block execution engine. The `workflow-types/`, `workflow-persistence/`, and `workflow-authz/` packages are well-modularized and could provide patterns. The audit system and auth patterns are directly portable. --- ### Domain 18: Vercel Ecosystem (Missed Repos) **Source**: Various Vercel repos. See DEEP RESEARCH C for Vercel Workflow and DEEP RESEARCH E for Vercel Sandbox. | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | **Turborepo task scheduler** (dependency graph, parallel execution, local+remote caching, task profiles) | `vercel/turborepo/` | `conductor/` → task dependency scheduling | Med | High | | **Vercel AI SDK provider pattern** (model-provider abstraction with streaming, tool calling, structured output) | `vercel/ai/` | `apps/server` → provider abstraction (already partially done) | Large | High | | **SWR stale-while-revalidate** (data fetching cache: serve stale→revalidate→update, dedup, focus revalidation) | `vercel/swr/` | `apps/server` → data caching layer | Small | High | | **Next.js server actions** (RPC-style server functions called directly from client components) | `vercel/next.js/` | `apps/web` → server action pattern | Small | Med | | **Vercel CLI platform API** (deployment, environment variables, domain management) | `vercel/vercel/` | `apps/server` → deployment integration | Large | Low | | **Styled-JSX** (scoped CSS with zero runtime, compile-time transformation) | `vercel/styled-jsx/` | `apps/web` → CSS-in-JS reference | Small | Low | **Key insight**: The most valuable Vercel patterns for BooCode are **Turborepo's task scheduler** (parallel dependency-graph execution maps to conductor workflow scheduling) and **SWR's stale-while-revalidate** (maps to BooCode's data caching for codecontext/boocontext results). Vercel AI SDK's provider pattern is already partially replicated in BooCode. --- ### Domain 19: LangChain Example Apps (Not Individual Libraries) **Source**: Various LangChain example repos (chat-langchain, open-canvas, deep-agents-ui, etc.) These repos are **example applications** of LangChain/LangGraph, not libraries with independent patterns. They demonstrate usage of the core libraries already analyzed (langchain-core, langgraph, langmem). | Repo | Assessment | Value to BooCode | |------|-----------|-----------------| | `chat-langchain/` | LangSmith-powered RAG chatbot example | **Low** — LangChain-specific patterns | | `open-canvas/` | Collaborative AI writing canvas (Next.js) | **Low** — product concept, not liftable code | | `deep-agents-ui/` | TypeScript UI for Deep Agents | **Low** — React UI for langgraphjs | | `deepagents/` | Python sub-agent framework | **Med** — sub-agent spawning pattern (covered by harness-sdk & DeerFlow analyses) | | `deepagentsjs/` | JS port of deepagents | **Low** — same as Python version | | `local-deep-researcher/` | Local research agent (Ollama) | **Low** — simple agent example | | `open_deep_research/` | LangChain deep research | **Low** — report generation example | | `open-swe/` | SWE-bench agent framework | **Low** — benchmark-specific | | `opengpts/` | GPTs clone with LangGraph | **Low** — product concept | | `openwork/` | LangGraph workflow platform | **Med** — visual workflow patterns | | `langsmith-starter-kit/` | LangSmith evaluation starter | **Low** — LangSmith-specific | | `claude-workflow-v2/` | CloudAI-X workflow definitions | **Med** — workflow agent patterns | | `opencode-workflow/` | CloudAI-X OpenCode workflows | **Med** — OpenCode workflow configurations | **Key insight**: These are primarily **example applications** for LangChain's commercial products. They don't contain independently liftable patterns beyond what's already captured in the core LangGraph/LangMem analyses. Skip deep analysis — focus on the library-level repos already covered. --- ### Domain 20: Strands Tools Library **Source**: `tools/` — Strands Agents tool library | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | **Tool library pattern** (file ops, shell, memory, web, image, swarm tools as independent modules) | `tools/` | `data/skills/` → tool organization pattern | Small | Med | | **Tool module format** (each tool = single directory with standardized interface) | `tools/` | `data/skills/` → tool packaging standard | Small | Med | **Key insight**: The strands tools library is a reference for how BooCode could organize its growing tool/skill collection. Each tool as an independent module with a standard interface is the right pattern. --- ### Domain 21: Other Missed Repos — Quick Assessment | Repo | Summary | Worth Lift? | Reason | |------|---------|-------------|--------| | `amp-acp/` | ACP (Agent Communication Protocol) adapter | **Med** | ACP is a standard, any implementation is useful. Reference for BooCode's ACP layer | | `qgn.app/` | Electron desktop app (QuickGen — AI code generation UI) | **Low** | Features duplicated: screenshot→code, code editing UI. BooCode's web UI covers the same ground | | `agent-runtime/` | Generic agent runtime | **Low** | Overlaps with harness-sdk analysis | | `ai-sdk-provider-opencode-sdk/` | OpenCode provider for Vercel AI SDK | **Low** | Integration adapter, not independently valuable | | `memory_engine/` | (Not analyzed — see langmem for LangChain memory) | **Low** | Covered by langmem + deer-flow analyses | | `parlant/` | Already deeply analyzed in DEEP RESEARCH A | — | Covered | | `audit-harness/` | Already deeply analyzed in DEEP RESEARCH A | — | Covered | | `Archon/` | Already deeply analyzed in DEEP RESEARCH C | — | Covered | | `harness-sdk/` | Already deeply analyzed in DEEP RESEARCH B | — | Covered | | `hive/` | Already deeply analyzed in DEEP RESEARCH B | — | Covered | | `CowAgent/` | Already deeply analyzed in DEEP RESEARCH D | — | Covered | | `deer-flow/` | Already deeply analyzed in DEEP RESEARCH D+F | — | Covered | | `ruflo/` | Already deeply analyzed in DEEP RESEARCH F | — | Covered | | `opencode-extras/*/` | Already covered in original lift analysis | — | Covered | --- ## UPDATED RANKED INTEGRATION RECOMMENDATIONS (Post-Extension) New findings sorted into the existing Tier structure: ### Tier 0: Immediate (New — higher value than existing Tier 1) | # | What | Source | BooCode Target | Why | |---|------|--------|----------------|-----| | 0a | **Add boocontext-audit as behavioral rules engine** | `boocontext-audit/` | `apps/coder` + `apps/server` | Complete TypeScript Parlant port: guideline model, 6-batch matcher, relational resolver, audit trail, ambient context, graded recovery. Zero external deps. Single most undervalued repo. | | 0b | **Add type-inject MCP server** | `type-inject/packages/mcp/` | `apps/server` MCP client | Fixes 0% TypeScript recovery. Published as `@nick-vi/type-inject-mcp`. One-line config addition. | | 0c | **Add type-inject auto-injection hook** | `type-inject/packages/claude-hook/` | `apps/coder` | Type injection on file reads + type checking on writes. Direct improvement to edit quality. | ### Tier 0.5: Plugin Architecture from claude-code | # | What | Source | BooCode Target | Why | |---|------|--------|----------------|-----| | 0d | **Adopt claude-code plugin format** | `claude-code/plugins/*/` | `data/plugins/` + `apps/coder` | Standard plugin structure (`.claude-plugin/plugin.json` → commands/agents/skills/hooks/MCP). Proven 14-plugin ecosystem. | | 0e | **Security guidance hooks** | `claude-code/plugins/security-guidance/` | `apps/coder` PreToolUse | 9 security pattern detectors. Stops command injection, XSS, unsafe deserialization before they happen. | | 0f | **Self-referential agent loop** | `claude-code/plugins/ralph-wiggum/` | `apps/coder` → `/ralph-loop` | Agent runs same task until completion. Stop hook intercepts exit. | ### Updated Tier 1 additions: | # | What | Source | BooCode Target | Why | |---|------|--------|----------------|-----| | 1a | **Supervisor agent pattern** | `langgraph-supervisor-py/langgraph_supervisor/` | `conductor/` | Central coordinator delegates to specialized agents. Pattern-ported from 469-line Python module. | | 1b | **Handoff tool mechanism** | `langgraph-supervisor-py + langgraph-swarm-py` | `conductor/` | Agent-to-agent context transfer via `create_handoff_tool(agent_name, description)`. | | 1c | **X-Agent-Flags header** | `llama-sidecar/` | `apps/server` | Per-agent LLM parameter overrides without spawning new processes. | ### Updated Tier 2 additions: | # | What | Source | BooCode Target | Why | |---|------|--------|----------------|-----| | 2a | **Turborepo task scheduler** | `turborepo/` | `conductor/` | Dependency graph scheduling, parallel execution, caching. Maps directly to workflow execution needs. | | 2b | **SWR stale-while-revalidate cache** | `swr/` | `apps/server` | Data caching layer for codecontext/boocontext results. Serve cached → revalidate → update. | | 2c | **Swarm agent pattern** | `langgraph-swarm-py/langgraph_swarm/` | `conductor/` | Dynamic agent handoff without central coordinator. | | 2d | **Sim workflow-types package** | `sim/packages/workflow-types/` | `conductor/` | Pure BlockState/Loop/Parallel types — reference for BooCode's own flow types. | ### Updated Tier 3 additions: | # | What | Source | BooCode Target | Why | |---|------|--------|----------------|-----| | 3a | **Visual workflow builder** | `sim/apps/sim/blocks/` + `executor/` | `apps/web` | Drag-and-drop agent design. Large effort but high strategic value. | | 3b | **PR review agent team** | `claude-code/plugins/pr-review-toolkit/` | `conductor/` → PR review flow | 5 parallel agents for code review, bug finding, test analysis, type design, simplification. | --- ## REVISED DEPENDENCY GRAPH ``` boocontext-audit behavioral engine (NEW — Tier 0) ├── Guideline model → Multi-batch matcher → Relational resolver ├── Audit middleware → Graded context recovery └── Depends on: LLM backend for SchematicGenerator type-inject MCP (NEW — Tier 0) ├── Type extraction → Type prioritization → Token-budgeted injection └── Independent — add as MCP server claude-code plugin format (NEW — Tier 0.5) ├── Enables: Security hooks → Self-referential loops → PR review teams └── Prerequisite: plugin.json convention LangGraph supervisor pattern (NEW — Tier 1) └── Enables: Handoff tool → Swarm pattern (Tier 2) Turborepo scheduler (NEW — Tier 2) └── Enables: Task dependency graph → Parallel execution → Caching ``` --- ## REVISED COMPLETE REPO REFERENCE (Additions) | Repo | Path | Key Capability | Lift Priority | |------|------|---------------|---------------| | boocontext-audit | `/opt/forks/boocontext-audit/` | Behavioral compliance engine (guidelines, matching, resolution, audit, recovery) | **Tier 0** | | type-inject | `/opt/forks/type-inject/` | TypeScript type extraction, lookup MCP, auto-injection hooks | **Tier 0** | | claude-code plugins | `/opt/forks/claude-code/plugins/` | 14 official plugins: plugin format, security hooks, loop, PR review, feature dev | **Tier 0.5** | | langgraph-supervisor | `/opt/forks/langchain/langgraph-supervisor-py/` | Supervisor agent pattern (central coordinator → specialized agents) | **Tier 1** | | langgraph-swarm | `/opt/forks/langchain/langgraph-swarm-py/` | Swarm agent pattern (dynamic handoff, no central coordinator) | **Tier 2** | | turborepo | `/opt/forks/vercel/turborepo/` | Task dependency graph scheduling, parallel execution, caching | **Tier 2** | | swr | `/opt/forks/vercel/swr/` | Stale-while-revalidate data fetching cache | **Tier 2** | | sim | `/opt/forks/sim/` | Full AI agent workspace: visual workflows, block engine, knowledge base | **Tier 3** | | claude-agent-sdk | `/opt/forks/claude-agent-sdk-typescript/` | Session store abstraction, streaming agent pattern | **Tier 2** | | claude-agent-sdk-python | `/opt/forks/claude-agent-sdk-python/` | Python version (same patterns as TS) | Low | | strands tools | `/opt/forks/tools/` | Tool organization pattern | Tier 3 | | amp-acp | `/opt/forks/amp-acp/` | ACP protocol adapter | Tier 2 | | llama-sidecar | `/opt/forks/llama-sidecar/` | X-Agent-Flags header pattern | **Tier 1** | --- ## KEY FINDINGS SUMMARY ### Most Undervalued Repo **`boocontext-audit/`** — Not a simple audit extraction. A full Parlant-inspired behavioral compliance engine with: - Guideline condition/action model (Parlant port) - 6-batch multi-matcher (Observational, Actionable, PreviouslyApplied, Disambiguation, ResponseAnalysis, LowCriticality) - Relational resolver (DEPENDS_ON, PRIORITIZES, ENTAILS, TAG_ALL, TAG_PRIORITIZES with iterative convergence) - SchematicGenerator for structured LLM batch calls - Full audit middleware with graded context recovery (L0-L4) - Zero external deps (only `@modelcontextprotocol/sdk`) The behavioral engine could enforce agent behavior rules (security policies, code style, tool restrictions) via structured LLM evaluation — far beyond simple CLAUDE.md guidelines. ### Easiest Wins 1. **type-inject MCP server** — One-line config add. Fixes 0% TypeScript recovery. 2. **Security guidance hooks** — Copy claude-code/plugins/security-guidance/ pattern. Days of effort. 3. **X-Agent-Flags header** — Small change to inference routing for per-agent LLM parameters. 4. **SWR caching for codecontext** — Stale-while-revalidate for MCP tool results. Days of effort. ### Architecture Patterns Worth Studying 1. **claude-code plugin format** — `.claude-plugin/plugin.json` → commands/agents/skills/hooks/ `.mcp.json` is the de facto standard. BooCode should adopt a compatible format. 2. **LangGraph supervisor pattern** — Clean central-coordinator architecture with handoff tools. 3. **Sim's workflow-types package** — Pure type definitions for BlockState, Loop, Parallel — reference for conductor flow types. 4. **Turborepo's task scheduling** — Dependency graph with remote caching — maps to conductor's parallel execution needs. --- ## PASS 4 — CORRECTED ASSESSMENTS (Deep Analysis Findings) Several repos were initially assessed as "Low Value" in the extension. Deep analysis reveals they are much more significant. --- ### Domain 22: Agent Runtime — Combined Eval + Sandbox + Pregel in TypeScript **Source**: `agent-runtime/` — `/home/samkintop/opt/forks/agent-runtime/` **What it is**: A **pre-compiled TypeScript monorepo** that combines three independent subsystems into one clean package: - `@agent-runtime/eval` — OpenEvals-style LLM evaluation framework - `@agent-runtime/sandbox` — Vercel Sandbox-style remote execution - `@agent-runtime/graph` — langgraphjs-style Pregel state graph engine **Why this matters**: This is the exact combined system from DEEP RESEARCH E (OpenEvals + Vercel Sandbox + langgraphjs), already ported to TypeScript, already compiled to `dist/`, with zero LangChain dependencies. It's a direct-lift candidate. **Key Architecture** (`packages/graph/src/`): ``` pregel/ ├── index.ts — Pregel class (compiled graph engine) ├── algo.ts — _applyWrites, _prepareNextTasks ├── loop.ts — PregelLoop (execution loop) ├── runner.ts — PregelRunner (parallel task execution) ├── read.ts — PregelNode (channel reads) ├── write.ts — ChannelWrite ├── io.ts — mapInput, readChannels └── types.ts — Pregel types channels/ ├── base.ts — BaseChannel (abstract) ├── last_value.ts — LastValue, LastValueAfterFinish ├── binop.ts — BinaryOperatorAggregate ├── topic.ts — Topic (publish/subscribe) ├── ephemeral.ts — EphemeralValue └── named_barrier.ts — NamedBarrierValue graph/ ├── graph.ts — Graph class (untyped DAG) ├── state.ts — StateGraph class (typed state machine) └── annotation.ts — Annotation.Root helpers stream/ ├── index.ts — StreamEvent protocol, GraphRunStream state/ ├── schema.ts — State schema + channel builder └── adapter.ts — State adapter interrupt.ts — interrupt(), interruptMultiple() — HITL constants.ts — START, END, INTERRUPT, Command, Send errors.ts — NodeSpecError, GraphCycleError, ChannelError ``` | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | **Pre-compiled Pregel engine** (StateGraph, superstep execution, channels, streaming — zero LangChain deps) | `agent-runtime/packages/graph/dist/` | `conductor/` → workflow graph engine | **Small** (import/adapt) | **Critical** | | **LLM-as-judge evaluator** (structured scoring, prompt templates, multi-turn simulation, trajectory evaluation) | `agent-runtime/packages/eval/dist/` | `apps/server` → agent quality evaluation | **Small** | **High** | | **Remote sandbox abstraction** (command execution, POSIX filesystem, snapshots, network policy) | `agent-runtime/packages/sandbox/dist/` | `apps/booterm` → sandboxed code execution | **Small** | **High** | | **Human-in-the-loop interrupts** (interrupt()/interruptMultiple() pattern — resumable execution) | `agent-runtime/packages/graph/src/interrupt.ts` | `apps/coder` → pause-for-input mid-workflow | **Small** | **High** | | **Channel types** (LastValue, Topic, BinaryOperatorAggregate, Ephemeral, NamedBarrierValue) | `agent-runtime/packages/graph/src/channels/` | `conductor/` → typed state channels | **Small** | **High** | | **StreamEvent protocol** (STREAM_MODES, GraphRunStream, customEvent) | `agent-runtime/packages/graph/src/stream/` | `apps/server` → streaming workflow events | **Small** | **High** | | **Execution loop with checkpoint** (PregelLoop → PregelRunner → _applyWrites → checkpoint cycle) | `agent-runtime/packages/graph/src/pregel/loop.ts` + `runner.ts` | `conductor/` → structured execution lifecycle | **Small** | **High** | **Key insight**: `agent-runtime` is the #1 most undervalued repo. It's a pre-built, compiled TypeScript implementation of the most powerful patterns from DEEP RESEARCH E, ready for direct import. The `@agent-runtime/graph` package provides a complete Pregel state machine that could replace or augment BooCode's conductor flow runner. Zero LangChain deps, clean TypeScript, already built. --- ### Domain 23: Memory Engine — Complete 3-Tier Memory System **Source**: `memory_engine/` — `/home/samkintop/opt/forks/memory_engine/` **What it is**: A standalone Python memory system combining LangMem's token-budget summarization, CowAgent's 3-tier architecture (Context→Daily→Core), and DeerFlow's memory update flow. Complete with SQLite FTS5 + vector search, Deep Dream consolidation, and management tools. **Why this matters**: Unlike the other memory repos (LangMem = framework-coupled, CowAgent = complex, DeerFlow = LangChain-coupled), `memory_engine` is a **clean, standalone Python package** with a clear architecture that can be ported to TypeScript for boocode directly. **Key Architecture:** ``` config.py — MemoryConfig (Pydantic, all tunable params) core/ ├── store.py — MemoryStore (SQLite + FTS5 + vector BLOB, 262 lines) ├── hybrid_search.py — HybridSearchEngine (vector 0.7 + keyword 0.3) ├── schemas.py — MemoryChunk, SearchResult, Fact (Pydantic + dataclass) tiers/ ├── context.py — ContextTier (short-term, token-budget summarization, 205 lines) ├── core.py — CoreTier (long-term SQLite + hybrid search, 132 lines) ├── daily.py — DailyTier (Markdown files + MEMORY.md, 107 lines) tools/ ├── manage.py — Memory management (create/update/delete) ├── search.py — Search tools background/ ├── deep_dream.py — Deep Dream LLM consolidation (like CowAgent) ├── queue.py — Debounced background queue (like DeerFlow) embedding/ extraction/ utils/ ``` | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | **SQLite FTS5 store** with vector BLOB storage, WAL mode, thread safety | `memory_engine/core/store.py` (262 lines) | `apps/coder` → memory persistence | Med | High | | **3-tier memory** (Context: token-budget summary → Daily: Markdown files → Core: SQLite+vectors) | `memory_engine/tiers/` (context.py, daily.py, core.py) | `apps/coder` → structured memory hierarchy | Med | **Critical** | | **Hybrid search** (vector 0.7 + keyword 0.3 with FTS5, temporal decay) | `memory_engine/core/hybrid_search.py` | `apps/coder` → memory retrieval | Med | High | | **MemoryConfig** (typed, Pydantic, 21 tunable parameters with defaults) | `memory_engine/config.py` | `apps/server` → configuration pattern | Small | Med | | **Deep Dream consolidation** (overnight LLM rewrite of MEMORY.md) | `memory_engine/background/deep_dream.py` | `apps/coder` → long-term memory consolidation | Med | High | | **Management tools** (manage.py create/update/delete + search.py) | `memory_engine/tools/` | `apps/coder` → memory CRUD tools | Small | High | | **Debounced background queue** | `memory_engine/background/queue.py` | `apps/server` → async memory processing | Small | Med | **Key insight**: `memory_engine` is the cleanest reference implementation of the memory patterns identified in DEEP RESEARCH D. Where LangMem is framework-coupled (LangGraph) and CowAgent is feature-rich but complex (1500+ line files), memory_engine has clean <300-line files with clear separation of concerns. Best model for porting 3-tier memory to boocode. --- ## UPDATED RANKED INTEGRATION RECOMMENDATIONS (Post-Correction) ### New Tier 0 additions: | # | What | Source | BooCode Target | Why | |---|------|--------|----------------|-----| | 0g | **Import @agent-runtime/graph Pregel engine** | `agent-runtime/packages/graph/dist/` | `conductor/` → replace flow runner | Pre-compiled TS StateGraph with Pregel execution, channels, interrupts, streaming. Zero deps. Direct lift. | | 0h | **Import @agent-runtime/eval evaluator** | `agent-runtime/packages/eval/dist/` | `apps/server` → agent quality eval | LLM-as-judge, trajectory, code correctness, multi-turn simulation. Ready to use. | | 0i | **Port memory_engine 3-tier memory to TypeScript** | `memory_engine/` (Python → TS port) | `apps/coder` → structured memory | Cleanest reference for Context→Daily→Core with SQLite FTS5 + vectors + Deep Dream. | ### Updated REVISED COMPLETE REPO REFERENCE | Repo | Path | Key Capability | Lift Priority | |------|------|---------------|---------------| | agent-runtime | `/opt/forks/agent-runtime/` | Pre-compiled Pregel engine + evaluator + sandbox (TypeScript, zero LangChain deps) | **Tier 0** | | memory_engine | `/opt/forks/memory_engine/` | 3-tier memory: SQLite FTS5+vectors, Deep Dream, token-budget summarization | **Tier 0** | | deepagents | `/opt/forks/deepagents/` | Sub-agent framework with filesystem, memory, skills, summarization middleware | Tier 2 | | open-swe | `/opt/forks/langchain/open-swe/` | Production coding agent: 11 middleware components, sandbox lifecycle, GitHub/Linear/Slack | Tier 2 | --- ### Domain 24: Deep Agents — Production Sub-Agent Harness **Source**: `deepagents/` — Python agent harness by LangChain **Corrected assessment**: Initially assessed as "Med" due to being a LangChain-specific implementation. However, it contains a **clean middleware architecture** for sub-agent orchestration that is the reference implementation for boocode's sub-agent system. **Key patterns** (`deepagents/libs/deepagents/deepagents/`): ``` graph.py — create_deep_agent(): full agent assembly (866 lines) middleware/ ├── subagents.py — SubAgent middleware (788 lines): spawn isolated agents with task() tool ├── async_subagents.py — AsyncSubAgent middleware: parallel sub-agent execution ├── filesystem.py — Filesystem middleware: read/write/edit/ls with permission model ├── memory.py — MemoryMiddleware: persistent cross-session memory ├── skills.py — SkillsMiddleware: loadable skill behaviors ├── summarization.py — Token-budget context management └── _tool_exclusion.py — Tool exclusion per middleware layer backends/ — StateBackend, SandboxBackend, LangSmithSandbox profiles/ — ProviderProfile, HarnessProfile (model-specific config) ``` | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | **SubAgent middleware** (task() tool spawns isolated agent with own model, tools, middleware, permissions) | `deepagents/middleware/subagents.py` (788 lines) | `conductor/` → sub-agent spawning | Med | High | | **Filesystem middleware** (permission model: allow/deny paths by pattern) | `deepagents/middleware/filesystem.py` | `apps/coder` → file access control | Small | High | | **Memory middleware** (cross-session persistent state via BaseStore) | `deepagents/middleware/memory.py` | `apps/coder` → agent memory abstraction | Med | High | | **Skills middleware** (loadable skills from directories) | `deepagents/middleware/skills.py` | `data/skills/` → skill loading architecture | Med | Med | | **Summarization middleware** (token-budget context management) | `deepagents/middleware/summarization.py` | `apps/server` → context window management | Med | High | **Key insight**: deepagents is the reference implementation for boocode's sub-agent middleware pattern. The SubAgent spec (name, description, system_prompt, tools, model, middleware, permissions) maps directly to boocode's agent configuration. The middleware chain architecture is the right abstraction for composable agent behavior. --- ### Domain 25: Open SWE — Production Coding Agent Framework **Source**: `open-swe/` (at `/opt/forks/langchain/open-swe/`) — LangChain's open-source internal coding agent framework **Corrected assessment**: Initially assessed as "Low" because it was grouped with example apps. In reality, it's a **production coding agent framework** used by companies like Stripe, Ramp, Coinbase. Has 10+ middleware components, sandbox lifecycle management, and multi-channel integration (Slack, Linear, GitHub) that directly relate to boocode's domain. **Key architecture** (`agent/`): ``` ├── server.py — Main agent factory (607 lines): create_deep_agent with curated tool list + middleware stack ├── webapp.py — FastAPI routes: webhooks for GitHub, Linear, Slack ├── middleware/ — 11 middleware components │ ├── check_message_queue.py — Mid-run message injection (Linear/Slack comments arrive mid-stream) │ ├── model_fallback.py — Transient failure → fallback model (Anthropic↔OpenAI) │ ├── sandbox_circuit_breaker.py — Circuit breaker on repeated sandbox failures │ ├── sanitize_thinking_blocks.py — Strip malformed Anthropic thinking blocks │ ├── sanitize_tool_inputs.py — Normalize tool inputs before execution │ ├── tool_error_handler.py — Catch tool exceptions → tool messages │ ├── notify_step_limit.py — Post Slack reply when agent hits step cap │ ├── refresh_slack_status.py — Keep Slack "typing" indicator alive │ ├── ensure_no_empty_msg.py — Guard against empty assistant messages │ └── exclude_tools.py — Tool exclusion per context ├── dashboard/ — Model profiles, team settings, OAuth, usage tracking ├── integrations/ — LangSmith sandbox with GitHub proxy ├── tools/ — Curated tool set (http_request, fetch_url, web_search, Linear, Slack, GitHub) ├── reviewer.py — Read-only PR reviewer with findings model ├── analyzer.py — Per-repo review style learner ├── utils/ — Auth, model resolution, sandbox state management └── skills/ — Deep agents skills for bootstrap/continual learning ``` | Capability | Source | BooCode Target | Effort | Value | |-----------|--------|----------------|--------|-------| | **Mid-run message injection** (queue new messages mid-stream → inject before next LLM call) | `open-swe/agent/middleware/check_message_queue.py` | `apps/coder` → mid-conversation message injection | Med | High | | **Model fallback middleware** (primary fails → retry with fallback provider) | `open-swe/agent/middleware/model_fallback.py` (93 lines) | `apps/coder` → provider failover | Small | High | | **Sandbox circuit breaker** (consecutive sandbox failures → abort thread) | `open-swe/agent/middleware/sandbox_circuit_breaker.py` (261 lines) | `apps/booterm` → sandbox resilience | Small | High | | **Sanitize tool inputs middleware** (strip/normalize before tool execution) | `open-swe/agent/middleware/sanitize_tool_inputs.py` | `apps/coder` → tool input safety | Small | Med | | **Middleware stack pattern** (ordered chain: sanitize → limit → error → queue → status → breaker → fallback) | `open-swe/agent/middleware/` + `agent/server.py` | `conductor/` → middleware architecture | Med | High | | **Deterministic thread-id derivation** (same issue/PR → same thread) | `open-swe/agent/utils/github_comments.py` + `utils/linear.py` + `utils/slack.py` | `apps/server` → session continuity | Small | High | | **Sandbox lifecycle** (4 cases: cached→reconnect, creating→reset, missing→create, metadata→reconnect) | `open-swe/agent/utils/sandbox_state.py` | `apps/booterm` → sandbox lifecycle management | Med | High | | **GitHub proxy in sandbox** (inject GitHub App token → sandbox uses `gh dummy` without real tokens) | `open-swe/agent/utils/github_comments.py`, `integrations/langsmith.py` | `apps/booterm` → authenticated git in sandbox | Med | High | **Key insight**: open-swe is the most production-relevant coding agent framework in the entire forks directory. Its middleware stack pattern (10 ordered middleware components) is a direct reference for boocode's inference lifecycle. The model fallback pattern (Anthropic↔OpenAI on transient errors) and sandbox circuit breaker are directly liftable. The mid-run message injection pattern solves a real boocode problem: "how to inject user messages that arrive while the agent is processing." --- ### Corrected Assessment: LangChain Python Library **Source**: `langchain/langchain/libs/` + `langchain/langchain/libs/core/langchain_core/` This is the LangChain Python framework itself. Not an example app. The core abstractions live in `libs/core/langchain_core/`: | Module | Key Patterns | Liftable? | |--------|-------------|-----------| | `agents.py` | Agent types, AgentExecutor protocol | **No** — deeply coupled to LangChain's runnable framework | | `tools.py` | BaseTool, StructuredTool abstraction | **Concept only** — boocode already has its own tool model | | `callbacks/` | CallbackHandler, AsyncCallbackHandler (17 events) | **Inspiration** — boocode's hook system needs this event set | | `caches.py` | LLM response caching | **Yes** — pattern for boocode's LLM cache | **Verdict**: The LangChain library itself is too coupled to its own framework to lift individual patterns. The callback system (17 lifecycle events for tool start/end, LLM start/end, chain start/end) is a useful reference for boocode's hooks system but not directly liftable. --- ### Corrected Assessment: LangGraph Python Core **Source**: `langchain/langgraph/libs/` — Python langgraph Key differences from langgraphjs (already analyzed in DEEP RESEARCH E): | Feature | Python | JS | BooCode Relevance | |---------|--------|----|-------------------| | Checkpointer implementations | SQLite, Postgres, Memory, Conformance tests | Checkpoint interface only | **Med** — checkpointer diversity is useful | | Prebuilt agents | `create_react_agent` | `createReactAgent` | **Low** — same concept | | SDK | `sdk-py`, `sdk-js` | Platform clients | **Low** — deployment-specific | | CLI | `langgraph-cli` (dev, deploy, test) | None | **Low** — dev tooling | **Verdict**: No significant liftable patterns beyond what was already covered in the langgraphjs Pregel analysis (DEEP RESEARCH E). The checkpointer implementations are the most useful reference. --- ### Corrected Assessment: langchainjs **Source**: `langchain/langchainjs/` The JS port of LangChain. Same architecture, different language. Contains no independently liftable patterns beyond what the Python LangChain library provides. **Verdict**: No liftable patterns. Focus on `agent-runtime` instead (which is the clean TS rewrite). ---