Skip to content

Instantly share code, notes, and snippets.

View peterhartree's full-sized avatar

Peter Hartree peterhartree

View GitHub Profile
@peterhartree
peterhartree / permission-request-log.sh
Created September 3, 2026 08:05
Claude Code PermissionRequest logger: observation-only hook that appends every permission prompt to a JSONL log, tagged with origin (security hook rule vs Claude's own permission system)
#!/usr/bin/env bash
# Log every Claude Code PermissionRequest to ~/.agents/logs/permission-requests.jsonl.
# Observation only: prints nothing and exits 0, so the prompt behaves exactly as before.
#
# Origin tagging: a prompt raised because the PreToolUse security router answered
# "ask" has a matching record (same command, within 3 s) in bash-safety.jsonl, so it
# is tagged origin="security-hook:<rule_id>". Anything else is Claude Code's own
# permission system (auto-mode classifier or settings rules): origin="claude-permission-system".
# The full payload is kept (values clipped) so any origin/reason fields Claude Code adds
# later are captured without a script change.
@peterhartree
peterhartree / README.md
Created September 2, 2026 08:17
Save API keys to 1Password and project env files without putting them in model context

opadd

Save an API key from the macOS clipboard to 1Password without putting the secret in model context, chat transcripts, command arguments, or shell history. Optionally install the same value into a project env file without retrieving it from 1Password.

The prompt hook recognises a line beginning opadd , snapshots the clipboard, and gives the model a one-time snapshot ID. The model can then derive a useful title and hostname—and add known key scopes to the notes—before invoking opadd.

Requirements

  • macOS
  • 1Password CLI authenticated interactively or with OP_SERVICE_ACCOUNT_TOKEN
@peterhartree
peterhartree / cr
Created August 5, 2026 20:32
cr: full-text search and resume for Claude Code and Codex conversations
#!/usr/bin/env python3
"""cr — search and resume Claude Code + Codex conversations.
Usage:
cr incremental index, then interactive fzf search (default: last 7 days)
cr <words...> same, with an initial query
cr index incremental index only
cr index --full index all transcripts ever (first build defaults to last 90 days)
cr search -- <q> print matching sessions (used internally by fzf reload)
cr preview <sid> print session detail + matching snippets (used by fzf preview)
@peterhartree
peterhartree / interior-design-mockup-apps.md
Created July 28, 2026 10:22
Best apps for high-fidelity interior design mock-ups

At this point I'd find it helpful to have high-fidelity visuals of how the room will actually look. AI services can probably help a bunch here. Codex says:

The best setup is usually two apps: one AI tool for rapid visual ideas, then a 3D planner for spatially accurate mock-ups. ArchitectGPT-style generators can look photorealistic while quietly changing dimensions, windows or furniture placement.

App Best for Geometry fidelity My assessment
REimagineHome Redesigning photographs quickly Medium–high Best ArchitectGPT alternative. Its structural lock, reference images and incremental editing give more control than most photo generators. Five designs are free; Pro is $36/month.
Homestyler Affordable editable 2D/3D designs High Best value overall. Proper floor planning, custom models/materials and lighting controls. The free tier includes unlimited 1K renders; paid plans start around $6.8
@peterhartree
peterhartree / mundane-everyday-utility-redacted.md
Created June 15, 2026 14:25
Mundane everyday AI utility: damaged delivery replacement request
@peterhartree
peterhartree / blog-gist-adding-a-bag-transcript.md
Last active June 15, 2026 11:22
Adding a checked bag to a flight booking, by browser automation

User:

Please use browser automation to update Peter Hartree's Lufthansa return flight booking to add one checked/hold luggage bag.

Context:

  • Passenger: Peter Hartree
  • Return flight: Lufthansa LH****
  • Route: Munich (MUC) -> Marseille (MRS)
  • Date/time: [date redacted], departs 15:25, arrives 17:10
  • Booking code: ******
@peterhartree
peterhartree / c2.zsh
Last active August 5, 2026 19:30
c2: send one prompt to both Claude Code and Codex in side-by-side Warp panes
# c2: pick a project (same switcher as cc/cx), then run Codex in THIS pane and
# Claude in a new split pane to the right - both seeded with the same prompt.
# Usage: c2 "<prompt>" (interactive picker, then both agents)
# c2 3 "<prompt>" (quick-select project slot 3)
# c2 r2 "<prompt>" (quick-select repository slot 2)
# c2 3 (quick-select project, then open $EDITOR)
# c2 (no prompt -> opens $EDITOR; or pipe via stdin)
# Function arguments do not retain their shell quoting. Capture the command line
# immediately before execution so c2 can distinguish a quoted prompt from a

Find flights: earlier leg 1 to London (Montpellier → Reykjavík, July 2026)

Saved 8 June 2026. Generated with Claude Code.


User

/Users/ph/Documents/Projects/travel/work/flights/montpellier-reykjavik-via-london-july-2026.md we are researching this itinerary. plz could you look for a leg 1 option to london that'd arrive earlier in the day?

@peterhartree
peterhartree / accounts-preparation-plan-redacted.md
Created March 3, 2026 12:03
Claude Code's plan for preparing HartreeWorks Ltd annual accounts in Xero

HartreeWorks Limited — 2025/26 accounts preparation

Context

HartreeWorks Limited (company 10570654) has a financial year ending 31 January 2026. The accounts are due at Companies House by 31 October 2026. The accountant firm, [REDACTED], has already sent a 37-question Accounts Checklist via Xero on 4 February 2026 that needs to be completed. The company is not VAT-registered, turnover is in the [REDACTED] band, and the bank feed (Wise) is connected to Xero.

Goal: Prepare the accounts in Xero so the accountant can file statutory accounts and corporation tax return, then notify them we're done.

Key contacts

@peterhartree
peterhartree / format-calendar.py
Created February 2, 2026 08:48
Format Google Calendar API JSON into a day-grouped schedule (for use with Claude Code)
#!/usr/bin/env python3
"""Format Google Calendar API output into a day-grouped schedule.
Accepts JSON via stdin (the format returned by the Google Workspace MCP tool).
Parses event timestamps, converts to Europe/Paris timezone, groups by date,
and outputs a clean day-by-day schedule with verified day names.
Usage:
echo '<calendar JSON>' | python3 scripts/format-calendar.py
python3 scripts/format-calendar.py < calendar-data.json