askLoki injected zero project context — it sent the raw message to the gateway
with a generic system prompt, so Loki only knew what the shared OpenClaw agent
happened to remember. The fleet-knowledge RAG (pgvector) was wired into
dispatches, never into Loki chat.
Now every Loki turn prepends a read-only fleet-context block:
• BREADTH — a compact index of every active project (name, stack, description,
latest dev-log state) so Loki can answer across the whole fleet, not just
whatever RAG retrieved. (buildFleetIndex, pure + unit-tested.)
• DEPTH — top-K semantically-relevant chunks from knowledge_embeddings
(searchKnowledge / pgvector) scoped to the question — the dossiers + dev logs
reindexed this session.
Injected on both the gateway and Groq-fallback paths; best-effort (a failed
lookup degrades to plain Loki, never a broken turn). Pure index split into
loki-fleet-index.ts so it unit-tests without a DB (31/31).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>