{"_id":"@agent-smith/feat-sqlite","name":"@agent-smith/feat-sqlite","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.2":{"name":"@agent-smith/feat-sqlite","version":"0.0.2","description":"Sqlite features for Agent Smith cli","repository":{"type":"git","url":"git+https://github.com/synw/agent-smith.git"},"type":"module","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"license":"MIT","dependencies":{"@inquirer/prompts":"^8.5.2","better-sqlite3":"^12.10.0"},"gitHead":"1c17021ac41863aabda7be964d8ba8a0138061bf","_id":"@agent-smith/feat-sqlite@0.0.2","bugs":{"url":"https://github.com/synw/agent-smith/issues"},"homepage":"https://github.com/synw/agent-smith#readme","_nodeVersion":"24.11.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-jeACuUY2Ynu72nIZ/IBBrdhcvdWjMm+br3cEjZRnPYchUhSkwpL2ccEtMwvHCXt24NAEFbeyPd2DuNBdXVMlcg==","shasum":"f08e7814153154515f70db5a9361103e091f3380","tarball":"https://registry.npmjs.org/@agent-smith/feat-sqlite/-/feat-sqlite-0.0.2.tgz","fileCount":13,"unpackedSize":14192,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCtLUIq+o9OsNti42miuIHCACt0bQdVSVTMV4K2f9yiVwIgcEUCLhG2Ib0/RB/ssKROe7wJGM06MQq2nj/iT6PP6Og="}]},"_npmUser":{"name":"synw","email":"synwx@protonmail.com"},"directories":{},"maintainers":[{"name":"synw","email":"synwx@protonmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/feat-sqlite_0.0.2_1781272748073_0.5776232048772438"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-12T13:59:07.910Z","0.0.2":"2026-06-12T13:59:08.204Z","modified":"2026-06-12T13:59:08.436Z"},"maintainers":[{"name":"synw","email":"synwx@protonmail.com"}],"description":"Sqlite features for Agent Smith cli","homepage":"https://github.com/synw/agent-smith#readme","repository":{"type":"git","url":"git+https://github.com/synw/agent-smith.git"},"bugs":{"url":"https://github.com/synw/agent-smith/issues"},"license":"MIT","readme":"[![pub package](https://img.shields.io/npm/v/@agent-smith/feat-sqlite)](https://www.npmjs.com/package/@agent-smith/feat-sqlite)\n\n# @agent-smith/feat-sqlite — SQLite Database Integration for AI Agents\n\nA plugin that provides SQLite database integration for Agent Smith, enabling AI agents to read and write data through natural language queries with schema awareness. Part of the [Agent Smith](https://github.com/lynxai-team/agent-smith) toolkit.\n\n## Features\n\n- 🗄️ **Schema-Aware Queries** — Automatic schema introspection for intelligent query generation\n- 🔒 **Safe Read Operations** — Readonly database connections for read-only access\n- ✍️ **Protected Writes** — Write operations require user confirmation via interactive prompts\n- 🔄 **Atomic Transactions** — Query execution wrapped in transactions for data integrity\n- 🤖 **AI Agents** — Pre-built agents for full read/write and read-only database interactions\n- 🌐 **Natural Language** — Ask questions in plain English and get structured results\n\n## Documentation\n\n### For AI Agents\n\n- [Codebase Summary](.agents/documentation/codebase-summary.md) — Architecture, key files, and patterns for the @agent-smith/feat-sqlite plugin\n- [SQLite Plugin](https://raw.githubusercontent.com/lynxai-team/agent-smith/refs/heads/main/docsite/public/doc/plugins/code/2.sqlite.md) — Complete plugin documentation with actions, tools, and agents\n\n### For Humans\n\n- [SQLite Plugin](https://lynxai-team.github.io/agent-smith/plugins/code/sqlite) — Full plugin documentation and usage guide\n\n## Installation\n\n```bash\nnpm i -g @agent-smith/feat-sqlite\n```\n\nAdd the plugin to your `config.yml` file and run the `conf` command:\n\n```yml\nplugins:\n  - \"@agent-smith/feat-sqlite\"\n```\n\n```bash\nlm conf\n```\n\n## Quick Start\n\nCreate a minimal agent with SQLite read-only access:\n\n```yaml\ndescription: Sqlite read only agent\nmodel: qwen4b\ntoolsList:\n  - sqlreadquery\nvariables:\n  required:\n    dbpath:\n      description: The database path\n```\n\n## Usage\n\n### Database Operations\n\nThe plugin provides two main tools for interacting with SQLite databases:\n\n| Tool | Description | Access Level |\n|------|-------------|--------------|\n| `sqlquery` | Read data or write in the database. Schema-aware and can read/write everything | Full (read + write) |\n| `sqlreadquery` | Read data by asking a question in natural language. Schema-aware read-only access | Read-only |\n\nBoth tools require the `dbpath` variable to be set, pointing to your SQLite database file.\n\n### AI Agents\n\nThe plugin provides two pre-built agents:\n\n#### Full Read/Write Agent (`runsqliteagent`)\n\nA complete SQLite database assistant that decomposes user questions and delegates tasks to tools.\n\n- Uses `sqlquery` tool for schema-aware read and write operations\n- Requires user confirmation for any write operations\n- Best for: Database administration, data manipulation, schema changes\n\n#### Read-Only Agent (`runsqlitereadagent`)\n\nA safe SQLite database reader that analyzes questions and executes read queries only.\n\n- Uses `sqlreadquery` tool for schema-aware read-only queries\n- No write operations possible — maximum safety\n- Best for: Data analysis, reporting, research queries\n\n### Security Model\n\n- **Read operations** use readonly database connections for safety\n- **Write operations** require user confirmation via interactive prompts (`@inquirer/prompts`)\n- **Query execution** is wrapped in transactions via `better-sqlite3`'s transaction API for atomicity\n\n## API Reference\n\n### Available Tools\n\n#### `sqlquery`\n\nExecute schema-aware SQL queries with full read/write access.\n\n```typescript\n// The agent automatically handles:\n// 1. Schema introspection\n// 2. Query generation from natural language\n// 3. Transaction wrapping for writes\n// 4. User confirmation prompts for modifications\n```\n\n**Parameters:**\n- `dbpath` (required): Path to the SQLite database file\n- `query`: Natural language description of the operation or SQL query\n\n#### `sqlreadquery`\n\nExecute read-only SQL queries using natural language questions.\n\n```typescript\n// The agent automatically handles:\n// 1. Schema introspection\n// 2. Query generation from natural language\n// 3. Readonly connection enforcement\n```\n\n**Parameters:**\n- `dbpath` (required): Path to the SQLite database file\n- `question`: Natural language question about the database\n\n### Agent Configuration\n\n#### Full Agent Example\n\n```yaml\ndescription: Sqlite full access agent\nmodel: qwen4b\ntoolsList:\n  - sqlquery\nvariables:\n  required:\n    dbpath:\n      description: The database path\n```\n\n#### Read-Only Agent Example\n\n```yaml\ndescription: Sqlite read only agent\nmodel: qwen4b\ntoolsList:\n  - sqlreadquery\nvariables:\n  required:\n    dbpath:\n      description: The database path\n```\n\n## Important Notes\n\n- 🔑 The `dbpath` variable is **required** for all operations — always specify the database path\n- 📝 Write operations will prompt for user confirmation before executing\n- 🔒 Read-only agents cannot perform any write operations, even if requested\n- ⚡ All operations are wrapped in transactions for data integrity\n- 🌐 Compatible with Node.js environments (uses `better-sqlite3` native module)\n\n## Dependencies\n\n- `better-sqlite3` — Fast SQLite bindings for Node.js\n- `@inquirer/prompts` — Interactive prompts for user confirmation\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-4fc03b9706bcec07b91b4227633f14cb"}