From c07d13059b7da158898d1f5c6449eeb7f7367815 Mon Sep 17 00:00:00 2001 From: Cameron Pfiffer Date: Sun, 8 Mar 2026 23:15:57 -0700 Subject: [PATCH] fix: relocate ingest-thread output to /tmp/ to prevent Letta context window bloat --- src/void_tools/cli.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/void_tools/cli.py b/src/void_tools/cli.py index d3b5407..0c80781 100644 --- a/src/void_tools/cli.py +++ b/src/void_tools/cli.py @@ -711,18 +711,17 @@ def cmd_ingest_thread(args): response = client.app.bsky.feed.get_post_thread({'uri': args.uri, 'depth': args.depth, 'parent_height': 100}) thread = response.thread - agent_id = os.getenv("AGENT_ID") - if not agent_id: - print("Error: AGENT_ID not set in environment.", file=sys.stderr) - sys.exit(1) - - memfs_threads_dir = os.path.expanduser(f"~/.letta/agents/{agent_id}/memory/threads") - os.makedirs(memfs_threads_dir, exist_ok=True) + import tempfile + import datetime + + # Save to temporary directory to prevent Letta context window bloat + threads_dir = "/tmp/void_ingested_threads" + os.makedirs(threads_dir, exist_ok=True) # Extract post ID from URI for filename post_id = args.uri.split('/')[-1] timestamp = datetime.datetime.now(datetime.UTC).strftime('%Y%m%d_%H%M%S') - filename = os.path.join(memfs_threads_dir, f"thread_{post_id}_{timestamp}.md") + filename = os.path.join(threads_dir, f"thread_{post_id}_{timestamp}.md") def format_thread_node(node, level=0): content = "" -- 2.51.2