This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
CookingAgent is a TypeScript-based intelligent chatbot that serves as a personal cooking assistant. It combines LLM capabilities with the HowToCook open-source recipe repository to provide:
- Smart menu recommendations based on user preferences
- Ingredient and tool shopping lists
- Optimized cooking workflow planning
- Interactive conversation support
- Requirements:
docs/prd.md- Product Requirements Document v1.1 - Architecture:
docs/sad.md- System Architecture Document v1.3 - Task List:
docs/todo.md- Detailed development tasks breakdown - Data Source:
HowToCook/- Recipe repository (Markdown files)
The system follows a 3-layer architecture:
- Data Layer: Offline preprocessing pipeline that converts HowToCook MD files to structured JSON
- Application Core: Conversation engine, knowledge base, and AI agent modules
- Presentation Layer: CLI interface built with Ink + React
-
Offline Data Processing:
RecipeParser: MD → native JSON conversionLLM-basedTagger: Incremental smart tagging using LLMDatabaseBuilder: Generatesrecipes_index.jsonandrecipes_data.json
-
Online Agent Modules:
extractIntent: Parse user preferences from natural languagerecommendMenu: Generate personalized menu recommendationsplanWorkflow: Create optimized cooking workflowsKnowledgeBase: In-memory recipe data management
-
CLI Interface: React-based Ink components for rich terminal UI
- Language: TypeScript
- AI Framework: Vercel AI SDK
- UI Framework: Ink (React for CLI)
- Data Processing: Native Node.js with crypto for hashing
- Schema Validation: Zod (for LLM output validation)
Since the project is not yet implemented, these commands will be added during development:
# Data processing
npm run process-data # Process HowToCook recipes into JSON
# Development
npm run dev # Start development server
npm run build # Build for production
npm start # Run the CLI application
# Code quality
npm run lint # Run ESLint
npm run type-check # Run TypeScript compiler- Offline: HowToCook MD files → RecipeParser → LLM-basedTagger → JSON database
- Online: User input → extractIntent → recommendMenu → planWorkflow → CLI display
- Incremental: Only new/changed recipes are processed by LLM to optimize API costs
The system uses structured prompts with specific personas:
- LLM-basedTagger: "美食数据分析师" for recipe tagging
- extractIntent: "智能点餐员" for preference extraction
- recommendMenu: "高级营养师和米其林餐厅行政总厨" for menu creation
- planWorkflow: "效率大师和厨房总指挥" for workflow optimization
All LLM interactions use JSON schemas with Zod validation to ensure output consistency.
The terminal interface should display:
- Welcome message at the top
- Message history in the middle
- Input box at the bottom that clears after submission
- Status/error line below the input box
- Use incremental processing to minimize LLM API calls
- Preserve original markdown text for ingredient lists and cooking steps
- Implement proper error handling for LLM API failures
- Follow the detailed task breakdown in
docs/todo.md