agentcore-cli / lib
AGENTS.md301 starsChanged 3 months agoApache-2.0View on GitHub
The lib module contains functionalities and utilities that are used by both the cli and the cdk modules. This module serves the important goal of making sure that the CDK implementations don't take a direct dependency on the CLI. Packaging: Producing deployment artifacts for AgentCore runtimes. Two packagers are available: - PythonPackager / NodePackager (CodeZip): Installs dependencies and produces a .zip artifact targeting ARM64 architecture. - ContainerPackager (Container): Validates the Dockerfile exists, detects a local container runtime (Docker/Podman/Finch), builds the…
- Deletes or force-pushes
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/commands/AGENTS.mdAGENTS.md
- src/cli/templates/AGENTS.mdAGENTS.md
- src/cli/tui/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
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 43
Never hardcode Unix paths: - Use getVenvExecutable() for Python venv paths
- Very specific: line 44
Use platform utilities: - Import from lib/utils/platform instead of checking process.platform directly
- Distinctive: line 45
Test on both platforms: - Ensure features work on Windows and Unix
- Very specific: line 46
Avoid Unix-specific commands: - Use Node.js APIs or cross-platform alternatives (e.g., Node.js fs instead of rm -rf)
- Distinctive: line 48
Document platform differences: - Add comments explaining platform-specific behavior
≈ “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
Lib Module
The lib module contains functionalities and utilities that are used by both the cli and the cdk modules. This
module serves the important goal of making sure that the CDK implementations don't take a direct dependency on the CLI.
Functions
Packaging: Producing deployment artifacts for AgentCore runtimes. Two packagers are available:
- PythonPackager / NodePackager (CodeZip): Installs dependencies and produces a
.zipartifact targeting ARM64 architecture. - ContainerPackager (Container): Validates the Dockerfile exists, detects a local container runtime (Docker/Podman/Finch), builds the image locally, and validates the 1GB size limit. If no local runtime is available, the local build is skipped (deploy uses CodeBuild).
Container constants (CONTAINER_RUNTIMES, DOCKERFILE_NAME, CONTAINER_INTERNAL_PORT) and the ContainerRuntime type
are in lib/constants.ts.
ConfigIO: This module defines utilities to read and write configs which satisfy schemas to the local file system. Both the CLI and the CDK require this functionality.
Util: Subprocess command utilities, zod utilities, and OS utilities.
Cross-Platform Support
The CLI is designed to work on both Windows and Unix-like systems (Linux, macOS). Platform-specific differences are
abstracted through utilities in lib/utils/platform.ts.
Platform Utilities
Key utilities for cross-platform development:
isWindows,isMacOS,isLinux- Platform detection flagsgetVenvExecutable(venvPath, executable)- Get correct path to Python venv executables- Unix:
.venv/bin/python,.venv/bin/uvicorn - Windows:
.venv\Scripts\python.exe,.venv\Scripts\uvicorn.exe
- Unix:
getShellCommand()- Get platform-appropriate shell commandgetShellArgs(command)- Get platform-appropriate shell argumentsnormalizeCommand(command)- Add .exe extension on Windows when needed
Guidelines for Cross-Platform Code
- Never hardcode Unix paths - Use
getVenvExecutable()for Python venv paths - Use platform utilities - Import from
lib/utils/platforminstead of checkingprocess.platformdirectly - Test on both platforms - Ensure features work on Windows and Unix
- Avoid Unix-specific commands - Use Node.js APIs or cross-platform alternatives (e.g., Node.js fs instead of
rm -rf) - Document platform differences - Add comments explaining platform-specific behavior
Example
import { getVenvExecutable, isWindows } from '../lib/utils/platform';
// ❌ BAD: Hardcoded Unix path
const uvicorn = join(venvPath, 'bin', 'uvicorn');
// ✅ GOOD: Cross-platform
const uvicorn = getVenvExecutable(venvPath, 'uvicorn');
// Returns: .venv/bin/uvicorn on Unix, .venv\Scripts\uvicorn.exe on WindowsFuture Direction
Functionality such as imperative code implementations to write secret values into the AgentCore Identity primitive would be well-suited for this module.
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.

