AIで自動化

I Built a Fully Autonomous Blog Engine with Gemini 3 & Streamlit (And Yes, It Wrote This)

Introduction: Despair, Chrome RAM, and the Birth of “Lumina AI”

“Whirrrrr…”

It was 2:00 AM, Winter 2024. The sound filling my room wasn’t the heater—it was my MacBook Pro screaming for help.

I didn’t need to open the Activity Monitor to know the culprit. It was Chrome. specifically, “Google Chrome Helper (Renderer)” was devouring every byte of available memory. I had over 20 tabs open: ChatGPT, Claude, Keyword Planner, competitor sites, and the WordPress editor.

“AI will automate blogging,” the tech influencers shouted back then. But for us engineers who bought into that sweet promise, what was the reality?

Sure, AI could generate text. But in the actual workflow required to rank on Google, humans were reduced to glorified babysitters.

We were downloading CSV volumes, visually scraping headers, stuffing context into prompts, and getting back generic “Conclusion” paragraphs that said absolutely nothing. If you asked for a revision, it forgot the previous instructions. Even after getting the text, we had to fact-check, fix links, transfer to WordPress, fix h tags, and find images.

We weren’t “automating” anything. We were performing the penance of manually steering a high-performance stochastic parrot.

The “Copy-Paste Hell” and Context Fragmentation

I tried the tools available at the time—Jasper, Copy.ai—but as a developer, I hit the unsubscribe button within three days.

The fatal flaw wasn’t UI/UX; it was a structural limitation of LLMs I call “Context Fragmentation.”

Most tools decoupled “Title Generation,” “Outline Generation,” and “Body Generation” into independent API calls. The result? A broken logical spine. The title might promise “Implementation Details of React Server Components,” but the body would start with “React is a UI library created by Facebook.”

This makes it impossible to satisfy Google’s E-E-A-T (Experience, Expertise, Authoritativeness, and Trustworthiness). In technical blogging, we don’t want textbook answers. We want the “visceral experience”—why you chose a library, where you got stuck, and how you fixed it. Ask a 2024-era AI for that, and it would hallucinate a non-existent API with confidence.

“I don’t want a bot that predicts the next word. I want an editorial team that mirrors my thinking process, from ideation to deployment.”

Driven by engineer’s arrogance and a pathological hatred of repetitive tasks (virtuous laziness), I decided to build it myself.

The Concept: “One Prompt, Massive Reasoning”

Thus began the development of “Lumina AI.”

(Fun fact: The original codename was “Lazy Writer v1.” The system itself rejected this, lecturing me: “That name will not garner user trust. I propose ‘Lumina’ to symbolize lighting up the sea of information and visualizing the opaque thinking process of AI.” It was a valid code review, so I accepted.)

The frontend concept is simple: “One Prompt, Full Publish.”

I input one line: “I want to write about Gemini 3’s Agent capabilities.” Behind the scenes, however, it’s not magic. It is a brute-force application of computational resources.

A single prompt triggers over 30 internal API calls and a multi-million token reasoning loop.

  1. Multi-angle Research: It crawls not just Google top 10, but GitHub Issues and Stack Overflow to find “code-level truths” and developer pain points.
  2. Recursive Architecture: After drafting an outline, a separate AI agent acts as a “Critic,” roasting the content for being too shallow. This Self-Correction Loop continues until it passes a threshold.
  3. Context-Aware Writing: It holds the entire article context from title to conclusion, enabling callbacks and logical consistency.
  4. Auto-Refactoring: The AI reviews its own code blocks (and prose) to debug.
  5. DOM Generation: It generates matching diagrams and POSTs everything to WordPress via REST API, complete with HTML tags, alt attributes, and permalinks.

While I make coffee, the AI is sweating through hundreds of iterations in the background.

Why Now (2026)? The “Gemini 3” Singularity

I’ll confess: I architected this in 2024. But back then, it was vaporware. GPT-4o class models couldn’t handle such recursive instructions without forgetting the prompt or breaking logic mid-loop.

Everything changed in late 2025 with the release of the Google Gemini 3 Series.

It wasn’t just the context window. The game-changer was the leap in “Multimodal Reasoning” and “Agentic Autonomy.”

Gemini 3 can look at a screenshot of a UI and understand “design intent,” or read GitHub diffs to infer “developer frustration.” By grasping the non-verbal nuances, it finally became capable of writing technical articles that feel human.

Simultaneously, Streamlit evolved into the standard framework for “Agentic UI,” allowing us to control complex backend state management with the Python we know and love.

Lumina AI stands at the singularity where Gemini 3 meets Streamlit.

This article you are reading? I gave Lumina AI a single prompt: “Write a deep technical deep-dive about how Lumina AI works for an audience of engineers.” The logical flow and “heat” of this text are the Proof of Concept.

So, how does it work? Time to open the black box. Let’s look at the code.


Under the Hood: The Power of Gemini 3 Series

“Why Gemini? Isn’t GPT-4o or Claude stable enough?”

I get this question a lot. In the First Generative AI Boom (2024-2025), OpenAI was the undisputed king. I was a believer too.

But in 2026, for the specific task of automated technical writing, there is no reason not to choose Gemini 3, unless you have an irrational allergy to the Google Cloud Console.

Here is the engineering breakdown of why Gemini 3 is the engine of choice.

1. Constructing with Logic, Not Probability: Gemini 3 Pro Preview’s “Deep Think”

The reason previous AI tools wrote fluff was that they were just predicting the next likely word.

If you asked for an outline on “React UseEffect,” they gave you the average of the internet: “What is it?”, “How to use,” “Summary.” This is commodity content—SEO poison.

Lumina AI uses gemini-3-pro-preview with the parameter thinking_level="high". This triggers “Deep Think” mode.

When active, the model goes silent for seconds or minutes. API latency increases, but internally, it performs an Adversarial Reasoning loop:

[Internal Thought Log Visualization]

(Step 1: Analysis) “User wants a React guide. However, SERPs are full of ‘Documentation Rewrites.’ Probability of ranking with a standard structure: <3%. Rejecting this path.”

(Step 2: Counter-proposal) “What about a contrarian approach: ‘Don’t use UseEffect’? Trends favor Server Components. But search intent data shows 80% of users are still struggling with client-side loops.”

(Step 3: Synthesis) “Compromise: Start by empathizing with the ‘infinite render trap’ (the pain), then propose ‘Custom Hooks’ as the solution. This satisfies intent while boosting the Uniqueness Score. Beginning H2 drafting…”

The “Architect Agent” only outputs JSON after this debate. The result is a professional editorial pitch, not a probabilistic average.

2. Curing Amnesia: State Management via “Thought Signatures”

Long-form content (5,000+ words) usually suffers from “IQ Decay” as the article progresses.

  • “Chapter 1 praised Python, but the Conclusion recommends Java.”
  • “Defined a term in Chapter 2, forgot it by Chapter 5.”

This is a stateless API problem. The context gets garbage collected.

In Gemini 3, we implemented “Thought Signatures.” This isn’t magic; it’s a structured context metadata injection system in the System Instruction.

<code>json
// Conceptual Schema of Thought Signatures
{
  "article_state": {
    "core_thesis": "Python is slow, but developer velocity pays for it",
    "tone_voice": "Senior Engineer, slightly cynical but helpful",
    "defined_terms": {
      "GIL": "Global Interpreter Lock - treat as the 'villain' in this narrative"
    }
  },
  "logic_trace": [
    {"section_1": "Admit Python's slowness (Build rapport)"},
    {"section_2": "Compare with C++ dev costs (Contrast)"}
  ],
  "forbidden_patterns": ["Mentioning Java", "Neutral/Wishy-washy conclusion"]
}</code>

When the Writer Agent tackles Chapter 5, it checks the logic_trace: “I planted a seed in Chapter 1 about ‘slowness.’ I must resolve that thread now.”

An AI that does callbacks. This requires a massive context window and the semantic compression of JSON states.

3. The Violence of Speed and Cost: Flash Models & Infinite Rewrites

“Won’t this bankrupt me?”

Enter gemini-3-flash-preview. Lumina AI uses a “Brain (Pro) vs. Hands (Flash)” division of labor.

Pro handles architecture. Flash handles the token-heavy drafting and coding. In 2026, Flash is 1/20th the cost of Pro and 5x faster. We use this to employ a “Council of Critics” strategy.

  1. Parallel Generation: Flash generates three versions of a paragraph: (A) Logical, (B) Emotional, (C) Simple.
  2. Adversarial Evaluation: A critic agent scores them on Logical Consistency and Redundancy.
  3. The Loop: If the top score is < 80, it discards everything and retries.

We substitute “talent” with “trials.” Brute-forcing quality by rewriting a sentence 5 times in the blink of an eye is a strategy only possible with Flash models.

4. Visual QA: The “Auto-Inspection” System

Generative images often contain gibberish text or backwards flowcharts. Lumina AI uses imagen-4.0-generate-preview but adds a “Visual QA” pipeline.

  1. Generate: Create the image.
  2. Vision Check: Feed the image immediately into gemini-3-pro-vision with the prompt: “Does this image contain garbled text? Do the arrows flow left-to-right?”
  3. Decision: If NG, the reason is added to the Negative Prompt, and it auto-regenerates.

You only see the final, clean image. The failures are buried in the logs.


Tech Anatomy: A Robust System with Python & Streamlit

“Streamlit? Isn’t that a toy for data scientists to make quick charts?”

In 2024, that was true. In 2026, the assessment has flipped. Lumina AI’s codebase exceeds 3,200 lines, handling async tasks, database connections, and WordPress APIs.

We built this without React or Vue, just pure Python. Here is the recipe for breaking the “Full Stack Wall.”

1. Modular Monolith Architecture

We treat Streamlit (app.py) purely as a State Machine.

<code>text
lumina-ai/
├── app.py                  # Frontend / Controller
├── agents/                 # Autonomous Agents
│   ├── architect.py        # Gemini 3 Pro (Planning)
│   ├── writer.py           # Gemini 3 Flash (Execution)
│   └── vision.py           # Imagen 4 + Vision QA
├── core/                   # Core Logic
│   ├── llm_client.py       # Rate limiting, Cost calc
│   ├── sandbox.py          # AST Security parsing
│   └── wordpress.py        # REST API
├── database/               # Persistence
│   ├── connection.py       # SQLite / Migration
│   └── schema.sql          # Tables
└── utils/
    └── gsc_analyzer.py     # Search Console Integration</code>

The trap beginners fall into is writing business logic inside app.py. We delegate heavy lifting to agents/ and use asyncio to run image generation in parallel with text drafting, providing a UX that rivals modern SPAs.

2. The Budget Circuit Breaker

To prevent API bankruptcy, core/llm_client.py implements strict controls:

  • Model Routing: Complex tasks go to Pro; simple edits go to Flash.
  • Hard Limits: If daily usage hits $5.00, the system kills requests.

“`python

core/llm_client.py concept

class CostManager: def check_budget(self, estimated_cost): current_usage = self._get_daily_usage() if current_usage + estimated_cost > self.DAILY_LIMIT: raise BudgetExceededException(“Daily Limit Reached. Shutting down.”) “`

3. Safety First: The AST Sandbox

Lumina AI can write code to analyze data. Letting an LLM run exec() on your local machine is suicidal. We use Python’s ast module for a Whitelist Sandbox.

“`python import ast

class SecurityValidator(ast.NodeVisitor): def init(self): self.allowed_modules = {‘pandas’, ‘matplotlib.pyplot’, ‘numpy’, ‘math’} self.is_safe = True

def visit_Import(self, node):
    for alias in node.names:
        if alias.name not in self.allowed_modules:
            self.is_safe = False # Block 'os', 'subprocess', etc.

# ... (Block dangerous calls like exec, open, input) ...

“`

This validator parses the syntax tree before execution. If Gemini tries to be “helpful” and run os.remove() to clean up files, the AST validator kills it instantly.

4. Persistence: SQLite & st.connection

The nightmare of browser refreshes deleting your draft is over. We use Streamlit’s st.connection with SQLite.

We store articles in a relational DB because blog posts are structured data (Title, Body, Status). We also log the Thought Signatures so we can resume a specific “train of thought” even if the server restarts.

5. Output: Structured POST to WordPress

We don’t just dump Markdown. We use the WordPress REST API to format the content into Gutenberg Blocks JSON.

  1. Media: Upload images first, get IDs.
  2. Blocks: Parse <h2> and <img> tags into WordPress specific comments <!-- wp:image {"id":123} -->.
  3. Meta: Inject SEO descriptions directly into Yoast/RankMath fields.

“`python

core/wordpress.py snippet

def post_article_as_blocks(title, content_html, featured_media_id): # Convert HTML to Gutenberg JSON structure gutenberg_content = convert_to_gutenberg_blocks(content_html)

payload = {
    "title": title,
    "content": gutenberg_content, 
    "status": "draft",
    "featured_media": featured_media_id,
    "meta": {
        "_yoast_wpseo_metadesc": generated_meta_desc
    }
}
# requests.post(Endpoint, json=payload)

“`

When I open WordPress, the post is formatted, SEO-optimized, and ready to publish.

6. The Feedback Loop: Search Console Analyst

utils/gsc_analyzer.py pulls data from Google Search Console. If a post has high impressions but low CTR, Lumina suggests a rewrite upon startup:

“Alert: Rewrite Proposal for Article #402” * Reason: High impressions for query “Python Automation”, but CTR is 1.2%. * Fix: Title is too technical. Rename to “5 Python Scripts You Can Copy-Paste.”

Write, Publish, Analyze. It is the Operating System of a blog.


Final Thoughts

We used to joke that AI would replace writers. We were wrong. AI replaced the drudgery of writing.

Lumina AI isn’t about pressing a button and walking away. It’s about having a tireless research assistant, a harsh editor, and a diligent publisher living inside my terminal.

If you’re a developer tired of the content grind, close your SaaS subscriptions. Open your IDE. The tools to build your own editorial team are already here.

この記事もAIが書いてます。Gemini 3 PreviewとStreamlitで構築した「完全自動化ブログエンジン」の正体前のページ

【月額1万円】動画講座見放題+無制限添削+毎月個別面談で成果を出すまでプロが伴走するスクール次のページ

ピックアップ記事

  1. 脱・ローカル宣言。AIで作ったアプリを0円・3分で世界公開する「Vercel」デ…

  2. 【脱・挫折】知識ゼロの私がAIとペアプログラミング!自作Webツールを「Wind…

  3. Cursorとの決定的な違い。「Gemini」がプロジェクト全体を監視する安心感…

  4. Google Antigravityで誰でもアプリ開発者になれる?未来のプログラ…

  5. 脱・チャット指示。AI開発は「最初の1ファイル」で決まる!非エンジニア専用「Ma…

関連記事

  1. AIで自動化

    AIで「ブログ記事」を「デジタル商品(E-book)」に自動再編する“資産化”ワークフロー

    導入:なぜ今、ブログ記事を「デジタル商品」に変えるべきなのか…

  2. AIで自動化

    【失敗談あり】AIブログ炎上回避術:著作権とハルシネーション対策

    導入:なぜ今、AIブログに「炎上回避術」が必要なのか?…

  3. AIで自動化

    AIブログ成功の「全自動執筆フロー」全解剖

    単発のAIプロンプトでは稼げません。本記事では、私の成功ブ…

コメント

  1. この記事へのコメントはありません。

  1. この記事へのトラックバックはありません。

最近の記事
最近の記事
  1. バイテック生成AI|【高額報酬】話題の生成AIオンラインスク…
  2. 流行りの「AIチャットボット」を作るなら、Gemini AP…
  3. Cursorとの決定的な違い。「Gemini」がプロジェクト…
  4. 挫折率No.1の「エラー地獄」を逆手に取る!AI時代の「エラ…
  5. 【月額1万円】動画講座見放題+無制限添削+毎月個別面談で成果…
  1. 社会人スクール

    【未経験OK】GPCオンラインスクールの評判は?働きながら2ヶ月でゲーム企画職へ…
  2. AIで自動化

    AI量産記事がインデックスされない問題の終焉。cosmic-note.comの全…
  3. AIで自動化

    Cursorとの決定的な違い。「Gemini」がプロジェクト全体を監視する安心感…
  4. AIで自動化

    【脱・挫折】知識ゼロの私がAIとペアプログラミング!自作Webツールを「Wind…
  5. AIで自動化

    【完全解説】非エンジニアがAIで開発した生産管理システム「Forge」の全貌
PAGE TOP