Test cipher's functionalities
Cipher Agent Comprehensive Test Plan
Codebase Architecture Overview
Key Components:
- Memory System: Dual backend (Vector DB + Knowledge Graph)
- LLM Providers: OpenAI, Anthropic, OpenRouter, Ollama
- Vector Storage: In-memory, Qdrant, Milvus
- Knowledge Graph: In-memory, Neo4j
- Memory Operations: ADD, UPDATE, DELETE, NONE (via src/core/brain/tools/definitions/memory/extract_and_operate_memory.ts:416)
- Installation & Environment Testing
1.1 LLM Provider Configurations
OpenAI Provider
Environment: .env
OPENAI_API_KEY=sk-... EMBEDDING_MODEL=text-embedding-3-small
Config: memAgent/cipher.yml
llm: provider: openai model: gpt-4.1-mini apiKey: $OPENAI_API_KEY
Anthropic Provider
ANTHROPIC_API_KEY=sk-ant-...
OpenRouter Provider
OPENROUTER_API_KEY=sk-or-...
Ollama Provider
OLLAMA_BASE_URL=http://localhost:11434/v1
Prerequisites: ollama pull qwen3:8b
1.2 Vector Database Backends
In-Memory Vector Store
VECTOR_STORE_TYPE=in-memory VECTOR_STORE_MAX_VECTORS=10000
Qdrant (Local)
Start: docker run -p 6333:6333 qdrant/qdrant
VECTOR_STORE_TYPE=qdrant VECTOR_STORE_HOST=localhost VECTOR_STORE_PORT=6333
Qdrant (Cloud)
VECTOR_STORE_TYPE=qdrant VECTOR_STORE_URL=https://your-cluster.qdrant.tech VECTOR_STORE_API_KEY=your-api-key
1.3 Knowledge Graph Backends
In-Memory Graph
KNOWLEDGE_GRAPH_ENABLED=true KNOWLEDGE_GRAPH_TYPE=in-memory
Neo4j
Start: docker run -p7474:7474 -p7687:7687 neo4j
KNOWLEDGE_GRAPH_ENABLED=true KNOWLEDGE_GRAPH_TYPE=neo4j KNOWLEDGE_GRAPH_HOST=localhost KNOWLEDGE_GRAPH_PORT=7687 KNOWLEDGE_GRAPH_USERNAME=neo4j KNOWLEDGE_GRAPH_PASSWORD=password
1.4 Memory Operation Tests (All Backends)
ADD Operation: cipher "Remember: Python uses list comprehensions for efficient iteration"
Expected: New memory entry created
UPDATE Operation: cipher "Python list comprehensions are used for iteration" cipher "Python list comprehensions are used for efficient iteration and filtering"
Expected: Second message updates first (more complete)
DELETE Operation: cipher "JavaScript is synchronous" cipher "JavaScript is asynchronous by nature"
Expected: First memory deleted (contradiction)
- Custom Agent Configuration Testing
2.1 Create Custom Configuration
File: custom-agent.yml llm: provider: anthropic model: claude-3-5-haiku-20241022 apiKey: $ANTHROPIC_API_KEY maxIterations: 25
systemPrompt: | You are a specialized coding assistant with enhanced memory. Focus on Python and JavaScript programming help.
mcpServers: filesystem: type: stdio command: npx args: ["-y", "@modelcontextprotocol/server-filesystem", "."] connectionMode: strict
sessions: maxSessions: 50 sessionTTL: 1800
agentCard: name: CustomCoder version: 2.0.0 description: "Specialized Python/JS coding assistant"
2.2 Test Custom Agent
cipher --agent ./custom-agent.yml
Test Cases:
✅ Custom system prompt active ✅ Modified session limits ✅ Anthropic LLM provider ✅ Strict MCP connection mode ✅ Memory operations with custom config ✅ Agent card info in MCP mode
- CLI Testing (Per README)
3.1 Installation & Build
pnpm i && pnpm run build && npm link
3.2 CLI Modes
Interactive Mode
cipher cipher --mode cli
One-shot Mode
cipher "What is binary search tree implementation?" cipher --strict "Store this algorithm: BST insertion requires..." cipher --new-session test "Remember this debugging tip"
Custom Metadata
cipher> !meta project=test,type=algorithm Binary search tree has O(log n) complexity
3.3 Session Management
/session new coding-session /session list /session switch coding-session /session current /session delete old-session
3.4 System Commands
/config # Display agent configuration /stats # Show system statistics /prompt # Display system prompt /tools # List available MCP tools /help # Show help /clear # Reset conversation
- API Server Mode Testing
4.1 Start API Server
cipher --mode api --port 3000 cipher --mode api --host 0.0.0.0 --port 8080
4.2 API Endpoint Tests
Health Check
curl http://localhost:3000/health
Send Message
curl -X POST http://localhost:3000/api/message/sync
-H "Content-Type: application/json"
-d '{
"message": "Remember: React hooks were introduced in version 16.8",
"sessionId": "test-session"
}'
Session Management
Create session
curl -X POST http://localhost:3000/api/sessions
-H "Content-Type: application/json"
-d '{"sessionId": "api-test"}'
List sessions
curl http://localhost:3000/api/sessions
Get session history
curl http://localhost:3000/api/sessions/api-test/history
4.3 API Memory Operations
ADD via API:
curl -X POST http://localhost:3000/api/message/sync
-d '{"message": "Vue.js uses reactive data binding", "sessionId": "memory-test"}'
UPDATE via API:
curl -X POST http://localhost:3000/api/message/sync
-d '{"message": "Vue.js uses reactive data binding with virtual DOM", "sessionId":
"memory-test"}'
- MCP Server Mode & Cursor Integration
5.1 Start MCP Server
cipher --mode mcp
5.2 Cursor Configuration
Add to Cursor settings (settings.json): { "mcp.servers": { "cipher-agent": { "command": "cipher", "args": ["--mode", "mcp"], "env": { "ANTHROPIC_API_KEY": "your-key", "VECTOR_STORE_TYPE": "in-memory", "KNOWLEDGE_GRAPH_ENABLED": "true" } } } }
5.3 Cursor Integration Tests
- Open Cursor
- Access MCP servers panel
- Connect to cipher-agent
- Test ask_cipher tool
Memory Operations via Cursor:
ADD Test: ask_cipher("Remember this algorithm: Quicksort has average O(n log n) complexity")
UPDATE Test: ask_cipher("Quicksort is efficient") ask_cipher("Quicksort is efficient with average O(n log n) time complexity")
SEARCH Test: ask_cipher("What sorting algorithms do you know?")
5.4 MCP Resources & Prompts Test
- ✅ Access cipher://agent/card
- ✅ Access cipher://agent/stats
- ✅ Use system_prompt prompt
- Memory Operation Validation
6.1 Vector DB Memory Tests
For each backend (in-memory, Qdrant, Milvus):
cipher "JavaScript arrays have push() method" cipher "Arrays in JavaScript support push() and pop() methods" # UPDATE cipher "What do you know about JavaScript arrays?" # SEARCH cipher "JavaScript arrays don't have methods" # DELETE (contradiction)
6.2 Knowledge Graph Memory Tests
For each backend (in-memory, Neo4j):
cipher "John works at Google as a Software Engineer" cipher "John is a Senior Software Engineer at Google" # UPDATE relationship cipher "Tell me about John" # SEARCH graph cipher "John doesn't work at Google" # DELETE contradictory info
6.3 Dual Backend Validation
Both vector + knowledge graph
VECTOR_STORE_TYPE=qdrant KNOWLEDGE_GRAPH_ENABLED=true KNOWLEDGE_GRAPH_TYPE=neo4j
cipher "Python Flask is a web framework created by Armin Ronacher"
Should store both vector embedding AND graph entities/relationships
- Test Automation & Validation
7.1 Setup Script
#!/bin/bash cp env.example .env docker-compose up -d # Start Qdrant, Neo4j pnpm i && pnpm run build
7.2 Memory Test Script
#!/bin/bash echo "Testing ADD operation..." cipher "Test fact: Redis is an in-memory database"
echo "Testing UPDATE operation..." cipher "Redis is fast" cipher "Redis is a fast in-memory key-value database"
echo "Testing SEARCH operation..." cipher "What do you know about Redis?"
echo "Testing DELETE operation..." cipher "Redis is slow"
7.3 Success Criteria
- ✅ All LLM providers initialize correctly
- ✅ Vector and graph backends connect successfully
- ✅ Memory operations (ADD/UPDATE/DELETE/NONE) work correctly
- ✅ CLI commands execute without errors
- ✅ API endpoints return expected responses
- ✅ MCP server integrates with Cursor
- ✅ Knowledge persists across sessions
- ✅ Contradictory information triggers deletions
- ✅ Similar information triggers updates
1. Installation & Environment Testing: 1.1 LLM OpenAI: [ERROR: Error in OpenAI API call (Attempt 1/3): 400 Invalid schema for function 'cipher_extract_and_operate_memory': In context=('properties', 'interaction', 'type', '1'), array schema missing items.] OpenRouter: [ERROR: Error in OpenRouter API call (Attempt 1/3): 400 Provider returned error] 2. Custom Agent Configuration Testing Custom system prompt active: Fail: The agent does not strictly adhere to the system prompt and still mentions multiple languages and technologies beyond the specified scope (Python and JavaScript). 3 PASS 4 API Server Mode Testing Get session history: curl http://localhost:3000/api/sessions/api-test/history {"success":false,"error":{"code":"SESSION_NOT_FOUND","message":"Session api-test not found"},"meta":{"timestamp":"2025-07-11T09:18:52.584Z","requestId":"538c01a5-845d-4522-990c-eef4c4301dc8"}}%
1. Installation & Environment Testing:
1.3 neo4j Neo.ClientError.Security.AuthenticationRateLimit The client has provided incorrect authentication details too many times in a row.
2. Custom Agent Configuration Testing
Should provide some guidance to agent so that agent can complete as expected ==> Modify prompt to handle vague input
3. PASS
4. PASS
5. MCP Server Mode & Cursor Integration
Currently cannot setup mcp panel although following above steps ==> Need to do more investigation
6. Memory Operation Validation
6.2 Cannot connect to neo4j to test
7. PASS
5. MCP Server Mode & Cursor Integration Cannot Access MCP servers panel 6. Memory Operation Validation Q: What do you know about JavaScript arrays? Expected: Search Actual: Update (misclassified as fact instead of query) 7. Pass
@Oxazolidinone I supposed there is no SEARCH operation so that it presents UPDATE at the time
Configuration for mcp mode: { "mcpServers": { "cipher-agent": { "command": "cipher", "args": ["--mode", "mcp"], "env": { "ANTHROPIC_API_KEY": "your-key", "VECTOR_STORE_TYPE": "in-memory", "KNOWLEDGE_GRAPH_ENABLED": "true" } } } }