# codestory

> Turn Python scripts and execution traces into interactive, animated HTML stories for stakeholders and engineers.

codestory is a free AI agent skill on Agensi by Ansh Sharma, in Agents & Orchestration. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Ansh Sharma](https://www.agensi.io/creators/ansh-sharma)
- Category: [Agents & Orchestration](https://www.agensi.io/skills/agents-orchestration)
- Uses: 2
- Version: 1.1
- Last updated: 2026-10-24
- Security: scan passed (2026-10-24); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/codestory
- Tags: ai-agents, python, visualization, debugging, documentation

## About this skill

Turn complex Python codebases or specific execution runs into interactive, animated HTML stories. This skill bridges the gap between raw source code and stakeholder comprehension by generating a visual "storyboard" that maps data flow, transformations, and decisions. It uses a custom Python tracer to record exactly what happened during a run—including data samples, row counts, and intercepted side effects—or scans the logic to explain how a system works without executing it.

The tool includes a built-in animation engine (`player.html`) that produces a single, offline-ready file. It handles "safe mode" execution, automatically sandboxing file writes, database mutations, and network requests so you can trace production scripts locally without side effects.

### What it does
- **Visualizes execution** by generating an animated timeline of function calls, data states, and I/O events.
- **Records data transformations** with automatic tracking of table shapes (rows/cols) and data samples.
- **Safe-mode tracing** intercepts and redirects side effects to a temporary sandbox for risk-free analysis of live scripts.
- **Audience-tuned narration** generates plain-language explanations of code logic for stakeholders or deep-dives for engineers.
- **Branch analysis** identifies taken and untaken paths in a specific run to debug logic flow.

### How it works
1. **Record**: Run `codestory.py scan` to map logic or `run` to trace a live execution with specific arguments.
2. **Storyboard**: The agent analyzes the resulting JSON bundle to draft a structured `storyboard.json` following the official schema.
3. **Build**: Run the `build` command to embed the storyboard into a standalone, animated `story.html` player.

### Frameworks & tools
Built for Python 3.8+ using the standard library. Supports tracing for `pandas`, `requests`, `httpx`, `psycopg2`, `pymysql`, and `sqlite3`.

### Why this beats prompting it yourself
Generic LLMs struggle to maintain consistent line-number highlights and arithmetic accuracy across thousands of lines of trace data. This skill uses a structured schema and a dedicated animation engine to ensure every data card, code snippet, and row count is grounded in actual execution telemetry rather than hallucinated summaries.

### Use cases
- **Onboarding engineers** by providing an animated walkthrough of a complex pipeline's entry point and data flow.
- **Incident post-mortems** to visualize exactly why a specific run failed or where data was dropped.
- **Stakeholder reporting** to show non-technical managers how a business process translates into code logic.
- **Safe refactoring** by comparing "scan" stories of new logic against "run" stories of legacy scripts.

### Known limitations
Does not support cloud SDKs (AWS/GCP), MongoDB, or Redis interception. Limited to Python. Truncates detailed traces for functions called more than three times under the same parent.

## Requires

- Python

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the codestory skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### Which AI agents are compatible with CodeStory?

CodeStory is designed for any Python-capable AI agent; it provides a command-line interface and a structured JSON schema that agents use to interpret execution traces and compile them into visual stories.

### How does the 'Safe-mode' tracing protect my production environment?

The 'Safe-mode' feature automatically intercepts and redirects side effects like file writes, database mutations, and network requests to a sandbox, allowing you to trace production scripts without affecting live data.

### What is included in the CodeStory package?

You receive the core Python tracer, the storyboard generator agent, the custom HTML5 animation engine, and full documentation on the structured storyboard schema.

### Does CodeStory work with my existing data stack?

CodeStory is built for Python 3.8+ and includes specialized support for tracing libraries like pandas, requests, and common SQL drivers like psycopg2 and sqlite3.

### Are there any limits on how much code can be visualized at once?

To keep stories concise and readable, the tool automatically truncates traces for functions called more than three times under the same parent, preventing repetitive loops from bloating the visualization.

### Why should I use this instead of just asking an LLM to explain my code?

Unlike generic LLM summaries, CodeStory uses a dedicated animation engine and actual telemetry data to ensure every row count and data transformation is grounded in fact rather than model hallucination.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
