agentleFS
AWSKnown publisheraws/agentcore-cli/src/lib/AGENTS.md

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

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
  1. Very specific:

    Never hardcode Unix paths: - Use getVenvExecutable() for Python venv paths

    line 43
  2. Very specific:

    Use platform utilities: - Import from lib/utils/platform instead of checking process.platform directly

    line 44
  3. Distinctive:

    Test on both platforms: - Ensure features work on Windows and Unix

    line 45
  4. Very specific:

    Avoid Unix-specific commands: - Use Node.js APIs or cross-platform alternatives (e.g., Node.js fs instead of rm -rf)

    line 46
  5. Distinctive:

    Document platform differences: - Add comments explaining platform-specific behavior

    line 48

≈ “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.

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

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 .zip artifact 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 flags
  • getVenvExecutable(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
  • getShellCommand() - Get platform-appropriate shell command
  • getShellArgs(command) - Get platform-appropriate shell arguments
  • normalizeCommand(command) - Add .exe extension on Windows when needed

Guidelines for Cross-Platform Code

  1. Never hardcode Unix paths - Use getVenvExecutable() for Python venv paths
  2. Use platform utilities - Import from lib/utils/platform instead of checking process.platform directly
  3. Test on both platforms - Ensure features work on Windows and Unix
  4. Avoid Unix-specific commands - Use Node.js APIs or cross-platform alternatives (e.g., Node.js fs instead of rm -rf)
  5. 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 Windows

Future Direction

Functionality such as imperative code implementations to write secret values into the AgentCore Identity primitive would be well-suited for this module.

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.