J
JBC System Wiki
Knowledge Base • johnbcowan.com
JBC Philosophy Production System — Knowledge Base

How the JBC Essay Machine Works

A simple, reliable system that turns a big philosophy book into clear, thoughtful essays for readers — using smart tools, secure storage, and helpful AI that stays true to the original voice.

1

Tools — What is the Command Center and what does it do?

The Command Center is the private mission control dashboard for the entire essay series. It gives you a single, clear view of everything happening in the production pipeline so you can track progress, pull research on demand, and trigger the next steps without hunting through folders or scripts.

At its heart is the Essay Pipeline table. This living list shows every essay by number and title, its source chapter from the book, current status, target length, and quick actions. You can glance at it to see what’s Planned, what’s In Progress, and what’s already Published, then update notes or statuses right there.

A powerful RAG Research Assistant lives inside the dashboard too. Open the modal, type a question or key idea, and it instantly surfaces the most relevant passages from the philosophy book using smart semantic search. You can review the excerpts, copy what you need, or even ask for light expansions that weave the context smoothly into your current essay.

Finally, the dashboard includes convenient action buttons: one to run the local extractor that pulls fresh book sections for upcoming essays, and another to batch-enqueue AI polishing jobs for anything marked In Progress. Everything stays coordinated in one friendly interface.

Current mode: Live Production Mode. The old embedded wiki was removed in Batch 5; a small pointer remains to this full knowledge base at wiki.johnbcowan.com (Zero Trust protected). The dashboard also shows the live Agent Directives panel with Rule D (the Consultancy Protocol) listing the four sub-agents the Orchestrator must consult for specialized work.

2

Storage — How D1 and R2 hold the essays and data

D1 serves as the project’s reliable, structured database — essentially a smart, always-current spreadsheet that acts as the single source of truth. It holds the master list of every essay: its ID and number, title, source chapter and sections, status (Planned, In Progress, or Published), word-count target, published URL when ready, detailed notes, and timestamps. A companion table tracks rewrite jobs so nothing falls through the cracks.

R2 is the secure, scalable big-file cabinet built for the heavier lifting. It’s optimized for full polished drafts, images, media assets, exports, archives, and any other substantial content. The standing policy is simple and practical: prefer R2 for anything over 1MB. This keeps the system fast, cost-effective, and well-organized, with files stored under clear paths like drafts for each essay.

Together they give the production system both precise, queryable records (D1) and roomy, durable storage (R2) without compromise.

3

AI Systems — Memory and the Writer, explained simply

Vectorize functions as the project’s long-term memory. It takes important passages from the philosophy book (and later the essays themselves) and transforms them into compact numerical “embeddings” — think of these as unique, searchable fingerprints of the ideas and their meaning. When you search for a concept, the system can instantly locate the most relevant book excerpts instead of scanning page by page. This powers the RAG Research Assistant with fast, context-rich results.

Workers AI is the skilled, voice-faithful writer and editor on the team. It uses capable language models to help turn raw book excerpts into polished, standalone essay sections. Its instructions are deliberately strict: preserve the original author’s thoughtful, layman-friendly tone, sentence rhythms, intellectual register, and every core idea. It can add a gentle modern hook for new readers or smooth transitions for standalone reading, but it never introduces new philosophy or drifts from the source voice. You’ll see it at work in both quick expansions from RAG results and full light-polish jobs that run through the production queue.

4

Workflows & How It Works — The full journey of an essay

Picture the journey of an essay as a clear, repeatable story that turns rich material from the big philosophy book into a finished piece on the public site.

1. Source material
It begins with the source: Philosophy as a Great Conversation, the continuous, engaging narrative of Western philosophy written in an accessible voice. The master essay plan (kept in D1 and mirrored in the dashboard) identifies which chapters and sections belong to each upcoming title.

2. Extraction
Next, the local Extractor tool runs. You trigger it from the Command Center (or directly). It reads the plan, intelligently locates the matching sections in the book, and creates clean raw files plus scaffolded drafts with helpful frontmatter and light-reworking notes. This gives you high-quality starting material without manual copy-paste.

3. Research with memory
With drafts in hand, you open the Command Center and use the RAG Research Assistant (powered by Vectorize memory). Search for key ideas, philosophers, or themes, and it pulls the most relevant passages from the book. You can study them, insert useful context, or request a short voice-faithful expansion to weave ideas together.

4. AI-assisted polishing
When the essay feels ready for refinement, you click AI Polish (or run the batch version). This sends the work to the backend, where it is enqueued for Workers AI. The model processes it with careful, voice-preserving prompts — adding reader-friendly hooks or smoothing as needed while staying true to the author. Results are stored securely (R2 for larger outputs), job status updates in D1, and you can review or iterate.

5. Publish
Finally, once everything looks good, you update the status to Published in the dashboard. The finished essay moves to the public website, joins the growing series, and becomes available for readers — complete with public RAG search over the published works. The cycle repeats for the next essay, keeping production steady and high-quality.

5

Current Inventory — Live Resources

Here is the exact, verified inventory of every service powering the JBC Philosophy Production System as of the Batch 6 infrastructure stock-take (Cycles 1–3). All IDs, bindings, and statuses were confirmed against the live filesystem (wrangler.toml), wrangler CLI, and Cloudflare v4 API (Account 951d6aeabb663fd73e4aa32f7dd40bd7).

Service Name ID / UUID Binding Purpose & Notes
D1 jbc-essay-db 3bf2ea2d-89b6-4937-8bc9-d8cf607e105b DB Essay plan, status (Planned / In Progress / Published), source_sections (JSON arrays of chapter refs), notes, rewrite jobs. The persistent memory of the entire pipeline.
R2 jbc-drafts Active (created 2026-05-24) DRAFTS_BUCKET Production active. Used for polished drafts, raw extracts, assets >1MB. Binding live in Worker. See updated R2 section below.
Vectorize jbc-philosophy-book — (created 2026-05-24) VECTORIZE 384-dimensional vectors, cosine metric. Holds exactly 123 semantic chunks from the master manuscript for RAG search. 📜 Traceable to master
KV jbc-command-center-kv 34e61f32a7a14cbc856e38d88a73a87b KV Fast global cache and job-status board.
Queues jbc-rewrite-queue 802f53924f57430e9c120b486d922383 REWRITE_QUEUE 1 producer / 1 consumer. Async voice-faithful polishing jobs. Config: batch size 5, 30 s timeout, 3 retries.
Workers AI (binding only) AI Powers voice-faithful rewrites and /rag-expand inside the Queue consumer.
Workers jbc-command-center-api Main API (src/index.js, nodejs_compat). Endpoints: /essays, /trigger-extract, /polish, /rag-query, /rag-expand, /health. CORS * with Origin validation.
Pages 3 projects jbc-system-wikiwiki.johnbcowan.com
jbc-essay-command-centertools.johnbcowan.com
johnbcowanjohnbcowan.com
📦
R2 Status — Production Active

R2 is now fully activated for the production system. Bucket jbc-drafts is live (created during this R2 Activation batch). The Worker binding DRAFTS_BUCKET is enabled in wrangler.toml. The backend automatically stores polished drafts (and raw extracts when provided) to R2 with proper metadata. This fulfills the long-standing policy to prefer R2 for anything over 1 MB.

See Cloudflare R2 docs and the current wrangler.toml for binding details. Additional tools activated in this batch: Hyperdrive (available for D1 performance improvements).

6

File Locations & Master Manuscript

The one true source lives only on the local machine.

Authoritative 65,000-word manuscript: /home/cybortus/writing/reference/Philosophy as a Great Conversation.md (exactly 1,360 lines). Full text confirmed, from the Introduction through the closing line: “The room is still full of voices. They are waiting for yours.”

Companion working copy: Philosophy as a Great Conversation - Polished.md (1,299 lines).

Nothing else holds the complete 65,000-word text. No full manuscript exists in any Cloudflare service.

Derived Data Map (the prepared ingredients)

  • 123 semantic chunks → Vectorize index jbc-philosophy-book 📜 Traceable to master (via book_chunker.pybook_chunks.jsonlingest-to-vectorize.js)
  • Essay plan rows + status + source_sections (JSON arrays) + notes → D1 jbc-essay-db
  • Raw extracts & working drafts → local /home/cybortus/writing/essays/raw/ (8 files) and /home/cybortus/writing/essays/drafts/ (8 files, including 01-the-first-philosophers.md — the first published title)
  • Essay plan (single source of truth): /home/cybortus/writing/tools/essay-command-center/data/essay-plan.json (target 28 essays total; as of stock-take: 2 published, 6+ in active pipeline)

Friendly analogy: Think of the master manuscript as the single, well-loved family cookbook that never leaves the kitchen. The 123 chunks are perfectly measured spice packets for instant lookup. The essay drafts are beautifully plated individual courses. The plan is the handwritten menu for the season. Everything is traceable back to the original book, but the book itself stays safely on the shelf.

Full provenance details and the complete stock-take synthesis live in /home/cybortus/writing/Batch6_Infrastructure_Stock_Take_Synthesis.md.

7

Security & Access — Cloudflare Zero Trust

Both the private Command Center (tools.johnbcowan.com) and this Wiki (wiki.johnbcowan.com) are protected by Cloudflare Zero Trust (Team: quiet-sea-7b49).

🛡️
The Polite but Unyielding Bouncer

“Imagine a beautiful private library with an extremely polite but unyielding bouncer at the door. Only one person holds the permanent invitation. The door automatically locks itself after 24 hours, and the bouncer never argues. That is Cloudflare Access protecting our tools and our thinking space.”

Two self-hosted Access Applications. Exact-email Allow policies limited to beau.cowan.id@gmail.com only. 24-hour sessions. Configured via setup_zero_trust.py + official v4 API in Batch 4/5.

The footer of every page proudly states the protection status. This is not optional — it is the permanent security posture for all human-facing production tools.

Official docs: Securing Self-Hosted Applications with Cloudflare Access

8

Scripts & Tooling — The Quiet Heroes

These permanent, lovingly maintained assets are the reliable “quiet heroes” that make the entire operation reproducible, observable, and safe. They live in /home/cybortus/writing/tools/ (and sub-dirs).

essay_extractor.py

The precise chef. Reads the essay plan, slices chapters from the master manuscript, writes raw extracts + drafts with full source_sections provenance arrays for D1.

diagnostic.sh (Rule B)

The 24/7 building superintendent. Browser-simulating health checks (Origin header, OPTIONS preflight, /essays, /health, explicit CORS validation). Run locally: ./diagnostic.sh.

Telegram suite + telegram_watchdog.sh

The reliable on-site messenger and his ever-watchful dog. PM2 listener + interrupt-flag system for notifications and long-running process supervision.

setup_zero_trust.py

The locksmith. Uses the Cloudflare v4 API to provision the two self-hosted Access apps and exact-email policies that lock down the private domains.

book_chunker.py + ingest-to-vectorize.js

The research assistants. Turn the 65k-word manuscript into exactly 123 semantic chunks and load them into the Vectorize index for instant RAG lookup.

wrangler.toml (Worker)

The wiring diagram. Documents every active binding (D1, KV, Queue, Vectorize, AI) and the commented R2 aspirational block. The single source of truth for how the Worker talks to the platform.

9

Diagnostic Assets & Rule B

Rule B (Systematic Diagnostics) in OPERATING_PROTOCOL.md requires permanent, proactive health tooling. diagnostic.sh is the canonical implementation.

It sends browser-realistic requests (with Origin: https://jbc-essay-command-center.pages.dev), explicitly tests the CORS preflight (OPTIONS), hits the live /essays and /health endpoints, and verifies that CORS headers are correctly set so the Worker answers politely from any allowed origin.

This catches deployment drift, configuration mistakes, or silent CORS problems before any reader ever sees them.

==========================================
JBC Command Center Diagnostic Tool
Target: https://jbc-command-center-api.cybortus.workers.dev
...
>>> TEST: OPTIONS Preflight for /essays (browser fetch simulation)
    Status: HTTP/2 204 ...
    CORS Headers:
      access-control-allow-origin: ...
>>> TEST: GET /essays ...
>>> TEST: GET /health ...
==========================================
DIAGNOSIS SUMMARY
- If OPTIONS preflight is missing Access-Control-Allow-Origin ... → Worker CORS is broken.
Diagnostic run complete.

The Telegram watchdog and messenger suite integrate with these diagnostics so the human team can be alerted when something needs attention. These are not side projects — they are core operational infrastructure.

Connecting Resources to Your Worker with Bindings (explains the wrangler.toml wiring that makes diagnostics possible).