agentcore-cli / commands
AGENTS.md301 starsChanged 3 months agoApache-2.0View on GitHub
This file defines context around specific commands surfaced by the CLI and related functionalities Each command directory follows a standardized structure: The command.tsx file must be boring Commander registration only: If removing a command file would remove behavior, the design is wrong. Some commands have additional files for their specific needs:
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,773 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 repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- examples/AgentCoreCliReviewer/AGENTS.mdAGENTS.md
- src/assets/agents/AGENTS.mdAGENTS.md
- src/assets/AGENTS.mdAGENTS.md
- src/cli/AGENTS.mdAGENTS.md
- src/cli/templates/AGENTS.mdAGENTS.md
- src/cli/tui/AGENTS.mdAGENTS.md
- src/lib/AGENTS.mdAGENTS.md
- src/schema/AGENTS.mdAGENTS.md
- src/schema/llm-compacted/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- acr-reportSkill
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Must NOT contain behavior or decision-making logic
- Distinctive: line 25
If removing a command file would remove behavior, the design is wrong.
- Distinctive: line 43
Must be UI-agnostic where possible
- Distinctive: line 47
Must be UI-agnostic (no Ink, no process.exit)
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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.
Files
Command Descriptions
This file defines context around specific commands surfaced by the CLI and related functionalities
File Naming Convention
Each command directory follows a standardized structure:
commands/{name}/
├── command.tsx # Commander registration (required)
├── action.ts # Business logic and handlers (optional)
├── index.ts # Re-exports (required)
└── {Component}.tsx # React components for TUI (optional)Separation of Concerns
The command.tsx file must be boring Commander registration only:
- Define flags, help text, aliases
- Invoke a handler from
action.tsor render a TUI screen - Must NOT contain behavior or decision-making logic
If removing a command file would remove behavior, the design is wrong.
Three-Layer Architecture
- Command File (
commands/{name}/command.tsx)- Commander registration only
- Parses CLI args and invokes handler or TUI
- Primitives (
primitives/) — for resource add/remove commands- Each resource type (agent, memory, identity, gateway, mcp-tool) has a primitive class
- Primitives own add/remove logic, CLI subcommand registration, and TUI screen routing
addandremovecommands delegate to primitives viaprimitive.registerCommands()- See
src/cli/AGENTS.mdfor the full primitives architecture
- Action File (
commands/{name}/action.ts) — for non-resource commands- Contains business logic specific to this command (e.g., deploy, invoke, package)
- Defines interfaces (e.g.,
InvokeContext,PackageResult) - Implements handlers (e.g.,
handleInvoke,loadPackageConfig) - Must be UI-agnostic where possible
- Operation (
operations/{domain}/)- Shared utilities consumed by primitives and commands (schema mapping, template rendering)
- Must be UI-agnostic (no Ink, no process.exit)
- Reusable by TUI screens, primitives, and command handlers alike
Good vs Bad Examples
// GOOD: Command file only registers and delegates
// commands/deploy/command.tsx
export const registerDeploy = (program: Command) => {
program
.command('deploy')
.description('Deploy AgentCore agent')
.action(() => {
render(<DeployScreen onExit={() => process.exit(0)} />);
});
};
// GOOD: Logic in action.ts, command.tsx just wires it up
// commands/invoke/action.ts
export async function loadInvokeConfig(): Promise<InvokeContext> { ... }
export function handleInvoke(context: InvokeContext): InvokeResult { ... }
// commands/invoke/command.tsx
export const registerInvoke = (program: Command) => {
program.command('invoke').action(async () => {
const context = await loadInvokeConfig();
const result = handleInvoke(context);
render(<Text>{result.agentName}</Text>);
});
};
// BAD: Command file contains domain logic
export const registerPackage = (program: Command) => {
program.command('package').action(async () => {
const config = await loadConfig(); // should be in action.ts
const agents = filterAgents(config, flag); // should be in action.ts
await packRuntime(agent, options); // should be in action.ts
});
};Command-Specific Resources
Some commands have additional files for their specific needs:
commands/create/- Containsschema-mapper.tsandwrite-agent-to-project.tsfor agent creation logiccommands/init/- ContainsInitScreen.tsxfor the initialization UI component
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
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.

