Metadata-Version: 2.4
Name: llmggfu
Version: 0.3.0
Summary: Autonomous Product Foundry — opportunity discovery, prompt orchestration, identity management, application generation, compliance, marketing, launch, and continuous improvement
Author: alep
License: MIT
Project-URL: Homepage, https://pypi.org/project/llmggfu/
Project-URL: Documentation, https://pypi.org/project/llmggfu/
Project-URL: Repository, https://github.com/alep/llmggfu
Project-URL: Issues, https://github.com/alep/llmggfu/issues
Keywords: llm,automation,product,foundry,prompt,genome,pipeline,orchestration,mcp,sdk,adk
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Code Generators
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: cryptography>=42.0.0
Provides-Extra: test
Requires-Dist: pytest>=7.0; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Provides-Extra: api
Requires-Dist: fastapi>=0.100; extra == "api"
Requires-Dist: uvicorn>=0.20; extra == "api"
Requires-Dist: pydantic>=2.0; extra == "api"
Provides-Extra: llm
Provides-Extra: all
Requires-Dist: fastapi>=0.100; extra == "all"
Requires-Dist: uvicorn>=0.20; extra == "all"
Requires-Dist: pydantic>=2.0; extra == "all"
Requires-Dist: pytest>=7.0; extra == "all"
Requires-Dist: pytest-cov; extra == "all"

# llmggfu — Autonomous Product Foundry

[![PyPI version](https://badge.fury.io/py/llmggfu.svg)](https://pypi.org/project/llmggfu/)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![Tests](https://img.shields.io/badge/tests-passing-brightgreen.svg)](#tests)

> Transform incomplete ideas into production-ready applications — autonomously.

`llmggfu` implements a 25-step pipeline that takes a problem statement and produces a launched product, complete with research, compliance review, marketing materials, and performance tracking.

## Architecture

```
┌─────────────────────────────────────────────────────────────┐
│                    Foundry (main)                           │
├─────────────────────────────────────────────────────────────┤
│  SDK · ADK · MCP Server · REST API · Hooks · Plugins       │
├─────────────────────────────────────────────────────────────┤
│  Research    Prompt     Ambient    User      Identity      │
│  Engine      Genome     Intent     Account   Wallet        │
│  Credential  Registra-  Opportu-  Product   Compliance     │
│  Store       tion       nity      Generator  Engine        │
│  Marketing   Witness    Evolution  Pipeline                 │
│  System      Network    Engine     Orchestrator             │
├─────────────────────────────────────────────────────────────┤
│  Crypto (AES-256-GCM) · Logger · DB (JSON / SQLite)       │
├─────────────────────────────────────────────────────────────┤
│  LLM: OpenAI · Anthropic · Gemini · Mock                   │
└─────────────────────────────────────────────────────────────┘
```

## Installation

```bash
pip install llmggfu

# With REST API
pip install "llmggfu[api]"

# With LLM providers
pip install "llmggfu[llm]"

# Everything
pip install "llmggfu[all]"

# Development
pip install "llmggfu[dev]"
```

## Quick Start

```python
from llmggfu.sdk import FoundrySDK

sdk = FoundrySDK()

result = (
    sdk.create_opportunity(
        problem="Developers need API monitoring",
        target_user="Indie developers",
        market_need="Affordable monitoring",
        competitive_gap="No affordable option",
        proposed_product="API Monitor",
        technical_approach="FastAPI + SQLite",
        estimated_complexity="low",
        distribution_plan="Product Hunt",
        monetization_model="Freemium $9/mo",
        risk_assessment="Low",
        prototype_path="FastAPI",
        launch_path="PH + HN",
    )
    .generate_variants(tech_stack=["Python", "FastAPI"])
    .select_recommended()
    .run_pipeline()
    .result()
)

print(f"Status: {result['status']}")
print(f"Project: {result['project'].name}")
```

## SDK — High-Level API

```python
# Users
user = sdk.create_user(name="Alice", email="alice@example.com")

# Opportunities
opps = sdk.list_opportunities(status="prepared")
ranked = sdk.rank_opportunities(limit=5)

# Pipeline
run = sdk.start_pipeline("opp_abc123")
run = sdk.run_pipeline(run.id)
sdk.pause_pipeline(run.id)
sdk.resume_pipeline(run.id)

# Projects
projects = sdk.list_projects(status="launched")
sdk.launch_project("proj_xyz")

# Compliance
review = sdk.review_compliance("proj_xyz")

# Research
prior_art = sdk.assess_prior_art("API monitoring")

# Prompt Genome
entry = sdk.create_prompt("Research", "Market research", "internal", "Research {{topic}}")
ranked = sdk.rank_prompts(metric="reliability")

# Identity & Credentials
sdk.init_wallet("user_123")
sdk.add_identity("user_123", "contact", "email", {"value": "alice@example.com"})
sdk.store_credential("stripe", "api_key", "sk_test_...", "secret")

# Witnesses & Metrics
sdk.register_witness("proj_xyz", "Bob", "bob@example.com", "v0.1.0")
sdk.record_metrics("proj_xyz", activation=0.3, retention=0.8, revenue=1200)
```

## ADK — Agent Development Kit

```python
from llmggfu.adk import AgentSwarm, ResearchAgent, OpportunityAgent, PipelineAgent, ComplianceAgent

swarm = AgentSwarm(sdk)
swarm.add(ResearchAgent(sdk))
swarm.add(OpportunityAgent(sdk))
swarm.add(PipelineAgent(sdk))
swarm.add(ComplianceAgent(sdk))

results = swarm.run_pipeline_flow("API monitoring", target_user="Indie devs", ...)

# Custom agent
from llmggfu.adk import Agent, AgentRole

class MyAgent(Agent):
    role = AgentRole.CUSTOM
    def _execute_impl(self, task, **ctx):
        return f"Handled: {task}"
```

## MCP Server

```bash
llmggfu-mcp          # CLI
python -m llmggfu.mcp_server  # Python
```

15 tools: `list_opportunities`, `create_opportunity`, `start_pipeline`, `run_pipeline`, `review_compliance`, `assess_prior_art`, `create_prompt`, `launch_project`, `register_witness`, `record_metrics`, `analyze_performance`, etc.

## REST API

```bash
pip install "llmggfu[api]"
llmggfu-api --port 8000
```

Endpoints: `GET/POST /api/opportunities`, `POST /api/pipeline/start`, `POST /api/pipeline/run`, `GET /api/projects`, `POST /api/compliance/review`, `GET /api/research/{topic}`, etc.

## Hooks — Event System

```python
from llmggfu.hooks import HookSystem, HookEvent

hooks = HookSystem()

@hooks.on(HookEvent.PIPELINE_COMPLETED, webhook="https://example.com/hook")
def on_complete(run_id, **ctx):
    print(f"Pipeline {run_id} done!")
```

20 events: `pipeline.started/completed/failed/paused/resumed`, `step.completed/failed`, `opportunity.created/selected`, `project.launched`, `compliance.reviewed`, `witness.registered`, `metrics.recorded`, etc.

## LLM Providers

```python
from llmggfu.llm import LLMManager, OpenAIProvider, AnthropicProvider, GeminiProvider

manager = LLMManager.from_config(sdk.foundry.config)
response = manager.complete("Research API monitoring", system="You are a research assistant.")
```

Supports OpenAI, Anthropic, Gemini, and Mock providers. Auto-detected from config.

## Plugins

```python
from llmggfu.plugins import PluginManager

plugins = PluginManager(sdk)

@plugins.step("custom_analysis")
def custom_step(run, opp):
    return "Custom analysis complete"

@plugins.hook(HookEvent.PIPELINE_COMPLETED)
def on_complete(run_id, **ctx):
    send_notification(run_id)
```

## Configuration

```yaml
# foundry.yaml
db:
  path: ./data/foundry.db
  backend: sqlite          # sqlite or json
llm:
  provider: openai
  api_key: ${LLM_API_KEY}
  model: gpt-4o-mini
wallet:
  encryption_key: ${WALLET_ENCRYPTION_KEY}
log:
  level: info
```

```python
from llmggfu.config import load_config
config = load_config("foundry.yaml")
sdk = FoundrySDK(config)
```

Environment variables: `FOUNDRY_DB_PATH`, `FOUNDRY_DB_BACKEND`, `FOUNDRY_LLM_PROVIDER`, `FOUNDRY_LLM_API_KEY`, `FOUNDRY_LLM_MODEL`, `FOUNDRY_WALLET_ENCRYPTION_KEY`, `FOUNDRY_LOG_LEVEL`.

## Storage Backends

```python
# JSON files (default)
from llmggfu.db import FoundryDB
db = FoundryDB("./data/foundry.db")

# SQLite
from llmggfu.sqlite_db import SQLiteDB
db = SQLiteDB("./data/foundry.db")

# In-memory
db = FoundryDB(":memory:")
db = SQLiteDB(":memory:")
```

## Async Pipeline

```python
import asyncio
run = sdk.start_pipeline("opp_abc123")
result = asyncio.run(sdk.run_pipeline_async(run.id))
```

## Docker

```bash
docker build -t llmggfu .
docker run -p 8000:8000 llmggfu
```

## Web Dashboard

```bash
llmggfu-dashboard --port 3000
```

Real-time pipeline visualization.

## 25-Step Pipeline

| # | Step | Description |
|---|------|-------------|
| 1 | `research_prior_art` | Assess existing solutions |
| 2 | `identify_unmet_need` | Define the gap |
| 3 | `define_target_user` | Profile target audience |
| 4 | `assess_market_value` | Score the opportunity |
| 5 | `generate_product_variations` | Create product variants |
| 6 | `select_strongest_direction` | Pick best variant |
| 7 | `define_technical_architecture` | Design the system |
| 8 | `identify_required_services` | List external services |
| 9 | `create_or_connect_accounts` | Prepare registrations |
| 10 | `generate_prototype` | Build the prototype |
| 11 | `test_functionality` | Run smoke tests |
| 12 | `review_security` | Security audit |
| 13 | `review_privacy` | Privacy check |
| 14 | `review_licensing` | License compliance |
| 15 | `review_platform_compliance` | Platform ToS |
| 16 | `generate_documentation` | Write docs |
| 17 | `capture_demonstrations` | Record demos |
| 18 | `create_landing_page` | Build landing page |
| 19 | `create_marketing_assets` | Marketing materials |
| 20 | `prepare_launch_materials` | Launch prep |
| 21 | `publish_through_channels` | Go live |
| 22 | `measure_performance` | Track metrics |
| 23 | `improve_product` | Analyze & improve |
| 24 | `reuse_successful_components` | Extract reusable parts |
| 25 | `add_learnings_to_prompt_genome` | Update prompt library |

## Security

- **AES-256-GCM** encryption for sensitive data at rest
- **PBKDF2** key derivation (100k iterations)
- **Granular sharing** with field-level permission scopes
- **Audit logging** for every read, write, share, revoke
- **Sensitive data filtering** — emails, phones, cards, SSNs redacted
- **Human verification** — pauses for CAPTCHA, biometrics, legal terms

## Tests

```bash
pip install "llmggfu[test]"
python -m pytest -v
```

## Subsystems

| Subsystem | Description |
|-----------|-------------|
| Research Engine | Prior-art research and market intelligence |
| Prompt Genome | Reusable prompt library with natural selection |
| Ambient Intent Capture | Intent extraction from user-approved input |
| User Account Manager | Persistent profiles, memory, permissions |
| Identity Wallet | Encrypted identity storage with granular sharing |
| Credential Store | Secure credential management with audit logging |
| Registration Agent | Autonomous account registration |
| Opportunity Pipeline | Prepared opportunities with variant generation |
| Product Generator | Autonomous product creation |
| Compliance Engine | 10-point compliance review |
| Marketing System | Pre-launch and launch materials |
| Witness Network | Early observer participation tracking |
| Evolution Engine | Performance tracking and improvement |
| Pipeline Orchestrator | 25-step autonomous pipeline |

## License

MIT
