model

A command for adding a data model or value object to a TriadJS project, along with request types for creating and updating it. A model has identity; a value object is defined by its contents, such as money or an email address.

In plain words
What is it for?
It is for defining fields, identity and database settings, deriving Create and Update request types, and registering the model in the bounded context.
Why use it?
It reduces the manual work of keeping schema files, request data shapes, database hints, and the application's model registry consistent.

Command

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 commands/justhamade/triadjs/model
Clone the repo
git clone --depth 1 https://github.com/justhamade/triadjs
Per session 45 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 567 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.00045 $0.00567
Opus 5 $0.00023 $0.00283
Sonnet 5 $0.00009 $0.00113
Haiku 4.5 $0.00005 $0.00057

Measured 2d ago against content hash e858e5b00d39, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

model 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 2d ago.

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.

plugin/commands/model.md · 41 lines

How it starts

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

Load the triad-schema skill for authoritative rules on t.model vs t.value, derivation operators, and .storage() hints.

Add a new model or value object to the project based on the user's description ($ARGUMENTS).

Steps

  1. Decide model vs value object. Entities with identity → t.model. Comparable-by-value shapes (Email, Money, DateRange) → t.value. If unsure, default to t.model.

  2. Place the file in src/schemas/<resource>.ts. If a schemas directory doesn't exist, create it.

  3. Include derivations when appropriate:

    • CreateX = X.pick(...).named('CreateX') — omit identity/audit fields, keep user-supplied fields
    • UpdateX = X.pick(...).partial().named('UpdateX') — make every updatable field optional
  4. Identity field should have both .identity() and .storage({ primaryKey: true }) if the model will become a DB table:

    id: t.string().format('uuid').identity().storage({ primaryKey: true })
    
  5. Add .storage() hints to persistent fields per the triad-drizzle skill: indexed, unique, references, defaultNow, defaultRandom, columnName.

  6. Update the bounded context's models[] in src/app.ts so triad validate recognizes the model as part of the context's ubiquitous language.

  7. Run triad validate to confirm the new model doesn't break any consistency checks.

  8. If the project uses persistence (src/db/schema.generated.ts exists), run triad db generate to regenerate the Drizzle schema.

Rules

  • Always .named('NewName') when deriving. Unnamed derivations collide with the parent in OpenAPI.
  • Never define a model inside a test file — tests import the real model.
  • Value objects (t.value) cannot be used with body matches assertions — only models can.
  • Use t.datetime() rather than t.string().format('date-time').
  • Use t.empty() only for response slots (204/205/304), never for fields.

After adding the model, print the diff summary and suggest a follow-up: "Add an endpoint that uses <Model> via /triadjs:endpoint."

Read the full file on GitHub · 41 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. 2d ago First seen · 41 lines · 45 tokens per session scan A e858e5b00d39

Subscribe to this mod's changes

model is a command published in the GitHub repository justhamade/triadjs (23 stars, last pushed 4mo ago), licensed MIT. It adds 45 tokens to every session and 567 once invoked, about $0.0002 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.