LogicTrail for Claude Code
Ask Claude how a feature works and get the path the code actually takes: the entry point, calls, database reads and writes, events, external APIs and the branches between them, with the file and line behind every step.
Install in Claude Code
Requirements-
/plugin marketplace add werlen-nevio/LogicTrail -
/plugin install logictrail@logictrail
/logictrail:explain how does checkout work?
What comes back
Checkout starts in CheckoutPage: it creates the order through
POST /api/orders, then confirms the card payment in the browser with
Stripe.js. The server checks the session and the cart before it creates the order and
a Stripe PaymentIntent.
-
handleCheckout()runs when the customer clicksclient/src/pages/CheckoutPage.tsx:14 -
createOrder()sendsPOST /api/ordersclient/src/api/orders.ts:8 -
requireAuth()answers 401 without a valid session, thenvalidateBody()checks the requestserver/src/middleware/requireAuth.ts:10 -
OrdersController.create()validates the cart; an invalid one gets 400server/src/controllers/ordersController.ts:13 -
OrderService.createOrder()writesorder.create, reserves stock and emitsorder.createdserver/src/services/orderService.ts:9 -
createPaymentIntent()calls Stripe'spaymentIntents.createserver/src/payments/stripe.ts:9 -
Stripe's webhook (inferred, 60%) reaches
handleStripeWebhook(), which marks the order paid or failedserver/src/payments/stripe.ts:29 -
Back in the browser,
result.errordecides between/checkout/failedand the order pageclient/src/pages/CheckoutPage.tsx:19
An example on the sample shop, shortened. Claude's wording varies; the steps and lines
come from the trace. It ends with the viewer:
.logictrail/how-does-checkout-work.html
Watch it run
A question goes in, the trail comes out, and every step points at a line of code.
/logictrail:explain
Ask a question, or start from a code location:
--route "POST /api/orders", --function createSession or
--file src/cart.ts. You don't have to type the command: Claude also uses it
when you ask how something works or what happens when something happens.
-
Finds LogicTrail
On your PATH, as a dev dependency of the project, or downloaded from npm with
npx -y logictrail. -
Traces the flow
It runs
logictrail '<question>' --output json,htmlfrom the project root. Static analysis selects the steps; withANTHROPIC_API_KEYset, Claude does. -
Reads the outline
logictrail-outline, included with the plugin, prints every step in flow order with its file and line, so Claude never loads the whole graph. Then it reads the source at the steps that decide the answer. -
Answers
A direct answer, the path as numbered steps citing file and line, the branches and their error exits, inferred links marked as inferred, and the path to the interactive viewer.
/logictrail:update
A saved flow shows the code as it was when you asked. After the code changes, Claude re-runs it with the same question and limits, reads what changed and explains what it means for the path.
- + paymentAttempt.create (database) server/src/services/orderService.ts:35A step that is new in the flow.
- โ sendPaymentFailedEmail() โ Resend: emails.send (calls)A connection lost between two steps that are in both versions: a call that no longer happens.
- ~ markOrderFailed() server/src/services/orderService.ts:30 โ :32The same step, now on another line.
Run it
/logictrail:updateEvery flow saved in .logictrail/-
/logictrail:update checkoutThe flow whose name matches, such as how-does-checkout-work
Install
Add the marketplace and install the plugin in Claude Code. The CLI comes along on its own through npx.
- LogicTrail CLI
-
Found on your PATH, in the project (
npm install --save-dev logictrail), or downloaded by npx. It needs Node.js 22 or newer. - API key
-
Optional. With
ANTHROPIC_API_KEYset, LogicTrail uses Claude to select the relevant code; otherwise static analysis does. - Saved flows
- Written to
.logictrail/in your project. Add it to .gitignore. - Permissions
- The commands run only LogicTrail and its outline script, and read and search files.
- Without installing
claude --plugin-dir path/to/LogicTrail/claude-plugin
In Claude Code
Source-
/plugin marketplace add werlen-nevio/LogicTrail -
/plugin install logictrail@logictrail