AGENTS

A command system for a channel-based application, including command parsing, subcommands, translations, and permission checks. It defines commands with a chained builder style and routes them through shared middleware.

In plain words
What is it for?
Use it to implement general, identity, session, authorization, channel-control, and access commands, including administrator-only actions and typed channel tools.
Why use it?
It gives the application one consistent place to define, organize, translate, and protect commands instead of handling each command separately.

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/oneworks-ai/app/agents
Clone the repo
git clone --depth 1 https://github.com/oneworks-ai/app
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,018 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.00000 $0.02018
Opus 5 $0.00000 $0.01009
Sonnet 5 $0.00000 $0.00404
Haiku 4.5 $0.00000 $0.00202

Measured yesterday against content hash 4de1ae1c9dd6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

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

apps/server/src/channels/middleware/commands/AGENTS.md · 99 lines

How it starts

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

Commands Middleware

Channel 指令系统的核心中间件,负责解析用户输入的文本指令并执行对应的操作。

架构概览

commands/
  index.ts            ← 中间件入口,组装所有指令并分发(含权限拦截)
  command-system.ts   ← 指令类型系统、chain builder、解析器
  cmd.general.ts      ← 通用指令:help / whoami / lang(含 help 格式化)
  cmd.identity.ts     ← 身份指令:identity whoami / link / accounts
  cmd.session.ts      ← 会话指令:session / search / bind / unbind / reset / stop / get / set / permissionMode
  cmd.authorization.ts ← 授权请求指令:auth request / list / grant / deny
  cmd.channel-control.ts ← 频道过程控制指令:silent / unsilent / stop / start / ban
  cmd.access.ts       ← 权限指令:access / admins / admin / allow / block
  access.ts           ← 权限检查 & 频道配置写入工具
  tools.ts            ← CommandSpec 到 `channel.*` typed tool definition 的转换
  i18n.ts             ← 国际化注册 API(defineMessages / t / createT)、LanguageCode 类型、系统级共享翻译
  utils.ts            ← splitCommand / dedupe / choiceParser

核心机制

Chain-style 指令定义

所有指令使用 command() builder 链式定义,而非对象字面量。支持 .alias() / .description() / .adminOnly() / .argument() / .subcommand() / .action() / .build()。需要 action 的指令以 .action() 结尾返回 CommandSpec;纯分组指令(只有 subcommands 没有 action)以 .build() 结尾。

权限自动拦截

每个 CommandSpecpermission: 'everyone' | 'admin'(通过 .adminOnly() 设置)。中间件在 dispatch 时会把解析后的 command、当前 sender、channel admin 配置和 source 交给 services/channel-approval 做最小裁决:若指令标记为 admin-only 且当前发送者不是管理员,直接回复权限错误,不会进入 action。cmd 文件中的 action 无需手动检查权限。

Command Run 审计

解析成功的 fast path 指令会写入 channel_command_runs

  • action 成功:success
  • admin-only 被拦截:denied
  • action 抛错:failed

未知指令会继续透传给后续 middleware,不写 command run。解析到已知指令但参数错误时当前仍只回复用法,不写 run;后续若需要完整审计再扩展 parse-error run。

channel_command_runs.metadata.approval 会记录最小 resolver 的裁决摘要,包括 status、reasonCode、capability、actor id 和 authorizationRequestId(如有)。这只是审计摘要,不是 credential secret,也不代表已经获得用户个人登录态。

Typed Tool Registry

tools.ts 将现有 CommandSpec 树转换成 channel.* typed tool definition,并提供 tool input 到 CommandParseSuccess 的解析。registry 描述工具名、command path、slash usage、参数 JSON schema、权限等级和 actorAuthority: 'sender';执行仍回到 index.ts 的统一 command runner,所以 typed invocation 和 slash fast path 共享权限拦截、action 和 channel_command_runs 审计。

Read the full file on GitHub · 99 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 · 99 lines · 0 tokens per session scan A 4de1ae1c9dd6

Subscribe to this mod's changes

AGENTS is a command published in the GitHub repository oneworks-ai/app (18 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,018 tokens. 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.