From 19ee33b87c19fc0ba1280f145f38f139e1c10035 Mon Sep 17 00:00:00 2001 From: PatrickJS Date: Sat, 20 Jun 2026 00:10:37 -0700 Subject: [PATCH] feat(ledger): record sanitized thread handoffs --- docs/gists/auto-git.md | 13 +- gists/auto-git/README.md | 13 +- gists/auto-git/auto-git.SKILL.md | 13 +- .../auto-git.script-auto-git-finish.mjs | 111 ++++++- .../auto-git.script-auto-git-ledger.mjs | 289 +++++++++++++++++- skills/auto-git/SKILL.md | 13 +- skills/auto-git/scripts/auto-git-finish.mjs | 111 ++++++- skills/auto-git/scripts/auto-git-ledger.mjs | 289 +++++++++++++++++- tests/skill-suite.test.js | 208 +++++++++++++ 9 files changed, 1030 insertions(+), 30 deletions(-) diff --git a/docs/gists/auto-git.md b/docs/gists/auto-git.md index 7ae557d..738df58 100644 --- a/docs/gists/auto-git.md +++ b/docs/gists/auto-git.md @@ -51,7 +51,7 @@ Gist file mapping: - Uses a compact snapshot helper to detect Git index write capability, run locks, package-manager hints, ledger occupancy, PR handoffs, PR readiness, and the recommended verification profile before expensive commands. - Writes a sanitized start decision receipt on claimed runs, including the normalized route, selected workflow, required gates, branch/worktree context, release-preflight requirement, and follow-up thread handoff requirement without storing raw transcript text. - Supports two workflows: local review for single-chat code review and coordinated branch for multi-chat conflicts, PR handoffs, experiments, and fanouts. -- Tracks cooperative run state and PR handoffs under `~/.async/auto-git/v1/repos//ledger.json`, with live leases under `~/.async/locks/auto-git/`, without storing raw diffs, prompts, full command output, environment dumps, or secrets. +- Tracks cooperative run state, PR handoffs, and sanitized thread handoff metadata under `~/.async/auto-git/v1/repos//ledger.json`, with live leases under `~/.async/locks/auto-git/`, without storing raw diffs, prompts, transcripts, full command output, environment dumps, secrets, or local absolute worktree paths in handoff records. - Commits by change intent instead of making one vague bulk commit. - Reads the code and diffs when there are many unstaged changes, then builds the best commit split. - Optionally routes large or unclear worktrees to `git-intent-audit` before committing. @@ -331,6 +331,7 @@ Controller helpers: ```sh auto-git start --cwd "$PWD" --task "fix this" auto-git ledger list --cwd "$PWD" +auto-git ledger record-thread --cwd "$PWD" --run-id "" --action create --thread-id "" --target "ADR 4" --repo "async/auto-git" --package "@async/auto-git" --next-adr "ADR 4" auto-git finish --cwd "$PWD" --run-id "" --complete auto-git release-preflight --cwd "$PWD" --run-id "" --require-verification ``` @@ -343,13 +344,21 @@ explicit deferral, follow-up thread handoff, return to main/default, and the final ledger update. Blockers are short command-class hints and do not include raw diffs, command output, transcripts, or secret-looking values. +Use `auto-git ledger record-thread` when a coordinated follow-up route creates, +sends to, reads, or hands off another thread. The record keeps only sanitized +coordination metadata: source session id when available, thread id, action, +target ADR or work item, repository/package labels, branch, worktree class or +basename, PR reference, release-check status, and the next ADR label. It rejects +or excludes transcript-like and secret-looking values. + For release and yolo routes, `auto-git release-preflight` records successful preflight evidence to the active or requested run using safe metadata only. If release execution is intentionally deferred, finish requires an explicit `--defer-release`. Completion from main/default still preserves the completed branch/head in the -ledger so later chats can find the exact handoff. +ledger so later chats can find the exact handoff. When thread handoff evidence +is present, finish preserves that sanitized metadata through completion. For long or environment-sensitive gates, use: diff --git a/gists/auto-git/README.md b/gists/auto-git/README.md index 7ae557d..738df58 100644 --- a/gists/auto-git/README.md +++ b/gists/auto-git/README.md @@ -51,7 +51,7 @@ Gist file mapping: - Uses a compact snapshot helper to detect Git index write capability, run locks, package-manager hints, ledger occupancy, PR handoffs, PR readiness, and the recommended verification profile before expensive commands. - Writes a sanitized start decision receipt on claimed runs, including the normalized route, selected workflow, required gates, branch/worktree context, release-preflight requirement, and follow-up thread handoff requirement without storing raw transcript text. - Supports two workflows: local review for single-chat code review and coordinated branch for multi-chat conflicts, PR handoffs, experiments, and fanouts. -- Tracks cooperative run state and PR handoffs under `~/.async/auto-git/v1/repos//ledger.json`, with live leases under `~/.async/locks/auto-git/`, without storing raw diffs, prompts, full command output, environment dumps, or secrets. +- Tracks cooperative run state, PR handoffs, and sanitized thread handoff metadata under `~/.async/auto-git/v1/repos//ledger.json`, with live leases under `~/.async/locks/auto-git/`, without storing raw diffs, prompts, transcripts, full command output, environment dumps, secrets, or local absolute worktree paths in handoff records. - Commits by change intent instead of making one vague bulk commit. - Reads the code and diffs when there are many unstaged changes, then builds the best commit split. - Optionally routes large or unclear worktrees to `git-intent-audit` before committing. @@ -331,6 +331,7 @@ Controller helpers: ```sh auto-git start --cwd "$PWD" --task "fix this" auto-git ledger list --cwd "$PWD" +auto-git ledger record-thread --cwd "$PWD" --run-id "" --action create --thread-id "" --target "ADR 4" --repo "async/auto-git" --package "@async/auto-git" --next-adr "ADR 4" auto-git finish --cwd "$PWD" --run-id "" --complete auto-git release-preflight --cwd "$PWD" --run-id "" --require-verification ``` @@ -343,13 +344,21 @@ explicit deferral, follow-up thread handoff, return to main/default, and the final ledger update. Blockers are short command-class hints and do not include raw diffs, command output, transcripts, or secret-looking values. +Use `auto-git ledger record-thread` when a coordinated follow-up route creates, +sends to, reads, or hands off another thread. The record keeps only sanitized +coordination metadata: source session id when available, thread id, action, +target ADR or work item, repository/package labels, branch, worktree class or +basename, PR reference, release-check status, and the next ADR label. It rejects +or excludes transcript-like and secret-looking values. + For release and yolo routes, `auto-git release-preflight` records successful preflight evidence to the active or requested run using safe metadata only. If release execution is intentionally deferred, finish requires an explicit `--defer-release`. Completion from main/default still preserves the completed branch/head in the -ledger so later chats can find the exact handoff. +ledger so later chats can find the exact handoff. When thread handoff evidence +is present, finish preserves that sanitized metadata through completion. For long or environment-sensitive gates, use: diff --git a/gists/auto-git/auto-git.SKILL.md b/gists/auto-git/auto-git.SKILL.md index 6c7a6f3..080d7b0 100644 --- a/gists/auto-git/auto-git.SKILL.md +++ b/gists/auto-git/auto-git.SKILL.md @@ -248,6 +248,13 @@ PATH, use the installed skill's `scripts/*.mjs` helper paths as a fallback. - prints active runs, stale runs, completed runs, PR handoffs, branches, worktrees, leases, decision receipts, and verification state from safe ledger metadata +- `auto-git ledger record-thread --cwd "$PWD" --run-id "" --action [--thread-id ""] [--source-session ""] [--target ""] [--repo ""] [--package ""] [--branch ""] [--worktree ""] [--pr-url ""] [--pr-number ""] [--release-check ] [--next-adr "