backtrack-analysis

A command that examines backtracking in a distilled clens coding session, such as repeated failures, difficult iterations, and debugging loops.

In plain words
What is it for?
Use it to classify backtracking, assess its severity, and investigate likely causes using session decisions, reasoning, files, statistics, and timing.
Why use it?
It helps reveal where work was repeated or stalled instead of requiring you to reconstruct those patterns from the session timeline.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/silouone/clens/backtrack-analysis
Clone the repo
git clone --depth 1 https://github.com/silouone/clens
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 724 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00012 $0.00724
Opus 5 $0.00006 $0.00362
Sonnet 5 $0.00002 $0.00145
Haiku 4.5 $0.00001 $0.00072

Measured 2d ago against content hash e77566d62b28, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

backtrack-analysis scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

packages/cli/agentic/commands/backtrack-analysis.md · 79 lines

How it starts

The opening of the file, as written. The whole thing — 79 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Backtrack Analysis Command

Analyze backtracking patterns from a distilled clens session. Identifies wasted effort: failure retries, iteration struggles, and debugging loops.

Setup

Load the session-analysis skill for schema knowledge and interpretation context before proceeding.

Variables

TARGET: $ARGUMENTS

Workflow

1. Resolve the Session

  • If TARGET is empty or --last, find the most recent distilled session in .clens/distilled/
  • If TARGET is a session ID (full UUID or prefix), find .clens/distilled/{TARGET}*.json
  • If no distilled file is found, inform the user:

    No distilled session found. Run clens distill --last first, then re-run this command.

2. Gather Data

Read the distilled JSON file at .clens/distilled/{sessionId}.json for the full DistilledSession object. Focus on: backtracks, file_map, decisions, reasoning, timeline, stats.

No CLI commands are needed — the distilled JSON is the primary data source.

3. Analyze Backtracks

For each backtrack entry, determine:

  • Type classification: failure_retry, iteration_struggle, or debugging_loop
  • Severity: Based on attempt count, duration, and recurrence
  • Root cause hypothesis: Infer from error messages, file paths, and reasoning context
  • Prevention strategy: Actionable recommendation to avoid similar issues

4. Identify Hot Files

Cross-reference backtrack file_path values to find fragile files:

  • Files appearing in 2+ backtracks are flagged as fragile
  • Rank by backtrack count descending
  • Note the types of backtracks each file triggers

5. Assess Tool Reliability

For each tool involved in backtracks:

  • Calculate failure-to-success ratio
  • Compare against session-wide tool usage from stats.tools_by_name
  • Flag tools with failure rate above 20%

6. Generate Report

Produce a structured report with these sections:

  1. Summary table: Total backtracks, counts by type, wasted attempts, time in backtracks, percentage of session
  2. Severity assessment: Low / Medium / High rating with justification
  3. Backtrack details: Per-backtrack analysis with what happened, reasoning context, root cause, prevention
  4. Hot files: Table of fragile files with backtrack counts and types
  5. Tool reliability: Table of tools ranked by failure rate
  6. Timeline context: Simplified timeline showing events around each backtrack
  7. Prevention checklist: Actionable items relevant to detected patterns

Read the full file on GitHub · 79 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 79 lines · 12 tokens per session scan A e77566d62b28

Subscribe to this mod's changes

backtrack-analysis is a command published in the GitHub repository silouone/clens (6 stars, last pushed 1mo ago), licensed MIT. It adds 12 tokens to every session and 724 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.