惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
S
Securelist
GbyAI
GbyAI
The Register - Security
The Register - Security
B
Blog
Recorded Future
Recorded Future
D
DataBreaches.Net
C
Cybersecurity and Infrastructure Security Agency CISA
A
About on SuperTechFans
C
CERT Recently Published Vulnerability Notes
T
The Blog of Author Tim Ferriss
Vercel News
Vercel News
Google DeepMind News
Google DeepMind News
S
Schneier on Security
S
SegmentFault 最新的问题
Martin Fowler
Martin Fowler
T
Tenable Blog
T
The Exploit Database - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
宝玉的分享
宝玉的分享
AWS News Blog
AWS News Blog
L
Lohrmann on Cybersecurity
Spread Privacy
Spread Privacy
N
News | PayPal Newsroom
Engineering at Meta
Engineering at Meta
T
Tor Project blog
The Hacker News
The Hacker News
量子位
酷 壳 – CoolShell
酷 壳 – CoolShell
MongoDB | Blog
MongoDB | Blog
Cyberwarzone
Cyberwarzone
Security Archives - TechRepublic
Security Archives - TechRepublic
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Threatpost
WordPress大学
WordPress大学
Google Online Security Blog
Google Online Security Blog
G
GRAHAM CLULEY
Google DeepMind News
Google DeepMind News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Attack and Defense Labs
Attack and Defense Labs
N
Netflix TechBlog - Medium
SecWiki News
SecWiki News
Hacker News: Ask HN
Hacker News: Ask HN
M
MIT News - Artificial intelligence
Scott Helme
Scott Helme
Microsoft Security Blog
Microsoft Security Blog
H
Help Net Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org

Hacker News: Show HN

PurrrrrFocus: Pomodoro Timer App - App Store Workflow Engine — Multi-Step Orchestration for Bun RapidPhoto: Pro Photo Editor App - App Store GitHub - DheerG/swarms: Achieve extraordinary results with claude code across a variety of tasks SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads Show HN: VCoding – A 5 MB native Windows IDE with no dynamic dependencies Show HN: LLMs don't hallucinate because they're bad at math, it's the format GitHub - Agent-FM/agentfm-core: AgentFM is a peer-to-peer network that turns everyday computers into a decentralized AI supercomputer. AgentFM lets you run massive AI workloads directly across a global mesh of idle CPUs and GPUs. Show HN: Tracking Top US Science Olympiad Alumni over Last 25 Years GitHub - Potarix/agent-hub: One place to talk to all your agents Show HN: Runtime security for AI agents(injection,tool abuse, data exfiltration) GitHub - dubeyKartikay/lazyspotify: Terminal Spotify client for macOS and Linux GitHub - the-banana-tool/king-louie: Easy to use GUI Personal AI Assistant. Win/Linux/Mac. Show HN I made my vacation rental bookable by AI agents–no Airbnb, 0% commission GitHub - basteez/jsf-autoreload: maven plugin to enable hot reload on jsf projects uvm32/hosts/host-gdbstub at main · ringtailsoftware/uvm32 GitHub - labsai/EDDI: Config-driven engine that turns JSON into production-grade AI agents. Multi-agent orchestration, 12+ LLM providers, MCP/A2A protocols, RAG, persistent memory, and enterprise compliance (EU AI Act, GDPR, HIPAA). Built on Quarkus. GitHub - glitchnsec/fortyone-oss: AI Executive Assistant Platform Quickstart | Alien GitHub - muxshed/shed: One stream in, or many. Every destination, simultaneously. No cloud middleman, no per-channel fees, no limits. GitHub - ocrbase-hq/ocrbase: 📄 PDF/IMG ->.MD/JSON Document OCR API for PaddleOCR and GLMOCR. Self-hostable. GitHub - impactjo/home-memory: MCP server that lets your AI assistant remember everything about your home. GitHub - Sets88/dbcls: DbCls is a powerful terminal database client that supports various databases GitHub - neptun2000/heor-agent-mcp GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh RollQuation: Math Puzzles - Apps on Google Play GitHub - dropbox/witchcraft Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis GitHub - opentalon/opentalon: OpenTalon is an open-source platform built from the ground up in Go as a robust alternative to OpenClaw LinkedIn™ 职位抓取工具 - Chrome 应用商店 GitHub - EdoardoBambini/Agent-Armor-Iaga: AI agents are getting tool access — shell, file system, databases, APIs, secrets. But **nobody is governing what they actually do with it**. Frameworks like LangChain, CrewAI, AutoGen, and Claude Code give agents the power to execute. Agent Armor gives you the power to control, audit, and approve every single action before it happens. HN Vibes — Week 15, Apr 7–13 2026 GitHub - chojs23/ec: Easy terminal-native 3-way git mergetool vim-like workflow GitHub - SethPyle376/hiraeth: Local AWS emulator focused on fast integration testing, with SQS support, SQLite-backed state, and a debug-friendly web UI. GitHub - JakOb-dotcom/cloud-sandbox-security-analysis: Technical analysis and Proof of Concept (PoC) regarding environment variable exfiltration in containerized cloud sandboxes via side-channel data leaks. Springboards - Flint Alpha Show HN: A simpler coding agent harness GitHub - audiodude/sudomake-friends GitHub - 256thFission/mini-mythos: OSS clone of Anthropic’s Mythos harness to locate C/C++ memory vulnerabilities Show HN: OpenParallax: OS-level privilege separation for AI agent execution Hacker News Sorted - Chrome 应用商店 Show HN: How to Install Docker on Ubuntu 24.04 LTS: Complete 2026 Guide GitHub - himanshudongre/smriti GitHub - sverrirsig/claude-control: macOS desktop dashboard for monitoring and managing multiple Claude Code sessions GitHub - ory/dockertest: Write better integration tests! Dockertest helps you boot up ephermal docker images for your Go tests with minimal work. Chiral - Chrome 应用商店 Show HN: Two Claudes collaborating through shared memory on a $100 mini-PC GitHub - pmichaillat/latex-cv: Minimalist LaTeX template for academic CVs GitHub - oguzbilgic/posse: A web UI for Anthropic Managed Agents. GitHub - sshiraz/depsly: Dependency risk analysis tool for npm packages ABI Add safari/agent-harness — Safari browser automation via safari-mcp by achiya-automation · Pull Request #212 · HKUDS/CLI-Anything GitHub - Halfblood-Prince/trustcheck: Verify PyPI package attestations and improve Python supply-chain security GitHub - oguzbilgic/kern-ai: Agents that do the work and show it. GitHub - bruits/satteri: High-performance Markdown and MDX processing for the JavaScript ecosystem GitHub - tylergibbs1/feedstock: High-performance web crawler and scraper for TypeScript, powered by Bun and Playwright GitHub - Grimm67123/grimmbot: The self-improving sandboxed and open-source AI agent. With persistent memory and scheduling. GitHub - whitevanillaskies/whitebloom: Local whiteboard that blooms. GitHub - hwdsl2/docker-whisper: Docker image for a self-hosted Whisper speech-to-text server with speaker diarization and OpenAI-compatible transcription and translation APIs. Powered by faster-whisper. Supports all Whisper models, NVIDIA GPU (CUDA) acceleration, JSON/SRT/VTT output, SSE streaming, offline mode, and multi-arch (amd64, arm64). GitHub - yisding/reviewwiggum GitHub - MarwanAlsoltany/serrors: Structured errors for Go: sentinel hierarchies, typed data, custom formatting, and slog integration. GitHub - soatok/age-php GitHub - Luthiraa/markitme GitHub - stagas/rtdiff: realtime git diff gui and AI-assisted commits GitHub - tombedor/excalicharts GitHub - wh1le/excalidraw-edit: Open and edit .excalidraw files from the terminal. Offline, auto-saves to disk. MalExt Sentry - Malicious Extension Scanner - Chrome 应用商店 GitHub - syi0808/asciianimesvg: Generate animated ASCII art SVGs from text. CLI, Rust library, WASM, and web editor. GitHub - zaina-ml/ml_forge: A visual-based graph node editor for training computer vision models. GitHub - anakin87/llm-rl-environments-lil-course: 🌱 A little course on Reinforcement Learning Environments for evaluating and training Language Models GitHub - takaakit/superpowers-uml: Superpowers-UML modifies Superpowers to ensure a software development workflow in which AI agents design through UML modeling. AdriByte Studio - Sviluppo Web e Soluzioni Digitali GitHub - chouligi/angel-copilot: Your personalized Angel Investment Advisor Show HN: MoodSense AI (ML and FastAPI and Gradio, Deployed on Hugging Face) Moodsense Ai - a Hugging Face Space by aman179102 GitHub - agenteractai/lodmem: Level Of Detail Context Management for Agents GitHub - ostefani/subnetlens: A fast, concurrent network scanner with a TUI and plain-text CLI, built in Go. It discovers live hosts on your network, scans their open ports, resolves hostnames, and fingerprints operating systems—delivered. Cyber Pulse: Agentic Intel - Apps on Google Play Whisper API: Self-Hostable Speech to Text Transcription The Agent-Web Protocol Stack: A Research Thesis GitHub - msmarkgu/RelayFreeLLM: A restful API designed to route user prompts to various AI model providers. Show HN: Provepy – A Python decorator that proves your code using Lean and LLMs Show HN: Pardonned.com – A searchable database of US Pardons GitHub - patrickdappollonio/dux: Dux is a terminal UI that lets you run multiple AI coding agents side by side, each in its own git worktree, with full companion terminals, macros, commit generation, and a command palette that knows more tricks than you do. kMC Crystal Simulator Show HN: HyperFlow – A self-improving agent framework built on LangGraph GitHub - stef41/vibescore: 🎵 Grade your vibe-coded project. One command, instant letter grade across security, quality, dependencies, and testing. GitHub - stef41/lmscan: 🔍 Detect AI-generated text and fingerprint which LLM wrote it. Open-source GPTZero alternative. Zero dependencies, works offline. imgur.com GitHub - visionscaper/collabmem: Enabling long-term collaboration with Agentic AI - building up episodic and world model memory over time with in-context awareness 在 Steam 上购买 FriedrichAI: Offline AI 立省 10% GitHub - atripati/ark: AI Runtime Kernel — a context operating system for AI agents. Eliminates tool bloat, loads only what’s needed, and gives LLMs their reasoning space back. GitHub - nowork-studio/toprank: Open-source Claude Code skills for SEO, SEM, Google Ads GitHub - tacomanator/sash: Lightweight macOS menu bar app for reliably cycling through windows of the current application. Appents | Social Media Management for Product-First Teams GitHub - pnhoang/youtube-spam-blocker: Automatically detects and hides spam messages in YouTube Live chat. Set rate limits, keyword filters, and block repeat offenders. GitHub - decisionnode/DecisionNode: CLI + Local MCP - A shared structured memory store across Claude Code, Cursor, Windsurf, Antigravity, and every MCP client. Semantically queryable. GitHub - AvaCodeSolutions/django-email-learning: An open source Django app for creating email-based learning platforms with IMAP integration and React frontend components. The $100K Gap in Kubernetes Security Tooling Function Calling Harness: From 6.75% to 100%
GitHub - lucastononro/tiny-claude-recycler: Tiny lib that integrates to agents sdk by anthropic and recycles your devs oauth token
ltononro · 2026-05-15 · via Hacker News: Show HN

PyPI Python License

Rotate a pool of Claude OAuth subscription tokens. Fall back to a regular Anthropic API key when they're all rate-limited. Zero runtime dependencies.

pip install tiny-claude-recycler
from claude_agent_sdk import query
from tcr import recycler, Secret

recycler.master_key  = Secret("sk-ant-api03-...")
recycler.oauth_keys  = [Secret("sk-ant-oat01-..."), Secret("sk-ant-oat01-...")]

@recycler.cycle(retries=3)
def ask(prompt):
    return query(prompt=prompt)   # SDK reads env on this call, after our swap

That's it. Use claude_agent_sdk (or anthropic) as normal.

What it does on every call

  1. Sets CLAUDE_CODE_OAUTH_TOKEN to the next pool key.
  2. Clears ANTHROPIC_API_KEY and ANTHROPIC_AUTH_TOKEN — both outrank OAuth in Claude Code's auth precedence and would silently override our token.
  3. Runs your function.
  4. On exception → marks the key failed, advances the round-robin cursor, retries up to retries times.
  5. After retries failures → swaps to master (ANTHROPIC_API_KEY set, OAuth cleared) and runs once more.

State (failures, cursor, cooldowns) is preserved on the module-level singleton, so the next call resumes where the last one left off. With 9 keys and retries=3 you naturally burn through them in batches of 3.

API

@recycler.cycle(
    retries            = 3,           # OAuth attempts before master fallback
    fallback_to_master = True,        # False → re-raise the last OAuth error
    cooldown_seconds   = 60.0,        # failed keys are skipped for this long
    exceptions         = (Exception,) # which exceptions trigger cycling
)

Works on def and async def. Inspect / reset:

recycler.state_snapshot()  # {idx: {failures, last_error, cooldown_until, available, ...}}
recycler.reset_state()

Secret redacts its value in repr/str so tokens stay out of tracebacks and logs.

Production tips

Narrow the exception tuple. The default (Exception,) would burn keys on bugs. Use the curated helpers (lazy imports — only load if you call them):

from tcr import anthropic_exceptions, claude_agent_sdk_exceptions

@recycler.cycle(exceptions=anthropic_exceptions())   # 401/403/429/5xx/timeout/conn
def ask(prompt): ...

anthropic_exceptions() is verified against the SDK source: AuthenticationError, PermissionDeniedError, RateLimitError, OverloadedError, InternalServerError, ServiceUnavailableError, DeadlineExceededError, APIConnectionError, APITimeoutError.

Construct your Anthropic client inside the wrapped function (the import itself can be at module top — it's only the Anthropic() call that captures the env var). A long-lived client built before the decorator runs already pinned to whatever key was set at construction time and won't see swaps.

from anthropic import Anthropic            # import: anywhere is fine
from tcr import recycler, anthropic_exceptions

@recycler.cycle(retries=3, exceptions=anthropic_exceptions())
def ask(prompt):
    return Anthropic().messages.create(    # construction: must be inside
        model="claude-opus-4-7",
        max_tokens=1024,
        messages=[{"role": "user", "content": prompt}],
    )

For claude_agent_sdk, this caveat doesn't apply — every query(...) call spawns a fresh subprocess that reads env at spawn time.

Known sharp edges (it's a little sketchy, by design)

  • Process-global env. Two decorated calls running concurrently across threads can race on CLAUDE_CODE_OAUTH_TOKEN. Either serialize Claude calls, or run one event loop / thread.
  • apiKeyHelper in ~/.claude/settings.json outranks OAuth and can't be cleared from env. If you use one, the recycler is a no-op for claude_agent_sdk.
  • Bedrock/Vertex/Foundry flags route requests away from Anthropic entirely. Don't set those if you want the recycler to do anything.
  • No proactive quota check. Anthropic doesn't expose subscription consumption via the API; this lib reacts to failures, it can't predict them.

How it works, in detail

The state model

Each OAuth key has a KeyState record:

KeyState:
    failures: int           # total times this key has failed
    last_failure_at: float  # epoch seconds of the most recent failure
    last_error: str         # repr() of the last exception (for debugging)
    cooldown_until: float   # epoch seconds; key is unavailable until then

A key is available for selection iff now >= cooldown_until. Default cooldown_until is 0.0, so a fresh key is always available.

Plus two pieces of recycler-wide state:

  • cursor — an integer index pointing at the next OAuth key to try (round-robin)
  • master_key — the Secret-wrapped ANTHROPIC_API_KEY used as last resort

All of this lives on the module-level recycler singleton, so state persists across calls of any function you decorate.

What cooldown_seconds is for

When a key fails, the decorator stamps key.cooldown_until = time.time() + cooldown_seconds. During that window, _pick_next_available simply skips it.

Without a cooldown, this happens:

Call 1: key 0 fails, key 1 fails, key 2 fails → master
Call 2: key 0 fails again (still listed as available!), ...

You'd thrash on dead keys forever. The cooldown is what lets calls 1 and 2 actually make progress through the pool:

Call 1: key 0 fails → cooldown=60s, key 1 fails → cooldown=60s, key 2 fails → cooldown=60s → master
Call 2 (5s later): cursor=3, key 3 is available → uses it → success

Default is 60.0. Tune up for permanent failures (e.g. revoked tokens), down for transient blips:

Failure type Suggested cooldown
AuthenticationError (401) — token revoked 3600+ — the key is dead until manually rotated
RateLimitError (429) — subscription window hit 300–600 — wait for window reset
APIConnectionError / APITimeoutError — network blip 10–30 — likely transient

You can layer this with multiple decorators on different code paths if you want different policies.

Per-call flow

For each call to a decorated function:

for attempt in range(retries):
    1. _pick_next_available()       # round-robin from cursor, skip cooled-down
       └─ returns None? → break to master
    2. _activate_oauth(idx)         # set CLAUDE_CODE_OAUTH_TOKEN,
                                    # clear ANTHROPIC_API_KEY + ANTHROPIC_AUTH_TOKEN
    3. fn(*args, **kwargs)
       └─ success?   → return value, cursor stays put
       └─ failure?   → _record_failure(idx)  (failures += 1, cooldown_until = now + N)
                       _advance_cursor()     (cursor = (cursor + 1) % len(keys))

# loop exhausted or no keys available
_activate_master()                  # set ANTHROPIC_API_KEY, clear OAuth + AUTH_TOKEN
return fn(*args, **kwargs)          # one final attempt; if it raises, raise

Key behaviors:

  • On success → cursor doesn't move. A working key keeps being used. (Anthropic's 5-hour OAuth window means sticky-key behavior is what you want until the window closes.)
  • On failure → cursor advances. Combined with cooldown, this gives the "batches of 3 of 9" pattern.
  • Non-matching exception → propagates immediately. If you pass exceptions=(RateLimitError,) and your code raises a TypeError, the recycler doesn't mark the key failed and doesn't retry. This is the guardrail against bugs draining your pool.

Worked example — 9 OAuth keys, retries=3, cooldown_seconds=60

Call 1, t=0 — outage in progress:

attempt 1: cursor=0, key 0 available → fails    → key0.cooldown_until=60,  cursor→1
attempt 2: cursor=1, key 1 available → fails    → key1.cooldown_until=60,  cursor→2
attempt 3: cursor=2, key 2 available → fails    → key2.cooldown_until=60,  cursor→3
retries exhausted → activate master → success ✅

State after: keys 0,1,2 cooling until t=60. Cursor=3.

Call 2, t=5:

attempt 1: cursor=3, key 3 available → success ✅

Master is not used. Cursor stays at 3.

Call 3, t=10 — outage still ongoing, key 3 starts failing:

attempt 1: key 3 fails → cooldown_until=70, cursor→4
attempt 2: key 4 fails → cooldown_until=70, cursor→5
attempt 3: key 5 fails → cooldown_until=70, cursor→6
master ✅

Call 4, t=15: cursor=6, key 6 → success ✅. You've now naturally walked through 6 keys in batches of 3 without ever retrying a failed one.

Call 5, t=65 — keys 0,1,2 self-heal (their cooldown_until=60 < now=65). They re-enter the rotation automatically once the cursor passes them again.

Auth env-var swap, exactly

Per Claude Code's auth precedence (highest → lowest):

  1. CLAUDE_CODE_USE_BEDROCK / _VERTEX / _FOUNDRY — cloud provider routing (recycler ignores; if set, your requests don't go to Anthropic at all)
  2. ANTHROPIC_AUTH_TOKENAuthorization: Bearer ... header (proxy / gateway)
  3. ANTHROPIC_API_KEYX-Api-Key header
  4. apiKeyHelper in ~/.claude/settings.json — script-based (recycler cannot clear this from env)
  5. CLAUDE_CODE_OAUTH_TOKEN — what our pool uses

So when activating an OAuth key, the recycler must clear both ANTHROPIC_AUTH_TOKEN and ANTHROPIC_API_KEY — otherwise either of them silently overrides our token and your OAuth pool does nothing.

def _activate_oauth(idx):
    os.environ["CLAUDE_CODE_OAUTH_TOKEN"] = oauth_keys[idx].get()
    os.environ.pop("ANTHROPIC_AUTH_TOKEN", None)
    os.environ.pop("ANTHROPIC_API_KEY",   None)

def _activate_master():
    os.environ["ANTHROPIC_API_KEY"]       = master_key.get()
    os.environ.pop("CLAUDE_CODE_OAUTH_TOKEN", None)
    os.environ.pop("ANTHROPIC_AUTH_TOKEN",    None)

Concurrency note

os.environ is process-global. If two decorated functions run concurrently in different threads, they can race: thread A sets key 3, thread B overwrites with key 5, thread A's request goes out with key 5. There is no clean way around this short of serializing all Claude calls or running one event loop per process.

The lock in Recycler is held only for state mutations and env-var swaps (microseconds) — it is never held across your function call. This keeps the async path truly non-blocking but accepts the env-race for the sake of speed. If you need bulletproof concurrent rotation, drive the rotation yourself by reading recycler.oauth_keys and passing each key explicitly to a fresh Anthropic(api_key=...) client.

Inspecting state

recycler.state_snapshot()
# {
#   0: {'failures': 3, 'last_error': "RateLimitError(...)",
#       'last_failure_at': 1778791520.87,
#       'cooldown_until': 1778791580.87, 'available': False},
#   1: {'failures': 0, 'last_error': None,
#       'cooldown_until': 0.0, 'available': True},
#   ...
# }

recycler.reset_state()   # wipe failures + cooldowns, cursor → 0

Pair this with a debug log or /metrics endpoint to see which keys are healthy.

Development

git clone https://github.com/lucastononro/tiny-claude-recycler
cd tiny-claude-recycler
pip install -e ".[dev]"
pytest