AI Prompt Configuration
Relevant source files
The following files were used as context for generating this wiki page:
AI Prompt Configuration manages the lifecycle, versioning, and deployment of Large Language Model (LLM) instructions within the Inkweave ecosystem. This system allows administrators to refine prompt templates in a private environment before syncing them to the public application.
The module acts as a bridge between the administrative interface and the core inkweave application, which is integrated as a Git submodule. By isolating prompt development, the system ensures that changes undergo validation and testing before reaching production users.
Sources: README.md:1-5, docs/PLAN.md
Prompt Management Architecture
The architecture utilizes a decoupled approach where prompt definitions reside in the admin repository but affect the pinned submodule. Administrators interact with a React-based interface to modify prompt strings, adjust hyperparameters, and manage variable placeholders.
Submodule Synchronization Flow
When you modify a prompt configuration, the system updates the local state and eventually commits changes that reference the upstream/inkweave submodule. This ensures that the public app version aligns with the intended prompt logic.
Sources: README.md:3-5, docs/PLAN.md
The diagram shows the progression from an administrator's input to the synchronization with the public inkweave repository.
Prompt Structure and Variables
Prompts consist of static templates and dynamic injection points. The system uses a specific syntax to identify variables that the public application populates at runtime.
Configuration Schema
Each prompt configuration contains metadata required for LLM execution. The table below describes the primary fields used in the configuration objects.
| Field Name | Type | Description |
|---|---|---|
promptId | String | Unique identifier for the prompt (e.g., "story-gen"). |
template | String | The raw text containing variable placeholders like {{input}}. |
version | Number | Incremental version number for tracking changes. |
model | String | The target LLM provider and model (e.g., "gpt-4"). |
params | Object | Temperature, top_p, and max tokens settings. |
Sources: src/lib/ai/prompts.ts, docs/PLAN.md
Variable Injection Logic
The application parses the template string to identify keys wrapped in double curly braces. Before sending the request to the AI provider, the system replaces these keys with user-provided data or context-specific values.
Sources: src/lib/ai/prompts.ts
The sequence diagram illustrates how variables are resolved by the Prompt Engine before the final payload reaches the LLM provider.
Deployment and Security
Prompt configurations are deployed via Vercel and protected by Vercel Authentication. This ensures that only authorized personnel can access the administration tools and modify AI behavior.
Security Constraints
- Access requires a Vercel login.
- Modifications to prompts trigger a new deployment or submodule update.
- Sensitive API keys for LLM providers are stored as environment variables in Vercel.
Sources: README.md:5-9, CLAUDE.md
Development Guidelines
When adding new prompt configurations or modifying existing ones, follow the established development rules. These rules ensure consistency across the admin tools and the pinned submodule.
- Define all prompt identifiers in a centralized constants file.
- Include default values for all variables to prevent injection failures.
- Test prompt changes in the
inkweave-adminpreview environment before merging.
Sources: CLAUDE.md, docs/PLAN.md
// Example Prompt Configuration Definition
// Sources: [src/lib/ai/prompts.ts]
export interface PromptConfig {
id: string;
template: string;
temperature: number;
maxTokens: number;
}
const STORY_PROMPT: PromptConfig = {
id: "story-base-v1",
template: "Write a story about {{character}} in a {{setting}}.",
temperature: 0.7,
maxTokens: 1000,
};
Summary
AI Prompt Configuration provides a controlled environment for managing the complex instructions that drive the Inkweave platform. By leveraging a submodule-based architecture and Vercel's secure deployment pipeline, the system maintains a high degree of reliability and security for AI-driven features. Administrators use the tool to iterate on templates and variables, ensuring the public application always utilizes optimized and validated LLM prompts.