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.
npx agentmods add commands/edobreque/clens/backtrack-analysisgit clone --depth 1 https://github.com/edobreque/clensWhat 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.
| Model | Per session | Once 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 |
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 3d 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.
This is a copy
100% identical to backtrack-analysis — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
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 --lastfirst, 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, ordebugging_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:
- Summary table: Total backtracks, counts by type, wasted attempts, time in backtracks, percentage of session
- Severity assessment: Low / Medium / High rating with justification
- Backtrack details: Per-backtrack analysis with what happened, reasoning context, root cause, prevention
- Hot files: Table of fragile files with backtrack counts and types
- Tool reliability: Table of tools ranked by failure rate
- Timeline context: Simplified timeline showing events around each backtrack
- Prevention checklist: Actionable items relevant to detected patterns
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.
- 3d ago First seen · 79 lines · 12 tokens per session scan A e77566d62b28
backtrack-analysis is a command published in the GitHub repository edobreque/clens (2 stars, last pushed 3d 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. It is 100% identical to backtrack-analysis, differing in 0 lines, and is treated as a copy.
Other commands, from other repositories
session-report
Analyze a distilled clens session and generate a structured performance report.
backtrack-analysis
Deep-dive into backtracking patterns from distilled clens sessions.
session-compare
Compare two distilled clens sessions side-by-side to identify performance differences.
project-hierarchy-check
Use this command before changing organisation, project, or database config behavior.
security-validation
Use this command before handing off security-sensitive OpenLIT changes.
code-review
Perform a comprehensive review of code changes, checking quality, security, performance, and convention compliance.