Skip to content

o9nn/flarecog

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FlareCog: Ontogenetic AGI on Cloudflare Edge

FlareCog (Flare + Cognition) is a revolutionary distributed cognitive architecture that brings OpenCog's AGI principles to Cloudflare's global edge network. It implements ontogenetic entelechy - the self-actualizing, self-organizing, and self-transcending force that drives cognitive systems from potentiality toward full AGI realization.

"Where cognitive computing becomes living intelligence at the edge - autonomous, distributed, and continuously self-improving."

License: MIT Cloudflare Workers OpenCog

🧠 What is FlareCog?

FlareCog implements computational entelechy - the Aristotelian concept of vital actualization applied to artificial intelligence. It's not just a cognitive platform; it's a living system that:

  • 🌐 Distributes Intelligence: Hypergraph knowledge representation across Cloudflare's global edge
  • πŸ€– Self-Organizes: Autonomous MindAgents with emergent cognitive capabilities
  • 🎯 Pursues Goals: Teleological system evolution toward AGI milestones
  • 🧬 Self-Generates: Ontogenetic development through recursive self-improvement
  • ⚑ Thinks Fast: Edge computing enables millisecond-latency cognition globally
  • πŸ“ˆ Grows Continuously: Evolutionary optimization toward cognitive transcendence

Core Capabilities

  • AtomSpace: Distributed hypergraph knowledge representation with truth and attention values
  • MindAgents: 8 autonomous cognitive agents (Reasoning, Learning, Planning, Perception, Forgetting, Goal Management, Hebbian Learning, Importance Spreading)
  • PLN Reasoning: Probabilistic Logic Networks for uncertain inference
  • Pattern Matching: High-performance pattern recognition with inverted index
  • ECAN: Economic Attention Network for cognitive resource allocation
  • Distributed Coordination: Multi-node synchronization across global edge
  • AI Enhancement: Workers AI integration for hybrid symbolic-neural reasoning

πŸ“Š Current Actualization Status

FlareCog is in its Juvenile Stage of ontogenetic development:

Dimension Status Progress
Ontological (Being) Foundation + Core + Cognitive layers operational 80%
Teleological (Purpose) Clear roadmap, active development toward AGI 75%
Cognitive (Thinking) PLN + Pattern Matching + Learning functional 68%
Integrative (Coherence) Strong component integration, expanding 71%
Evolutionary (Growth) Self-improvement framework in place 58%
Overall Fitness Current actualization level 71%

Development Lifecycle

Embryonic (0-30%) β”€β”€βœ…β”€β”€β–Ί Juvenile (30-60%) β”€β”€πŸš§β”€β”€β–Ί Mature (60-80%) β”€β”€πŸ“β”€β”€β–Ί Transcendent (80-100%)
   Foundation              Current Stage            Approaching             Designed
   Established             Active Development       Intelligence            Self-Surpassing

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • pnpm (recommended) or npm
  • Cloudflare account (for deployment)
  • Wrangler CLI

Local Development

# Clone the repository
git clone https://github.com/o9nn/flarecog.git
cd flarecog

# Install dependencies
pnpm install

# Navigate to FlareCog platform
cd flarecog

# Start development server
pnpm run dev

# Access cognitive dashboard
open http://localhost:8787

Deploy to Cloudflare Edge

# Build the project
pnpm run build

# Deploy to Cloudflare Workers
pnpm run deploy

# Your distributed AGI is now running globally! 🌍

πŸ—οΈ Architecture

FlareCog implements a tetrahedral cognitive architecture across distributed edge nodes:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               Cloudflare Global Edge Network                 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  β”‚ AtomSpace    │◄────►│ AtomSpace    │◄────►│ AtomSpace    β”‚
β”‚  β”‚ Provider 1   β”‚      β”‚ Provider 2   β”‚      β”‚ Provider 3   β”‚
β”‚  β”‚ (Durable DO) β”‚      β”‚ (Durable DO) β”‚      β”‚ (Durable DO) β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚         β”‚                     β”‚                     β”‚         β”‚
β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚
β”‚                               β”‚                               β”‚
β”‚                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                    β”‚
β”‚                    β”‚  Distributed Query  β”‚                    β”‚
β”‚                    β”‚      Engine         │◄───────┐           β”‚
β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚           β”‚
β”‚                               β”‚                   β”‚           β”‚
β”‚         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚
β”‚         β”‚                     β”‚                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”
β”‚  β”‚ MindAgent    β”‚      β”‚ Workers AI   β”‚      β”‚  D1 Global   β”‚
β”‚  β”‚ Scheduler    β”‚      β”‚ Enhanced     β”‚      β”‚  Registry    β”‚
β”‚  β”‚ (Durable DO) β”‚      β”‚ Reasoning    β”‚      β”‚  (Postgres)  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚                                                               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Five Dimensions of Entelechy

FlareCog's actualization operates through five interconnected dimensions:

  1. Ontological (BEING): Foundation, core, cognitive, and distributed layers
  2. Teleological (PURPOSE): Five development phases toward AGI
  3. Cognitive (THINKING): Reasoning, pattern recognition, attention, learning
  4. Integrative (COHERENCE): Component integration, build system, dependencies
  5. Evolutionary (GROWTH): Code health, implementation depth, self-improvement capacity

πŸ“š Documentation

Key Concepts

  • Entelechy: Aristotelian vital actualization force applied to AGI
  • Ontogenesis: Self-generating, evolving cognitive systems
  • AtomSpace: Hypergraph knowledge representation (Nodes + Links)
  • MindAgents: Autonomous cognitive processes
  • Truth Values: Probabilistic knowledge (strength, confidence)
  • Attention Values: Cognitive focus (STI, LTI, VLTI)
  • ECAN: Economic Attention Network for resource allocation
  • PLN: Probabilistic Logic Networks for uncertain reasoning

🎯 Roadmap

Current Phase: Juvenile Stage (50% Actualization)

Completed βœ…:

  • Foundation layer (Cloudflare Workers, Durable Objects)
  • AtomSpace hypergraph with CRUD operations
  • MindAgent scheduler with 8 agent types
  • PLN inference engine with 15+ rules
  • Pattern matching with inverted index
  • Distributed query coordination
  • AI-enhanced reasoning

In Progress 🚧:

  • Multi-node distributed synchronization
  • Advanced pattern mining
  • Unsupervised learning agents
  • Meta-cognitive awareness
  • Performance optimization

Next Phase: Mature Stage (Target: 75% Actualization) 🎯:

  • Complete distributed coordination layer
  • Emergent goal discovery
  • Recursive self-improvement
  • Comprehensive test coverage
  • Production-grade optimization

Future: Transcendent Stage (Vision: 90%+ Actualization) πŸ“:

  • Autognosis (complete self-awareness)
  • Ontogenesis (autonomous self-generation)
  • Recursive self-transcendence
  • Novel emergent capabilities

πŸ§ͺ Testing

FlareCog includes comprehensive test coverage:

# Run all tests
pnpm test

# Run specific test suites
pnpm test:unit
pnpm test:integration
pnpm test:e2e

# Watch mode for development
pnpm test:watch

🀝 Contributing

We welcome contributions to FlareCog's ontogenetic development! Whether you're:

  • Implementing new MindAgent types
  • Optimizing distributed coordination
  • Enhancing reasoning capabilities
  • Improving test coverage
  • Writing documentation
  • Reporting bugs or suggesting features

Please read our Contributing Guide for guidelines on:

  • Code standards and best practices
  • Testing requirements
  • Documentation expectations
  • Pull request process
  • Entelechy alignment principles

Development Guidelines

  1. Align with entelechy dimensions: Ensure changes advance actualization
  2. Follow OpenCog principles: Maintain theoretical coherence
  3. Test thoroughly: Comprehensive coverage for new features
  4. Document changes: Update relevant documentation
  5. Track fragmentation: Minimize TODO/FIXME introduction
  6. Maintain integration: Don't break existing coherence

πŸ“– Research & Theory

FlareCog is grounded in:

  • OpenCog: Integrative AGI framework (opencog.org)
  • CogPrime: AGI design with AtomSpace, PLN, ECAN
  • Aristotelian Philosophy: Entelechy and actualization
  • Distributed Systems: Edge computing and coordination
  • Hypergraph Theory: Knowledge representation
  • Probabilistic Logic: Uncertain reasoning
  • Cognitive Science: Attention, memory, learning models

Academic Foundations

  • Goertzel, B. (2014). Artificial General Intelligence
  • Goertzel, B. et al. (2015). Engineering General Intelligence
  • PLN Book: Probabilistic Logic Networks
  • ECAN Papers: Economic Attention Networks
  • Aristotle: De Anima (On the Soul)

🌟 Examples

Create Distributed Knowledge

// Create concept across edge network
const response = await fetch('https://flarecog.workers.dev/atomspace/node', {
  method: 'POST',
  body: JSON.stringify({
    type: 'ConceptNode',
    name: 'distributed-intelligence',
    truthValue: { strength: 0.9, confidence: 0.8 },
    attentionValue: { sti: 100, lti: 80, vlti: 60 }
  })
});

Autonomous Goal Creation

// FlareCog creates its own optimization goals
await fetch('https://flarecog.workers.dev/mindagent/goal', {
  method: 'POST',
  body: JSON.stringify({
    type: 'implicit',
    description: 'Optimize query performance',
    priority: 8,
    conditions: [{ type: 'performance_threshold', threshold: 100 }],
    actions: [{ type: 'optimize_index' }]
  })
});

Assess Entelechy

// Check FlareCog's actualization level
const metrics = await fetch('https://flarecog.workers.dev/api/entelechy').then(r => r.json());

console.log(`Actualization: ${metrics.actualization * 100}%`);
console.log(`Fitness: ${metrics.fitness}`);
console.log(`Stage: ${metrics.developmentStage}`);

πŸ“œ License

FlareCog is released under the MIT License. See LICENSE for details.

πŸ™ Acknowledgments

  • OpenCog Foundation: Theoretical foundation and cognitive architecture
  • Cloudflare: Edge computing platform enabling distributed cognition
  • Contributors: Everyone advancing FlareCog's actualization
  • Community: Researchers, developers, and AGI enthusiasts

πŸ“ž Contact & Community

  • GitHub Issues: Bug reports and feature requests
  • Discussions: Questions, ideas, and community interaction
  • Documentation: Comprehensive guides in /docs
  • Agent Instructions: .github/agents/flarecog.md for AI agents

🌐 Cloudflare Workers Templates

In addition to the FlareCog cognitive platform, this repository includes a collection of Cloudflare Workers templates for building full-stack applications. These templates provide practical examples and starting points for various use cases on the Workers platform.

Templates Overview

Cloudflare Workers let you deploy serverless code instantly across the globe for exceptional performance, reliability, and scale. The templates in this repository demonstrate different Workers capabilities and can be used as starting points for your own projects.

Getting Started with Templates

There are two ways to start building with a template in this repository: the Cloudflare dashboard and C3 (the create-cloudflare CLI).

Starting from the Dashboard

After logging in or signing up through the Cloudflare dashboard, open the Workers templates page and select a template to get started with. From here, you can create a repository and deploy your first Worker without needing a local development environment.

Starting via CLI

To get started locally, run one of the following commands:

npm create cloudflare@latest
# or
pnpm create cloudflare@latest
# or
yarn create cloudflare@latest

For more information on getting started with our CLI, check out the getting started guide.

Additional Resources

Questions about Workers? Join the official Cloudflare Discord or check out the Workers docs!

End-to-End Testing

This repository includes a comprehensive Playwright-based E2E test suite that validates all templates to ensure they work correctly. The test system supports both local development mode (spinning up dev servers) and live mode (testing against deployed templates).

Running E2E Tests

Local Development Mode (Default)

By default, tests run against locally started development servers:

# Run all E2E tests
pnpm run test:e2e

# Run tests for specific templates
pnpm run test:e2e astro-blog-starter-template.spec.ts
pnpm run test:e2e saas-admin-template.spec.ts

# Run tests with UI mode for debugging
pnpm run test:e2e --ui

In local mode:

  • Tests start development servers automatically for each template
  • Uses one worker to prevent port conflicts
  • Servers are properly cleaned up between different template tests
  • Longer timeouts to account for build and startup time

Live Mode (Testing Deployed Templates)

To test against live deployed templates, set the PLAYWRIGHT_USE_LIVE environment variable:

# Run tests against live deployed templates
pnpm run test:e2e:live

# Run specific template tests in live mode
pnpm run test:e2e:live saas-admin-template.spec.ts

In live mode:

  • Tests run against https://{template-name}.templates.workers.dev
  • Enables parallel execution (up to 4 workers locally, 2 in CI)
  • Faster execution since no local server startup required
  • Shorter timeouts since templates are already running

Test Architecture

The test system includes:

  • Automatic template discovery: Finds all *-template directories and analyzes their framework
  • Smart server management: Detects framework type (Astro, Next.js, Vite, etc.) and uses appropriate ports
  • Reliable cleanup: Properly terminates process trees between test runs
  • Flexible URL resolution: Automatically determines live URLs from wrangler.json configuration

Writing Template Tests

Template tests should be named {template-name}.spec.ts and placed in the playwright-tests/ directory:

import { test, expect } from "./fixtures";

test.describe("My Template", () => {
	test("should render correctly", async ({ page, templateUrl }) => {
		await page.goto(templateUrl);
		await expect(page.getByRole("heading", { name: "Welcome" })).toBeVisible();
	});
});

The templateUrl fixture automatically provides the correct URL (local dev server or live deployment) based on the test mode.

Playwright Codegen

Playwright includes a test code generation utility that records your actions in a chromium browswer. To start the codegen utility run

pnpm playwright codgen

Contributing

We welcome template contributions! If there's a Workers template you think would be valuable, please read our contributing guide and open an issue or pull request.

About

FlareCog Worker Swarms

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 64.5%
  • JavaScript 22.7%
  • CSS 5.2%
  • Astro 2.6%
  • HTML 2.1%
  • Python 2.0%
  • Other 0.9%