claude-plugin/skills/architecture/SKILL.md
Architecture guide for the Promptrail CLI. Use when the user asks about how Promptrail works, its data model, CLI commands, or wants to understand the tool before making changes.
npx skillsauth add thisalihassan/promptrail claude-plugin/skills/architectureInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
CLI tool that reads Claude Code sessions and presents a timeline of prompts with per-prompt file attribution, diffs, search, and rollback.
promptrail timeline [--files] All prompts with file counts
promptrail diff <n|text> Diff for prompt #n or matching text
promptrail response <n|text> AI response for prompt #n or matching text
promptrail search <query> Full-text search across prompts and responses
promptrail rollback <n|text> Cherry revert prompt's changes
promptrail sessions List all sessions
Filters: --source claude (always use this), --model <substring>
Shortcuts: tl, d, r, rb, s
Claude Code JSONL at ~/.claude/projects/<encoded-workspace>/ is self-contained. Each session file has:
role: "human", content[].text contains the promptrole: "assistant" with content[] containing text blocks and tool_use blockstype: "tool_use" with name (Edit, Write, etc.) and input containing file_path, old_string, new_string, or contentNo SQLite or file watcher needed -- the JSONL has everything for prompts, file changes, and rollback.
| Tool Name | Purpose | Key Fields |
|-----------|---------|------------|
| Edit | String replacement | file_path, old_string, new_string |
| Write | File creation/overwrite | file_path, content |
| MultiEdit | Multiple edits in one call | file_path, edits[] |
SessionReader.readAllTasks()
|-> Parse Claude Code JSONL (prompts + tool_use blocks for file changes)
|-> Returns Task[] sorted chronologically
Each Task has: id, prompt, createdAt, filesChanged, source, model
| File | Purpose |
|------|---------|
| src/cli/index.ts | CLI entry point, all commands |
| src/core/session-reader.ts | Parses Claude Code sessions into Task[] |
| src/core/selective-revert.ts | Cherry revert logic (exact string matching) |
| src/models/types.ts | Shared interfaces (Task, FileChange, etc.) |
| Data | Path |
|------|------|
| Claude sessions | ~/.claude/projects/<workspace>/ |
| Shadow DB | .promptrail/promptrail.db in workspace root |
old_string/new_string from tool calls), not full file before/after snapshotstools
Show the timeline of all AI prompts in this project with file change counts. Use when the user asks to see what the AI has done, list prompts, show history, or view the agent timeline.
tools
List all Claude Code sessions for this project. Use when the user asks about sessions, wants to see which sessions exist, or asks about session history.
tools
Search across all AI prompts and responses using full-text search. Use when the user wants to find a previous conversation, check if they already asked something, or search for a specific topic across sessions.
tools
Rollback (undo) the file changes from a specific AI prompt. Use when the user wants to undo, revert, or rollback changes from a specific prompt. IMPORTANT - this is destructive, always confirm with the user first.