agent-transcript ยท diff
git:20260901.e6f05b5 to git:20260905.be2a15b
54 added, 79 removed. Audit A to A.
---
name: agent-transcript
- description: "GitHub PR/issue agent transcripts: redact, preview, and insert safely; skip automatic use for sessions hosted on *.openclaw.ai."
+ description: "Requested GitHub PR/issue agent transcripts: redact, trim, preview, and insert safely."
---
# Agent Transcript
- Best-effort local-only provenance for OpenClaw PR/issue bodies. Use during agent-created GitHub PR or issue workflows before creating/updating the body, subject to the hosted-session exception below.
-
- ## Hosted-session exception
-
- - When the current session's hosting URL has a hostname matching `*.openclaw.ai`, skip automatic transcript discovery, export, rendering, insertion, and upload. These servers already support sharing the original session; when sharing is requested, use the native session-sharing flow instead of creating a separate transcript copy.
- - Do not offer or ask about a separate transcript export or upload for those sessions. Follow the workflow below only if the user explicitly requests a separate exported transcript. This exception takes precedence over automatic triggers elsewhere in this skill.
- - Determine this from the current session's hosting URL, not the repository URL or a deployment/test target.
-
- ## Contract
-
- - Never use network. Session discovery reads local agent logs only.
- - Never upload raw logs. Render sanitized Markdown first.
- - Always ask the user before adding transcript logs to a GitHub PR/issue body.
- - Tell the user sanitized session logs help reviewers and can make PRs easier to prioritize.
- - Offer a local HTML preview before insertion. If the user wants preview, open it and wait for confirmation before adding the section.
- - Fail closed on unresolved secrets, private keys, browser/session/cookie details, or auth URLs.
- - Drop system/developer prompts, raw tool outputs, reasoning, env, cookies, tokens, and broad local paths.
- - Keep user prompts, assistant visible decisions, terse tool summaries, and test/proof outcomes.
- - Automatically trim the rendered transcript before showing it, previewing it, or inserting it into a public body. Never paste the raw full-session render into a PR/issue body just because `render` or `append-body` produced it.
- - Remove session turns unrelated to the PR/issue work. Use the PR/issue title, branch name, changed files, and stated goal as scope; omit earlier/later unrelated tasks even when they are in the same session log.
- - Best effort only: PR/issue creation must continue if no safe transcript is found.
- - Add the `## Agent Transcript` section only when inserting a real transcript. Never add a placeholder transcript heading or text such as "A sanitized local transcript preview was generated but not included."
- - Use a collapsed `<details>` section and update existing markers instead of duplicating sections.
+ Use only when the user explicitly requests a transcript or preview. Omit by
+ default; never offer one or ask whether to include one during ordinary PR work.
+ A preview request alone does not authorize publication.
- ## Helper
+ For a session hosted at `*.openclaw.ai`, use native session sharing when sharing
+ is requested; export a separate transcript only when the user explicitly asks
+ for that copy. Identify hosting from the current session URL, not a repository
+ URL or deployment/test target. Do not offer separate exports.
- ```bash
- skills/agent-transcript/scripts/agent-transcript --help
- ```
+ ## Prepare Locally
- Find a likely local session:
+ Default file discovery/rendering reads local Codex, Claude, Pi, and OpenClaw
+ logs without network calls. Never upload raw logs.
```bash
skills/agent-transcript/scripts/agent-transcript find \
- --query "$PR_TITLE $BRANCH_OR_PR_URL" \
- --cwd "$PWD" \
- --since-days 14
+ --query "$PR_TITLE $BRANCH_OR_PR_URL" --cwd "$PWD" --since-days 14
+ skills/agent-transcript/scripts/agent-transcript render \
+ --session "$SESSION_JSONL" --out /tmp/agent-transcript.md
```
- `find` scans the newest 400 matching local JSONL logs by default across Codex, Claude, Pi, and OpenClaw agent sessions. Use `--max-files N` for a wider local search. `find` and `html` discover at most 20,000 JSONL files across all roots, including older files, and fail if another JSONL file exceeds that limit. Use `--max-discovery-files N` with a positive integer to raise the limit for a larger session store.
-
- `render`, `preview`, `append-body`, and `html` read at most 8 MiB of each session file (head and tail) before JSONL parse. Use `--max-read-bytes N` with a positive integer to change the limit. Output includes a visible partial-transcript notice and `sourceTruncated` in its stats if the read limit or the existing 12,000-line parse limit omits source content.
-
- In a downstream repo that syncs shared skills under `.agents/skills`, replace
+ In downstream repositories that sync under `.agents/skills`, replace
`skills/agent-transcript` with `.agents/skills/agent-transcript`.
- Render a PR/issue body section:
-
- ```bash
- skills/agent-transcript/scripts/agent-transcript render \
- --session "$SESSION_JSONL" \
- --out /tmp/agent-transcript.md
- ```
-
- Preview one candidate session locally:
+ `find` scans the newest 400 matching logs by default; `--max-files N` widens
+ local discovery. Treat matches as candidates, not proof of scope.
+ `find` and `html` count up to 20,000 JSONL files across all roots, including old
+ files, and fail when another exceeds the cap. `--max-discovery-files N` accepts
+ a positive integer override; prefer narrowing roots before raising it.
- ```bash
- skills/agent-transcript/scripts/agent-transcript preview \
- --session "$SESSION_JSONL" \
- --out /tmp/agent-transcript-preview.html
- open /tmp/agent-transcript-preview.html
- ```
+ File rendering reads at most 8 MiB per session from its head and tail and parses
+ at most 12,000 lines. `--max-read-bytes N` changes the byte limit. Preserve the
+ visible partial-transcript notice and `sourceTruncated` stats through trimming,
+ preview, and insertion; omitted source must never be described as complete.
+ These are file-read limits, not limits on the separate app-server rendering mode.
- Append/update a body file before `gh pr create --body-file` or connector PR creation:
+ Automatically trim the rendered Markdown **before showing, previewing, or
+ inserting it**. Keep only task-relevant user prompts, visible decisions, terse
+ tool summaries, and proof outcomes. Use the PR/issue goal, branch, and changed
+ files to remove unrelated earlier/later turns. Drop system/developer prompts,
+ reasoning, raw tool output, environment data, local paths, credentials,
+ browser/session/cookie details, and auth URLs. Inspect the trimmed result;
+ helper redaction is not sufficient disclosure review. Unresolved sensitive
+ content means omit the transcript.
- ```bash
- skills/agent-transcript/scripts/agent-transcript append-body \
- --body /tmp/pr-body.md \
- --session "$SESSION_JSONL" \
- --out /tmp/pr-body.with-transcript.md
- ```
+ ## Preview And Insert
- ## PR/Issue Workflow
+ Show the trimmed Markdown for a requested preview. If HTML is requested, build
+ the local preview from that trimmed content. The helper's `preview`, `html`, and
+ `append-body` modes render the session again; they do not consume an edited
+ Markdown file and can reintroduce removed turns. Do not use their untrimmed
+ output as the approved artifact.
- 1. Draft the normal PR/issue body first.
- 2. Run `find` with title, branch, PR URL/number if known, and cwd.
- 3. If a high-confidence session is found, ask:
- `Include a redacted agent transcript? It helps reviewers and can make the PR easier to prioritize. I can open a local preview first.`
- 4. If the user wants preview, run `preview`, open the HTML with `open`, and wait for confirmation.
- 5. Render or append to a temp body, then automatically trim the `## Agent Transcript` section before showing it to the user or inserting it publicly. Keep only turns that explain this PR/issue's goal, implementation choices, files, tests, proof, blockers, and final outcome.
- 6. Inspect the trimmed transcript text. If it still includes unrelated earlier/later work, trim again before proceeding.
- 7. If the user approves, use the enriched trimmed body file for creation/update.
- 8. If no safe session is found, say nothing and continue without transcript. If the user declines, continue without transcript and do not add any transcript placeholder section.
+ Insert only the inspected, scoped text when the user's authorization specifically
+ covers publishing that transcript to the named PR/issue. Generating or previewing
+ a transcript does not authorize publication, even when ordinary PR creation or
+ editing is already approved. If that scope is missing, show the trimmed result
+ and obtain publication authorization before insertion. Existing explicit
+ authorization covering transcript publication needs no repeat confirmation.
+ Keep the collapsed `<details>` section and replace existing transcript markers
+ instead of duplicating them. No safe match means continue the PR work without
+ transcript or placeholder; explain the omission when it prevents the explicitly
+ requested transcript. Do not promote transcript inclusion as a review priority
+ requirement.
- ## Validate
+ ## Validate Helper Changes
```bash
node --test skills/agent-transcript/scripts/agent-transcript.test.mjs
```
- ## Review Artifacts
-
- For manual audits across many PR/session candidates, create a local HTML preview from a local JSON file. This is for maintainers only and is not part of the PR/issue workflow:
-
- ```bash
- skills/agent-transcript/scripts/agent-transcript html \
- --prs /tmp/recent-prs.json \
- --out /tmp/agent-transcript-preview.html
- ```
+ For a downstream `.agents/skills` copy, run that test command from `.agents/`
+ so the test's relative helper path resolves. Use synthetic logs and isolated
+ discovery roots; never discover real user logs just to validate this skill.