# jmikedupont2/meta-meme architecture

> Architecture diagram of the GitHub repository jmikedupont2/meta-meme, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jmikedupont2/meta-meme
- Repository: https://github.com/jmikedupont2/meta-meme

## Overview

##### Project type and purpose
- Meta-Meme is an open-source, CLI-driven Python framework and library for collaborative human-AI creative exploration.
- It provides a core engine (metameme/metameme.py), a command-line interface (metameme/cli.py), and a collection of prompt examples, transformations, and documentation.

##### File structure
- Top-level “metameme/” directory: the core Python package (__init__.py, cli.py, metameme.py).
- “llms/” directory: organized subdirectories of prompt/example files for different language models.
- “examples/”: markdown demos.
- “docs/”: Sphinx documentation.
- “tests/”: unit tests for core functionality.

##### README insights
- Emphasis on human-AI collaboration, vector-based knowledge, pluggable tools (e.g., ToEmoji), community contributions.
- No external DB or GUI; persistence is file-based.
- Interfaces: CLI → core logic → LLM connectors (via API clients) and transform functions → file system for examples.

##### Main components and their interactions
a. User/CLI layer
- Entry point: `metameme/cli.py`
- Parses commands (e.g., generate, evolve, document) and passes arguments to core engine.
b. Core engine
- `metameme/metameme.py`: orchestrates workflows—loads prompt templates, invokes LLM connectors, applies transforms, writes outputs.
- Plugin points for new tools and connectors via Python entry points or config.
c. LLM Connector modules
- Implicit: code that calls external APIs (OpenAI, Bard, Claude, etc.) using prompt files under “llms/”.
d. Transformation tools
- Functions like ToEmoji that convert or enrich text.
e. Persistence layer
- File-system directories: “llms/” for prompt templates, “examples/” for demos, output artifacts written to project folders.
f. Supporting infrastructure
- Tests (pytest in “tests/”), documentation pipeline (Sphinx in “docs/”), CI/CD via Travis/GitHub Actions.

Relationships & Data Flow
User → CLI → Core Engine → (Select LLM Connector → External LLM Service)
↘ Transformation Tool
↘ File-system (read prompt templates, write results)
Tests import Core Engine and simulate CLI calls.
Docs read metadata from code and examples.

##### Architectural patterns & design principles
- Modular CLI + core library separation.
- Pluggable connectors and transformation plugins (open-closed principle).
- File-based configuration and template management.
- Lightweight, no centralized database (file-system acts as datastore).
- Clear layering: presentation (CLI) → application logic → external services → storage.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User and Presentation Layer
    User["User"]:::external
    CLI["CLI Layer\nmetameme/cli.py"]:::internal
    Init["Package Init\nmetameme/__init__.py"]:::internal

    %% Core and Plugins
    Core["Core Engine\nmetameme/metameme.py"]:::internal
    Connectors["LLM Connectors\nllms/"]:::plugin
    Transforms["Transformation Tools\n(e.g., ToEmoji)"]:::plugin

    %% Persistence Layer
    Templates["Prompt Templates\nllms/"]:::storage
    Examples["Example Demonstrations\nexamples/"]:::storage

    %% External Systems
    ExternalLLM["External LLM Service"]:::external

    %% Supporting Infrastructure
    Tests["Unit Tests\ntests/test_metameme.py"]:::pipeline
    Docs["Documentation Pipeline\ndocs/"]:::pipeline
    Starter["Starter Architecture Diagram\ndiagram.mermaid"]:::pipeline
    CI["CI/CD Workflows"]:::pipeline

    subgraph "Config & Packaging"
        Cookie["cookiecutter.json"]:::pipeline
        SetupPy["setup.py"]:::pipeline
        SetupCfg["setup.cfg"]:::pipeline
        ReqDev["requirements_dev.txt"]:::pipeline
        Tox["tox.ini"]:::pipeline
    end

    %% Relationships
    User -->|uses| CLI
    CLI -->|invokes| Core
    Init -.-> Core
    Core -->|loads| Templates
    Core -->|writes outputs| Examples
    Core -->|calls| Connectors
    Connectors -->|API call| ExternalLLM
    Core -->|applies| Transforms
    Tests -->|import & simulate| Core
    Docs -->|read metadata| Core
    Docs -->|read examples| Examples
    CI -->|runs tests & docs| Tests
    CI -->|deploys| Docs
    CI -->|validates config| Cookie

    %% Click Events
    click CLI "https://github.com/jmikedupont2/meta-meme/blob/main/metameme/cli.py"
    click Init "https://github.com/jmikedupont2/meta-meme/blob/main/metameme/__init__.py"
    click Core "https://github.com/jmikedupont2/meta-meme/blob/main/metameme/metameme.py"
    click Connectors "https://github.com/jmikedupont2/meta-meme/tree/main/llms/"
    click Templates "https://github.com/jmikedupont2/meta-meme/tree/main/llms/"
    click Examples "https://github.com/jmikedupont2/meta-meme/tree/main/examples/"
    click Tests "https://github.com/jmikedupont2/meta-meme/blob/main/tests/test_metameme.py"
    click Docs "https://github.com/jmikedupont2/meta-meme/tree/main/docs/"
    click Starter "https://github.com/jmikedupont2/meta-meme/blob/main/diagram.mermaid"
    click Cookie "https://github.com/jmikedupont2/meta-meme/blob/main/cookiecutter.json"
    click SetupPy "https://github.com/jmikedupont2/meta-meme/blob/main/setup.py"
    click SetupCfg "https://github.com/jmikedupont2/meta-meme/blob/main/setup.cfg"
    click ReqDev "https://github.com/jmikedupont2/meta-meme/blob/main/requirements_dev.txt"
    click Tox "https://github.com/jmikedupont2/meta-meme/blob/main/tox.ini"

    %% Styles
    classDef internal fill:#ffffff,stroke:#000000,stroke-width:1px;
    classDef external fill:#CCEEFF,stroke:#000000,stroke-width:1px;
    classDef storage fill:#FFEE99,stroke:#000000,stroke-width:1px;
    classDef plugin fill:#CCFFCC,stroke:#000000,stroke-width:1px;
    classDef pipeline fill:#EEEEEE,stroke:#000000,stroke-width:1px;
```
