Loading...
Loading...
Amend a published CLI from one of two input sources: (1) dogfood mode mines the active Claude Code session transcript for friction (missing flags, hand- rolled API payloads, silent-null returns); (2) direct-input mode accepts user-supplied asks (rename a command, add commands or feeds, fix a named bug, optionally sniff the source site for new endpoints). Confirms scope with the user, plans + executes the fix autonomously, scrubs PII, and opens a PR against mvanhorn/printing-press-library. Two user-in-loop checkpoints: scope after capture, PR draft before open. Trigger phrases: "amend the CLI", "submit a patch", "fix what I just dogfooded", "open a PR for this CLI", "patch this CLI", "add features to my CLI", "rename this command", "add these feeds to <cli>", "sniff for new APIs in <cli>", "amend with these ideas", "use printing-press-amend", "run printing-press-amend".
npx skill4agent add mvanhorn/cli-printing-press printing-press-amend/printing-press-amend # auto-detect target CLI from session
/printing-press-amend superhuman # explicit short name
/printing-press-amend superhuman-pp-cli
/printing-press-amend ~/printing-press/library/superhuman/printing-press-publish/printing-press-polish/printing-press-retro// PATCH(...).printing-press-patches.jsonamendprinting-press patch# min-binary-version: 4.0.0
# Derive scope first — needed for local build detection
_scope_dir="$(git rev-parse --show-toplevel 2>/dev/null || echo "$PWD")"
_scope_dir="$(cd "$_scope_dir" && pwd -P)"
# Prefer local build when running from inside the printing-press repo.
_press_repo=false
if [ -x "$_scope_dir/printing-press" ] && [ -d "$_scope_dir/cmd/printing-press" ]; then
_press_repo=true
export PATH="$_scope_dir:$PATH"
echo "Using local build: $_scope_dir/printing-press"
elif ! command -v printing-press >/dev/null 2>&1; then
if [ -x "$HOME/go/bin/printing-press" ]; then
echo "printing-press found at ~/go/bin/printing-press but not on PATH."
echo "Add GOPATH/bin to your PATH: export PATH=\"\$HOME/go/bin:\$PATH\""
else
echo "printing-press binary not found."
echo "Install with: go install github.com/mvanhorn/cli-printing-press/v4/cmd/printing-press@latest"
fi
return 1 2>/dev/null || exit 1
fi
# Resolve and emit the absolute path the agent must use for every later
# `printing-press` invocation. `export PATH` above only affects this one
# Bash tool call; subsequent calls open a fresh shell and resolve bare
# `printing-press` against the user's default PATH, where a stale global
# can silently shadow the local build. The agent captures this marker and
# substitutes the absolute path into every later invocation.
if [ "$_press_repo" = "true" ]; then
PRINTING_PRESS_BIN="$_scope_dir/printing-press"
else
PRINTING_PRESS_BIN="$(command -v printing-press 2>/dev/null || true)"
fi
echo "PRINTING_PRESS_BIN=$PRINTING_PRESS_BIN"
PRESS_BASE="$(basename "$_scope_dir" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9_-]/-/g; s/^-+//; s/-+$//')"
if [ -z "$PRESS_BASE" ]; then
PRESS_BASE="workspace"
fi
PRESS_SCOPE="$PRESS_BASE-$(printf '%s' "$_scope_dir" | shasum -a 256 | cut -c1-8)"
PRESS_HOME="$HOME/printing-press"
PRESS_RUNSTATE="$PRESS_HOME/.runstate/$PRESS_SCOPE"
PRESS_LIBRARY="$PRESS_HOME/library"
PRESS_MANUSCRIPTS="$PRESS_HOME/manuscripts"
PRESS_CURRENT="$PRESS_RUNSTATE/current"
mkdir -p "$PRESS_RUNSTATE" "$PRESS_LIBRARY" "$PRESS_MANUSCRIPTS" "$PRESS_CURRENT"PRINTING_PRESS_BIN=<abs-path>printing-press ...$PRINTING_PRESS_BINexport PATHprinting-pressPATHmin-binary-version<PRINTING_PRESS_BIN> version --jsonmin-binary-versiongo install github.com/mvanhorn/cli-printing-press/v4/cmd/printing-press@latestMODE=directrenameaddremovefixsniffdiscoverhttps://example.com/feed/xMODE=dogfoodMODE=bothAskUserQuestion"Two ways to source findings for this amend. Which fits?
- Mine the current session transcript (dogfood mode)
- Use the asks I just typed (direct-input mode)
- Both — combine transcript friction with my asks"
MODE=dogfood/printing-press-amend$PRESS_RUNSTATE/current/mode.txtecho "$MODE" > "$PRESS_RUNSTATE/current/mode.txt"mode: <dogfood|direct|both>### 1a### 1bidkindcategoryclassificationevidencetarget_clirationaleprovenancetranscriptuser-asksniffMODE=dogfood### 1aMODE=direct### 1bMODE=both### 1a### 1breferences/transcript-parsing.md<project-dir-slug>~/.claude/projects/<slug>/*.jsonlAskUserQuestioncurl<slug>-pp-cli<slug>-pp-cliAskUserQuestion<cli-name-or-path>~/printing-press-library/library/*/provenance: transcriptreferences/transcript-parsing.mdreferences/direct-input-parsing.md<slug>-pp-clireferences/direct-input-parsing.mdkindrenameclassification: featureadd-commandclassification: featureadd-feedclassification: featureadd-endpointclassification: featurefix-bugclassification: bugsniff### 1b.ievidenceupdate XAskUserQuestionprovenance: user-askprovenance: sniffkind: sniff~/printing-press-library/library/<category>/<slug>/.printing-press.jsonsource_urlspec_url"Sniff needs a target URL — paste the source site you want sniffed, or skip the sniff finding for this run?"
<PRINTING_PRESS_BIN><PRINTING_PRESS_BIN> crowd-sniff --site "$SOURCE_URL" --json > /tmp/amend-sniff-crowd.json
crowd_exit=$?crowd-sniff<PRINTING_PRESS_BIN> browser-sniff --har "$HAR_PATH" --json > /tmp/amend-sniff-browser.json
browser_exit=$?id: F<n>kind: add-endpointclassification: featureevidence: "discovered via crowd-sniff: <endpoint-path>"browser-snifftarget_cli: <slug>-pp-clirationale: <one-line summary from sniff output if available, otherwise "sniff candidate, user to confirm">provenance: sniff| Condition | Behavior |
|---|---|
| Drop sniff finding; continue with other 1b findings; log "sniff skipped — no source URL". |
| Log the error; skip sniff findings; continue with other 1b findings. Do NOT abort the amend run. |
| Emit one entry to the deferred-findings list ("sniff ran, no new endpoints discovered") rather than adding nothing — gives the user a record. |
| Browser-sniff requested but no HAR available | Log; fall back to crowd-sniff results only. |
(sniff)Tier 3 — Polish / architecture (5)
F8 add-endpoint /v1/feeds/stars (sniff)
F9 add-endpoint /v1/feeds/new (sniff)
F10 add-endpoint /v1/feeds/activity (sniff)
...mvanhorn/printing-press-library# Replace <PRINTING_PRESS_BIN> use with the absolute path captured at setup.
# This phase uses gh, not the press binary.
# Open PRs touching this CLI
gh pr list --repo mvanhorn/printing-press-library \
--search "in:title,body <slug>" --state open --limit 20 \
--json number,title,state,headRefName,files
# Recently merged PRs (last 90 days) touching this CLI.
# Compute "90 days ago" portably — `date -v-90d` is BSD/macOS only, `date -d`
# is GNU/Linux only. Try GNU first, fall back to BSD, then to python3. If
# every form fails, abort with an explicit error rather than letting the
# dedup guard silently drop out with an empty `merged:>` qualifier.
ninety_days_ago=$(date -u -d '90 days ago' +%Y-%m-%d 2>/dev/null \
|| date -u -v-90d +%Y-%m-%d 2>/dev/null \
|| python3 -c 'import datetime; print((datetime.datetime.now(datetime.UTC).date() - datetime.timedelta(days=90)).isoformat())' 2>/dev/null)
if [ -z "$ninety_days_ago" ]; then
echo "ERROR: cannot compute 90-days-ago date — no GNU date, BSD date, or python3 available."
exit 1
fi
gh pr list --repo mvanhorn/printing-press-library \
--search "in:title,body <slug> merged:>$ninety_days_ago" \
--state merged --limit 20 \
--json number,title,state,mergedAt,headRefName,files"Finding(F<n>) may already be addressed by PR #<num> —<category>(<state>, <date>). Skip this finding?"<title>
gh pr view <num> --repo mvanhorn/printing-press-library --web.printing-press.json# Read published version (managed clone if available, else gh api)
if [ -f "$HOME/printing-press-library/library/<category>/<slug>/.printing-press.json" ]; then
published=$(jq -r '.version // empty' "$HOME/printing-press-library/library/<category>/<slug>/.printing-press.json")
else
published=$(gh api repos/mvanhorn/printing-press-library/contents/library/<category>/<slug>/.printing-press.json \
--jq '.content' | base64 -d | jq -r '.version // empty')
fi
# Read local binary version (if installed; the user dogfooded with this binary)
local_ver=$(<slug>-pp-cli version --json 2>/dev/null | jq -r '.version // empty' || echo "")local_verpublished"Thebinary you dogfooded is v<slug>-pp-cli, but the published library version is v<local_ver>. The friction you hit may already be fixed in the published version. Run:<published>go install github.com/mvanhorn/<slug>-pp-cli@latest...then re-runafter re-dogfooding. Aborting this run."/printing-press-amend
.printing-press.jsonversionfindings_kept:
- <finding from Phase 1>
findings_suppressed:
- id: F3
reason: "Duplicate of PR #571 (merged 2026-05-13)"
target_binary_check: { local: "1.0.0", published: "1.0.0", status: "current" }classification: bugclassification: featureclassification: featureFriction found for <slug>-pp-cli (12 signals, 2 suppressed as duplicates):
Tier 1 — Bugs (4)
F1 drafts list returns 400 silently
F4 messages query returns data: null
F7 refresh-token expiry not surfaced in errors
F11 ai --query returns code 500
Tier 2 — Missing features that solve session pain (4)
F2 no `drafts new` command (user hand-rolled writeMessage payload)
F5 no `--type sent` for threads list (user worked around with messages query)
F8 no `--remind-in <duration>` flag for send (user manually re-flagged drafts)
F10 no `bootstrap` to local SQLite (user did 50+ thread API calls)
Tier 3 — Polish / architecture (2)
F12 `auth status` doesn't link to `auth login` when refresh expired
F13 doctor doesn't surface stale-binary warning vs. published versionWhich scope should this patch cover?
1. Bugs only (Tier 1) — 4 findings
2. Bugs + immediate features (Tier 1 + Tier 2) — 8 findings
3. All tiers (Tier 1 + Tier 2 + Tier 3) — 10 findings
4. Custom selection — pick individual findingsAskUserQuestion$PRESS_MANUSCRIPTS/<api-slug>/<run-id>/proofs/<timestamp>-amend-<cli-name>-deferred.md<run-id>amend-2026-05-15T1432/printing-press-amend---
date: 2026-05-15
target_cli: superhuman-pp-cli
amend_run_id: amend-2026-05-15T1432
deferred_count: 2
---still_relevant: unknown/printing-press-amend$PRESS_MANUSCRIPTS/<api-slug>/*-deferred.md"All findings from this session were addressed by existing PRs. No novel patches found."
scope_tier: bugs+features # or bugs|all|custom
findings_active: [...] # the user-confirmed subset
findings_deferred_path: <path> # where the deferred file landedmvanhorn/printing-press-library$PRESS_LIBRARY/<slug>/$PRESS_HOME/.publish-repo-$PRESS_SCOPE/printing-press-publishPUBLISH_REPO_DIR="$PRESS_HOME/.publish-repo-$PRESS_SCOPE"
PUBLISH_CONFIG="$PRESS_HOME/.publish-config-$PRESS_SCOPE.json"
if [ ! -d "$PUBLISH_REPO_DIR/.git" ]; then
# First-time setup: see references/library-pr-plumbing.md for the full
# detection (push-vs-fork access via gh api .../permissions.push,
# SSH-vs-HTTPS protocol detection, scoped-clone cleanup loop).
echo "Managed clone not present — bootstrapping..."
# ... (see library-pr-plumbing.md)
else
# Refresh from upstream. -f on checkout discards any local edits left behind
# by a prior run that aborted between Phase 4's edits and Phase 7's commit —
# without -f, those uncommitted changes block the checkout and the subsequent
# reset --hard never runs.
cd "$PUBLISH_REPO_DIR"
git fetch upstream main
git checkout -f main
git reset --hard upstream/main
fi$PUBLISH_REPO_DIR/library/<category>/<slug>/find "$PUBLISH_REPO_DIR/library" -maxdepth 2 -name "<slug>" -type dCLI_DIR="$PUBLISH_REPO_DIR/library/<category>/<slug>"$CLI_DIR$PRESS_LIBRARY/<slug>/$PRESS_MANUSCRIPTS/<slug>/<run-id>/proofs/<timestamp>-amend-<cli-name>.md/tmp/printing-press/amend/datetarget_cliamend_run_idscope_tierfindings_count$CLI_DIR/...$CLI_DIR/// pp:client-call// pp:novel-static-reference// PATCH(<short reason>)// PATCH(amend-2026-05-15: surface refresh-token expiry to user) — was silently retrying
func (c *Client) Refresh(ctx context.Context) error {
...
}$CLI_DIR/.printing-press-patches.jsonpatches[]{
"date": "2026-05-15",
"amend_run_id": "amend-2026-05-15T1432",
"summary": "fix(superhuman): surface refresh-token expiry; add drafts new + --type sent",
"files": [
"internal/auth/refresh.go",
"internal/cli/drafts.go",
"internal/cli/threads.go"
],
"findings_addressed": ["F1", "F2", "F5", "F7"],
"patch_count": <total // PATCH comments added in this run>
}// PATCH(...).printing-press-patches.jsonverify-library-conventions~/printing-press-library/AGENTS.md--type sent"Finding F5 (missing) looks like a machine-level fix — the generator template--type sentshould emit it for every CLI with this endpoint shape, not justinternal/generator/templates/threads.go.tmpl. Defer to a<slug>-pp-clifollow-up, or proceed CLI-specific?"/printing-press-retro
machine-level<PRINTING_PRESS_BIN><PRINTING_PRESS_BIN> publish validate --dir "$CLI_DIR" --json > /tmp/amend-validate.json
exit_code=$?publish validatego vetgo build--help--versionpublish validate# Save the in-progress plan + diff to a holding location
HELD_PATH="$PRESS_MANUSCRIPTS/<slug>/<run-id>/proofs/<timestamp>-amend-<cli-name>-INCOMPLETE.md"
git -C "$PUBLISH_REPO_DIR" diff > "${HELD_PATH%.md}.diff"
cp "$PLAN_PATH" "$HELD_PATH"publish validate.printing-press-patches.json// PATCH(...)verify-library-conventions# Count only NEW // PATCH(...) markers added in this run by diffing against
# upstream. A naive `grep -rc` over $CLI_DIR also counts markers added by
# prior amend runs, which lets a zero-new-markers run pass when prior history
# makes the cumulative count meet or exceed the per-run declared count.
#
# This check runs in Phase 4 Step 6 — BEFORE the Phase 7 commit. The edits
# are still in the working tree, not in any commit, so `git diff` against
# upstream/main (working-tree diff) is the right tool. `format-patch
# upstream/main..HEAD` would scan committed history only, find no commits,
# and emit nothing — silently returning 0 markers for every valid run.
#
# --no-pager + --no-color + --no-ext-diff defeats colorized output and any
# configured `diff.external` tool that would reformat the diff away from
# unified-diff shape and break the grep parse.
new_patch_markers=$(git -C "$PUBLISH_REPO_DIR" --no-pager diff --no-color --no-ext-diff upstream/main -- "$CLI_DIR" \
| grep -cE '^\+.*// PATCH\(')
patches_entry=$(jq '.patches[-1].patch_count // 0' "$CLI_DIR/.printing-press-patches.json")
if [ "$new_patch_markers" -lt "$patches_entry" ]; then
echo "ERROR: .printing-press-patches.json claims $patches_entry patch markers added this run, found $new_patch_markers new // PATCH(...) comments in the diff."
exit 1
fiprinting-press publish validateplan_doc_path: <path>
managed_clone_dir: <path>
cli_dir_in_clone: <path>
findings_addressed: [...]
build_status: PASS|FAIL
test_status: PASS|FAIL
dogfood_status: PASS|FAIL|N/A # PASS|FAIL when MODE=dogfood (or "both"); always N/A when MODE=direct
validate_iterations: <n>
patch_marker_count: <n>dogfood_statusMODE=dogfoodMODE=directdogfood_status=N/AMODE=bothreferences/pii-scrubbing.mdskills/printing-press-retro/references/secret-scrubbing.mdAuthorizationCookieX-API-Key~/.printing-press/amend-config.yaml<company-1><person-1><email-1>Esper Labs$CLI_DIR<path>.pre-pii-scrub*.go$CLI_DIR~/.printing-press/amend-config.yaml$PRESS_MANUSCRIPTS/<slug>/<run-id>/scrub-report.jsonghfix(<api-slug>): <one-line summary>feat(<api-slug>): <one-line summary>feat(<api-slug>): <one-line summary><one-line summary>surface refresh-token expiry; add drafts new + --type sentgit diff --stat upstream/main..HEAD.printing-press-patches.jsonlibrary-pr-plumbing.mdcomp:<api-slug>priority:P1priority:P2priority:P3git diff --stat"Reminder: PR body references(you accepted as legitimate during Phase 5). Confirm before opening."<phrase>
PR draft ready. What now?
1. Open PR as drafted (recommended)
2. Edit then open — drop into an interactive review of title/body
3. Hold — save plan + diff for later resume; nothing pushed
4. Abort — discard everything, no record kept$PRESS_MANUSCRIPTS/<slug>/<run-id>/proofs/<timestamp>-amend-<cli-name>-HELD.md${path%.md}.diffstatus: held/printing-press-amendstatus: abortedreferences/library-pr-plumbing.mdgit add "$CLI_DIR"gh pr create--body-filereferences/library-pr-plumbing.md"PR open: <url>Greptile will review within ~2 minutes. Check inline comments:gh api repos/mvanhorn/printing-press-library/pulls/<N>/commentsP0/P1 findings are worth addressing before requesting human review."
---PATCH-RESULT------PATCH-RESULT---
pr_url: <url>
pr_number: <n>
branch_name: <name>
api_slug: <slug>
scope_tier: <bugs|bugs+features|all|custom>
files_changed:
- <file>
build_status: <PASS|FAIL>
test_status: <PASS|FAIL>
dogfood_status: <PASS|FAIL|N/A>
pii_scrub_summary: <N tokens replaced across M artifacts>
findings_addressed:
- <one-line-summary>
findings_deferred:
- <one-line-summary>
deferred_list_path: <path>
plan_doc_path: <path>
---END-PATCH-RESULT---<PRINTING_PRESS_BIN> verify-internal-skill --dir skills/printing-press-amendinternal/cli/verify_internal_skill.gointernal/pipeline/contracts_test.goTestSkillSetupBlocksMatchWorkspaceContract