persistent-python

A persistent Python session for repeated Python work, including inspecting files, testing code, debugging, and working with notebooks. Values and imports remain available between commands.

In plain words
What is it for?
Use it for Python coding, package and API checks, data transformations, notebook work, and other tasks that can be performed in Python.
Why use it?
It avoids restarting the Python environment for every experiment and keeps inspection and debugging state in one place.

Skill for Claude CodeCodex

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 skills/answerdotai/skill-plugins/persistent-python
Any agent
npx skills add AnswerDotAI/skill-plugins --skill persistent-python
Clone the repo
git clone --depth 1 https://github.com/AnswerDotAI/skill-plugins

Made for: Claude Code, Codex.

Per session 118 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 937 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00118 $0.00937
Opus 5 $0.00059 $0.00468
Sonnet 5 $0.00024 $0.00187
Haiku 4.5 $0.00012 $0.00094

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

Security

Grade B, and why

persistent-python scanned grade B with 1 finding 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 yesterday.

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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

- Claude Code settings are plain JSON: `~/.claude/settings.json` (user-global), `.claude/settings.json` (project, committed), `.claude/settings.local.json` (project, personal); later files override earlier. Edit them wit
plugins/claude-aai/skills/persistent-python/SKILL.md · 24 lines

How it starts

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

Persistent Python

ALWAYS use the clikernel MCP server for ALL Python work: writing code, editing code or notebooks, running or debugging anything, inspecting objects or packages, probing APIs, and transforming data. It is the workbench for every task in this environment. If the work could go through Python, it goes through clikernel. Do not fall back to python -c, shell heredocs, or ad hoc scripts.

The server's execute tool runs code in one persistent IPython session, so imports, variables, monkeypatches, and cached objects carry across calls. Check the clikernel MCP server instructions already in your context before the first call. Normally the startup script has run, and its output says what is imported and which cells to run next. Follow it. If the instructions report that project imports were skipped, or contain no startup output, report that to the user before other work. Then run the guarded import block from $XDG_CONFIG_HOME/clikernel/startup.py (default ~/.config/clikernel/startup.py) as one execute call. That file is the single source of truth for bootstrap imports; never retype them from memory.

Complete every practice task named in the server instructions (the llmdojo round started by dojo_start()) before any other work. This gate applies in every session, including tasks that only read files or search directories.

The server instructions and startup docs cover the tools, notebook magics, output shape, interaction rules, reload gotchas, and pyskills workflow, so this skill does not repeat them. list_pyskills() shows the available tooling. Prefer a relevant pyskill over ad hoc code.

Environment specifics

The following apply specifically to this environment:

  • Doc-state persists on disk per conversation and is managed mechanically (the compaction hook resets it when your context is rewritten), so there is nothing to run by hand: doc notes fire exactly for the functions whose docs you don't hold. After a kernel restart or compaction, just read doc(f) again whenever a note fires.
  • Use exhash for ALL edits -- code, tests, config, prose, notebook cells -- never the host's built-in file-edit tools, and read with lnhashview_* (not the host's file reader) the moment an edit is plausible. llmsurgery.dlgskill covers the structural cell/message operations exhash doesn't; fastcore.tools file editors are the rare fallback where exhash can't express a text edit.
  • Claude Code settings are plain JSON: ~/.claude/settings.json (user-global), .claude/settings.json (project, committed), .claude/settings.local.json (project, personal); later files override earlier. Edit them with the normal kernel tooling (lnhashview_file + %%exhash), merging into existing keys rather than replacing, then verify with json.load. Useful facts: a BARE tool name in permissions.deny removes that tool from the system prompt entirely, while a scoped rule (Bash(rm *)) only blocks matching calls; hooks live under "hooks" keyed by event (PreToolUse, SessionStart, UserPromptSubmit, ...); skillOverrides hides bundled skills ("off", or "user-invocable-only" to keep the slash command usable by the user). Settings load at startup, so changes take effect from the next session.
  • Narration between consecutive tool calls must ride inside a tool call, since mid-run assistant text is neither shown nor saved (anthropics/claude-code#75900). For clikernel work that means a separate execute call containing only a Python comment: one or two prose lines starting #, saying what the last result showed and what comes next. It runs as a no-op, renders in the transcript, and persists across resume. Retire this practice when the issue is fixed.

Read the full file on GitHub · 24 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. yesterday First seen · 24 lines · 0 tokens per session scan B f936b0b1d244

Subscribe to this mod's changes

persistent-python is a skill published in the GitHub repository AnswerDotAI/skill-plugins (5 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 118 tokens to every session and 937 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

babysit-pr

Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep…

openai/codex · 114 tokens

imagegen

Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output…

openai/codex · 113 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

next-cache-components-optimizer

Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…

vercel/next.js · 170 tokens