JsonModel

JsonModel is a cursor rule for Cursor from StratoKit/strato-db. It costs 875 tokens per session, scanned A, original, MIT.

A JavaScript data model for storing and querying JSON-style documents in SQLite tables. SQLite is a small database that runs inside an application rather than as a separate server.

In plain words
What is it for?
It is for creating and managing records, extracting searchable JSON fields, changing IDs, and maintaining SQLite-backed models.
Why use it?
It provides a common interface for schema rules, inserts, updates, queries, indexes, migrations, and caching over this stored data.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

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 rules/stratokit/strato-db/jsonmodel
Clone the repo
git clone --depth 1 https://github.com/StratoKit/strato-db

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for JsonModel

README.md
[![agentmods](https://agentmods.dev/badge/rules/stratokit/strato-db/jsonmodel.svg)](https://agentmods.dev/rules/stratokit/strato-db/jsonmodel)
Your own site
<a href="https://agentmods.dev/rules/stratokit/strato-db/jsonmodel"><img src="https://agentmods.dev/badge/rules/stratokit/strato-db/jsonmodel.svg" alt="Measured on agentmods" height="20"></a>
Per session 875 This file is loaded in full into every session.
When invoked 875 The same file — it is already loaded in full.
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.1 $0.00875 $0.00875
Opus 5 $0.00438 $0.00438
Sonnet 5 $0.00175 $0.00175
Haiku 4.5 $0.00088 $0.00088

Measured yesterday against content hash 8d56550e590a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

JsonModel 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.

.cursor/rules/JsonModel.mdc · 70 lines

How it starts

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

JsonModel Module (src/JsonModel)

This module provides the JsonModel class, a powerful Object-Relational Mapper (ORM)-like interface for storing and querying JSON-style documents within SQLite tables.

Core Components

JsonModel.js (JsonModelImpl class)

  • Purpose: Manages a specific SQLite table, mapping rows to JavaScript objects. It handles schema definition, data serialization/deserialization, CRUD operations, querying, indexing, migrations, and caching.
  • Key Features:
    • Schema Definition: Defines table structure through a columns object, supporting various data types (TEXT, INTEGER, JSON, etc.), primary keys (idCol), automatic value generation (value), indexing (index), and aliasing.
    • JSON Handling: Stores primary data in a json column but can extract specific JSON paths (path) into virtual columns for efficient querying and indexing.
    • CRUD: Provides comprehensive methods:
      • set(): Inserts or updates (upserts) an object.
      • get(): Retrieves an object by its ID.
      • getAll(): Retrieves multiple objects by IDs.
      • update(): Updates an existing object.
      • remove() / delete(): Deletes an object by ID or the object itself.
      • changeId(): Updates the ID of an object.
    • Querying: Offers flexible search capabilities:
      • search(), searchOne(), searchAll(): Finds objects based on attribute matching (where), sorting (sort), limiting results (limit), and cursor-based pagination.
      • exists(): Checks if an object matching criteria exists.
      • count(): Counts matching objects.
      • Aggregate functions: max(), min(), sum(), avg().
    • Caching: Integrates dataloader for efficient batching and caching of get operations via getCached().
    • Migrations: Manages database schema evolution through registered migration functions.
    • Customization: Allows specifying a custom class (ItemClass) for instantiated objects.
    • Utilities: Includes internal helpers for SQL generation, object cloning, cursor encoding/decoding (jsurl2).
  • Dependencies: DB (likely via passed db instance), dataloader, lodash, debug, jsurl2, internal helpers.

Read the full file on GitHub · 70 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 · 70 lines · 875 tokens per session scan A 8d56550e590a

Subscribe to this mod's changes

JsonModel is a cursor rule published in the GitHub repository StratoKit/strato-db (14 stars, last pushed 6mo ago), licensed MIT. It adds 875 tokens to every session, about $0.0044 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-09-04.