Skip to content

Latest commit

 

History

History
578 lines (442 loc) · 13.8 KB

File metadata and controls

578 lines (442 loc) · 13.8 KB

BEAST System Integration Guide

Complete step-by-step guide to integrate the BEAST system into HoundShield and activate development godmode.


Pre-Integration Checklist

Before integrating, ensure:

  • HoundShield repository cloned locally
  • Node.js 20+ installed
  • GitHub CLI (gh) installed for PR automation
  • Docker available (for deployment)
  • Kubectl configured (for Kubernetes deployment)
  • All BEAST files ready to copy

Step 1: Clone Repository

git clone https://github.com/thecelestialmismatch/HoundShield.git
cd HoundShield
git checkout main

Step 2: Copy BEAST System Files

Copy Core Documents

# Copy all BEAST documentation
cp /path/to/BEAST_PROMPT.md .
cp /path/to/CLAUDE.md .
cp /path/to/GODMODE_ACTIVATION.md .
cp /path/to/pr-automation.md .
cp /path/to/MANIFEST.md .

Create Directory Structure

# Create tasks directory
mkdir -p tasks
cp /path/to/tasks_todo.md ./tasks/todo.md
cp /path/to/tasks_lessons.md ./tasks/lessons.md

# Create .claude directory for agent orchestration
mkdir -p .claude/{agents,commands,hooks,rules,skills}

# Create scripts directory
mkdir -p scripts

Initialize Session State

# Copy SESSION_STATE.json to project root
cp /path/to/SESSION_STATE.json .

# Initialize with current timestamp
node -e "
const fs = require('fs');
const state = JSON.parse(fs.readFileSync('SESSION_STATE.json', 'utf8'));
state.started_at = new Date().toISOString();
state.last_activity = new Date().toISOString();
fs.writeFileSync('SESSION_STATE.json', JSON.stringify(state, null, 2));
"

Step 3: Create Deployment Scripts

Create scripts/save-session-state.js

#!/usr/bin/env node

const fs = require('fs');
const path = require('path');

const sessionPath = path.join(process.cwd(), 'SESSION_STATE.json');

function saveSessionState() {
  try {
    const state = JSON.parse(fs.readFileSync(sessionPath, 'utf8'));
    
    // Update timestamps
    state.last_activity = new Date().toISOString();
    
    // Calculate elapsed time
    const startTime = new Date(state.started_at);
    const nowTime = new Date();
    state.elapsed_hours = ((nowTime - startTime) / (1000 * 60 * 60)).toFixed(1);
    
    // Save
    fs.writeFileSync(sessionPath, JSON.stringify(state, null, 2));
    
    console.log(`✓ Session state saved at ${new Date().toISOString()}`);
    console.log(`  Elapsed: ${state.elapsed_hours} hours`);
    console.log(`  Tokens: ${state.tokens_used.total}/${state.tokens_used.limit}`);
    console.log(`  Tasks completed: ${state.completed_tasks.length}`);
    
  } catch (error) {
    console.error('Error saving session state:', error.message);
    process.exit(1);
  }
}

saveSessionState();

Create scripts/deploy-staging.js

#!/usr/bin/env node

const { execSync } = require('child_process');
const fs = require('fs');

console.log('🚀 Deploying to staging...');

try {
  // Run tests
  console.log('✓ Running test suite...');
  execSync('npm run test:coverage -- --run', { stdio: 'inherit' });
  
  // Build
  console.log('✓ Building...');
  execSync('npm run build', { stdio: 'inherit' });
  
  // Build Docker
  console.log('✓ Building Docker image...');
  const timestamp = Math.floor(Date.now() / 1000);
  execSync(`docker build -t kaelus:staging-${timestamp} .`, { stdio: 'inherit' });
  
  console.log('✅ Staging deployment ready (Docker image built)');
  console.log(`   Image: kaelus:staging-${timestamp}`);
  console.log('   Run: docker run -p 3000:3000 kaelus:staging-[timestamp]');
  
} catch (error) {
  console.error('❌ Deployment failed:', error.message);
  process.exit(1);
}

Create scripts/deploy-prod.js

#!/usr/bin/env node

const { execSync } = require('child_process');
const fs = require('fs');

console.log('🚀 Deploying to production...');
console.log('⚠️  PRODUCTION DEPLOYMENT - Verify all checks pass');

try {
  // Verify tests
  console.log('✓ Verifying test suite...');
  execSync('npm run test:coverage -- --run', { stdio: 'inherit' });
  
  // Build
  console.log('✓ Building production bundle...');
  execSync('npm run build', { stdio: 'inherit' });
  
  // Docker
  console.log('✓ Building Docker image...');
  execSync('docker build -t kaelus:prod-latest .', { stdio: 'inherit' });
  
  // Update session state
  console.log('✓ Updating session state...');
  const state = JSON.parse(fs.readFileSync('SESSION_STATE.json', 'utf8'));
  state.deployments.push({
    environment: 'prod',
    timestamp: new Date().toISOString(),
    status: 'initiated'
  });
  fs.writeFileSync('SESSION_STATE.json', JSON.stringify(state, null, 2));
  
  console.log('✅ Production deployment ready');
  console.log('   Image: kaelus:prod-latest');
  console.log('   Next: Deploy to production environment');
  
} catch (error) {
  console.error('❌ Production deployment failed:', error.message);
  process.exit(1);
}

Update package.json Scripts

Add these scripts to your package.json:

{
  "scripts": {
    "save-session": "node scripts/save-session-state.js",
    "deploy:staging": "node scripts/deploy-staging.js",
    "deploy:prod": "node scripts/deploy-prod.js",
    "ship": "node scripts/deploy-staging.js && npm run save-session"
  }
}

Step 4: Create .claude/settings.json

{
  "version": "1.0",
  "projectName": "HoundShield / Houndshield.com",
  "description": "AI Data Loss Prevention Proxy with CMMC L2 Compliance",
  "autoMemoryEnabled": true,
  "hooks": {
    "preCommit": "bash .claude/hooks/pre-commit.sh",
    "postMerge": "bash .claude/hooks/post-merge.sh"
  },
  "modelConfig": {
    "model": "claude-sonnet-4",
    "temperature": 0.2,
    "maxTokens": 8000
  },
  "permissions": {
    "deployToProduction": "requires_manual_approval",
    "createPullRequest": "autonomous",
    "modifyDatabase": "requires_review",
    "modifySecurityRules": "requires_security_review"
  },
  "agentTeam": {
    "teamLead": "Claude (main orchestrator)",
    "codeReviewer": "Required approval on all PRs",
    "testWriter": "Owns test coverage",
    "securityAuditor": "Compliance and secrets scanning",
    "debugger": "Autonomous bug fixing"
  }
}

Step 5: Create .claude/hooks/pre-commit.sh

#!/bin/bash

# Pre-commit hook to prevent bad commits

echo "Running pre-commit checks..."

# 1. TypeScript strict
echo "✓ Checking TypeScript strict mode..."
npm run typecheck || exit 1

# 2. Linting
echo "✓ Running linter..."
npm run lint || exit 1

# 3. Format check
echo "✓ Checking format..."
npm run format:check || exit 1

# 4. Check for console.logs
if grep -r "console\." src/ --include="*.ts" --include="*.tsx" | grep -v ".test.ts"; then
  echo "❌ Console logs found in production code"
  exit 1
fi

# 5. Check for secrets
if grep -r "REACT_APP_\|process\.env\|SECRET\|API_KEY" src/ --include="*.ts" --include="*.tsx" | grep -v "process\.env"; then
  echo "❌ Hardcoded secrets or API keys found"
  exit 1
fi

echo "✅ Pre-commit checks passed"
exit 0

Step 6: Verify Integration

Run verification script to ensure everything is set up:

# Create verification script
cat > scripts/verify-integration.js << 'EOF'
#!/usr/bin/env node

const fs = require('fs');
const path = require('path');

const checks = [
  { name: 'BEAST_PROMPT.md', path: 'BEAST_PROMPT.md' },
  { name: 'CLAUDE.md', path: 'CLAUDE.md' },
  { name: 'GODMODE_ACTIVATION.md', path: 'GODMODE_ACTIVATION.md' },
  { name: 'MANIFEST.md', path: 'MANIFEST.md' },
  { name: 'SESSION_STATE.json', path: 'SESSION_STATE.json' },
  { name: 'tasks/todo.md', path: 'tasks/todo.md' },
  { name: 'tasks/lessons.md', path: 'tasks/lessons.md' },
  { name: '.claude/settings.json', path: '.claude/settings.json' },
  { name: 'scripts/save-session-state.js', path: 'scripts/save-session-state.js' },
  { name: 'scripts/deploy-staging.js', path: 'scripts/deploy-staging.js' },
];

console.log('Verifying BEAST system integration...\n');

let passed = 0;
let failed = 0;

checks.forEach(check => {
  if (fs.existsSync(path.join(process.cwd(), check.path))) {
    console.log(`✓ ${check.name}`);
    passed++;
  } else {
    console.log(`✗ ${check.name} (missing)`);
    failed++;
  }
});

console.log(`\n${passed} of ${checks.length} components verified`);

if (failed === 0) {
  console.log('\n✅ BEAST system fully integrated!');
  console.log('\nNext step: Load BEAST_PROMPT and say "Begin HoundShield development"');
  process.exit(0);
} else {
  console.log(`\n❌ ${failed} components missing. See instructions above.`);
  process.exit(1);
}
EOF

node scripts/verify-integration.js

Step 7: Update .gitignore

cat >> .gitignore << 'EOF'

# Session state (local tracking, not committed)
SESSION_STATE.json.bak
session-backups/

# Environment files
.env.local
.env.*.local

# Build outputs
.next/
out/
dist/

# Dependencies
node_modules/
EOF

Step 8: Initial Commit

# Create integration commit
git add BEAST_PROMPT.md CLAUDE.md GODMODE_ACTIVATION.md MANIFEST.md pr-automation.md \
        SESSION_STATE.json tasks/ .claude/ scripts/ 

git commit -m "
[INIT] Integrate BEAST system for HoundShield development

- BEAST PROMPT: Unified system prompt and project context
- CLAUDE.md: Project governance and workflow
- SESSION_STATE.json: Session persistence and token tracking
- Task management: todo.md and lessons.md
- Deployment automation: scripts and GitHub Actions
- Agent orchestration: .claude/ directory structure

This enables:
- Session resumption without context loss
- Token-efficient development (50%+ productive usage)
- Automated PR creation and deployment
- Complete task tracking and lessons learned

Status: GODMODE ready to activate
"

# Push to remote
git push origin main

Step 9: Activate GODMODE

First Session: Load and Begin

Paste BEAST_PROMPT.md content into this conversation.

Say: "Begin HoundShield development"

I will:
1. Load complete project context
2. Initialize SESSION_STATE.json
3. Inspect repository for gaps/inconsistencies
4. Identify highest-leverage work for next 5 hours
5. Plan first task
6. Execute, test, and deploy

Subsequent Sessions: Resume

Say: "continue"

I will:
1. Load SESSION_STATE.json
2. Report time elapsed and tokens used
3. List completed tasks with PR links
4. Show current task checkpoint
5. Resume from exact checkpoint

Step 10: Daily Workflow

Morning: Start Session

# Load BEAST PROMPT
# Say: "Begin" or "Continue"
# Work for 3-5 hours

Mid-Session: Checkpoint

# Automatic SESSION_STATE.json update
# Track progress, tokens, completed tasks

End of Session: Save

npm run save-session
# SESSION_STATE.json saved
# Ready to resume next session

Next Session: Resume

Say: "continue"
# System loads checkpoint
# Resume from exact point

Complete File Structure

After integration, your project looks like:

HoundShield/
├── BEAST_PROMPT.md          # Main system prompt
├── CLAUDE.md                # Project governance
├── GODMODE_ACTIVATION.md    # System overview
├── MANIFEST.md              # Inventory
├── pr-automation.md         # Deployment docs
├── SESSION_STATE.json       # Session tracking
├── .claude/
│   ├── settings.json        # Agent config
│   ├── agents/              # Agent definitions
│   ├── commands/            # Custom commands
│   ├── hooks/
│   │   ├── pre-commit.sh    # Pre-commit checks
│   │   └── post-merge.sh    # Post-merge actions
│   ├── rules/               # Context rules
│   └── skills/              # Situational skills
├── tasks/
│   ├── todo.md              # Active tasks
│   └── lessons.md           # Lessons learned
├── scripts/
│   ├── save-session-state.js
│   ├── deploy-staging.js
│   ├── deploy-prod.js
│   └── verify-integration.js
├── src/                     # Your actual codebase
├── tests/                   # Test files
├── package.json             # Updated with new scripts
└── ...                      # Rest of project

Verification Checklist

After completing integration, verify:

  • All BEAST files copied
  • Directory structure created (.claude/, tasks/, scripts/)
  • Scripts created and executable
  • package.json updated with new scripts
  • .gitignore updated
  • Integration commit created
  • npm run save-session works
  • npm run deploy:staging works
  • verification script passes all checks
  • Ready to load BEAST_PROMPT and begin

Troubleshooting Integration

Scripts not executing

chmod +x .claude/hooks/*.sh
chmod +x scripts/*.js

SessionState initialization failed

# Reset SESSION_STATE.json
cp /path/to/SESSION_STATE.json .
node -e "
const fs = require('fs');
const state = require('./SESSION_STATE.json');
state.started_at = new Date().toISOString();
state.last_activity = new Date().toISOString();
fs.writeFileSync('SESSION_STATE.json', JSON.stringify(state, null, 2));
"

Package.json merge conflict

Manually add the new scripts to your existing scripts section.


Ready to Ship

After completing all 10 steps:

# Verify integration
node scripts/verify-integration.js

# Start GODMODE session
# (In Claude conversation)
# Load BEAST_PROMPT.md
# Say: "Begin HoundShield development"

Integration Status: Ready to deploy
Estimated Setup Time: 15 minutes
Benefit: 50%+ faster development with zero lost context

Next: Load BEAST_PROMPT and activate GODMODE.


Support & Questions

If anything is unclear:

  1. Check MANIFEST.md for system overview
  2. Check GODMODE_ACTIVATION.md for protocol
  3. Check CLAUDE.md for governance details
  4. Check pr-automation.md for deployment steps

All questions are answered in the documentation.

You are ready to ship HoundShield at maximum velocity.