agentsclimarketplace

Sqlite state

Skill baronguyen001/ai-automation-skills/skills/sqlite-state

Give scheduled scripts memory between runs with one SQLite file - a seen-set for dedup, a key/value cursor to resume where you left off, and order-preserving new-item filtering. Use for dedup across runs, don't re-alert the same item, remember the last id, resume a scraper, or persist state between cron runs.From its SKILL.md

Install
npx -y skills add baronguyen001/ai-automation-skills --skill sqlite-state

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

2.2 KB, 453 tokens by cl100k_base, as published. Nobody here has run it

SQLite State

Use this skill when a recurring job must remember what it already did - which items it has alerted on, the last cursor it processed - so it does not re-notify or re-scrape on the next tick. One stdlib SQLite file gives durable, file-locked state with no server and no extra dependency.

When to invoke

  • User says: "don't alert the same thing twice", "dedup across runs", "remember the last id", "resume where it left off".
  • Code in the conversation is a cron/scheduled script that currently re-processes everything each run.

When NOT to invoke

  • State is tiny and ephemeral within a single run - a plain set/dict is enough.
  • Multiple machines must share state concurrently; reach for a real server DB instead of a single file.

Concrete example

User input:

My news scraper re-sends the same headlines every hour. Make it only send new ones.

Output:

from state import filter_new, mark_seen

db = "news.db"
fresh = filter_new(db, [a["url"] for a in articles])   # only unseen URLs
for url in fresh:
    send_alert(url)
mark_seen(db, *fresh)                                   # remember them for next run

Pattern to apply

  1. Key each item by something stable and unique (URL, id, content hash), not by array position.
  2. Use filter_new to decide what to act on, then mark_seen only after the action succeeds.
  3. Store progress as a named cursor (set_cursor/get_cursor) so a resumable scraper restarts mid-stream.
  4. Enable WAL mode for durable writes with concurrent readers; keep a single writer.
  5. Back up or version the one .db file - it is the whole memory of the job.

Reference: assets/state.py.

Source

Distilled from production use across the author's automation projects. v1.0.0. See also: [[pipeline-orchestrator]], [[cron-dispatch]], [[webhook-receiver]].

→ Build the full runnable bot with Trawlkit.

What ships with it: 1 file

3.0 KB alongside SKILL.md, 1 of them executable

assets/

Gives 0 of the 12 instructions most databases sql skills give in 453 tokens

Counted across 609 of the 712 authors here whose files we hold, read 2026-09-06

  • Index all foreign key columnsin 26 of 609
  • Use cursor pagination instead of offsetin 25 of 609, across 20 files
  • Use timestamptz for timestampsin 21 of 609
  • Specify columns instead of using select starin 20 of 609, across 10 files
  • Use parameterized queries for all database interactionsin 20 of 609, across 19 files
  • Use Enum for categorical datain 17 of 609, across 7 files
  • Order by frequently filtered columnsin 17 of 609, across 7 files
  • Batch data insertsin 17 of 609, across 7 files
  • Use expand-contract pattern for schema changesin 17 of 609
  • Use materialized views for real-time aggregationsin 16 of 609, across 6 files
  • Partition tables by timein 16 of 609, across 6 files
  • Use smallest appropriate data typesin 16 of 609, across 6 files

Said here and by no other author read

  • key items by stable unique identifiers
  • use filter_new to identify unseen items
  • mark items seen only after successful action
  • store progress using named cursors
  • enable WAL mode for durable writes
  • back up the database file

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.