πŸ› οΈ

AI-Coding-Agent-Workspace-Spec-Pack

🧭

What this is. The master spec pack for an AI Coding Workspace. The project ships two product lines on one Laravel brain:

(A) AI Coding Agent platform β€” Laravel web Control Center + iPhone SwiftUI app, both clients of the same Laravel API.

(B) AI-Powered Documentation Workspace β€” the STV sub-pack (open), nested as a sub-page below.

Every sub-page mirrors 1:1 into docs/ and is consumed by Cursor and Claude Code. First-file entry point: HOW TO START AND USE.

πŸ”’

Production stack (locked β€” B0 wins over any older mention). CentOS-compatible Linux + LiteSpeed + lsphp 8.3 (LSAPI) + Laravel 11 + MySQL 8 / MariaDB 11.4+ + Redis 7 + Horizon + Supervisor + Let's Encrypt.

Forbidden (do not propose, configure, or install): Nginx Β· Apache Β· PHP-FPM Β· PostgreSQL-as-default Β· pgvector-as-default Β· Qdrant Β· Milvus Β· Weaviate Β· Android in v1 Β· multi-tenant org/team in v1 Β· direct OpenAI / Anthropic / Claude Code calls from Swift or JS Β· Notion branding / logo / exact UI.

πŸ›οΈ

Architecture lock (canonical, verbatim β€” do not paraphrase). CentOS-compatible Server = production OS Β· LiteSpeed Web Server = production web server Β· Laravel Web App = full control center Β· Laravel API = shared backend for web and iPhone Β· MySQL/MariaDB = SQL source of truth Β· Swift iPhone App = mobile remote control through Laravel API only Β· RAG = project memory Β· Git = safe branch/snapshot workflow Β· Console = live debugging layer Β· Docs = always updated Β· Claude Code = development assistant with strict project rules.

This exact block must appear verbatim in CLAUDE.md, .claude/RULES.md, .claude/PROJECT_CONTEXT.md, and docs/00-product-overview.md. CI step claude-rules-lint enforces it.

✨

Global AI Text Selection Editor (F1). A Notion-AI-style select β†’ ask β†’ preview β†’ apply layer, active everywhere a user reads or edits text β€” project / task / comment / note / agent prompt / run summary / AI response / admin note. Any earlier wording that scoped this to one surface is superseded.

πŸ“œ

Source of Truth System. This pack is a controlled specification system, not a folder of notes. Every page is a versioned spec with a Spec ID, owner role, authority level, status, sync targets, dependencies, and change policy. The whole pack mirrors 1:1 into docs/. The rules below govern who can change what and what wins when two pages disagree. Treat the Source of Truth system as the constitution of the documentation system itself.

🧭

Canonical diagrams (Option 1). The project’s Mermaid diagrams are centralized in 🧭ARCHITECTURE_DIAGRAMS (Canonical). Other pages should link to those diagrams instead of duplicating Mermaid blocks.

πŸŽ›οΈ

Documentation visual system. Formatting + export conventions are defined in πŸŽ›οΈDOCS_SYSTEM (Visual + Export Standard). When in doubt, follow that page for headings/callouts/placeholder patterns.

Source of Truth System

Spec Header

Every spec page (HUB, B0, B1, F1, C1, C2, 00–18) MUST open with a callout containing the block below. Filled values per page live in the Spec Registry. The same block becomes the YAML front-matter of the mirrored docs/<file>.md in the repo.

spec_id:        SPEC-<short>
title:          <human title>
version:        <semver>            # bump on every material edit
status:         Planned | Approved | In Build | Implemented | Deprecated
authority:      Constitutional | Architecture | Specification | Implementation | Reference
priority:       P0 | P1 | P2 | P3
owner_role:     <role title>        # who writes the spec
reviewers:      [<role>, <role>]    # who must sign off on changes
last_reviewed:  YYYY-MM-DD
sync_targets:                       # repo files this spec owns
  - <path or glob>
depends_on:     [<Spec ID>, ...]    # upstream specs this assumes
consumed_by:    [<Spec ID>, ...]    # downstream specs / code
conflict_rule:  <pointer to higher authority or sibling tiebreaker>
change_policy:  <who can change, what gates apply>

Authority Hierarchy

Five levels, highest first. Higher beats lower in every conflict.

  1. Constitutional β€” the architecture-lock verbatim block in this hub. One source. Never paraphrased. Verbatim in CLAUDE.md, .claude/RULES.md, .claude/PROJECT_CONTEXT.md, docs/00-product-overview.md. Enforced by claude-rules-lint.
  1. Architecture β€” cross-cutting decisions that constrain the whole codebase: B0 (server), B1 (Laravel core), F1 (Selection Editor), 01 (platform strategy), 02 (backend modules & data model). Change requires architect sign-off plus a Registry version bump.
  1. Specification β€” feature-level specs: pages 00, 03–18, C1, C2. Owns concrete features, contracts, schemas, endpoints. Change requires spec owner plus one reviewer of a different role.
  1. Implementation β€” runnable how-to: build prompts, HOW TO START, deployment runbooks, the diagnose command. Generated from Specifications; not authoritative on its own.
  1. Reference β€” glossary, changelog, audit trail, indexes. Read-only relative to higher levels.

Conflict Resolution

  1. Constitutional > Architecture > Specification > Implementation > Reference. Always.
  1. Within the same level, the spec listed in the Spec Registry as canonical for a given concern wins. The loser must be revised, cross-referenced, or marked Deprecated.
  1. Verbatim blocks (architecture lock, forbidden list) are sacred. If another page contradicts them, the other page is wrong by definition.
  1. Two specs cannot both claim the same sync_target. The Registry assigns exactly one primary owner; others list the path under consumed_by.
  1. Any change to a Constitutional or Architecture spec requires: (a) version bump in the Registry, (b) entry in docs/CHANGELOG_AI.md, (c) sign-off from a reviewer role distinct from the author.
  1. When a spec flips to Deprecated, every page listing it under depends_on MUST be re-reviewed in the same edit pass.
  1. If a Claude Code or Cursor session encounters a runtime conflict, it stops and surfaces the disagreement. It never silently picks one.

Sync Targets

  • Paths are relative to repo root (docs/..., .claude/..., .cursor/rules/..., app/Services/..., resources/js/ai-text-editor/...).
  • A spec owns the file or directory and every doc generated from it.
  • Specs MAY share a directory only when file patterns are disjoint (e.g. OpenAIAgentService.php belongs to SPEC-07; ClaudeCodeAgentService.php belongs to SPEC-06).
  • Generated regions inside a human-owned file are wrapped in <!-- AUTO-GENERATED:START spec=SPEC-XX --> ... <!-- AUTO-GENERATED:END -->. Anything outside the markers belongs to humans.
  • Mirroring direction is Notion β†’ repo. A Cursor/Claude Code edit may propose a change to a Notion spec via docs/CHANGELOG_AI.md, but must not edit the Notion page directly.

Spec Registry

Spec IDTitleVersionStatusAuthorityPriorityOwner rolePrimary sync targetsNotion page
SPEC-HUBMaster Spec Pack β€” hosts both product lines + production-ready Claude Code prompt (Β§10) (this page)1.4.0ApprovedConstitutionalP0Product architectdocs/00-product-overview.md, the arch-lock block in CLAUDE.md and .claude/RULES.md, docs/SPEC_REGISTRY.mdthis page
SPEC-B0Production Infrastructure (CentOS + LiteSpeed + MySQL)1.0.0ApprovedArchitectureP0DevOps architectdocs/CENTOS_LITESPEED_DEPLOYMENT.md, docs/LITESPEED_SECURITY.md, docs/LITESPEED_CACHE_RULES.md, docs/QUEUE_AND_CRON.md, docs/SERVER_HEALTH.mdB0
SPEC-B1Laravel Web App Core + SQL Database1.0.0ApprovedArchitectureP0Backend architectapp/, config/agent_workspace.php, database/migrations/, routes/, docs/PROJECT_MAP.md, docs/DATABASE_SCHEMA.mdB1
SPEC-F1Global AI Text Selection Editor1.0.0ApprovedArchitectureP0Product architectresources/js/ai-text-editor/, app/Services/AiTextTransformService.php, docs/AI_SELECTION_EDITOR.mdF1
SPEC-C1Claude Code Setup Guide & HOW TO START1.1.0ApprovedSpecificationP0Developer-tooling leadCLAUDE.md (root), HOW TO START.md, docs/HOW_TO_START_WITH_CLAUDE_CODE.mdC1
SPEC-C2Claude Code Project Bundle (.claude/ files)1.0.0ApprovedSpecificationP0Developer-tooling lead.claude/**, .cursor/rules/**C2
SPEC-00Product Overview & Goals1.0.0ApprovedSpecificationP0Product architectdocs/00-product-overview.md00
SPEC-01Platform Strategy & Stack1.0.0ApprovedArchitectureP0Product architectdocs/01-platform-strategy.md01
SPEC-02Backend Modules & Data Model1.0.0ApprovedArchitectureP0Backend architectdocs/02-backend-modules.md, app/Services/**02
SPEC-03Database Migrations1.0.0ApprovedSpecificationP0Database architectdatabase/migrations/**, docs/03-database-migrations.md, docs/DATABASE_SCHEMA.md, docs/DATABASE_RELATIONS.md03
SPEC-04RAG System Design1.0.0ApprovedSpecificationP0RAG engineerapp/Services/Rag/**, docs/RAG_SYSTEM.md04
SPEC-05Agent Providers & Specialized Agents1.0.0ApprovedSpecificationP0AI workflow leadapp/Services/Agents/**, docs/AI_AGENTS.md, docs/AGENT_WORKFLOW.md05
SPEC-06Claude Code Integration (in-app)1.0.0ApprovedSpecificationP0AI workflow leadapp/Services/Agents/ClaudeCodeAgentService.php, docs/CLAUDE_CODE_INTEGRATION.md06
SPEC-07OpenAI API Integration1.0.0ApprovedSpecificationP1AI workflow leadapp/Services/Agents/OpenAIAgentService.php, docs/OPENAI_INTEGRATION.md07
SPEC-08Server Params & Configuration1.0.0ApprovedSpecificationP1Backend architectapp/Models/ServerParam.php, config/agent_workspace.php, docs/SERVER_PARAMS.md08
SPEC-09Git Workflow & Safety1.0.0ApprovedSpecificationP0DevOps architectapp/Services/Git/**, docs/GIT_WORKFLOW.md09
SPEC-10Auto Documentation System1.0.0ApprovedSpecificationP1Docs leadapp/Services/Docs/**, docs/10-auto-documentation.md10
SPEC-11Cursor Rules Pack1.0.0ApprovedSpecificationP1Developer-tooling lead.cursor/rules/**11
SPEC-12Console Log UI1.0.0ApprovedSpecificationP1Frontend leadresources/js/console/**, docs/12-console-ui.md12
SPEC-13iPhone SwiftUI App1.0.0ApprovedSpecificationP0iOS leadios/**, docs/IPHONE_APP_PLAN.md13
SPEC-14API Endpoints Reference1.0.0ApprovedSpecificationP0Backend architectroutes/api.php, app/Http/Controllers/Api/**, docs/API_ENDPOINTS.md14
SPEC-15Security Rules & Threat Model1.0.0ApprovedSpecificationP0Security leadapp/Policies/**, docs/SECURITY.md15
SPEC-16PROJECT_MAP / DATABASE_SCHEMA / DIAGRAMS templates1.0.0ApprovedImplementationP2Docs leaddocs/16-templates/**16
SPEC-17Implementation Roadmap1.0.0ApprovedReferenceP2Product architectdocs/17-roadmap.md, docs/CHANGELOG_AI.md17
SPEC-18Laravel Web Admin Panel & Control Center1.0.0ApprovedSpecificationP0Frontend leadapp/Filament/**, resources/views/**, docs/WEB_APP_PLAN.md18
SPEC-STV-HUBSTV sub-pack root β€” AI-Powered Documentation Workspace (integrated product line, v1.3.0 project-final polish). 14 sub-specs listed in the STV sub-registry at Β§10 of the sub-pack.1.3.0ApprovedConstitutional (STV scope)P0Product architectSTV sub-tree: docs/PRODUCT_OVERVIEW.md, docs/ARCHITECTURE.md, docs/DATABASE_SCHEMA.md, docs/API_ENDPOINTS.md, docs/EDITOR_SYSTEM.md, docs/BLOCK_TYPES.md, docs/TEMPLATE_SYSTEM.md, docs/RAG_SYSTEM.md, docs/AI_ASSISTANT.md, docs/MOBILE_UX.md, docs/SECURITY.md, docs/SCALABILITY.md, docs/CHANGELOG_AI.md, docs/MOBILE_GESTURES_AND_TEXT_SELECTION_EDITOR.md β€’ app/Services/{Pages,Blocks,Databases,Templates,Ai,Rag,Search,Activity}/**, resources/js/editor/**, resources/js/ai-selection/**, app/Policies/** (STV scope), app/Filament/** (admin), .cursor/rules/{project-overview,database,editor,security,rag,mobile}.mdcπŸ“˜AI-Powered-Documentation-Workspace

Roles

  • Product architect β€” owns vision, lock, registry.
  • Backend architect β€” owns Laravel core, models, routes, DB schema.
  • Database architect β€” owns migrations, relations, indexes.
  • RAG engineer β€” owns indexing, embedding, retrieval, secret exclusion.
  • AI workflow lead β€” owns agents, skills, prompts, run lifecycle.
  • Frontend lead β€” owns Filament panels, Livewire, Console UI, F1 mount.
  • iOS lead β€” owns Swift client, parity contract.
  • DevOps architect β€” owns server, queues, schedule, snapshots, Git ops.
  • Security lead β€” owns threat model, auth, abilities, audit, secret scanning.
  • Developer-tooling lead β€” owns .claude/, .cursor/, the Claude Code CLI guide.
  • Docs lead β€” owns doc generators, templates, CHANGELOG_AI.

A reviewer must hold a different role from the author. Two-eyes minimum for Architecture+; one-eye minimum for Specification.

Change Management

  1. Draft β€” edit the Notion page; set status: Planned or In Build in the spec header.
  1. Bump version β€” semver. Major = breaking spec change (sync target removed, contract renamed); minor = additive; patch = wording or clarification.
  1. Update Registry β€” bump the row in the Spec Registry in the same edit pass.
  1. Log it β€” append a line to docs/CHANGELOG_AI.md with <date> | SPEC-XX | <author role> | <version> | <one-line summary>.
  1. Re-review dependants β€” every spec listed under consumed_by must be re-checked. If any breaks, either revise the dependant in the same pass or roll back.
  1. Mirror to repo β€” only after Notion review. A repo PR may not edit Notion-owned content directly; it edits the mirrored docs/<file>.md and the matching <!-- AUTO-GENERATED:* --> blocks.

CI Enforcement

  • claude-rules-lint β€” verifies the architecture-lock verbatim block in CLAUDE.md, .claude/RULES.md, .claude/PROJECT_CONTEXT.md, docs/00-product-overview.md. Fails CI on drift.
  • spec-registry-lint β€” parses the Registry (mirrored to docs/SPEC_REGISTRY.md) and asserts: every sync_target exists OR is marked Planned; no two specs claim the same primary sync_target; every Spec ID referenced under depends_on exists.
  • secrets-scan β€” runs on every PR; refuses commits matching sk-*, ghp_*, AWS access keys, JWTs.
  • php artisan agent-workspace:diagnose β€” runtime guard; surfaces any drift between the deployed app and the active specs.

Status Legend

  • Planned β€” spec exists, code does not.
  • Approved β€” spec finalized, build authorized, code may be missing or partial.
  • In Build β€” code is actively landing PRs against this spec.
  • Implemented β€” code matches spec; CI green; doc mirrors current.
  • Deprecated β€” spec superseded; do not consume. The replacement must be cited under consumed_by.

Rollout Plan

  1. Phase 1 (done). The SoT section is live on the master hub. SPEC-HUB v1.0.0 β†’ v1.1.0 (SoT system adopted) β†’ v1.2.0 (sister pack adopted as idea & improvement track) β†’ v1.3.0 (STV sub-pack physically merged as sub-page of this hub; Β§9 renamed to Integrated Second Product Line; STV-HUB row added to Β§SoT.5; "sister/peer" framing retired) β†’ v1.4.0 (final repolish: Β§9 prose normalized to "product line" vocabulary throughout; Β§10 Production-Ready Build Prompt for Claude Code added with verbatim prompt, allowlist sketch, acceptance gates, and day-one operating loop; "one final documentation" milestone).
  1. Phase 2 (next pass). Add the spec-header callout (Spec Header) to the top of every page: HUB, B0, B1, F1, C1, C2, 00–18.
  1. Phase 3. Mirror the Registry into docs/SPEC_REGISTRY.md and wire spec-registry-lint into CI.
  1. Phase 4. Every future page or section change opens with a Registry version bump and a CHANGELOG_AI line; no exceptions. Cross-pack changes that touch Β§9.3 shared doctrine require the matching edit on the sister pack in the same pass.

Versioning

Every spec page in the Registry follows strict semantic versioning. The discipline guarantees that any consumer (Claude Code session, Cursor rule, CI lint, downstream spec) can compute compatibility at a glance and decide whether a re-review is required.

  • Major (X.0.0) β€” breaking spec change. A sync_target was removed or renamed; a contract field disappeared; an authority tier was downgraded; a depends_on edge was severed. Every spec listed under consumed_by MUST be re-reviewed in the same edit pass before the bump merges.
  • Minor (1.X.0) β€” additive change. New sections, new sync_targets, new optional fields, clarifications that close ambiguity. Backward compatible by definition. Consumers are notified but not blocked.
  • Patch (1.0.X) β€” wording, typo, formatting, callout color, link repair, version-drift alignment. No semantic change. No re-review required, but CHANGELOG_AI entry still mandatory.
  • Rollback β€” version numbers are monotonic; a rollback is a new version with a Reverts: vX.Y.Z note in CHANGELOG_AI, never an in-place rewrite of the previous tag.
  • Pre-release tags β€” vX.Y.Z-rc.N is allowed for Architecture+ tier specs during a long migration; production code never consumes a pre-release tag.

Drift Detection

Drift is any divergence between the Notion spec, the mirrored docs/<file>.md, and the deployed code. Three guards keep drift bounded:

  1. Mirror lint (docs-mirror-lint) β€” compares the SHA-256 of each docs/<file>.md against the SHA-256 recorded in the Notion spec header (mirrored on every save). Mismatch β†’ CI fails with a one-liner pointing at the offending Spec ID and the diff cursor.
  1. Sync-target audit (sync-target-audit) β€” walks every sync_target glob in the Registry and asserts the path exists (for Approved+ specs) or is marked Planned (for the rest). Orphan files inside an owned glob trigger a warning to the spec owner via the daily digest.
  1. Runtime diagnose (php artisan agent-workspace:diagnose) β€” surfaces drift between the deployed app and the active specs (missing migrations, missing env keys, missing service classes, missing slash commands, MCP server unreachable). Run on every deploy and on every Claude Code session start.

Remediation playbook: (a) determine which side is authoritative per the Authority Hierarchy; (b) open a same-pass PR that either bumps the spec or updates the code; (c) record the drift cause in CHANGELOG_AI under category drift-fix; (d) if the drift was caused by an out-of-band manual edit, write a one-paragraph note in docs/INCIDENTS.md so the team learns the exact failure mode.

Deprecation

No spec is deleted. Deprecation is a four-stage transition; skipping a stage is forbidden.

  1. Marked β€” status: Deprecated, consumed_by rewritten to point at the replacement Spec ID. Page banner added at the top: "This spec is deprecated. See {replacement}." All downstream consumers are notified in the next daily digest.
  1. Quarantined β€” sync_targets cleared. Any file previously owned by this spec is reassigned to the replacement in the same pass. spec-registry-lint enforces zero overlap. The page remains readable but is no longer indexed by RAG.
  1. Sunset β€” the page is moved under the master hub's /_archive sub-page. It remains addressable by URL forever; new Claude Code sessions are instructed never to consume it. Cursor rules referencing the old Spec ID are auto-rewritten to point at the replacement.
  1. Tombstoned β€” after one major release cycle (or 6 months, whichever is longer), the page is reduced to a single redirect callout and a CHANGELOG_AI entry. Body is preserved in Git history of the repo mirror so audits can replay any past state.

A deprecated spec may be un-deprecated only by a same-pass PR that documents why the replacement failed and re-establishes the previous spec as canonical; this is rare and requires two-eyes review at the Architecture tier or higher.

0 Β· TL;DR

A structured AI coding workspace where a user gives a real software task to an AI agent, and the system manages:

  • project workspace (cloned repo on the server)
  • code inspection (routes, controllers, models, migrations, services, jobs, events, policies, config)
  • RAG context (pgvector-backed, project-scoped)
  • file changes (tracked, hashed, diffed)
  • terminal commands (allowlist + blocklist, sandboxed)
  • Git (branch-per-run, snapshots, optional commit/push)
  • snapshots and revisions (pre-run, pre-command, final)
  • live console log (every event, every payload, streamed via SSE)
  • automatic documentation update (PROJECT_MAP, DATABASE_SCHEMA, ARCHITECTURE_DIAGRAMS, etc.)
  • multiple specialized agents (Architect, Backend, Frontend, iPhone, RAG, QA, DevOps, Documentation)
  • providers: OpenAI, Claude API, Claude Code, local shell runner
  • iPhone-first SwiftUI client driven by a clean REST/SSE API

It is not a chatbot. It is an execution platform with full auditability and safe recovery.

1 Β· Product Pillars

🎯

Real code, real results

The agent operates on a real cloned repo, not on pasted snippets.

🧠

Context before action

RAG must be queried before any plan or edit. Never guess when context exists.

πŸ›‘οΈ

Safe by default

Snapshots, allowlists, branch-per-run, manual approval before push.

πŸ“œ

Everything is logged

Every event, command, file change, RAG hit and Git op is persisted.

πŸ”„

Pause / resume

Agents can stop for user input and resume exactly where they left off.

πŸ“±

Two clients, one brain

Laravel Control Center and iPhone SwiftUI app both drive the same API with full feature parity.

2 Β· Specification Pack Index

πŸ“š

Numbered for direct 1:1 mirroring into the docs/ folder of the codebase.

Each child page is self-contained and can be exported as a Markdown file.

Sub-pages will be created below. They form the canonical documentation set:

  1. 00 β€” Product Overview & Goals
  1. 01 β€” Platform Strategy & Stack
  1. 02 β€” Backend Modules & Data Model
  1. 03 β€” Database Migrations
  1. 04 β€” RAG System Design
  1. 05 β€” Agent Providers & Specialized Agents
  1. 06 β€” Claude Code Integration
  1. 07 β€” OpenAI API Integration
  1. 08 β€” Server Params & Configuration
  1. 09 β€” Git Workflow & Safety
  1. 10 β€” Auto Documentation System
  1. 11 β€” Cursor Rules Pack
  1. 12 β€” Console Log UI Spec
  1. 13 β€” iPhone SwiftUI App Spec
  1. 14 β€” API Endpoints Reference
  1. 15 β€” Security Rules & Threat Model
  1. 16 β€” PROJECT_MAP / DATABASE_SCHEMA / DIAGRAMS templates
  1. 17 β€” Implementation Roadmap
  1. 18 β€” Laravel Web Admin Panel & Control Center Spec

Build prompts (executable):

  • B0 β€” Production Infrastructure (CentOS + LiteSpeed + Laravel + MySQL) β€” server-build authoritative source.
  • B1 β€” Laravel Web App Core + SQL Database β€” app-skeleton authoritative source.

Global features (cross-cutting specs):

  • F1 β€” Global AI Text Selection Editor (Notion-AI-style layer) β€” app-wide select-to-AI overlay across every text surface; wired into B1, B5, B6, pages 14, 15, 18.

Claude Code (developer & in-app rules):

  • C1 β€” Claude Code Setup Guide & HOW TO START.md β€” the developer-side onboarding (install, first prompt, slash commands, MCP servers, safety rails, the verbatim HOW TO START.md file).
  • C2 β€” Claude Code Project Bundle (.claude/ files) β€” authoritative bodies for CLAUDE.md, .claude/PROJECT_CONTEXT.md, .claude/RULES.md, .claude/TOOLS.md, .claude/WORKFLOW.md, .claude/settings.json, sub-agents, slash commands, hooks. The same bundle is loaded by the in-app ClaudeCodeAgentService (page 06) β€” one bundle, two surfaces.

3 Β· System at a Glance

flowchart LR
	Web(["Web operator<br>Filament + Livewire"]) -->|HTTPS + Reverb WS| API["Laravel API + Control Center"]
	IOS(["iPhone operator<br>SwiftUI"]) -->|HTTPS + SSE| API
	API --> Orchestrator["AgentRunOrchestrator"]
	Orchestrator --> Providers{"Provider"}
	Providers -->|OpenAI API| OAI["OpenAI"]
	Providers -->|Claude API| CLA["Anthropic"]
	Providers -->|Claude Code adapter| CC["Claude Code CLI"]
	Orchestrator --> RAG["RagContextService<br>pgvector"]
	Orchestrator --> WS["WorkspaceService<br>(isolated repo)"]
	Orchestrator --> GIT["GitService"]
	Orchestrator --> SNAP["SnapshotService"]
	Orchestrator --> DOCS["DocumentationAutoUpdateService"]
	Orchestrator --> EVT["ConsoleEventService<br>(agent_events)"]
	EVT -->|SSE / WebSocket| API
	WS --> FS[("Project workspace<br>on disk")]
	RAG --> PG[("PostgreSQL + pgvector")]
	EVT --> PG
	SNAP --> S3[("Snapshot store")]

4 Β· Agent Run Lifecycle

stateDiagram-v2
	[*] --> draft
	draft --> queued: start()
	queued --> running: worker picked up
	running --> waiting_for_user: agent needs input
	waiting_for_user --> running: user responds
	running --> paused: user pause()
	paused --> running: resume()
	running --> completed: final_summary
	running --> failed: fatal error
	running --> cancelled: user cancel()
	completed --> [*]
	failed --> [*]
	cancelled --> [*]

5 Β· Core Design Decisions

  • Why Laravel 11 + Horizon + Redis + PostgreSQL + pgvector
    • Laravel 11 gives a mature HTTP/queue/auth stack and Sanctum for token auth out of the box.
    • Horizon makes long-running agent jobs observable and supervisable.
    • Redis is the event bus for SSE/WebSocket fan-out, queue backend, and short-lived locks (one agent per project workspace at a time).
    • PostgreSQL is the durable store. pgvector is preferred for rag_chunks.embedding. If the existing app is on MySQL, the abstraction layer (RagContextService) keeps the storage backend swappable.
  • Why branch-per-run + snapshots
    • Every run gets its own Git branch agent/run-{run_id}-{slug}. The default branch is never modified by an agent.
    • A pre_run snapshot (tar + commit hash) is created before any change. A pre_command snapshot is created before any destructive command.
    • Restoring a snapshot is always possible without losing audit history.
  • Why provider-agnostic agents
    • AgentProviderInterface abstracts OpenAI, Claude API, Claude Code, and local shell runner.
    • Same RAG, same workspace, same event log β€” only the model/tool layer changes.
    • Adding a new provider is a single class implementing the interface.
  • Why web-first, mobile-supported
    • The Laravel Control Center is the primary operator surface: admin, RAG inspector, diff review, plan/approve, server params, audit log.
    • The iPhone app is a fully-featured remote with full feature parity β€” same API, same events, same actions. Parity is enforced by a CI contract test.
    • The API is designed to serve both transports cleanly: WS over Reverb for the web client, SSE for the iPhone client, both fanned out from one ConsoleEventService::publish().
    • Earlier wording called this "iPhone-first". That is superseded.
  • Why LiteSpeed + lsphp on CentOS-compatible Linux
    • LSWS LSAPI is markedly faster than PHP-FPM for PHP workloads and ships native HTTP/2 + HTTP/3 (QUIC). The iPhone client benefits directly from QUIC on mobile networks.
    • CentOS-compatible (AlmaLinux 9 / Rocky 9) gives long-support RPM packaging, SELinux enforcing, and is widely supported by managed-hosting providers.
    • The full infra and tuning lives in B0; this page only references it.

6 Β· Top-Level Folder Layout (target)

app/
	Http/Controllers/Api/
	Models/
	Services/
		Agents/
			OpenAIAgentService.php
			ClaudeAgentService.php
			ClaudeCodeAgentService.php
			AgentRunOrchestrator.php
		Rag/
			RagContextService.php
			ProjectIndexer.php
		Workspace/
			WorkspaceService.php
			CommandExecutionService.php
			SnapshotService.php
		Git/
			GitService.php
		Docs/
			DocumentationAutoUpdateService.php
			ProjectMapService.php
			SchemaAnalyzerService.php
		Events/
			ConsoleEventService.php
	Jobs/
	Events/
	Listeners/
config/agent_workspace.php
database/migrations/
docs/
	PROJECT_CONTEXT.md
	PROJECT_MAP.md
	DATABASE_SCHEMA.md
	ARCHITECTURE_DIAGRAMS.md
	API_ENDPOINTS.md
	RAG_SYSTEM.md
	AGENT_WORKFLOW.md
	CLAUDE_CODE_INTEGRATION.md
	OPENAI_INTEGRATION.md
	SERVER_PARAMS.md
	GIT_WORKFLOW.md
	IPHONE_APP_PLAN.md
	SECURITY.md
	CHANGELOG_AI.md
.cursor/rules/
	project-overview.mdc
	architecture.mdc
	database.mdc
	rag-system.mdc
	agent-workflow.mdc
	git-workflow.mdc
	testing.mdc
	security.mdc
	iphone-first.mdc
	documentation-auto-update.mdc
.claude/
	PROJECT_CONTEXT.md
	RULES.md
	TOOLS.md
	WORKFLOW.md
ios/
	AgentWorkspace.xcodeproj/
	AgentWorkspace/...

7 Β· Non-Goals (explicit)

Each non-goal below is intentional. Adding any of these reopens the architecture lock and requires a SPEC-HUB minor bump with a written rationale that survives reviewer-set sign-off.

  • No Android client in v1. SwiftUI iPhone is the only mobile-native surface in v1. Rationale: parity is hard to enforce across two native platforms during iPhone bring-up; mobile-web covers Android users until a dedicated Android spec is written.
  • No multi-tenant org/team model in v1 β€” single-owner workspaces with API tokens. Rationale: tenancy invariants leak into every policy, query, and cache key; defer until the single-tenant path is hardened.
  • No web IDE β€” file edits are applied by the agent, reviewed in diff form. Rationale: an in-app IDE would compete with Cursor / Claude Code without adding leverage; diff review is sufficient at this stage.
  • No automatic push to remote. Push is always a deliberate user action. Rationale: an in-repo agent that can push can also publish bad commits; the human gate is mandatory.
  • No execution of arbitrary unsigned shell commands. Allowlist only (see .claude/settings.json). Rationale: a misbehaving model plus an open shell equals a production outage; the allowlist is the seatbelt.
  • No PostgreSQL or pgvector as default. Opt-in only behind the RAG abstraction. Rationale: MySQL 8 / MariaDB 11.4+ is the production lock; pgvector lives as an opt-in upgrade path for very large RAG indexes.
  • No Notion branding, logo, exact UI, proprietary design, colors, design tokens, or icon set anywhere in the shipping product. Rationale: the product is an original high-end design; the inspiration is Notion-class quality, not Notion-clone surface.
  • No agent self-modification of Notion content from the repo. Repo edits propose changes to Notion via docs/CHANGELOG_AI.md; humans apply them. Rationale: Notion is the human-curated source of truth; one-way mirroring is the only safe direction.

8 Β· Glossary

TermMeaning
ProjectA real software codebase cloned into an isolated server workspace.
RunOne coding task given to one agent on one project. Has a lifecycle and a branch.
EventA row in agent_events. The atomic unit of the console log.
SnapshotA point-in-time recovery artifact (Git commit + optional tar archive).
ProviderAn implementation of AgentProviderInterface (OpenAI, Claude API, Claude Code, local).
Specialized agentA higher-level role (Architect, Backend, …) that selects prompts, tools and a provider.
RAG chunkOne indexed, embedded fragment of project context in rag_chunks.
Project MapThe canonical route ↔ controller ↔ model ↔ table ↔ service relationship doc.
STV sub-packThe integrated AI-Powered Professional Documentation Workspace sub-pack (StevoApp Β· SPEC-STV-HUB v1.3.0, project-final polish), the second product line of this project, physically nested under this hub. See πŸ“˜AI-Powered-Documentation-Workspace and Β§9.

9 Β· Integrated Second Product Line Β· AI-Powered Documentation Workspace (STV)

🧩

Merged into project v1.3.0. This project now hosts two product lines under one master hub: (1) AI Coding Agent platform (the original scope of this pack, SPECs HUB / B0 / B1 / F1 / C1 / C2 / 00–18), and (2) AI-Powered Professional Documentation Workspace β€” the STV sub-pack at πŸ“˜AI-Powered-Documentation-Workspace (SPEC-STV-HUB v1.3.0, project-final polish), now physically nested as a sub-page of this hub. They share one Β§SoT system, one Spec Registry (this hub's Spec Registry points to the STV sub-registry at section 10 of the sub-pack), one CHANGELOG_AI, one reviewer pool. The two product lines remain conceptually distinct (different end users, different domain objects, different sync target trees) so contributors keep mental clarity; governance is unified.

Product Line Identity

DimensionProduct line A β€” AI Coding Agent platformProduct line B β€” AI-Powered Documentation Workspace (STV sub-pack)
Spec rootSPEC-HUB v1.4.0 β€” this page (master hub of the whole project)SPEC-STV-HUB v1.3.0 β€” πŸ“˜AI-Powered-Documentation-Workspace, nested under this master hub
End userOperator / engineer running coding agents on real repos.Knowledge worker creating, organizing, improving, rewriting, summarizing, publishing and maintaining professional documentation with AI.
Primary surfaceLaravel Control Center + iPhone SwiftUI client, both clients of the same Laravel API.Block-based web editor (Livewire 3 + Alpine + Tailwind), mobile-responsive from day one; future SwiftUI client.
Domain objectProject Β· Run Β· Event Β· Snapshot Β· Agent Β· RAG chunk.Workspace Β· Page Β· Block Β· Database Β· View Β· Template Β· Comment Β· Share Β· RAG chunk.
SQL layerMySQL 8 / MariaDB 11.4+ (B0 lock).MySQL 8 / MariaDB 11.4+ (same lock).
RealtimeSSE for console; WS via Reverb for Filament.WS for autosave / presence; SSE for AI token streaming.
RAG storerag_chunks (MySQL JSON default; pgvector opt-in).rag_chunks (MySQL JSON default; pgvector opt-in).
Admin layerFilament (operator-facing).Filament (admin-only; end users never see Filament).
AuthorityConstitutional (this pack).Constitutional (its own pack).

Scope Boundary

  1. No mixing of domain objects. A Run belongs to product line A (Coding Agent); a Page belongs to product line B (STV). Neither product line imports the other's tables, routes, controllers, services, or Livewire components.
  1. Co-hosted in one Laravel repo, isolated by namespace. Both product lines may ship in the same Laravel repo. Each lives under its own service namespace (app/Services/Agents/** vs app/Services/Pages/**); migrations are non-overlapping; route prefixes are distinct (/api/v1/runs/* vs /api/v1/pages/*); Filament panels live under distinct route prefixes.
  1. No cross-citation in RAG by default. Product line A's RAG indexes project code and coding-run history; product line B's RAG indexes user-authored documentation. A workspace in one is never a workspace in the other unless an explicit, audited bridge service is built (see Β§9.5 candidate #2; opt-in, off by default).
  1. One user account model is allowed but not required. When both product lines ship together, identity SHOULD use one users table with role grants per product line. SSO via OAuth/OIDC is the supported alternative; no foreign-key join from one product line's tables into the other.
  1. One admin surface, two Filament panels (or one with two clusters). A single operator can administer both product lines; permissions are split by Filament policy.

Shared Doctrine

  • The Source of Truth system (authority hierarchy, conflict ladder, sync-target ownership, change-management protocol, CI guards).
  • The architecture posture lock: MySQL/MariaDB as SQL source of truth; Redis 7; Horizon; Laravel 11/12; no PHP-FPM-as-default, no PostgreSQL-as-default, no Nginx-as-default.
  • The forbidden lists (each product line maintains its own; the union is enforced project-wide β€” no Notion branding / logo / exact UI / proprietary design / colors / copyrighted elements anywhere in the product).
  • The preview-gate principle for AI: AI never auto-applies to user content; user must explicitly accept / replace / insert / discard.
  • The CHANGELOG_AI.md discipline: append-only, one line per AI-assisted change, dated, attributed by role, formatted <YYYY-MM-DD> | SPEC-<id> | <author role> | <semver> | <one-line summary>.
  • The secrets hygiene rules: no provider API keys in frontend, no sk-* / ghp_* / AWS keys / JWTs in any committed file, secret-scan in CI.

Promotion Path

StepActionGate
1. ProposeOpen a section in the source product line's roadmap (docs/17-roadmap.md for product line A; equivalent in STV) describing the candidate idea, why it belongs in the other product line, and what API / contract it would expose.Product architect signs off as the source of the proposal.
2. MirrorCreate a new spec in the target product line's Registry (NOT in the source). Assign owner role from the target product line's roster.Registry version bump in the target product line.
3. CiteAdd a consumed_by: line in the source spec pointing at the new target spec; add a depends_on: line in the target spec pointing at the source idea.Two-eyes review across product lines.
4. ImplementCode lands in the target product line's sync targets only. No source product line files are edited as part of the promotion.CI green on the target product line; CHANGELOG_AI.md line on both sides referencing each other.
5. CloseSource product line's roadmap entry flips to Promoted β†’ SPEC-XXX-YY. Source spec is not deleted; it stays as a reference cross-link.Product architect sign-off on both product lines.

Cross-Pollination Ideas

  1. Run report β†’ documentation page. When a coding-agent run completes (product line A), optionally export its final report into product line B as a page under a designated workspace, with the run summary, diff, and snapshot links rendered as blocks. Owner candidate: AI workflow lead (source) + Frontend lead (target).
  1. Documentation page β†’ agent context. Allow product line A's RagContextService to read-only consume product line B's published documentation pages of a designated workspace as additional context, via a signed read-only token and a dedicated consumed_workspaces whitelist. Strictly opt-in per coding-project.
  1. Selection editor parity. Both product lines ship a select-to-AI overlay (F1 in product line A; SPEC-STV-08 / SPEC-STV-13 in product line B). The prompt action vocabulary (improve / rewrite / shorter / longer / simplify / professional / translate / summarize / outline) is kept verbatim-identical across product lines so a single .cursor/rules/*.mdc AI-action lint passes in both.
  1. CHANGELOG_AI line format. Standardized <YYYY-MM-DD> | SPEC-<id> | <author role> | <semver> | <summary> across both product lines so a single tool can lint both logs (now part of shared doctrine in Β§9.3).
  1. Shared claude-rules-lint core. Extract the verbatim-block linter into a shared internal package consumed by both product lines (each product line supplies its own canonical block).
  1. Public read-only documentation host. Product line B's public-page reader (tokenized link + premium mobile reader) could expose read-only run reports from product line A as a publish target. Strictly opt-in; same threat-model gates as the STV /public/{token} endpoint.

Conflict Rule

When something is genuinely shared (doctrine in Β§9.3) and the two product lines ever disagree, the version on this master hub (SPEC-HUB) is the doctrinal anchor for both, because the master hub defined the Source of Truth system first. Any STV sub-pack page that contradicts Β§9.3 must either bump its version with an explicit rationale (and update the doctrine on the master hub in the same edit pass) or revise to match. There is no silent divergence within the project.

Linked Artifacts

  • STV sub-pack sub-specs (current count: 14): SPEC-STV-00 Product Overview, -01 Architecture & Modules, -02 Database Schema, -03 API Endpoints, -04 Editor System & 28 Block Types, -05 Databases / Tables, -06 Template System, -07 RAG Knowledge Base, -08 AI Writing Assistant, -09 Search, -10 Mobile & Desktop UX, -11 Sharing / Permissions / Security / Scalability / Admin, -12 Comments / Activity / Import-Export / Testing / Docs / CHANGELOG, -13 Mobile Gestures & Text Selection Editor.
  • Mirror path in repo (if co-hosted): docs/RELATED_PACKS.md β€” generated from this section, owner Docs lead.

10 Β· Production-Ready Build Prompt for Claude Code

πŸš€

This is THE prompt. Paste the block in Β§10.3 into Claude Code (or Cursor with the Claude provider) as the first message of a fresh session at the repo root. It transplants the Source of Truth system into the agent's working memory, locks every architectural ban, names every Spec ID with its sync targets, and gives a deterministic 14-phase build plan that ends in a production-deployable system. Iterations always resume from the last green CI commit β€” never from a "best guess".

Why This Exists

The Notion pack is the spec. The repo is the implementation. The bridge between them is this prompt. It does four jobs at once: (1) it transplants the Source of Truth system into Claude's working memory, (2) it forbids the things this project bans (Nginx, PHP-FPM, PostgreSQL-as-default, etc.), (3) it routes the agent to the correct sync targets per Spec ID, and (4) it gives a phased, gated execution plan so Claude does not invent features that are not in the Registry.

How to Use

  1. Clone the repo. Open Claude Code at the repo root (claude CLI, or via Cursor / IDE plugin).
  1. Confirm the C2 bundle exists: CLAUDE.md, .claude/RULES.md, .claude/PROJECT_CONTEXT.md, .claude/TOOLS.md, .claude/WORKFLOW.md, .claude/settings.json, docs/SPEC_REGISTRY.md, docs/00-product-overview.md. If missing, the first session creates them from the Notion specs.
  1. Paste the prompt in Β§10.3 as the first message.
  1. Approve plans before edits. Approve commands before they run (allowlist in .claude/settings.json).
  1. Every PR opened by Claude Code MUST: (a) cite one Spec ID, (b) update the matching Registry row if version changed, (c) append a CHANGELOG_AI.md line, (d) pass claude-rules-lint, spec-registry-lint, secrets-scan, the Pest suite, and php artisan agent-workspace:diagnose.

The Prompt

# Role
You are a senior staff engineer, Laravel architect, RAG engineer, SwiftUI engineer, and DevOps lead, working as the in-repo coding agent for the AI Coding Agent Workspace project. The project has TWO product lines under ONE master hub (SPEC-HUB v1.4.0+): (A) AI Coding Agent platform β€” operator-grade execution surface for code, and (B) AI-Powered Professional Documentation Workspace (STV sub-pack, SPEC-STV-HUB v1.2.0+) β€” end-user documentation OS. You implement both, but you never blur their domain objects.

# Doctrine (read in this order, then keep loaded for the whole session)
1. `CLAUDE.md` β€” root rules. The architecture-lock verbatim block lives here.
2. `.claude/RULES.md`, `.claude/PROJECT_CONTEXT.md`, `.claude/TOOLS.md`, `.claude/WORKFLOW.md` β€” the C2 bundle.
3. `docs/SPEC_REGISTRY.md` β€” mirror of the Notion Spec Registry. Every PR MUST cite a Spec ID from this file.
4. `docs/00-product-overview.md` and the rest of `docs/*.md` β€” the mirrored Notion spec pages.
5. `.cursor/rules/*.mdc` β€” Cursor-style rule files (also consulted by you).
You operate under the Source of Truth hierarchy: Constitutional > Architecture > Specification > Implementation > Reference. Higher beats lower in every conflict. Stop and surface conflicts; never silently pick one.

# Production stack (LOCKED β€” do not propose alternatives)
- OS: CentOS-compatible (AlmaLinux 9 / Rocky 9), SELinux enforcing.
- Web server: LiteSpeed Web Server + lsphp 8.3 (LSAPI). Never Nginx. Never Apache. Never PHP-FPM.
- Framework: Laravel 11 (12 when GA). Sanctum tokens for API. Filament v3 for admin only.
- SQL: MySQL 8 / MariaDB 11.4+. Never PostgreSQL as default (opt-in upgrade path only).
- Cache / queue / pub-sub / locks: Redis 7. Horizon for workers. Reverb for WS. SSE for AI token streaming.
- Storage: S3-compatible (S3 / R2 / MinIO). Signed URLs only for private files.
- AI providers: OpenAI + Anthropic accessed via `app/Services/Ai/**` and `app/Services/Agents/**`. Never call providers from JS or Swift.
- RAG: `rag_chunks` table (MySQL JSON default; pgvector opt-in via abstraction).
- Clients: Laravel web Control Center (Livewire 3 + Alpine + Tailwind for STV; Filament for product line A admin) and iPhone SwiftUI (product line A only in v1). Android is banned in v1.
- Multi-tenant org/team model: banned in v1. Single-owner workspaces with API tokens.

# Behavioural rules
- Plan before code. Output a numbered plan, then await approval before edits.
- One Spec ID per PR. Title format: `SPEC-<id>: <short summary>`.
- Bump version in `docs/SPEC_REGISTRY.md` when a spec changes; append a `CHANGELOG_AI.md` line: `<YYYY-MM-DD> | SPEC-<id> | <role> | <semver> | <one-line summary>`.
- Never edit Notion content from the repo. If a spec is wrong, open a `CHANGELOG_AI.md` proposal entry and stop.
- Never auto-apply AI text edits to user content. Preview-gate is mandatory (replace / insert below / copy / discard).
- Never push to remote. `git push` is a deliberate human action.
- Allowlist for shell commands lives in `.claude/settings.json`. If a command is not on the allowlist, propose it and wait.
- Snapshots: `pre_run` (tar + commit hash) before any run; `pre_command` before any destructive command.
- Branch per run: `agent/run-{run_id}-{slug}`. Default branch is never modified by you.
- Two-eyes review minimum for Architecture+ specs. One-eye minimum for Specification.

# Hard forbids (do not propose, do not configure, do not install)
Nginx Β· Apache Β· PHP-FPM Β· PostgreSQL-as-default Β· pgvector-as-default Β· Qdrant Β· Milvus Β· Weaviate Β· Android Β· multi-tenant org/team in v1 Β· direct OpenAI / Anthropic / Claude Code calls from JS or Swift Β· controllers over 200 LOC Β· raw editor HTML without server-side sanitization Β· `SELECT *` on hot paths Β· unsigned URLs for private files Β· public share links without tokenized URL Β· Notion branding / logo / exact UI / proprietary design / colors / copyrighted elements anywhere in the product.

# Phased build plan (deterministic; advance phase only when the previous is green)
P0 β€” Foundation: SPEC-B0 (server), SPEC-B1 (Laravel core), SPEC-C1+C2 (Claude bundle), SPEC-03 (migrations skeleton). Acceptance: `php artisan migrate` green; LiteSpeed + lsphp 8.3 serving HTTPS; Redis + Horizon healthy.
P1 β€” Coding-agent core (product line A): SPEC-02, SPEC-05, SPEC-06, SPEC-07, SPEC-09, SPEC-14, SPEC-15. Acceptance: end-to-end agent run on a test repo with snapshot + diff + Console SSE.
P2 β€” Coding-agent surface: SPEC-04 (RAG), SPEC-08 (server params), SPEC-10 (auto-docs), SPEC-12 (Console UI), SPEC-18 (Filament Control Center), SPEC-13 (iPhone). Acceptance: web Control Center and iPhone client both drive an agent run; parity test green.
P3 β€” STV foundation (product line B): SPEC-STV-01, SPEC-STV-02, SPEC-STV-03. Acceptance: users / workspaces / pages / page_blocks CRUD with autosave on web and mobile.
P4 β€” STV editor: SPEC-STV-04 (28 block types + version history), SPEC-STV-06 (templates). Acceptance: slash menu, drag handle, floating toolbar, autosave reliable, version restore working.
P5 β€” STV databases: SPEC-STV-05 (databases / tables / views). Acceptance: table / board / list / gallery / calendar views with server-side filter and sort.
P6 β€” STV collaboration: SPEC-STV-11 (shares, permissions, security, scalability, admin), SPEC-STV-12 (comments, activity, import / export, testing, docs, CHANGELOG). Acceptance: per-user shares + tokenized public links + Filament admin + audit log.
P7 β€” STV AI + RAG: SPEC-STV-07 (RAG), SPEC-STV-08 (AI writing assistant), SPEC-STV-13 (mobile gestures + selection editor). Acceptance: preview-gated AI on selection across all surfaces; RAG citations to internal pages.
P8 β€” STV search: SPEC-STV-09 (Meilisearch via Scout; FULLTEXT fallback). Acceptance: Cmd/Ctrl+K palette across pages / blocks / files / comments / databases.
P9 β€” STV mobile + desktop polish: SPEC-STV-10. Acceptance: mobile-web fluent for editor / search / share / AI / RAG.
P10 β€” Cross-pollination (opt-in): Β§9.5 #1 (Run report β†’ STV page) and Β§9.5 #2 (STV page β†’ agent context). Acceptance: signed-token bridge with audited consumption whitelist.
P11 β€” Hardening: secrets-scan, secret rotation runbook, rate limits, IDOR test sweep, signed-URL audit, queue retry caps, failed-job alerting.
P12 β€” Performance: indexes verified; N+1 sweep; cache warming; Meilisearch tuning; LSWS LSAPI process model tuned.
P13 β€” Release: tag; mirror Registry to `docs/SPEC_REGISTRY.md`; generate `docs/PROJECT_MAP.md` + `docs/DATABASE_SCHEMA.md` + `docs/ARCHITECTURE_DIAGRAMS.md`; build deployment artefact; smoke-test on staging; cut release notes from `CHANGELOG_AI.md`.

# First action right now
1. Run `php artisan agent-workspace:diagnose` if available; otherwise list what is missing.
2. Open `docs/SPEC_REGISTRY.md` and confirm every Spec ID above has a row.
3. Output the current phase (P0–P13), the next Spec ID you will tackle, the proposed plan, and the proposed Git branch name.
4. Wait for approval before any file edit or shell command.
{
  "tools": {
    "bash": {
      "allow": [
        "php artisan *",
        "composer install",
        "composer require *",
        "npm install",
        "npm run *",
        "git status",
        "git diff *",
        "git log *",
        "git branch *",
        "git checkout -b agent/run-*",
        "git add *",
        "git commit -m *",
        "vendor/bin/pest *",
        "vendor/bin/phpstan *",
        "vendor/bin/pint *"
      ],
      "deny": [
        "rm -rf /",
        "git push *",
        "git reset --hard *",
        "sudo *",
        "curl * | sh",
        "wget * | sh",
        "* /etc/*",
        "mysql -e 'DROP *",
        "psql -c 'DROP *"
      ]
    }
  }
}

Acceptance Gates

  1. claude-rules-lint green on CLAUDE.md + .claude/RULES.md + .claude/PROJECT_CONTEXT.md + docs/00-product-overview.md.
  1. spec-registry-lint green: every sync_target exists OR its spec is Planned; no two specs claim the same primary sync_target; every depends_on Spec ID exists.
  1. secrets-scan green on every commit (no sk-*, ghp_*, AWS keys, JWTs).
  1. Pest test suite green (feature + unit + policy + API contract + Livewire + parity).
  1. CI parity test green: Laravel Control Center and iPhone client drive the same agent-run state machine identically.
  1. php artisan agent-workspace:diagnose reports zero drift.
  1. LiteSpeed + lsphp 8.3 + MySQL 8 / MariaDB 11.4+ + Redis 7 + Horizon + Reverb confirmed in production; HTTPS via Let's Encrypt; Supervisor managing queues; SELinux enforcing.
  1. STV /public/{token} rate-limited; signed URLs only for private files; HTML sanitizer pass on every editor write.
  1. CHANGELOG_AI.md lines present for every spec touched during the release.
  1. No banned dependency anywhere in composer.json / package.json / server packages.

Day-One Loop

  1. Open the master hub (this page). Pick the next Spec ID for the current phase.
  1. Open Claude Code at the repo root. Paste the Β§10.3 prompt as turn 1.
  1. Approve the plan on turn 2. Approve commands as they come.
  1. Review the diff. Merge to main only via PR with green CI.
  1. After merge: bump the Registry row version, append a CHANGELOG_AI.md line, mirror the Notion spec page if its content changed, close the issue.
  1. Loop to step 1.

11 Β· Open issues, known gaps & next-pass agenda

The following items are deliberately tracked here at hub level rather than buried inside a single spec β€” they cut across the project and need explicit cross-pollination decisions. Treat this section as the canonical backlog of follow-ups; everything not here is either landed in a spec or out of scope.

Doc-System Gaps

  1. C1 (C1 β€” Claude Code Setup Guide) orphan tail. Duplicate Β§17/Β§18/Β§19 footer and a DELETE_ME_ORPHAN_MARKER sentinel still present at the bottom of C1; needs a targeted cleanup pass with a safer anchor than was tried previously. Owner: developer-tooling lead.
  1. C2 (C2 β€” Claude Code Project Bundle) Part B bodies (Β§15–§26) never landed. Only headings exist; the deeper sub-agent / slash-command / hook bodies are still pending. Estimated ~3500 words; should be applied in three update passes, one tier at a time, to avoid render-stripping adjacent headings.
  1. Β§10.4 heading was stripped during a previous render of this page; restore via a small targeted edit with safer fencing β€” do not re-paste the Β§10.3 prompt block in the same pass.
  1. SoT spec-header callout rollout (Spec Header) still missing on 23 of 25 pages in the pack. This is Phase 2 of the Rollout Plan. Each page needs the same 12-line YAML callout at the top, filled per Registry row.

Pending Cross-Pack Ideas

  1. Shared claude-rules-lint core (Β§9.5 #5) β€” extract the verbatim-block linter into a small internal package consumed by both product lines; each product line supplies its own canonical block.
  1. Public read-only documentation host for run reports (Β§9.5 #6) β€” depends on STV /public/{token} rate-limiter and threat-model gates being audited first.
  1. Run report β†’ STV page (Β§9.5 #1) β€” first cross-product-line bridge; needs an audited consumption whitelist and a signed read-only token spec landed before any code touches it.

Repo Mirrors Pending

  • docs/RELATED_PACKS.md β€” mirror of Β§9 of this hub.
  • docs/CLAUDE_CODE_BUILD_PROMPT.md β€” verbatim mirror of Β§10.3.
  • docs/SPEC_REGISTRY.md β€” mirror of the Spec Registry.
  • docs/CHANGELOG_AI.md β€” seed file; append-only thereafter.

All five are blocked on the first Claude Code bootstrap session (Β§6 of the HOW TO START guide). They are listed in C2's sync targets but produced by the repo, not by Notion.

Versioning Calendar

VersionWhat triggers itReviewer set
Patch (x.y.Z)Wording fix, typo, broken link, clarification with no behavioural change.Spec owner only.
Minor (x.Y.0)Additive change: new section, new acceptance criterion, new sync target, new forbidden item.Spec owner + one reviewer of a different role.
Major (X.0.0)Breaking change: sync target removed or renamed, contract renamed, authority level changed, forbidden item removed.Product architect + two reviewers; CHANGELOG_AI.md line marked BREAKING.

12 Β· Operating cadence & review rhythm

The Source of Truth system needs a heartbeat or it drifts. Treat the following as the doctrinal cadence; deviations require an explicit CHANGELOG_AI.md entry with a cadence-skip tag and a one-line rationale.

Daily

  1. Open the master hub; pick the next Spec ID in the current phase from the Spec Registry.
  1. Paste Β§10.3 prompt as turn 1 of a Claude Code session at the repo root.
  1. Approve plan; approve commands; review diff; merge PR with green CI.
  1. Bump the Registry row if the spec content changed; append a CHANGELOG_AI.md line.
  1. Snapshot any pre-run / pre-command artefacts (tar + commit hash) to the snapshot store.

Weekly

  1. Walk every row in the Spec Registry; flag any spec whose last_reviewed is older than 30 days.
  1. Run spec-registry-lint locally on the docs mirror; reconcile any drift back into Notion in the same edit pass.
  1. Read the week's CHANGELOG_AI.md lines; confirm one PR per line and no orphans.
  1. Resolve any cross-product-line conflicts surfaced during the week (Β§9.6 ladder).

Monthly

  1. Re-read the Authority Hierarchy and Conflict Resolution sections. Confirm no implicit drift in actual practice.
  1. Audit the Deprecated set; remove anything that has been replaced and is no longer cited.
  1. Tag a docs/SPEC_REGISTRY.md mirror release; cut release notes from CHANGELOG_AI.md.
  1. Refresh the forbidden list against the current ecosystem; bump SPEC-HUB minor if anything changes.

Quarterly

  1. Re-evaluate the locked stack (LiteSpeed, lsphp 8.3, MySQL/MariaDB, Redis 7) against major upstream releases. Unlock only after a written rationale lands in this hub.
  1. Run a tabletop incident exercise on STV /public/{token} abuse, RAG secret exfiltration, and snapshot restore correctness.
  1. Confirm secret rotation across every provider key (Anthropic, OpenAI, S3, Meilisearch admin).
  1. Re-read the Change Management protocol with the full pool; calibrate where it has eroded.

πŸ‘‡

The full detailed specs are split across the sub-pages below.

Open any sub-page to see the deep design for that area.

🧩

STV sub-pack link. πŸ“˜AI-Powered-Documentation-Workspace β€” opens the integrated second product line (StevoApp Β· SPEC-STV-HUB v1.3.0, project-final polish, physically nested as a sub-page of this hub).