🎃 HauntedAI – Multi-Agent AI Platform

Kiroween Hackathon Submission


🌟 Inspiration

The idea behind HauntedAI came from exploring the incredible capabilities of Kiro’s AI-assisted development platform. We wanted to showcase how a complex, multi-agent system could be built using specs, property-based testing, and MCP plugins — all working like a haunted house full of spirits collaborating together.

Key inspirations:

  • Kiro’s revolutionary spec-driven approach
  • Decentralized permanence with IPFS/Storacha
  • Multi-agent orchestration like a coordinated film crew

🎯 What HauntedAI Does

HauntedAI is an autonomous multi-agent AI platform that generates full spooky digital experiences — story, images, code, and deployment.

Autonomous Workflow

graph LR
    A[User Input] --> B[StoryAgent]
    B --> C[AssetAgent] 
    C --> D[CodeAgent]
    D --> E[DeployAgent]
    E --> F[Live Experience]

Agents

  • 🤖 StoryAgent – GPT-4 spooky storytelling
  • 🎨 AssetAgent – DALL-E 3 image generation
  • 💻 CodeAgent – Generates and tests mini-games
  • 🚀 DeployAgent – Deploys to Vercel
  • 🪙 Rewards – HHCW tokens + Ghost Badge NFTs

Key Features

  • 🔗 Permanent decentralized storage (IPFS/Storacha)
  • 🎮 3D spooky UI (Three.js + fog + ghosts)
  • 📊 Real-time logs (SSE)
  • 🌐 Multi-language (EN + AR with RTL)
  • ⛓️ Blockchain rewards on Polygon

🏗️ How We Built It

1. Kiro-Centric Development

Spec-Driven Architecture

/.kiro/specs/haunted-ai/requirements.md   (21 requirements)
/.kiro/specs/haunted-ai/design.md         (1597 lines)
/.kiro/specs/haunted-ai/tasks.md          (200+ tasks)

Property-Based Testing

Example:

describe('Story Generation Properties', () => {
  it('should generate non-empty story for any non-empty input', async () => {
    await fc.assert(
      fc.asyncProperty(fc.string({ minLength: 1 }), async (userInput) => {
        const story = await storyAgent.generate(userInput);
        expect(story.length).toBeGreaterThan(0);
        expect(story).toMatch(/spooky|ghost|haunted|dark|scary/i);
      }),
      { numRuns: 100 }
    );
  });
});
  • 81 correctness properties
  • 152 total property tests
  • 8,100+ test iterations
  • 100% success rate

MCP Plugin Integration

{
  "mcpServers": {
    "openai": {
      "command": "uvx",
      "args": ["openai-mcp-server@latest"]
    },
    "storacha": {
      "command": "uvx",
      "args": ["storacha-mcp-server@latest"]
    }
  }
}

Automated Hooks

# .kiro/hooks/on-save.sh
if [[ "$1" == *.ts ]]; then
  npm test -- "$1" --runInBand --no-coverage
fi

🏛️ Technical Architecture

Frontend

  • Next.js 14 (App Router, TypeScript)
  • Three.js (fog, particles, ghost sprites)
  • TailwindCSS dark theme
  • Wagmi + Viem (Web3)
  • Howler.js (sound effects)

Backend Microservices

┌───────────────────────────────┐
│      API Gateway (NestJS)     │
│ Auth • Rooms • Assets • Token │
└───────────┬───────────────────┘
            │ Redis Pub/Sub
┌───────────┴───────────────────┐
│ StoryAgent • AssetAgent •     │
│ CodeAgent • DeployAgent       │
└───────────────────────────────┘

Storage & Blockchain

  • PostgreSQL + Prisma
  • Redis Pub/Sub
  • IPFS/Storacha permanent storage
  • Polygon smart contracts

    • HHCWToken.sol (ERC20)
    • GhostBadge.sol (ERC721)
    • Treasury.sol

📡 Real-time Experience

app.get('/api/v1/rooms/:id/logs', (req, res) => {
  res.setHeader('Content-Type', 'text/event-stream');
  redis.subscribe(`room:${roomId}:logs`, (msg) => {
    res.write(`event: log\ndata: ${msg}\n\n`);
  });
});

🚧 Challenges

1. Multi-Agent Orchestration

Retry system:

async function executeAgentWithRetry(agentName, input) {
  const maxAttempts = 3;
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
    try { return await callAgent(agentName, input); }
    catch (e) { await sleep(2000 * 2**attempt); }
  }
}

2. Property-Based Testing

Custom CIDs:

const cidArbitrary = fc.string({ minLength:59, maxLength:59 })
  .map(s => 'bafy' + s.toLowerCase().replace(/[^a-z0-9]/g,'2'));

3. 3D Performance Optimization

const animateGhost = () => {
  gsap.to(ghost.position, { y: "+=0.5", duration: 2 });
};

4. IPFS Upload Reliability

if (!cid.match(/^bafy[a-z0-9]+$/)) throw new Error("Invalid CID");

🏆 Accomplishments

  • 1,597-line design spec
  • 200+ Kiro tasks
  • 152 property tests (100% pass)
  • <4% error rate under load
  • Full multi-agent coordination
  • Real decentralized architecture
  • Multi-language + RTL support
  • CI/CD + monitoring dashboards

📚 What We Learned

  • Spec-first development = clarity
  • MCP plugins remove mocking complexity
  • Property-based testing → mathematical confidence
  • Multi-agent orchestration is complex but powerful
  • Real-time systems require careful optimization
  • Decentralization needs UX balancing

🚀 Roadmap

Phase 2 – AI Expansion

  • Video generation
  • Voice narration
  • AI-generated soundtracks

Phase 3 – Social & Gaming

  • Multiplayer spooky worlds
  • Community scores + competitions

Phase 4 – Enterprise

  • Public agent orchestration API

Phase 5 – Global Expansion

  • Mobile apps
  • 10+ languages
  • Region-based spooky themes

📊 Technical Metrics

Metric Target Achieved Status
Response Time (95th) <5s 3.89s
Error Rate <10% 3.8%
Concurrent Users 50 50
Property Tests 81 152

🎉 Conclusion

HauntedAI is not just a hackathon project — it’s a full ecosystem showing what’s possible when:

  • Autonomous agents collaborate
  • Specs drive architecture
  • Math verifies correctness
  • Blockchain ensures permanence
  • 3D effects bring everything to life

Built with Kiro. Verified mathematically. Ready to haunt the digital world. 👻

Built With

Share this project:

Updates