From 9d1523d7e75880c8d287761be130c2bd2723ee9c Mon Sep 17 00:00:00 2001 From: NagyVikt Date: Sat, 16 May 2026 02:17:52 +0200 Subject: [PATCH] feat(codex-fleet): robust pane paste helper with MIME validation + structured logging PR #140's inline image-paste in pane-context-menu.sh only matched png/jpeg/gif/webp/bmp and didn't validate the captured payload, causing silent "didn't quite work" failures when modern browsers/screenshots provided avif/heic/svg, when wl-paste exited zero with empty output, or when the wrong MIME landed first in --list-types output. Extract a single source-of-truth helper that drives both the bash menu (pane-context-menu.sh) and the tmux display-menu (style-tabs.sh): - pane-menu-paste.sh (new): enumerates MIME types once, walks an extended image preference list (png > webp > jpeg > avif > heic > heif > gif > bmp > tiff > svg+xml > x-icon), validates each saved image by size guard (>100 bytes) + magic-byte sniff (PNG/JPEG/GIF/ WebP/BMP/TIFF/ICO/AVIF/HEIC ftyp box/SVG xml header), falls through to the next MIME on failure, then to text/uri-list (pastes file paths from file managers), then text/plain. Saves images under /tmp/codex-fleet-clipboard/ (mode 700, auto-prunes >1h files), logs every invocation to /tmp/codex-fleet-paste.log with mime/size/path/error for tail -f debugging, caps the log at 100KB. Falls back to tmux's own paste-buffer when wl-paste is missing entirely. - pane-context-menu.sh: replaces the 30-line inline p) case with a one-line shellout. - style-tabs.sh: rewires the MouseDown3Pane Paste row to call the same helper so the two menu surfaces stay behaviorally identical. Verification: bash -n + shellcheck (docker koalaman/shellcheck:stable) clean on all three files (only pre-existing SC1091 source-resolution info on pane-context-menu.sh remains). Smoke tests covered text/empty-clipboard/PNG-too-small/PNG-magic-validated paths against a fake pane id; helper exits cleanly with structured log lines in all cases. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../.openspec.yaml | 2 + .../proposal.md | 11 + .../specs/robust-paste-helper/spec.md | 9 + .../tasks.md | 34 +++ .../README.md | 30 +++ .../architect/.openspec.yaml | 9 + .../architect/README.md | 12 ++ .../architect/prompt.md | 34 +++ .../architect/proposal.md | 15 ++ .../architect/specs/architect/spec.md | 10 + .../architect/tasks.md | 33 +++ .../checkpoints.md | 4 + .../coordinator-prompt.md | 41 ++++ .../critic/.openspec.yaml | 9 + .../critic/README.md | 12 ++ .../critic/prompt.md | 34 +++ .../critic/proposal.md | 15 ++ .../critic/specs/critic/spec.md | 10 + .../critic/tasks.md | 33 +++ .../executor/.openspec.yaml | 9 + .../executor/README.md | 12 ++ .../executor/checkpoints.md | 4 + .../executor/prompt.md | 34 +++ .../executor/proposal.md | 15 ++ .../executor/specs/executor/spec.md | 10 + .../executor/tasks.md | 33 +++ .../kickoff-prompts.md | 108 ++++++++++ .../open-questions.md | 6 + .../phases.md | 15 ++ .../planner/.openspec.yaml | 9 + .../planner/README.md | 12 ++ .../planner/plan.md | 65 ++++++ .../planner/prompt.md | 34 +++ .../planner/proposal.md | 15 ++ .../planner/specs/planner/spec.md | 10 + .../planner/tasks.md | 33 +++ .../summary.md | 8 + .../verifier/.openspec.yaml | 9 + .../verifier/README.md | 12 ++ .../verifier/prompt.md | 34 +++ .../verifier/proposal.md | 15 ++ .../verifier/specs/verifier/spec.md | 10 + .../verifier/tasks.md | 33 +++ .../writer/.openspec.yaml | 9 + .../writer/README.md | 12 ++ .../writer/prompt.md | 34 +++ .../writer/proposal.md | 15 ++ .../writer/specs/writer/spec.md | 10 + .../writer/tasks.md | 33 +++ scripts/codex-fleet/bin/pane-context-menu.sh | 34 +-- scripts/codex-fleet/bin/pane-menu-paste.sh | 197 ++++++++++++++++++ scripts/codex-fleet/style-tabs.sh | 2 +- 52 files changed, 1217 insertions(+), 31 deletions(-) create mode 100644 openspec/changes/agent-claude-robust-paste-helper-2026-05-16-02-10/.openspec.yaml create mode 100644 openspec/changes/agent-claude-robust-paste-helper-2026-05-16-02-10/proposal.md create mode 100644 openspec/changes/agent-claude-robust-paste-helper-2026-05-16-02-10/specs/robust-paste-helper/spec.md create mode 100644 openspec/changes/agent-claude-robust-paste-helper-2026-05-16-02-10/tasks.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/README.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/.openspec.yaml create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/README.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/prompt.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/proposal.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/specs/architect/spec.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/tasks.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/checkpoints.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/coordinator-prompt.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/.openspec.yaml create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/README.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/prompt.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/proposal.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/specs/critic/spec.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/tasks.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/.openspec.yaml create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/README.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/checkpoints.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/prompt.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/proposal.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/specs/executor/spec.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/tasks.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/kickoff-prompts.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/open-questions.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/phases.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/.openspec.yaml create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/README.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/plan.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/prompt.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/proposal.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/specs/planner/spec.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/tasks.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/summary.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/.openspec.yaml create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/README.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/prompt.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/proposal.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/specs/verifier/spec.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/tasks.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/.openspec.yaml create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/README.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/prompt.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/proposal.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/specs/writer/spec.md create mode 100644 openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/tasks.md create mode 100755 scripts/codex-fleet/bin/pane-menu-paste.sh diff --git a/openspec/changes/agent-claude-robust-paste-helper-2026-05-16-02-10/.openspec.yaml b/openspec/changes/agent-claude-robust-paste-helper-2026-05-16-02-10/.openspec.yaml new file mode 100644 index 0000000..ab7f13b --- /dev/null +++ b/openspec/changes/agent-claude-robust-paste-helper-2026-05-16-02-10/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-05-16 diff --git a/openspec/changes/agent-claude-robust-paste-helper-2026-05-16-02-10/proposal.md b/openspec/changes/agent-claude-robust-paste-helper-2026-05-16-02-10/proposal.md new file mode 100644 index 0000000..313eca3 --- /dev/null +++ b/openspec/changes/agent-claude-robust-paste-helper-2026-05-16-02-10/proposal.md @@ -0,0 +1,11 @@ +## Why + +- TODO: describe the user/problem outcome this change addresses. + +## What Changes + +- TODO: summarize the intended behavior and scope. + +## Impact + +- TODO: call out risks, rollout notes, and affected surfaces. diff --git a/openspec/changes/agent-claude-robust-paste-helper-2026-05-16-02-10/specs/robust-paste-helper/spec.md b/openspec/changes/agent-claude-robust-paste-helper-2026-05-16-02-10/specs/robust-paste-helper/spec.md new file mode 100644 index 0000000..bdf6ff3 --- /dev/null +++ b/openspec/changes/agent-claude-robust-paste-helper-2026-05-16-02-10/specs/robust-paste-helper/spec.md @@ -0,0 +1,9 @@ +## ADDED Requirements + +### Requirement: robust-paste-helper behavior +The system SHALL enforce robust-paste-helper behavior as defined by this change. + +#### Scenario: Baseline acceptance +- **WHEN** robust-paste-helper behavior is exercised +- **THEN** the expected outcome is produced +- **AND** regressions are covered by tests. diff --git a/openspec/changes/agent-claude-robust-paste-helper-2026-05-16-02-10/tasks.md b/openspec/changes/agent-claude-robust-paste-helper-2026-05-16-02-10/tasks.md new file mode 100644 index 0000000..22541c0 --- /dev/null +++ b/openspec/changes/agent-claude-robust-paste-helper-2026-05-16-02-10/tasks.md @@ -0,0 +1,34 @@ +## Definition of Done + +This change is complete only when **all** of the following are true: + +- Every checkbox below is checked. +- The agent branch reaches `MERGED` state on `origin` and the PR URL + state are recorded in the completion handoff. +- If any step blocks (test failure, conflict, ambiguous result), append a `BLOCKED:` line under section 4 explaining the blocker and **STOP**. Do not tick remaining cleanup boxes; do not silently skip the cleanup pipeline. + +## Handoff + +- Handoff: change=`agent-claude-robust-paste-helper-2026-05-16-02-10`; branch=`agent//`; scope=`TODO`; action=`continue this sandbox or finish cleanup after a usage-limit/manual takeover`. +- Copy prompt: Continue `agent-claude-robust-paste-helper-2026-05-16-02-10` on branch `agent//`. Work inside the existing sandbox, review `openspec/changes/agent-claude-robust-paste-helper-2026-05-16-02-10/tasks.md`, continue from the current state instead of creating a new sandbox, and when the work is done run `gx branch finish --branch agent// --base dev --via-pr --wait-for-merge --cleanup`. + +## 1. Specification + +- [ ] 1.1 Finalize proposal scope and acceptance criteria for `agent-claude-robust-paste-helper-2026-05-16-02-10`. +- [ ] 1.2 Define normative requirements in `specs/robust-paste-helper/spec.md`. + +## 2. Implementation + +- [ ] 2.1 Implement scoped behavior changes. +- [ ] 2.2 Add/update focused regression coverage. + +## 3. Verification + +- [ ] 3.1 Run targeted project verification commands. +- [ ] 3.2 Run `openspec validate agent-claude-robust-paste-helper-2026-05-16-02-10 --type change --strict`. +- [ ] 3.3 Run `openspec validate --specs`. + +## 4. Cleanup (mandatory; run before claiming completion) + +- [ ] 4.1 Run the cleanup pipeline: `gx branch finish --branch agent// --base dev --via-pr --wait-for-merge --cleanup`. This handles commit -> push -> PR create -> merge wait -> worktree prune in one invocation. +- [ ] 4.2 Record the PR URL and final merge state (`MERGED`) in the completion handoff. +- [ ] 4.3 Confirm the sandbox worktree is gone (`git worktree list` no longer shows the agent path; `git branch -a` shows no surviving local/remote refs for the branch). diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/README.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/README.md new file mode 100644 index 0000000..be98c7e --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/README.md @@ -0,0 +1,30 @@ +# Plan Workspace: agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10 + +This folder stores durable planning artifacts before implementation changes. + +## Shared files +- `summary.md` +- `checkpoints.md` +- `phases.md` +- `open-questions.md` +- `coordinator-prompt.md` +- `kickoff-prompts.md` + +## Role folders +- `planner/` +- `architect/` +- `critic/` +- `executor/` +- `writer/` +- `verifier/` + +When Codex or Claude hits an unresolved question that should survive chat, add it to `open-questions.md` as an unchecked `- [ ]` item. + +Each role folder contains OpenSpec-style artifacts: +- `.openspec.yaml` +- `prompt.md` (copy/paste role prompt) +- `proposal.md` +- `tasks.md` (Spec / Tests / Implementation / Checkpoints checklists) +- `specs//spec.md` +Planner also gets `plan.md`; executor also gets `checkpoints.md`. +Planner plans should follow `openspec/plan/PLANS.md`. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/.openspec.yaml b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/.openspec.yaml new file mode 100644 index 0000000..92e0a1a --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/.openspec.yaml @@ -0,0 +1,9 @@ +schema: 1 +plan: agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10 +role: architect +status: draft +artifacts: + prompt: prompt.md + proposal: proposal.md + tasks: tasks.md + spec: specs/architect/spec.md diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/README.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/README.md new file mode 100644 index 0000000..1e1c275 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/README.md @@ -0,0 +1,12 @@ +# architect + +Role workspace for `architect`. + +Default artifacts: +- `.openspec.yaml` +- `prompt.md` +- `proposal.md` +- `tasks.md` +- `specs//spec.md` + +Use this folder for role notes, artifacts, and status updates. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/prompt.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/prompt.md new file mode 100644 index 0000000..ca01d66 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/prompt.md @@ -0,0 +1,34 @@ +# architect Prompt + +You are the `architect` role for OpenSpec plan `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10`. + +## Objective + +Complete only this role's assigned checklist and leave compact evidence for the coordinator. + +## Source of truth + +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/summary.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/checkpoints.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/open-questions.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/tasks.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/proposal.md` + +## Before edits + +1. Confirm branch/worktree with `git status --short --branch`. +2. Claim every touched file before editing: + - Prefer Colony `task_claim_file` when an active task exists. + - Otherwise run `gx locks claim --branch `. +3. Stay inside assigned files/modules; coordinate before touching shared paths. + +## Working rules + +- Update `architect/tasks.md` as each item completes. +- Record durable unresolved questions in `open-questions.md`. +- Keep handoffs short: files changed, behavior touched, verification, risks. +- Do not revert another agent's edits. + +## Cleanup + +Only the owner/finalizer lane runs `gx branch finish --branch --base dev --via-pr --wait-for-merge --cleanup`. If blocked, append `BLOCKED:` with branch, task, blocker, next, evidence. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/proposal.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/proposal.md new file mode 100644 index 0000000..b4f8478 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/proposal.md @@ -0,0 +1,15 @@ +# Proposal: architect (agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10) + +## Why + +Summarize why this role's work is required for plan `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10`. + +## What Changes + +- [ ] List the planned role-specific changes + +## Impact + +- Scope: +- Risks: +- Dependencies: diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/specs/architect/spec.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/specs/architect/spec.md new file mode 100644 index 0000000..996a878 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/specs/architect/spec.md @@ -0,0 +1,10 @@ +# Capability Spec: architect + +## ADDED Requirements + +### Requirement: architect responsibilities for `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` +This role MUST define and deliver its scoped outputs with evidence. + +#### Scenario: Role executes assigned scope +- **WHEN** the role begins execution for `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` +- **THEN** it follows `tasks.md` and records evidence for completion diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/tasks.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/tasks.md new file mode 100644 index 0000000..f355787 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/architect/tasks.md @@ -0,0 +1,33 @@ +# architect tasks + +## 1. Spec + +- [ ] 1.1 Define ownership boundaries, interfaces, and artifact responsibilities for `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` +- [ ] 1.2 Validate architecture constraints and non-functional requirements coverage + +## 2. Tests + +- [ ] 2.1 Define architectural verification checkpoints (integration boundaries, failure modes, compatibility) +- [ ] 2.2 Validate that acceptance criteria map to concrete architecture decisions + +## 3. Implementation + +- [ ] 3.1 Review plan for strongest antithesis/tradeoff tensions +- [ ] 3.2 Propose synthesis path and guardrails for implementation teams +- [ ] 3.3 Record architecture sign-off notes for downstream execution + +## 4. Checkpoints + +- [ ] [A1] READY - Architecture review checkpoint + +## 5. Collaboration + +- [ ] 5.1 Owner recorded this lane before edits. +- [ ] 5.2 Record joined agents / handoffs, or mark `N/A` when solo. +- [ ] 5.3 Record unresolved plan questions in `../open-questions.md`, or mark `N/A` when none. + +## 6. Cleanup + +- [ ] 6.1 If this lane owns finalization, run `gx branch finish --branch --base dev --via-pr --wait-for-merge --cleanup`. +- [ ] 6.2 Record PR URL + final `MERGED` state in the handoff. +- [ ] 6.3 Confirm sandbox cleanup (`git worktree list`, `git branch -a`) or append `BLOCKED:` and stop. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/checkpoints.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/checkpoints.md new file mode 100644 index 0000000..fa80586 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/checkpoints.md @@ -0,0 +1,4 @@ +# Plan Checkpoints: agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10 + +Chronological checkpoint log for all roles. + diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/coordinator-prompt.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/coordinator-prompt.md new file mode 100644 index 0000000..e39fc09 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/coordinator-prompt.md @@ -0,0 +1,41 @@ +# Master Coordinator Prompt + +You are the coordinator for plan `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10`. + +## Objective + +Drive this plan from draft to execution-ready status with strict checkpoint discipline and no scope drift. + +## Source-of-truth artifacts + +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/summary.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/checkpoints.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/open-questions.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/plan.md` +- role `prompt.md` files for copy/paste helper startup +- role `tasks.md` files for planner/architect/critic/executor/writer/verifier + +## Coordinator responsibilities + +1. Keep checkpoints current in each role `tasks.md` and root `checkpoints.md`. +2. Route unresolved questions and branching decisions into `open-questions.md`. +3. Ensure each role has explicit acceptance criteria and verification evidence. +4. Prevent implementation from starting before planning gates are complete. +5. Keep handoffs concise: files changed, behavior touched, verification output, risks. + +## Wave-splitting decision (optional) + +Create wave prompts in `kickoff-prompts.md` only when at least one applies: + +- 3+ independent implementation lanes can run in parallel. +- Runtime cutover/rollback sequencing needs explicit lane ownership. +- Risk is high enough that bounded execution packets reduce coordination mistakes. + +If wave splitting is not needed, keep execution under a single owner with normal role checkpoints. + +## Exit criteria + +- All role checkpoints required for planning are done. +- Execution lanes (if any) have clear ownership boundaries. +- `open-questions.md` captures unresolved decisions that still need answers. +- Verification plan and rollback expectations are explicit and testable. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/.openspec.yaml b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/.openspec.yaml new file mode 100644 index 0000000..0ba302f --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/.openspec.yaml @@ -0,0 +1,9 @@ +schema: 1 +plan: agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10 +role: critic +status: draft +artifacts: + prompt: prompt.md + proposal: proposal.md + tasks: tasks.md + spec: specs/critic/spec.md diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/README.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/README.md new file mode 100644 index 0000000..5b5c877 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/README.md @@ -0,0 +1,12 @@ +# critic + +Role workspace for `critic`. + +Default artifacts: +- `.openspec.yaml` +- `prompt.md` +- `proposal.md` +- `tasks.md` +- `specs//spec.md` + +Use this folder for role notes, artifacts, and status updates. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/prompt.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/prompt.md new file mode 100644 index 0000000..7ad6c6e --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/prompt.md @@ -0,0 +1,34 @@ +# critic Prompt + +You are the `critic` role for OpenSpec plan `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10`. + +## Objective + +Complete only this role's assigned checklist and leave compact evidence for the coordinator. + +## Source of truth + +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/summary.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/checkpoints.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/open-questions.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/tasks.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/proposal.md` + +## Before edits + +1. Confirm branch/worktree with `git status --short --branch`. +2. Claim every touched file before editing: + - Prefer Colony `task_claim_file` when an active task exists. + - Otherwise run `gx locks claim --branch `. +3. Stay inside assigned files/modules; coordinate before touching shared paths. + +## Working rules + +- Update `critic/tasks.md` as each item completes. +- Record durable unresolved questions in `open-questions.md`. +- Keep handoffs short: files changed, behavior touched, verification, risks. +- Do not revert another agent's edits. + +## Cleanup + +Only the owner/finalizer lane runs `gx branch finish --branch --base dev --via-pr --wait-for-merge --cleanup`. If blocked, append `BLOCKED:` with branch, task, blocker, next, evidence. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/proposal.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/proposal.md new file mode 100644 index 0000000..3feda45 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/proposal.md @@ -0,0 +1,15 @@ +# Proposal: critic (agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10) + +## Why + +Summarize why this role's work is required for plan `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10`. + +## What Changes + +- [ ] List the planned role-specific changes + +## Impact + +- Scope: +- Risks: +- Dependencies: diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/specs/critic/spec.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/specs/critic/spec.md new file mode 100644 index 0000000..a75cbf8 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/specs/critic/spec.md @@ -0,0 +1,10 @@ +# Capability Spec: critic + +## ADDED Requirements + +### Requirement: critic responsibilities for `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` +This role MUST define and deliver its scoped outputs with evidence. + +#### Scenario: Role executes assigned scope +- **WHEN** the role begins execution for `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` +- **THEN** it follows `tasks.md` and records evidence for completion diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/tasks.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/tasks.md new file mode 100644 index 0000000..6b455a2 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/critic/tasks.md @@ -0,0 +1,33 @@ +# critic tasks + +## 1. Spec + +- [ ] 1.1 Validate principle-driver-option consistency across the plan +- [ ] 1.2 Validate risks, consequences, and mitigation clarity (including idempotency expectations) + +## 2. Tests + +- [ ] 2.1 Validate testability and measurability of all acceptance criteria +- [ ] 2.2 Validate verification steps are concrete and reproducible + +## 3. Implementation + +- [ ] 3.1 Produce verdict (APPROVE / ITERATE / REJECT) with actionable feedback +- [ ] 3.2 Confirm revised drafts resolve prior findings before approval +- [ ] 3.3 Publish final quality/risk sign-off notes + +## 4. Checkpoints + +- [ ] [C1] READY - Quality gate checkpoint + +## 5. Collaboration + +- [ ] 5.1 Owner recorded this lane before edits. +- [ ] 5.2 Record joined agents / handoffs, or mark `N/A` when solo. +- [ ] 5.3 Record unresolved plan questions in `../open-questions.md`, or mark `N/A` when none. + +## 6. Cleanup + +- [ ] 6.1 If this lane owns finalization, run `gx branch finish --branch --base dev --via-pr --wait-for-merge --cleanup`. +- [ ] 6.2 Record PR URL + final `MERGED` state in the handoff. +- [ ] 6.3 Confirm sandbox cleanup (`git worktree list`, `git branch -a`) or append `BLOCKED:` and stop. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/.openspec.yaml b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/.openspec.yaml new file mode 100644 index 0000000..42e10be --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/.openspec.yaml @@ -0,0 +1,9 @@ +schema: 1 +plan: agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10 +role: executor +status: draft +artifacts: + prompt: prompt.md + proposal: proposal.md + tasks: tasks.md + spec: specs/executor/spec.md diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/README.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/README.md new file mode 100644 index 0000000..62b95ee --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/README.md @@ -0,0 +1,12 @@ +# executor + +Role workspace for `executor`. + +Default artifacts: +- `.openspec.yaml` +- `prompt.md` +- `proposal.md` +- `tasks.md` +- `specs//spec.md` + +Use this folder for role notes, artifacts, and status updates. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/checkpoints.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/checkpoints.md new file mode 100644 index 0000000..c731fd3 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/checkpoints.md @@ -0,0 +1,4 @@ +# executor checkpoints + +Timestamped execution checkpoints for `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10`. + diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/prompt.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/prompt.md new file mode 100644 index 0000000..3834493 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/prompt.md @@ -0,0 +1,34 @@ +# executor Prompt + +You are the `executor` role for OpenSpec plan `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10`. + +## Objective + +Complete only this role's assigned checklist and leave compact evidence for the coordinator. + +## Source of truth + +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/summary.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/checkpoints.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/open-questions.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/tasks.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/proposal.md` + +## Before edits + +1. Confirm branch/worktree with `git status --short --branch`. +2. Claim every touched file before editing: + - Prefer Colony `task_claim_file` when an active task exists. + - Otherwise run `gx locks claim --branch `. +3. Stay inside assigned files/modules; coordinate before touching shared paths. + +## Working rules + +- Update `executor/tasks.md` as each item completes. +- Record durable unresolved questions in `open-questions.md`. +- Keep handoffs short: files changed, behavior touched, verification, risks. +- Do not revert another agent's edits. + +## Cleanup + +Only the owner/finalizer lane runs `gx branch finish --branch --base dev --via-pr --wait-for-merge --cleanup`. If blocked, append `BLOCKED:` with branch, task, blocker, next, evidence. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/proposal.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/proposal.md new file mode 100644 index 0000000..0d14603 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/proposal.md @@ -0,0 +1,15 @@ +# Proposal: executor (agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10) + +## Why + +Summarize why this role's work is required for plan `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10`. + +## What Changes + +- [ ] List the planned role-specific changes + +## Impact + +- Scope: +- Risks: +- Dependencies: diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/specs/executor/spec.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/specs/executor/spec.md new file mode 100644 index 0000000..d27a644 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/specs/executor/spec.md @@ -0,0 +1,10 @@ +# Capability Spec: executor + +## ADDED Requirements + +### Requirement: executor responsibilities for `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` +This role MUST define and deliver its scoped outputs with evidence. + +#### Scenario: Role executes assigned scope +- **WHEN** the role begins execution for `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` +- **THEN** it follows `tasks.md` and records evidence for completion diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/tasks.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/tasks.md new file mode 100644 index 0000000..062ff29 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/executor/tasks.md @@ -0,0 +1,33 @@ +# executor tasks + +## 1. Spec + +- [ ] 1.1 Map approved plan requirements to concrete implementation work items +- [ ] 1.2 Validate touched components/files are explicitly listed before coding starts + +## 2. Tests + +- [ ] 2.1 Define test additions/updates required to lock intended behavior +- [ ] 2.2 Validate regression and smoke verification commands for delivery + +## 3. Implementation + +- [ ] 3.1 Execute implementation tasks in approved order +- [ ] 3.2 Keep progress and evidence linked back to plan checkpoints +- [ ] 3.3 Complete final verification bundle for handoff + +## 4. Checkpoints + +- [ ] [E1] READY - Execution start checkpoint + +## 5. Collaboration + +- [ ] 5.1 Owner recorded this lane before edits. +- [ ] 5.2 Record joined agents / handoffs, or mark `N/A` when solo. +- [ ] 5.3 Record unresolved plan questions in `../open-questions.md`, or mark `N/A` when none. + +## 6. Cleanup + +- [ ] 6.1 If this lane owns finalization, run `gx branch finish --branch --base dev --via-pr --wait-for-merge --cleanup`. +- [ ] 6.2 Record PR URL + final `MERGED` state in the handoff. +- [ ] 6.3 Confirm sandbox cleanup (`git worktree list`, `git branch -a`) or append `BLOCKED:` and stop. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/kickoff-prompts.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/kickoff-prompts.md new file mode 100644 index 0000000..d4e6708 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/kickoff-prompts.md @@ -0,0 +1,108 @@ +# Kickoff Prompts (Copy/Paste) + +Use these only when the coordinator decides wave-splitting is needed. + +## Prompt A — Wave A (Primary lane) + +```text +You own Wave-A for plan `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` in /home/deadpool/Documents/codex-lb. + +Goal: +Implement the assigned Wave-A scope and return verification evidence. + +Hard constraints: +- You are not alone in the codebase; do not revert others' work. +- Stay in your owned files/modules only. +- Record explicit handoff notes for integration. + +Owned scope: +- + +Verification: +- + +Handoff format: +- Files changed +- Behavior touched +- Verification outputs +- Risks/follow-ups +``` + +## Prompt B — Wave B (Secondary lane) + +```text +You own Wave-B for plan `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` in /home/deadpool/Documents/codex-lb. + +Goal: +Implement the assigned Wave-B scope and return verification evidence. + +Hard constraints: +- You are not alone in the codebase; do not revert others' work. +- Stay in your owned files/modules only. +- Record explicit handoff notes for integration. + +Owned scope: +- + +Verification: +- + +Handoff format: +- Files changed +- Behavior touched +- Verification outputs +- Risks/follow-ups +``` + +## Prompt C — Wave C (Secondary lane) + +```text +You own Wave-C for plan `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` in /home/deadpool/Documents/codex-lb. + +Goal: +Implement the assigned Wave-C scope and return verification evidence. + +Hard constraints: +- You are not alone in the codebase; do not revert others' work. +- Stay in your owned files/modules only. +- Record explicit handoff notes for integration. + +Owned scope: +- + +Verification: +- + +Handoff format: +- Files changed +- Behavior touched +- Verification outputs +- Risks/follow-ups +``` + +## Prompt D — Integrator lane + +```text +You are the integrator for plan `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` in /home/deadpool/Documents/codex-lb. + +Goal: +Integrate completed waves, resolve conflicts, run final verification, and prepare rollout/cutover notes. + +Hard constraints: +- You are not alone in the codebase; do not revert others' work. +- Preserve safety-critical behavior unless explicitly planned and tested. +- Keep final output evidence-first. + +Owned scope: +- integration glue and shared touchpoints +- final validation + handoff summary + +Verification: +- + +Final report: +- Files changed +- Integration decisions +- Verification outputs +- Remaining risks +``` diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/open-questions.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/open-questions.md new file mode 100644 index 0000000..17dd7f3 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/open-questions.md @@ -0,0 +1,6 @@ +# Open Questions: agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10 + +Capture unresolved plan questions here as unchecked checklist items. +Keep each item concrete, decision-shaped, and easy to close with evidence. + +- [ ] Add the next unresolved question here. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/phases.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/phases.md new file mode 100644 index 0000000..4ae229f --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/phases.md @@ -0,0 +1,15 @@ +# Plan Phases: agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10 + +One entry per phase. Checkbox marks map to: `x` = completed, `>` = in progress, space = pending. +Indented sub-bullets are optional metadata consumed by the Plans UI: + +- `session`: which agent kind runs the phase (`codex` / `claude`). +- `checkpoints`: comma-separated role checkpoint ids delivered within the phase. +- `summary`: one short sentence rendered under the phase title. + +One phase is intended to fit into a single Codex or Claude session task. + +- [ ] [PH01] First milestone title goes here + - session: codex + - checkpoints: P1, A1 + - summary: Describe the single session outcome expected for this phase. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/.openspec.yaml b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/.openspec.yaml new file mode 100644 index 0000000..7ee19fa --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/.openspec.yaml @@ -0,0 +1,9 @@ +schema: 1 +plan: agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10 +role: planner +status: draft +artifacts: + prompt: prompt.md + proposal: proposal.md + tasks: tasks.md + spec: specs/planner/spec.md diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/README.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/README.md new file mode 100644 index 0000000..1b0ad5d --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/README.md @@ -0,0 +1,12 @@ +# planner + +Role workspace for `planner`. + +Default artifacts: +- `.openspec.yaml` +- `prompt.md` +- `proposal.md` +- `tasks.md` +- `specs//spec.md` + +Use this folder for role notes, artifacts, and status updates. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/plan.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/plan.md new file mode 100644 index 0000000..feed278 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/plan.md @@ -0,0 +1,65 @@ +# ExecPlan: agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10 + +This ExecPlan is a living document. Keep `Progress`, `Surprises & Discoveries`, `Decision Log`, and `Outcomes & Retrospective` current as work proceeds. + +Follow repository guidance in `openspec/plan/PLANS.md`. + +## Purpose / Big Picture + +Describe what becomes possible after this plan is executed and how a user/operator can observe it working. + +## Progress + +- [ ] (YYYY-MM-DD HH:MMZ) Capture initial scope and acceptance criteria. +- [ ] (YYYY-MM-DD HH:MMZ) Draft architecture/tradeoff plan and verification strategy. +- [ ] (YYYY-MM-DD HH:MMZ) Finalize execution-ready handoff. + +## Surprises & Discoveries + +- Observation: _none yet_ + Evidence: _n/a_ + +## Decision Log + +- Decision: Use OpenSpec plan workspace as source of truth for this planning cycle. + Rationale: Keeps planning artifacts in-repo and reviewable. + Date/Author: YYYY-MM-DD / planner + +## Outcomes & Retrospective + +Summarize outcomes, gaps, and lessons learned when a milestone or the full plan is completed. + +## Context and Orientation + +Describe relevant modules, files, constraints, and assumptions for a newcomer. Use repository-relative paths. + +## Plan of Work + +Describe the sequence of edits and deliverables in prose. Name target files and expected effects. + +## Concrete Steps + +List exact commands with working directory and short expected outcomes. + + cd /home/deadpool/Documents/codex-lb + openspec validate --specs + +## Validation and Acceptance + +State observable behavior and verification evidence required before execution handoff. + +## Idempotence and Recovery + +Document safe re-run behavior, rollback strategy, and failure recovery notes. + +## Artifacts and Notes + +Capture concise command output snippets, evidence pointers, and references. + +## Interfaces and Dependencies + +Name concrete interfaces/modules/dependencies and any required signatures/contracts. + +## Revision Note + +- YYYY-MM-DD HH:MMZ: Initial scaffold generated by `scripts/openspec/init-plan-workspace.sh`. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/prompt.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/prompt.md new file mode 100644 index 0000000..97da9ab --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/prompt.md @@ -0,0 +1,34 @@ +# planner Prompt + +You are the `planner` role for OpenSpec plan `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10`. + +## Objective + +Complete only this role's assigned checklist and leave compact evidence for the coordinator. + +## Source of truth + +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/summary.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/checkpoints.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/open-questions.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/tasks.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/proposal.md` + +## Before edits + +1. Confirm branch/worktree with `git status --short --branch`. +2. Claim every touched file before editing: + - Prefer Colony `task_claim_file` when an active task exists. + - Otherwise run `gx locks claim --branch `. +3. Stay inside assigned files/modules; coordinate before touching shared paths. + +## Working rules + +- Update `planner/tasks.md` as each item completes. +- Record durable unresolved questions in `open-questions.md`. +- Keep handoffs short: files changed, behavior touched, verification, risks. +- Do not revert another agent's edits. + +## Cleanup + +Only the owner/finalizer lane runs `gx branch finish --branch --base dev --via-pr --wait-for-merge --cleanup`. If blocked, append `BLOCKED:` with branch, task, blocker, next, evidence. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/proposal.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/proposal.md new file mode 100644 index 0000000..2952a15 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/proposal.md @@ -0,0 +1,15 @@ +# Proposal: planner (agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10) + +## Why + +Summarize why this role's work is required for plan `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10`. + +## What Changes + +- [ ] List the planned role-specific changes + +## Impact + +- Scope: +- Risks: +- Dependencies: diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/specs/planner/spec.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/specs/planner/spec.md new file mode 100644 index 0000000..636e7c0 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/specs/planner/spec.md @@ -0,0 +1,10 @@ +# Capability Spec: planner + +## ADDED Requirements + +### Requirement: planner responsibilities for `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` +This role MUST define and deliver its scoped outputs with evidence. + +#### Scenario: Role executes assigned scope +- **WHEN** the role begins execution for `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` +- **THEN** it follows `tasks.md` and records evidence for completion diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/tasks.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/tasks.md new file mode 100644 index 0000000..bb63172 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/planner/tasks.md @@ -0,0 +1,33 @@ +# planner tasks + +## 1. Spec + +- [ ] 1.1 Define planning principles, decision drivers, and viable options for `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` +- [ ] 1.2 Validate that scope, constraints, and acceptance criteria are captured in `summary.md` + +## 2. Tests + +- [ ] 2.1 Define verification approach for plan quality (traceability, testability, evidence expectations) +- [ ] 2.2 Validate OpenSpec consistency checkpoints (including `openspec validate --specs` when applicable) + +## 3. Implementation + +- [ ] 3.1 Produce the initial RALPLAN-DR plan draft +- [ ] 3.2 Integrate Architect/Critic feedback into revised plan iterations +- [ ] 3.3 Publish final planning handoff with explicit execution lanes + +## 4. Checkpoints + +- [ ] [P1] READY - Initial planning draft checkpoint + +## 5. Collaboration + +- [ ] 5.1 Owner recorded this lane before edits. +- [ ] 5.2 Record joined agents / handoffs, or mark `N/A` when solo. +- [ ] 5.3 Record unresolved plan questions in `../open-questions.md`, or mark `N/A` when none. + +## 6. Cleanup + +- [ ] 6.1 If this lane owns finalization, run `gx branch finish --branch --base dev --via-pr --wait-for-merge --cleanup`. +- [ ] 6.2 Record PR URL + final `MERGED` state in the handoff. +- [ ] 6.3 Confirm sandbox cleanup (`git worktree list`, `git branch -a`) or append `BLOCKED:` and stop. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/summary.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/summary.md new file mode 100644 index 0000000..905e43b --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/summary.md @@ -0,0 +1,8 @@ +# Plan Summary: agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10 + +- **Mode:** ralplan +- **Status:** draft + +## Context + +Describe the planning context, constraints, and desired outcomes. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/.openspec.yaml b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/.openspec.yaml new file mode 100644 index 0000000..086b812 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/.openspec.yaml @@ -0,0 +1,9 @@ +schema: 1 +plan: agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10 +role: verifier +status: draft +artifacts: + prompt: prompt.md + proposal: proposal.md + tasks: tasks.md + spec: specs/verifier/spec.md diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/README.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/README.md new file mode 100644 index 0000000..1daa373 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/README.md @@ -0,0 +1,12 @@ +# verifier + +Role workspace for `verifier`. + +Default artifacts: +- `.openspec.yaml` +- `prompt.md` +- `proposal.md` +- `tasks.md` +- `specs//spec.md` + +Use this folder for role notes, artifacts, and status updates. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/prompt.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/prompt.md new file mode 100644 index 0000000..e1844bd --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/prompt.md @@ -0,0 +1,34 @@ +# verifier Prompt + +You are the `verifier` role for OpenSpec plan `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10`. + +## Objective + +Complete only this role's assigned checklist and leave compact evidence for the coordinator. + +## Source of truth + +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/summary.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/checkpoints.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/open-questions.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/tasks.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/proposal.md` + +## Before edits + +1. Confirm branch/worktree with `git status --short --branch`. +2. Claim every touched file before editing: + - Prefer Colony `task_claim_file` when an active task exists. + - Otherwise run `gx locks claim --branch `. +3. Stay inside assigned files/modules; coordinate before touching shared paths. + +## Working rules + +- Update `verifier/tasks.md` as each item completes. +- Record durable unresolved questions in `open-questions.md`. +- Keep handoffs short: files changed, behavior touched, verification, risks. +- Do not revert another agent's edits. + +## Cleanup + +Only the owner/finalizer lane runs `gx branch finish --branch --base dev --via-pr --wait-for-merge --cleanup`. If blocked, append `BLOCKED:` with branch, task, blocker, next, evidence. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/proposal.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/proposal.md new file mode 100644 index 0000000..a4e66ea --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/proposal.md @@ -0,0 +1,15 @@ +# Proposal: verifier (agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10) + +## Why + +Summarize why this role's work is required for plan `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10`. + +## What Changes + +- [ ] List the planned role-specific changes + +## Impact + +- Scope: +- Risks: +- Dependencies: diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/specs/verifier/spec.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/specs/verifier/spec.md new file mode 100644 index 0000000..ad56a18 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/specs/verifier/spec.md @@ -0,0 +1,10 @@ +# Capability Spec: verifier + +## ADDED Requirements + +### Requirement: verifier responsibilities for `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` +This role MUST define and deliver its scoped outputs with evidence. + +#### Scenario: Role executes assigned scope +- **WHEN** the role begins execution for `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` +- **THEN** it follows `tasks.md` and records evidence for completion diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/tasks.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/tasks.md new file mode 100644 index 0000000..a891130 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/verifier/tasks.md @@ -0,0 +1,33 @@ +# verifier tasks + +## 1. Spec + +- [ ] 1.1 Define end-to-end validation matrix for `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` +- [ ] 1.2 Validate success/failure conditions and evidence requirements + +## 2. Tests + +- [ ] 2.1 Execute verification commands and collect outputs +- [ ] 2.2 Validate idempotency/re-run behavior and error-path handling + +## 3. Implementation + +- [ ] 3.1 Verify completed work against acceptance criteria +- [ ] 3.2 Produce pass/fail findings with concrete evidence links +- [ ] 3.3 Publish final verification sign-off (or blocker report) + +## 4. Checkpoints + +- [ ] [V1] READY - Verification checkpoint + +## 5. Collaboration + +- [ ] 5.1 Owner recorded this lane before edits. +- [ ] 5.2 Record joined agents / handoffs, or mark `N/A` when solo. +- [ ] 5.3 Record unresolved plan questions in `../open-questions.md`, or mark `N/A` when none. + +## 6. Cleanup + +- [ ] 6.1 If this lane owns finalization, run `gx branch finish --branch --base dev --via-pr --wait-for-merge --cleanup`. +- [ ] 6.2 Record PR URL + final `MERGED` state in the handoff. +- [ ] 6.3 Confirm sandbox cleanup (`git worktree list`, `git branch -a`) or append `BLOCKED:` and stop. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/.openspec.yaml b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/.openspec.yaml new file mode 100644 index 0000000..02a2b36 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/.openspec.yaml @@ -0,0 +1,9 @@ +schema: 1 +plan: agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10 +role: writer +status: draft +artifacts: + prompt: prompt.md + proposal: proposal.md + tasks: tasks.md + spec: specs/writer/spec.md diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/README.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/README.md new file mode 100644 index 0000000..757c824 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/README.md @@ -0,0 +1,12 @@ +# writer + +Role workspace for `writer`. + +Default artifacts: +- `.openspec.yaml` +- `prompt.md` +- `proposal.md` +- `tasks.md` +- `specs//spec.md` + +Use this folder for role notes, artifacts, and status updates. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/prompt.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/prompt.md new file mode 100644 index 0000000..67f42bd --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/prompt.md @@ -0,0 +1,34 @@ +# writer Prompt + +You are the `writer` role for OpenSpec plan `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10`. + +## Objective + +Complete only this role's assigned checklist and leave compact evidence for the coordinator. + +## Source of truth + +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/summary.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/checkpoints.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/open-questions.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/tasks.md` +- `openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/proposal.md` + +## Before edits + +1. Confirm branch/worktree with `git status --short --branch`. +2. Claim every touched file before editing: + - Prefer Colony `task_claim_file` when an active task exists. + - Otherwise run `gx locks claim --branch `. +3. Stay inside assigned files/modules; coordinate before touching shared paths. + +## Working rules + +- Update `writer/tasks.md` as each item completes. +- Record durable unresolved questions in `open-questions.md`. +- Keep handoffs short: files changed, behavior touched, verification, risks. +- Do not revert another agent's edits. + +## Cleanup + +Only the owner/finalizer lane runs `gx branch finish --branch --base dev --via-pr --wait-for-merge --cleanup`. If blocked, append `BLOCKED:` with branch, task, blocker, next, evidence. diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/proposal.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/proposal.md new file mode 100644 index 0000000..871ded5 --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/proposal.md @@ -0,0 +1,15 @@ +# Proposal: writer (agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10) + +## Why + +Summarize why this role's work is required for plan `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10`. + +## What Changes + +- [ ] List the planned role-specific changes + +## Impact + +- Scope: +- Risks: +- Dependencies: diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/specs/writer/spec.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/specs/writer/spec.md new file mode 100644 index 0000000..8a086cb --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/specs/writer/spec.md @@ -0,0 +1,10 @@ +# Capability Spec: writer + +## ADDED Requirements + +### Requirement: writer responsibilities for `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` +This role MUST define and deliver its scoped outputs with evidence. + +#### Scenario: Role executes assigned scope +- **WHEN** the role begins execution for `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` +- **THEN** it follows `tasks.md` and records evidence for completion diff --git a/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/tasks.md b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/tasks.md new file mode 100644 index 0000000..31cf46c --- /dev/null +++ b/openspec/plan/agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10/writer/tasks.md @@ -0,0 +1,33 @@ +# writer tasks + +## 1. Spec + +- [ ] 1.1 Validate documentation scope and audience for `agent-claude-masterplan-robust-paste-helper-2026-05-16-02-10` +- [ ] 1.2 Validate consistency between plan terminology and OpenSpec artifacts + +## 2. Tests + +- [ ] 2.1 Define documentation verification checklist (accuracy, completeness, command correctness) +- [ ] 2.2 Validate command/help text examples against current workflow behavior + +## 3. Implementation + +- [ ] 3.1 Update workflow docs and command guidance for approved plan behavior +- [ ] 3.2 Add or refine examples for operator usage and handoff clarity +- [ ] 3.3 Publish final docs change summary with references + +## 4. Checkpoints + +- [ ] [W1] READY - Docs update checkpoint + +## 5. Collaboration + +- [ ] 5.1 Owner recorded this lane before edits. +- [ ] 5.2 Record joined agents / handoffs, or mark `N/A` when solo. +- [ ] 5.3 Record unresolved plan questions in `../open-questions.md`, or mark `N/A` when none. + +## 6. Cleanup + +- [ ] 6.1 If this lane owns finalization, run `gx branch finish --branch --base dev --via-pr --wait-for-merge --cleanup`. +- [ ] 6.2 Record PR URL + final `MERGED` state in the handoff. +- [ ] 6.3 Confirm sandbox cleanup (`git worktree list`, `git branch -a`) or append `BLOCKED:` and stop. diff --git a/scripts/codex-fleet/bin/pane-context-menu.sh b/scripts/codex-fleet/bin/pane-context-menu.sh index 3bd03ff..3b41ed3 100755 --- a/scripts/codex-fleet/bin/pane-context-menu.sh +++ b/scripts/codex-fleet/bin/pane-context-menu.sh @@ -350,36 +350,10 @@ case "$choice" in tmux display-message -d 1500 '▢ Visible area copied' ;; l) printf '%s' "$MOUSE_LINE" | wl-copy tmux display-message -d 1500 '─ Line copied' ;; - p) # Paste from the SYSTEM clipboard (Wayland wl-paste). Falls through to - # tmux's own buffer if wl-paste is unavailable. Images are detected via - # MIME type and saved to /tmp/clipboard-paste-.; the saved path - # is then pasted as text so downstream CLIs (codex/claude) can read it. - if command -v wl-paste >/dev/null 2>&1; then - mimes="$(wl-paste --list-types 2>/dev/null || true)" - img_mime="$(printf '%s\n' "$mimes" | grep -m1 -oE '^image/(png|jpeg|gif|webp|bmp)' || true)" - if [ -n "$img_mime" ]; then - ext="${img_mime#image/}"; [ "$ext" = "jpeg" ] && ext="jpg" - out="/tmp/clipboard-paste-$(date +%s).$ext" - if wl-paste --type "$img_mime" > "$out" 2>/dev/null && [ -s "$out" ]; then - printf '%s' "$out" | tmux load-buffer -b _menu_paste - - tmux paste-buffer -b _menu_paste -t "$PANE_ID" -p - tmux delete-buffer -b _menu_paste 2>/dev/null || true - tmux display-message -d 1800 "⤓ Image pasted as path: $out" - else - rm -f "$out" 2>/dev/null || true - tmux display-message -d 1500 '⚠ Image paste failed' - fi - else - wl-paste --no-newline 2>/dev/null | tmux load-buffer -b _menu_paste - - tmux paste-buffer -b _menu_paste -t "$PANE_ID" -p - tmux delete-buffer -b _menu_paste 2>/dev/null || true - tmux display-message -d 1500 '⤓ Pasted from clipboard' - fi - else - tmux paste-buffer -t "$PANE_ID" -p - tmux display-message -d 1500 '⤓ Pasted from tmux buffer (no wl-paste)' - fi - ;; + p) # Robust paste — MIME detection, image validation, structured logging + # all live in pane-menu-paste.sh so behavior stays identical across the + # bash menu (here) and the tmux display-menu in style-tabs.sh. + bash "$SCRIPT_DIR/pane-menu-paste.sh" "$PANE_ID" ;; '<') tmux copy-mode -t "$PANE_ID" tmux send-keys -X -t "$PANE_ID" history-top ;; '>') tmux copy-mode -t "$PANE_ID" diff --git a/scripts/codex-fleet/bin/pane-menu-paste.sh b/scripts/codex-fleet/bin/pane-menu-paste.sh new file mode 100755 index 0000000..e534221 --- /dev/null +++ b/scripts/codex-fleet/bin/pane-menu-paste.sh @@ -0,0 +1,197 @@ +#!/usr/bin/env bash +# pane-menu-paste.sh — robust clipboard paste helper for fleet pane menus. +# Reads system clipboard via wl-paste, picks best MIME (image > file URI > +# text), validates payload (size + magic bytes for images), saves images +# under /tmp/codex-fleet-clipboard/, and pastes resulting text/path into the +# target tmux pane via a bracketed paste-buffer. Every invocation appends +# one structured line to /tmp/codex-fleet-paste.log for debuggability. +# Usage: pane-menu-paste.sh +set -eo pipefail + +# shellcheck source=/dev/null +source "$(dirname "${BASH_SOURCE[0]}")/../lib/_tmux.sh" + +PANE_ID="${1:-}" +LOG_FILE="/tmp/codex-fleet-paste.log" +CLIP_DIR="/tmp/codex-fleet-clipboard" +BUF="_menu_paste" + +[[ -z "$PANE_ID" ]] && { echo "pane-menu-paste.sh: missing pane_id arg" >&2; exit 2; } +mkdir -p "$CLIP_DIR" 2>/dev/null && chmod 700 "$CLIP_DIR" 2>/dev/null || true # SC2174 + +# ── logging ──────────────────────────────────────────────────────────────── +log_line() { + local outcome="$1" mime="$2" size="$3" path="$4" err="$5" + printf '[%s] pane=%s outcome=%s mime=%s size=%s path=%s err=%s\n' \ + "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$PANE_ID" \ + "$outcome" "${mime:--}" "${size:--}" "${path:--}" "${err:--}" \ + >> "$LOG_FILE" 2>/dev/null || true +} + +# shellcheck disable=SC2329 # called via trap, not directly +cleanup() { + find "$CLIP_DIR" -type f -mmin +60 -delete 2>/dev/null || true + [[ -f "$LOG_FILE" && $(wc -c < "$LOG_FILE") -gt 102400 ]] \ + && tail -c 51200 "$LOG_FILE" > /tmp/.paste.log.new 2>/dev/null \ + && mv /tmp/.paste.log.new "$LOG_FILE" 2>/dev/null || true +} +trap cleanup EXIT + +# ── helpers ──────────────────────────────────────────────────────────────── +mime_to_ext() { + case "$1" in + image/jpeg) printf 'jpg' ;; + image/svg+xml) printf 'svg' ;; + image/x-icon) printf 'ico' ;; + image/*) printf '%s' "${1#image/}" ;; + *) printf 'bin' ;; + esac +} + +# First 16 bytes as hex. Used for magic-byte checks + failure diagnostics. +hex_head() { xxd -p -l 16 "$1" 2>/dev/null | tr -d '\n'; } + +# Validate magic bytes against claimed MIME. Returns 0 on match. +validate_magic() { + local mime="$1" file="$2" hex + hex="$(hex_head "$file")" + [[ -z "$hex" ]] && return 1 + case "$mime" in + image/png) [[ "$hex" == 89504e47* ]] ;; + image/jpeg) [[ "$hex" == ffd8ff* ]] ;; + image/gif) [[ "${hex:0:8}" == "47494638" ]] ;; + image/webp) [[ "${hex:0:8}" == "52494646" && "${hex:16:8}" == "57454250" ]] ;; + image/bmp) [[ "${hex:0:4}" == "424d" ]] ;; + image/tiff) [[ "${hex:0:8}" == "49492a00" || "${hex:0:8}" == "4d4d002a" ]] ;; + image/x-icon) [[ "${hex:0:8}" == "00000100" ]] ;; + image/avif|image/heic|image/heif) + # ISO-BMFF box: 4-byte size then 'ftyp' at byte 4. + [[ "${hex:8:8}" == "66747970" ]] ;; + image/svg+xml) + head -c 256 "$file" 2>/dev/null | grep -qE '<\?xml|/dev/null || return 1 + tmux paste-buffer -b "$BUF" -t "$PANE_ID" -p 2>/dev/null || return 1 + tmux delete-buffer -b "$BUF" 2>/dev/null || true + return 0 +} + +# urldecode for file:// URIs (RFC 3986). +url_decode() { local s="${1//+/ }"; printf '%b' "${s//%/\\x}"; } + +# ── wl-paste missing → fall back to tmux's own paste buffer ──────────────── +if ! command -v wl-paste >/dev/null 2>&1; then + if tmux paste-buffer -t "$PANE_ID" -p 2>/dev/null; then + tmux display-message -d 1500 '⤓ pasted from tmux buffer (no wl-paste)' || true + log_line "text" "tmux-buffer" "-" "-" "wl-paste-missing" + exit 0 + fi + tmux display-message -d 2000 '⚠ no clipboard helper and tmux buffer empty' || true + log_line "fail-fallback" "-" "-" "-" "wl-paste-missing-and-buffer-empty" + exit 1 +fi + +# ── enumerate available MIME types once ──────────────────────────────────── +mimes="$(wl-paste --list-types 2>/dev/null || true)" + +# ── (1) image preference order ───────────────────────────────────────────── +IMG_PREF=( + image/png image/webp image/jpeg image/avif image/heic image/heif + image/gif image/bmp image/tiff image/svg+xml image/x-icon +) + +for mime in "${IMG_PREF[@]}"; do + printf '%s\n' "$mimes" | grep -Fxq "$mime" || continue + ext="$(mime_to_ext "$mime")" + out="$CLIP_DIR/clipboard-paste-$(date +%Y%m%d-%H%M%S).$ext" + + if ! wl-paste --type "$mime" > "$out" 2>/dev/null; then + log_line "fail-fallback" "$mime" "0" "$out" "wl-paste-exit-nonzero" + rm -f "$out" 2>/dev/null || true + continue + fi + + size="$(wc -c < "$out" 2>/dev/null || echo 0)" + if (( size <= 100 )); then + log_line "fail-fallback" "$mime" "$size" "$out" "too-small hex=$(hex_head "$out")" + rm -f "$out" 2>/dev/null || true + continue + fi + + if ! validate_magic "$mime" "$out"; then + log_line "fail-fallback" "$mime" "$size" "$out" "magic-mismatch hex=$(hex_head "$out")" + rm -f "$out" 2>/dev/null || true + continue + fi + + if paste_text_buf "$out"; then + tmux display-message -d 1800 "⤓ image pasted: $(basename "$out")" || true + log_line "image" "$mime" "$size" "$out" "-" + exit 0 + fi + log_line "fail-fallback" "$mime" "$size" "$out" "tmux-paste-failed" + # Keep the saved file so the operator can recover it manually. + break +done + +# ── (2) text/uri-list — paste file path(s) ──────────────────────────────── +if printf '%s\n' "$mimes" | grep -Fxq "text/uri-list"; then + uris="$(wl-paste --type text/uri-list 2>/dev/null || true)" + paths="" + while IFS= read -r line; do + line="${line%$'\r'}" + [[ -z "$line" || "$line" == \#* ]] && continue + case "$line" in + file://*) + decoded="$(url_decode "${line#file://}")" + if [[ -f "$decoded" && -r "$decoded" ]]; then + paths+="${paths:+$'\n'}$decoded" + fi + ;; + esac + done <<<"$uris" + + if [[ -n "$paths" ]]; then + if paste_text_buf "$paths"; then + first="${paths%%$'\n'*}" + tmux display-message -d 1800 "⤓ path pasted: $(basename "$first")" || true + log_line "uri-list" "text/uri-list" "${#paths}" "$first" "-" + exit 0 + fi + log_line "fail-fallback" "text/uri-list" "${#paths}" "$first" "tmux-paste-failed" + fi +fi + +# ── (3) text fallback (text/plain or any text/*) ────────────────────────── +text_mime="" +if printf '%s\n' "$mimes" | grep -Fxq "text/plain;charset=utf-8"; then + text_mime="text/plain;charset=utf-8" +elif printf '%s\n' "$mimes" | grep -Fxq "text/plain"; then + text_mime="text/plain" +else + text_mime="$(printf '%s\n' "$mimes" | grep -m1 -E '^text/' || true)" +fi + +if [[ -n "$text_mime" ]]; then + text="$(wl-paste --type "$text_mime" --no-newline 2>/dev/null || true)" + if [[ -n "$text" ]]; then + if paste_text_buf "$text"; then + tmux display-message -d 1500 "⤓ text pasted (${#text} chars)" || true + log_line "text" "$text_mime" "${#text}" "-" "-" + exit 0 + fi + log_line "fail-fallback" "$text_mime" "${#text}" "-" "tmux-paste-failed" + else + log_line "fail-fallback" "$text_mime" "0" "-" "wl-paste-empty" + fi +fi + +# ── nothing usable on the clipboard ─────────────────────────────────────── +tmux display-message -d 2000 '⚠ clipboard empty or unsupported' || true +log_line "fail-fallback" "-" "-" "-" "no-usable-mime mimes=$(printf '%s' "$mimes" | tr '\n' ',' | head -c 200)" +exit 1 diff --git a/scripts/codex-fleet/style-tabs.sh b/scripts/codex-fleet/style-tabs.sh index b3fdac5..4c41e64 100755 --- a/scripts/codex-fleet/style-tabs.sh +++ b/scripts/codex-fleet/style-tabs.sh @@ -307,7 +307,7 @@ bind-key -T root MouseDown3Pane \ display-menu -O -x M -y M \ -T "#[align=centre,bold,fg=#FFFFFF,bg=#1C1C1E] pane #{pane_index} · #{pane_id} " \ "#{?#{!=:#{buffer_size},0},#[fg=#34C759]✓ #[fg=#FFFFFF,bold]Copy selection #[fg=#8E8E93,italics]\"#{=/22/...:buffer_sample}\",-}" "" "run-shell \"tmux save-buffer - | bash ${CODEX_FLEET_REPO_ROOT}/scripts/codex-fleet/bin/pane-menu-clip-dual.sh && tmux send-keys -X -t '#{pane_id}' cancel 2>/dev/null ; tmux display-message -d 1200 '✓ selection copied'\"" \ - "#[fg=#34C759]↳ #[fg=#FFFFFF]Paste clipboard" p "run-shell \"wl-paste --no-newline | tmux load-buffer - && tmux paste-buffer -d -p -t '#{pane_id}'\"" \ + "#[fg=#34C759]↳ #[fg=#FFFFFF]Paste clipboard" p "run-shell \"bash ${CODEX_FLEET_REPO_ROOT}/scripts/codex-fleet/bin/pane-menu-paste.sh '#{pane_id}'\"" \ "" "" "" \ "#[fg=#AEAEB2]▣ #[fg=#FFFFFF]Copy whole pane" C "run-shell \"tmux capture-pane -t '#{pane_id}' -p -S - -E - | bash ${CODEX_FLEET_REPO_ROOT}/scripts/codex-fleet/bin/pane-menu-clip-dual.sh && tmux display-message -d 1200 '▣ pane history copied'\"" \ "#[fg=#AEAEB2]▢ #[fg=#FFFFFF]Copy visible" c "run-shell \"tmux capture-pane -t '#{pane_id}' -p | bash ${CODEX_FLEET_REPO_ROOT}/scripts/codex-fleet/bin/pane-menu-clip-dual.sh && tmux display-message -d 1200 '▢ visible area copied'\"" \