From 0d996cf7590e3e52f424859c7d6f0e68640f119e Mon Sep 17 00:00:00 2001
From: soryu <soryu@soryu.co>
Date: Sun, 17 May 2026 21:23:20 +0100
Subject: chore: remove LLM module + all dependent surfaces (#135)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Wholesale removal of the LLM integration layer. ~14,200 LOC deleted
across backend and frontend. All chat-driven UIs go with it.

## Backend
- Delete `src/llm/` (7,400 LOC): claude/groq clients, contract_tools,
  contract_evaluator, discuss_tools, mesh_tools, phase_guidance,
  task_output, templates, markdown round-trip, tools, transcript_analyzer.
- Delete handlers wholly dependent on LLM:
  - `chat.rs` (file-level LLM chat at /files/{id}/chat)
  - `mesh_chat.rs` (mesh & task LLM chat + history)
  - `templates.rs` (/contract-types listing)
- Strip LLM uses from `mesh_daemon.rs`:
  - `compute_action_directive` (used phase_guidance::check_deliverables_met
    to nudge supervisors with "all tasks done" messages). The auto-PR
    path below still fires when all tasks finish, so no behaviour lost.
  - `crate::llm::markdown_to_body` → inline 1-line replacement that
    wraps markdown content in a single BodyElement::Markdown. The
    editor re-parses on display, so round-trip is preserved.
- Drop routes: /files/{id}/chat, /mesh/chat, /mesh/chat/history,
  /mesh/tasks/{id}/chat, /contract-types.
- Drop the matching openapi registrations.

## Frontend
- Delete components that were LLM-only:
  - `mesh/UnifiedMeshChatInput.tsx`
  - `listen/DiscussContractModal.tsx`
  - `listen/TranscriptAnalysisPanel.tsx`
  - `listen/ContractPickerModal.tsx`
  - `files/CliInput.tsx`
- Delete the entire /listen page (its primary value-add was
  voice → LLM analysis → contract creation; without LLM the page is
  just a transcript display with no obvious user purpose).
- Delete `hooks/useMeshChatHistory.ts` and `lib/listenApi.ts`
  (transcript-analysis API client to the already-Phase-5-removed
  listen handlers).
- Strip api.ts of LLM exports: LlmModel, ChatMessage/Request/Response,
  UserQuestion/Answer, chatWithFile, MeshChat* types & functions,
  getMeshChatHistory, clearMeshChatHistory, chatWithMeshContext,
  ContractTypeTemplate, listContractTypes, chatWithContract,
  getContractChatHistory, clearContractChatHistory, discussContract,
  PhaseDefinition, DeliverableDefinition.
- mesh.tsx: drop UnifiedMeshChatInput render + the chatContext memo +
  handleTaskUpdatedFromCli (only consumer was the input).
- files.tsx: drop CliInput render + handleGenerateFromElement +
  handleBodyUpdate + handleClearFocus + suggestedPrompt state (all
  CliInput-only).
- NavStrip: drop the /listen link.
- main.tsx: drop the /listen route.

## Net diff: 37 files changed, 58 insertions, 14,281 deletions.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---
 makima/frontend/src/routes/mesh.tsx | 37 ++++++-------------------------------
 1 file changed, 6 insertions(+), 31 deletions(-)

(limited to 'makima/frontend/src/routes/mesh.tsx')

diff --git a/makima/frontend/src/routes/mesh.tsx b/makima/frontend/src/routes/mesh.tsx
index f210227..362b2e0 100644
--- a/makima/frontend/src/routes/mesh.tsx
+++ b/makima/frontend/src/routes/mesh.tsx
@@ -4,11 +4,10 @@ import { Masthead } from "../components/Masthead";
 import { TaskList } from "../components/mesh/TaskList";
 import { TaskDetail } from "../components/mesh/TaskDetail";
 import { TaskOutput } from "../components/mesh/TaskOutput";
-import { UnifiedMeshChatInput } from "../components/mesh/UnifiedMeshChatInput";
 import { ContractCompleteQuestion } from "../components/mesh/ContractCompleteQuestion";
 import { useTasks } from "../hooks/useTasks";
 import { useTaskSubscription, type TaskUpdateEvent, type TaskOutputEvent } from "../hooks/useTaskSubscription";
-import type { TaskWithSubtasks, MeshChatContext, ContractSummary, ContractWithRelations, DaemonDirectory, TaskSummary, RepositoryHistoryEntry } from "../lib/api";
+import type { TaskWithSubtasks, ContractSummary, ContractWithRelations, DaemonDirectory, TaskSummary, RepositoryHistoryEntry } from "../lib/api";
 import { startTask as startTaskApi, stopTask as stopTaskApi, getTaskOutput, listContracts, getContract, getDaemonDirectories, continueTask as continueTaskApi, resumeSupervisor, branchTask, getRepositorySuggestions, getTaskDiff } from "../lib/api";
 import { DirectoryInput } from "../components/mesh/DirectoryInput";
 import { useAuth } from "../contexts/AuthContext";
@@ -650,28 +649,8 @@ export default function MeshPage() {
     setShowRepoSuggestions(false);
   }, []);
 
-  // Callback when task is updated via CLI
-  const handleTaskUpdatedFromCli = useCallback(async () => {
-    if (id) {
-      const updated = await fetchTask(id);
-      if (updated) {
-        setTaskDetail(updated);
-      }
-    }
-    // Also refresh the task list
-    fetchTasks();
-  }, [id, fetchTask, fetchTasks]);
-
-  // Calculate chat context based on current view
-  const chatContext: MeshChatContext = useMemo(() => {
-    if (!id) {
-      return { type: "mesh" };
-    }
-    if (taskDetail?.parentTaskId) {
-      return { type: "subtask", taskId: id, parentTaskId: taskDetail.parentTaskId };
-    }
-    return { type: "task", taskId: id };
-  }, [id, taskDetail?.parentTaskId]);
+  // handleTaskUpdatedFromCli + chatContext drove the deleted
+  // UnifiedMeshChatInput; gone with the LLM module.
 
   // Handle resizing of the split panel
   const handleResizeStart = useCallback((e: MouseEvent) => {
@@ -904,13 +883,9 @@ export default function MeshPage() {
             </div>
           )}
 
-          {/* Mesh Chat Input - always rendered to persist state across navigation */}
-          <div className="shrink-0">
-            <UnifiedMeshChatInput
-              context={chatContext}
-              onUpdate={id ? handleTaskUpdatedFromCli : fetchTasks}
-            />
-          </div>
+          {/* UnifiedMeshChatInput removed alongside the LLM module. The
+              mesh page is now a pure task viewer; spawning / editing
+              tasks via natural language chat went with LLM removal. */}
         </div>
       </main>
 
-- 
cgit v1.2.3

