For the complete documentation index, see llms.txt. This page is also available as Markdown.

Instrument Flows

The instrument-flows skill inserts Triton Log actions into a Flow's metadata XML at entry, fault paths, and record operations, then optionally deploys it.

The instrument-flows skill reads a Flow's metadata XML, parses its elements, and inserts Triton Log actions at the moments that matter — flow entry, every fault connector, negative decision branches, record operations, and subflow boundaries — using the TritonFlow invocable. Then it shows you the diff and, if you want, deploys.

Invocation is agent-specific. In agents that support slash commands (Claude Code, Cursor) you invoke it as /pharos:instrument-flows <path>; in others you point the agent at this skill and give it the path. See Running these in your agent.

Usage

/pharos:instrument-flows <path> [--area <Area>] [--level <Level>] [--deploy]
Argument
Required
Meaning

<path>

✅

The .flow-meta.xml file to instrument. If omitted, the skill asks.

--area

The business/functional Area (a free String, required on every log action). Inferred from the flow's purpose and matched to related code if omitted.

--level

Default level for informational checkpoints. Defaults to INFO. Fault paths always use ERROR.

--deploy

Deploy the flow after you accept the diff.

How Flow logging works — individual named inputs

Flow logging calls the TritonFlow invocable — an Apex action labeled Log, under the TritonLogging category. The crucial detail: the log record is built in Apex, and the Flow supplies individual named String inputs. Each field is its own <inputParameters> element.

Required inputs on every log action

Input
Required
Notes

area

✅

Area string (free-form; matched to related code).

summary

✅

The log's one-line headline.

interviewGUID

✅

Always {!$Flow.InterviewGuid} — exact casing interviewGUID.

Optional inputs the skill sets where relevant: category (recommend Flow; invalid values fall back to Flow), type (from <processType>, e.g. Screen Flow), level, details, operation, flowApiName (the plain API name — no version suffix), flowVersion, transactionId, additionalFields (a JSON string), and stacktrace / fullStacktrace for chaining.

Split the name and the version. flowApiName takes the plain API name; the version number goes in flowVersion. Component-scoped Log_Level__mdt rules match the Flow API Name in full, so My_Flow-4 won't match a rule naming My_Flow. See Logging in Flow.

Chaining stack traces. The fullStacktrace output is populated; the stacktrace output is always null — don't rely on it. To carry context forward, assign fullStacktrace to a variable and pass it as the fullStacktrace input of a later action.

The canonical log action

What it instruments

After parsing the flow's <processType>, elements, fault connectors, start node, and any existing TritonFlow actions (already-instrumented elements are skipped), the skill adds:

  • Flow entry — an INFO log after the start connector's first target: Flow started: <FlowApiName>.

  • Fault paths (most critical) — for every element with a <faultConnector>, an ERROR log as the first element on the fault path, with details = {!$Flow.FaultMessage}. This is how Pharos surfaces unhandled Flow errors, and an ERROR level auto-creates an issue — so fault instrumentation is non-negotiable.

  • Negative decision branches — a WARNING log on <decisions> outcomes representing error states or empty results (happy paths stay at DEBUG to keep noise down).

  • Record operations — a DEBUG log after <recordCreates> / <recordUpdates> / <recordDeletes> success paths.

  • Subflow boundaries — an INFO log before each <subflows> element.

The skill never removes existing elements or connectors — it only inserts new <actionCalls> — and it never adds logs inside <loops> (log before/after the loop, not per iteration).

Fault-path logging

Transaction stitching

To tie the Flow into an existing LWC/Apex transaction, the skill passes the id as the transactionId input on every log action. If the flow already has a transaction-id input variable, it references it; otherwise, when the flow is invoked from Apex/LWC, it adds an input variable and passes it:

If no id is supplied, TritonFlow starts/uses one automatically and correlates via the Interview GUID — so transactionId is optional.

Review the diff

The skill summarizes what it added — flow entry, fault paths, decision branches, record operations, subflow calls, the category/type it set, and the transaction-id approach — plus the key XML. Answer yes to apply, modify for corrections, or skip to write nothing. On write, the modified XML goes back to the original .flow-meta.xml, preserving existing indentation and structure.

Deploy

Where to go next

Last updated