Index of every page on this site: llms.txt
All skills
jeremylongshore avatar

/twinmind-reference-architecture

@0d57af8
Run it yourself

Production architecture for meeting AI systems using TwinMind: transcription pipeline, memory vault, action item workflow, and calendar integration. Use when implementing reference architecture, or managing TwinMind meeting AI operations. Trigger with phrases like "twinmind reference architecture", "twinmind reference architecture".

Use this Skill: https://skilld.dev/gh/jeremylongshore/tons-of-skills-marketplace/twinmind-reference-architecture

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesimplementation.md

≈1.6k tokens on demand. Your agent reads this file only when SKILL.md points to it.

TwinMind Reference Architecture - Detailed Implementation

Project Structure

my-twinmind-project/
├── src/
│   ├── twinmind/           # TwinMind layer
│   │   ├── client.ts       # Singleton client wrapper
│   │   ├── config.ts       # Environment configuration
│   │   ├── types.ts        # TypeScript types
│   │   ├── errors.ts       # Custom error classes
│   │   └── handlers/       # Webhook/event handlers
│   ├── services/meeting/   # Service layer
│   │   ├── index.ts        # Orchestration facade
│   │   ├── transcription.ts
│   │   ├── summary.ts
│   │   ├── actions.ts
│   │   └── cache.ts
│   ├── integrations/       # Integration layer
│   │   ├── calendar/
│   │   ├── slack/
│   │   ├── linear/
│   │   └── email/
│   ├── api/                # API layer
│   │   ├── routes/
│   │   └── middleware/
│   ├── jobs/               # Background jobs
│   └── utils/              # Utilities
├── tests/
├── config/
└── docs/

Layer Architecture

API Layer (Controllers, Routes, Webhooks)
   ↓
Service Layer (Business Logic, Orchestration)
   ↓
TwinMind Layer (Client, Types, Error Handling)
   ↓
Integration Layer (Calendar, Slack, Linear, Email)
   ↓
Infrastructure Layer (Cache, Queue, Monitoring)

Client Wrapper

import axios, { AxiosInstance } from 'axios';

export class TwinMindService {
  private client: AxiosInstance;
  private cache: TranscriptCache;
  private metrics: MetricsCollector;

  constructor(config?: TwinMindConfig) {
    this.config = config || loadConfig();
    this.client = axios.create({
      baseURL: this.config.baseUrl,
      headers: { 'Authorization': `Bearer ${this.config.apiKey}`, 'Content-Type': 'application/json' },
      timeout: this.config.timeout,
    });
    this.cache = new TranscriptCache(this.config.cacheOptions);
    this.metrics = new MetricsCollector('twinmind');
    this.setupInterceptors();
  }

  private setupInterceptors(): void {
    this.client.interceptors.request.use((config) => { this.metrics.incrementCounter('requests', { method: config.method }); return config; });
    this.client.interceptors.response.use(
      (response) => { this.metrics.recordLatency('request_duration', response.config.metadata?.startTime); return response; },
      (error) => { this.metrics.incrementCounter('errors', { status: error.response?.status || 'network' }); throw error; }
    );
  }

  async transcribe(audioUrl: string, options?: TranscriptionOptions): Promise<Transcript> {
    return this.cache.getOrFetch(`transcript:${audioUrl}`, () => this.metrics.track('transcribe', () => this.client.post('/transcribe', { audio_url: audioUrl, ...options })));
  }
}

let instance: TwinMindService | null = null;
export function getTwinMindService(): TwinMindService {
  if (!instance) instance = new TwinMindService();
  return instance;
}

Service Layer

export class MeetingService {
  private twinmind = getTwinMindService();

  async processMeeting(audioUrl: string, options = {}): Promise<MeetingResult> {
    const calendarEvent = options.calendarEventId ? await this.calendar.getEvent(options.calendarEventId) : null;
    const transcript = await this.transcription.transcribe(audioUrl, { title: calendarEvent?.title, attendees: calendarEvent?.attendees });

    const [summary, actionItems] = await Promise.all([
      this.summaryService.generate(transcript.id),
      this.actionService.extract(transcript.id),
    ]);

    const participants = await this.identifyParticipants(transcript, calendarEvent?.attendees);

    if (options.notifySlack) {
      await this.slack.notifyMeetingComplete({ title: transcript.title, summary: summary.summary, actionItems });
    }

    return { transcriptId: transcript.id, transcript, summary, actionItems, participants };
  }
}

Error Boundary

export class TwinMindError extends Error {
  constructor(message: string, public readonly code: string, public readonly statusCode?: number, public readonly retryable = false) {
    super(message);
    this.name = 'TwinMindError';
  }

  static fromApiError(error: any): TwinMindError {
    const status = error.response?.status;
    const message = error.response?.data?.message || error.message;
    switch (status) {
      case 401: return new TwinMindError(message, 'AUTH_FAILED', status, false);
      case 429: return new TwinMindError(message, 'RATE_LIMITED', status, true);
      case 500: case 502: case 503: return new TwinMindError(message, 'SERVER_ERROR', status, true);
      default: return new TwinMindError(message, 'UNKNOWN', status, false);
    }
  }
}

Health Check

export async function checkHealth(): Promise<HealthStatus> {
  const checks: HealthCheck[] = [];

  // TwinMind API
  const start = Date.now();
  try { await getTwinMindService().healthCheck(); checks.push({ name: 'twinmind_api', status: 'pass', latencyMs: Date.now() - start }); }
  catch (e: any) { checks.push({ name: 'twinmind_api', status: 'fail', latencyMs: Date.now() - start, message: e.message }); }

  // Cache + DB checks...
  const hasFailure = checks.some(c => c.status === 'fail');
  const hasWarning = checks.some(c => c.status === 'warn');
  return { status: hasFailure ? 'unhealthy' : hasWarning ? 'degraded' : 'healthy', checks, timestamp: new Date() };
}

Configuration

export function loadConfig(): TwinMindConfig {
  const env = process.env.NODE_ENV || 'development';
  const envConfig = require(`./twinmind.${env}.json`);
  return {
    apiKey: process.env.TWINMIND_API_KEY!,
    baseUrl: process.env.TWINMIND_API_URL || 'https://api.twinmind.com/v1',
    environment: env,
    timeout: parseInt(process.env.TWINMIND_TIMEOUT || '30000'),
    retries: parseInt(process.env.TWINMIND_RETRIES || '3'),
    ...envConfig,
  };
}

Tons of Skills by Intent Solutions | jeremylongshore.com

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    This skill provides a reference architecture and implementation guide for TwinMind, a meeting AI system. It includes standard project structures, integration code, and configuration practices. No security risks were identified.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at 0d57af8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 3 months ago
What it can do
Reads files Edits files Runs commands
version
1.13.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
[
  "saas",
  "twinmind",
  "architecture"
]
All 6 allowed tools
ReadWriteEditBash(npm:*)Bash(curl:*)Grep
Other metadata
compatibility
Designed for Claude Code

README badge

README badge for jeremylongshore/tons-of-skills-marketplace/twinmind-reference-architecture