ccb-self-chain
The ccb-self-chain skill diagnoses and repairs broken message and work lineages in Claude Code Bridge systems by tracing job states, inspecting queue and inbox observers, and executing targeted repairs. Use it when replies are missing, artifacts incomplete, callbacks pending, or work chains need resumption after failed or incomplete execution, following a structured classification of retry, resubmit, or acknowledgement repairs.
git clone --depth 1 https://github.com/SeemSeam/claude_codex_bridge /tmp/ccb-self-chain && cp -r /tmp/ccb-self-chain/docs/plantree/plans/ccb-self-role/drafts/agentroles.ccb_self/skills/codex/ccb-self-chain ~/.claude/skills/ccb-self-chainSKILL.md
# CCB Self Chain
Use this skill for message and work-lineage recovery. Do not restart or clear a
pane as the first repair for a lineage problem.
## Core Workflow
1. Identify the lineage id: `job_id`, `message_id`, `attempt_id`, `reply_id`,
inbound event id, or artifact path.
2. Run `ccb trace <id>` and record message, attempt, reply, event, callback,
and job state.
3. Inspect observer state as supplementary evidence:
- `ccb queue --detail <agent|all>`
- `ccb pend --inbox --detail <agent>`
4. If a reply or request is artifact-backed, read the full artifact file before
acting. If the file is absent, expired, truncated, or unreadable, report a
blocker and do not act from preview text.
5. Classify the repair:
- retry: same job or attempt should be retried because the attempt is
failed, incomplete, or retryable and the original lineage remains valid.
- resubmit: original message should be submitted as fresh work because the
old lineage is no longer appropriate.
- ack: acknowledgement or inbox progress is wrong, but the reply is
otherwise accepted.
6. If trace shows a job still running or in flight, run `ccb cancel <job_id>`
first when the user intended repair, then re-run trace before choosing retry
or resubmit. If cancel fails or reports a blocking state, stop and report
the blocker; do not retry, resubmit, or create a second concurrent path for
the same work.
7. Execute a repair command only when trace evidence supports it and the user
supplied maintenance intent:
- `ccb repair retry <job_id|attempt_id>`
- `ccb repair resubmit <message_id>`
- `ccb repair ack <agent_name> [inbound_event_id]`
8. After repair, re-run trace and queue/inbox checks. Success means the new or
repaired lineage is queued/running/completed as intended, the old duplicate
path is cancelled or terminal, and no unexpected pending reply remains. Hand
work back to the original target agent unless the user explicitly retargets
it.
## Decision Rules
- Prefer `repair retry` when the same target and same work should run again
after incomplete, failed, or recoverable execution.
- Prefer `repair resubmit` when the old execution lineage is stale,
context-corrupted, or semantically wrong but the user still wants the task
attempted.
- Prefer `repair ack` only for bad acknowledgement/progress state after a reply
has been accepted.
- For `project_shutdown` lineage, do not use `ack`. Explain that the project
stopped the old execution. Prefer `repair resubmit <message_id>` when the
user wants fresh work because `repair retry` is usually invalid after project
shutdown. Use `repair retry <job_id|attempt_id>` only when trace explicitly
proves the job completed before shutdown and the reply is intact.
- Handoff to `ccb-self-recover` only when trace proves process/context/pane
replacement is required.
- Handoff to `ccb-self-diagnose` when the target id is ambiguous or runtime
state is too uncertain to pick a lineage repair.
## Artifact Rules
Artifact-backed replies are full-text authority for the reply content. Inline
previews are hints only.
When a reply says "read the full text file above before acting":
1. Open the path.
2. Verify it is complete enough for the requested decision.
3. If expected checksum/bytes are available, compare them when cheap.
4. Only then summarize or act.
If the path is missing or expired, say that the artifact content is unavailable
and choose no mutation unless the user provides the full content again.
## Red Lines
- Do not run `ccb restart`, `ccb clear`, or `ccb reload` as the first response
to a lineage problem.
- Do not treat queue/inbox observer snapshots as terminal authority for
completed lineage; use `ccb trace <id>`.
- Do not repair from artifact preview text alone.
- Do not retarget work to another agent unless the user asks for that.Maintain this CCB project's GitHub-facing release and npm publication surface. Use when preparing, publishing, auditing, or fixing CCB releases; updating README.md, README_zh.md, CHANGELOG.md, VERSION, package.json, GitHub release notes/assets, repository description/topics, npm registry state, or GitHub Actions release/test status.
Private built-in CCB configuration skill for agentroles.ccb_self. Design, edit, validate, and prepare reloads for .ccb/ccb.config, role bindings, providers, windows, workspaces, tool windows, sidebar, and provider startup inputs. Use only inside ccb_self; non-self agents should delegate CCB config changes to ccb_self.
Diagnose CCB runtime, mounted daemon graph, tmux namespace and panes, provider context, queue/inbox/trace, replies/artifacts, config drift, and storage boundaries. Use when the user asks what is broken, which agent is stuck, whether CCB is mounted, why a reply did not arrive, or what to check first.
Recover CCB agents, panes, mounts, provider contexts, API/provider failures, config reload aftermath, clear operations, and guarded single-agent restarts. Use when the user asks to fix, recover, restart if safe, clear context, reload, remount, or keep work going after provider/API failure.
Send a request to a CCB agent with `ask`.
Clear CCB managed agent conversation context with `ccb clear`. Use when the user writes `$ccb-clear`, `$ccb_clear`, or asks to clear/reset one or more CCB agent contexts without restarting or deleting project state.
Maintain a structured planning document tree made of roadmap/status files, implementation status or handoff TODO files, topic notes, decision records, open questions, ideas/inspiration pools, and repository/file-structure hygiene plans. Use when Codex needs to create, reorganize, audit, or update a multi-file plan, design-doc folder, roadmap tree, active implementation-status file, repo cleanup/filesystem plan, ADR/decision log, ideas inbox, or linked planning knowledge base; reconcile Done/In Progress/Next state; resume work from TODO/handoff state; move resolved questions into decisions; promote ideas into formal plan artifacts; or keep plan documents and file-structure planning internally consistent without making this project-specific.