This file provides comprehensive guidance to Claude Code (claude.ai/code) when working with the ContextMax codebase. It contains project-specific instructions, architectural details, and development practices that help maintain consistency and quality.
ContextMax is a privacy-first, browser-based web application built with Nuxt.js 3 that helps developers create precise, reusable context sets for Large Language Models (LLMs).
- Privacy First: All processing happens client-side, no code ever leaves the user's machine
- Developer Focused: Built by developers for developers working with complex codebases
- LLM Agnostic: Works with any LLM that accepts context (Claude, GPT, Gemini, etc.)
- Performance Optimized: Uses WebGPU, IndexedDB caching, and OPFS for speed
# Start development server
npm run dev
# Clean development (removes .nuxt cache)
npm run dev:clean
# Fresh start (clean + reinstall)
npm run dev:fresh
# Build for production
npm run build
# Run tests
npm run test
# Run tests with coverage
npm run test:coverage
# Generate coverage badge
npm run coverage:badgeImportant Notes:
- Development server runs on port 3000
- Do not run commands to start/restart the server - assume it's already running
- Always run tests before committing changes
- Maintain 91%+ code coverage
When a user references @context:Name, resolve it via context-sets.json → sets["context:Name"].
- Check workflows first
- If workflows exist: Start from
workflow.start.functionand trace toend - If workflows empty: Read all files in the context, prioritizing those with
functionRefs
- File Resolution
- String → filesIndex[fileId].path → read entire file
- Object → filesIndex[fileId].path → locate specific functionRefs
- Impact Analysis
- Direct: Check context's
usesarray - Indirect: Check
filesIndex[fileId].contextsfor shared files - When modifying file_X in ContextA, also consider ContextB if both use file_X
User: "Fix the download button in @context:PhotoGallery" → Load PhotoGallery context → See it uses ["DownloadPhoto"] → Find download button via workflow start point or grep functions → Check if changes affect DownloadPhoto via shared files
- Track changes in memory during session
- Update context-sets.json only when explicitly requested
- Use functionRefs for surgical precision when available
- No warnings for files outside contexts
- Nuxt.js 3 with Vue.js 3 and TypeScript
- Tailwind CSS v4 for styling
- shadcn-nuxt and Reka UI for component system
- @huggingface/transformers for client-side AI processing
- regex for code parsing to feed to locally-embedded LLM
- Vitest for testing with 91%+ coverage
Centralized in composables/useProjectStore.ts which manages:
- Project files and directory structure
- Context sets and their relationships
- Workflows and execution steps
- File manifest and indexing
- Persistent storage synchronization
Multi-tier storage approach for performance and persistence:
- File System Access API for reading local project files
- Origin Private File System (OPFS) for persistent browser storage
- IndexedDB cache for performance optimization (
composables/useIndexedDBCache.ts)
Hybrid AI-powered suggestion engine using:
- Local LLM embeddings via Hugging Face Transformers
- AST-like analysis using regex parsers + 2 local LLMs of
jinaai/jina-embeddings-v2-base-codeandXenova/flan-t5-small - File relationship analysis through
composables/useProjectAnalysis.ts
The context-sets.json file uses a structured JSON format:
filesIndex- ID-based file registry with paths and commentscontextSets- Named collections of files, line ranges, and workflowsschemaVersion- Format versioningprojectName- The name of the uploaded directory/folderlastUpdated- The UTC timestamp that denotes when was the last export done
-
TypeScript Usage
- Strict mode enabled
- Explicit return types for public functions
- Proper interface definitions for all data structures
- Avoid
anytype - useunknownor proper types
-
Vue 3 Composition API
- Use
<script setup>syntax - Prefer composables for shared logic
- Reactive refs and computed properties
- Proper TypeScript integration with
definePropsanddefineEmits
- Use
-
Error Handling
- Try-catch blocks for async operations
- User-friendly error messages
- Fallback UI states for errors
- Console errors only in development
-
UI Components: Use shadcn-vue CLI
npx shadcn-vue@latest add COMPONENT_NAME
-
Feature Components: Follow this structure
<template> <div class="component-name"> <!-- Template here --> </div> </template> <script setup lang="ts"> import { ref, computed } from 'vue' import type { ComponentProps } from './types' const props = defineProps<ComponentProps>() const emit = defineEmits<{ 'update:modelValue': [value: string] }>() </script>
-
Test Organization
- Component tests:
tests/components/ - Composable tests:
tests/composables/ - Utility tests:
tests/utils/
- Component tests:
-
Testing Stack
- Framework: Vitest
- DOM: happy-dom
- Vue testing:
@testing-library/vue - Coverage: 91%+ requirement
-
Test Writing Guidelines
describe('ComponentName', () => { it('should render correctly', () => { const { getByText } = render(ComponentName) expect(getByText('Expected Text')).toBeTruthy() }) it('should handle user interaction', async () => { const { getByRole } = render(ComponentName) await fireEvent.click(getByRole('button')) // Assert expected behavior }) })
-
Data Handling
- ALL file processing must happen client-side
- NEVER send file content to external servers
- Use File System Access API for local file access
- Store persistent data in OPFS, not cloud services
-
Browser API Usage
- File System Access API (Chrome/Edge 86+)
- Origin Private File System (OPFS)
- IndexedDB for caching
- WebGPU for AI acceleration (when available)