Skip to content

Instantly share code, notes, and snippets.

View mgreenly's full-sized avatar

Michael Greenly mgreenly

View GitHub Profile
@mgreenly
mgreenly / gist:9b820d855a8467c434d433921895f43f
Created July 1, 2026 16:25
A continue, next, done ralph loop in codex with the /goal command
/goal Cycle the prompt sequence gather -> build -> verify (verify wraps back to gather),
starting at gather, until a subagent returns a DONE status. For each step, spawn a
Codex subagent to read and execute the current prompt file
(./project/prompts/{gather,build,verify}.md); it ends by emitting a single JSON
object of the form {"status": ..., "message": ...}. Parse its "status" and relay
its "message" so progress stays visible. CONTINUE -- re-run the same prompt file.
NEXT -- advance to the next prompt file (verify wraps to gather). DONE -- stop. If
a subagent fails, or its final output is not a JSON object carrying a "status" of
exactly CONTINUE, NEXT, or DONE, stop and surface the raw output -- never guess a
status. You are only the orchestrator -- never read the prompt files yourself;
@mgreenly
mgreenly / gist:504b1f90d460841b1628502687e87cb8
Created July 1, 2026 16:25
A continue, next, done ralph loop in codex with the /goal command (external cursor)
/goal Advance the gather -> build -> verify prompt cycle until DONE (verify wraps
back to gather), using ./project/prompts/cursor.md as the durable current-step
marker. Each iteration: read cursor.md for the current step; if it is missing or
empty, the current step is gather. Spawn a Codex subagent to read and execute that
step's prompt file (./project/prompts/{gather,build,verify}.md); it ends by
emitting a single JSON object of the form {"status": ..., "message": ...}. Parse
its "status" and relay its "message" so progress stays visible, then act:
CONTINUE -- leave cursor.md unchanged and continue the goal with the same step.
NEXT -- write the next step in the cycle to cursor.md and continue the goal.
DONE -- delete cursor.md and stop the goal. If a subagent fails, or its final
@mgreenly
mgreenly / prompt.txt
Last active July 1, 2026 16:23
A continue, next, done ralph loop in claude code with the /goal command
/goal Cycle the prompt sequence gather → build → verify (verify wraps back to gather),
starting at gather, until a subagent returns a DONE status. For each step, dispatch a
subagent to read and execute the current prompt file (./project/prompts/{gather,build,verify}.md);
it ends by emitting a single JSON object of the form {"status": ..., "message": ...}. Parse
its "status" and relay its "message" so progress stays visible. CONTINUE — re-run the same
prompt file. NEXT — advance to the next prompt file (verify wraps to gather). DONE — stop. If
a subagent fails, or its final output is not a JSON object carrying a "status" of exactly
CONTINUE, NEXT, or DONE, stop and surface the raw output — never guess a status. You are only
the orchestrator — never read the prompt files yourself; subagents read and execute them.
@mgreenly
mgreenly / prompt.txt
Created July 1, 2026 16:21
A continue, next, done ralph loop in claude code with the /loop command
/loop Advance the gather → build → verify prompt cycle by one step (verify wraps back to
gather), using ./project/prompts/cursor.md as the durable current-step marker. Each
iteration: read cursor.md for the current step; if it is missing or empty, the current step
is gather. Dispatch a subagent to read and execute that step's prompt file
(./project/prompts/{gather,build,verify}.md); it ends by emitting a single JSON object of the
form {"status": ..., "message": ...}. Parse its "status" and relay its "message" so progress
stays visible, then act: CONTINUE — leave cursor.md unchanged and loop again. NEXT — write
the next step in the cycle to cursor.md and loop again. DONE — delete cursor.md and stop; do
not schedule another iteration. If a subagent fails, or its final output is not a JSON object
carrying a "status" of exactly CONTINUE, NEXT, or DONE, stop and surface the raw output —
SELECT
e1.event_id,
e1.created_at
FROM
events e1
JOIN
events e2 ON e1.event_id <> e2.event_id
AND e1.created_at BETWEEN e2.created_at - INTERVAL '10' MINUTE AND e2.created_at + INTERVAL '10' MINUTE;

Excellent question. This is a common security and organizational challenge when working with third-party tools and automations.

The short answer is no, it is not possible to directly authorize a GitHub App or OAuth App to access only specific directories within a repository.

GitHub's permission model operates at the repository level. When you grant an app access to a repository, you grant it permissions (like Read on code, or Read & write on issues) for the entire repository. There is no native feature to scope that access down to a file or directory path.

However, there are several effective workarounds and architectural patterns to achieve a similar result. The best choice depends on your specific use case (e.g., CI/CD, code analysis, a custom bot).


@mgreenly
mgreenly / Dockerfile
Last active April 28, 2025 02:52
nix-docker
FROM nixos/nix AS build
RUN nix-channel --update
# Build a profile and package store in the /scratch directory. Only the files we install
# during this docker build will end up in this profile.
RUN mkdir -p /scratch/store
# Install all desired packages into the scratch profile. It's important to know that the
# packages themselve are installed in /nix/store during this step and the /scratch/profile
@mgreenly
mgreenly / shell.nix
Created April 8, 2025 12:41
simple ruby shell.nix
let
tarball = fetchTarball "https://github.com/NixOS/nixpkgs/archive/refs/tags/24.11.tar.gz";
pkgs = import tarball { config = {}; overlays = []; };
in
pkgs.mkShell {
packages = with pkgs; [
nodejs
ruby
qty, size, bonus = "3d6-1"
.match(/^(\d+)d(\d+)([+-]\d+)?/)
.captures
.map(&:to_i)
class Record
class MissingField < Error; end
class << self
def build(hash)
new(*members.map{|m| hash[m.to_s] })
end
end
def initialize(*values)
self.class.members.zip(values).each do |member, value|
raise MissingField, "Unable to initialize #{self.class}, missing field: '#{member}'." if value.nil?