Seraph is an advanced AI assistant system designed to provide intelligent, context-aware interactions through a CLI interface. It features a sophisticated cognitive architecture with memory persistence, function execution capabilities, and middleware support.
- Persistent Memory: Long-term storage and retrieval of information using semantic search
- Cognitive Functions: Extensible system of tools and functions that Seraph can use to help users
- Middleware System: Pluggable middleware architecture for customizing behavior and adding capabilities
- CLI Interface: Clean, user-friendly command-line interface with formatted output
- Conversation History: Maintains context across sessions with conversation persistence
- Clone the repository:
git clone https://github.com/oneirocom/seraph.git
cd seraph- Install dependencies:
npm install- Set up environment variables:
cp .env.example .envAdd your API keys to the .env file:
OPENAI_API_KEY=your_openai_key_here
ANTHROPIC_API_KEY=your_anthropic_key_here
- Build the project:
npm run buildStart Seraph:
npm start!help- Display available commands!vim- Open text editor for multi-line input!prompt- Display current system prompt!messages- Show conversation history!clearLastMessage- Remove last message!memory-diagnostics- Run diagnostics on memory system
Type exit to end the conversation.
Seraph is built with a modular architecture consisting of several key components:
- SeraphCore: Main system orchestrator
- ConversationManager: Handles conversation state and persistence
- CognitiveFunctionExecutor: Manages execution of cognitive functions
- MiddlewareManager: Handles middleware registration and execution
- ResponseParser: Processes and parses AI responses
- MemoryStore: Manages semantic memory storage and retrieval
Seraph uses a sophisticated memory system with different types:
code: Stores generated code and related informationcontext: Stores contextual informationreflection: Stores self-reflection and performance metricsfacts: Stores facts and general knowledgesystem: Stores system-related information
Seraph comes with built-in cognitive functions:
- Memory Storage and Retrieval
- Bash Command Execution
- Custom function support
src/
├── lib/
│ ├── cognitive_functions/ # Cognitive function implementations
│ ├── middleware/ # Middleware implementations
│ ├── seraphCore.ts # Core system implementation
│ ├── conversation_manager.ts # Conversation handling
│ ├── response_parser.ts # Response parsing logic
│ └── seraphCLI.ts # CLI interface
- Create a new class extending
BaseCognitiveFunction - Implement the required methods
- Register the function in
src/lib/cli.ts
Example:
class NewFunction extends BaseCognitiveFunction {
constructor(seraph: SeraphCore) {
super({
name: "newFunction",
description: "Description of the function",
parameters: {
param1: {
type: "string",
description: "Parameter description",
},
},
});
}
async execute(args: Record<string, any>): Promise<string> {
// Implementation
}
}- Create a new class implementing
IMiddleware - Implement the required methods
- Register the middleware in
src/lib/cli.ts
Example:
class NewMiddleware implements IMiddleware {
name = "newMiddleware";
schema = z.object({
// Schema definition
});
async run(response: string): Promise<string> {
// Implementation
}
}- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
MIT License - See LICENSE file for details