Upload folder using huggingface_hub
Browse files- knowledge/advanced_agents.md +33 -0
- knowledge/agent_prototypes.md +33 -0
- knowledge/agents.md +16 -0
- knowledge/api_wizard.md +15 -0
- knowledge/book_writer.md +13 -0
- knowledge/domain_router.md +12 -0
- knowledge/formatting.md +15 -0
- knowledge/generation.md +12 -0
- knowledge/hostinger_hosting.md +18 -0
- knowledge/intro.md +8 -0
- knowledge/market_research.md +17 -0
- knowledge/meta_agent.md +22 -0
- knowledge/openai_integration.md +22 -0
- knowledge/publishing.md +12 -0
- knowledge/sales_marketing.md +24 -0
- knowledge/supabase_integration.md +21 -0
- knowledge/webhooks.md +13 -0
knowledge/advanced_agents.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# KB: Advanced Agent Prototypes (Phase 2)
|
| 2 |
+
|
| 3 |
+
This module documents the second wave of advanced agents implemented for the EbookBuilder ecosystem.
|
| 4 |
+
|
| 5 |
+
## 1. Global Localization Agent
|
| 6 |
+
- **Function**: `localize_content`
|
| 7 |
+
- **Role**: High-fidelity translation and cultural adaptation.
|
| 8 |
+
- **Use Case**: Expanding book distribution to non-English speaking markets.
|
| 9 |
+
|
| 10 |
+
## 2. Legal & Copyright Guard
|
| 11 |
+
- **Function**: `legal_copyright_scan`
|
| 12 |
+
- **Role**: Intellectual property protection and plagiarism detection.
|
| 13 |
+
- **Use Case**: Pre-publishing compliance check and licensing generation.
|
| 14 |
+
|
| 15 |
+
## 3. Interactive Companion Agent
|
| 16 |
+
- **Function**: `create_character_companion`
|
| 17 |
+
- **Role**: Deploys interactive character chatbots to Hugging Face Spaces.
|
| 18 |
+
- **Use Case**: Marketing and community engagement via interactive lore.
|
| 19 |
+
|
| 20 |
+
## 4. Sentiment & Beta-Reader Analyst
|
| 21 |
+
- **Function**: `analyze_reader_sentiment`
|
| 22 |
+
- **Role**: Data-driven analysis of emotional impact and narrative pacing.
|
| 23 |
+
- **Use Case**: Iterative editing based on reader feedback.
|
| 24 |
+
|
| 25 |
+
## 5. Accessibility & Universal Design
|
| 26 |
+
- **Function**: `optimize_accessibility`
|
| 27 |
+
- **Role**: Ensures WCAG compliance and dyslexia-friendly formatting.
|
| 28 |
+
- **Use Case**: Preparing ebooks for institutional and library distribution.
|
| 29 |
+
|
| 30 |
+
## 6. Plot Continuity & Sequel Architect
|
| 31 |
+
- **Function**: `build_continuity_graph`
|
| 32 |
+
- **Role**: Narrative mapping and conflict detection across series.
|
| 33 |
+
- **Use Case**: Maintaining a "Series Bible" for complex, multi-volume works.
|
knowledge/agent_prototypes.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# KB: Agent Prototypes & Multi-Agent Workflows
|
| 2 |
+
|
| 3 |
+
This module documents the prototype agents implemented in the EbookBuilder MCP server.
|
| 4 |
+
|
| 5 |
+
## 1. Research & Fact-Checker
|
| 6 |
+
- **Function**: `fact_check_text`
|
| 7 |
+
- **Role**: Validates claims and provides citations.
|
| 8 |
+
- **Usage**: Call this after generating a non-fiction chapter or a historically accurate scene.
|
| 9 |
+
|
| 10 |
+
## 2. Multi-Modal Illustrator
|
| 11 |
+
- **Function**: `generate_illustration_prompt`
|
| 12 |
+
- **Role**: Translates narrative descriptions into visual prompts for image generation.
|
| 13 |
+
- **Usage**: Automates the creation of internal book art and covers.
|
| 14 |
+
|
| 15 |
+
## 3. Audiobook (TTS) Synthesis
|
| 16 |
+
- **Function**: `synthesize_audiobook_chapter`
|
| 17 |
+
- **Role**: Queues text for conversion to speech using Parler-TTS or ElevenLabs.
|
| 18 |
+
- **Usage**: Used to create multi-format releases (Ebook + Audiobook).
|
| 19 |
+
|
| 20 |
+
## 4. Marketing & Metadata
|
| 21 |
+
- **Function**: `generate_marketing_package`
|
| 22 |
+
- **Role**: Creates sales blurbs, social media campaigns, and SEO tags.
|
| 23 |
+
- **Usage**: Call during the final "Publishing" phase.
|
| 24 |
+
|
| 25 |
+
## 5. Token & Cost Auditor
|
| 26 |
+
- **Function**: `audit_project_costs`
|
| 27 |
+
- **Role**: Monitors infrastructure spend and token consumption.
|
| 28 |
+
- **Usage**: Run at the end of each work session to track project budget.
|
| 29 |
+
|
| 30 |
+
## 6. Human-in-the-Loop Review
|
| 31 |
+
- **Function**: `request_human_review`
|
| 32 |
+
- **Role**: Creates a checkpoint that requires manual approval before proceeding.
|
| 33 |
+
- **Usage**: Critical for maintaining authorial quality control.
|
knowledge/agents.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# KB: Agent Orchestration & Autonomy
|
| 2 |
+
|
| 3 |
+
In the EbookBuilder ecosystem, "Agents" are autonomous units of logic that collaborate to solve complex problems.
|
| 4 |
+
|
| 5 |
+
## Types of Agents
|
| 6 |
+
1. **Manager Agent**: Coordinates the high-level plan (The "Director").
|
| 7 |
+
2. **Worker Agents**: Specialize in narrow tasks like "Cover Design" or "Markdown Linting".
|
| 8 |
+
3. **Validation Agents**: Verify the output of worker agents against a set of rubrics.
|
| 9 |
+
|
| 10 |
+
## Orchestration Patterns
|
| 11 |
+
- **Sequential**: Agent A finishes, then Agent B starts (e.g., Draft -> Edit).
|
| 12 |
+
- **Parallel**: Multiple agents work on different chapters simultaneously.
|
| 13 |
+
- **Hierarchical**: A manager agent delegates sub-tasks to subordinate agents and aggregates the results.
|
| 14 |
+
|
| 15 |
+
## MCP Integration
|
| 16 |
+
Agents communicate via the **Model Context Protocol**, allowing them to share tools and resources (like the Hugging Face Hub) seamlessly.
|
knowledge/api_wizard.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# KB: API Wizard MCP Server
|
| 2 |
+
|
| 3 |
+
The **API Wizard** is a specialized agent role designed to automate the lifecycle of API integration within an MCP (Model Context Protocol) environment.
|
| 4 |
+
|
| 5 |
+
## Capabilities
|
| 6 |
+
- **Schema Analysis**: Automatically parses OpenAPI/Swagger specifications.
|
| 7 |
+
- **Tool Generation**: Dynamically creates MCP tool definitions from endpoint descriptions.
|
| 8 |
+
- **Authentication Handling**: Manages headers, tokens, and OAuth2 flows securely.
|
| 9 |
+
- **Error Mapping**: Translates complex API error codes into human-readable debugging hints for the LLM.
|
| 10 |
+
|
| 11 |
+
## Workflow
|
| 12 |
+
1. **Discovery**: Point the Wizard at a URL or JSON schema.
|
| 13 |
+
2. **Drafting**: The Wizard proposes a set of tool definitions (name, description, input schema).
|
| 14 |
+
3. **Validation**: Testing the generated tools against a sandbox environment.
|
| 15 |
+
4. **Deployment**: Exporting the configuration to the `mcpServers` section of the agent config.
|
knowledge/book_writer.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# KB: Book Writer Agent
|
| 2 |
+
|
| 3 |
+
The **Book Writer Agent** is the core creative engine. It transforms outlines into prose while adhering to specific stylistic guidelines.
|
| 4 |
+
|
| 5 |
+
## Responsibilities
|
| 6 |
+
- **Drafting**: Writing long-form content based on chapter briefs.
|
| 7 |
+
- **Tone Consistency**: Ensuring the voice remains stable across 50,000+ words.
|
| 8 |
+
- **Character Tracking**: Maintaining a "World Bible" dataset to avoid continuity errors (e.g., eye color changes or teleporting characters).
|
| 9 |
+
|
| 10 |
+
## Tools Used
|
| 11 |
+
- **Knowledge Base Query**: Accessing research modules to ensure factual accuracy in non-fiction or internal consistency in fiction.
|
| 12 |
+
- **Memory Buffer**: A rolling window of previous chapter summaries.
|
| 13 |
+
- **Critique Loop**: A secondary "Editor" pass to identify and fix repetitive phrasing or pacing issues.
|
knowledge/domain_router.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# KB: Domain Router
|
| 2 |
+
|
| 3 |
+
The **Domain Router** is the traffic controller of the EbookBuilder ecosystem, responsible for directing requests to the correct agent or service based on the context of the task.
|
| 4 |
+
|
| 5 |
+
## Functions
|
| 6 |
+
- **Contextual Routing**: Analyzes incoming user prompts to determine if they need a "Creative Writer", an "API Wizard", or a "Technical Editor".
|
| 7 |
+
- **Multi-Tenant Support**: Maps custom subdomains (e.g., `user-1.ebookbuilder.com`) to specific Hugging Face Space instances.
|
| 8 |
+
- **Load Balancing**: Distributes heavy generation tasks across multiple backend model endpoints to maintain responsiveness.
|
| 9 |
+
|
| 10 |
+
## Architecture
|
| 11 |
+
- **Layer 7 Routing**: Operates at the application level to inspect headers and path parameters.
|
| 12 |
+
- **Failover Logic**: If a specific model provider is down, the router automatically switches to a fallback (e.g., switching from Vertex AI to Hugging Face Inference Endpoints).
|
knowledge/formatting.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EbookBuilder: Formatting & Conversion
|
| 2 |
+
|
| 3 |
+
Once content is generated, it must be transformed into a reader-ready format.
|
| 4 |
+
|
| 5 |
+
## Standard Structure
|
| 6 |
+
- `metadata.yaml`: Contains title, author, and CSS paths.
|
| 7 |
+
- `chapters/`: Individual markdown files.
|
| 8 |
+
- `assets/`: Images and fonts.
|
| 9 |
+
|
| 10 |
+
## Conversion Tools
|
| 11 |
+
- **Pandoc**: The "Swiss army knife" of document conversion. Use it to go from Markdown to EPUB or PDF.
|
| 12 |
+
- **KindleGen**: For final MOBI/AZW3 optimization.
|
| 13 |
+
|
| 14 |
+
## Visuals
|
| 15 |
+
- Use **FLUX.1** or **Stable Diffusion XL** for cover art and internal illustrations.
|
knowledge/generation.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EbookBuilder: Content Generation
|
| 2 |
+
|
| 3 |
+
The generation module focuses on producing coherent and engaging text.
|
| 4 |
+
|
| 5 |
+
## Strategies
|
| 6 |
+
1. **Recursive Outlining**: Generate a high-level outline, then expand each point into sub-points before drafting.
|
| 7 |
+
2. **Context Window Management**: Pass previous chapter summaries to the model to ensure narrative consistency.
|
| 8 |
+
3. **Style Injection**: Use system instructions to enforce specific literary styles or technical tones.
|
| 9 |
+
|
| 10 |
+
## Recommended Models
|
| 11 |
+
- **General Purpose**: Llama-3-70B, Qwen-2.5.
|
| 12 |
+
- **Creative Writing**: Claude-3.5-Sonnet (via API) or specialized fine-tuned models on HF.
|
knowledge/hostinger_hosting.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# KB: Hostinger Hosting & Deployment
|
| 2 |
+
|
| 3 |
+
The **Hostinger Agent** handles the final mile of the ebook project: securing a domain and hosting the sales pages and companion apps.
|
| 4 |
+
|
| 5 |
+
## Core Capabilities
|
| 6 |
+
- **Account Usage**: Monitoring hosting resources via `hostinger_get_account_info`.
|
| 7 |
+
- **Domain Management**: Listing and verifying owned domains with `hostinger_list_domains`.
|
| 8 |
+
- **DNS Configuration**: Using `hostinger_add_dns_record` to point domains to sales pages (e.g., A records) or verify ownership for external services (e.g., TXT records for Stripe/Google).
|
| 9 |
+
- **Automated Deployment**: Using `hostinger_deploy_static_site` to push the sales page copy generated by the Sales Page Agent directly to the web.
|
| 10 |
+
|
| 11 |
+
## Workflow Integration
|
| 12 |
+
1. **Purchase**: The user buys a domain on Hostinger.
|
| 13 |
+
2. **Setup**: The Hostinger Agent adds necessary DNS records for SSL and CDN.
|
| 14 |
+
3. **Draft**: The Sales Page Agent creates the high-converting copy.
|
| 15 |
+
4. **Publish**: The Hostinger Agent deploys the copy to the domain's `public_html` directory.
|
| 16 |
+
|
| 17 |
+
## Connection
|
| 18 |
+
The agent uses the `HOSTINGER_API_KEY` for secure, authenticated REST API requests to the Hostinger backend.
|
knowledge/intro.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EbookBuilder: Introduction
|
| 2 |
+
|
| 3 |
+
EbookBuilder is an automated system for creating high-quality ebooks using Artificial Intelligence. By leveraging the Hugging Face ecosystem, it streamlines the process from initial outline to final publication.
|
| 4 |
+
|
| 5 |
+
## Core Philosophy
|
| 6 |
+
- **Automation with Oversight**: AI handles the bulk of content creation, while the author provides direction and refinement.
|
| 7 |
+
- **Portability**: Content is maintained in Markdown for maximum compatibility.
|
| 8 |
+
- **Scalability**: High-performance models on Hugging Face ensure that even complex, multi-volume projects are handled efficiently.
|
knowledge/market_research.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# KB: Market Research Agent
|
| 2 |
+
|
| 3 |
+
The **Market Research Agent** is designed to provide authors and publishers with data-driven insights into specific book niches and market trends.
|
| 4 |
+
|
| 5 |
+
## Core Capabilities
|
| 6 |
+
- **Trend Identification**: Analyzes current high-performing topics and sub-genres.
|
| 7 |
+
- **Competitive Intelligence**: Evaluates successful titles in the same niche (pricing, covers, blurbs).
|
| 8 |
+
- **Audience Profiling**: Defines the ideal reader, their demographics, and their motivations.
|
| 9 |
+
- **Keyword Optimization**: Suggests high-traffic keywords for Amazon (KDP) and Google Search.
|
| 10 |
+
|
| 11 |
+
## Workflow Integration
|
| 12 |
+
The Market Research Agent should be called at the very beginning of a project (The "Discovery Phase") and periodically during the writing process to ensure the book remains commercially viable.
|
| 13 |
+
|
| 14 |
+
## Tool Function
|
| 15 |
+
- **Function**: `perform_market_research(niche: str)`
|
| 16 |
+
- **Output**: A comprehensive report covering trends, competitors, audience, and keywords.
|
| 17 |
+
- **AI Engine**: Powered by Llama-3-8B-Instruct for high-fidelity market analysis.
|
knowledge/meta_agent.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# KB: Meta Orchestrator & System Upgrades
|
| 2 |
+
|
| 3 |
+
This module documents the upgrade of the EbookBuilder agents from static prototypes to dynamic, Inference-powered tools, and the introduction of the **Meta Orchestrator**.
|
| 4 |
+
|
| 5 |
+
## 1. The Meta Orchestrator (Meta Agent)
|
| 6 |
+
- **Function**: `meta_orchestrator`
|
| 7 |
+
- **Role**: The "Brain" of the system. It takes high-level user goals and decomposes them into specific tool calls.
|
| 8 |
+
- **Workflow**:
|
| 9 |
+
1. Analyze user intent.
|
| 10 |
+
2. Map intent to the 12+ specialized tools.
|
| 11 |
+
3. Suggest a sequence of execution.
|
| 12 |
+
|
| 13 |
+
## 2. Upgraded AI Capabilities
|
| 14 |
+
All specialized agents now use the **Hugging Face Inference API** (via `InferenceClient`) for real-time processing:
|
| 15 |
+
- **Llama-3 Integration**: Powers the Meta Agent, Fact-Checker, Illustrator, and Legal Guard for complex reasoning.
|
| 16 |
+
- **DistilBERT Integration**: Powers the Sentiment Analyst for high-speed text classification.
|
| 17 |
+
- **Style-Preserving Translation**: Uses state-of-the-art models for the Localization Agent.
|
| 18 |
+
|
| 19 |
+
## 3. Operational Benefits
|
| 20 |
+
- **Real-Time Results**: No longer returns "mock" data; tools now provide actual AI-generated insights.
|
| 21 |
+
- **Scalability**: Tasks are offloaded to Hugging Face's global inference infrastructure.
|
| 22 |
+
- **Intelligence**: The Meta Agent ensures that complex requests (e.g., "Translate my book and generate a marketing plan for it") are handled with logical consistency.
|
knowledge/openai_integration.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# KB: OpenAI Integration & Hybrid AI
|
| 2 |
+
|
| 3 |
+
The EbookBuilder system now supports a hybrid AI architecture, combining the open-source power of Hugging Face with the advanced reasoning and generative capabilities of OpenAI.
|
| 4 |
+
|
| 5 |
+
## 1. GPT-4o Integration
|
| 6 |
+
- **Function**: `generate_content_openai`
|
| 7 |
+
- **Role**: High-fidelity drafting, complex character development, and intricate plot planning.
|
| 8 |
+
- **Why**: Use GPT-4o for tasks that require the highest level of linguistic nuance or multi-step logic.
|
| 9 |
+
|
| 10 |
+
## 2. DALL-E 3 Integration
|
| 11 |
+
- **Function**: `generate_image_dalle`
|
| 12 |
+
- **Role**: Premium cover design and photorealistic internal illustrations.
|
| 13 |
+
- **Why**: DALL-E 3 excels at following complex visual instructions and embedding text into images.
|
| 14 |
+
|
| 15 |
+
## 3. Hybrid Orchestration
|
| 16 |
+
The **Meta Orchestrator** has been upgraded to route tasks dynamically between HF and OpenAI based on the requirements:
|
| 17 |
+
- **Research/Fact-Checking**: Handled by Llama-3 (HF).
|
| 18 |
+
- **Prose/Creativity**: Handled by GPT-4o (OpenAI).
|
| 19 |
+
- **Marketing/Commerce**: Handled by Llama-3 (HF).
|
| 20 |
+
|
| 21 |
+
## Setup
|
| 22 |
+
To use these features, ensure the `OPENAI_API_KEY` environment variable is set in your session.
|
knowledge/publishing.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EbookBuilder: Publishing & Distribution
|
| 2 |
+
|
| 3 |
+
Getting your book into the hands of readers.
|
| 4 |
+
|
| 5 |
+
## Platforms
|
| 6 |
+
1. **Amazon KDP**: The primary marketplace for self-published authors.
|
| 7 |
+
2. **Leanpub**: Excellent for technical books and "work-in-progress" publishing.
|
| 8 |
+
3. **Gumroad/Koji**: For direct-to-reader sales.
|
| 9 |
+
|
| 10 |
+
## Hugging Face Integration
|
| 11 |
+
- **Spaces**: Create a demo or a "reader" app for your book.
|
| 12 |
+
- **Datasets**: Host the raw text and training data if the book is an open-source project.
|
knowledge/sales_marketing.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# KB: Sales, Marketing & Payments
|
| 2 |
+
|
| 3 |
+
This module documents the agents responsible for the commercial success of your ebook, focusing on traffic generation, conversion, and monetization.
|
| 4 |
+
|
| 5 |
+
## 1. The Blogger Agent
|
| 6 |
+
- **Function**: `generate_blog_post`
|
| 7 |
+
- **Role**: Content marketer and SEO specialist.
|
| 8 |
+
- **Workflow**: Creates long-form educational or entertaining content that provides value to the reader while positioning your ebook as the logical "next step."
|
| 9 |
+
|
| 10 |
+
## 2. The Sales Page Agent
|
| 11 |
+
- **Function**: `create_sales_page`
|
| 12 |
+
- **Role**: Conversion rate optimization (CRO) specialist.
|
| 13 |
+
- **Workflow**: Uses psychological triggers (scarcity, social proof, benefit-driven headlines) to draft landing page copy that turns visitors into buyers.
|
| 14 |
+
|
| 15 |
+
## 3. The Stripe Integration Agent
|
| 16 |
+
- **Function**: `setup_stripe_payment`
|
| 17 |
+
- **Role**: Financial architect.
|
| 18 |
+
- **Workflow**: Generates the exact technical configuration required to securely accept payments via Stripe Checkout, including product metadata and price IDs.
|
| 19 |
+
|
| 20 |
+
## Integrated Commercial Workflow
|
| 21 |
+
1. **Research**: Use the Market Research agent to find a profitable niche.
|
| 22 |
+
2. **Attract**: Use the Blogger agent to create articles that rank on search engines.
|
| 23 |
+
3. **Convert**: Use the Sales Page agent to draft the landing page.
|
| 24 |
+
4. **Monetize**: Use the Stripe agent to handle the transaction.
|
knowledge/supabase_integration.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# KB: Supabase Database Integration
|
| 2 |
+
|
| 3 |
+
The **Supabase Agent** provides the persistence layer for the EbookBuilder ecosystem, managing ebook metadata, sales records, and transaction logs.
|
| 4 |
+
|
| 5 |
+
## Core Capabilities
|
| 6 |
+
- **Metadata Management**: Uses `db_upsert_ebook` to keep track of book titles, authors, status (draft/published), and GCS/HF paths.
|
| 7 |
+
- **Sales Intelligence**: Uses `db_get_sales_report` to provide the author with real-time insights into book performance.
|
| 8 |
+
- **Audit Logging**: Uses `db_log_transaction` to maintain a secure and immutable record of every payment and generation event.
|
| 9 |
+
|
| 10 |
+
## Database Schema (Recommended)
|
| 11 |
+
1. **ebooks**: `id`, `title`, `author`, `status`, `content_url`, `created_at`
|
| 12 |
+
2. **sales**: `id`, `ebook_id`, `amount`, `currency`, `customer_email`, `created_at`
|
| 13 |
+
3. **transactions**: `id`, `event_type`, `payload`, `status`, `created_at`
|
| 14 |
+
|
| 15 |
+
## Workflow Integration
|
| 16 |
+
- **Post-Generation**: Automatically upsert ebook metadata after a successful manuscript completion.
|
| 17 |
+
- **Post-Sale**: Log the transaction details immediately after a successful Stripe Checkout callback.
|
| 18 |
+
- **Reporting**: Query the sales table to generate monthly performance reviews via the Meta Orchestrator.
|
| 19 |
+
|
| 20 |
+
## Connection
|
| 21 |
+
The agent uses the Service Key for administrative access, ensuring it can manage all tables within the `vrspcqzajxupormgqhpe` project.
|
knowledge/webhooks.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# KB: Webhooks & Event-Driven Architecture
|
| 2 |
+
|
| 3 |
+
Webhooks enable the EbookBuilder and API Wizard to respond to real-time events from external services (e.g., GitHub, Stripe, Hugging Face).
|
| 4 |
+
|
| 5 |
+
## Implementation
|
| 6 |
+
- **Endpoints**: Secure HTTPS endpoints that listen for `POST` requests.
|
| 7 |
+
- **Payload Verification**: Using HMAC signatures (e.g., `X-Hub-Signature`) to ensure requests originate from a trusted source.
|
| 8 |
+
- **Asynchronous Processing**: Webhooks should immediately return a `202 Accepted` and queue the task for an agent to handle.
|
| 9 |
+
|
| 10 |
+
## Common Events
|
| 11 |
+
- `repo_update`: Triggers a re-download of a knowledge base module.
|
| 12 |
+
- `generation_complete`: Notifies the user when an LLM chapter draft is ready.
|
| 13 |
+
- `subscription_change`: Manages access tiers for the EbookBuilder interface.
|