agentleFS
bharath31bharath31/nominee/AGENTS.md

nominee

AGENTS.md2 starsChanged 4 months agoMITView on GitHub

Guide for AI coding agents and contributors working in this repository. nominee is the authorization layer for AI agents. Every tool call is checked against a declarative allow/deny/ask policy (nominee.authorize() / nominee.guard()), risky calls pause for human approval, and every decision — including refusals — is sealed into a hash-chained, tamper-evident receipt log (tamper-evident against a downstream log editor, not non-repudiation against the agent host). Tools that act on third-party APIs call nominee.token() at execution time to get a fresh…

  • Reads credentials
  • Installs packages
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,736 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository3 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

10 rules. About 0 are common, 3 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use per-package filters when working narrowly:

    line 176
  2. Very specific:

    Use import type for type-only imports.

    line 186
  3. Very specific:

    Use .js extensions on relative TypeScript imports.

    line 187
  4. Distinctive:

    Keep public APIs small and documented.

    line 190
  5. Very specific:

    Prefer focused tests in test/*.test.ts next to the package being changed.

    line 191
  6. Very specific:

    Do not add runtime dependencies to packages/core.

    line 192
  7. Very specific:

    Keep those files gitignored on disk or in a private repo.

    line 224
  8. Distinctive:

    Keep examples aligned with the actual exported API before publishing.

    line 232
  9. Very specific:

    When you change packages/core/src/nominee.ts, action.ts, adapter run() wiring, or the decision-bound lifecycle, update these surfaces in …

    line 236
  10. Very specific:

    Run node brand/check-surfaces.mjs before opening a PR — CI enforces it.

    line 249

≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md - nominee

Guide for AI coding agents and contributors working in this repository.

Project

nominee is the authorization layer for AI agents. Every tool call is checked against a declarative allow/deny/ask policy (nominee.authorize() / nominee.guard()), risky calls pause for human approval, and every decision — including refusals — is sealed into a hash-chained, tamper-evident receipt log (tamper-evident against a downstream log editor, not non-repudiation against the agent host). Tools that act on third-party APIs call nominee.token() at execution time to get a fresh access token for a user and connection.

The framework decides when to call a tool. nominee decides whether the call may execute — and for high-impact actions that decision is bound to the exact arguments, consumable once, and recoverable across restarts. See docs/production.md for that lifecycle.

Four design commitments matter most:

  1. Install-and-go by default. A policy-only nominee needs no strategy, no provider, no signup. Core token usage works with a plain function that returns a token. Auth0 is an optional managed strategy, not a requirement.
  2. Core stays dependency-free. packages/core must have zero runtime dependencies (it carries its own SHA-256/HMAC). Provider and framework dependencies belong in strategy or adapter packages.
  3. Enforcement is honest. Deny means the tool never runs; receipts record refusals as faithfully as approvals; sub-agent policies can only narrow authority, never widen it.
  4. Fail closed, and say so. A store, sink, or authorizer that errors must never degrade into allow. In-memory stores are conformance implementations and deliberately refuse production: true. Observe mode (mode: 'observe') is the one deliberate exception: it does not enforce policy decisions, so it must be asked for by name, announce itself on startup, mark every receipt enforcement: 'observe', preserve the original policy verdict, count only callbacks that actually start, avoid retaining raw string/boolean values or user IDs, bound numeric samples, and refuse production: true. See docs/observe.md and security-contract/contract.test.ts.

Layout

packages/
  core/     published as nominee           - engine, action lifecycle, Strategy interface
  cli/      published as nominee-cli       - local console, policy generator, and runnable proof
  ai/       published as nominee-ai        - Vercel AI SDK and Cloudflare Agents adapter
  eve/      published as nominee-eve       - Vercel Eve adapter
  openai/     published as nominee-openai     - OpenAI Agents SDK adapter
  mastra/     published as nominee-mastra     - Mastra adapter
  mcp/        published as nominee-mcp        - MCP server adapter
  langchain/  published as nominee-langchain  - LangChain JS adapter
  auth0/      published as nominee-auth0      - optional Auth0 strategy (+ CIBA stores)
  supabase/   published as nominee-supabase   - optional Supabase strategy
  postgres/   published as nominee-postgres   - durable action/receipt stores for multi-replica
examples/
  support-refund-agent/       durable Vercel AI SDK approval + PostgreSQL wiring
  prompt-injection-blocked/   supporting security proof: injected exfiltration blocked by policy
  github-agent/               golden Eve + Auth0 example (PR review-and-merge agent)
site/
  static microsite for nominee.dev
  agent-worker/   deployed nominee.dev/agent worker (Cloudflare Durable Object) -
                  live pause/hibernate/resume demo: receipt chain resumes across
                  hibernation, credential fetched fresh only at resume; demonstrates
                  prepareAction/resolveActionApproval/resumeAction/executeCapability usage

Public API Shape

import {
  Nominee, allow, deny, ask, tokens, formatReceipts, formatObservations, verifyReceipts,
} from 'nominee'

const nominee = new Nominee({
  policy: {
    rules: [
      allow('email.read'),
      allow('email.forward', { when: ({ input }) => input.to.endsWith('@acme.com') }),
      deny('email.forward', { reason: 'external forwarding is exfiltration' }),
      ask('email.delete'),
      allow('search.*', { maxCalls: 20 }), // lifetime call count, no time window; call #21 escalates to a human
    ],
    fallback: 'deny', // default is 'ask'
  },
  receipts: { key: process.env.RECEIPT_KEY, onReceipt: (r) => sink.write(r) },
  strategy: tokens(({ user, connection }) => db.getFreshToken(user, connection)), // optional
  onApprovalRequest: async (req) => notifyUser(req),
  onAudit: (event) => auditDb.insert(event),
  agent: 'triage-bot',
})

// Observe mode (report-only: records policy decisions without enforcing them)
const observing = new Nominee({ mode: 'observe' })  // refused with production: true
const observed = observing.observe(rawTools)        // no policy needed
observing.observations()                            // JSON; tool inventory, cardinality + ranges
formatObservations(observing.observations())        // terminal report

// Authorization
await nominee.authorize({ tool, input, user }) // throws PolicyDeniedError / ApprovalDeniedError
await nominee.assertUnchanged(authorization, input) // bind a manual authorize to execution
await nominee.check({ tool, input, user })     // dry run, no side effects
const tools = nominee.guard(rawTools, { user }) // wrap functions or { execute } tools

// Decision-bound execution (required under `production: true`)
await nominee.run({ tool, input, user, resource, tenant, connection, scopes }, execute)
const prepared = await nominee.prepareAction({ tool, input, user }) // capability or pending id
await nominee.resolveActionApproval(actionId, { decision: 'approved', approver, via })
const resumed = await nominee.resumeAction(actionId)
await nominee.executeCapability(resumed.capability, input, execute) // execute receives { action, input, token? }

// Receipts
nominee.receipts
await nominee.verifyReceipts() // async; the exported verifyReceipts() below is sync
formatReceipts(nominee.receipts)
await nominee.flushReceipts()        // await buffered async sinks before shutdown
await nominee.verifyDurableReceipts() // verify the durable stream + checkpoint
verifyReceipts(exported, { key })

// Delegation (policies can only narrow; receipts share one chain)
const sub = nominee.delegate('research-agent', { policy: [deny('email.*')] })

// Approvals + tokens (as before)
await nominee.token({ user, connection })
await nominee.approve({ user, action, detail })
nominee.resolveApproval(id, 'approved')
await nominee.can({ user, action, resource })
nominee.on((event) => auditDb.insert(event))

The action lifecycle is planned → policy_checked → pending_approval → approved → capability_issued → executing → succeeded | failed. A capability is returned once, expires quickly, and executes once; resumeAction() before consumption rotates it and invalidates the old value. An approval is bound to a canonical hash of the input, so mutating the arguments after approval throws AuthorizationInputChangedError instead of executing. When an action names a resource, the application authorizer is consulted while planning and again after capability consumption, so a permission revoked mid-approval fails closed.

production: true refuses construction unless a default-deny policy, a durable action store, an atomic durable receipt store, and delivery: 'strict' are all configured. nominee-postgres supplies the stores.

Policy semantics: first matching rule wins within a policy; no match falls back to fallback (default 'ask'); across a delegation chain the strictest outcome wins (deny > ask > allow). Sub-agent policies passed to delegate() default their fallback to 'allow' (they are restrictions on top of the chain).

Adapters expose nomineeTool(config), withNominee(nominee, defaults), and — for nominee-ai — guardTools(nominee, tools, { user }); nominee-mcp exposes registerNomineeTool. Adapter config uses inputSchema (LangChain: schema), optional connection, optional approval / requireApproval (forces an ask), optional action (the policy tool name), and an execute(input, ctx) function. The adapter context is { token?, user, ai } for nominee-ai and { token?, user, eve } for nominee-eve. Official adapters route through the decision-bound path, so they bind authorization to an argument fingerprint and surface ActionPendingError when an approval outlives the request.

Commands

pnpm install
pnpm -r build
pnpm -r test
pnpm -r typecheck
pnpm check
pnpm format

CI and the deploy workflows run Node 24; develop on Node 24+.

Use per-package filters when working narrowly:

pnpm --filter nominee test
pnpm --filter nominee-ai build

Conventions

  • TypeScript strict mode is enabled.
  • Use import type for type-only imports.
  • Use .js extensions on relative TypeScript imports.
  • Biome formatting uses single quotes, no semicolons, trailing commas, and 100-character line width.
  • Keep public APIs small and documented.
  • Prefer focused tests in test/*.test.ts next to the package being changed.
  • Do not add runtime dependencies to packages/core.

Documentation

First-touch docs live in three places:

  • README.md for the GitHub landing page.
  • packages/*/README.md for npm package pages.
  • site/ for nominee.dev.

Deeper operator docs live in docs/: production.md for the production runbook and measurement.md for the opt-in usage reporter.

Never commit GTM or internal planning

This repository is public. .gitignore is not enough — agents have shipped the same notes under new folder names (docs/launch-shot/, docs/design-partners/, docs/placements/follow-through.md). Do not commit, open a PR for, or "document in-repo" any of:

  • Launch kits (Product Hunt / HN / Reddit drafts, gate checklists, day-of posting plans)
  • Design-partner outreach, scorecards, pipelines, call notes, contact lists
  • Placement / listing follow-through boards, paste-ready upstream PR blurbs meant only for filing, weekly GTM status
  • Private Linear issue bodies, workspace URLs (linear.app/brth31), or "Road to 500" / kill-criteria working notes
  • Named third-party maintainer emails used as outreach targets
  • Anything that belongs in *.local.md, launch/, INTERNAL_NOTES.md, or marketing_plan.md

Keep those files gitignored on disk or in a private repo. Public docs/ is for operators of the library (production runbook, observe, measurement script usage, integration guides). brand/check-surfaces.mjs fails if a forbidden path is tracked or a private Linear workspace URL appears in git.

Positioning copy for the site lives in brand/content.ts and docs/positioning.md. That is not a license to commit the GTM machine.

Keep examples aligned with the actual exported API before publishing.

Public surface sync

When you change packages/core/src/nominee.ts, action.ts, adapter run() wiring, or the decision-bound lifecycle, update these surfaces in the same PR:

SurfaceFile
GitHub landingREADME.md
LLM context (both copies)llms.txt, site/llms.txt
Docssite/docs/index.html
Landing pagesite/index.html
Package READMEspackages/*/README.md (especially adapters)
Examplesexamples/*/README.md
Agent guideAGENTS.md, CLAUDE.md

Run node brand/check-surfaces.mjs before opening a PR — CI enforces it. Positioning copy changes start in brand/content.ts; walk brand/README.md's surface registry for narrative surfaces.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.