Skip to Content

Prompt Histories

undefined

main.history.ts
import { AutoBeAgent } from "@autobe/agent"; import { AutoBeCompiler } from "@autobe/compiler"; import { AutoBeHistory } from "@autobe/interface"; import OpenAI from "openai"; declare function getHistories(): Promise<AutoBeHistory[]>; declare function archiveHistories(histories: AutoBeHistory[]): Promise<void>; const agent = new AutoBeAgent({ model: "chatgpt", vendor: { api: new OpenAI({ apiKey: "********" }), model: "gpt-4.1", }, compiler: new AutoBeCompiler(), histories: await getHistories(), }); await agent.conversate(` I want to create a political/economic discussion board. Since I'm not familiar with programming, please write a requirements analysis report as you see fit. `); await archiveHistories(agent.getHistories());

When creating an AutoBeAgent, you can start from previous conversations by specifying the histories property. Additionally, you can retrieve the conversation histories of the current AutoBeAgent by calling the AutoBeAgent.getHistories() method.

All history types in @autobe are collected into the AutoBeHistory type as a union. Each history type represents:

Message Histories

@autobe/interface
import { AutoBeAgentHistoryBase } from "./AutoBeHistoryBase"; import { AutoBeUserMessageContent } from "./contents/AutoBeUserMessageContent"; /** * History record generated when a user sends a message during the conversation * flow. * * User messages support comprehensive multimodal capabilities, allowing not * only text input but also image attachments, document file uploads, and voice * input. This flexibility enables users to communicate requirements, provide * visual references, share existing documentation, and interact naturally * through multiple input modalities. * * The multimodal support enhances the vibe coding experience by allowing users * to express their needs through the most appropriate medium, whether that's * describing requirements in text, showing examples through images, or * providing specifications through document uploads. * * @author Samchon */ export interface AutoBeUserMessageHistory extends AutoBeAgentHistoryBase<"userMessage"> { /** * Array of content items that comprise the user's message. * * Contains the multimodal content of the user's message, which can include * various types of {@link AutoBeUserMessageContent} such as text, images, * document files, and audio inputs. Each content item represents a different * modality or attachment within the same message. * * The array structure allows users to combine multiple content types in a * single message, such as text description accompanied by reference images or * documents. This multimodal approach provides rich context for the AI * assistant to better understand user requirements and generate more accurate * development artifacts. */ contents: AutoBeUserMessageContent[]; }

Message histories are divided into user conversation history AutoBeUserMessageHistory and assistant conversation history AutoBeAssistantMessageHistory.

For users, multimodal capabilities are supported, allowing not only text but also image/document file attachments and voice input, which results in different content types. The assistant communicates only through text, so its content type is limited to string.

Development Histories

AutoBeAnalyzeHistory

@autobe/interface
import { tags } from "typia"; import { AutoBeAgentHistoryBase } from "./AutoBeHistoryBase"; import { AutoBeAnalyzeFile } from "./contents/AutoBeAnalyzeFile"; import { AutoBeAnalyzeRole } from "./contents/AutoBeAnalyzeRole"; /** * History record generated when the Analyze agent and user have completed all * discussions regarding requirements, and a comprehensive analysis report has * been issued. * * The Analyze agent follows a structured workflow from initial drafting to * final completion, producing multiple markdown documents that capture business * requirements, technical specifications, and architectural decisions. This * analysis serves as the foundation for all subsequent development phases * including database design and API specification. * * The requirements analysis process transforms user conversations and business * needs into structured documentation that guides the entire vibe coding * pipeline, ensuring that technical implementation accurately reflects business * intentions. * * @author Samchon */ export interface AutoBeAnalyzeHistory extends AutoBeAgentHistoryBase<"analyze"> { /** * Reason why the Analyze agent was activated through function calling. * * Explains the specific circumstances that triggered the AI chatbot to invoke * the Analyze agent via function calling. This could include reasons such as * initial project requirements gathering, requests for requirement * clarification, updates to existing requirements based on user feedback, or * revision requests for the analysis report. */ reason: string; /** * Iteration number of this requirements analysis report. * * Indicates which revision of the requirements analysis this represents. A * value of 0 means this is the initial requirements analysis, while higher * values represent subsequent revisions based on user feedback or additional * requirements gathering. * * If other development artifacts (Prisma, Interface, Test histories) have * step values lower than this value, it means those artifacts have not been * updated to reflect the latest requirements and may need regeneration. */ step: number; /** * Project alias prefix that will be applied to all generated artifacts. * * A short project identifier that will be consistently used as a prefix for * database table names, API function names, and DTO type names throughout the * entire codebase. This ensures consistent naming conventions and helps avoid * naming conflicts in larger systems. * * For example, if the prefix is "shopping", generated artifacts might include * tables like `shopping_customers` and DTOs like `IShoppingCartCommodity`. */ prefix: string; /** * Generated requirements analysis report files as key-value pairs. * * Contains the complete set of markdown documents that comprise the * requirements analysis report. Each key represents the filename and each * value contains the actual markdown content. The report typically includes * business context, functional requirements, technical specifications, * architectural decisions, and implementation guidelines. * * These documents serve as the authoritative source for understanding project * requirements and guide all subsequent development phases in the vibe coding * pipeline. */ files: AutoBeAnalyzeFile[]; /** * ISO 8601 timestamp indicating when the requirements analysis was completed. * * Marks the exact moment when the Analyze agent finished the complete * analysis workflow including drafting, review, amendments, and finalization. * This timestamp is crucial for tracking the development timeline and * determining which development artifacts need updating based on requirement * changes. */ completed_at: string & tags.Format<"date-time">; /** * List of roles identified during the requirements analysis process. * * Contains the various user roles, personas, or stakeholder types that were * identified and analyzed during the requirements gathering phase. These * roles help define different user perspectives, access levels, and * functional requirements needed for the system being developed. */ roles: AutoBeAnalyzeRole[]; }

AutoBeAnalyzeHistory is a history generated when the @autobe agent and user have completed all discussions regarding requirements, and a report has been issued. The report consists of multiple markdown documents, which are stored in the files property.

The step property indicates which iteration of the requirements analysis report this represents. If this value is not 0, it means the requirements analysis report has been revised that many times. If the step value of other histories is lower than AutoBeAnalyzeHistory.step, it means those histories have not been reflected in the latest requirements analysis report.

AutoBePrismaHistory

@autobe/interface
import { tags } from "typia"; import { IAutoBePrismaCompileResult } from "../compiler"; import { IAutoBePrismaValidation } from "../prisma"; import { AutoBeAgentHistoryBase } from "./AutoBeHistoryBase"; /** * History record generated when the Prisma agent analyzes the requirements * specification and completes the database design. * * The Prisma agent constructs data of type {@link AutoBePrisma.IApplication} * through AI function calling, validates it, and then generates prisma schema * files. This history captures the complete database design process including * validation results, generated schema files, and compilation outcomes. * * The database design process follows a sophisticated three-tier compiler * infrastructure that transforms business requirements into validated database * architectures through AST (Abstract Syntax Tree) manipulation, ensuring 100% * syntactic correctness while maintaining semantic integrity. * * @author Samchon */ export interface AutoBePrismaHistory extends AutoBeAgentHistoryBase<"prisma"> { /** * Validation results of the constructed {@link AutoBePrisma.IApplication} * data. * * Contains the outcome of validating the AST structures generated through AI * function calling. The Prisma agent generally creates valid * {@link AutoBePrisma.IApplication} data through a validation feedback * process, but when using very small AI models, this result might have * `success := false`. * * The validation includes: * * - Relationship graph analysis to detect circular dependencies * - Business logic validation for constraint compliance * - Performance optimization analysis for query patterns * - Security constraint enforcement for data access patterns */ result: IAutoBePrismaValidation; /** * Generated Prisma schema files as key-value pairs. * * Each key represents the filename (following the pattern * `schema-{number}-{domain}.prisma`) and each value contains the actual * Prisma schema content. These files are organized by business domains * following domain-driven design principles. * * The schemas are generated through deterministic code generation that * transforms validated AST structures into production-ready Prisma schema * files with comprehensive documentation, optimal indexes, and proper * constraints. */ schemas: Record<string, string>; /** * Results of compiling the generated Prisma schema files. * * Contains the compilation outcome when the generated schemas are processed * by the Prisma compiler. This should always compile successfully since the * schemas are generated from validated AST structures. If compilation fails, * it would be a bug in the system and should be reported as an issue. * * The compilation process includes validation of syntax, relationships, and * database-specific constraints to ensure the schemas will work correctly in * the target database environment. */ compiled: IAutoBePrismaCompileResult; /** * Reason why the Prisma agent was activated through function calling. * * Explains the specific circumstances that triggered the AI chatbot to invoke * the Prisma agent via function calling. This could include reasons such as * new requirements that require database schema changes, updates to existing * requirements that affect data models, or initial database design requests * from the user conversation. */ reason: string; /** * Iteration number of the requirements analysis report this database design * was performed for. * * Indicates which version of the requirements analysis this database design * reflects. If this value is lower than {@link AutoBeAnalyzeHistory.step}, it * means the database design has not yet been updated to reflect the latest * requirements and may need to be regenerated. * * A value of 0 indicates the initial database design, while higher values * represent subsequent revisions based on updated requirements. */ step: number; /** * ISO 8601 timestamp indicating when the database design process was * completed. * * Marks the exact moment when the Prisma schema generation, validation, and * compilation process finished successfully. This timestamp is crucial for * tracking the development timeline and determining the currency of the * database design relative to other development artifacts. */ completed_at: string & tags.Format<"date-time">; }

AutoBePrismaHistory is a history generated when @autobe analyzes the requirements specification and completes the database design.

@autobe constructs data of type AutoBePrisma.IApplication through AI function calling, validates it, and then generates prisma schema files. The validation results are stored in the result property as type IAutoBePrismaValidation, and the results of converting this to prisma schema files (code generation) are stored in the schemas property.

Note that @autobe generally creates valid AutoBePrisma.IApplication data through a validation feedback process. However, when using very small AI models, the IAutoBePrismaValidation result might have success := false. Additionally, the results of compiling the prisma schema files are stored in the compiled property as type IAutoBePrismaCompileResult, which should always compile successfully. If compilation fails, it would be a bug in @autobe, so please report it as an issue.

The step property indicates which requirements analysis report iteration the database design was performed for. If the AutoBePrismaHistory.step value is lower than AutoBeAnalyzeHistory.step, it means the database design has not yet been updated to reflect the latest requirements.

AutoBeInterfaceHistory

@autobe/interface
import { tags } from "typia"; import { AutoBeOpenApi } from "../openapi/AutoBeOpenApi"; import { AutoBeAgentHistoryBase } from "./AutoBeHistoryBase"; import { AutoBeInterfaceAuthorization } from "./contents"; /** * History record generated when the Interface agent completes RESTful API * design based on the previous requirements analysis report and database * design. * * The Interface agent constructs data of type {@link AutoBeOpenApi.IDocument} * through AI function calling, validates it, and stores it in the document * property. This is then converted to a formal OpenAPI document, and NestJS API * controllers, DTOs, and e2e test code are generated through the sophisticated * multi-stage transformation pipeline. * * The Interface agent operates on the same vibe coding principles as other * agents, ensuring that API designs are syntactically perfect and semantically * aligned with business requirements before any code generation occurs. * * @author Samchon */ export interface AutoBeInterfaceHistory extends AutoBeAgentHistoryBase<"interface"> { /** * The constructed OpenAPI document containing the complete API specification. * * Contains the validated {@link AutoBeOpenApi.IDocument} AST structure that * defines all API endpoints, operations, schemas, and business logic. This * document serves as the source of truth for API generation and ensures * perfect alignment between database schemas and API interfaces. * * The document includes comprehensive business logic integration, type safety * bridges with Prisma schemas, and security pattern validation to ensure * enterprise-grade API specifications. */ document: AutoBeOpenApi.IDocument; /** * JWT-based authentication and authorization operations generated for each * user role. * * Contains role-specific authentication API operations including essential * flows (join, login, validate, changePassword, refresh) plus additional * operations based on Prisma schema capabilities like email verification and * password reset. These operations are generated by analyzing the database * schema to determine which authentication features are supported for each * role. */ authorizations: AutoBeInterfaceAuthorization[]; /** * Reason why the Interface agent was activated through function calling. * * Explains the specific circumstances that triggered the AI chatbot to invoke * the Interface agent via function calling. This could include reasons such * as completing initial API design after database schema creation, updating * API specifications due to requirement changes, or regenerating interfaces * to reflect modified data models. */ reason: string; /** * Iteration number of the requirements analysis report this API design was * performed for. * * Indicates which version of the requirements analysis this API design * reflects. If this value is lower than {@link AutoBeAnalyzeHistory.step}, it * means the API design has not yet been updated to reflect the latest * requirements and may need to be regenerated. * * A value of 0 indicates the initial API design, while higher values * represent subsequent revisions based on updated requirements or database * schema changes. */ step: number; /** * ISO 8601 timestamp indicating when the API design process was completed. * * Marks the exact moment when the Interface agent finished the complete * transformation pipeline from AST construction through OpenAPI validation to * NestJS code generation. This timestamp is crucial for tracking the * development timeline and determining the currency of the API design * relative to other development artifacts. */ completed_at: string & tags.Format<"date-time">; }

AutoBeInterfaceHistory is a history generated when the RESTful API design is completed based on the previous requirements analysis report and database design.

@autobe constructs data of type AutoBeOpenApi.IDocument through AI function calling, validates it, and stores it in the document property. This is then converted to a formal OpenAPI document (OpenApi.IDocument), and NestJS API controllers, DTOs, and e2e test code are generated (code generation), with the results stored in the files property.

The step property indicates which requirements analysis report iteration the API design was performed for. If the AutoBeInterfaceHistory.step value is lower than AutoBeAnalyzeHistory.step, it means the API design has not yet been updated to reflect the latest requirements.

AutoBeTestHistory

@autobe/interface
import { tags } from "typia"; import { IAutoBeTypeScriptCompileResult } from "../compiler/IAutoBeTypeScriptCompileResult"; import { AutoBeAgentHistoryBase } from "./AutoBeHistoryBase"; import { AutoBeTestFile } from "./contents/AutoBeTestFile"; /** * History record generated when the Test agent writes e2e test code based on * the previous requirements analysis, database design, and RESTful API * specification. * * The Test agent conceives multiple use case scenarios for each API endpoint * and implements them as test programs. These test programs are composed of one * TypeScript file and a standalone function for each scenario, providing * comprehensive coverage of the API functionality and business logic * validation. * * When the AI occasionally writes incorrect TypeScript code, the system * provides compilation error messages as feedback, allowing the AI to * self-correct. This feedback process usually works correctly, so test code * written by AI almost always compiles successfully, ensuring robust and * reliable test suites. * * @author Samchon */ export interface AutoBeTestHistory extends AutoBeAgentHistoryBase<"test"> { /** * Collection of generated e2e test files with detailed scenario metadata. * * Contains an array of test file objects where each file represents a * specific testing scenario with its location, content, and associated * scenario information. Each test file includes standalone functions that * implement particular use case scenarios for API endpoints, providing * comprehensive end-to-end testing coverage with rich contextual * information. * * Unlike simple key-value pairs, this structure allows for detailed tracking * of test scenarios, their purposes, and their relationships to specific API * endpoints and business requirements. The test files are designed to * validate both technical functionality and business rule implementation, * ensuring that the generated APIs work correctly under realistic operational * conditions. */ files: AutoBeTestFile[]; /** * Results of compiling the generated test code using the embedded TypeScript * compiler. * * Contains the compilation outcome of the test files built through the * TypeScript compiler. The feedback process usually works correctly, so this * should typically indicate successful compilation. However, when using very * small AI models, the {@link IAutoBeTypeScriptCompileResult} might have * `success := false`. * * Compilation errors trigger a self-correction feedback loop where the AI * receives detailed error messages and attempts to fix the issues * automatically. */ compiled: IAutoBeTypeScriptCompileResult; /** * Reason why the Test agent was activated through function calling. * * Explains the specific circumstances that triggered the AI chatbot to invoke * the Test agent via function calling. This could include reasons such as * initial test suite generation after API specification completion, updating * test scenarios due to API changes, or regenerating tests to reflect * modified business requirements or database schemas. */ reason: string; /** * Iteration number of the requirements analysis report this test code was * written for. * * Indicates which version of the requirements analysis this test suite * reflects. If this value is lower than {@link AutoBeAnalyzeHistory.step}, it * means the test code has not yet been updated to reflect the latest * requirements and may need regeneration. * * A value of 0 indicates the initial test suite, while higher values * represent subsequent revisions based on updated requirements, API changes, * or database schema modifications. */ step: number; /** * ISO 8601 timestamp indicating when the test code generation was completed. * * Marks the exact moment when the Test agent finished writing all test * scenarios, completed the compilation validation process, and resolved any * compilation errors through the feedback loop. This timestamp is crucial for * tracking the development timeline and determining the currency of the test * suite relative to other development artifacts. */ completed_at: string & tags.Format<"date-time">; }

AutoBeTestHistory is a history generated when e2e test code is written based on the previous requirements analysis, database design, and RESTful API specification.

@autobe conceives multiple use case scenarios for each API endpoint and implements them as test programs. These test programs are composed of one TypeScript file and a standalone function for each scenario, stored in the files property. These are then built using the TypeScript compiler embedded in @autobe, with the results stored in the compiled property.

When the AI occasionally writes incorrect TypeScript code, @autobe provides compilation error messages as feedback, allowing the AI to self-correct. This feedback process usually works correctly, so test code written by AI almost always compiles successfully. However, when using very small AI models, the IAutoBeTypeScriptCompileResult result might have success := false.

The step property indicates which requirements analysis report iteration the test code was written for. If the AutoBeTestHistory.step value is lower than AutoBeAnalyzeHistory.step, it means the test code has not yet been updated to reflect the latest requirements.

AutoBeRealizeHistory

Not implemented yet.

Last updated on