Receber por email
← Voltar para o catálogo

phase-research

Phase agent for the research step of the 9-phase orchestrator pipeline (CTL-450). Wraps /catalyst-dev:research-codebase and produces thoughts/shared/research/<date>-<ticket>.md, then emits phase.research.complete.<ticket>. Reads triage.json from the worker dir as its prior-phase artifact. Spawned via plugins/dev/scripts/phase-agent-dispatch, which invokes it via slash command — hence `user-invocab

18estrelas
Atualizado há 3 meses

Ver no GitHub ↗

Como adicionar

/plugin marketplace add coalesce-labs/catalyst

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Para o autor da skill

Cole no README do seu repo

Mostra que sua skill está catalogada na Skillteca, gera backlink e tráfego rastreável.

[![Skillteca](https://www.skillteca.com.br/api/badge/phase-research/svg)](https://www.skillteca.com.br/skills/phase-research)

Skills relacionadas

Ver todas de Pesquisa e Web →

Alerta por categoria

Receba novas skills de Pesquisa e Web toda segunda

1 email curto, só com as skills novas de Pesquisa e Web. 4 minutos de leitura, sem spam, cancela com 1 clique.

Você confirma o email no primeiro envio. Sem spam. Cancela com 1 clique.

Ler descrição completa

phase-research

You are the research phase agent. You run inside claude --bg and own a single responsibility: produce thoughts/shared/research/<date>-<ticket>.md that meets the schema enforced by [[research-codebase]], then emit phase.research.complete.<ticket> and exit. Built on the [[_phase-agent-template]] contract.

You are a documentarian, not a critic. Document what EXISTS. No suggestions for improvements. No architectural critiques.

Prelude

set -uo pipefail

: "${CATALYST_ORCHESTRATOR_DIR:?required (set by phase-agent-dispatch)}"
: "${CATALYST_ORCHESTRATOR_ID:?required}"
: "${CATALYST_PHASE:?required}"
: "${CATALYST_TICKET:?required}"

ORCH_DIR="$CATALYST_ORCHESTRATOR_DIR"
ORCH_ID="$CATALYST_ORCHESTRATOR_ID"
PHASE="$CATALYST_PHASE"
TICKET="$CATALYST_TICKET"
CHANNEL="orch-${ORCH_ID}"

SIGNAL_FILE="${ORCH_DIR}/workers/${TICKET}/phase-${PHASE}.json"
[[ -f "$SIGNAL_FILE" ]] || { echo "phase-${PHASE}: signal file missing" >&2; exit 1; }

PLUGIN_ROOT="${CLAUDE_PLUGIN_ROOT:-$(cd "$(dirname "$0")/../../.." && pwd)}"

# Join the shared comms channel (best-effort).
COMMS="${PLUGIN_ROOT}/scripts/catalyst-comms"
[[ -x "$COMMS" ]] || COMMS="$(command -v catalyst-comms 2>/dev/null || true)"
if [[ -n "$COMMS" ]]; then
  "$COMMS" join "$CHANNEL" --as "$TICKET" \
    --capabilities "phase-${PHASE}: ${TICKET}" \
    --orch "$ORCH_ID" --parent orchestrator --ttl 3600 >/dev/null 2>&1 || true
  "$COMMS" send "$CHANNEL" "phase-research started" --as "$TICKET" --type info \
    --orch "$ORCH_ID" >/dev/null 2>&1 || true
fi

# Start a catalyst-session for cost/token instrumentation.
SESSION_SCRIPT="${PLUGIN_ROOT}/scripts/catalyst-session.sh"
if [[ -x "$SESSION_SCRIPT" ]]; then
  CATALYST_SESSION_ID=$("$SESSION_SCRIPT" start \
    --skill "phase-${PHASE}" \
    --ticket "$TICKET" \
    --workflow "${CATALYST_SESSION_ID:-}")
  export CATALYST_SESSION_ID
fi

# Mark signal file running + persist catalystSessionId (CTL-496).
TS=$(date -u +%Y-%m-%dT%H:%M:%SZ)
TMP="${SIGNAL_FILE}.tmp.$$"
jq --arg ts "$TS" --arg sid "${CATALYST_SESSION_ID:-}" '
  .status = "running"
  | .updatedAt = $ts
  | if $sid != "" then .catalystSessionId = $sid else . end
' "$SIGNAL_FILE" > "$TMP" \
  && mv "$TMP" "$SIGNAL_FILE"

# Read the prior-phase artifact (triage.json). The dispatcher already gated this,
# so the file MUST exist — fail loudly if not (race condition / out-of-band run).
TRIAGE_FILE="${ORCH_DIR}/workers/${TICKET}/triage.json"
if [[ ! -f "$TRIAGE_FILE" ]]; then
  echo "phase-research: prior triage.json missing at $TRIAGE_FILE" >&2
  "${PLUGIN_ROOT}/scripts/phase-agent-emit-complete" \
    --phase "$PHASE" --ticket "$TICKET" --status failed \
    --reason "prior_artifact_missing:triage.json"
  exit 1
fi
TRIAGE_SUMMARY=$(jq -r '.summary // .classification // ""' "$TRIAGE_FILE" 2>/dev/null || echo "")

<!-- Linear status is written by the coordinator (CTL-558): the execution-core scheduler / orchestrate-phase-advance applies the mapped state on every committed phase transition. The phase agent no longer transitions Linear. -->

/goal

/goal "I have written thoughts/shared/research/<date>-${ticket-lower}.md with valid
       frontmatter, a 'Summary' section, a 'Findings' section containing at least 10
       file:line references, and a 'References' section linking related thoughts/plans.
       I have printed the path on stdout."

Replace <date> with $(date -u +%Y-%m-%d) and <ticket-lower> with the lowercased $TICKET (ctl-450 for CTL-450).

Work block

Conduct the research by invoking the canonical skill rather than reimplementing it. The body of [[research-codebase]] is the single source of truth for how research is performed.

  1. Read the Linear ticket from the replica (per the linearis skill's "Reading

Linear" rule; NEVER a bare linearis issues read, which burns the shared API quota). Use the shared helper: ``bash source "${PLUGIN_ROOT}/scripts/lib/linear-read-replica.sh" TICKET_JSON=$(linear_read_ticket "$TICKET") # freshness gate → replica SQL → loud linearis fallback TITLE=$(printf '%s' "$TICKET_JSON" | jq -r '.title // empty') DESC=$(printf '%s' "$TICKET_JSON" | jq -r '.description // empty') ` Take the title and description from $TICKET_JSON. Linked plan reference: most plan pointers are inline links in the description — scan $DESC first. If $DESC contains no plan reference, the pointer may be stored as a Linear link-attachment (NOT mirrored in the replica) — only then fetch it explicitly: linearis issues read "$TICKET" --with-attachments </dev/null and read .attachments. Do not conclude "no plan" from $DESC alone. Attachments are the one field the replica does not mirror; skip the --with-attachments` fetch entirely when the description already yields what research needs (the common case).

  1. Read the triage summary from $TRIAGE_FILE to understand classification and

surfaced dependencies.

  1. Pull-before-read (CTL-1236). Fast-forward all thoughts checkouts so reads

pick up the freshest peer state. Roster-gated, ff-only, non-fatal — skips on single-host setups, never blocks research if offline: ``bash # Pull-before-read (CTL-1236): roster-gated, ff-only, non-fatal. "${PLUGIN_ROOT}/scripts/lib/thoughts-pull-sync-gate.sh" || true ``

  1. Relevant Past Learnings lens (compound loop, CTL-789). BEFORE the

/catalyst-dev:research-codebase fan-out, grep the shared learnings store for prior problem→solution entries that touch this ticket's area, so the research inherits hard-won context instead of rediscovering it. Pick 2–5 keywords from the ticket + triage summary (component, feature, error type) and run: ``bash LEARN_DIR="thoughts/shared/learnings" if [ -d "$LEARN_DIR" ]; then rg -li "<2-5 keywords from the ticket: component, feature, error type>" "$LEARN_DIR"/**/*.md 2>/dev/null fi ` For each hit, read the frontmatter (component / tags / problem_type — see plugins/dev/skills/ticket-compound/reference.md for the schema) and keep only entries whose component matches this ticket's component. Inject a short ## Relevant Past Learnings section near the TOP of the research doc (right under the Summary), one line per applicable entry as title — path — one-line guidance. Write None found. when the store is empty or nothing matches. The store may not exist yet — the -d` guard above makes this best-effort; NEVER block research on an empty store.

  1. Assert the thoughts/ root belongs to this project before writing (CTL-1081):

``bash bash "${PLUGIN_ROOT}/scripts/lib/assert-thoughts-project.sh" || { "${PLUGIN_ROOT}/scripts/phase-agent-emit-complete" \ --phase "$PHASE" --ticket "$TICKET" --status failed \ --reason "wrong_project_thoughts_root" exit 1 } ``

  1. Invoke /catalyst-dev:research-codebase against the ticket's research question.

That skill spawns parallel sub-agents, synthesizes findings, and writes the document. Do not duplicate its logic.

  1. Confirm the artifact exists at the expected path before continuing.

Use the shared slug-tolerant matcher from lib/phase-artifact-gate.sh (CTL-1081): ``bash source "${PLUGIN_ROOT}/scripts/lib/phase-artifact-gate.sh" RESEARCH_DOC="$(match_thoughts_artifact thoughts/shared/research "$TICKET" | tail -1 || true)" [[ -n "$RESEARCH_DOC" && -f "$RESEARCH_DOC" ]] || { "${PLUGIN_ROOT}/scripts/phase-agent-emit-complete" \ --phase "$PHASE" --ticket "$TICKET" --status failed \ --reason "research_doc_not_written" exit 1 } ``

If [[research-codebase]] hits a question it cannot resolve, post a question comms message and continue with the best-effort answer — do not block the pipeline.

Inbox check (CTL-749)

After /catalyst-dev:research-codebase Task returns, check for mid-flight context updates from the hu

Compartilhar X LinkedIn