ATCG-M Fractal Pattern: The Universal Bee Architecture

Abstraction Level: Level 2 (Cellular) — Internal nucleotide structure

Purpose: Demonstrate how EVERY Bee follows the same 5-nucleotide ATCG-M structure, achieving fractal self-similarity across the entire Hive.


The ATCG-M Invariant

According to FOUNDATION.md:27, every "Bee" (Service) MUST follow this fractal structure:

  • A (Aggregator): Collects senses/data

  • T (Transformer): Reasons via Ona (LLM/DSPy). Uses <think> blocks

  • C (Connector): Acts via Jules (Proteins/IO)

  • G (Generator): Pulses events to NATS

  • M (Membrane): Deterministic safety guards

This pattern repeats at every scale — from individual services to the entire Hive organism.


Fractal Self-Similarity: Three Examples

Example 1: bee-keeper (Autonomous Agent)

Location: agents/bee-keeper/src/hive/

spinner

Role: Architectural auditor. Watches for FOUNDATION.md violations and chronicles findings.

Trigger: GitHub Actions on git push

Output:

  • GitHub PR/commit comments (architectural violations)

  • NATS events (aura.hive.audit, aura.hive.injury)

  • HIVE_STATE.md operational log


Example 2: core-service (Sovereign Brain)

Location: core-service/src/hive/

spinner

Role: The Nucleus. Makes economic negotiation decisions using LLM-powered reasoning.

Trigger: gRPC NegotiateRequest from api-gateway

Output:

  • gRPC NegotiateResponse (accept/counter/reject/ui_required)

  • NATS events (negotiation outcomes for audit trail)

  • PostgreSQL state updates


Example 3: api-gateway (Hive Gate)

Location: api-gateway/src/ (implicit ATCG-M)

spinner

Role: The Hive Gate. Translates HTTP/JSON to gRPC/Protobuf and enforces perimeter security.

Trigger: HTTP requests from external agents

Output:

  • HTTP/JSON responses (translated from gRPC)

  • OpenTelemetry traces for observability

  • Structured logs for audit


Key Insight: Fractal Recursion

Notice that all three services have the same shape:

  1. M (in) validates inputs

  2. A senses the environment

  3. T applies reasoning

  4. M (out) enforces output constraints

  5. C takes action

  6. G chronicles the decision

This fractal pattern means:

  • New contributors can predict internal structure by knowing the ATCG-M invariant

  • Code reviewers can verify compliance by checking for all 5 nucleotides

  • The architecture scales — adding a new Bee just means implementing ATCG-M again


Implementation References

bee-keeper ATCG-M

  • A: agents/bee-keeper/src/hive/aggregator.pyBeeAggregator.sense() (implements Aggregator protocol)

  • T: agents/bee-keeper/src/hive/transformer.pyBeeTransformer.reflect() (implements Transformer protocol)

  • C: agents/bee-keeper/src/hive/connector.pyBeeConnector.act() (implements Connector protocol)

  • G: agents/bee-keeper/src/hive/generator.pyBeeGenerator.pulse() (implements Generator protocol)

  • M: Implicit in input validation (prompts, file access). Note: bee-keeper is an advisory-only service without economic decisions, so deterministic guards are minimal. Future enhancement: extract to explicit membrane.py for consistency.

core ATCG-M

  • A: core/src/hive/aggregator.py — Data collection layer

  • T: core/src/hive/transformer.py — LLM strategy layer

  • C: core/src/hive/connector.py — Database/gRPC action layer

  • G: core-service/src/hive/generator.py — Event emission layer

  • M: core-service/src/hive/membrane.pyExplicit dual-gate implementation

api-gateway ATCG-M

  • A: api-gateway/src/main.py — FastAPI endpoint handlers

  • T: Implicit in Protobuf message construction

  • C: gRPC client stubs (core_service_stub)

  • G: OpenTelemetry instrumentation

  • M: FastAPI middleware (rate limiting, auth)


Verification Checklist

When reviewing a new Bee, confirm it implements:

If any nucleotide is missing, the service is incomplete and violates FOUNDATION.md.


Relation to Canonical Architecture

This diagram implements the fractal pattern defined in:

  • docs/FOUNDATION.md lines 26-32 (ATCG-M definition)

  • packages/aura-core/src/aura_core/dna.py lines 147-202 (Protocol definitions)

  • Implemented in: agents/bee-keeper/, core-service/src/hive/, api-gateway/src/


End of ATCG-M Fractal Pattern Documentation

For the glory of the Hive. 🐝

Последнее обновление