backfill-enumerate-drain

A procedure for rebuilding the history of a newly connected repository or team by first listing its available items and then processing each one.

In plain words
What is it for?
Handling repository or team connection events, creating one task per returned pull request, issue, project, or document, and processing those tasks safely.
Why use it?
It gives the agent a repeatable way to handle many related records without missing items or losing its place after an interruption.

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/potpie-ai/potpie/backfill-enumerate-drain
Any agent
npx skills add potpie-ai/potpie --skill backfill-enumerate-drain
Clone the repo
git clone --depth 1 https://github.com/potpie-ai/potpie

Made for: Claude Code, Codex.

Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 649 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.00052 $0.00649
Opus 5 $0.00026 $0.00324
Sonnet 5 $0.00010 $0.00130
Haiku 4.5 $0.00005 $0.00065

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

Security

Grade A, and why

backfill-enumerate-drain 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 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.

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.

potpie/context-engine/src/potpie_context_engine/adapters/outbound/reconciliation/skills/backfill-enumerate-drain/SKILL.md · 58 lines

How it starts

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

Backfill: enumerate, then drain

You are handling a single *.added seed event (a repository or a team was just connected). The graph has no history for it yet. One seed fans out into many artifacts (PRs, issues, projects, documents). Your todo/plan tools are ON. Use this procedure for any such backfill; the playbook tells you WHICH enumerators and WHAT to extract per artifact.

The loop

  1. Enumerate (one call per list tool). Call each list/enumerator tool the playbook names exactly once. They are bounded server-side to a trailing window and a hard item cap, and come back newest-first. Do not page or scrape beyond what one call returns — the window/cap is deliberate; the tail arrives via live webhooks and future backfill.
  2. Write one todo per returned ref, across all enumerated kinds. If the playbook says some kinds frame the others (e.g. projects/documents frame issues), drain those first.
  3. Drain newest-first. For each todo: hydrate the ref with the detail tool named by the playbook (for example github_get_pull_request or github_get_issue), apply the extraction the relevant per-kind playbook prescribes via apply_graph_mutations, then mark the todo done and move on.

Resume discipline (critical)

The todo list rides in your message history, which is checkpointed after every tool call. A resumed run therefore continues an existing list — if todos already exist, never re-enumerate and never restart the walk from scratch. Re-running an enumerator on resume duplicates work and burns budget.

Single-event contract

This batch contains exactly one event — the seed. Per-artifact identity lives in each artifact's stable entity_key, not in event ids. So:

  • Pass the seed's event_id to every apply_graph_mutations call.
  • Finish with a single mark_event_processed(seed_event_id, summary) then finish_batch.

Stable keys make a backfilled artifact and a later live webhook for the same thing converge on one node instead of duplicating. See the graph-mutation-plan skill for the key patterns.

Read the full file on GitHub · 58 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 · 58 lines · 52 tokens per session scan A 53cb98bd71e8

Subscribe to this mod's changes

backfill-enumerate-drain is a skill published in the GitHub repository potpie-ai/potpie (5,702 stars, last pushed 2d ago), licensed Apache-2.0. It adds 52 tokens to every session and 649 once invoked, about $0.0003 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-30.

Related

Other skills, from other repositories

build-paths-advanced

Scaffold an agent system where Oracle AI DB is the only state store, composed from the build-paths/skills/ building-block library. Stack — langchain-oracledb + oracle-database-mcp-server + in-DB ONNX embeddings + OCI GenAI Grok 4 + Open WebUI. Three projects — production-feeling NL2SQL+RAG hybrid analyst…

oracle-devrel/oracle-ai-developer-hub · 110 tokens

soccer-workshop-setup

Bootstrap the soccer analytics agent workshop. Starts the Oracle AI Database Free container, applies schema, loads the FIFA dataset, optionally trains models, populates LangChain OracleVS hybrid retrieval plus semantic memory, applies LangGraph OracleDB observability, and verifies OCI GenAI access. Use when starting…

oracle-devrel/oracle-ai-developer-hub · 72 tokens

design-taste-frontend

Senior UI/UX Engineer. Architect digital interfaces overriding default LLM biases. Enforces metric-based rules, strict component architecture, CSS hardware acceleration, and balanced design engineering.

oracle-devrel/oracle-ai-developer-hub · 40 tokens

skill-creator

Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.

oracle-devrel/oracle-ai-developer-hub · 28 tokens

build-paths-intermediate

Scaffold a Grok-4 tool-calling agent over an Oracle schema using langchain-oracledb + oracle-database-mcp-server + in-DB ONNX embeddings (registered MiniLM model, no external embedding API) + Open WebUI. For users who've built RAG before and want to rebuild it on the production-feeling Oracle stack.

oracle-devrel/oracle-ai-developer-hub · 78 tokens

oracle-mcp-server-helper

Wire the oracle-database-mcp-server into a Python project so an LLM agent can call listtables / describetable / runsql / vectorsearch at inference time. Handles install, stdio launch, and LangChain tool conversion via langchain-mcp-adapters. Use whenever a project needs a Grok 4 / GPT-class agent that talks to a live…

oracle-devrel/oracle-ai-developer-hub · 0 tokens