endpoint

A command for adding a new HTTP endpoint, a URL that a program can call to request or change data, to an existing TriadJS router. It defines the request and response shapes, handler, authentication when needed, and behavior scenarios.

In plain words
What is it for?
Use it to add GET, POST, PUT, PATCH, or DELETE endpoints for resources such as pets, including parameters, request bodies, status responses, and calls to project services.
Why use it?
It removes the need to manually wire together routing, validation, responses, authentication, and basic behavior checks for each new endpoint.

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/endpoint
Clone the repo
git clone --depth 1 https://github.com/justhamade/triadjs
Per session 33 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 865 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.00033 $0.00865
Opus 5 $0.00016 $0.00432
Sonnet 5 $0.00007 $0.00173
Haiku 4.5 $0.00003 $0.00086

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

Security

Grade A, and why

endpoint 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/endpoint.md · 52 lines

How it starts

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

Load the triad-endpoint skill for the endpoint() signature and patterns. Load triad-behaviors for the assertion phrase table. If the endpoint needs auth, load triad-schema for the ApiError pattern.

Add a new endpoint to the project based on the user's description ($ARGUMENTS).

Steps

  1. Identify the target file. Either src/endpoints/<resource>.ts (add a new export const) or create a new file if the resource is new.

  2. Define the endpoint() config:

    • name — unique across the whole router (used as operationId)
    • method — one of GET, POST, PUT, PATCH, DELETE
    • path — Express-style (/pets/:id)
    • summary — one-line human description
    • tags['<BoundedContext>']
    • requestbody, params, query, headers as appropriate
    • responses — every status the handler can return, each with { schema, description }
    • handler — thin; parse ctx.body/params/query, call a repository on ctx.services, return ctx.respond[status](body)
    • behaviors — at least one happy-path scenario and ...scenario.auto()
  3. Request schemas — use inline shapes (params: { id: t.string() }) for one-off shapes, or named ModelSchemas when they should appear as OpenAPI components.

  4. Response schemas — reuse the existing Pet/ApiError/etc. Derive with .pick(...)/.partial() if needed. Every 4xx response uses the project-wide ApiError model.

  5. 204 No Content — use t.empty(), never t.unknown().optional(). Call ctx.respond[204]() with zero args.

  6. If auth is needed — use beforeHandler: requireAuth. Do NOT declare authorization in request.headers — the beforeHandler reads ctx.rawHeaders before validation. Make sure 401: { schema: ApiError, description: '...' } is in responses.

  7. Add at least one behavior that covers the happy path, plus ...scenario.auto() for boundary/missing/enum/type coverage for free. Every assertion string must come from the triad-behaviors phrase table. Strings use double quotes. null is not supported — let the response schema enforce nullability.

  8. Register the endpoint in src/app.ts:

    router.context('Pets', { ... }, (ctx) => ctx.add(createPet, getPet, listPets, /* newly added */ yourEndpoint));
    
  9. Verify:

    • triad validate --strict — catches duplicate names, missing responses, out-of-context models
    • triad test --filter yourEndpoint — runs just the new endpoint's behaviors

Read the full file on GitHub · 52 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 · 52 lines · 33 tokens per session scan A 65e8473adb34

Subscribe to this mod's changes

endpoint is a command published in the GitHub repository justhamade/triadjs (23 stars, last pushed 4mo ago), licensed MIT. It adds 33 tokens to every session and 865 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.