npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@twigg/agent-database

v0.3.0

Published

A persistent JSON document store (SQLite) for twigg-agent: collections of records the agent can find, get, upsert and delete

Readme

@twigg/agent-database

A persistent database for twigg-agent: named collections of JSON records, each with an id. It is stored in SQLite, built into Node, so there is nothing else to install.

npm install -g @twigg/agent-database
twigg-agent task.md --tool @twigg/agent-database

or in a settings file: "tools": ["@twigg/agent-database"].

| Tool | What it does | Permission | | --- | --- | --- | | db_collections | Lists collections with record counts. | read | | db_find | Filters, sorts and pages a collection. | read | | db_get | Fetches records by id. | read | | db_upsert | Creates or updates up to 100 records atomically. set merges fields, unset removes them, and append adds to a list (for example a history of comments). | write | | db_delete | Deletes records by id. | delete |

--no-write and --no-delete (or a subagent denied them) leave out the tools that need them, so a run can read the database without changing it.

where in db_find takes a value (equals) or operators: eq, ne, in, nin, lt, lte, gt, gte, exists, and contains (case-insensitive, also inside lists). Dot paths reach nested fields. id, created_at and updated_at are built in.

Where the data lives

In .twigg-agent/state/twigg__agent-database/db.sqlite under the agent's working directory, so each project has its own database and upgrades don't touch it. The agent reaches it only through these tools. Set DB_PATH to put it somewhere else:

{ "tools": [{ "use": "@twigg/agent-database", "env": { "DB_PATH": "/data/crm.sqlite" } }] }

Back the file up if the data matters: it exists only on that machine.

Looking at the data yourself

Run these in the agent's working directory:

twigg-agent-db path            # where the database file is
twigg-agent-db dump            # every collection, as JSON
twigg-agent-db dump leads      # one collection
sqlite3 "$(twigg-agent-db path)"

How it's built

This package is also the reference for writing twigg-agent tools: tool.json declares five tools that share one program, db.js reads the arguments from stdin, and the state goes in TWIGG_AGENT_STATE_DIR. See Writing tools.