---
title: Maylin Taryne
---

Maylin Taryne (hereinafter the "Application") is an AI-powered Discord bot that offers companionship and comfort during your darkest moments. Built with TypeScript and powered by Anthropic's Claude AI, Maylin provides a safe space for users to share their feelings and experiences through direct message conversations.

## 1. User Documentation

This section is for those interacting with a live instance of the Application.

### Quick Start

1. [Add Maylin to your Discord account](https://discord.com/oauth2/authorize?client_id=1343370633916059668)
2. Use the `/dm` command to start a private conversation
3. Send messages directly to Maylin in DMs for AI-powered companionship

### Available Commands

- `/about` - Learn more about Maylin and view bot information
- `/dm` - Opens a direct message conversation with Maylin
- `/clear` - Clears your conversation history to start fresh

### Subscription Features

Maylin operates on a subscription model. Some features require an active subscription:
- AI-powered conversations in direct messages
- Conversation history management
- Premium support access

### Important Notes

- Maylin is **NOT** a therapist and does **NOT** provide legal, medical, or financial advice
- She serves as a supportive, encouraging friend during tough times
- All conversations happen in private direct messages
- Conversation history can be cleared using the `/clear` command

## 2. Technical Documentation

This section is for those interested in running their own instance of the Application.

### Architecture Overview

Maylin Taryne is built as a user-installable Discord bot with the following key components:

#### Core Technologies
- **Runtime**: Node.js with TypeScript
- **Discord API**: discord.js v14
- **AI Integration**: Anthropic Claude (claude-sonnet-4-20250514)
- **Web Server**: Fastify for health monitoring
- **Logging**: @nhcarrigan/logger for centralised logging
- **Build System**: TypeScript compiler with ES modules

#### Bot Architecture
- **Event-Driven**: Responds to Discord events (messages, interactions, entitlements)
- **Command System**: Slash commands for user interactions
- **Subscription Model**: Discord entitlement system for premium features
- **Direct Message Focus**: Primarily operates in DM channels

#### Key Modules

##### Commands (`src/commands/`)
- Command definitions for Discord slash commands
- Exported as JSON for Discord API registration

##### Modules (`src/modules/`)
- **About Module**: Displays bot information and version details
- **Clear Module**: Manages conversation history clearing

##### Events (`src/events/`)
- **Message Handler**: Processes incoming DM messages and generates AI responses
- Manages conversation context and history
- Implements subscription validation

##### Utilities (`src/utils/`)
- **AI Integration**: Anthropic Claude API wrapper
- **Subscription Validation**: Discord entitlement checking
- **Cost Calculation**: Usage tracking and cost monitoring
- **Error Handling**: Standardized error responses
- **Logging**: Centralised logging infrastructure

##### Server (`src/server/`)
- Health monitoring web server on port 5011
- Serves basic landing page with bot information

#### Configuration
- **Personality**: Defined in `src/config/personality.ts`
- **Environment Variables**: 
  - `DISCORD_TOKEN`: Bot authentication
  - `AI_TOKEN`: Anthropic API key
  - `LOG_TOKEN`: Logging service token

#### Deployment
- Built to `prod/` directory using TypeScript compiler
- Runs with 1Password CLI for environment variable management
- Uses `op run` for secure environment injection

### Development Setup

```bash
# Install dependencies
pnpm install

# Build the project
pnpm run build

# Run linting
pnpm run lint

# Start the bot (requires environment setup)
pnpm start
```

### Environment Requirements
- Node.js (ES modules support)
- Discord Bot Token
- Anthropic API Key
- 1Password CLI (for production deployment)

## 3. Legal Documentation

This section is for expansions to our legal policies specific to the Application.

### Licensing
- Licensed under Naomi's Public Licence
- Copyright held by Naomi Carrigan
- See [global software licence](https://docs.nhcarrigan.com/#/license) for details

### Privacy Considerations
- All conversations occur in Discord direct messages
- Message history is temporarily stored for context (up to 20 messages)
- Conversation history can be cleared by users via `/clear` command
- Usage metrics and costs are logged for operational purposes

### Service Limitations
- Maylin is not a licensed therapist or counsellor
- No legal, medical, or financial advice is provided
- Service availability depends on Discord and Anthropic API uptime
- Subscription required for full feature access
- NHCarrigan are not liable for any decisions you make based on Maylin's responses.

## 4. Contributing Documentation

This section is for documentation related to contributing to the Application's codebase.

### Development Standards
- TypeScript with strict type checking
- ESLint configuration (@nhcarrigan/eslint-config)
- ES modules throughout
- Comprehensive error handling and logging

### Code Structure
- Modular architecture with clear separation of concerns
- Event-driven design following Discord.js patterns
- Utility-first approach for shared functionality
- Configuration-driven personality and behaviour

### Testing
- Vitest for testing framework (configuration present)
- Coverage reporting with Istanbul
- Currently no test files ("No tests yet!" placeholder)

### Build Process
- TypeScript compilation to `prod/` directory
- Clean build process (removes existing `prod/` before compilation)
- Source maps and proper module resolution

### Contributing Guidelines
- Review [CONTRIBUTING.md](CONTRIBUTING.md) before submitting changes
- Follow the established [Code of Conduct](CODE_OF_CONDUCT.md)
- Create Pull Requests for proposed changes
- All contributions subject to review process

### Support and Contact
- [Chat Server](https://chat.nhcarrigan.com) for community support
- Email: contact@nhcarrigan.com
- [Source Code Repository](https://git.nhcarrigan.com/NHCarrigan/maylin-taryne)
