@@ -11,6 +11,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
1111- ** Test locally** : ` bun run ./dist/index.js ` - Run the built CLI locally
1212- ** Run tests** : ` bun test ` - Runs all test files (* .spec.ts)
1313- ** Run single test** : ` bun test src/lib/util.spec.ts ` - Run specific test file
14+ - ** Test cat** : ` bun test src/lib/cat.spec.ts ` - Run cat vocabulary and emotion detection tests
1415
1516## Project Architecture
1617
@@ -26,7 +27,7 @@ This is a terminal-based chat UI CLI tool that simulates a conversation with a c
2627 - ` Spinner.tsx ` : Loading indicator during cat responses
2728 - ` types.ts ` : Shared TypeScript interfaces
2829- ** Business Logic** (` src/lib/ ` ): Core functionality and utilities
29- - ` cat.ts ` : Cat class with async response generation
30+ - ` cat.ts ` : Cat class with emotion-based response generation and vocabulary system
3031 - ` util.ts ` : Reusable utility functions (e.g., indent for text formatting)
3132- ** Build System** (` scripts/build.ts ` ): Custom Bun build script that creates executable CLI binary
3233
@@ -50,7 +51,7 @@ The custom InputField component supports comprehensive terminal-style keybinding
5051- ** Message Persistence** : Uses Ink's ` <Static> ` component to render chat history that doesn't re-render
5152- ** Loading States** : Displays cyan spinner with "Thinking..." during cat response delay
5253- ** Input Management** : Disables cursor and prevents duplicate submissions during loading
53- - ** Cat Behavior** : Cat class provides async responses with "ニャー" after 500ms delay
54+ - ** Cat Behavior** : Cat class provides contextual responses based on detected emotions, with 500ms delay for realistic interaction
5455- ** Message Styling** : User messages prefixed with "> " in gray, cat messages prefixed with "⏺ " in cyan
5556- ** Multi-line Support** : Both user and cat messages use indent utility for proper 2+ line formatting
5657
@@ -80,4 +81,29 @@ The codebase follows a modular component structure:
8081- Color scheme: gray for user messages, cyan for cat messages and spinner, yellow for input prompt
8182- Components are split into separate files in ` src/components/ ` for maintainability
8283- Test files use ` .spec.ts ` naming convention and bun: test framework
83- - Utility functions follow options-object pattern for extensibility
84+ - Utility functions follow options-object pattern for extensibility
85+
86+ ## Cat Intelligence System
87+
88+ The cat response system uses emotion detection and vocabulary mapping:
89+
90+ ### Emotion Detection
91+ - ** Keyword Matching** : User input is analyzed for emotional keywords (case-insensitive)
92+ - ** 7 Categories** : greeting, affection, satisfaction, excitement, playful, sleepy, hungry
93+ - ** Fallback** : Unrecognized input defaults to basic cat sounds
94+
95+ ### Vocabulary System
96+ - ** Half-width Katakana** : All responses use consistent ニャー-style formatting
97+ - ** Contextual Responses** : Each emotion category has 2-3 unique vocalizations
98+ - ** Random Selection** : Responses are randomly chosen from appropriate category
99+ - ** Expandable** : New emotions and sounds can be easily added to vocabulary maps
100+
101+ ### Cat Response Patterns
102+ - ** Greeting** : ニャッ, ミャッ, ニャ (for hellos, introductions)
103+ - ** Affection** : ニャオ~ ン, ミャオ~ , ニャンニャン (for love, cute, petting)
104+ - ** Satisfaction** : ゴロゴロ, ニャ~ (for thanks, happiness)
105+ - ** Excitement** : ニャニャニャ!, ミャー!, ニャッニャッ (for play, fun)
106+ - ** Playful** : ニャーン, ミャミャ, ニャオッ (for games, toys)
107+ - ** Sleepy** : ニャ…, フニャ~ , ニャ~ ン (for tired, sleep)
108+ - ** Hungry** : ニャオォン, ミャーオ, ニャンニャン! (for food, eating)
109+ - ** Default** : ニャー, ニャン, ミャー (for unrecognized input)
0 commit comments