Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
perf: strip tool-result content from task_message storage
Gusc68a84064782
diff --git a/scripts/cleanup-tool-result-content.sh b/scripts/cleanup-tool-result-content.shnew file mode 100755index 000000000..84bcbf55c--- /dev/null+++ b/scripts/cleanup-tool-result-content.sh@@ -0,0 +1,50 @@+#!/bin/bash+# Bulk clear content/output/input from 'tool-result' rows in task_message table (batches of 50k)+# The record is kept (for audit trail) but the payload is zeroed out to save space.+# Run from repo root: bash scripts/cleanup-tool-result-content.sh++cd "$(dirname "$0")/../src/web"++BATCH=10000+TOTAL_UPDATED=0++while true; do+ echo "Updating batch of $BATCH rows..."+ RESULT=$(npx wrangler d1 execute alook-app --remote --json --command \+ "UPDATE task_message SET content = '', output = '', input = NULL WHERE type = 'tool-result' AND (content != '' OR output != '' OR input IS NOT NULL) LIMIT $BATCH;" 2>&1)++ if [ $? -ne 0 ]; then+ echo "Wrangler command failed. Output:"+ echo "$RESULT"+ echo "Waiting 30s before retry..."+ sleep 30+ continue+ fi++ if echo "$RESULT" | grep -q '"error"'; then+ echo "D1 error detected, waiting 30s before retry..."+ echo "$RESULT"+ sleep 30+ continue+ fi++ CHANGES=$(echo "$RESULT" | grep -o '"changes":[[:space:]]*[0-9]*' | head -1 | grep -o '[0-9]*' || true)++ if [ -z "$CHANGES" ]; then+ echo "Could not parse changes from response:"+ echo "$RESULT"+ echo "Waiting 10s before retry..."+ sleep 10+ continue+ fi++ TOTAL_UPDATED=$((TOTAL_UPDATED + CHANGES))+ echo "Updated $CHANGES rows (total: $TOTAL_UPDATED)"++ if [ "$CHANGES" -lt "$BATCH" ]; then+ echo "Done! Total updated: $TOTAL_UPDATED"+ break+ fi++ sleep 5+donediff --git a/src/cli/daemon/session-runner.ts b/src/cli/daemon/session-runner.tsindex 0765b1bc0..23cbb90ae 100644--- a/src/cli/daemon/session-runner.ts+++ b/src/cli/daemon/session-runner.ts@@ -428,9 +428,9 @@ export async function runSession(input: SessionRunnerInput): Promise<void> {type: msg.type,tool: msg.tool,call_id: msg.callId,- content: msg.content,- input: msg.input,- output: msg.output,+ content: msg.type === "tool-result" ? "" : msg.content,+ input: msg.type === "tool-result" ? undefined : msg.input,+ output: msg.type === "tool-result" ? "" : msg.output,});// Timeline — record assistant text messagesdiff --git a/src/web/src/app/api/daemon/tasks/[taskId]/messages/route.ts b/src/web/src/app/api/daemon/tasks/[taskId]/messages/route.tsindex c93fe5fdc..f4f04341e 100644--- a/src/web/src/app/api/daemon/tasks/[taskId]/messages/route.ts+++ b/src/web/src/app/api/daemon/tasks/[taskId]/messages/route.ts@@ -61,9 +61,9 @@ export const POST = withAuth(async (req: NextRequest, ctx) => {type: m.type,tool: m.tool || "",callId: m.call_id || "",- content: m.content || "",- input: m.input,- output: m.output || "",+ content: m.type === "tool-result" ? "" : (m.content || ""),+ input: m.type === "tool-result" ? undefined : m.input,+ output: m.type === "tool-result" ? "" : (m.output || ""),})));