Problem Statement
Is your feature request related to a problem? Please describe.
The documentation at docs/features/conversation-history.md describes CLI commands for managing conversation memory (list, export, delete sessions), but these commands do not actually exist in the CLI implementation. Users reading the documentation expect to use commands like neurolink memory list or neurolink memory export --session-id <ID>, but receive "command not found" errors.
This creates a documentation-implementation gap and prevents users from managing their conversation sessions via the CLI.
Proposed Solution
Describe the solution you'd like
Implement a memory subcommand in the NeuroLink CLI with the following commands:
Commands to Implement
| Command |
Description |
neurolink memory list |
List all conversation sessions with metadata |
neurolink memory export --session-id <ID> |
Export a specific session to JSON/CSV |
neurolink memory export-all |
Export all sessions to a directory |
neurolink memory delete --session-id <ID> |
Delete a specific session |
neurolink memory clear |
Clear all sessions (with confirmation) |
API Design
# List all sessions for current user
neurolink memory list
# Output format:
# session-123 | "Machine Learning Discussion" | 15 messages | last active: 2024-01-01
# session-456 | "API Design Review" | 8 messages | last active: 2024-01-02
# List with JSON output
neurolink memory list --format json
# Export single session to JSON
neurolink memory export --session-id session-123 --format json > history.json
# Export with full metadata
neurolink memory export --session-id session-123 --include-metadata
# Export to CSV format
neurolink memory export --session-id session-123 --format csv > history.csv
# Export all sessions to directory
neurolink memory export-all --output ./exports/
# Delete specific session
neurolink memory delete --session-id session-123
# Delete with force (skip confirmation)
neurolink memory delete --session-id session-123 --force
# Clear all sessions
neurolink memory clear --confirm
# Get memory stats
neurolink memory stats
Expected Inputs and Outputs
Input Options:
--session-id <string>: Session identifier (required for export/delete)
--format <json|csv>: Output format (default: json)
--include-metadata: Include session metadata in export
--output <path>: Output directory for export-all
--confirm: Skip confirmation prompt for destructive operations
--force: Force operation without prompts
--user-id <string>: User ID for multi-user scenarios (optional)
Output:
- Formatted table output for list command
- JSON/CSV file output for export commands
- Confirmation messages for delete/clear operations
Example Usage
Describe how you would use this feature
// This is CLI usage, not SDK - showing the file structure needed
// src/cli/commands/memory.ts - New file to create
import { CommandModule } from "yargs";
import { createMemoryCommands } from "../factories/memoryCommandFactory.js";
export const memoryCommand: CommandModule = {
command: "memory <subcommand>",
describe: "Manage conversation memory and session history",
builder: (yargs) => createMemoryCommands(yargs),
handler: () => {},
};
# CLI usage examples
# Developer workflow: Debug a problematic conversation
neurolink memory list --format json | jq '.[] | select(.title | contains("error"))'
neurolink memory export --session-id session-problematic --include-metadata > debug.json
# Operations workflow: Clean up old sessions
neurolink memory list
neurolink memory delete --session-id old-session-1 --force
neurolink memory delete --session-id old-session-2 --force
# Analytics workflow: Export all for analysis
neurolink memory export-all --output ./weekly-export/ --format csv
Alternatives Considered
Describe alternatives you've considered
-
Direct Redis CLI access: Users could use redis-cli to query session data directly
- Why insufficient: Requires Redis knowledge, doesn't handle serialization/deserialization, no user-friendly formatting
-
SDK-only API: Keep memory management as SDK-only feature
- Why insufficient: CLI users expect parity with documented features, CLI is often used for debugging/operations
-
Loop mode commands: Add memory commands as loop-mode internal commands (/memory list)
- Why insufficient: Users expect these to work as standalone CLI commands matching documentation
Use Case
What is your use case?
- Industry: Enterprise AI development (all industries using NeuroLink)
- Application type: Developer tooling, DevOps, debugging, compliance auditing
- Scale: Production - teams managing multiple conversation sessions
Specific scenarios:
- Debugging: Developer needs to export a conversation to understand why AI gave unexpected response
- Compliance: Team needs to export all conversations for audit trail
- Operations: Ops engineer needs to clean up stale sessions to manage Redis storage
- Analytics: Data team needs to export conversations for quality analysis
Impact
Who would benefit from this feature?
Additional Context
Current State
The SDK already has the underlying implementation in RedisConversationMemoryManager:
// Existing methods in src/lib/core/redisConversationMemoryManager.ts
getUserSessions(userId: string): Promise<string[]>
getUserSessionMetadata(userId: string, sessionId: string): Promise<SessionMetadata | null>
getUserSessionHistory(userId: string, sessionId: string): Promise<ChatMessage[] | null>
getUserSessionObject(userId: string, sessionId: string): Promise<RedisConversationObject | null>
getUserAllSessionsHistory(userId: string): Promise<SessionMetadata[]>
clearSession(sessionId: string, userId?: string): Promise<boolean>
clearAllSessions(): Promise<void>
getStats(): Promise<ConversationMemoryStats>
Documentation Reference
The following documentation already describes these CLI commands:
docs/features/conversation-history.md - Lines 76-80, 266-269
Related Files
| File |
Purpose |
src/lib/core/redisConversationMemoryManager.ts |
Existing Redis memory manager with required methods |
src/cli/commands/ |
Directory for CLI command implementations |
src/cli/factories/commandFactory.ts |
Pattern to follow for command creation |
docs/features/conversation-history.md |
Documentation to align with |
Implementation Considerations
Technical details
- Affected components: CLI only (SDK methods already exist)
- Breaking changes: No - this adds new functionality
- Provider compatibility: N/A - this is storage layer (Redis)
- Performance implications:
list command should use metadata-only fetch (already optimized)
export-all should handle pagination for large session counts
clear should use batch deletion (already implemented)
Suggested Implementation Steps
- Create
src/cli/commands/memory.ts with subcommand definitions
- Create
src/cli/factories/memoryCommandFactory.ts following existing patterns
- Register memory command in
src/cli/index.ts
- Add proper error handling for Redis connection issues
- Implement table formatting for list output
- Add confirmation prompts for destructive operations
- Add tests in
test/cli/memory.test.ts
- Update CLI documentation in
docs/cli/commands.md
Example Output Formats
List command (table format):
Session ID | Title | Messages | Last Active
--------------|------------------------------|----------|---------------------
session-123 | Machine Learning Discussion | 15 | 2024-01-01 10:30:00
session-456 | API Design Review | 8 | 2024-01-02 14:15:00
Export command (JSON format):
{
"sessionId": "session-123",
"title": "Machine Learning Discussion",
"userId": "user-001",
"createdAt": "2024-01-01T10:00:00Z",
"updatedAt": "2024-01-01T10:30:00Z",
"messages": [
{
"id": "msg-001",
"role": "user",
"content": "What is machine learning?",
"timestamp": "2024-01-01T10:00:00Z"
},
{
"id": "msg-002",
"role": "assistant",
"content": "Machine learning is...",
"timestamp": "2024-01-01T10:00:05Z"
}
]
}
Checklist
Problem Statement
Is your feature request related to a problem? Please describe.
The documentation at
docs/features/conversation-history.mddescribes CLI commands for managing conversation memory (list, export, delete sessions), but these commands do not actually exist in the CLI implementation. Users reading the documentation expect to use commands likeneurolink memory listorneurolink memory export --session-id <ID>, but receive "command not found" errors.This creates a documentation-implementation gap and prevents users from managing their conversation sessions via the CLI.
Proposed Solution
Describe the solution you'd like
Implement a
memorysubcommand in the NeuroLink CLI with the following commands:Commands to Implement
neurolink memory listneurolink memory export --session-id <ID>neurolink memory export-allneurolink memory delete --session-id <ID>neurolink memory clearAPI Design
Expected Inputs and Outputs
Input Options:
--session-id <string>: Session identifier (required for export/delete)--format <json|csv>: Output format (default: json)--include-metadata: Include session metadata in export--output <path>: Output directory for export-all--confirm: Skip confirmation prompt for destructive operations--force: Force operation without prompts--user-id <string>: User ID for multi-user scenarios (optional)Output:
Example Usage
Describe how you would use this feature
Alternatives Considered
Describe alternatives you've considered
Direct Redis CLI access: Users could use
redis-clito query session data directlySDK-only API: Keep memory management as SDK-only feature
Loop mode commands: Add memory commands as loop-mode internal commands (
/memory list)Use Case
What is your use case?
Specific scenarios:
Impact
Who would benefit from this feature?
Additional Context
Current State
The SDK already has the underlying implementation in
RedisConversationMemoryManager:Documentation Reference
The following documentation already describes these CLI commands:
docs/features/conversation-history.md- Lines 76-80, 266-269Related Files
src/lib/core/redisConversationMemoryManager.tssrc/cli/commands/src/cli/factories/commandFactory.tsdocs/features/conversation-history.mdImplementation Considerations
Technical details
listcommand should use metadata-only fetch (already optimized)export-allshould handle pagination for large session countsclearshould use batch deletion (already implemented)Suggested Implementation Steps
src/cli/commands/memory.tswith subcommand definitionssrc/cli/factories/memoryCommandFactory.tsfollowing existing patternssrc/cli/index.tstest/cli/memory.test.tsdocs/cli/commands.mdExample Output Formats
List command (table format):
Export command (JSON format):
{ "sessionId": "session-123", "title": "Machine Learning Discussion", "userId": "user-001", "createdAt": "2024-01-01T10:00:00Z", "updatedAt": "2024-01-01T10:30:00Z", "messages": [ { "id": "msg-001", "role": "user", "content": "What is machine learning?", "timestamp": "2024-01-01T10:00:00Z" }, { "id": "msg-002", "role": "assistant", "content": "Machine learning is...", "timestamp": "2024-01-01T10:00:05Z" } ] }Checklist