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

agentcore-cli / tui

AGENTS.md301 starsChanged 3 months agoApache-2.0View on GitHub

The TUI is defined using the ink npm package which converts React definitions to terminal output. The TUI layer defines a full immersive app that takes over the running shell process. To accomidate users running arbitrary commands while using the TUI, the ! input serves as an escape. At a high level, the TUI should be thought of more as a unified app than a CLI. Nevertheless, business logic, async work, and process orchestration must live outside the UI and…

The file

Show its rules and text

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

16 rules. About 0 are common, 6 are distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Avoid manual spacing to ensure graceful resizing -- use flexbox for responsive layouts

    line 22
  2. Very specific:

    Use consistent theming via theme.ts

    line 25
  3. Distinctive:

    Do not perform async work inside components or screens

    line 30
  4. Distinctive:

    All side effects live in hooks

    line 32
  5. Distinctive:

    Prefer reuse over specialization

    line 39
  6. Distinctive:

    When adding a new screen:

    line 41
  7. Very specific:

    All screens must use the Screen component wrapper.

    line 50
  8. Very specific:

    Simple selection screens: use SelectScreen - one component replaces manual useInput, Panel, and SelectList

    line 52
  9. Very specific:

    Multi-phase screens: use Screen with conditional content based on phase/step state

    line 53
  10. Very specific:

    Wizard flows: use Screen with StepIndicator in headerContent

    line 54
  11. Very specific:

    Prompts/modals: use SuccessPrompt, ErrorPrompt, or ConfirmPrompt

    line 55
  12. Very specific:

    Never write manual exit handling (useInput with escape/q checks).

    line 57
  13. Very specific:

    Never write manual list navigation.

    line 59
  14. Very specific:

    All help text strings must be defined in constants.ts as HELP_TEXT.*.

    line 65
  15. Distinctive:

    When both are provided, custom validation runs first, then schema validation.

    line 107
  16. Very specific:

    Never duplicate error messages - they must come from Zod schemas or the customValidation return value.

    line 123

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

TUI

The TUI is defined using the ink npm package which converts React definitions to terminal output.

The TUI layer defines a full immersive app that takes over the running shell process. To accomidate users running arbitrary commands while using the TUI, the ! input serves as an escape.

At a high level, the TUI should be thought of more as a unified app than a CLI. Nevertheless, business logic, async work, and process orchestration must live outside the UI and be accessed via hooks.

The architecture:

  1. App.tsx: Main router handling navigation between screens. Owns global screen state and transitions.
  2. screens/ : This directory contains feature-specific UI screens. Feature-level UI screens (full-page views).
  3. components/ : This directory contains reusable UI components. No navigation logic.
  4. hooks/ : This directory contains custom react hooks for state management and responsive behavior. Hooks may call services or CLI logic.
  5. utils/ : This directory contains helper functions

To implement effective ink:

  1. Avoid manual spacing to ensure graceful resizing -- use flexbox for responsive layouts
  2. Centralize keyboard handling with useInput and internal state.
  3. Focus on pure rendering. Async work or process orchestration should be pulled out into hooks or services.
  4. Use consistent theming via theme.ts
  5. Define styling, or visual text as constants. Don't inline important visual decisions buried in the code.

Rendering:

  1. Do not perform async work inside components or screens
  2. UI components must be pure functions of props and state
  3. All side effects live in hooks

Component Design:

  1. Build small, composable, reusable components
  2. Separate layout from content
  3. Maintain consistent visual hierarchy
  4. Prefer reuse over specialization

When adding a new screen:

  1. Define the screen component in screens/
  2. Register it in App.tsx
  3. Move all async or orchestration logic into a hook
  4. Reuse existing components where possible

Screen Patterns

All screens must use the Screen component wrapper. This provides exit handling, headers, and help text automatically.

  1. Simple selection screens use SelectScreen - one component replaces manual useInput, Panel, and SelectList
  2. Multi-phase screens use Screen with conditional content based on phase/step state
  3. Wizard flows use Screen with StepIndicator in headerContent
  4. Prompts/modals use SuccessPrompt, ErrorPrompt, or ConfirmPrompt

Never write manual exit handling (useInput with escape/q checks). Use Screen or useExitHandler.

Never write manual list navigation. Use useListNavigation or SelectScreen.

For future generic and re-usable components, separate them out.

Constants

All help text strings must be defined in constants.ts as HELP_TEXT.*. Never inline help text strings.

Silent defaults are forbidden. If a value might be undefined, either throw an error or use a centrally defined constant.

Component Hierarchy

Screen (exit handling, layout, help text)
  └─ ScreenHeader (bordered title + optional metadata)
  └─ Content (StepProgress, SelectList, TextInput, etc.)
  └─ Help text (from HELP_TEXT constants)

SelectScreen (for simple selection lists)
  └─ Screen + Panel + SelectList + useListNavigation (bundled)

PromptScreen / SuccessPrompt / ErrorPrompt / ConfirmPrompt
  └─ For modal-like confirmations and error displays

Flow Hooks

Screens with multi-step async workflows must extract logic into a use*Flow hook (e.g., usePlanFlow, useInitFlow).

The hook owns:

  • Phase/step state machine
  • Async operations
  • Error handling
  • Retry logic

The screen owns:

  • Rendering based on hook state
  • User input that triggers hook actions

TextInput Validation

TextInput supports two validation modes that can be used independently or together:

  1. schema - Zod schema validation. Error message comes from the schema definition.
  2. customValidation - Function returning true if valid, or error message string if invalid.

When both are provided, custom validation runs first, then schema validation.

// Schema only - error message from Zod
<TextInput schema={GatewayNameSchema} />

// Custom only - returns true or error string
<TextInput customValidation={value => value === expected || 'Must match exactly'} />

// Both - custom runs first, then schema
<TextInput
  schema={GatewayNameSchema}
  customValidation={value => !existingNames.includes(value) || 'Must be unique'}
/>

Never duplicate error messages - they must come from Zod schemas or the customValidation return value.

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.