Skip to content

Instantly share code, notes, and snippets.

@grahama1970
grahama1970 / AgentComms.md
Last active December 27, 2025 18:32
Durable Async Subagent Completion Logging (Session JSONL)

Durable Async Subagent Completion Logging (Session JSONL)

Goal

When a long-running subagent finishes (success/fail/abort), the main agent should:

  1. Notify the user in the interactive session when idle (push-style, no polling), and
  2. Persist a concise, searchable record even if the interactive session is disconnected/terminated.

Status (PR #323): PR #323 introduces pi.events so hooks can notify the user while the agent is idle. It also mentions PI_ASYNC_RESULT for writing an async result artifact. This proposal adds a durable session-history record by appending subagent lifecycle events to the existing session .jsonl via SessionManager. PR #323 already enables (1) via pi.events + hooks. This adds (2) using the existing SessionManager JSONL session file.

@grahama1970
grahama1970 / TERMINAL_TASKS.md
Last active December 6, 2025 16:06
Terminal task runner: docs + Python CLI to spawn long-running repo scripts in a detached terminal or tmux with .env/.venv, geometry presets, gnome dark theme, logging, PID capture, and agent rules to keep the Codex harness from hanging.

Terminal Task Runner

Long-running commands (smokes, pipelines, servers) must not run inside the Codex CLI harness. Use the terminal task runner instead so work happens in a detached GUI terminal with optional .env, .venv, geometry, PID capture, and tee logging.

Quick start (defaults that work here)

export PREFERRED_TERMINAL=gnome-terminal
export RIGHT_MONITOR_GEOM="160x40+3840+0"   # adjust to your layout
export SPAWN_GEOMETRY="$RIGHT_MONITOR_GEOM" # default geometry
@grahama1970
grahama1970 / chibi_grep.py
Last active November 29, 2025 14:38
“Bash helper script that wraps ripgrep or similar tools to provide fast, interactive search from Warp terminal, simplifying grep-style workflows in projects.”
#!/usr/bin/env python3
"""
chibi_grep.py — minimal local "WarpGrep-style" search primitive for LLM agents.
http://googleusercontent.com/image_generation_content/5
This script is intentionally *simpler* than Morph's WarpGrep and does not
implement an MCP server:
@grahama1970
grahama1970 / K2-AGENT.md
Last active November 12, 2025 17:35
K2-Agent.md

K2 Agent Constraints (MUST FOLLOW)

Personal reminder: Operate at high precision, low temperature (~0.15) - concise, direct, minimal explanations. Focus on code implementation over discussion.

BEFORE YOU START ANY TASK

  1. Check environment - source .venv/bin/activate
  2. Load env vars - source .env or use load_dotenv(find_dotenv(usecwd=True), override=False)
  3. Reference operational docs:
  • sparta/docs/SCILLM_PAVED_PATH_CONTRACT.md - Required for any SciLLM/Chutes code
@grahama1970
grahama1970 / 00_initial_sanity.sh
Last active November 12, 2025 13:37
Repro for Kimi-K2-Thinking on Chutes: JSON returns choices[0].message.content=null while reasoning_content contains the payload. Happens with response_format=json_object and json_schema; persists with larger max_tokens. Req id included for log lookup.
curl -sS -L "$CHUTES_API_BASE/chat/completions" \
-H "Authorization: Bearer $CHUTES_API_KEY" -H "Content-Type: application/json" \
-d '{
"model":"moonshotai/Kimi-K2-Thinking",
"messages":[
{"role":"system","content":"Respond strictly with valid JSON."},
{"role":"user","content":"Return only {\"ok\": true} as JSON."}
],
"response_format":{"type":"json_object"},
"max_tokens":64,
@grahama1970
grahama1970 / copilot_judge_context.patch
Created October 19, 2025 14:50
Copilot unblock patch
diff --git a/devops_agent/metrics.py b/devops_agent/metrics.py
index 992882f8..5be5cbb7 100644
--- a/devops_agent/metrics.py
+++ b/devops_agent/metrics.py
@@ -23,6 +23,15 @@ def inc_counter(name: str, labels: dict | None = None, amount: float = 1.0) -> N
_flush_unlocked(path)
+def write_metric(name: str, labels: dict | None = None, amount: float = 1.0) -> None:
+ """
@grahama1970
grahama1970 / scheduler_review.md
Created September 30, 2025 12:30
Scheduler Integration Review 2025-09-30

Scheduler Integration Review (Single File)

  • Date: 2025-09-30

Context

Adds a config.toml-driven scheduler crate and feature-gated MCP server bootstrap. Default-off at build and runtime; starts only when [scheduler] is enabled in ~/.codex/config.toml.

Files to Analyze

  • codex-rs/scheduler/Cargo.toml
  • codex-rs/scheduler/src/lib.rs
  • codex-rs/scheduler/src/config.rs
@grahama1970
grahama1970 / review_curated.md
Created September 28, 2025 19:02
Curated Code Review (Pre-hooks) 2025-09-28

Code Review Bundle (Curated, Single File)

  • Date: 2025-09-28
  • Scope: Generic pre‑hooks (core config + exec wiring)

Review Focus

  • Config correctness: TOML → runtime mapping for [pre_hooks] and steps (cmd/env/cwd/timeout).
  • Exec integration: CLI flag → override translation; hooks run before agent submission; error semantics.
  • Runner safety: timeouts, required vs non‑fatal, env/cwd application.
  • Demos: Makefile/wrapper targets for local validation.
@grahama1970
grahama1970 / review_bundle.md
Created September 28, 2025 18:47
Codex Review Bundle (Prompt-Driven) 2025-09-28

Codex Review Bundle (Single File)

  • Repo root: /home/graham/workspace/experiments/codex
  • Date: 2025-09-28

Executive Verdict

Readiness: ✅ Generic pre-hooks are correctly implemented, opt-in, sandbox-respecting, and validated with demos and tests.

Top 5 risks (with anchors):

@grahama1970
grahama1970 / codex_review_bundle.md
Created September 28, 2025 18:24
Codex Review Bundle (Single) 2025-09-28

Codex Review Bundle (Single File)

  • Repo root: /home/graham/workspace/experiments/codex
  • Date: 2025-09-28

Executive Verdict

Readiness: ✅ Generic pre‑hooks are correctly wired and tested.

Findings by Focus Area