- Add CyberSec Career Navigator with JotForm white-label integration - Implement direct access agent system alongside webhook agents - Add digital branding services page with SOSTAC+RACE methodology - Create dual integration patterns: webhook vs direct access flows - Clean up unused form API endpoints for streamlined architecture - Add career navigator management command and templates - Update marketplace with conditional logic for different agent types - Fix UI consistency issues (remove category labels, fix animations) - Update documentation to reflect new dual architecture 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
11 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
Quantum Tasks AI is a Django-based AI agent marketplace platform. Users can access AI agent services through a web interface, with execution handled via two distinct systems: N8N webhook integrations and direct form access integrations.
Key Architecture:
- Django Framework: Main web application using Django 5.2.4
- Agent System: Database-driven agents app with dual integration systems:
- Webhook Agents: N8N integrations for complex processing
- Direct Access Agents: Form-based integrations (JotForm, etc.)
- Authentication: Custom user model with email verification
- Payments: Stripe integration with wallet system (supports free agents)
- Database: SQLite for development, PostgreSQL for production (Railway)
- Static Files: WhiteNoise for production static file serving
Development Commands
Environment Setup
# Use virtual environment
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt # Production
pip install -r requirements-dev.txt # Development
# Start development server
./run_dev.sh # Recommended - includes migration checks
# OR
python manage.py runserver # Direct Django server
Database Operations
# Make migrations
python manage.py makemigrations
# Apply migrations
python manage.py migrate
# Create superuser
python manage.py createsuperuser
# Database shell
python manage.py dbshell
# Check database configuration
python manage.py check_db
Testing
# Run Django tests
python manage.py test
# Run pytest (if configured)
pytest
# Run specific app tests
python manage.py test authentication
python manage.py test agents
python manage.py test wallet
# Custom test scripts
python tests/simple_test.py
python tests/check_agents.py
Code Quality (Development Dependencies)
# Format code
black .
# Sort imports
isort .
# Lint code
flake8
# Type checking (if available)
mypy .
Production Commands
# Collect static files
python manage.py collectstatic --noinput
# Production server (via Gunicorn)
gunicorn netcop_hub.wsgi:application
Core Architecture
Apps Structure
- authentication/: Custom user model, email verification, password reset
- core/: Homepage, error handlers, utility functions
- agents/: Database-driven agent system (marketplace, execution, models, REST API)
- wallet/: Stripe payments, wallet management, transactions
Agent System (agents app)
Key Files:
agents/models.py: Agent, AgentCategory, AgentExecution, ChatSession modelsagents/views.py: Dual integration systems and web interface viewsagents/templates/agents/: Dynamic agent templates and marketplaceagents/management/commands/: Agent creation and management commandstemplates/career_navigator.html: Direct access form template
Dual Integration Systems:
System 1: Webhook Agents (N8N Integration)
- User browses marketplace (
/agents/) - Clicks "Try Now" → Agent detail page (
/agents/{slug}/) - Fills dynamic form → Form submission calls
/agents/api/execute/ - N8N webhook processes request and returns response
- Results displayed with file upload support
System 2: Direct Access Agents (Form Integration)
- User browses marketplace (
/agents/) - Clicks special "Try Now" button → Direct access (
/agents/{slug}/access/) - Payment processed → Redirect to form page (
/agents/{slug}/) - Form displays embedded interface (JotForm, etc.)
- User interacts directly with external form system
Database Models
User Management:
authentication.User: Custom user model with email verificationauthentication.PasswordResetToken: Password reset tokensauthentication.EmailVerificationToken: Email verification tokens
Agents:
agents.Agent: Agent definitions with JSON form schemas and pricingagents.AgentCategory: Agent categories with icons and descriptionsagents.AgentExecution: Execution history and results tracking
Payments:
wallet.Wallet: User wallet with balance trackingwallet.WalletTransaction: Transaction history and Stripe integration
Settings Configuration
Environment Variables (Required for Production):
SECRET_KEY: Django secret keyALLOWED_HOSTS: Comma-separated list of allowed hostsEMAIL_HOST_USER,EMAIL_HOST_PASSWORD: SMTP credentialsSTRIPE_SECRET_KEY,STRIPE_WEBHOOK_SECRET: Stripe API keysDATABASE_URL: PostgreSQL connection string (Railway)
Current Agents: The platform supports both webhook-based agents (N8N integration) and direct access agents (embedded forms):
Webhook Agents (N8N Integration):
-
Social Ads Generator (social-ads-generator) - 6.00 AED
- Creates compelling social media advertisements
- Form fields: description, social_platform, include_emoji, language
- Webhook: N8N endpoint for social media ad generation
-
Job Posting Generator (job-posting-generator) - 10.00 AED
- Creates professional job postings
- Form fields: job_title, company_name, job_description, seniority_level, contract_type, location, language
- Webhook: N8N endpoint for job posting generation
-
PDF Summarizer (pdf-summarizer) - 8.00 AED
- Analyzes and summarizes PDF documents with file upload
- Form fields: pdf_file (file upload with drag-and-drop), summary_type
- Webhook: N8N endpoint for PDF processing with multipart file support
-
5 Whys Analyzer (5-whys-analyzer) - 15.00 AED
- Interactive chat-based root cause analysis using 5 Whys methodology
- Chat interface with real-time N8N webhook integration
- Session timeout: 2 hours
Direct Access Agents (Embedded Forms): 5. CyberSec Career Navigator (cybersec-career-navigator) - 0.00 AED
- JotForm-based career guidance consultation
- Embedded white-label interface
- Session duration: 2 hours
- Direct access URL:
/agents/career-navigator/
URL Structure
/ # Homepage (core app)
/digital-branding/ # Digital branding services page
/auth/ # Authentication (login, register, etc.)
/agents/ # Agent marketplace (agents app)
/agents/{slug}/ # Individual agent pages (webhook agents)
/agents/career-navigator/ # Career navigator form page
/agents/career-navigator/access/ # Career navigator payment processing
/wallet/ # Wallet management
/admin/ # Django admin
Key Components
Agent Configuration (Database-driven):
- All agent metadata stored in database (pricing, descriptions, webhooks)
- JSON form schemas for dynamic form generation
- Easy to add new agents via management commands or admin interface
Templates:
templates/base.html: Main layout with navigationtemplates/components/: Reusable UI componentsagents/templates/agents/: Dynamic agent forms and marketplace pages
Adding New Agents
- Create management command (recommended approach):
# agents/management/commands/create_new_agent.py
from django.core.management.base import BaseCommand
from agents.models import AgentCategory, Agent
class Command(BaseCommand):
def handle(self, *args, **options):
category, _ = AgentCategory.objects.get_or_create(
slug='category-slug',
defaults={'name': 'Category Name', 'icon': '🤖'}
)
Agent.objects.get_or_create(
slug='agent-slug',
defaults={
'name': 'Agent Name',
'short_description': 'Brief description',
'description': 'Full description',
'category': category,
'price': 10.0,
'form_schema': {
'fields': [
{
'name': 'input_field',
'type': 'text',
'label': 'Input Field',
'required': True
}
]
},
'webhook_url': 'http://your-n8n-webhook-url'
}
)
- Run the command:
python manage.py create_new_agent - Update N8N workflow to handle the new agent
- Agent will automatically appear in marketplace with dynamic form generation
Supported Form Field Types:
text: Text inputtextarea: Multi-line textselect: Dropdown with optionsfile: File upload with drag-and-dropurl: URL input with validationcheckbox: Boolean checkbox
Production Deployment
Railway Configuration:
- Automatic deployment from git repository
- PostgreSQL database provided by Railway
- Environment variables configured in Railway dashboard
- Static files served via WhiteNoise
Security Features:
- CSRF protection enabled
- Rate limiting on sensitive endpoints
- Secure headers in production
- HTTPS redirect and HSTS headers
- Session and cookie security
Development Notes
- Database: Uses SQLite by default for development reliability
- Cache: Redis preferred, falls back to local memory cache
- Email: Console backend in development, SMTP in production
- Debug Tools: Debug toolbar and Django extensions available in development
- Static Files: Collected to
staticfiles/directory for production - Media Files: User uploads stored in
media/directory
Common Development Tasks
Adding new environment variables:
- Add to
settings.pywithconfig()call - Add to required_env_vars list if production-required
- Document in this file
Database changes:
- Make model changes
- Run
python manage.py makemigrations - Review migration file
- Run
python manage.py migrate
Testing agent webhooks locally:
- Use ngrok or similar to expose local server
- Update webhook URLs in agent database records
- Test agent execution flow
- Check AgentExecution records and results display
System Status
Current Status: ✅ STABLE WORKING SYSTEM
- All 5 agents confirmed working and tested (4 webhook + 1 direct access)
- Dual integration architecture with clean separation
- Digital branding services integration complete
- Chat-based and form-based agent systems operational
- White-label integration patterns established
Latest Changes:
- Implemented dual integration architecture (webhook + direct access)
- Added CyberSec Career Navigator with JotForm integration
- Enhanced agent marketplace with conditional button logic
- Added digital branding services page
- Cleaned up unused form API endpoints
- Implemented 2-hour session timeout system
- Fixed persistent success messages and UI consistency
Future Development:
- Optimization work available in feature/optimization-backup branch
- Safe to add new agents via database-driven approach
- Performance optimizations should be applied incrementally with testing
Last updated: 2025-08-02 12:30:00