Skip to content

fsafey/islamic-text-workflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Islamic Text Workflow - AI-Powered Academic Research Platform

A complete AI-powered research platform for Islamic text analysis, built on Claude Docker with autonomous academic workflows, Graphiti temporal knowledge graphs, and multiple parallel Claude instances for advanced research coordination.

πŸ“‹ MCP Setup Guide: See infrastructure/claude-docker/MCP_SERVERS.md for customizing or adding more MCP servers

🧠 NEW: Graphiti Knowledge Graph Integration

This project now includes complete Graphiti temporal knowledge graph capabilities with Claude Docker integration:

⚑ Quick Commands

# Knowledge graph operations (available in all terminals)
gr "Store Islamic text insights"        # Remember information
gs "search for concepts"                # Search knowledge graph  
gt "file.txt"                          # Analyze text files

# Project development tracking
pstart "session-name"                   # Start work session
pdecision "architectural choice"        # Track decisions
pfeature "feature-name" "status"       # Track features
psearch "query"                        # Search project history
poverview                              # Project overview

# Launch second Claude Docker instance
claude2                                # Interactive second Claude instance

🎯 Key Features

  • 🧠 Temporal Knowledge Graphs: Track Islamic scholarship evolution over time
  • πŸ” Hybrid Search: Semantic + keyword + graph traversal search
  • πŸ€– Local Processing: Zero external API costs via Claude Docker
  • πŸ“Š Project Intelligence: Persistent memory of development decisions
  • πŸ•Œ Islamic Text Specialization: Arabic NLP and Islamic entity extraction
  • πŸ”„ Multiple Claude Instances: Parallel processing and specialized tasks

πŸ“š Complete Documentation

Essential Guides (Start Here)

Technical Architecture

πŸ”— Integration Reference

This comprehensive integration was developed through detailed conversation and implementation. For the complete setup process, troubleshooting, and advanced usage patterns, refer to the implementation conversation that covers:

  • βœ… Complete Graphiti framework integration (120,854+ lines of code)
  • βœ… Claude Docker local processing setup (zero external API costs)
  • βœ… Multiple Claude instance configuration (claude2 command)
  • βœ… Project development tracking system (sessions, decisions, features)
  • βœ… Islamic text analysis specialization (Arabic NLP, temporal entities)
  • βœ… Knowledge graph command interface (gr, gs, gt shortcuts)

The conversation demonstrates practical usage, troubleshooting steps, and real-world implementation details for all features.

πŸ—οΈ Project Structure

islamic-text-workflow/
β”œβ”€β”€ graphiti-main/              # 🧠 Complete Graphiti knowledge graph framework
β”‚   β”œβ”€β”€ graphiti_core/          # Core temporal knowledge graph library
β”‚   β”œβ”€β”€ claude_docker/          # Claude Docker integration for local processing
β”‚   β”œβ”€β”€ mcp_server/             # Model Context Protocol server
β”‚   β”œβ”€β”€ server/                 # FastAPI REST service
β”‚   └── tests/                  # Comprehensive test suite
β”œβ”€β”€ research/                    # Core research activities
β”‚   β”œβ”€β”€ analysis/               # Analysis results and reports
β”‚   β”œβ”€β”€ methodology/            # Research methodologies
β”‚   β”œβ”€β”€ templates/              # Analysis templates
β”‚   └── output/                 # Generated research outputs (includes knowledge exports)
β”œβ”€β”€ infrastructure/             # Technical infrastructure
β”‚   β”œβ”€β”€ claude-docker/          # Claude Docker setup and configuration
β”‚   β”œβ”€β”€ coordination/           # Multi-agent coordination system
β”‚   └── configs/                # Environment and MCP configurations
β”œβ”€β”€ documentation/              # Project documentation
β”‚   β”œβ”€β”€ guides/                 # User guides and tutorials (includes Graphiti docs)
β”‚   β”œβ”€β”€ api/                    # API documentation
β”‚   └── academic/               # Academic methodology documentation
β”œβ”€β”€ tools/                      # Automation and utilities
β”‚   β”œβ”€β”€ scripts/                # Shell commands (gr, gs, pstart, claude2, etc.)
β”‚   β”œβ”€β”€ automation/             # Automated research workflows
β”‚   └── utilities/              # Helper tools and scripts
β”œβ”€β”€ alias*.csv                  # Islamic text datasets (199 entries)
└── archive/                    # Historical and reference materials
    β”œβ”€β”€ legacy/                 # Legacy files and configurations
    β”œβ”€β”€ demos/                  # Demo projects and examples
    └── backups/                # Backup files and archives

πŸš€ AI Coding Agent Starter Pack

This is a complete starter pack for autonomous AI development with optimized dev container support.

What This Does

  • Complete AI coding agent setup with Claude Code in an isolated Docker container
  • Optimized Dev Container - Fast-startup minimal environment with on-demand package installation
  • Pre-configured MCP servers for maximum coding productivity:
    • Serena - Advanced coding agent toolkit with project indexing and symbol manipulation
    • Context7 - Pulls up-to-date, version-specific documentation and code examples straight from the source into your prompt
    • Twilio - SMS notifications when long-running tasks complete (perfect for >10min jobs)
  • Persistent conversation history - Resumes from where you left off, even after crashes
  • Remote work notifications - Get pinged via SMS when tasks finish, so you can step away from your monitor
  • Simple one-command setup and usage - Zero friction set up for plug and play integration with existing cc workflows.
  • Fully customizable - Modify the can modify the files at ~/.claude-docker for custom slash commands, settings and claude.md files.

🐳 Dev Container Quick Start

Option 1: VS Code Dev Container (Recommended)

# 1. Open in VS Code
code .

# 2. Reopen in Container (Command Palette: "Reopen in Container")
# Container starts fast with minimal dependencies

# 3. Install packages as needed
pkg dev-tools python-dev graphiti

# 4. Load project commands
source tools/scripts/graphiti-commands.sh

# 5. Begin development
gr "Starting Islamic text research session"

Option 2: Docker Compose

# Start dev container
docker-compose -f .devcontainer/docker-compose.yml up -d

# Attach to container
docker exec -it islamic-text-workflow-app-1 bash

# Install what you need
pkg all

Option 3: Multi-Instance Claude (Parallel Processing)

# Method 1: Multiple VS Code Dev Containers
# 1. Open multiple VS Code windows
# 2. Each window: "Reopen in Container"
# 3. Each container: run `claude`
# 4. Result: Independent Claude instances with shared workspace

# Method 2: Docker Compose Scale
docker-compose -f .devcontainer/docker-compose.yml up -d --scale app=3
docker exec -it islamic-text-workflow-app-1 claude  # Instance 1
docker exec -it islamic-text-workflow-app-2 claude  # Instance 2
docker exec -it islamic-text-workflow-app-3 claude  # Instance 3

# All instances share:
# - /workspace directory
# - Graphiti knowledge graph
# - Project files and configurations

Dev Container Features

  • ⚑ Fast Startup: Minimal base image loads in seconds
  • πŸ“¦ On-Demand Installation: pkg claude, pkg dev-tools, pkg python-dev, pkg graphiti
  • πŸ’Ύ Persistent Storage: Installed packages persist across rebuilds
  • πŸ”„ Efficient Development: No waiting for unnecessary dependencies
  • πŸ€– Multi-Instance Claude: Easy deployment of multiple Claude instances
  • 🧠 Shared Knowledge Graph: All instances share the same Graphiti knowledge base
  • πŸ•Œ Islamic Text Workflow: Full project functionality available

Quick Start

1. Setup Islamic Text Research Platform

# 1. Configure environment
cp infrastructure/configs/.env.example infrastructure/configs/.env
nano infrastructure/configs/.env  # Add your API keys (Twilio, etc.)

# 2. Install Claude Docker
./tools/scripts/install.sh

# 3. Start autonomous research session
claude-docker

# 4. Begin Islamic text analysis
"Read research/methodology/ and analyze new Islamic texts using our established methodology"

2. Multi-Agent Coordination

# Monitor coordination between Claude instances
./infrastructure/coordination/monitor.sh

# Assign tasks to Docker instance
echo "Analyze academic methodology" > infrastructure/coordination/inbox/research-task.md

Prerequisites

⚠️ IMPORTANT: Complete these steps BEFORE using claude-docker:

1. Claude Code Authentication (Required)

You must authenticate Claude Code on your host system first:

# Install Claude Code globally
npm install -g @anthropic-ai/claude-code

# Run and complete authentication
claude

# Verify authentication files exist
ls ~/.claude.json ~/.claude/

πŸ“– Full Claude Code Setup Guide: https://docs.anthropic.com/en/docs/claude-code

2. Docker Installation (Required)

3. Git Configuration (Required)

Git configuration is automatically loaded from your host system during Docker build:

  • Make sure you have configured git on your host system first:
    git config --global user.name "Your Name"
    git config --global user.email "your.email@example.com"
  • Important: Claude Docker will commit to your current branch - make sure you're on the correct branch before starting

4. SSH Keys for Git Push (Optional - for push/pull operations)

Claude Docker uses dedicated SSH keys (separate from your main SSH keys for security):

Setup SSH keys:

# 1. Create directory for Claude Docker SSH keys
mkdir -p ~/.claude-docker/ssh

# 2. Generate SSH key for Claude Docker
ssh-keygen -t rsa -b 4096 -f ~/.claude-docker/ssh/id_rsa -N ''

# 3. Add public key to GitHub
cat ~/.claude-docker/ssh/id_rsa.pub
# Copy output and add to: GitHub β†’ Settings β†’ SSH and GPG keys β†’ New SSH key

# 4. Test connection
ssh -T git@github.com -i ~/.claude-docker/ssh/id_rsa

Why separate SSH keys?

  • βœ… Security Isolation: Claude can't access or modify your personal SSH keys, config, or known_hosts
  • βœ… SSH State Persistence: The SSH directory is mounted at runtime.
  • βœ… Easy Revocation: Delete ~/.claude-docker/ssh/ to instantly revoke Claude's git access
  • βœ… Clean Audit Trail: All Claude SSH activity is isolated and easily traceable

Technical Note: We mount the SSH directory rather than copying keys because SSH operations modify several files (known_hosts, connection state) that must persist between container sessions for a smooth user experience.

5. Twilio Account (Optional - for SMS notifications)

If you want SMS notifications when tasks complete:

Why Pre-authentication?

The Docker container needs your existing Claude authentication to function. This approach:

  • βœ… Uses your existing Claude subscription/API access
  • βœ… Maintains secure credential handling
  • βœ… Enables persistent authentication across container restarts

Environment Variables (infrastructure/configs/.env)

# SMS notifications (highly recommended for research workflows!)
# Perfect for long-running Islamic text analysis - step away and get notified when done
TWILIO_ACCOUNT_SID=your_twilio_sid  
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_FROM_NUMBER=+1234567890
TWILIO_TO_NUMBER=+0987654321

# Optional - Custom conda paths (for academic environments)
CONDA_PREFIX=/path/to/your/conda
CONDA_EXTRA_DIRS="/path/to/envs /path/to/pkgs"

# Optional - System packages for NLP and text processing
SYSTEM_PACKAGES="libopenslide0 libgdal-dev python3-dev"

⚠️ Security Note: Credentials are baked into the Docker image. Keep your image secure!

πŸŽ“ Academic Research Features

Islamic Text Analysis

  • Automated Methodology: AI applies consistent academic analysis frameworks
  • Multi-Agent Research: Parallel Claude instances coordinate on complex research tasks
  • Quality Assurance: Academic standards compliance and citation management
  • Scalable Processing: Batch analysis of multiple Islamic texts simultaneously

Research Coordination System

  • File-Based Communication: Seamless task distribution between Claude instances
  • Progress Tracking: Real-time monitoring of research activities
  • Result Integration: Automated compilation of analysis results
  • Documentation Generation: Publication-quality research documentation

Expandable Architecture

  • Modular Design: Add new analysis methods and research tools easily
  • Template System: Standardized formats for consistent research output
  • Integration Ready: Connect with external databases and research platforms
  • Version Control: Track research evolution and methodology improvements

Features

πŸ€– Full Autonomy

  • Claude runs with --dangerously-skip-permissions for complete access
  • Can read, write, execute, and modify any files in your project
  • No permission prompts or restrictions

πŸ”Œ Modular MCP Server Support

  • Easy installation of any MCP server through infrastructure/claude-docker/mcp-servers.txt
  • Automatic environment variable handling for MCP servers requiring API keys
  • Pre-configured servers optimized for academic research:
    • Serena: Advanced coding and text analysis toolkit
    • Context7: Up-to-date Islamic studies documentation
    • Twilio: SMS notifications for long-running research tasks
  • See infrastructure/claude-docker/MCP_SERVERS.md for full setup guide

πŸ“± SMS Notifications

  • Automatic SMS via Twilio when Claude completes tasks
  • Configurable via MCP integration
  • Optional - works without if Twilio not configured

🐍 Conda Integration

  • Has access to your conda envs so do not need to add build instructions to the Dockerfile
  • Supports custom conda installation directories (ideal for academic/lab environments where home is quota'd)

πŸ”‘ Persistence

  • Login once, use forever - authentication tokens persist across sessions
  • Automatic UID/GID mapping ensures perfect file permissions between host and container
  • Loads history from previous chats in a given project.

πŸ“ Task Execution Logging

  • Prompt engineered to generate task_log.md documenting agent's execution process
  • Stores assumptions, insights, and challenges encountered
  • Acts as a simple summary to quickly understand what the agent accomplished

🐳 Clean Environment

  • Each session runs in fresh Docker container
  • Only current working directory mounted (along with conda directories specified in .env).

Configuration

During build, the .env file from infrastructure/configs/ is baked into the image:

  • Credentials are embedded at /app/.env inside the container
  • No need to manage .env files in each project
  • The image contains everything needed to run
  • Important: After updating infrastructure/configs/.env, you must rebuild the image with claude-docker --rebuild

The setup creates ~/.claude-docker/ in your home directory with:

  • claude-home/ - Persistent Claude authentication and settings
  • ssh/ - Directory where claude-dockers private ssh key and known hosts file is stored.

Multi-Agent Coordination

The infrastructure/coordination/ system enables communication between parallel Claude instances:

  • inbox/ - Task assignments for Docker instance
  • outbox/ - Results and progress updates
  • status/ - Real-time coordination status
  • logs/ - Communication history and debugging

Template Configuration Copy

During installation (install.sh), all contents from the project's .claude/ directory are copied to ~/.claude-docker/claude-home/ as template/base settings. This includes:

  • settings.json - Default Claude Code settings with MCP configuration
  • CLAUDE.md - Default instructions and protocols
  • commands/ - Slash commands (if any)
  • Any other configuration files

To modify these settings:

  • Recommended: Directly edit files in ~/.claude-docker/claude-home/
  • Alternative: Modify .claude/ in this repository and re-run install.sh

All changes to ~/.claude-docker/claude-home/ persist across container sessions.

Each project gets:

  • .claude/settings.json - Claude Code settings with MCP
  • .claude/CLAUDE.md - Project-specific instructions (if you create one)

Command Line Flags

Claude Docker supports several command-line flags for different use cases:

Basic Usage

claude-docker                    # Start Claude in current directory
claude-docker --continue         # Resume previous conversation in this directory
claude-docker --rebuild          # Force rebuild Docker image
claude-docker --rebuild --no-cache  # Rebuild without using Docker cache

Available Flags

Flag Description Example
--continue Resume the previous conversation in current directory claude-docker --continue
--rebuild Force rebuild of the Docker image claude-docker --rebuild
--no-cache When rebuilding, don't use Docker cache claude-docker --rebuild --no-cache
--memory Set container memory limit claude-docker --memory 8g
--gpus Enable GPU access (requires nvidia-docker) claude-docker --gpus all

Environment Variables

You can also set defaults in your .env file:

DOCKER_MEMORY_LIMIT=8g          # Default memory limit
DOCKER_GPU_ACCESS=all           # Default GPU access

Examples

# Resume work with 16GB memory limit
claude-docker --continue --memory 16g

# Rebuild after updating .env file
claude-docker --rebuild

# Use GPU for ML tasks
claude-docker --gpus all

Rebuilding the Image

The Docker image is built only once when you first run claude-docker. To force a rebuild:

# Force rebuild (uses cache)
claude-docker --rebuild

# Force rebuild without cache
claude-docker --rebuild --no-cache

Rebuild when you:

  • Update your .env file with new credentials
  • Update the Claude Docker repository
  • Change system packages in .env

Conda Configuration

For custom conda installations (common in academic/lab environments), add these to your .env file:

# Main conda installation
CONDA_PREFIX=/vol/lab/username/miniconda3

# Additional conda directories (space-separated)
CONDA_EXTRA_DIRS="/vol/lab/username/.conda/envs /vol/lab/username/conda_envs /vol/lab/username/.conda/pkgs /vol/lab/username/conda_pkgs"

How it works:

  • CONDA_PREFIX: Mounts your conda installation to the same path in container
  • CONDA_EXTRA_DIRS: Mounts additional directories and automatically configures conda

Automatic Detection:

  • Paths containing *env* β†’ Added to CONDA_ENVS_DIRS (conda environment search)
  • Paths containing *pkg* β†’ Added to CONDA_PKGS_DIRS (package cache search)

Result: All your conda environments and packages work exactly as they do on your host system.

System Package Installation

For scientific computing packages that require system libraries, add them to your .env file:

# Install OpenSlide for medical imaging
SYSTEM_PACKAGES="libopenslide0"

# Install multiple packages (space-separated)
SYSTEM_PACKAGES="libopenslide0 libgdal-dev libproj-dev libopencv-dev"

Note: Adding system packages requires rebuilding the Docker image (docker rmi claude-docker:latest).

How This Differs from Anthropic's DevContainer

We provide a different approach than Anthropic's official .devcontainer, optimized for autonomous task execution:

Feature Comparison

Feature claude-docker Anthropic's DevContainer
IDE Support Any editor/IDE VSCode-specific
Authentication Once per machine, persists forever Per-devcontainer setup
Conda Environments Direct access to all host envs Manual setup in Dockerfile
Prompt Engineering Optimized CLAUDE.md for tasks Standard behavior
Network Access Full access (firewall coming soon) Configurable firewall
SMS Notifications Built-in Twilio MCP Not available
Permissions Auto (--dangerously-skip-permissions) Auto (--dangerously-skip-permissions)

Note: Network firewall functionality similar to Anthropic's implementation is our next planned feature.

Next Steps

Phase 2 - Security Enhancements:

  • Network firewall to whitelist specific domains (similar to Anthropic's DevContainer)
  • Shell history persistence between sessions
  • Additional security features

Attribution & Dependencies

Core Dependencies

Inspiration & References

Islamic Text Workflow Extensions

  • Academic Research Platform: Built on claude-docker foundation
  • Multi-Agent Coordination: Custom file-based communication system
  • Research Templates: Islamic studies methodology integration
  • Expandable Architecture: Modular design for research scalability

πŸ“Š Current Research Output

πŸ“– Documentation Structure

License

This project is open source. See the LICENSE file for details.


Islamic Text Workflow - Advancing Islamic studies through AI-powered research platforms built on Claude Docker infrastructure.

About

Islamic text processing and analysis workflow system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors