Skip to content

Instantly share code, notes, and snippets.

View odysseus0's full-sized avatar
🎯
Focusing

George Zhang odysseus0

🎯
Focusing
View GitHub Profile
@odysseus0
odysseus0 / AI Agent State Synchronization - Context and Filesystem.md
Created June 28, 2025 22:39
AI Agent State Synchronization: Context and Filesystem

AI Agent State Synchronization: Context and Filesystem

The Problem

When coding with AI agents, we need the ability to roll back mistakes - both the conversation context AND the filesystem changes need to revert together.

Current state: We can manually revert files (git), and we can revert conversation context, but these are separate operations that can leave the agent's understanding out of sync with actual files.

The Initial Thought: Just Use Git?

@odysseus0
odysseus0 / Git-Inspired Context Management for AI Agents.md
Created June 28, 2025 22:39
Git-Inspired Context Management for AI Agents

Git-Inspired Context Management for AI Agents

The Core Analogy

Git and AI agent conversations face the same fundamental challenge: managing branching threads of work that must be merged back together.

The key insight: Think of git as if it only had commit messages, no file changes. This is exactly what AI conversation management needs - a way to branch, merge, and rebase pure conversation history. The vocabulary and mental models from git can illuminate context management for AI agents.

Precise Mappings (Git Without Files)

@odysseus0
odysseus0 / Selective Context Compaction for Claude Code.md
Created June 28, 2025 22:39
Selective Context Compaction for Claude Code - Feature Proposal

Selective Context Compaction for Claude Code

The Problem

Effective AI agent performance depends on maintaining high signal-to-noise ratio in the context window. Even with large contexts, noise degrades performance.

Claude Code currently offers only "Compact" - a nuclear option that rebuilds the entire conversation from scratch. This is like having only git rebase -i --root when you often just need git rebase -i HEAD~5.

The Git Analogy

@odysseus0
odysseus0 / async-agents-design-doc.md
Last active July 1, 2025 03:28
Async Agent Architecture - Design and Exploration

Non-blocking Tasks for Claude Code - V1 Design

Overview

This design makes Claude Code more responsive by allowing the main agent to continue working while background tasks run. Currently, when Claude spawns multiple long-running tasks, everything freezes - the agent can't continue working on other things, and you can't interact with it. With this change, Claude can process results as they arrive, continue working on independent tasks, and remain available for user interaction.

Background: Understanding Claude Code

To understand the problem and solution, you need to know how Claude Code works today.

@odysseus0
odysseus0 / gist_blog_post.md
Created June 20, 2025 10:43
How a Hotel WiFi Taught Me That Happy Eyeballs Can't See Everything

How a Hotel WiFi Taught Me That Happy Eyeballs Can't See Everything

Or: The Empty Error String That Led Me Down a Rabbit Hole of Broken Networks

TL;DR: httpx AsyncClient was failing with empty error messages. After hours of debugging, I discovered a hotel WiFi firewall that accepts IPv6 TCP connections but kills them during TLS handshake - an edge case so specific it defeats Happy Eyeballs and every other protection mechanism.

It started with the most frustrating error message I've ever seen:

{"detail":"An error occurred while requesting TikAPI: "}
@odysseus0
odysseus0 / gist_test_tikapi_ipv6_issue_raw.py
Created June 20, 2025 09:51
Test TikAPI IPv6 issue - Raw investigation script
#!/usr/bin/env python3
"""
Demonstrate how unusual TikAPI's IPv6 behavior is compared to other services.
"""
import asyncio
import socket
import ssl
import time
@odysseus0
odysseus0 / gist_check_environment.py
Created June 20, 2025 09:51
Environment checker - System IPv6 capability analysis
#!/usr/bin/env python3
"""
Check why httpx AsyncClient works on some machines but not others
This will help identify environment differences
"""
import socket
import subprocess
import platform
import asyncio
@odysseus0
odysseus0 / gist_phase1_dns_resolution.py
Created June 20, 2025 09:51
DNS resolution analysis - IPv4 vs IPv6 investigation
#!/usr/bin/env python3
"""
Phase 1: Network-Level Deep Dive - DNS Resolution Testing
Tests DNS resolution behavior and IPv4/IPv6 connectivity
"""
import asyncio
import httpx
import socket
import ssl
@odysseus0
odysseus0 / gist_phase1_network_capture.py
Created June 20, 2025 09:51
Network capture analysis - Deep dive into socket operations
#!/usr/bin/env python3
"""
Phase 1: Network-Level Deep Dive - Packet Capture Analysis
Captures and compares network behavior between sync and async httpx clients
"""
import asyncio
import httpx
import socket
import ssl
@odysseus0
odysseus0 / gist_test_alternatives.py
Created June 20, 2025 09:51
Test alternative HTTP clients - aiohttp verification
#!/usr/bin/env python3
import asyncio
import aiohttp
import json
async def test_tikapi_aiohttp():
"""Test TikAPI using aiohttp instead of httpx."""
print("🧪 Testing TikAPI with aiohttp...")