The BackDoor Assistant is not just a chatbot wrapper; it is a Multi-Stage AI Pipeline. It breaks down the interaction into distinct logical steps to ensure the model has maximum context and minimum "hallucination."
Every message sent to the harness goes through the following stages (found in ai-harness/pipeline/):
The requirementAnalyzer.js parses the user's input against available tools and existing memory to determine what the model needs to "know" or "do" before it can answer.
Instead of dumping the entire history, memoryRetriever.js performs a semantic search (using memory.json) to pull only the relevant facts related to the current query. This keeps the prompt clean and focused.
The functionPlanner.js decides if any external functions (APIs, calculations, etc.) need to be called to fulfill the user's request.
functionExecutor.js runs the planned functions and captures their output to be injected into the model's context.
To handle long conversations, conversationSummarizer.js maintains a high-level summary of the chat, allowing the model to remember the "vibe" and "goal" of the session without needing every single token from line 1.
The contextBuilder.js assembles all the gathered pieces (Memory, Function Results, Summaries, Recent Messages) into a structured prompt.
The responseGenerator.js sends the final context to the LLM (via OpenRouter) and streams the response back to the user.
After the response is generated, memoryExtractor.js looks at the new information exchanged and updates memory.json. This ensures the "BackDoor" to the user's world is always up to date.
We believe that the Harness is more important than the Model. A weak model with a great harness (good memory, perfect context, tool use) will always outperform a powerful model with a weak harness.
By building this harness as an open-source project, we are enabling developers to:
- Use cheaper/smaller models effectively.
- Bypass proprietary context limits.
- Build agents that actually learn from their users over time.