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…
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/lib/AGENTS.mdAGENTS.md
- src/schema/AGENTS.mdAGENTS.md
- src/schema/llm-compacted/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- acr-reportSkill
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
- Distinctive: line 22
Avoid manual spacing to ensure graceful resizing -- use flexbox for responsive layouts
- Very specific: line 25
Use consistent theming via theme.ts
- Distinctive: line 30
Do not perform async work inside components or screens
- Distinctive: line 32
All side effects live in hooks
- Distinctive: line 39
Prefer reuse over specialization
- Distinctive: line 41
When adding a new screen:
- Very specific: line 50
All screens must use the Screen component wrapper.
- Very specific: line 52
Simple selection screens: use SelectScreen - one component replaces manual useInput, Panel, and SelectList
- Very specific: line 53
Multi-phase screens: use Screen with conditional content based on phase/step state
- Very specific: line 54
Wizard flows: use Screen with StepIndicator in headerContent
- Very specific: line 55
Prompts/modals: use SuccessPrompt, ErrorPrompt, or ConfirmPrompt
- Very specific: line 57
Never write manual exit handling (useInput with escape/q checks).
- Very specific: line 59
Never write manual list navigation.
- Very specific: line 65
All help text strings must be defined in constants.ts as HELP_TEXT.*.
- Distinctive: line 107
When both are provided, custom validation runs first, then schema validation.
- Very specific: line 123
Never duplicate error messages - they must come from Zod schemas or the customValidation return value.
≈ “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
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:
- App.tsx: Main router handling navigation between screens. Owns global screen state and transitions.
- screens/ : This directory contains feature-specific UI screens. Feature-level UI screens (full-page views).
- components/ : This directory contains reusable UI components. No navigation logic.
- hooks/ : This directory contains custom react hooks for state management and responsive behavior. Hooks may call services or CLI logic.
- utils/ : This directory contains helper functions
To implement effective ink:
- Avoid manual spacing to ensure graceful resizing -- use flexbox for responsive layouts
- Centralize keyboard handling with useInput and internal state.
- Focus on pure rendering. Async work or process orchestration should be pulled out into hooks or services.
- Use consistent theming via theme.ts
- Define styling, or visual text as constants. Don't inline important visual decisions buried in the code.
Rendering:
- Do not perform async work inside components or screens
- UI components must be pure functions of props and state
- All side effects live in hooks
Component Design:
- Build small, composable, reusable components
- Separate layout from content
- Maintain consistent visual hierarchy
- Prefer reuse over specialization
When adding a new screen:
- Define the screen component in
screens/ - Register it in
App.tsx - Move all async or orchestration logic into a hook
- Reuse existing components where possible
Screen Patterns
All screens must use the Screen component wrapper. This provides exit handling, headers, and help text automatically.
- Simple selection screens use
SelectScreen- one component replaces manual useInput, Panel, and SelectList - Multi-phase screens use
Screenwith conditional content based on phase/step state - Wizard flows use
ScreenwithStepIndicatorin headerContent - Prompts/modals use
SuccessPrompt,ErrorPrompt, orConfirmPrompt
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 displaysFlow 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:
schema- Zod schema validation. Error message comes from the schema definition.customValidation- Function returningtrueif 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.
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.

