Skip to content

Instantly share code, notes, and snippets.

View michaelewens's full-sized avatar

Michael Ewens michaelewens

View GitHub Profile
@michaelewens
michaelewens / allow-screenshot-cp.sh
Last active February 9, 2026 16:58
Claude Code PreToolUse hook: auto-approve safe Bash commands (ls, cp from screenshots)
#!/bin/bash
# PreToolUse hook: auto-approve safe Bash commands
# Input: JSON on stdin with tool_name and tool_input.command
# Output: JSON with hookSpecificOutput.permissionDecision = "allow" to approve
INPUT=$(cat)
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // ""')
# Always allow ls (read-only, safe)
if echo "$COMMAND" | grep -qE '^ls\b'; then
@michaelewens
michaelewens / logging_in_cc.md
Last active March 4, 2026 04:59
"Automatic" logging in Claude Code

Log Reminder Hook for Claude Code

A UserPromptSubmit hook that nudges Claude to log session work before context compaction wipes it out.

The Problem

Claude Code instructions like "proactively log your work" in CLAUDE.md are unreliable. Claude gets absorbed in the task and skips logging. When context compaction hits, the session's work history is lost.

A PreCompact hook can't solve this either: by the time compaction triggers, the context window is nearly full. Claude wouldn't have room to reason about what happened and write a meaningful log entry.

@michaelewens
michaelewens / claude_tasks_project.md
Created January 23, 2026 22:50
Claude Code tasks: project-level and persistent across sessions

Claude Code Persistent Task Lists

This guide explains how to set up task lists that persist across Claude Code sessions for a specific project.

How It Works

Claude Code's task system stores tasks in ~/.claude/tasks/<task-list-id>/. By default, each session gets a random UUID. To persist tasks across sessions, you set the CLAUDE_CODE_TASK_LIST_ID environment variable to a consistent ID for your project.

One-Time Setup (Already Done)

@michaelewens
michaelewens / orality-check.md
Last active January 20, 2026 01:17
Havelock.ai Claude Code Skill
name description version
orality-check
Analyze text for orality markers using the Havelock API. Use when the user asks to check orality, analyze text for oral/literate characteristics, or mentions "orality score" or "Havelock".
1.0.0

Orality Check Skill

Analyzes text for orality markers using the Havelock API. Returns a score from 0 (highly literate) to 1 (highly oral) with interpretation.

@michaelewens
michaelewens / makeTheReclinkWork.do
Last active June 18, 2020 06:24
Make reclink work...?
// These seem to fix weird errors in the reclink command in Stata (i.e., it doesn't like some characters
// Run this basic logic through your using and master strings.
// This table is your friend: http://www.asciitable.com/
** This one gets rid of all non-alphanumeric
replace yourString = ustrregexra(yourString ,`"[^a-zA-Z0-9]"',"")
** Old, but still works
replace yourString = subinstr(yourString, "$", "",.)
replace yourString = subinstr(yourString, char(44), "",.)
replace yourString = subinstr(yourString, "+", "",.)
replace yourString = subinstr(yourString, char(34), "",.)
@michaelewens
michaelewens / callForApplicants.txt
Created January 13, 2020 20:12
NBER Entrepreneurship Research Boot Camp 2020 Call for Applicants
NBER Entrepreneurship Research Boot Camp 2020
Call for Applicants
The NBER Entrepreneurship Working Group is hosting the 13th
Entrepreneurship Research Boot Camp (ERBC). This intensive workshop
provides an introduction into the leading research topics in the
areas of the economics of entrepreneurship and entrepreneurial
finance. The workshop is sponsored by the Ewing Marion Kauffman Foundation.
When: Monday, July 13 (late afternoon) to Friday, July 17, 2020.
clear
* Dummy data
set obs 4
gen name = ""
replace name = "John a." if _n == 1
replace name = "Sarah b." if _n == 2
replace name = "Samuel c." if _n == 3
replace name = "Mike" if _n == 4