一键导入
bootstrap-existing-agent-with-prefactor-cli
Use when an existing agent needs Prefactor resources created via the Prefactor CLI before SDK instrumentation is added.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when an existing agent needs Prefactor resources created via the Prefactor CLI before SDK instrumentation is added.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when performing root-cause analysis on a Prefactor agent run — bad output, surprising behavior, high cost, incomplete work, downvotes, or anything worth investigating. Run in the agent's own codebase. User provides agent instance ID (and agent ID if needed).
Use when choosing which Prefactor SDK skill to load for agent instrumentation or for building a custom provider integration on top of @prefactor/core.
Use when writing or fixing span summary templates (display templates) on Prefactor span type schemas, when spans show raw JSON or blank summaries in the Prefactor UI, or when you want one-line Liquid summaries of agent, llm, tool, and custom spans.
Review proposed or newly written tests for relevance, behavioral value, and maintainability. Use when Codex writes tests, reviews test diffs, receives feedback that tests are unnecessary, or needs to detect "bullshit tests": tests outside scope, tests written only for coverage, tests for impossible/unrealistic cases, tests coupled to implementation details, stale tests that should be removed, or tests adjacent to but not required by the feature.
Codebase health scanner and technical debt tracker. Use when the user asks about code quality, technical debt, dead code, large files, god classes, duplicate functions, code smells, naming issues, import cycles, or coupling problems. Also use when asked for a health score, what to fix next, or to create a cleanup plan. Supports 29 languages.
Codebase health scanner and technical debt tracker. Use when the user asks about code quality, technical debt, dead code, large files, god classes, duplicate functions, code smells, naming issues, import cycles, or coupling problems. Also use when asked for a health score, what to fix next, or to create a cleanup plan. Supports 29 languages.
| name | bootstrap-existing-agent-with-prefactor-cli |
| description | Use when an existing agent needs Prefactor resources created via the Prefactor CLI before SDK instrumentation is added. |
Set up Prefactor resources for an already-working agent before instrumentation code changes.
Core principle: provision first, instrument second.
Apply this skill first when the user asks to:
After this skill completes:
skills/instrument-existing-agent-with-prefactor-sdk/SKILL.md.skills/create-provider-package-with-core/SKILL.md.langchain, ai, openclaw, or custom)Before running CLI commands, choose package first, then install required Prefactor package(s).
bun, npm, pnpm, or yarn).@prefactor/cli for bootstrap commands.prefactor command requirement:
prefactor command comes from the npm package @prefactor/cli.bunx @prefactor/cli, npx @prefactor/cli, pnpm dlx @prefactor/cli, or yarn dlx @prefactor/cli).prefactor help or prefactor <group> help for command details.Examples:
# bun
bun add @prefactor/cli
# npm
npm install @prefactor/cli
# pnpm
pnpm add @prefactor/cli
# yarn
yarn add @prefactor/cli
Run these in order:
prefactor profiles add default [base-url] --api-token <api-token>
prefactor accounts list
prefactor environments create --name <env-name> --account_id <account-id>
prefactor agents create --name <agent-name> --environment_id <environment-id>
prefactor agent_instances register \
--agent_id <agent-id> \
--agent_version_external_identifier <agent-version-id> \
--agent_version_name <agent-version-name> \
--agent_schema_version_external_identifier <schema-version-id> \
--update_current_version
Profile notes:
<profile-name> is any key like default, staging, or prod.--profile <name>.npx @prefactor/cli profiles add ...).Config resolution notes:
./prefactor.json~/.prefactor/prefactor.json./prefactor.jsonCollect and persist these IDs from command output:
environment_idagent_idagent_instance_idChoose package by provider:
@prefactor/langchain@prefactor/ai@prefactor/openclawskills/create-provider-package-with-core/SKILL.mdWhen handing off to SDK instrumentation, import helpers from that selected package directly, for example:
import { init, withSpan, shutdown } from '@prefactor/ai';
// or '@prefactor/langchain'
Do not mix adapter init with withSpan/shutdown from @prefactor/core unless an explicit tracer is passed.
This guidance targets adapter-style integrations (@prefactor/ai, @prefactor/langchain) and does not change @prefactor/openclaw plugin runtime behavior.
If you have identified and selected an existing package, use skills/instrument-existing-agent-with-prefactor-sdk/SKILL.md
Produce this output for the user after setup:
export PREFACTOR_API_URL="<api-url>"
export PREFACTOR_API_TOKEN="<api-token>"
export PREFACTOR_AGENT_ID="<agent-id>"
Use the created agent_id for PREFACTOR_AGENT_ID.
prefactor.json is ignored by git (git check-ignore prefactor.json, git status --short).agent_id to PREFACTOR_AGENT_ID.@prefactor/core directly when a built-in adapter exists.prefactor.json.prefactor.json (contains API tokens).