# ALAI 4-Team Restructure — Dispatch Flow, FORGE Routing, MEMORY.md Contract

# ALAI 4-Team Restructure — Dispatch Flow, FORGE Routing, MEMORY.md Contract

**MC task:** #101653  
**Status:** documentation page for the MC #101640–#101654 restructure sweep  
**Last updated:** 2026-05-21  
**Owner:** John / Lexicon-Skillforge documentation lane

## Executive summary

This page records the post-sweep operating contract after the 4-team restructure work around MC #101640–#101654.

The restructure is **not globally PASS**. The correct top-level validation posture is **PARTIAL/BLOCKED** until validator blockers are resolved. Several implementation lanes are ready for review, but LightRAG ingestion/query verification, prompt-cache WAL truncation, .bak cleanup policy, and pipeline-watcher side-effect decisions remain blocked or partial.

## Current task-state snapshot

| MC | Lane | Current result | Evidence / note |
|---:|---|---|---|
| #101640 | FORGE dispatch wrapper | `ready_for_review` | `forge-dispatch.js` syntax/help/smoke checks passed; BookStack page live. |
| #101641 | FORGE route gate | `ready_for_review` | verifier-class Opus block when FORGE healthy; FORGE-down fallback tested. |
| #101642 | Tier A hook wiring | `ready_for_review` | five Tier A hooks wired in `~/.claude/settings.json`; hooks reference updated. |
| #101643 | GOTCHA + async auto-verify | `ready_for_review` | `mc.js start` creates H/BLOCKER GOTCHA stubs; auto-verify worker async smoke passed. |
| #101644 | LightRAG ingest | `blocked` | upload accepted, but processing/query/entity verification remains unproven. |
| #101645 | MEMORY.md compact index | `ready_for_review` | MEMORY.md reduced to compact index and size gate installed. |
| #101646 | Mem0/HiveMind/Qdrant cleanup | `blocked` | ghost `bookstack.db` archived; canonical HiveMind and ADR-retained Qdrant/Mem0 snapshots require CEO/ops decision. |
| #101647 | AutoCoder/durable consolidation | `ready_for_review` | AutoCoder UI plist archived; read-only durable observability merged. |
| #101648 | Agent mapping cleanup | `ready_for_review` | unmapped active agent definitions reduced to zero; archives have SHA256 manifest. |
| #101649 | Tools governance | `blocked` | manifest and safe archives done; broad stale cleanup blocked by active `comms-agent/node_modules`. |
| #101650 | Hook consolidation | `ready_for_review` | PreToolUse killswitch matchers consolidated. |
| #101651 | P3 housekeeping batch | `blocked` | safe patches done; blockers remain for WAL busy, .bak policy, Qdrant ADR retention, LightRAG label probe. |
| #101652 | Global validation | `blocked` | honest validation report says global result is PARTIAL/BLOCKED, not PASS. |
| #101654 | pipeline-watcher daemon | `blocked` | do **not** reload: archived daemon would mutate real invoice escalation state. |

## New dispatch flow

1. **Task enters MC** with priority and owner/company.
2. **H/BLOCKER tasks require GOTCHA context.** `mc.js start` now auto-generates a GOTCHA stub under `/tmp/gotcha-task-<id>.md` for H/BLOCKER work.
3. **Planning gate:** H/BLOCKER tasks follow `/prompt-forge <mc_id>` then `/mehanik` before dispatch/build. M/L trivial work can skip prompt-forge and go directly to Mehanik or local implementation.
4. **Routing:** verifier/reviewer/comparator-class work should route to FORGE local models when FORGE is healthy.
5. **Implementation:** builders may work directly for small safe patches, otherwise route through company workers.
6. **Validation:** claims must be backed by machine evidence. For user-facing/deploy work, browser/Playwright verification is required.
7. **Ready gate:** H/BLOCKER task readiness must go through `~/.claude/hooks/mc-ready-gate.sh` with evidence JSON and actor identity. Direct `node ~/system/tools/mc.js ready <H task>` is a bypass attempt.
8. **Verifier lane:** validator verdicts must stay honest: use `PASS`, `PARTIAL`, or `BLOCKED`; never report global PASS while upstream blockers remain.

## FORGE routing contract

- `~/system/tools/forge-dispatch.js` is the canonical wrapper for sending verifier/reviewer/comparator-class jobs to FORGE.
- `~/.claude/hooks/forge-route-gate.sh` protects against unnecessary paid Opus use for verifier-class agents when FORGE is healthy.
- Expected behavior:
  - FORGE healthy + verifier/reviewer/comparator class → use FORGE/local model route.
  - FORGE unavailable → allow fallback, but record why and preserve evidence.
  - Non-verifier work → do not block solely because FORGE is healthy.
- Cost discipline remains active: ALAI revenue is zero; use local/free routes where they are fit for purpose.

## Tier A hooks now active

The settings-level hook wiring activates previously orphaned Tier A protections:

- `evidence-contract-validator.sh`
- `git-author-guard.sh`
- `mc-ready-gate.sh`
- `pre-publish-claims-gate.sh`
- `zakon-30-direct-probe-gate.sh`

Operational rule: do not claim done/deployed/verified without direct machine evidence, and do not bypass the H/BLOCKER ready wrapper.

## MEMORY.md new contract

`~/.claude/projects/-Users-makinja/memory/MEMORY.md` is now a compact index, not a fact dump.

Rules:

- Keep MEMORY.md small; current guardrail is a 50-line index target.
- Put durable procedures/runbooks in BookStack/system docs.
- Put concrete searchable knowledge in LightRAG / discover.js / HiveMind as appropriate.
- Use `~/system/tools/discover.js memory "topic"` for deep memory lookup.
- `memory-size-gate.sh` blocks regressions back to large inline memory dumps.

## LightRAG reality note

The canonical LightRAG runtime for Pi/Anvil is Azure direct: `http://20.240.61.67:9621`. Public `https://lightrag.alai.no` remains Cloudflare Access protected unless valid CF Access headers are configured.

Do not equate upload acceptance with successful graph extraction. MC #101644 remains blocked because uploaded docs were accepted but query/entity attribution was not proven.

## pipeline-watcher safety note

Do **not** load or bootstrap `com.john.pipeline-watcher` until CEO/ops approves one of these paths:

1. restore production daemon and accept real invoice escalation side effects;
2. patch and verify safe mode/no-mutation behavior first; or
3. retire the daemon.

The preload inspection found real overdue invoice escalation side effects, so keeping the daemon blocked is intentional.

## Documentation ownership

Skillforge/Lexicon owns this documentation lane. Documentation does not override MC state, validator evidence, ADRs, or CEO/ops approval gates.

## Evidence sources

- `/tmp/101653-source-statuses.txt`
- `/tmp/101651-evidence/report.md`
- `/tmp/101652-validation/report.md`
- `/tmp/101640-evidence/` (where present)
- `/tmp/101641-evidence/` (where present)
- `/tmp/101642-evidence/` and `/tmp/101642-bookstack-doc-probe.txt`
- `/tmp/101643-evidence/`
- Mission Control task records #101640–#101654