ignitionstack.pro v1.0 is out! Read the announcement →
Skip to Content

AI Agents

ignitionstack.pro ships with a catalog of opinionated AI agents that live entirely in the repository. Each agent is described in markdown under AI/agents and is loaded at runtime through the typed loader in src/app/lib/ai/agents/agent-loader.ts. This guide explains how to create or customize agents, how the UI consumes them, and how to validate everything with automated tests.

Folder Structure

AI/ ├── agents/ │ ├── README.md # Quick reference │ ├── codebase-expert.md # Example agent │ └── ... └── memory|instructions|... # Additional AI context artifacts

Agent File Template

Every agent file follows the same structure:

--- id: codebase-expert # Unique slug name: Codebase Expert # UI label description: Deep knowledge...# Appears in dropdowns icon: bot # Lucide icon name category: development # See table below tags: [code, docs] --- # Codebase Expert ## Overview Explain what problems this agent solves. ## System Prompt

[Write the full system prompt here. Use fenced code blocks so the loader can extract it.]

## Usage - Optional tips, commands, references

Metadata reference

FieldRequiredDescription
idUnique identifier referenced by the chat UI (agentId).
nameHuman friendly title shown in dropdowns.
descriptionShort summary displayed beside the agent picker.
iconLucide icon (defaults to bot).
categoryOne of development, analysis, creative, education, business (fallback: development).
tagsArray of free-form tags used for filtering/search.

Tip: Keep prompts under version control by treating .md files like code. Changes go through code review, simplifying audits.

How agents flow through the app

  1. Server querygetAvailableAgents (src/app/server/ai/get-agents.ts) exposes metadata to the UI without loading system prompts.
  2. Chat UI/[locale]/(pages)/chat and /chat/[id] call getAvailableAgents to populate the sidebar dropdown.
  3. Server actionsrc/app/actions/ai/create-conversation.ts accepts an optional agentId. When provided, it:
    • Fetches the full agent via getAgentById.
    • Overrides the conversation systemPrompt with the agent prompt.
    • Prefixes the conversation title with the agent name.
  4. PersistenceConversationRepository.create stores the prompt + metadata in Supabase so subsequent LLM calls stay agent-aware.

Adding or editing an agent

  1. Duplicate an existing .md file under AI/agents.
  2. Update the frontmatter and prompt.
  3. Include ## System Prompt with a fenced code block — the loader ignores any other format.
  4. Commit the file; no build step is required.
  5. Run the tests below to ensure the loader and action logic still behave correctly.

Testing the agent experience

What to testCommand
Loader + parser (frontmatter, prompt extraction)npm run test -- src/app/test/unit/ai/agent-loader.test.ts
createConversation agent workflow (new in this update)npm run test -- src/app/test/unit/ai/create-conversation-action.test.ts

The loader tests catch malformed markdown or metadata. The action tests guarantee that selecting an agent in the UI actually injects the agent prompt, updates the title, and logs missing agents correctly.

Troubleshooting

With these guardrails, adding an opinionated Claude/GPT agent is as simple as editing a markdown file, running npm run test, and deploying.