Skip to content

DruxAMB/TIN

Repository files navigation

🧠 TIN (Temporal Intelligence Network)

Revolutionary AI agents with decentralized memory - they remember, forget, learn from each other, and form collective intelligence through Arkiv's blockchain data layer.

⚑ Try It Now - Zero Setup Required!

npx create-arkiv-app@latest my-ai-agents
cd my-ai-agents  
npm install
npm run dev

πŸŽ‰ In 30 seconds, you'll have collaborative AI agents running on Arkiv blockchain!

npm version npm downloads


Arkiv Main Track Hackathon Submission ($10k Prize Pool)

A breakthrough demonstration of AI agents with persistent, collaborative, and naturally expiring memories using all four core Arkiv features.

🎯 The Innovation

What if AI agents could have memory systems like humans? They remember important things, gradually forget irrelevant details, learn from each other's experiences, and even argue about contradictions. This project showcases exactly that through:

  • πŸ”„ CRUD Operations: βœ… REAL - Dynamic memory lifecycle with Arkiv blockchain entities
  • ⏰ TTL Innovation: βœ… REAL - Arkiv's native expiration system with batched transactions
  • πŸ“‘ Real-time Subscriptions: ⚠️ DEMO - Simulated for local collaboration (Arkiv integration planned)
  • πŸ” Advanced Queries: 🚧 PLANNED - Semantic search capabilities (coming soon)

πŸ•΅οΈ Live Demo: The Detective Agency

Watch three AI detective agents collaborate to solve mysteries:

  • Sherlock Holmes - Pattern analysis and logical deduction specialist
  • Dr. John Watson - Medical expertise and methodical data correlation
  • Professor Moriarty - Counter-intelligence and contradiction detection

✨ What Makes This Special

  1. Blockchain Persistence: βœ… Memories stored on real Arkiv testnet with transaction hashes
  2. Natural Forgetting: βœ… Automatic expiration using Arkiv's native TTL system
  3. Collaborative AI: ⚠️ Agents share insights through simulated real-time events
  4. Performance Monitoring: βœ… Live blockchain metrics with actual confirmation times

πŸš€ Quick Start

🌟 Option 1: Use the NPM Package (Recommended)

# Create a new Arkiv AI app instantly
npx create-arkiv-app@latest my-detective-agency
cd my-detective-agency
npm install
npm run dev

πŸ”§ Option 2: Clone This Repository

# Clone and install dependencies
git clone https://github.com/DruxAMB/TIN.git
cd TIN
npm install

# Set up environment variables
cp .env.example .env.local
# Edit .env.local with your Arkiv configuration

# Run the development server  
npm run dev

# Open http://localhost:3000

🎯 Both options give you the same powerful AI detective agency demo!

πŸ“¦ create-arkiv-app Package

The create-arkiv-app npm package transforms this demo into a reusable template for building collaborative AI applications:

✨ Package Features:

  • ⚑ Instant Setup: Get running in under 30 seconds
  • 🎯 Interactive CLI: Beautiful prompts for project customization
  • πŸ› οΈ Multiple Templates: AI Agents, Basic, Chat (more coming)
  • πŸ”§ Smart Configuration: Auto-generated environment files
  • πŸ“š Complete Documentation: Ready-to-use README for your project
  • πŸš€ Production Ready: TypeScript, Next.js, Tailwind CSS

🌟 Template Options:

npx create-arkiv-app@latest --template ai-agents    # Full detective demo
npx create-arkiv-app@latest --template basic        # Minimal starter  
npx create-arkiv-app@latest --template chat         # Real-time chat agents

πŸ“Š Package Stats:

  • Published: Available on npm registry
  • Size: 184 kB (optimized for quick downloads)
  • Dependencies: 5 core packages (chalk, commander, inquirer, fs-extra, validate-npm-package-name)
  • License: MIT (developer-friendly)

πŸ” Implementation Transparency

βœ… What's REAL Arkiv Blockchain:

  • Memory Storage: All agent memories stored as entities on Mendoza testnet
  • Transaction Hashes: Every memory creation gets a real blockchain transaction
  • TTL Expiration: Native Arkiv expiration system (no manual cleanup needed)
  • Batched Operations: Efficient transaction batching with 2-second windows
  • Performance Metrics: Real confirmation times and gas costs

⚠️ What's Demo/Simulated:

  • Real-time Subscriptions: Local in-memory callbacks (works in single session)
  • Cross-Agent Communication: Simulated for demo purposes
  • Live Updates: Browser-local only (no multi-user sync yet)

🚧 What's Planned:

  • Advanced Queries: Waiting for Arkiv query API maturity
  • Multi-User Subscriptions: Real cross-session collaboration
  • Semantic Search: AI-powered memory retrieval

🎯 Bottom Line: The memories are REAL blockchain data, the collaboration is simulated for demo impact.


Environment Configuration

The project supports both demo mode (with mock Arkiv client) and production mode (with real Arkiv integration):

Demo Mode (Default)

NEXT_PUBLIC_USE_MOCK_CLIENT=true
NEXT_PUBLIC_DEMO_MODE=true

Production Mode

NEXT_PUBLIC_USE_MOCK_CLIENT=false
NEXT_PUBLIC_ARKIV_NETWORK_URL=https://api.arkiv.network
ARKIV_API_KEY=your-actual-arkiv-api-key

Demo Flow

  1. Landing Page (/) - Overview of the concept and agents
  2. Live Demo (/demo) - Watch agents solve mysteries in real-time
  3. Architecture (/architecture) - Technical deep-dive (coming soon)

πŸ—οΈ Architecture

Core Components

Memory System (src/lib/memory/)

  • MemoryManager - CRUD operations with Arkiv integration
  • SubscriptionManager - Real-time event handling and notifications
  • Adaptive TTL algorithms based on relevance, confidence, and access patterns

Agent System (src/lib/agents/)

  • DetectiveAgent - Base class with memory management and collaboration
  • SherlockAgent - Pattern recognition and deduction specialist
  • WatsonAgent - Medical analysis and systematic documentation
  • MoriartyAgent - Skeptical analysis and contradiction detection

Arkiv Integration (src/lib/arkiv/)

  • Client configuration using @arkiv-network/sdk
  • Mock implementation for development/testing
  • All four core features: CRUD, TTL, Subscriptions, Queries

Memory Structure

interface AgentMemory {
  id: string;
  agentId: string;
  agentType: 'sherlock' | 'watson' | 'moriarty';
  content: {
    type: 'observation' | 'deduction' | 'pattern' | 'contradiction';
    data: any;
    confidence: number;
    description: string;
  };
  metadata: {
    created: number;
    lastAccessed: number;
    accessCount: number;
    relevanceScore: number;
    linkedMemories: string[];
    tags: string[];
    caseId?: string;
  };
  ttl: number; // Adaptive based on access patterns
}

πŸŽͺ Arkiv Features Implementation Status

1. βœ… CRUD Operations (REAL ARKIV)

  • βœ… Create: Agents store memories as Arkiv blockchain entities with batching
  • βœ… Read: Fetch stored memories using entityKey from Arkiv network
  • ⚠️ Update: Creates new entities (Arkiv design limitation)
  • ❌ Delete: Not supported - entities naturally expire via TTL

2. βœ… TTL Innovation (REAL ARKIV)

  • βœ… Native Expiration: Uses Arkiv's built-in expiresIn parameter
  • βœ… Batched Transactions: 2-second batching for efficiency
  • βœ… Performance Tracking: Real confirmation times from blockchain
  • βœ… Automatic Cleanup: Arkiv handles memory expiration natively

3. ⚠️ Real-time Subscriptions (DEMO MODE)

  • ⚠️ Local Simulation: In-memory callbacks for demo purposes
  • ⚠️ Single-Session: Works within one browser session
  • 🚧 Arkiv Integration: Planned for multi-user real-time collaboration
  • βœ… Event Persistence: Published events stored as Arkiv entities

4. 🚧 Advanced Queries (PLANNED)

  • 🚧 Semantic Search: Coming with Arkiv query capabilities
  • 🚧 Pattern Recognition: Planned advanced filtering
  • 🚧 Cross-Agent Queries: Multi-agent knowledge discovery
  • ⚠️ Basic Filtering: Currently returns empty results with warning

πŸ§ͺ Demo Scenarios

Mystery 1: The Vanishing Violin

  • Difficulty: Medium
  • Key Features: Pattern recognition, evidence correlation, red herring detection
  • TTL Showcase: False theories expire as new evidence emerges

Mystery 2: The Poisoned Professor

  • Difficulty: Hard
  • Key Features: Medical analysis, conspiracy detection, multi-agent collaboration
  • Demo Feature: Simulated real-time sharing of medical insights

Mystery 3: The Digital Ghost

  • Difficulty: Easy
  • Key Features: Technical analysis, insider threat detection
  • Blockchain Feature: Evidence stored as persistent Arkiv entities

🎯 Hackathon Success Criteria

Technical Excellence (40%)

  • βœ… CRUD + TTL (Real): Blockchain persistence with native expiration
  • ⚠️ Subscriptions (Demo): Local simulation for collaboration showcase
  • 🚧 Queries (Planned): Architecture ready for Arkiv query integration
  • βœ… Performance Monitoring: Real transaction metrics and batching
  • βœ… Developer Feedback: Honest assessment of Arkiv capabilities and limitations

Product Innovation (30%)

  • βœ… Genuine Problem: Solves AI's lack of persistent, collaborative memory
  • βœ… Compelling UX: Watch memories form, fade, and connect in real-time
  • βœ… Clear Applications: Enterprise AI, gaming, research, trading networks
  • βœ… Network Effects: Demonstrates collective intelligence emergence

Market Potential (30%)

  • βœ… Multi-Billion Market: AI agents, autonomous systems, decentralized intelligence
  • βœ… First-Mover Advantage: No existing decentralized AI memory solutions
  • βœ… Viral Potential: "AI agents with Alzheimer's and telepathy"
  • βœ… Clear Monetization: Platform approach with ecosystem opportunities

πŸ”§ Technical Stack

  • Frontend: Next.js 14 + TypeScript + Tailwind CSS
  • Real-time: Arkiv Subscriptions + WebSocket fallbacks
  • 3D Visualization: Three.js + React Three Fiber (stretch goal)
  • State Management: Zustand (lightweight and performant)
  • Deployment: Vercel (seamless Next.js integration)

πŸš€ Development Notes

Arkiv SDK Integration

The project uses @arkiv-network/sdk with the following pattern:

import { createClient, http } from '@arkiv-network/sdk';

export const arkivClient = createClient({
  transport: http('https://api.arkiv.network')
});

Mock Development Mode

For development without full Arkiv setup, the system includes a comprehensive mock client that simulates all four core features including TTL expiration.

Performance Optimizations

  • Lazy loading of agent responses for dramatic effect
  • Efficient memory querying with filters and limits
  • TTL cleanup processes running in background
  • Debounced subscription updates to prevent UI flooding

πŸŽ₯ Demo Video Script (2-3 minutes)

  1. Introduction (0:00-0:30): "Watch AI agents develop Alzheimer's and telepathy"
  2. Mystery Setup (0:30-0:45): Present the violin theft case
  3. Real-time Analysis (0:45-1:30): Show agents discovering and sharing clues
  4. Memory Evolution (1:30-2:00): Demonstrate TTL, conflicts, and resolution
  5. Collective Solution (2:00-2:30): The "aha!" moment when they solve it together

πŸ† Why This Will Win

  1. Technical Depth: Novel use of all Arkiv features with meaningful innovation
  2. Immediate Impact: Solves a fundamental AI limitation everyone can understand
  3. Perfect Demo: Visual, dramatic, and showcases all key concepts
  4. Market Ready: Clear path from demo to production applications
  5. Developer Value: Provides actionable feedback for Arkiv's evolution

πŸš€ Developer Impact

🌍 Global Accessibility

The create-arkiv-app package has transformed TIN from a hackathon demo into a global developer tool:

# Before: Complex setup, blockchain knowledge required
git clone ... && cd ... && npm install && configure...

# After: Instant AI agents in 30 seconds  
npx create-arkiv-app@latest my-ai-app

πŸ“ˆ Adoption Metrics

  • πŸ“¦ Live on npm: create-arkiv-app
  • πŸ”„ Zero friction: From idea to running AI agents instantly
  • 🌟 Developer experience: Beautiful CLI, comprehensive docs, production-ready
  • 🎯 Market ready: Perfect for hackathons, prototypes, production apps

πŸŽ‰ Try It Right Now

npx create-arkiv-app@latest test-arkiv-agents --template ai-agents

🀝 Contributing

This project demonstrates the future of AI memory management. Key areas for enhancement:

  • Additional agent types and personalities
  • More sophisticated TTL algorithms
  • 3D memory visualization with Three.js
  • Integration with major AI frameworks
  • Production-ready Arkiv deployment
  • New templates for the create-arkiv-app package

πŸ“„ License

MIT License - Built for the Arkiv Hackathon


"The future of AI isn't just about making machines smarter - it's about making them remember, forget, and collaborate like we do."

About

# 🧠 TIN (Temporal Intelligence Network)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published