Agent System Improvements — Multi-Team Orchestration (2026-03-30)

Agent System Improvements — Multi-Team Orchestration (2026-03-30)

Source: IndyDevDan video "One Agent Is NOT ENOUGH: Agentic Coding BEYOND Claude Code" Analysis: Plan agent + Devil's Advocate + Petter Graff (AI Architect) Status: IMPLEMENTED


Background

CEO reviewed IndyDevDan's multi-team agentic coding system (PI agent harness) and requested improvements to ALAI's virtual company/agent system. Video covers: three-tier architecture (Orchestrator → Leads → Workers), persistent mental models, domain write-locking, skills sharing, config-driven teams, multi-perspective consensus, and conversation logs.

Gap Analysis

What ALAI Already Does Better

Gaps Identified

Gap Description Impact
Lead delegation not enforced Lead agents could write code (behavioral rule only) HIGH
Write-lock not enforced YAML allowed_paths existed but hooks didn't check them HIGH
No session conversation logs Agents couldn't see what other agents did MEDIUM-HIGH
RAG-first was advisory only Agents skipped RAG queries with no consequence HIGH
HiveMind posts unstructured Free-form text, no company/domain/pattern tags MEDIUM

Rejected Proposal: Per-Agent Mental Models

Architect recommendation: Do NOT implement persistent expertise.md files per agent. Reason: creates 4th knowledge layer (HiveMind + Knowledge DB + RAG cache + expertise.md) that will diverge. Instead, enforce RAG-first as blocking and improve HiveMind post quality with structured tags. This gives 80% of the benefit with zero new infrastructure.


Implemented Changes

Faza 1: Lead YAML Constraints + Write-Lock Enforcement

Lead YAML updates (16/16 companies): All lead.yaml files now have:

constraints:
  allowed_paths:
    - "~/companies/<CompanyName>/**"
  forbidden_paths:
    - "~/projects/**"
    - "~/ALAI/products/**"
    - "~/system/**"
    - "~/.claude/**"
  write_locked: true

Leads can READ everything but only WRITE to their own company directory.

Write-Lock Script: ~/system/tools/agent-write-lock.py

Faza 2: Session Conversation Logs

Tool: ~/system/tools/session-workspace.sh Commands:

Agent Integration:

Report schema: agent_type, company, task_summary, files_written, key_decisions, blockers, verification.

Faza 3: RAG-First Blocking + Structured HiveMind Tags

RAG Enforcement Upgrade:

Structured HiveMind Posts:


Architecture Diagram

CEO (Alem)
  └── John (Orchestrator, Opus)
        ├── company.sh → Route to company
        ├── consensus-query.js → Multi-company consensus (planned)
        │
        ├── CodeCraft (Lead: delegate-only, write-locked)
        │     ├── Builder (Sonnet, allowed_paths enforced)
        │     └── Validator (Sonnet, read-only)
        │
        ├── Proveo (Lead: delegate-only, write-locked)
        │     ├── QA Builder
        │     └── Audit Validator
        │
        └── ... (14 companies total)

Shared Infrastructure:
  ├── HiveMind (23K entries, structured tags)
  ├── RAG-first hook (BLOCKING for project files)
  ├── Session workspace (/tmp/session-{task-id}/)
  └── Write-lock enforcement (agent-write-lock.py)

Files Changed

File Change
~/companies/*/agents/lead.yaml (x16) Added constraints, write_locked: true
~/system/tools/agent-write-lock.py NEW — write-lock enforcement script
~/system/tools/session-workspace.sh NEW — shared session log tool
~/system/tools/hivemind-post-structured.sh NEW — structured HiveMind post helper
~/.claude/hooks/lib/rag_first_enforcer.py Upgraded — blocking for project paths
~/.claude/hooks/config/rag-enforcement.json Updated — project_mode: blocking
~/.claude/agents/builder.md Updated — session awareness + structured posts
~/.claude/agents/validator.md Updated — session awareness

Future Work


Revision #2
Created 2026-03-30 21:43:44 UTC by John
Updated 2026-05-31 20:05:24 UTC by John