Skip to content

Instantly share code, notes, and snippets.

@christophermark
christophermark / task-delegation-system.md
Last active July 17, 2026 16:08
Claude Code task delegation system — Fable orchestrator routing to Sonnet subagents + Codex CLI

Claude Code Task Delegation System — Implementation Plan

Audience: an implementing agent (Claude Code or similar) running on any machine. Goal: set up a delegation system for Claude Code where a premium main-loop model (Fable 5 / Opus) acts as orchestrator and routes work to cheaper Claude subagents and to the Codex CLI — expanding the main thread's capability by keeping bulk tool output out of its context window, not by dumbing it down.

Verified against: Claude Code v2.1.205 and Codex CLI v0.142.5 on macOS, July 2026. Every codex exec flag and config key used here was checked against the

@christophermark
christophermark / codex_delegation_claude_code.md
Last active July 9, 2026 16:12
Codex Delegation - Claude Code
> **Update (2026-07-09, second revision):** After a live delegation shakedown, the wrapper now emits a one-line provenance record (`codex-delegate: mode=… model=… effort=…`) to stderr on success — falling back to the `~/.codex/config.toml` default when `--model` isn't passed — so the orchestrator can attribute results to the model actually used without reading the Codex config. The embedded wrapper below has also been synced wholesale to the successor's current revision — adding the `--network` flag for write mode and hardened argument parsing (a missing option value now prints usage instead of dying silently) — so installing from this gist yields the same script as the successor plan.
>
> **Update (2026-07-09):** Fixed for how non-interactive `codex exec` actually behaves (verified against codex-cli 0.142.5): write mode previously used `approval_policy="on-request"` plus `approvals_reviewer="auto_review"`, but non-interactive runs have no surface to answer approval prompts (requests fail) and `approva
@christophermark
christophermark / fable_delegation.md
Last active July 9, 2026 16:04
Fable Delegation

Update (2026-07-09, second revision): After a live six-lane shakedown, File 4's Explore prompt now ends with an explicit report-back rule — a background Explore was observed completing its search but going idle without delivering its brief until nudged via SendMessage.

Update (2026-07-09): Added File 4, an Explore override pinned to Sonnet. Since Claude Code v2.1.198 the built-in Explore agent inherits the main session's model (capped at Opus) — so on a premium main-loop model, codebase exploration silently runs at premium prices unless overridden. Sonnet rather than Haiku is deliberate: exploration results are navigation ground truth for the orchestrator, and a smaller model's silent false negatives ("no other call sites exist") are exactly the failure mode that degrades the main thread. A fuller successor setup (adds a fresh-context verifier, persistent agent memory, and a hardened Codex bridge) lives at https://gist.github.com/christophermark/50e0487fce92d7de176bdc8bb5c8ea5e

Set up my pe

@christophermark
christophermark / set_mac_screeenshot_location.md
Last active February 20, 2026 01:13
Set Mac Screenshot Folder

Change the directory where screenshots are saved on Mac

mkdir ~/Screenshots
defaults write com.apple.screencapture location ~/Screenshots
@christophermark
christophermark / withAlpha.ts
Created December 18, 2025 18:43
makeHexTransparent
/**
* Adds transparency to a hex color by appending an alpha value.
*
* @param hexColor - A 6-digit hex color string (e.g., '#C1E38C' or 'C1E38C')
* @param alpha - A number between 0 (fully transparent) and 1 (fully opaque)
* @returns An 8-digit hex color string with the alpha value appended
*
* @example
* withAlpha('#C1E38C', 0.4) // Returns '#C1E38C66'
* withAlpha('#FF0000', 0.5) // Returns '#FF000080'
@christophermark
christophermark / gist:9f9706cd1620aa7d0f9cd990f3febecf
Created May 22, 2025 16:26
Git reset but keep commit message
1. Prevent losing the message in the first place
If you know ahead of time that you want to “undo” a commit without losing either your changes or your commit message, use soft reset:
# Move HEAD one commit back, but keep index & working-tree untouched
git reset --soft HEAD~1
• What it does
• HEAD moves to the previous commit
• Your index (staging area) still contains exactly what you had in that commit
@christophermark
christophermark / rebase-onto
Last active February 10, 2026 20:48
Git Rebase --onto
https://stackoverflow.com/questions/29914052/how-to-git-rebase-a-branch-with-the-onto-command/29916361#29916361
git rebase --onto <newparent> <oldparent>
// Most frequent usage, after base branch is squashed and merged into main
git rebase --onto main [SHA before first commit on your branch]
@christophermark
christophermark / vscode-exclude-tests.txt
Last active February 21, 2025 22:48
VSCode Exclude Test Files
// Exclude test files from VSCode searches
**/*.test.*
@christophermark
christophermark / setIosVersion.sh
Last active January 9, 2024 13:13
Shell script to set the iOS version of a project
# Prints out the iOS version number
printIosVersion() {
sed -n 'N;s/.*CFBundleShortVersionString.*>\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' ios/Compass/Info.plist
}
# Sets the iOS version number
#
# {$1} The new version number to set
###### Documentation ######
# sed -i '' ' # -i '' will modify the file and save it
@christophermark
christophermark / jestSetSystemTime.js
Created December 7, 2020 19:38
Forcing system time for jest tests
/**
* Set the system time for our tests.
* This ensures that our tests can't fail based on the local time of the CI machine.
* This guards against app code where the behavior changes based on the device time.
* For example, a test might fail if we attempt to set the search time "before now".
*/
beforeAll(() => {
// @TODO: 'modern' is default once we upgrade to Jest 27 https://jestjs.io/blog/2020/05/05/jest-26#new-fake-timers
jest.useFakeTimers("modern");
const JS_DATE_11_AM = new Date(new Date().setHours(11, 0, 0, 0));