AgentForge

Infrastructure to stand up one AI agent per client without building it from scratch each time.

AI and automation · TypeScript · MVP codebase published

The problem

Plenty of companies want an "AI employee" and cannot build or run one. Those who can — a consultancy — have no product to deliver it repeatably: every engagement starts from scratch and setup eats the margin.

What it does

  • The agent is configured once — instructions, tools, memory and branding — and handed to the client as its own chat address.
  • The conversation travels from the interface to Firestore, then to a self-hosted n8n flow, and from there to the model.
  • Persistent memory: long-term facts about the client are loaded on every turn and consolidated nightly down to at most twenty.
  • No per-instance cost: the infrastructure is shared across every agent.

What was decided while building it

Memory hangs off the agent, not the conversation
Each agent has its own collection of facts, re-injected into the prompt on every turn. Storing it on the conversation would make it vanish when a new chat opens, which is exactly what turns an assistant into something you have to bring up to speed every morning.
The engine writes with a service account, hence the strict rules
The free tier has no cloud functions, so orchestration lives in a self-hosted n8n that talks to the database through its admin interface. That path bypasses the security rules, which is precisely why the client-side rules are restrictive: what the browser may write is limited to what an end user should be able to write.
The nightly consolidation aborts rather than damage memory
Every night the accumulated facts are merged down to at most twenty. Since the step deletes the old ones and writes the new ones, it goes as a single atomic operation, and if the model does not return something valid the flow stops before touching anything. A half-erased memory is worse than an unconsolidated one.
The history is ordered and cleaned before it is sent
The query returns messages newest first, so they are reversed before the prompt is assembled, and failed turns are dropped. A model handed the conversation backwards answers with reasonable coherence and answers something else entirely.

How far it goes

  • It is a minimum product, not deployed: the flows are inactive, the credentials unfilled and no cloud project has been created. What can be read is the full architecture, not a running service.
  • Memory facts are entered by hand from the panel today. Automatic extraction at the end of a session is in the design, not in the code.
  • The client identifier is an informational field: it takes no part in any query or security rule. Real isolation is per agent, and in this version the messages collection is readable without authentication.
  • The tools configured in the panel are stored but the flow does not use them yet: the model call carries instructions, memory and history, and nothing else.

Built with

  • React
  • Firebase
  • n8n
  • Claude

Backs this service

Automating your processes with artificial intelligence

Read the code · Open the demo