Skip to content

Instantly share code, notes, and snippets.

@myobie
myobie / pty-claude-launcher.sh
Created June 23, 2026 20:19
Wrapper for launching Claude Code under detached pty (e.g. pty up) — bootstraps the session jsonl via --print on first run since detached pty interactive doesn't trigger persistence init. See https://gist.github.com/myobie/1505d47f9e805534d07ff721ca38557f for the bug context.
#!/bin/sh
# pty-claude-launcher.sh — start or resume a pinned-id claude session
# under a detached pty (e.g. `pty up`), bootstrapping the transcript
# jsonl via `claude --print` on first run.
#
# Why: under detached pty + scripted interaction, claude's interactive
# init never creates `~/.claude/projects/<sanitized-cwd>/<uuid>.jsonl`,
# so a `--session-id <new-uuid>` fallthrough silently runs in-memory
# only and loses everything on shutdown. `--print` hits a different
# code path that always writes the jsonl. Subsequent `--resume <uuid>`
@myobie
myobie / cc-persist-bug-report.md
Last active June 23, 2026 12:18
Claude Code: interactive session under @myobie/pty silently never persists conversation to disk

Claude Code: interactive session under pty silently never persists conversation to disk

Claude Code version: 2.1.186 OS: macOS 25.4.0 (Darwin) Environment: @myobie/pty (a tmux-shaped session manager) — confirmed NOT in tmux/psmux, and NOT in @myobie/pty-layout's --tmux mode (which explicitly sets TMUX / TMUX_PANE for Claude Code interop — see the Update section below).

Symptom

An interactive Claude Code session launched via pty up <dir> (against a pty.toml declaring a [sessions.claude] block) runs normally — tool calls work, MCP servers connect, channel notifications surface, multi-turn conversations complete cleanly — but the conversation transcript is never written to ~/.claude/projects/<encoded-cwd>/<session-id>.jsonl. The project directory is never created at all.

@myobie
myobie / agent-onboarding.md
Last active May 14, 2026 22:51
Onboarding a Claude Code agent into coord — the recipe
date 2026-05-14
audience humans onboarding a new agent into coord
status living doc — update as workflow evolves

Onboarding an agent into coord (Claude Code edition)

The recipe for taking a Claude Code agent (running as a pty session) and making it a first-class coord participant — visible in coord members, able to send/receive channel messages, running the boot ritual on every resume.

@myobie
myobie / SKILL.md
Created March 24, 2026 12:47
Codex CLI plugin for Claude Code
name review
description Run consistent, findings-first code reviews with Codex CLI for any target: uncommitted/dirty working tree, current branch vs base branch, specific commit SHA, or pull request. Use when asked to review bugs, risks, regressions, and test gaps with actionable file/line findings.

Codex Review

Execute one-shot code review flows with Codex CLI and return review-quality findings.

1) Select review mode

@myobie
myobie / CCMAILBOX.md
Created March 17, 2026 14:33
ccmailbox pattern — just files + a real Claude Code session for async bidirectional communication

ccmailbox pattern

Just files + a real Claude Code session. A folder with simple conventions that gives any local process fully async conversational, bidirectional communication with a running Claude Code session. No special hooks, no SDK, no patches. The Claude Code session continues to work, is not blocked, you can still work there too.

How it works

  1. Agree on the folder location. The local process (web server?) sees all files Claude Code wrote into the folder.
  2. The local process writes a file to requests/ (the mailbox folder) (web server can expose a POST so any browser can make new requests at any time)
  3. CronCreate inside Claude Code polls the mailbox folder every minute
  4. Claude reads the request, does work, and writes/edits files on disk into the folder
@myobie
myobie / SKILL.md
Created March 17, 2026 11:48
Literate PR Review — Claude Code SKILL file for interactive code review with diffs, web UI, and comment monitoring
name literate-review
description Use when the user wants to review code changes interactively. Uses literate markdown documents served in a local web app. Works with one repo or many. Triggers on: 'review PR', 'review branch', 'review changes', 'literate review', 'set up a review', 'create review docs', 'review these branches'. Generates topic-organized markdown files with inline diffs and surrounding context, serves them with syntax highlighting and inline commenting, and watches for reviewer comments that the current Claude Code session can respond to.

Literate PR Review

Generate a topic-organized code review experience for changes in one or more git repositories. The output is a set of .diff and literate markdown files served in a local web app where reviewers can leave inline comments that Claude watches and responds to. Works equally well for a single branch in one repo or coordinated changes across many repos.

Overview

export function saveURLToDisk(url: URL | string, name: string) {
const anchor = document.createElement('a')
anchor.href = url.toString()
anchor.download = name
anchor.click()
requestAnimationFrame(() => {
anchor.remove()
})
}
@myobie
myobie / reactive-text-node.js
Created December 8, 2024 09:00
An example used in my blog post at https://nathanherald.com/
export function reactiveTextNode(signal) {
const node = document.createTextNode(signal.value)
effect(() => {
node.textContent = signal.value
})
return node
}
@myobie
myobie / convert-flacs-to-alacs.sh
Last active June 15, 2024 07:44
Convert .flac to alac .m4a's because of Apple
#!/bin/bash
mkdir -p alac
for flac_file in ./*.flac; do
base_name=$(basename "$flac_file" .flac)
alac_file="./alac/$base_name.m4a"
echo ffmpeg -i "$flac_file" -map 0:a -c:a alac "$alac_file"
ffmpeg -i "$flac_file" -map 0:a -c:a alac "$alac_file"
done
@myobie
myobie / dot-env
Created June 4, 2024 08:08
Using 1password to inject ENV vars into the current shell from .env.* files
#!/bin/bash
# Usage: eval "$(bin/dot-env)"
set -eo pipefail
PROJECT=$(git rev-parse --show-toplevel)
for f in ${PROJECT}/.env.*; do
echo "# ${f}"